Ignoring keyboard inputs for variables of time

Get help using Construct 2

Post » Fri Sep 06, 2013 9:08 pm

So Ive finally gotten a hand on how make player characters perform combo attacks, but now I have a new problem. How do I make it so certain keyboard inputs are not allowed for a certain amount of time? I can ignore platform movement, but what about just regular ol keyboard inputs?

For example,

Lets say my attack button is X on the keyboard

And for the sake of simplicity lets say my first attack animation lasts for 2 seconds, how do I make it so if X is pressed in the 1st second, its ignored. But if its pressed in the 2nd second, its registered and it activates the 2nd part of the combo.

Posting the capx up so you guys know what Im talking about

https://www.dropbox.com/s/twabtyp6867ai0b/Comboanimationtesting.capxCDAfree2013-09-06 23:50:01
B
6
Posts: 25
Reputation: 300

Post » Fri Sep 06, 2013 9:21 pm

First, you didn't post a capx, but a caproj file.

Second, I just have a variable (or array value or whatever) for each one. You could even tie them to private variables on your character. But have it work as a cooldown more or less.

If attackhold = 0, on keyboard key pressed --> Do action, set attackhold to 1, wait 2.0 seconds, set attackhold to 0.

That way, the conditions won't be true again until the cooldown is over. You could also get fancy and use either else or a separate event for when the attackhold variable is set to 1 for the game to do something else. You could even have a visual cue come up on screen as long as attackhold = 1. So pretty neat stuff.
B
103
S
38
G
19
Posts: 962
Reputation: 17,996

Post » Sat Sep 07, 2013 7:01 am

I re-posted with the proper capx this time, could you modify it the way you describe in your post? 'cause I tried it myself and got varied results and I don't know what I'm doing wrong, other than you telling me to think in terms of cooldowns as opposed to ignoring inputs.

Thanks for the help!
B
6
Posts: 25
Reputation: 300

Post » Mon Sep 09, 2013 5:20 am

[QUOTE=C-7] If attackhold = 0, on keyboard key pressed --> Do action, set attackhold to 1, wait 2.0 seconds, set attackhold to 0.
[/QUOTE]

K, I figured out what the problem is. This advice works, but only for a single attack animation. i.e character does one slash when the attack button is pressed. Thing is, im trying to make my character do more combo attacks, i.e pressing attack button 3 time quickly triggers 3 different attack animations, and what I need is that for a short period of time in between each animation where pressing the attack button again will trigger the next animation. I'm currently messing with the "wait" and "is playing" conditions, but if anyone already knows how to do this, their input will be much appreciated :)
B
6
Posts: 25
Reputation: 300

Post » Mon Sep 09, 2013 7:25 am

@CDAfree @C-7

You just use the same advice as above but you use more variables...
I'm not sure exactly what you need but it sounds like you're looking to finish attack animations before the next one plays, but in quick succession. You would just set variables at either end of Is Playing and at the end of each animation, trigger the next one.
B
46
S
16
G
77
Posts: 2,159
Reputation: 45,833

Post » Mon Sep 09, 2013 8:01 am

Would this work?


give player timer behaviour

on x pressed - (attack)
               start timer "attack"

on x pressed - timer duration > 1 - (perform combo)
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775


Return to How do I....?

Who is online

Users browsing this forum: Artcadev, dop2000, Phacanu, richcoz81, Txchaser and 32 guests