Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- This is an example of the simplest solution I can think off.
- My question is: are there any good standard solutions / practices / patterns
- to deal with animation states? Especially as they get more complex than two states
- I imagine this solution being way too unwieldy to maintain.
- _idleAnimation and _turnAnimation are both members of the GameObject,
- and children of its DisplayList.
- */
- private function updateAnimationState(dx:Number):void
- {
- if(Math.abs(dx) < 4)
- {
- start(_idleAnimation);
- stop(_turnAnimation);
- }
- else
- {
- stop(_idleAnimation);
- start(_turnAnimation);
- _turnAnimation.scaleX = (dx < 0) ? 1 : -1; //flip left/right
- }
- }
- //EDIT: http://gamedev.stackexchange.com/questions/27079/data-driven-animation-states seems like a well researched comment
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement