How to make a touchscreen button?

  • I know that i am sounding foolish but this thing is really teasing me

    I have made many games but i am facing a huge problem.I have made touch buttons for making menus.When a button is pressed,we move to a new layout.But problem is that everything happens at so great speed that when i touch a button on a screen,another button on same spot in next layout also gets selected.

    My code:-

    for example,I clicked on play.Then not only play is selected but a button on next layout in same spot also gets selected(everything happens at very great speed)

  • I did this and it seems to work but still if someone have better ideas then they are welcome !!!

    + Touch: On tap gesture on play

    -> System: Go to choose_the_game

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The Touch object has dedicated triggered conditions.

    In this instance, prefer using "On touched object" which will trigger once a touch pressing down and releasing occurred (the event happens on the release).

    This should prevent the issue of clicking the next button in the next layout.

    Otherwise, do put some delay to your button by setting a global variable "isTouched" for example to a different value when you touch a button.

    As an additional condition to all your button touching events, check the value of this isTouched variable.

    When you click a button and that "isTouched" is false, do the action you want to do in regards to that button and do also change the value of "isTouched" to true, and start a timer (0.25 is a good spot in my experience) that will change back the value of isTouched to false when it happens.

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