Punch/Kick/Shoot

Talk about making games.

Punch/Kick/Shoot

Postby code4242 » Mon Jan 14, 2008 10:20 pm

How do you make an actor lower another actor's health only when it punches/kicks/shoots etc?
Current project: Teratism
User avatar
code4242
 
Posts: 40
Joined: Tue Dec 11, 2007 9:01 pm
Location: Sitting at my laptop :D
Score: 0 Give a positive score

Re: Punch/Kick/Shoot

Postby Thanx » Sun Feb 03, 2008 9:31 am

Maybe you could make a variable that is set to a value when you're not punching, and another value when you're punching, kicking etc. Change the value of the variable for the keydown, when you punch kick shoot, and change the variable's value back, when it has finished the animation (Animation Finish). In the Colision event, use an if statement, which checks the value, and if the value is what would be set when kicking punching, then take some health away. The colision event should look something like this:
Code: Select all
if(attackvar == 1)
{
    health = health - 10;
}

If you want to take away 10 healthpoints
Hope that helped.
http://www.youtube.com/watch?v=XyXexDJBv58
http://www.youtube.com/watch?v=Be4__gww1xQ
These are me and playing the piano (second one with a friend/fellow student)
Hope you watch and enjoy!
User avatar
Thanx
 
Posts: 314
Joined: Sat Jan 26, 2008 10:07 pm
Location: Home sweet home! :)
Score: 24 Give a positive score

Re: Punch/Kick/Shoot

Postby Bee-Ant » Sun Feb 03, 2008 10:01 am

Actor1->KeyDown->AnyKeyToAttack->ScriptEditor
Code: Select all
ChangeAnimation("EventActor","PunchAnimation",FORWARD);
attack=1;

Actor1->AnimationFinish->PunchAnimation->ScriptEditor
Code: Select all
ChangeAnimation("EventActor","StopAnimation",FORWARD);
attack=0;

Actor2->Collision->Actor1->ScriptEditor
Code: Select all
if(Actor1.attack==1)
{
    ChangeAnimation("EventActor","HitAnimation,FORWARD);
    power-=3;
}

Actor2->AnimationFinish->HitAnimation->ScriptEditor
Code: Select all
ChangeAnimation("EventActor","StopAnimation",FORWARD);
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score

Re: Punch/Kick/Shoot

Postby code4242 » Sun Feb 03, 2008 1:46 pm

Thanks guys! i'v been waiting forever for a reply! +1 point for both of you! :D :D :D :D :D :D
Current project: Teratism
User avatar
code4242
 
Posts: 40
Joined: Tue Dec 11, 2007 9:01 pm
Location: Sitting at my laptop :D
Score: 0 Give a positive score

Re: Punch/Kick/Shoot

Postby Bee-Ant » Sun Feb 03, 2008 1:50 pm

Foreover???OMG
Thanks anyway
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score

Re: Punch/Kick/Shoot

Postby Thanx » Sun Feb 03, 2008 7:50 pm

Yeah, your welcome!
http://www.youtube.com/watch?v=XyXexDJBv58
http://www.youtube.com/watch?v=Be4__gww1xQ
These are me and playing the piano (second one with a friend/fellow student)
Hope you watch and enjoy!
User avatar
Thanx
 
Posts: 314
Joined: Sat Jan 26, 2008 10:07 pm
Location: Home sweet home! :)
Score: 24 Give a positive score


Return to Game Development

Who is online

Users browsing this forum: No registered users and 1 guest

cron