How do you make it so that if, the person is standing to the
Posted:
Sun May 06, 2007 2:12 pm
by Kooldudese
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?
see
Posted:
Sun May 06, 2007 3:37 pm
by d-soldier
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.
Posted:
Sun May 06, 2007 4:46 pm
by Caaz Games
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.
Posted:
Mon May 07, 2007 2:24 am
by Sgt. Sparky
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);
Posted:
Mon May 07, 2007 8:30 pm
by Kooldudese
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)
Posted:
Tue May 08, 2007 12:41 am
by Sgt. Sparky
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)
Posted:
Sun May 13, 2007 12:09 pm
by Kooldudese
umm if there is two animations for left punch and right punch is it the same?, 50%50% chance for every punch to happen.
Posted:
Mon May 14, 2007 1:24 am
by Sgt. Sparky
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.