Jump on ANY TOUCH except when player is touching button

0 favourites
  • 6 posts
From the Asset Store
Players follower. use it for anything which follows the player
  • Alright so usually i know my way around this but I figured I will ask the community for the best way, in my platformer there is a left and right button for touch on screen, then i have an event where "on any touch > Jump " then after that it sets a double jump variable to 1.

    Then its On any touch > Doublejump is 1 > Jump

    But thing is when my character is in air, i want to be able to move it left and right, however when i click one of the button the character jumps/doublejumps to.

    I have tried ON any touch > Is not touching object BUTTON > Jump

    But still jumps when i move in air using the buttons.

    Appriciate any responses if anyone has a solution, i will just keep working on the other things while i wait for a reply.

  • I did solve it using a invisible layer with a "touchindicator" sprite that covers everything but the buttons, so I did on object touched > Jump

    However is this a good solution? Maybe not for performance? Layer is invisible.

    Anyone have a better way?

  • This is exactly what i did, but if the player is in air, it still double jumps if they press the left or right button.

    Double jump is setup with a variable so If player is in air> Double jump is 0 > Touch > Set vector etc etc > set doublejump to 1

    EDIT: I Tried it your way by setting double jump enabled on the platform behaviour,that worked however its not as smooth as my own made doublejump, it only doublejumps if player is falling.

    Weird how this way does not work when I do the same but with a variable condition and instead of platform jump I set it to set vector, really strange.

  • Sounds like a problem with your double jump logic and not the touch input. Post your project file so people can have a look.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • This is exactly what i did, but if the player is in air, it still double jumps if they press the left or right button.

    Double jump is setup with a variable so If player is in air> Double jump is 0 > Touch > Set vector etc etc > set doublejump to 1

    EDIT: I Tried it your way by setting double jump enabled on the platform behaviour,that worked however its not as smooth as my own made doublejump, it only doublejumps if player is falling.

    Weird how this way does not work when I do the same but with a variable condition and instead of platform jump I set it to set vector, really strange.

    Make a boolean variable for all buttons and say

    If - is touching button = set button boolean /true

    If - not touching button = set button boolean /false

    And now you can say

    If - on any touch & all button boolean /false = set jump

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