/*
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
Comments
0 B
|👍
/👎
0 B
|0 👍
/0 👎
0 B
|👍
/👎
0 B
|👍
/👎