How do I turn off touch temporarily?

0 favourites
  • 14 posts
From the Asset Store
Surena Touch
$2.50 USD
A wrap from official Touch plugin to export touch/mouse input to other plugins.
  • I am making a virtual pet with buttons that trigger animations when pressed by touch.

    The problem I am having is if the buttons are pressed in rapid succession the animations overlap even though I have a set invisible to each sprite when any button is pressed.

    So, I need to turn off the touch for a couple seconds until the animations are done then turn the touch back on.

    Is there a way to do this or a work around?

  • Just ignore touch events. You can do this with a variable:

    Set variable IgnoreTouch to (time+5)

    And add this condition to all "On touch" events:

    IgnoreTouch<time

  • Thank you. I'm still a little confused on how to do this. Could you detail it a little more?

  • You need to set the variable to (time+5), which means the current time +5 seconds.

    And then you add this condition to all "On touch" and "On tap" events:

    IgnoreTouch<time

    It will prevent them from triggering until those 5 seconds have passed.

  • Thanks for being patient with me. I'm a bit new to using Construct and got pretty far with the Virtual Pet so far.

    "You need to set the variable to (time+5), which means the current time +5 seconds."

    So in the global variable I named "Ignoretouch" (see previous screen shot) I did enter +5 and it defaulted to 5 so you're saying if I understand you to input instead of "+5" (time+5) in parenthesis?

    And then you add this condition to all "On touch" and "On tap" events:

    IgnoreTouch<time

    Again thanks for your help and being patient with me.

    I'm learning. >:)

  • Another option - you can add a condition checking if the animation is still playing.

    For example:

    Touch On Tap 
    Player animation "reloading" NOT playing : Player spawn a bullet
    
  • Thanks. I'll try that out when i get back to my PC.

    I appreciate the help.

    Thank you.

  • O.K I think I probably put your suggestion in the wrong place but I'm having trouble actually creating the conditions in the same block as the touch commands. It keeps creating a new block. I tried putting it in the begining of the script and also after each touch command block but it's still not working.

    Obviously I'm screwing up somewhere.

  • I'm having trouble actually creating the conditions in the same block as the touch commands. It keeps creating a new block. I tried putting it in the begining of the script and also after each touch command block but it's still not working.

    No, don't add new events! You need to add this condition to your existing touch events. Select "On tap gesture on Budo_N" and press C to add another condition. Or right-click and select it from the menu.

    The result should look like this, and you will only be able to tap Budo_N once every 5 seconds:

  • Got it!

    Thanks so much!

    You've been so helpful!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Is there a way to visually indicate the buttons are not clickable for example I see change opacity?

    How could I add a opacity change to the ignoretouch then also have it change back?

    I don't want the player not knowing why the buttons are not working. Changing their opacity would indicate that they are not available until the ignoretouch turns off.

  • When the button is tapped, change its opacity.

    Button set opacity to 50

    Wait 5 seconds

    Button set opacity to 100

  • The way I do it is every time I touch an object that start an animation, I set a variable I called "Active" to True, and I have another condition under every Touch event to trigger only if "Active" is false. So once any animation is playing (="Active is true"), no other touch event can be triggered.

    I then set "Active" back to false once the animation end (you can even use "on any finished", if is applies to all animations).

    Hope I understood your problem correctly though :)

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