Design pattern for animation sequence in LibGDX

Posted by kevinyu on Game Development See other posts from Game Development or by kevinyu
Published on 2014-07-26T08:27:46Z Indexed on 2014/08/18 22:33 UTC
Read the original article Hit count: 450

Filed under:
|

What design pattern to use for sequence of animation that involve different actor in libGDX. For example I am making a game to choose a wolf from a group of sheeps. The first animation played when the game begin is the wolf enter the field that is filled with two sheeps.Then the wolf disguise as a sheep and goes to the center of the screen. Then the game will shuffle the sheeps. After it finished it will ask the player where is the wolf. The game wait for player input. After that the game will show animation to show the player whether their answer is right or wrong.

I am currently using State design pattern. There are four states wolfEnterState,DisguiseState,ShuffleState,UserInputState, and answerAnimationState. I feel that my code is messy. I use addAction with action sequence and action completion(new Runnable()) a lot. I feel that the action sequence is getting long. Is there a better solution for this kind of problem

© Game Development or respective owner

Related posts about java

Related posts about libgdx