by AliceXIII » Sat Aug 18, 2012 10:24 pm
im a little late on posting this but:
- Code: Select all
char*key=GetKeyState();
//int dir=key[KEY_d]-key[KEY_a]; the int dir doesn't need to exist
switch(key[KEY_d]-key[KEY_a]) // the switch is capable of taking the keys as straight input
{
case 0:
switch(animindex)
{
case 2: ChangeAnimation("Event Actor", "charStopLeft", NO_CHANGE);
break;
case 3: ChangeAnimation("Event Actor", "charStopRight", NO_CHANGE);
break;
}
spd=0;
break;
case 1:
spd = min(spd + 1, 7);
x+=spd;
ChangeAnimation("Event Actor", "charRight", NO_CHANGE);
break;
case -1:
spd = min(spd + 1, 7);
x-=spd;
ChangeAnimation("Event Actor", "charLeft", NO_CHANGE);
break;
}
just something i've known for awhile and decided you might want to know also, read the code insert around where you created the int dir and the switch
"Taking a breath of fresh air."