collision works perfectly.
Example: make a var (GlobalVar) called Punch,
when the hitting key is pressed Punch = 1;
when the punch animation is finished Punch = 0;
also, make a var Called Animfinish, when any animation is finish AnimFinish = 1;
or when moving keys that have to do with animations are released.
here is code for the right moving key pressed:
- Code: Select all
char *key=GetKeyState();
if (key[KEY_RIGHT] == 1 && key[KEY_LEFT] == 0 && Punch == 0)
{
x += 5;
if(AnimFinish == 0)
{
ChangeAnimation("Event Actor", "Right", FORWARD);
}
}
if (key[KEY_RIGHT] == 1 && key[KEY_LEFT] == 1)
{
ChangeAnimationDirection("Event Actor", STOPPED);
}
and for the left moving key:
- Code: Select all
char *key=GetKeyState();
if (key[KEY_RIGHT] == 0 && key[KEY_LEFT] == 1 && Punch == 0)
{
x -= 5;
if(AnimFinish == 0)
{
ChangeAnimation("Event Actor", "Left", FORWARD);
}
}
if (key[KEY_RIGHT] == 1 && key[KEY_LEFT] == 1)
{
ChangeAnimationDirection("Event Actor", STOPPED);
}
this event needs to be repeated, that way he will not move hile punching, Exept for his punching.
when the player collides with the badguys,
have this:
- Code: Select all
if(Punch == 1)
{
DestroyActor("Collide Actor");
}
I hope that helps, if you want any help with health bars ect. just let me know
this is part of a code I made for Anti-Moonwalking
http://game-editor.com/forum/tp-3039-Pe ... nwalk.html
for some Ai for a shooting game:
http://game-editor.com/forum/tp-3049-AI ... game-.html