by TheRealMegamanX » Thu Dec 27, 2012 12:56 am
So far I did this script but it seems that the character does not wan to move only change directions but that last only for a second. When i push right it stops right when i push left it immediately goes to the direction but then shifts it direction to the right here's my script what I do wrong on it.
char *key=GetKeyState();
int dir=+key[KEY_RIGHT]-key[KEY_LEFT];
switch(dir)
{
case 0: //None or both
if(animindex==0)
{
ChangeAnimation("Event Actor", "CharStopLeft", NO_CHANGE);
}
else if(animindex==1)
{
ChangeAnimation("Event Actor", "CharStopRight", NO_CHANGE);
}
break;
case -1: //Left
x-=5;
ChangeAnimation("Event Actor", "CharLeft", NO_CHANGE);
break;
case 1: //Right
x+=5;
ChangeAnimation("Event Actor", "CharRight", NO_CHANGE);
break;
}