Reset a tween animation

I have a sprite that when the player collides with it, it triggers a tween to move a nearby horizontal door to the left. I want it to tween back more slowly if the sprite is collided with again as long as the first tween has finished. Below is what I have. It works to start the tween, and to do the tween to make it go back. But, after that, collisions with the “switch” sprite no longer trigger the process again.

How do I get it to repeat all of that when the player collides with the switch a third time?

you would have to make it go to the original pos then stop tween then start the same tween

Isn’t that what I did in the code above?

true uh i didn’t check screenshot

Any thoughts on why it isn’t working?

cuz conditions are not met?

Are you just guessing? I need to figure out what to change.

The problem is that last event (labelled 3 in the image below) only gets checked once, when the tween doorMoveRight is created. and the conditions in the parent (labelled 2 in the image below) are met (i.e. once). So the tweens will never be removed

Changes you should make:

  1. Add a condition to the first event (labelled 1) to also check that doorMoveRight doesn’t exist.
  2. Change the event labelled 2 ;
    -change the condition to check that doorMoveLeftt doesn’t exist
    -add a condition to check that doorMoveRight doesn’t exist, and
  3. Remove the set boolean object variabel SwitchLever.on from both the exising subevents (the subevents of the events labelled 1 & 2)
  4. Outdent/ move the last event (labelled 3) to be in line with the 2 parent events (labelled 1 & 2)
  5. Then split that last event into two event
    -one to check that doorMoveRight has finished playing, removing the tween and setting the boolean object variable SwitchLever.on to false
    -the other to check that doorMoveLeft has finished playing, removing the tween, and setting the boolean object variable SwitchLever.on to true

That is blindingly obvious, and the comment is of no help.

1 Like

Thanks! @MrMen That fixed it.

I really appreciate all the helpful advice you’ve been giving me.

1 Like

no need to be mean about it I was just saying maybe cuz conditions are not met cuz idk if he tested with making all conditions met

also it is of little help of me saying its not met but yes your comment is more helpful

uh yah a little cuz i just looked at the picture of like 5 seconds and then assumed the conditions were not met(thought idk which ones were not cuz I only looked at it for 5 seconds, sorry)