I am developing a quite simple turn based board game and face different problems. The game flow is like that:
Player performs a move, after that I need to find all the objects that match a pattern and all of such objects considered scored. Depending on their health they either destoryed or just damaged. For all of them I need to perform some animation. After that goes second phase. Since I have scored objects, they could affect other objects on the board. And they have to change their state too, as well as animation for every one of them should be taken. Some of them may be destroyed too. After all that I need to refresh the board, adding new objects.
I explicitly decouple one phase from another, so we have three phases or states and maybe I did it wrong.
First of all, I don't know, when and where I should dispatch "actorDestroyed" event.
Because, after finding all that scored objects and sending event for everyone of them:
Animation system receives these events and plan animation. Also, all the other objects can receive those and react accordingly, whether they were affected, if so they also send events, that again animation system receives and so on.
Having written that I suddenly understood that I have first two phases merged together.
Thank you for your suggestions!
Seconldy, I don't know who to detect that second phase ended and I can start updating and refreshing the board. Because i have to wait for all those animations to end.
I had some thougths of wrapping all of it into processes, but right now I am not very clear how it would look like.
As a matter of fact, I have got so many questions that make me feel like a kid.
Player performs a move, after that I need to find all the objects that match a pattern and all of such objects considered scored. Depending on their health they either destoryed or just damaged. For all of them I need to perform some animation. After that goes second phase. Since I have scored objects, they could affect other objects on the board. And they have to change their state too, as well as animation for every one of them should be taken. Some of them may be destroyed too. After all that I need to refresh the board, adding new objects.
I explicitly decouple one phase from another, so we have three phases or states and maybe I did it wrong.
First of all, I don't know, when and where I should dispatch "actorDestroyed" event.
Because, after finding all that scored objects and sending event for everyone of them:
Animation system receives these events and plan animation. Also, all the other objects can receive those and react accordingly, whether they were affected, if so they also send events, that again animation system receives and so on.
Having written that I suddenly understood that I have first two phases merged together.
Thank you for your suggestions!
Seconldy, I don't know who to detect that second phase ended and I can start updating and refreshing the board. Because i have to wait for all those animations to end.
I had some thougths of wrapping all of it into processes, but right now I am not very clear how it would look like.
As a matter of fact, I have got so many questions that make me feel like a kid.
The post was edited 3 times, last by George ().