Tween Has Finished Playing - What am I missing?

What am I missing here? I thought this condition and subsequent actions would be a good cue to use the tween animation of the last button arriving in it’s resting position to animate the “highlight” animation sequence of my first button. However running this as a test, the first button doesn’t animate after the last button finishes its tween.

What am I missing here?!

Just to clarify, what do you want to do? By “tween” do you mean for the button’s animation, or the Pathfinding tween? (confused because of the naming).
Assuming you mean animation (like the button slowly rising after being pressed), that’s not what this Tween is for - you’d have to make the animation frames yourself, or just settle for an event that gradually changes opacity between the two buttons.

Hi Cat. Thanks for taking a look. I am doing an x-position tween of a sprite - so from pos x1 tweening to pos x2. When the sprite object has arrived at its final position at x2 ie it’s finished playing the tween, use that trigger to cue a new animation playing on one of the other sprites. IE finishing the positional tween of one sprite, triggers the playback/animation of another sprite

I’ve tried Tween for the first time now, and all I had to do is start a tween (scale, in my case), then create a condition that checks if this tween has finished. :

It does enlarge the other object gradually, then finishes by setting the background color.
I’ve yet to try animation change, but it could be your tween hasn’t finished playing. Try other code like changing background color?

If not that, and the animation name for the “first button” is correct, try instead assigning a scene variable (true/false) when the tween finishes, then in another event, check for said variable is true, then set it to the animation.

Thanks! I’ll take a look. To me it would seem like ‘Has Finished Playing’ is the same condition so it would be working but I’ll have a play as you’ve suggested and see if I can get it working. Cheers!

1 Like

No joy here. As far as I can tell GDevelop 5 x position tween doesn’t trigger the “finished playing” condition or at least doesn’t allow me to have the scope once it’s triggered for one object to manipulate a secondary object.

I’m totes NOOBS though so it’s very likely doing it wrong : )

Everyone’s a noob at some point - you’re bashing yourself head first into the wall, and that’s already a good start. :wink:

Anyway, I’m unsure why that would be - just tested an X position tween in the template project. Here’s how it looks like: (It then moves slowly to 200 X coordinate, over 2 seconds.)

Can you show more of your events sheet? (Although it’d be best to get only the relevant parts, you can show more if you’re unsure)

Hiya. It got late here last night so I retired for the evening. Here’s the events sheet. The sprites all tween perfectly, it’s just that last condition that doesn’t trigger.

That’s better.
Some suggestions: Does FrameCounter have a 32th frame? IIRC the animation frame starts counting at 0, so you can either add another frame or change the last animation frame condition to 31 (this would be the case if it never tweens/moves to position 342)
If the QuitAssistant does finish tweening, you could try testing some other, more visible, action, like setting background colour or quitting the game - purely for confirming if the condition is triggered! If the game’s BG changes colour/closes itself, then I assume for whatever reason, the final condition/event does not change the animation of PlayerSetup just because it’s not in the condition. So, using scene variables (not tied to object) and putting a condition to check for the scene variable to play the animation instead would help.

If the “tween has finished playing” condition is met, but the animation isn’t change, I can only say check your animation for PlayerSetup…

FrameCounter is a transparent .PNG image sequence sprite that runs for 124 frames so it won’t be that. But that’s a great idea re: something obvious

I ended up just using FrameCounter to cue the animation change and a few frames later rather than relying on the tween but I’d be keen to see if I can get it working and also I can see using variables to switch on and off different animation being very useful


1 Like

@white_brick I’m having the exact same problem now.


You’re missing a “remove tween” instruction to get rid of the previous tween before starting the new one, see this thread: