Punching

Game Editor comments and discussion.

Punching

Postby Setokyo » Fri Aug 13, 2010 4:40 am

Hi
Can anyone so me how to punch for a platform game?
I have the one's for fighting but it's not helping
thanks
code would be lovely
:mrgreen:
Last edited by Setokyo on Fri Aug 13, 2010 7:46 pm, edited 1 time in total.
Laws control the lesser man. Right conduct controls the greater one

"I'd rather be hated for who I am than loved for who I am not
User avatar
Setokyo
 
Posts: 85
Joined: Fri Jul 09, 2010 1:52 am
Location: Holetown barbados
Score: 3 Give a positive score

Re: Punching

Postby BloodRedDragon » Fri Aug 13, 2010 6:30 pm

How do you mean? do you want a punching animation or script? I'ma guessing you want some script.
Well to make sure that the punch works on other actors, you need variables. make a variable (Actor variable, integer, no array) called Punch or Attack.

Then make a Key Down - Script editor event for your player(disable repeat):

ChangeAnimation("Event Actor", "(your punching animation)", FORWARD);
attack = 1;

Now you can use if(player.attack==1) with the other squiggly brackets in a collision - script editor event for the enemy, which means that the enemy will only react if the punch hits him. Put a Destroy actor(event actor) in the script editor as a result of the If statement if you want the enemy to die, or you could make him change animation if you want.

Hope that Helps,
:mrgreen:
Current projects:
Techno-Tank Arena: on hold
Techno-Tank SuperPortal (working title): 0.1%
Bowels of Galaxies: 35% (was a bit too optimistic)
User avatar
BloodRedDragon
 
Posts: 123
Joined: Tue Jan 29, 2008 10:07 pm
Location: The Underworld
Score: 5 Give a positive score

Re: Punching

Postby Setokyo » Fri Aug 13, 2010 7:41 pm

Thanks for you help
1+ for you
any other ideas :mrgreen:
Laws control the lesser man. Right conduct controls the greater one

"I'd rather be hated for who I am than loved for who I am not
User avatar
Setokyo
 
Posts: 85
Joined: Fri Jul 09, 2010 1:52 am
Location: Holetown barbados
Score: 3 Give a positive score

Re: Punching

Postby lcl » Fri Aug 13, 2010 8:05 pm

I have another way of doing it.
It is mostly like BloodRedDragons' way, but little different.

If you have punch animation that contains the whole punch move, you want him of course do
the move completely. So you can do it like that:

Create variable -> Attack - Integer - Global - Array: no

Key down, the key you want, repeat disable, script editor:

Code: Select all
if (Attack == 0)
{
ChangeAnimation(put here your punch animation);
Attack = 1;
}


And then, animation finish, punch animation, script editor:

Code: Select all
Attack = 0;


And in enemy, collision, any side, main actor, repeat yes, script editor:
Code: Select all
if (Attack == 0)
{
//Put here the code that takes life away.
}

if (Attack == 1)
{
DestroyActor("Event Actor");
}


This way you can hit once, then it plays the animation and then enables hit again when animation finishes. :D
And if you're colliding enemy while you punch, you will kill him. :)
I hope this helps you! :D
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score

Re: Punching

Postby Setokyo » Fri Aug 13, 2010 8:48 pm

yea thanks
:mrgreen:
Laws control the lesser man. Right conduct controls the greater one

"I'd rather be hated for who I am than loved for who I am not
User avatar
Setokyo
 
Posts: 85
Joined: Fri Jul 09, 2010 1:52 am
Location: Holetown barbados
Score: 3 Give a positive score

Re: Punching

Postby BloodRedDragon » Sat Aug 14, 2010 12:13 am

Thanks for the +1! Oh and yeah, i was gonna carry it further in a similar way to lcl, but to tell you the truth, I was testing out the whole punching idea myself. I have used 'if' before, just not for that.
Current projects:
Techno-Tank Arena: on hold
Techno-Tank SuperPortal (working title): 0.1%
Bowels of Galaxies: 35% (was a bit too optimistic)
User avatar
BloodRedDragon
 
Posts: 123
Joined: Tue Jan 29, 2008 10:07 pm
Location: The Underworld
Score: 5 Give a positive score

Re: Punching

Postby Setokyo » Sat Aug 14, 2010 12:48 am

it's ok
try out my new demo
Zero madnesss
Laws control the lesser man. Right conduct controls the greater one

"I'd rather be hated for who I am than loved for who I am not
User avatar
Setokyo
 
Posts: 85
Joined: Fri Jul 09, 2010 1:52 am
Location: Holetown barbados
Score: 3 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest

cron