Is it possible to DISABLE Touch ?

0 favourites
  • 4 posts
From the Asset Store
Surena Touch
$2.50 USD
A wrap from official Touch plugin to export touch/mouse input to other plugins.
  • Is there a way to Disable Touch depending on the condition?

    I am making a player jump On Any Touch Release

    but if it is in the air I dont want it to jump again (using physics)

    But it seems that doesnt matter what condition I add to the Touch Release even, for example "on any touch release AND if player is overlapping ground" still it will Jump in the air...

    I wish there was a simple way to disable all Touch Events, like you can disable any other things....

    Am I not seeing something obvious here?

    Tagged:

  • You can't disable the whole Touch plugin, but you certainly should be able not to run the event, when player is in the air.

    Please post a screenshot of your code, or your project file.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • In that situation you can make your jump conditional on an instance variable.

    So give your player an instance variable named jumpCount. Then for the events controlling your jump, you can say something like.

    -On touch release

    -If player.jumpCount < 1 - make player jump and increment jumpCount by 1.

    If you try to jump while he is in the air, the jump events wont trigger because jumpCount is not < 1.

    Then when player lands, set jumpCount back to 0. Now player can jump again.

    Would that work?

  • I think the reason it wouldn't work is because "On Touch Release" is same as having: "In not touching" with "Trigger Once". So it means you had three things together:

    "Is not touching"

    "Overlapping ground"

    "Trigger once"

    So the moment you jumped, it would trigger once, but the above condition becomes false, allowing another trigger when it becomes true again (when you release again).

    The way around should simply be having a Sub-event like so:

    On Touch Release:

    (sub) "Overlapping Ground" (Action: Jump)

    This way, it would check for Overlapping Ground separately before executing the jump, each time.

    Let me know if it works.

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