change animation in current direction

Talk about making games.

change animation in current direction

Postby phractus » Wed Mar 10, 2004 8:04 pm

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~
phractus
 
Posts: 77
Joined: Mon Mar 08, 2004 1:25 am
Location: Rochester, NY, USA
Score: 0 Give a positive score

Postby makslane » Thu Mar 11, 2004 2:25 am

Trye the "Walking Character Online Tutorial" in:

http://game-editor.com/forum/viewtopic.php?t=184
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby phractus » Thu Mar 11, 2004 3:06 am

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~
phractus
 
Posts: 77
Joined: Mon Mar 08, 2004 1:25 am
Location: Rochester, NY, USA
Score: 0 Give a positive score

Postby phractus » Thu Mar 11, 2004 5:19 am

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!
phractus
 
Posts: 77
Joined: Mon Mar 08, 2004 1:25 am
Location: Rochester, NY, USA
Score: 0 Give a positive score

Why not try this for diagonal directions

Postby ingsan » Thu Mar 11, 2004 12:49 pm

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...


:wink:
User avatar
ingsan
 
Posts: 580
Joined: Mon Nov 17, 2003 4:02 pm
Location: Maurician LADY in FRANCE
Score: 6 Give a positive score


Return to Game Development

Who is online

Users browsing this forum: No registered users and 1 guest

cron