Ignore specific keypresses

Get help using Construct 2

Post » Thu Nov 08, 2012 8:19 am

Hi guys,

Working on a top-down game that features characters interacting with various objects in the environment. I want to use three keys to trigger various actions, let's say "A" "S" and "F"

While the action triggered by "A" is going on, I don't want the character to be able to do any potential actions triggered by "S" and "F" until the original action is completed.

My question is: Can I selectively disable/enable input from a given key as an action, similar to the way 8-Direction behavior ignoring can be started/stopped? I don't see any mechanism for this, but I'm fairly new so I could be missing something.

Any help is appreciated. Thanks!
B
7
S
1
Posts: 3
Reputation: 1,163

Post » Thu Nov 08, 2012 10:42 am

Use something like this....Add extra conditions to your Initial conditions

So..like add the condition and invert the extra conditions to get an opposite function

Condition 1-> A is pressed
Condition 2-> S is X Pressed (invert this to get the action..)

etc etc..

You can add as many conditions as you like to an Event and this included key presses ..
To bring up the Extra condition menu..or if you need to invert them or place an 'OR" block just right click the starting Condition...Also keep in mind that conditions work best if they are Sequentially correct like a flow chart..

So like ..If key A is pressed( the first check)
& key S is not pressed etc...

This is the basic idea..
build up complex conditions for any situation you need...



When in doubt..or you are lost in a Zombie apocalypse or someone is giving you a hard time..Remember one thing..... Read the Construct 2 Manual..it will save your life.:)
B
30
S
11
G
8
Posts: 313
Reputation: 7,360

Post » Thu Nov 08, 2012 6:06 pm

Makes perfect sense. Thanks!
B
7
S
1
Posts: 3
Reputation: 1,163

Post » Fri Nov 09, 2012 9:25 pm

Another way to do it, for fighting game example...

If I my character is attacking, I set his   IsAttacking instance variable to 1. So for any button that I don't want to interrupt his attack's (like running, or another attack) , I do this...

IsAttacking 0
and SideAttack is pressed = > set IsAttacking to 1, play animation side attack,     

so If i press the run button, it won't work while he's attacking.

IsAttacking 0
AND run is pressed. => Run

Then I clean it up by...

on Any Animation Finished = > Set IsAttacking to 0

This way, animations can't interrupt him while he's attacking.

Just another way to do things :) bscarl882012-11-09 21:27:05
B
32
S
4
Posts: 406
Reputation: 3,221


Return to How do I....?

Who is online

Users browsing this forum: Colludium and 28 guests