Posted By
|
Message
|
JetpackLover
Registered 01/03/2007
Points 212
|
23rd July, 2009 at 17:16:43 -
I need a fairly easy but efficient way of achieving this. For example down, diagonal, forward for Hadoken, how would I go about coding this?
http://www.invincibletime.com/
Devlog for HD MMF Game Omulus. Check it out because it's gonna be awesome. http://omulus.tumblr.com/
Follow me on the twitters https://twitter.com/JetpackLover
|
OMC What a goofball
Registered 21/05/2007
Points 3516
|
23rd July, 2009 at 17:21:48 -
In sequence, the easiest way is to do this:
Pressed button 1: Add 1 to counter. Add 1 to counter value A.
Pressed button 2, Counter = 1: Add 1 to counter. Add 1 to counter value A.
Pressed button 3, Counter = 2: Add 1 to counter. Add 1 to Counter value A.
Etc.
Counter = 13 (number of buttons in combo): attack, Set counter to 0.
Counter value A > 1: Set Value A to 1.
Counter Value A = 1 + Every 0.05 seconds: Set counter Value A to 0, set Counter to 0.
I think that should work. O_o I've never tried it. X) There are a lot of variations. You may want to set the 0.05 seconds to something higher, so the user doesn't have to press it so fast.
Edited by OMC
|
Jon C-B I create vaporware
Registered 23/04/2008
Points 237
|
23rd July, 2009 at 17:29:31 -
I found this in the tutorials in the clickteam website. I think this should help. http://www.clickteam.com/website/usa/img/uploads/tutorials/download/chaos_fighter.mfa
n/a
|
JetpackLover
Registered 01/03/2007
Points 212
|
23rd July, 2009 at 18:09:47 -
Thank you sooo much Jon C-B this is just what I needed!!
Also OMC that was my original plan but I was hoping there was a more efficient way, I'll check out the MFA posted and see how it's done there.
http://www.invincibletime.com/
Devlog for HD MMF Game Omulus. Check it out because it's gonna be awesome. http://omulus.tumblr.com/
Follow me on the twitters https://twitter.com/JetpackLover
|
OMC What a goofball
Registered 21/05/2007
Points 3516
|
23rd July, 2009 at 18:13:40 -
You'll find that it's very similar.
|
GamesterXIII
Registered 04/12/2008
Points 1110
|
23rd July, 2009 at 19:31:23 -
Originally Posted by OldManClayton In sequence, the easiest way is to do this:
Pressed button 1: Add 1 to counter. Add 1 to counter value A.
Pressed button 2, Counter = 1: Add 1 to counter. Add 1 to counter value A.
Pressed button 3, Counter = 2: Add 1 to counter. Add 1 to Counter value A.
Etc.
Counter = 13 (number of buttons in combo): attack, Set counter to 0.
Counter value A > 1: Set Value A to 1.
Counter Value A = 1 + Every 0.05 seconds: Set counter Value A to 0, set Counter to 0.
I think that should work. O_o I've never tried it. X) There are a lot of variations. You may want to set the 0.05 seconds to something higher, so the user doesn't have to press it so fast.
this method is inefficient.
Never use timed events for something like this. what if you execute the attack and the timer is equal to 00.00.04? That gives you 1 MS to initiate the next button. Too random - would cause a lot of execution failures.
Also, if your combo consists of 2 of the same button in a row or more, make SURE you put a delay between them.
EX
Counter = 1 + pressing A
-set counter to 2
counter = 2 + pressing A
-set counter to 3
Counter = 3 + pressing A
-set counter to 4
The way the code is run will cause the counter to jump to 4 as soon as you hit A once. You might want to put a delay between all buttons as well just to keep things even.
You can add a delay by using a different alterable value or a different counter like this.
Button 1 is pressed
+Delay counter = 0
+ Attack counter = 0
-set attack counter to 1
-set delay counter to 5
Delay counter > 5
subtract one
Button 2 is pressed
+ Delay Counter = 0
+ Attack Counter = 1
-set attack counter to 2
-set delay counter to 5
etc etc.
timed events are evil unless they are always events.
Edited by GamesterXIII
n/a
|
OMC What a goofball
Registered 21/05/2007
Points 3516
|
23rd July, 2009 at 19:36:01 -
Yes you're quite right, I'm not sure why I didn't use a delay counter in my example.
I also structured the reset incorrectly. Ignore my post altogether!
|
MBK
Registered 07/06/2007
Points 1578
|
24th July, 2009 at 03:12:18 -
If A is pressed, Counter1 > 0, Counter2 = 0 --> Set Counter1 to 20 and Set Counter2 to 1
If B is pressed, Counter1 > 0, Counter2 = 1 --> Set Counter1 to 20 and Set Counter2 to 2
If C is pressed, Counter1 > 0, Counter2 = 2 --> Set Counter1 to 20 and Set Counter2 to 0 and Set Counter1 to 0
0 = 0 --> Subtract 1 from Counter1
I believe that is how I would do it.
Question1: is this "evil" or inefficient in any way?
Question2: does this sort of coding affect jump height based upon the speed of different computers?
(I ask this because I use this sort of style most of the time and think nothing of how it will run on varying computers)
Click Me! http://www.create-games.com/project.asp?view=main&id=1444
http://www.mediafire.com/download.php?aoo1dnnlq5i
Blood of the Ancient One, Seen only as Shadow, Faster than Lightning, Fierce as the Greatest Dragon, Nearly Invisible, Floating in a Dream, Entered through the Demon Door, Destroyer of Evil in a Realm with a Red Sky Scarred, Who could I be ?
|
RedEnchilada formerly RedEchidna
Registered 01/08/2008
Points 301
|
24th July, 2009 at 15:09:55 -
*sigh* Just store all the inputs in a string and use that.
Player presses Up: Set Alterable String of String to AlterableString(String)+"U"
Player presses Down: Set Alterable String of String to AlterableString(String)+"D"
Etc.
Example combo:
Right$(String, 3)=DRP: Attack
I actually have something like this. Lemme see if I can find it.
http://www.youtube.com/watch?v=WYrSD35vHo4
woooooooooooooooooaah maaaaaaaaaaaaaaaaaaaaan
|
MechanicalPen
Registered 19/04/2009
Points 7
|
25th July, 2009 at 21:00:52 -
Wouldn't it be faster to store all of the inputs in a counter? Playing with strings is slow, doing math is not.
An example:
Start of loop: Set alterable value Combo to Combo*10
Player presses Up: add 1 to alterable value Combo.
Player presses Down: add 2 to alterable value Combo.
if Combo = 212: do combo 1
n/a
|
[DELETED] Likes to put dots on paper
Registered 08/12/2008
Points 118
|
26th July, 2009 at 13:28:12 -
But you can't store multiple values in a single counter, I don't think. Strings you can use the Left$ Mid$ Right$ functions to read 3 button combinations. I was working on a level editor and had trouble trying to give tiles in a tileset picture their own value because you cant put two values into the same array position as a tile ID and then rebuild it later (I was giving them values by multiplying their x/y positions and then I realised there is no way to take a crazy ass number like 13429424 and break it down into the correct x/y co-ordinates), I checked out other level editor tutorials/engines and Zephni used strings instead and wrote the x/y co-ordinates instead so it was like "3 4" and then you can break it down by using expression editor to take the left and right side of the string apart to check them.
I'm sure this same method could be applied to adding strings together and when you have the right combination of strings, a special attack is launched.
EDIT: With strings there is also no mistaking the moves you are going to pull off. If you use a single value, couldn't you press buttons in different combinations to make up that product (eg. 212 or what have you) and perform the move? It would maybe be easier to read that yes, he has pressed A, B, A, A in the right order and right buttons.
Edited by [DELETED]
n/a
|
MechanicalPen
Registered 19/04/2009
Points 7
|
27th July, 2009 at 02:45:53 -
You can with the magic of % (modulus). It basically divides your number by another number, and returns the remainder. If you type "29 mod 10" into MMF's expression editor it gives you 9. It takes some math to get the other number [(29 - (29 mod 10))/10] but it's faster than strings.
Anyways, here is a link to a tutorial that does it both ways:
http://www.sonicfangameshq.com/view.php?sec=4&id=154
n/a
|
MrMcFlurry
Registered 03/08/2009
Points 89
|
5th August, 2009 at 02:42:42 -
Originally Posted by RedEchidna*sigh* Just store all the inputs in a string and use that.
Player presses Up: Set Alterable String of String to AlterableString(String)+"U"
Player presses Down: Set Alterable String of String to AlterableString(String)+"D"
Etc.
Example combo:
Right$(String, 3)=DRP: Attack
I actually have something like this. Lemme see if I can find it.
I quite like this method to be honest, However, you would need to start deleting characters at the start of the string if it got too long, and wiping it if there's too longa break, and alsoyou would need to wipe it after each tiem a combo is completed.
Otherwise you'll get, say, a combo that goes up, right, down. then if you had another that was right down left, by pressing u through to l the input would be 'URD'<- perform combo followed by U'RDL' <- perform combo. the second combo would need only one keypress.
n/a
|
|
|