How do you make it so that if, the person is standing to the

Talk about making games.

How do you make it so that if, the person is standing to the

Postby Kooldudese » Sun May 06, 2007 2:12 pm

How do you make it so that if the person is standing to the right, and he punches then he punches with the right punch animation, and if he is standing to the left, then he punches with the left punch animation?
User avatar
Kooldudese
 
Posts: 128
Joined: Sat Jan 27, 2007 5:20 pm
Location: In a house
Score: 0 Give a positive score

see

Postby d-soldier » Sun May 06, 2007 3:37 pm

Reference:

http://game-editor.com/forum/viewtopic.php?t=3319

On the top of page 2, Sgt Sparky lays out how to set up a directional variable, though it is set to which direction the actor is moving, you can adjust with an animindex setting to capture all the:standing facing right, walking right, standing fracing left, walking left, etc. and apply it to what you want. Your next step would be to modify each of your keydown events, changing them into script which will have the same (if dir==0/1) type of coding as the above post.
Repost for help if you cant figure out how to apply it to your game.
User avatar
d-soldier
 
Posts: 703
Joined: Sun Apr 08, 2007 2:13 am
Score: 61 Give a positive score

Postby Kooldudese » Sun May 06, 2007 4:31 pm

I... cant get it to work
User avatar
Kooldudese
 
Posts: 128
Joined: Sat Jan 27, 2007 5:20 pm
Location: In a house
Score: 0 Give a positive score

Postby Caaz Games » Sun May 06, 2007 4:46 pm

add this to your Left Key Down/Key Up event and of course make a variable called "Left" and "Right"
Code: Select all
Left = 1;
Right = 0;
and on your Right Key Down/Key Up
Code: Select all
Right = 1;
Left = 0;
Now On Key Down For Your Punch Button Use
Code: Select all
if(Left == 1)
{
      ChangeAnimation(ThePunchLeft, Forward);
}
If(Right==1)
{
     ChangeAnimation(ThePunchRight, Forward);
}
I dont know if this works but i've always wanted to try it.
You are welcome to join my forum. 4 active members lol but it's a cool place. active... much talking :D it's fun!
http://caaz.freeforums.org/
User avatar
Caaz Games
 
Posts: 729
Joined: Wed Feb 14, 2007 9:09 am
Location: California....knows how to party!
Score: 25 Give a positive score

Postby Sgt. Sparky » Mon May 07, 2007 2:24 am

make a variable called direct,
Code: Select all
char*key=GetKeyState();
if(key[KEY_LEFT] == 1)direct = 1;
if(key[KEY_RIGHT] == 1)direct = 0;

and when he punches,
Code: Select all
if(direct == 0)ChangeAnimation("PunchRight", Forward);
if(direct == 1)ChangeAnimation("PunchLeft", Forward);

:D
Last edited by Sgt. Sparky on Tue May 08, 2007 12:41 am, edited 1 time in total.
Image
Random Links:
viewtopic.php?p=19474#19474
Right now (10/14/2009) I'm working on some C++ projects, but I might be able to help if you have some Game Editor questions. :)
User avatar
Sgt. Sparky
 
Posts: 1850
Joined: Sat Oct 07, 2006 5:28 pm
Location: Somewhere out there, beneath the pale blue sky...
Score: 236 Give a positive score

Postby Kooldudese » Mon May 07, 2007 8:30 pm

by the way, attacking right and attacking left are both the same button, i was thinking(cuz im bad with codes) mabye i could make 2 invisible regions, one is right and other is left,(infinite y, and the x is as big as it needs to cover the playing field), if the opponent is on the right side and i press punch then i use the right side animation, and vice versa, do you think this would work?,(by the way i will parent the regions to the player)
User avatar
Kooldudese
 
Posts: 128
Joined: Sat Jan 27, 2007 5:20 pm
Location: In a house
Score: 0 Give a positive score

Postby Sgt. Sparky » Tue May 08, 2007 12:41 am

Kooldudese wrote:by the way, attacking right and attacking left are both the same button, i was thinking(cuz im bad with codes) mabye i could make 2 invisible regions, one is right and other is left,(infinite y, and the x is as big as it needs to cover the playing field), if the opponent is on the right side and i press punch then i use the right side animation, and vice versa, do you think this would work?,(by the way i will parent the regions to the player)

that would not work. :(
why not just use one of the codes mentioned above(They would work)
:D
Image
Random Links:
viewtopic.php?p=19474#19474
Right now (10/14/2009) I'm working on some C++ projects, but I might be able to help if you have some Game Editor questions. :)
User avatar
Sgt. Sparky
 
Posts: 1850
Joined: Sat Oct 07, 2006 5:28 pm
Location: Somewhere out there, beneath the pale blue sky...
Score: 236 Give a positive score

Postby Kooldudese » Sat May 12, 2007 12:00 am

ill try the codes
User avatar
Kooldudese
 
Posts: 128
Joined: Sat Jan 27, 2007 5:20 pm
Location: In a house
Score: 0 Give a positive score

Postby Sgt. Sparky » Sat May 12, 2007 5:22 am

okay! :D
Image
Random Links:
viewtopic.php?p=19474#19474
Right now (10/14/2009) I'm working on some C++ projects, but I might be able to help if you have some Game Editor questions. :)
User avatar
Sgt. Sparky
 
Posts: 1850
Joined: Sat Oct 07, 2006 5:28 pm
Location: Somewhere out there, beneath the pale blue sky...
Score: 236 Give a positive score

Postby Kooldudese » Sun May 13, 2007 12:09 pm

umm if there is two animations for left punch and right punch is it the same?, 50%50% chance for every punch to happen.
User avatar
Kooldudese
 
Posts: 128
Joined: Sat Jan 27, 2007 5:20 pm
Location: In a house
Score: 0 Give a positive score

Postby Sgt. Sparky » Mon May 14, 2007 1:24 am

Kooldudese wrote:umm if there is two animations for left punch and right punch is it the same?, 50%50% chance for every punch to happen.

oi, you must seperate them first. :|
Image
Random Links:
viewtopic.php?p=19474#19474
Right now (10/14/2009) I'm working on some C++ projects, but I might be able to help if you have some Game Editor questions. :)
User avatar
Sgt. Sparky
 
Posts: 1850
Joined: Sat Oct 07, 2006 5:28 pm
Location: Somewhere out there, beneath the pale blue sky...
Score: 236 Give a positive score


Return to Game Development

Who is online

Users browsing this forum: No registered users and 1 guest