New extension: Advanced Back and Forth Movement #1985
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
How to use the extension
Setup
Add the Advanced Back and Forth Movement behavior to a Sprite object, then configure:
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:
__AdvancedBackAndForthMovementSupported alias:
ABFMIf 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 ifSyncAnimationis true.Checklist
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: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!