Page 1 of 1

Death animation

PostPosted: Wed May 22, 2013 6:27 pm
by hunter84
I'm back again and working on a new game. I set up a death animation for my character but you can move and it will cancel the animation. How can I freeze his movement so he does the animation before dieing without him moving. Thanks.

Re: Death animation

PostPosted: Wed May 22, 2013 6:58 pm
by skydereign
Probably the easiest way to do this is to disable keydown events for the actor.

Re: Death animation

PostPosted: Thu Jun 06, 2013 12:38 am
by Lokaar
you could try making player states like

int playerState=0

if(playerState==0)
{
idle state in here
put switches and cases for each button that has function while the player is in the idle state, same for each other player state
example, pushing a button while idle would begin switching over to walking state, play the roll-up anim, some slight movement, then:
playerState=1; //this would switch to the walking state from within the idle state, which means the next state would take over handling
}
if(playerState==1)
{
walking state in here
movement when pushing a button
}
if(playerState==2)
{
jumping state in here
}
if(playerState==3)
{
dead state in here
no movement defined
}

etc

also allows you to have things happen before switching to another state and when entering another state (such as animations to go from idle to walking before switching to walking state, and from walking to idle when switching back to idle state)
then, all you have to do is playerState=3; to make them die
this doesn't only have to be used for the player