How do I make trigger once on touch of object?

0 favourites
  • 3 posts
From the Asset Store
Change the size and position of everything without calculating anything!
  • I got a sprite that should trigger an event on touch once, when a certain condition is met. For that I created a sub-event with the condition and the additional condition "Trigger once when true". However, every time I touch the sprite, it triggers the event and the subevent always gets considered "first time trigger". how can I make sure that an action is only triggered once, when I tap on a sprite, without creating a global bool for every of them? I use it a lot.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You will need the bool or a variable so you can make the condition false. If you have too many objects consider using a Family with a Family instance variable then you can use one event that applies to everything.

  • To add to lionz suggestion. 'Trigger Once' means, trigger once when these conditions become true, not trigger once only ever. If the conditions become false again (in your case object not touching) then it will trigger again the next time.

    Use lionz suggestion of a variable to keep track of if the trigger has been fired already.

    On object touched

    Is object Var_triggered=false

    Trigger Once - Set object Var_triggered to True

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