How do I set multiple inputs conditions?

0 favourites
  • 6 posts
From the Asset Store
Supports keyboard, mouse and gamepads. Supports several gamepads at once.
  • Hello everyone, here's the problem i face:

    If you have a character who should move like

    On [UP pressed (once and release)] he moves to last mouse position like and rts (or do certain action)

    On [UP pressed twice] he dash to mouse position (or do a different action)

    On [UP held down] he follows the mouse position as long as you keep pressing UP.

    The player should move mainly by holding up a button. But should be able to dash by double tap the same button or move automatically to mouse position if a single tap of this same button is pressed.

    The first two events works fine together, (thanks to some helping people here), but the last one, holding a button to do something it's giving me a headache.

    I can make the three work simultaneusly but if i relase the held button to stop it's action, (pursuing the mouse position in this case), it paralyze the others movement events too.

    So the deal is how to use the same button to do 3 different actions depending if you hold it, press it once or double tap it.

    Specially taking into account that releasing the held button to stop its actions breaks any of the rest inputs types.

    Here is a quick capx with the 3 movement conditions and the held button not stoping the player no matter what i try.

    https://www.dropbox.com/s/23uof75u5u2y7 ... .capx?dl=0

    I need help on this. I have no more brain left...

    Thanks in advance and to those that created the template i use here <img src="{SMILIES_PATH}/icon_e_wink.gif" alt=";)" title="Wink">

  • I had a look at your capx but I can't see what the problem is. It seems to be doing what you want. What do you mean by "it paralyzes the other movement events"?

  • As ramones said, there doesn't seem to be issue with your control scheme.

    On the other hand though, the "player" will block when reaching the limit of your layout (as it is bound to layout). As you "Scale outer" your project, on a 1920 wide screen it gives the impression that the player won't move into the last right 1/4 of the screen. It's because it's actually out of the "Playzone".

    Is that actually your issue ?

    You can experience it better by delimiting your playzone with a sprite. See the attached capx (made in r179, link at the bottom of the page)

  • Sorry if my problem wasn't clear. Here goes more info:

    If you play a little with the capx demo you will start moving your player while you keep pressing "D". It will follows the mouse cursor but if you release the button the character won't stop. It will go loose.

    If i try to stop the character by setting it's bullet behavior to Speed 0 or disable it then the others movements also won't work. Like the single tap for the player to go to mouse position as in usual rts fashion.

    So basically i don't know how to stop the "On D is down" movement without stoping the ability to move with the other two methods (single tap and double tap).

    Should be easy i guess. I missing something very basic here but i'm out of ideas.

    PD:

    I didn't touch much the boundaries of the map because i was just showing the inputs methods and how they behave.

    Thanks to show interest helping me out.

  • Gotcha. If you create a new event with "On D released" and "Group Dash is NOT active" then "set speed to 0", it should only affect the hold movement.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Holy sh.. you! That's was it! Works fine now.

    Thanks ramones ! I was using your example from another topic all along but didn't remember who made it. And you came back to finish what you started!

    Epic stories apart i'm going to test this with all input devices to see if it works fine with all of them (mouse, gamepad, touch, etc). But i guess this solves all issues.

    Thanks Kyatric for your help too!

    PD: This is the topic from where i took ramones example.

    https://www.scirra.com/forum/double-touch-like-double-mouse-click_t70460?&hilit=double+tap

    This is the latest Capx with all three control schemes working fine together:

    https://www.dropbox.com/s/23uof75u5u2y7 ... .capx?dl=0

    Cursor sprite don't align correctly to mouse position but that's outside the scope of this example. I'm looking into this error.

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