How do I detect simultaneous key (code) pressed, not down?

0 favourites
  • 3 posts
From the Asset Store
5 levels with simple coding Source-code (.c3p) + HTML5 Exported
  • Hi.

    I have a character, that uses two buttons: one for a PUNCH, another for a KICK. For those events I use "on PRESS".

    Is there any way to trigger pressing PUNCH & KICK at the same time, but not by "ON KEY DOWN" (Key down works differently then press. DOWN triggers the event continuosly, while PRESS triggers is only once /similar to DOWN and immediately RELEASE/).

    I wish to emulate something like:

    -> On key pressed O

    -> On key pressed P

    not like this:

    -> on O down

    -> on P down

    I know that I can't really do the first, because its triggers, and it looks like I can use only one trigger at a time.

    The problem that occures with me is that:

    When I press DOWN the O+P keys, first an event under O starts and then/after, the right O+P event.

    It looks like my character, after pressing O+P, first punch (O), and then do super-move (O+P).

    I also don't want to use ON DOWN for punching/kicking, other wise the player can just hold the button and punching will be run continuosly until player releases it.

    Any help will be appreciated.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Use the system --> trigger once condition to make it work like a trigger:

    Is punch down

    Is kick down

    trigger once

    And then you have to add a condition to the other events as well.

    On punch

    kick is not down --> punch

    On kick

    punch is not down --> kick

    And read the manual about conditions and triggers before continuing. It will save you a lot of time later on.

  • Great answer! Thank you so much. I didn't try it yet, but I see the logic here, which will solve my issue 100% !!!

    Thank you a lot!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)