0 Favourites

Disable touch

  • Hello,

    when I touch some sprite on my mobile device (and something happens) I want that touch function to be disabled after the first touch...

    For example, when I touch some button -> object starts to rotate -> here I dont want that button to be touched again, simply I just want to disable it after the first touch input.

    How to do it?

  • nobody knows ? is it even possible?

  • Do you have a capx for me? <img src="smileys/smiley4.gif" border="0" align="middle" />

    and if you're talking about what I think u are, sure its possible

  • You can do that in many ways.

    One way is to create a global variable you set to 1 the first time its pressed.

    On the touch event just check for if that variable is 0

    You could also put the touch event in a group and then disable the group once the button is pressed.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • You can do that in many ways.

    One way is to create a global variable you set to 1 the first time its pressed.

    On the touch event just check for if that variable is 0

    You could also put the touch event in a group and then disable the group once the button is pressed.

    Thanks, that's what I need.

  • I used the search and I have a similar problem.

    I have a button and i need when the button is touched to disable a second button.

    There is no way to disable this second button?

    How do you do the event group disable?

  • A little explication would be very appreciated.

  • You have to figure a way for a second touch function to not be acted upon by your events. Remember, the events run every tick, so the only way to ignore a touch event is to add a condition to the touch trigger so that your code can identify when the trigger has been actioned before. You can't simply disable touch on an object, it doesn't work like that. There really are a lot of ways you could do this.

    One simple way is to add an object boolean to your sprite - something like object.Touched. Check that the boolean is false during your touch trigger and then set it to true during the subsequent commands so that the touch event trigger cannot fire again.

    Also remember that if you have mouse input set to yes on the touch object then that can also trigger two touch events on some iOS and Android devices.

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