Page 1 of 1

Punch/Kick/Shoot

PostPosted: Mon Jan 14, 2008 10:20 pm
by code4242
How do you make an actor lower another actor's health only when it punches/kicks/shoots etc?

Re: Punch/Kick/Shoot

PostPosted: Sun Feb 03, 2008 9:31 am
by Thanx
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.

Re: Punch/Kick/Shoot

PostPosted: Sun Feb 03, 2008 10:01 am
by Bee-Ant
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);

Re: Punch/Kick/Shoot

PostPosted: Sun Feb 03, 2008 1:46 pm
by code4242
Thanks guys! i'v been waiting forever for a reply! +1 point for both of you! :D :D :D :D :D :D

Re: Punch/Kick/Shoot

PostPosted: Sun Feb 03, 2008 1:50 pm
by Bee-Ant
Foreover???OMG
Thanks anyway

Re: Punch/Kick/Shoot

PostPosted: Sun Feb 03, 2008 7:50 pm
by Thanx
Yeah, your welcome!