Page 1 of 1
change animation in current direction
Posted:
Wed Mar 10, 2004 8:04 pm
by phractus
so i got a guy walking around and am trying to add in kicks and punches. How would i have it play the right animation for the right direction? So for example while walking left if space is hit it will kick left, while north it will show the kick north animation....etc. Also how can you have the diagnal movments? I cant figure out how to have something react to more than one key(up and left to show NW walking animation). Any and all help is apriacaiated.
~peace~
Posted:
Thu Mar 11, 2004 2:25 am
by makslane
Trye the "Walking Character Online Tutorial" in:
http://game-editor.com/forum/viewtopic.php?t=184
Posted:
Thu Mar 11, 2004 3:06 am
by phractus
The tutorial covers only NSEW movement. The only thing i dont understand is how to get it to start a action only when 2 different keys are held down(down and left, to move diagnol). As for the punches and kicks in a certain direction i think im ganna need to have a all purpose script that picks the right animation for the right direction.
~peace~
Posted:
Thu Mar 11, 2004 5:19 am
by phractus
ok figured out how to kick and punch in each direction. just when you move have it change a variable to a direction. Then when you hit the kick or punch button have it play the coorisponding animation for your direction by testing the direction variable. You can do this for anything that you need to animation to change depending on direction from a single button. This works good and i got my guy walking around kicking and punching. Still havent figured out diaganol movement but i think i am just ganna forget about it for now. Thanks for the help!
Why not try this for diagonal directions
Posted:
Thu Mar 11, 2004 12:49 pm
by ingsan
Why not try this for diagonal directions:
- Code: Select all
char *key= GetKeyState();
if(key[KEY_RIGHT]==1 && key[KEY_UP]==1)
{
x=x+3;
y=y-3;
// Change animation(like Punch_Right_&_Up or
Kick_Right_&_Up)
// Diagonal movements in +x and -y
// Just an example. U can put ur own code
}
if(key[KEY_LEFT]==1 && key[KEY_UP]==1)
{
x=x-3;
y=y+3;
// Change animation(like Punch_Left_&_Up or
Kick_Left_&_Up)
// Diagonal movements in -x and +y
}
...and so on...