4ian / GDevelop

🎮 Open-source, cross-platform 2D/3D/multiplayer game engine designed for everyone.
https://gdevelop.io
Other
10.85k stars 851 forks source link

Unintended tween behavior when scene is resumed #5097

Closed lhphr closed 1 year ago

lhphr commented 1 year ago

Describe the bug

Resuming the scene changes some object parameters to the value of the last played tween which affected said parameters, even if the tween is already completed.

To Reproduce

Steps to reproduce the behavior:

  1. Tween some object parameter (object position is one visual way to see it).
  2. Wait for the tween to finish, then change the object parameter to something else without using tweens.
  3. Pause the scene and go to a different one.
  4. Resume the scene by exiting the current one.
  5. Object parameters are different.

Small test project file showing the bug (uses position as example, but is replicable with other parameters)

Other details

OS: Windows 10 Pro 21H1 GDevelop version: 5.1.158, Desktop

AlexandreSi commented 1 year ago

Thanks for reporting this issue and thank you for the project, that was really helpful!

Here is the diagnostic:

When we resume a scene, shifty is called to process all existing tweens. When doing so, shifty does not care if its tween instance has the hasEnded flag and processes it (See https://jeremyckahn.github.io/shifty/doc/tweenable.js.html#line120), making it take the target value of the tween.

I will check if this can be fixed/improved in shifty before trying to find a solution of our own.