Skip to content

Conversation

@github-actions
Copy link
Contributor

Description

Advanced Back and Forth Movement

Advanced Back and Forth Movement is a Sprite behavior that moves a sprite back and forth on one axis, reversing after a set travel distance.

It supports optional start delay, pauses at each end, sprite flipping, animation synchronization, runtime control via actions, and per instance overrides via object variables.

Detailed documentation will be published on the GDevelop wiki once the extension is merged.

ScreenGrab.mp4

Typical uses

  • Patrolling enemies and NPCs.
  • Moving platforms.
  • Simple sentry style motion with optional pauses at each end.

How to use the extension

Setup

Add the Advanced Back and Forth Movement behavior to a Sprite object, then configure:

  • Activate movement
  • Move speed (px/s)
  • Travel distance (px)
  • Movement orientation (horizontal or vertical)
  • Initial direction (positive or negative)
  • Movement start delay (s) (optional)
  • Pause between direction reversals (s) (optional)
  • Flip sprite on movement reverse (optional)
  • Synchronize animation with movement (optional)
  • Reset animation index on pause (optional, only relevant if animation sync is enabled)

Runtime control

You can change speed, distance, direction, pauses, delays, enabled state, sprite flipping, and animation synchronization at runtime via actions.

Per instance overrides (optional)

You can override behavior settings per instance using object variables.

Preferred variable structure:

  • __AdvancedBackAndForthMovement

Supported alias:

  • ABFM

If a child exists, it overrides the corresponding behavior setting for that instance. If it does not exist, the behavior default is used.
If both structures exist on the same instance, __AdvancedBackAndForthMovement takes precedence and ABFM is ignored.

Supported children

  • MoveSpeed (number): movement speed in pixels per second.
  • MoveDistance (number): travel distance in pixels.
  • MoveHorizontal (boolean): true for horizontal movement, false for vertical.
  • StartPositive (boolean): true starts in the positive direction (right or down), false starts in the negative direction (left or up).
  • StartDelay (number): start delay in seconds.
  • PauseTime (number): pause duration at each end in seconds.
  • Enabled (boolean): enables or disables movement for that instance.
  • FlipSprite (boolean): enables or disables sprite flipping on direction reverse for that instance.
  • SyncAnimation (boolean): enables or disables synchronizing animation state (paused/playing) with movement for that instance.
  • AnimationReset (boolean): enables or disables resetting animation index to frame 0 when a pause begins for that instance, only relevant if SyncAnimation is true.

Checklist

  • I've followed all of the best practices.
  • 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.

Example file

ABFM_Demo.zip

Extension file

AdvancedBackAndForthMovement.zip


Extension by @Indeterminado

You can update the extension on this "Pull Request" by commenting the update command: in the comment field, type !update, then drag and drop a zip file with your extension file in the commenting field, like how you initially submitted the extension. It should look like this:

!update [MyExtension.zip](https://github.com/GDevelopApp/GDevelop-extensions/files/12709661/MyExtension.zip)

It can take a few seconds for the file to fully upload and show as the above. Once it is like shown above, click "Comment" and let the bot do the rest!

@github-actions github-actions bot requested a review from a team as a code owner January 12, 2026 14:14
@github-actions github-actions bot added the ✨ New extension A new extension label Jan 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

✨ New extension A new extension

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants