[Resolved] Tweens not working as intended

Hello, I’m just starting out on gdevelop and I’m trying to make a simple duck shooter game where I tween the ducks to move about the screen.

I’m facing an issue with tweening where all the ducks stop at the 2nd or 3rd iteration of the tween and just don’t move altogether even if I don’t do anything whereas the expected output is that they would keep moving until they get shot by the player.

Here’s a screenshot of the game events

I use an array of structures to tween the ducks and i is the index of the array which gets put in a circular queue

Any and all help would be greatly appreciated.

1 Like

I think the issue will lie here:

The condition “Tween finished playing” selects all the object that meet the conditions. However, the action remove tween only works on one of the objects, not all at once. You’ll need to:

  1. remove the trigger once. It doesn’t work on groups of objects like you think (see below)
  2. add a for each object event as a subevent of the “Tween finished playing”, and put the actions in that for each event.

Trigger Once on multiple objects explained:

  • Generally, tirgger once works by checking when a condition is true now, but wasn’t true the previous time the event condition was checked.

  • If you have multiple objects that meet the conditions with a Trigger once while true, and you only update one or some of the objects, then there will be objects remaining that will not be updated.

  • Because those objects still meet the condition, the trigger once condition treats it as unchanged from the previous time it was checked, and so returns false.

  • And so a stalemate is reached, where the objects don’t change because the conditions are never met, and the conditions are never met because the objects don’t change.

I hope that explains it a wee bit.

It worked! Thank you very much for the answer and the explanation.