diff --git a/extensions/community/AdvancedBackAndForthMovement.json b/extensions/community/AdvancedBackAndForthMovement.json new file mode 100644 index 000000000..11e2b6261 --- /dev/null +++ b/extensions/community/AdvancedBackAndForthMovement.json @@ -0,0 +1,4021 @@ +{ + "author": "", + "category": "Movement", + "extensionNamespace": "", + "fullName": "Advanced Back and Forth Movement", + "gdevelopVersion": "", + "helpPath": "", + "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0ibWRpLXR1bmUtdmFyaWFudCIgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0IiB2aWV3Qm94PSIwIDAgMjQgMjQiPjxwYXRoIGQ9Ik04IDEzQzYuMTQgMTMgNC41OSAxNC4yOCA0LjE0IDE2SDJWMThINC4xNEM0LjU5IDE5LjcyIDYuMTQgMjEgOCAyMVMxMS40MSAxOS43MiAxMS44NiAxOEgyMlYxNkgxMS44NkMxMS40MSAxNC4yOCA5Ljg2IDEzIDggMTNNOCAxOUM2LjkgMTkgNiAxOC4xIDYgMTdDNiAxNS45IDYuOSAxNSA4IDE1UzEwIDE1LjkgMTAgMTdDMTAgMTguMSA5LjEgMTkgOCAxOU0xOS44NiA2QzE5LjQxIDQuMjggMTcuODYgMyAxNiAzUzEyLjU5IDQuMjggMTIuMTQgNkgyVjhIMTIuMTRDMTIuNTkgOS43MiAxNC4xNCAxMSAxNiAxMVMxOS40MSA5LjcyIDE5Ljg2IDhIMjJWNkgxOS44Nk0xNiA5QzE0LjkgOSAxNCA4LjEgMTQgN0MxNCA1LjkgMTQuOSA1IDE2IDVTMTggNS45IDE4IDdDMTggOC4xIDE3LjEgOSAxNiA5WiIgLz48L3N2Zz4=", + "name": "AdvancedBackAndForthMovement", + "previewIconUrl": "https://asset-resources.gdevelop.io/public-resources/Icons/e9faf1b8aa5d8b9243ec171de4c0ae8d4fddddb4844e6edecf03071e47449ef5_tune-variant.svg", + "shortDescription": "Back and forth movement with optional start delay, end pause, sprite flipping, and optional per instance overrides.", + "version": "1.0.0", + "description": [ + "## Advanced Back and Forth Movement", + "", + "This extension adds a behavior that moves a Sprite back and forth on one axis, reversing after a set distance, with optional delay, pause, sprite flip, and animation sync.", + "", + "### Typical uses", + "* Patrolling enemies and NPCs.", + "* Moving platforms.", + "* Simple sentry style motion with optional pauses at each end.", + "", + "### 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." + ], + "tags": [ + "movement", + "patrol", + "back-and-forth", + "distance-based", + "pause", + "delay", + "moving-platform", + "enemy", + "npc", + "sentry" + ], + "authorIds": [ + "pjv8wX6ACiNkaHS9v4ljmViKbNp2" + ], + "dependencies": [], + "globalVariables": [], + "sceneVariables": [], + "eventsFunctions": [], + "eventsBasedBehaviors": [ + { + "description": "Moves an object back and forth by distance, with optional start delay, end pauses, sprite flipping, and per instance overrides.", + "fullName": "Advanced Back and Forth Movement", + "name": "AdvancedBackAndForthMovement", + "objectType": "Sprite", + "eventsFunctions": [ + { + "fullName": "", + "functionType": "Action", + "name": "onCreated", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "AdvancedBackAndForthMovement::AdvancedBackAndForthMovement::InitVariables" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "Sprite", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "AdvancedBackAndForthMovement::AdvancedBackAndForthMovement", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Reset object variables to initial state", + "fullName": "Initialize Variables", + "functionType": "Action", + "group": "Advanced Back and Forth Movement (private)", + "name": "InitVariables", + "private": true, + "sentence": "Set _PARAM0_ variables to initial state. _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "Creation", + "=", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "MettreXY" + }, + "parameters": [ + "Object", + "=", + "StartPositionX", + "=", + "StartPositionY" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "Creation", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "StartPositionX", + "=", + "Object.X()" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "StartPositionY", + "=", + "Object.Y()" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "InitialMoveDirection", + "=", + "\"Positive\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "CurrentDirection", + "=", + "1" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "InitialMoveDirection", + "=", + "\"Negative\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "CurrentDirection", + "=", + "-1" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "DistanceMoved", + "=", + "0" + ] + }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsPaused", + "True", + "" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "DelayRemaining", + "=", + "max(0, StartDelay)" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "PauseRemaining", + "=", + "0" + ] + }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "Initialized", + "False", + "" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "Sprite", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "AdvancedBackAndForthMovement::AdvancedBackAndForthMovement", + "type": "behavior" + }, + { + "defaultValue": "yes", + "description": "Is object being created", + "name": "Creation", + "optional": true, + "type": "yesorno" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "Action", + "name": "doStepPreEvents", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "Initialized", + "False", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "AdvancedBackAndForthMovement::AdvancedBackAndForthMovement::CheckOverrides" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsPaused", + "False", + "" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::Or" + }, + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "Active", + "False", + "" + ] + }, + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "Speed", + "<=", + "0" + ] + }, + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "Distance", + "<=", + "0" + ] + }, + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "DelayRemaining", + ">", + "0" + ] + }, + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "PauseRemaining", + ">", + "0" + ] + }, + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "Initialized", + "False", + "" + ] + } + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsPaused", + "True", + "" + ] + } + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::And" + }, + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "Speed", + ">", + "0" + ] + }, + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "Active", + "True", + "" + ] + }, + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "Initialized", + "True", + "" + ] + } + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TD", + "=", + "TimeDelta()" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "DelayRemaining", + ">", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "DelayRemaining", + "=", + "max(0, DelayRemaining - TD)" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::And" + }, + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "DelayRemaining", + "<=", + "0" + ] + }, + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "PauseRemaining", + ">", + "0" + ] + } + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "PauseRemaining", + "=", + "max(0, PauseRemaining - TD)" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "PauseRemaining", + "=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "CurrentDirection", + "*", + "-1" + ] + }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsPaused", + "False", + "" + ] + }, + { + "type": { + "value": "AdvancedBackAndForthMovement::AdvancedBackAndForthMovement::FlipObject" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsPaused", + "False", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "AdvancedBackAndForthMovement::AdvancedBackAndForthMovement::DoStep" + }, + "parameters": [ + "Object", + "Behavior", + "TD * Speed * CurrentDirection", + "" + ] + } + ] + } + ], + "variables": [ + { + "name": "TD", + "type": "number", + "value": 0 + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "AnimationSync", + "True", + "" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "AnimatableCapability::AnimatableBehavior::IsAnimationPaused" + }, + "parameters": [ + "Object", + "Animation" + ] + }, + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsPaused", + "False", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "AnimatableCapability::AnimatableBehavior::PlayAnimation" + }, + "parameters": [ + "Object", + "Animation" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "AnimatableCapability::AnimatableBehavior::IsAnimationPaused" + }, + "parameters": [ + "Object", + "Animation" + ] + }, + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsPaused", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "AnimatableCapability::AnimatableBehavior::PauseAnimation" + }, + "parameters": [ + "Object", + "Animation" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "AnimationSyncReset", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "ChangeSprite" + }, + "parameters": [ + "Object", + "=", + "0" + ] + } + ] + } + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "Sprite", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "AdvancedBackAndForthMovement::AdvancedBackAndForthMovement", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "CheckOverrides", + "functionType": "Action", + "group": "Advanced Back and Forth Movement (private)", + "name": "CheckOverrides", + "private": true, + "sentence": "Check if user is overriding any properties of _PARAM1_ for _PARAM0_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "Initialized", + "False", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "Initialized", + "True", + "" + ] + }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "UsePreferredOverrides", + "False", + "" + ] + } + ], + "events": [ + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "__AdvancedBackAndForthMovement Overrides", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ + { + "folded": true, + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "ObjectVariableChildExists" + }, + "parameters": [ + "Object", + "__AdvancedBackAndForthMovement", + "\"AnimationReset\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "UsePreferredOverrides", + "True", + "" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "ObjectVariableAsBoolean" + }, + "parameters": [ + "Object", + "__AdvancedBackAndForthMovement.AnimationReset", + "True" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "AnimationSyncReset", + "True", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "ObjectVariableAsBoolean" + }, + "parameters": [ + "Object", + "__AdvancedBackAndForthMovement.AnimationReset", + "False" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "AnimationSyncReset", + "False", + "" + ] + } + ] + } + ] + }, + { + "folded": true, + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "ObjectVariableChildExists" + }, + "parameters": [ + "Object", + "__AdvancedBackAndForthMovement", + "\"SyncAnimation\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "UsePreferredOverrides", + "True", + "" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "ObjectVariableAsBoolean" + }, + "parameters": [ + "Object", + "__AdvancedBackAndForthMovement.SyncAnimation", + "True" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "AnimationSync", + "True", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "ObjectVariableAsBoolean" + }, + "parameters": [ + "Object", + "__AdvancedBackAndForthMovement.SyncAnimation", + "False" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "AnimationSync", + "False", + "" + ] + } + ] + } + ] + }, + { + "folded": true, + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "ObjectVariableChildExists" + }, + "parameters": [ + "Object", + "__AdvancedBackAndForthMovement", + "\"FlipSprite\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "UsePreferredOverrides", + "True", + "" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "ObjectVariableAsBoolean" + }, + "parameters": [ + "Object", + "__AdvancedBackAndForthMovement.FlipSprite", + "True" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "FlipSprite", + "True", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "ObjectVariableAsBoolean" + }, + "parameters": [ + "Object", + "__AdvancedBackAndForthMovement.FlipSprite", + "False" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "FlipSprite", + "False", + "" + ] + } + ] + } + ] + }, + { + "folded": true, + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "ObjectVariableChildExists" + }, + "parameters": [ + "Object", + "__AdvancedBackAndForthMovement", + "\"Enabled\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "UsePreferredOverrides", + "True", + "" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "ObjectVariableAsBoolean" + }, + "parameters": [ + "Object", + "__AdvancedBackAndForthMovement.Enabled", + "True" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "Active", + "True", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "ObjectVariableAsBoolean" + }, + "parameters": [ + "Object", + "__AdvancedBackAndForthMovement.Enabled", + "False" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "Active", + "False", + "" + ] + } + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "ObjectVariableChildExists" + }, + "parameters": [ + "Object", + "__AdvancedBackAndForthMovement", + "\"PauseTime\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "PauseTimeAtReversals", + "=", + "max(0,Object.Variable(__AdvancedBackAndForthMovement.PauseTime))" + ] + }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "UsePreferredOverrides", + "True", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "ObjectVariableChildExists" + }, + "parameters": [ + "Object", + "__AdvancedBackAndForthMovement", + "\"StartDelay\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "StartDelay", + "=", + "max(0,Object.Variable(__AdvancedBackAndForthMovement.StartDelay))" + ] + }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "UsePreferredOverrides", + "True", + "" + ] + } + ] + }, + { + "folded": true, + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "ObjectVariableChildExists" + }, + "parameters": [ + "Object", + "__AdvancedBackAndForthMovement", + "\"StartPositive\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "UsePreferredOverrides", + "True", + "" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "ObjectVariableAsBoolean" + }, + "parameters": [ + "Object", + "__AdvancedBackAndForthMovement.StartPositive", + "True" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "InitialMoveDirection", + "=", + "\"Positive\"" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "CurrentDirection", + "=", + "1" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "ObjectVariableAsBoolean" + }, + "parameters": [ + "Object", + "__AdvancedBackAndForthMovement.StartPositive", + "False" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "InitialMoveDirection", + "=", + "\"Negative\"" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "CurrentDirection", + "=", + "-1" + ] + } + ] + } + ] + }, + { + "folded": true, + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "ObjectVariableChildExists" + }, + "parameters": [ + "Object", + "__AdvancedBackAndForthMovement", + "\"MoveHorizontal\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "UsePreferredOverrides", + "True", + "" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "ObjectVariableAsBoolean" + }, + "parameters": [ + "Object", + "__AdvancedBackAndForthMovement.MoveHorizontal", + "True" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "MovementAxis", + "=", + "\"Horizontal\"" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "ObjectVariableAsBoolean" + }, + "parameters": [ + "Object", + "__AdvancedBackAndForthMovement.MoveHorizontal", + "False" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "MovementAxis", + "=", + "\"Vertical\"" + ] + } + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "ObjectVariableChildExists" + }, + "parameters": [ + "Object", + "__AdvancedBackAndForthMovement", + "\"MoveDistance\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "Distance", + "=", + "max(0,Object.Variable(__AdvancedBackAndForthMovement.MoveDistance))" + ] + }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "UsePreferredOverrides", + "True", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "ObjectVariableChildExists" + }, + "parameters": [ + "Object", + "__AdvancedBackAndForthMovement", + "\"MoveSpeed\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "Speed", + "=", + "max(0,Object.Variable(__AdvancedBackAndForthMovement.MoveSpeed))" + ] + }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "UsePreferredOverrides", + "True", + "" + ] + } + ] + } + ], + "parameters": [] + }, + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "ABFM Overrides", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "UsePreferredOverrides", + "False", + "" + ] + } + ], + "actions": [], + "events": [ + { + "folded": true, + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "ObjectVariableChildExists" + }, + "parameters": [ + "Object", + "ABFM", + "\"AnimationReset\"" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "ObjectVariableAsBoolean" + }, + "parameters": [ + "Object", + "ABFM.AnimationReset", + "True" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "AnimationSyncReset", + "True", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "ObjectVariableAsBoolean" + }, + "parameters": [ + "Object", + "ABFM.AnimationReset", + "False" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "AnimationSyncReset", + "False", + "" + ] + } + ] + } + ] + }, + { + "folded": true, + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "ObjectVariableChildExists" + }, + "parameters": [ + "Object", + "ABFM", + "\"SyncAnimation\"" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "ObjectVariableAsBoolean" + }, + "parameters": [ + "Object", + "ABFM.SyncAnimation", + "True" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "AnimationSync", + "True", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "ObjectVariableAsBoolean" + }, + "parameters": [ + "Object", + "ABFM.SyncAnimation", + "False" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "AnimationSync", + "False", + "" + ] + } + ] + } + ] + }, + { + "folded": true, + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "ObjectVariableChildExists" + }, + "parameters": [ + "Object", + "ABFM", + "\"FlipSprite\"" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "ObjectVariableAsBoolean" + }, + "parameters": [ + "Object", + "ABFM.FlipSprite", + "True" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "FlipSprite", + "True", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "ObjectVariableAsBoolean" + }, + "parameters": [ + "Object", + "ABFM.FlipSprite", + "False" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "FlipSprite", + "False", + "" + ] + } + ] + } + ] + }, + { + "folded": true, + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "ObjectVariableChildExists" + }, + "parameters": [ + "Object", + "ABFM", + "\"Enabled\"" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "ObjectVariableAsBoolean" + }, + "parameters": [ + "Object", + "ABFM.Enabled", + "True" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "Active", + "True", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "ObjectVariableAsBoolean" + }, + "parameters": [ + "Object", + "ABFM.Enabled", + "False" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "Active", + "False", + "" + ] + } + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "ObjectVariableChildExists" + }, + "parameters": [ + "Object", + "ABFM", + "\"PauseTime\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "PauseTimeAtReversals", + "=", + "max(0,Object.Variable(ABFM.PauseTime))" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "ObjectVariableChildExists" + }, + "parameters": [ + "Object", + "ABFM", + "\"StartDelay\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "StartDelay", + "=", + "max(0,Object.Variable(ABFM.StartDelay))" + ] + } + ] + }, + { + "folded": true, + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "ObjectVariableChildExists" + }, + "parameters": [ + "Object", + "ABFM", + "\"StartPositive\"" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "ObjectVariableAsBoolean" + }, + "parameters": [ + "Object", + "ABFM.StartPositive", + "True" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "InitialMoveDirection", + "=", + "\"Positive\"" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "CurrentDirection", + "=", + "1" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "ObjectVariableAsBoolean" + }, + "parameters": [ + "Object", + "ABFM.StartPositive", + "False" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "InitialMoveDirection", + "=", + "\"Negative\"" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "CurrentDirection", + "=", + "-1" + ] + } + ] + } + ] + }, + { + "folded": true, + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "ObjectVariableChildExists" + }, + "parameters": [ + "Object", + "ABFM", + "\"MoveHorizontal\"" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "ObjectVariableAsBoolean" + }, + "parameters": [ + "Object", + "ABFM.MoveHorizontal", + "True" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "MovementAxis", + "=", + "\"Horizontal\"" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "ObjectVariableAsBoolean" + }, + "parameters": [ + "Object", + "ABFM.MoveHorizontal", + "False" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "MovementAxis", + "=", + "\"Vertical\"" + ] + } + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "ObjectVariableChildExists" + }, + "parameters": [ + "Object", + "ABFM", + "\"MoveDistance\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "Distance", + "=", + "max(0,Object.Variable(ABFM.MoveDistance))" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "ObjectVariableChildExists" + }, + "parameters": [ + "Object", + "ABFM", + "\"MoveSpeed\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "Speed", + "=", + "max(0,Object.Variable(ABFM.MoveSpeed))" + ] + } + ] + } + ] + } + ], + "parameters": [] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "DelayRemaining", + "=", + "max(0, StartDelay)" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "PauseRemaining", + "=", + "0" + ] + } + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "Sprite", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "AdvancedBackAndForthMovement::AdvancedBackAndForthMovement", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Reset object to initial state.", + "fullName": "Reset object motion and position", + "functionType": "Action", + "group": "Advanced Back and Forth Movement", + "name": "ResetObject", + "sentence": "Reset _PARAM0_ to its initial state", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "AdvancedBackAndForthMovement::AdvancedBackAndForthMovement::InitVariables" + }, + "parameters": [ + "Object", + "Behavior", + "no", + "" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "Sprite", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "AdvancedBackAndForthMovement::AdvancedBackAndForthMovement", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "DoStep", + "functionType": "Action", + "group": "Advanced Back and Forth Movement (private)", + "name": "DoStep", + "private": true, + "sentence": "Make _PARAM0_ move _PARAM2_ in the active axis", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "DistanceMoved", + "+", + "abs(Step)" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "Overshoot", + "=", + "DistanceMoved - Distance" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "Overshoot", + "<", + "0" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "MovementAxis", + "=", + "\"Horizontal\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "MettreX" + }, + "parameters": [ + "Object", + "+", + "Step" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "MovementAxis", + "=", + "\"Vertical\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "MettreY" + }, + "parameters": [ + "Object", + "+", + "Step" + ] + } + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "Overshoot", + ">=", + "0" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "MovementAxis", + "=", + "\"Horizontal\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "MettreX" + }, + "parameters": [ + "Object", + "+", + "Step" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "PauseTimeAtReversals", + ">", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "DistanceMoved", + "=", + "0" + ] + }, + { + "type": { + "value": "MettreX" + }, + "parameters": [ + "Object", + "+", + "Overshoot * CurrentDirection * -1" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "PauseRemaining", + "=", + "PauseTimeAtReversals" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "PauseTimeAtReversals", + "<=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "CurrentDirection", + "*", + "-1" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "DistanceMoved", + "=", + "Overshoot" + ] + }, + { + "type": { + "value": "MettreX" + }, + "parameters": [ + "Object", + "+", + "Overshoot * CurrentDirection * 2" + ] + } + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "MovementAxis", + "=", + "\"Vertical\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "MettreY" + }, + "parameters": [ + "Object", + "+", + "Step" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "PauseTimeAtReversals", + ">", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "DistanceMoved", + "=", + "0" + ] + }, + { + "type": { + "value": "MettreY" + }, + "parameters": [ + "Object", + "+", + "Overshoot * CurrentDirection * -1" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "PauseRemaining", + "=", + "PauseTimeAtReversals" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "PauseTimeAtReversals", + "<=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "CurrentDirection", + "*", + "-1" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "DistanceMoved", + "=", + "Overshoot" + ] + }, + { + "type": { + "value": "MettreY" + }, + "parameters": [ + "Object", + "+", + "Overshoot * CurrentDirection * 2" + ] + } + ] + } + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "AdvancedBackAndForthMovement::AdvancedBackAndForthMovement::FlipObject" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } + ] + } + ], + "variables": [ + { + "name": "Overshoot", + "type": "number", + "value": 0 + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "Sprite", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "AdvancedBackAndForthMovement::AdvancedBackAndForthMovement", + "type": "behavior" + }, + { + "description": "Pixel amount to move object", + "name": "Step", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "the distance the object should travel before turning around (px).", + "fullName": "Travel distance", + "functionType": "ExpressionAndCondition", + "group": "Advanced Back and Forth Movement", + "name": "Distance", + "sentence": "The travel distance", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "Distance" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "Sprite", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "AdvancedBackAndForthMovement::AdvancedBackAndForthMovement", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "Distance", + "name": "SetDistance", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "Distance", + "=", + "Value" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "Sprite", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "AdvancedBackAndForthMovement::AdvancedBackAndForthMovement", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "the movement speed of the object (px/s).", + "fullName": "Move speed", + "functionType": "ExpressionAndCondition", + "group": "Advanced Back and Forth Movement", + "name": "Speed", + "sentence": "The move speed", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "Speed" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "Sprite", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "AdvancedBackAndForthMovement::AdvancedBackAndForthMovement", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "Speed", + "name": "SetSpeed", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "Speed", + "=", + "Value" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "Sprite", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "AdvancedBackAndForthMovement::AdvancedBackAndForthMovement", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Object is set to flip with move direction.", + "fullName": "Object is set to flip with move direction", + "functionType": "Condition", + "group": "Advanced Back and Forth Movement", + "name": "FlipSprite", + "sentence": "_PARAM0_ is set to flip with move direction", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "FlipSprite", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "Sprite", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "AdvancedBackAndForthMovement::AdvancedBackAndForthMovement", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Enable or disable sprite flipping when direction changes.", + "fullName": "Flip sprite", + "functionType": "Action", + "group": "Advanced Back and Forth Movement", + "name": "SetFlipSprite", + "sentence": "Set sprite flipping for _PARAM0_ to _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "Value", + "False", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "FlipSprite", + "False", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "Value", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "FlipSprite", + "True", + "" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "Sprite", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "AdvancedBackAndForthMovement::AdvancedBackAndForthMovement", + "type": "behavior" + }, + { + "defaultValue": "yes", + "description": "Flip_Sprite", + "name": "Value", + "optional": true, + "type": "yesorno" + } + ], + "objectGroups": [] + }, + { + "description": "the movement axis of the object.", + "fullName": "Movement axis", + "functionType": "ExpressionAndCondition", + "group": "Advanced Back and Forth Movement", + "name": "MovementAxis", + "sentence": "The movement axis", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnString" + }, + "parameters": [ + "MovementAxis" + ] + } + ] + } + ], + "expressionType": { + "supplementaryInformation": "[\"Horizontal\",\"Vertical\"]", + "type": "stringWithSelector" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "Sprite", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "AdvancedBackAndForthMovement::AdvancedBackAndForthMovement", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "the starting move direction of the object.", + "fullName": "Starting move direction", + "functionType": "ExpressionAndCondition", + "group": "Advanced Back and Forth Movement", + "name": "InitialDirection", + "sentence": "The starting move direction", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnString" + }, + "parameters": [ + "InitialMoveDirection" + ] + } + ] + } + ], + "expressionType": { + "supplementaryInformation": "[\"Positive\",\"Negative\"]", + "type": "stringWithSelector" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "Sprite", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "AdvancedBackAndForthMovement::AdvancedBackAndForthMovement", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Set object movement direction.", + "fullName": "Set current direction", + "functionType": "Action", + "getterName": "Initial_Direction", + "group": "Advanced Back and Forth Movement", + "name": "SetCurrentDirection", + "sentence": "Set the current direction of _PARAM0_ to _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Direction", + "=", + "\"Positive\"" + ] + }, + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "CurrentDirection", + "=", + "-1" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "CurrentDirection", + "=", + "1" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "DistanceMoved", + "=", + "Distance - DistanceMoved" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Direction", + "=", + "\"Negative\"" + ] + }, + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "CurrentDirection", + "=", + "1" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "CurrentDirection", + "=", + "-1" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "DistanceMoved", + "=", + "Distance - DistanceMoved" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "AdvancedBackAndForthMovement::AdvancedBackAndForthMovement::FlipObject" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "Sprite", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "AdvancedBackAndForthMovement::AdvancedBackAndForthMovement", + "type": "behavior" + }, + { + "description": "Movement direction", + "name": "Direction", + "supplementaryInformation": "[\"Positive\",\"Negative\"]", + "type": "stringWithSelector" + } + ], + "objectGroups": [] + }, + { + "description": "Reverse object movement direction.", + "fullName": "Reverse movement", + "functionType": "Action", + "getterName": "Initial_Direction", + "group": "Advanced Back and Forth Movement", + "name": "ReverseDirection", + "sentence": "Reverse the current direction of _PARAM0_ immediately", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "CurrentDirection", + "*", + "-1" + ] + }, + { + "type": { + "value": "AdvancedBackAndForthMovement::AdvancedBackAndForthMovement::FlipObject" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "DistanceMoved", + "=", + "Distance - DistanceMoved" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "Sprite", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "AdvancedBackAndForthMovement::AdvancedBackAndForthMovement", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Is object movement enabled.", + "fullName": "Is movement enabled", + "functionType": "Condition", + "group": "Advanced Back and Forth Movement", + "name": "Enabled", + "sentence": "Movement is enabled for _PARAM0_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "Active", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "Sprite", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "AdvancedBackAndForthMovement::AdvancedBackAndForthMovement", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Enable or disable movement.", + "fullName": "Set movement enabled", + "functionType": "Action", + "group": "Advanced Back and Forth Movement", + "name": "SetEnabled", + "sentence": "Set movement enabled for _PARAM0_ to _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "Value", + "False", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "Active", + "False", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "Value", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "Active", + "True", + "" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "Sprite", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "AdvancedBackAndForthMovement::AdvancedBackAndForthMovement", + "type": "behavior" + }, + { + "defaultValue": "yes", + "description": "Enabled", + "name": "Value", + "optional": true, + "type": "yesorno" + } + ], + "objectGroups": [] + }, + { + "description": "the pause between direction reversals of the object.", + "fullName": "Pause at reversals (s)", + "functionType": "ExpressionAndCondition", + "group": "Advanced Back and Forth Movement", + "name": "PauseAtReversals", + "sentence": "The pause duration at each end (in seconds)", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "PauseTimeAtReversals" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "Sprite", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "AdvancedBackAndForthMovement::AdvancedBackAndForthMovement", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "PauseAtReversals", + "name": "SetPauseAtReversals", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "PauseTimeAtReversals", + "=", + "Value" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "Sprite", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "AdvancedBackAndForthMovement::AdvancedBackAndForthMovement", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "FlipObject", + "functionType": "Action", + "group": "Advanced Back and Forth Movement (private)", + "name": "FlipObject", + "private": true, + "sentence": "Flip _PARAM0_ as defined in _PARAM1_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "AdvancedBackAndForthMovement::AdvancedBackAndForthMovement::FlipSprite" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "MovementAxis", + "=", + "\"Horizontal\"" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "CurrentDirection", + "=", + "1" + ] + } + ], + "actions": [ + { + "type": { + "value": "FlippableCapability::FlippableBehavior::FlipX" + }, + "parameters": [ + "Object", + "Flippable", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "CurrentDirection", + "=", + "-1" + ] + } + ], + "actions": [ + { + "type": { + "value": "FlippableCapability::FlippableBehavior::FlipX" + }, + "parameters": [ + "Object", + "Flippable", + "yes" + ] + } + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "MovementAxis", + "=", + "\"Vertical\"" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "CurrentDirection", + "=", + "1" + ] + } + ], + "actions": [ + { + "type": { + "value": "FlippableCapability::FlippableBehavior::FlipY" + }, + "parameters": [ + "Object", + "Flippable", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "CurrentDirection", + "=", + "-1" + ] + } + ], + "actions": [ + { + "type": { + "value": "FlippableCapability::FlippableBehavior::FlipY" + }, + "parameters": [ + "Object", + "Flippable", + "yes" + ] + } + ] + } + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "Sprite", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "AdvancedBackAndForthMovement::AdvancedBackAndForthMovement", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Check if object is currently paused.", + "fullName": "Is paused", + "functionType": "Condition", + "group": "Advanced Back and Forth Movement", + "name": "IsObjectPaused", + "sentence": "_PARAM0_ is currently paused", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsPaused", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "Sprite", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "AdvancedBackAndForthMovement::AdvancedBackAndForthMovement", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Animation is synchronized with movement.", + "fullName": "Animation is synchronized with movement", + "functionType": "Condition", + "group": "Advanced Back and Forth Movement", + "name": "SyncAnimation", + "sentence": "_PARAM0_ animation is synchronized with movement", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "AnimationSync", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "Sprite", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "AdvancedBackAndForthMovement::AdvancedBackAndForthMovement", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Change if animation pauses/resumes with movement.", + "fullName": "Synchronize animation with movement", + "functionType": "Action", + "group": "Advanced Back and Forth Movement", + "name": "SetSyncAnimation", + "sentence": "Set animation synchronization for _PARAM0_ to _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "Value", + "False", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "AnimationSync", + "False", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "Value", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "AnimationSync", + "True", + "" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "Sprite", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "AdvancedBackAndForthMovement::AdvancedBackAndForthMovement", + "type": "behavior" + }, + { + "defaultValue": "yes", + "description": "Sync_animation", + "name": "Value", + "optional": true, + "type": "yesorno" + } + ], + "objectGroups": [] + } + ], + "propertyDescriptors": [ + { + "value": "200", + "type": "Number", + "unit": "Pixel", + "label": "Travel distance", + "description": "Distance the object should travel before turning around (pixels)", + "group": "01: Movement details", + "name": "Distance" + }, + { + "value": "100", + "type": "Number", + "unit": "PixelSpeed", + "label": "Move speed", + "description": "Speed the object moves (pixels per second)", + "group": "01: Movement details", + "name": "Speed" + }, + { + "value": "Positive", + "type": "Choice", + "label": "Initial direction", + "description": "What direction should the object face and move towards at the start?", + "group": "02: Movement direction", + "choices": [ + { + "label": "Right/Down", + "value": "Positive" + }, + { + "label": "Left/Up", + "value": "Negative" + } + ], + "name": "InitialMoveDirection" + }, + { + "value": "Horizontal", + "type": "Choice", + "label": "Movement orientation", + "description": "Selects the movement axis, horizontal or vertical", + "group": "02: Movement direction", + "choices": [ + { + "label": "(X)", + "value": "Horizontal" + }, + { + "label": "(Y)", + "value": "Vertical" + } + ], + "name": "MovementAxis" + }, + { + "value": "true", + "type": "Boolean", + "label": "Activate movement", + "description": "Lets you selectively activate/deactivate movement", + "group": "01: Movement details", + "name": "Active" + }, + { + "value": "true", + "type": "Boolean", + "label": "Flip sprite on movement reverse", + "description": "Flip the object when direction changes. The sprite should face right by default for horizontal movement, and down by default for vertical movement", + "group": "04: Visuals", + "name": "FlipSprite" + }, + { + "value": "0", + "type": "Number", + "unit": "Second", + "label": "Movement start delay (seconds)", + "description": "Adds a delay before the object starts moving", + "group": "03: Advanced movement", + "name": "StartDelay" + }, + { + "value": "0", + "type": "Number", + "unit": "Second", + "label": "Pause between direction reversals", + "description": "Adds a hold time when it reaches an end before reversing", + "group": "03: Advanced movement", + "name": "PauseTimeAtReversals" + }, + { + "value": "true", + "type": "Boolean", + "label": "Synchronize animation with movement", + "description": "Pauses/resumes animation with movement, if start delay or reversal pause are set", + "group": "04: Visuals", + "name": "AnimationSync" + }, + { + "value": "true", + "type": "Boolean", + "label": "Reset animation index on pause", + "description": "If true, current animation will reset to frame 0 on pause", + "group": "04: Visuals", + "name": "AnimationSyncReset" + }, + { + "value": "0", + "type": "Number", + "unit": "Dimensionless", + "label": "Current distance travelled", + "group": "Internals", + "hidden": true, + "name": "DistanceMoved" + }, + { + "value": "1", + "type": "Number", + "unit": "Dimensionless", + "label": "Current direction object is facing", + "group": "Internals", + "hidden": true, + "name": "CurrentDirection" + }, + { + "value": "", + "type": "Boolean", + "label": "Check if instance is created and initialized", + "group": "Internals", + "hidden": true, + "name": "Initialized" + }, + { + "value": "", + "type": "Number", + "unit": "Second", + "label": "Remainder of initial movement delay time", + "group": "Internals", + "hidden": true, + "name": "DelayRemaining" + }, + { + "value": "", + "type": "Number", + "unit": "Second", + "label": "Remainder of reversal pause time", + "group": "Internals", + "hidden": true, + "name": "PauseRemaining" + }, + { + "value": "false", + "type": "Boolean", + "label": "Current movement state", + "group": "Internals", + "hidden": true, + "name": "IsPaused" + }, + { + "value": "0", + "type": "Number", + "unit": "Dimensionless", + "label": "Object starting position x coordinate", + "group": "Internals", + "hidden": true, + "name": "StartPositionX" + }, + { + "value": "0", + "type": "Number", + "unit": "Dimensionless", + "label": "Object starting position y coordinate", + "group": "Internals", + "hidden": true, + "name": "StartPositionY" + }, + { + "value": "", + "type": "Boolean", + "label": "Check if the __AdvancedBackAndForthMovement structure exists", + "description": "If the __AdvancedBackAndForthMovement structure exists, ABFM alias should be ignored", + "group": "Internals", + "hidden": true, + "name": "UsePreferredOverrides" + } + ], + "sharedPropertyDescriptors": [] + } + ], + "eventsBasedObjects": [] +} \ No newline at end of file