create actor events for fighting

Talk about making games.

create actor events for fighting

Postby Bat Man » Fri Feb 16, 2007 2:07 pm

how can i use a create actor event for fighting. 4 example, when i press a button, it destroys an actor and another sprite/actor appears in the same place, because the collision event doesn't really work that well.

i m so confused :cry:
yes i am fifteen
User avatar
Bat Man
 
Posts: 4
Joined: Mon Feb 12, 2007 8:12 pm
Location: 2841 west 85th place
Score: 0 Give a positive score

Postby Sgt. Sparky » Fri Feb 16, 2007 3:06 pm

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. :D
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 :D
this is part of a code I made for Anti-Moonwalking :D
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
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