Page 1 of 1

run animation

PostPosted: Thu Jun 07, 2012 11:44 am
by Behdadsoft
Hi.

I want run Full animation when press A key, for this work I used this script :
Code: Select all

char *key = GetKeyState();
int uper=key[KEY_a];
switch(uper)
{
case 1 :
{
if (Down==1)
{
   Down=0;
   ChangeAnimation("ShangTsung", "Shang-Uper1", NO_CHANGE);
 
}
}
break;
}


But the animation is not fully implemented.But when I hold down the key animation is fully implemented, While I like the animation by pressing once fully implemented.

Please Guide ME.

Re: run animation

PostPosted: Thu Jun 07, 2012 3:34 pm
by skydereign
What do you mean it is not fully implemented? If the animation doesn't finish because the animation changes to something else, then that is because you changed the animation in some other event. To prevent that, you have to create a variable to lock it in some way. I suggest using the state method when you come into conditions like this, as it locks it by default. But, to implement a variable to lock, create one, and set it to 1 when you change the animation to the one you want to be locked. Then in its animation finish event set it back to 0. Lastly, anywhere you have a different change animation, use an if statement to check if it is 0 before changing. This isn't a very nice solution though, so I do suggest you look into the state method. http://game-editor.com/State_Method

Re: run animation

PostPosted: Mon Jun 11, 2012 7:30 am
by Behdadsoft
Hi. :D
It will be fully implemented before the animation ends. It runs for a second and can not know exactly what does the animation runs.