Page 1 of 1

animation priority

PostPosted: Sun Feb 14, 2010 5:11 am
by buckdogg75
I'm making a car game and have the animations to turn wheels left and right.
Can i make it so that the wheels will default to straight if i'm holding down up and left/right key, although left/right is the last key i've pressed. Basically, an override or default state kind of thing, unless i can create animations for multiple keys and i've overlooked an obvious work around.
thanks

Re: animation priority

PostPosted: Mon Feb 15, 2010 3:49 pm
by thunderios
You can add a "change animation" on the "Key up (left/right)" event, but that might make your car moondrive, which you don't want.
Instead use a script like this:
Code: Select all
char *key = GetKeyState();
if((key[KEY_RIGHT] == 0 && key[KEY_LEFT] == 0) || (key[KEY_RIGHT] == 1 && key[KEY_LEFT] == 1))
{
  ChangeAnimation("Event Actor", "Wheels_Straight", FORWARD);
}
else if(key[KEY_LEFT] == 1)
{
  ChangeAnimation("Event Actor", "Wheels_Left", FORWARD);
}
else
{
  ChangeAnimation("Event Actor", "Wheels_Right", FORWARD);
}

I haven't tested it yet, so I might be wrong. And don't forget to change the Wheels_(direction) to the true animation names.

Re: animation priority

PostPosted: Wed Feb 17, 2010 6:27 pm
by buckdogg75
k thx