Skip to content

Fix Shake object drifting when switching between shakes - #2355

Open
4ian wants to merge 1 commit into
mainfrom
claude/busy-dijkstra-e5w33f
Open

4ian wants to merge 1 commit into
mainfrom
claude/busy-dijkstra-e5w33f

Conversation

@4ian

@4ian 4ian commented Nov 6, 2026

Copy link
Copy Markdown
Collaborator

Description

Switching between two shakes that keep going until stopped (for example, one per state) left the object at the angle, position or scale it had reached, and this offset built up at each switch. There were two causes:

  • "Stop shaking" only set a flag that was handled at the end of the frame. Starting a new shake in the same frame overwrote the flag, so the stop never happened.
  • The previous shake's movement was only undone on the axes the new shake uses. For example, the angle reached by an angle shake was never reset once a scale shake replaced it.

Changes:

  • "Stop shaking" now resets the object to its original position, angle and scale immediately.
  • The reset is driven by how far the object actually moved, not by the current shake's amplitudes. It is done by a new private action, UndoShakeDisplacement.
  • Version bumped to 1.6.3.

How to use it

Use "Stop shaking" then "Shake object" (with "Keep shaking until stopped") in each state, each with different parameters. Every new shake now starts from the object's original values.

Example project

None attached. I tested it with a gameplay test run in GDevelop 5.6.287, using two states that switch between an angle shake and a scale shake. It fails with the old version (the object stays tilted by 2.45° during the scale shake) and passes with this one. The gameplay tests of the 10 examples that use this extension also pass with it.

Checklist

  • I've followed all of the best practices. The checks of this pull request must pass.
  • I confirm that this extension can be integrated to this GitHub repository, distributed and MIT licensed.
  • I am aware that the extension may be updated by anyone, and do not need my explicit consent to do so.

AI usage

  • I used an AI to generate some part of the code.
  • I don't understand the generated code or I don't feel able to modify it.

Generated by Claude Code

When a shake was stopped and another one started in the same frame (the
documented way to change the shake parameters), the object kept the
angle/position/scale it had reached instead of going back to its original
values:
- "Stop shaking" only flagged the shake to be stopped at the end of the
  frame, and starting the new shake overwrote this flag, so the stop was
  never processed.
- The displacement of the previous shake was only undone for the
  amplitudes of the current shake. Once the new shake replaced them (for
  example, an angle shake replaced by a scale shake), the angle reached by
  the previous shake was never undone and accumulated at each switch.

Now "Stop shaking" undoes the displacement immediately, and the
displacement is undone according to what was actually travelled rather
than the current amplitudes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GFZnZxMkqmjNFcNf4uAZnZ
@4ian
4ian requested a review from a team as a code owner November 6, 2026 18:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants