animation priority

Non-platform specific questions.

animation priority

Postby buckdogg75 » Sun Feb 14, 2010 5:11 am

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
buckdogg75
 
Posts: 4
Joined: Thu Feb 11, 2010 2:34 am
Score: 0 Give a positive score

Re: animation priority

Postby thunderios » Mon Feb 15, 2010 3:49 pm

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.
thunderios
 
Posts: 87
Joined: Thu Jan 31, 2008 1:18 pm
Score: 1 Give a positive score

Re: animation priority

Postby buckdogg75 » Wed Feb 17, 2010 6:27 pm

k thx
buckdogg75
 
Posts: 4
Joined: Thu Feb 11, 2010 2:34 am
Score: 0 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest