Make tween play everytime on condition?

Hello!

I’m unsure how to make a tween play again everytime a specific condition happens

1000023528

I want it so when Player collides with a wall, the tween plays, making the box visible for a bit then fading out.

A bonus would be making a cooldown timer for 5 seconds so it doesn’t trigger every single time.

How would I go about doing this? :thinking:
(Any help is appreciated)

I don’t see an event where the opacity of the box is brought back to it’s original value. The tween MAY be running again, but as the opacity is already at 0, it will be tweening from 0 to 0

Maybe consider an extra event above the Show & Tween event with a trigger once condition that returns the opacity back to it’s original value

Player is in collision
– trigger once - opacity to 255
– Show & Tween

Right, i think maybe they misunderstood hiding and showing as opacity, which wouldve been clever, but no.

It works! Thank you so much!

I thought the trigger once condition had to be inside the same condition box for it to work.

For anyone who may read this in the future, here’s my logic:

Condition:
At beginning of scene: Hide BOX

Condition:
Trigger Once

Condition:
Player is in collsion with Wall

Action:
Show BOX
Change opacity of BOX: set to 255
Tween opacity of BOX

Though my original problem is sovled, do you have any solution to add a cooldown timer?
Like, when the wall is touched, it won’t trigger the box effect again until 5 seconds have passed?

No need for trigger once or show/hide. Opacity already serves for show/hide and your conditions are sufficient to only trigger once already, as they only stay true for one frame.


The use of a timer would be the convenient solution, but it inherits the property of not showing the box, if the player collides with the wall in the first 5 seconds of gameplay. If you want to account for this, you should use a variable timer (best practice). That could go like like this:

Which is, in my opinion, a better practice anyways. For a few reasons (e.g. better customizable).

This was incredibly helpful, and I appreciate you using pictures to show me how it’s done!

Thank you all for your help :grin: