Fighter Combos

Game Editor comments and discussion.

Fighter Combos

Postby dmuhsin » Fri Jul 04, 2008 5:25 pm

Hello world! This will be my first post I am fairly new to GE, and I am working on a "Double Dragon" type game, and I was wondering if anyone could help me with fighter combos, I wanted to setup the controls where If the player pressed the A key the character would punch but if they pressed a combination of keys like AAA on the final pressing of the A the character would change to a different animation. I have searhed the forum and could not find anyone talking about this and figured it must be common knowledge and I am just a rookie.

any information would be greatly appreciated


Plant you now, dig you later :)
User avatar
dmuhsin
 
Posts: 3
Joined: Mon Jun 30, 2008 3:49 pm
Score: 0 Give a positive score

Re: Fighter Combos

Postby 4erv' » Fri Jul 04, 2008 6:16 pm

To change animation when AAA is pressed, just make a key down event, with "a a a" keys, and change "Execute when:" to "Keys are pressed in order",
but on pressing first a, the actor would punch anyway. :?
Gold Basketball 2008 - the first basketball game made with game editor.

User avatar
4erv'
 
Posts: 188
Joined: Sat Jul 07, 2007 10:52 am
Location: in Recycle Bin
Score: 10 Give a positive score

Re: Fighter Combos

Postby Thanx » Fri Jul 04, 2008 6:35 pm

Well, no matter what, you'll have to do a very bit of coding....
step 1: Make a Create Actor event, the select the Script Editor as the action. Click on the variables button. Add a variable, I'll call it combos, but ou name it whatever you want. Make it an integer.
step 2: So you have the script editor open, write this line of code:
combos = 0;
instead of combos enter the name of the variable, but you know that... press ok, make this an Immediate Action...
step 3: Now I'm sure you have an action for the key down.... open it up, inthe script editor, do this:
combos ++;
if(combos == 3)
{
ChangeAnimtaion(... You'll use the generator and select whatever);
combos = 0;
}
else
{
do non-combo action
}

What this code does, is that it counts how many times yo hit the key, and if it is 3, then it changes the animation, and resets the veriable to 0.
If you want to make it so that this only happens if someone presses the keys fast, then the code is just a bit longer:
DestroyTimer(The timer you created);
combos ++;
if(combos == 3)
{
ChangeAnimation(Same as before);
combos = 0;
}
else
{
do non-combo action
}
CreateTimer("Event Actor", sometimer you created that lasts a few hundred, or maybe a little over a thousand miliseconds);
Now you'll also need to create a Timer event, use the script editor, and say
combos = 0;

What this does, is that when you press the button it destroys any ongoing timers, enabling the combos to ever reach 3. But it also creates a new one, so that if that one reaches its time, then the combos are back to three, and if you want the combo, then you have to try again...
If you have anymore questions, just ask! :wink:
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: Fighter Combos

Postby DST » Sat Jul 05, 2008 10:41 am

Good explanation, thanx!

Creating and killing a timer is useful for many things!
It's easier to be clever than it is to be kind.
http://www.lostsynapse.com
http://www.dstgames.com
User avatar
DST
 
Posts: 1117
Joined: Sun Apr 15, 2007 5:36 pm
Location: 20 minutes into the future
Score: 151 Give a positive score

Re: Fighter Combos

Postby dmuhsin » Sat Jul 05, 2008 10:21 pm

Thank you "Thanx" this was a great explanation I figured I had to do something with a variable, but you laid it out (so to speak) very clear and I also [imgthank everyone for the rapid response I think this will help a lot of people
User avatar
dmuhsin
 
Posts: 3
Joined: Mon Jun 30, 2008 3:49 pm
Score: 0 Give a positive score

Re: Fighter Combos

Postby dmuhsin » Sun Jul 06, 2008 11:40 pm

Hey thanx I tried using the code do non-combo action and game editor gave me an error message saying non is a undeclared identifier heres what I entered

combo++;

if (combo==3)

{
ChangeAnimation("Event Actor", "Spinbackfist", FORWARD);
}

else

{

do non-combo action

}
User avatar
dmuhsin
 
Posts: 3
Joined: Mon Jun 30, 2008 3:49 pm
Score: 0 Give a positive score

Re: Fighter Combos

Postby Game A Gogo » Wed Jul 09, 2008 1:51 pm

dmuhsin wrote:Hey thanx I tried using the code do non-combo action and game editor gave me an error message saying non is a undeclared identifier heres what I entered

combo++;

if (combo==3)

{
ChangeAnimation("Event Actor", "Spinbackfist", FORWARD);
}

else

{

do non-combo action

}


You need to replace that with the normal animation :3
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Re: Fighter Combos

Postby DST » Wed Jul 09, 2008 3:36 pm

'do non combo action' is not a command.
Also if did you declare the variable 'combo', in the variables tab?
also, when the animation changes to spinbackfist, make sure to reset combo to 0 again.
It's easier to be clever than it is to be kind.
http://www.lostsynapse.com
http://www.dstgames.com
User avatar
DST
 
Posts: 1117
Joined: Sun Apr 15, 2007 5:36 pm
Location: 20 minutes into the future
Score: 151 Give a positive score

Re: Fighter Combos

Postby Thanx » Mon Jul 14, 2008 8:30 pm

Just to make this clear to anyone who'd use this topic to do this type of a thing: "do non-combo action" is no type of command, as DST said...
I assumed that if you use a control 3 times, then you'd have an action for using it once. You obviously have your own codes for that - ChangeAnimation, PlaySound, whatever - put those codes there, and don't use what I marked it with!
Cheers! 8)
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 GE - General

Who is online

Users browsing this forum: No registered users and 1 guest

cron