diff --git a/examples/rtree/assets/Big Brown Meteor (1).png b/examples/rtree/assets/Big Brown Meteor (1).png new file mode 100644 index 000000000..10e2149e7 Binary files /dev/null and b/examples/rtree/assets/Big Brown Meteor (1).png differ diff --git a/examples/rtree/assets/Big Grey Meteor (2).png b/examples/rtree/assets/Big Grey Meteor (2).png new file mode 100644 index 000000000..204b56857 Binary files /dev/null and b/examples/rtree/assets/Big Grey Meteor (2).png differ diff --git a/examples/rtree/assets/Green Ufo.png b/examples/rtree/assets/Green Ufo.png new file mode 100644 index 000000000..8348d2a52 Binary files /dev/null and b/examples/rtree/assets/Green Ufo.png differ diff --git a/examples/rtree/assets/Red playerShip (1).png b/examples/rtree/assets/Red playerShip (1).png new file mode 100644 index 000000000..213f1be09 Binary files /dev/null and b/examples/rtree/assets/Red playerShip (1).png differ diff --git a/examples/rtree/assets/tiled_dark purple space.png b/examples/rtree/assets/tiled_dark purple space.png new file mode 100644 index 000000000..dba417ad3 Binary files /dev/null and b/examples/rtree/assets/tiled_dark purple space.png differ diff --git a/examples/rtree/game.json b/examples/rtree/game.json new file mode 100644 index 000000000..d9cbe02e4 --- /dev/null +++ b/examples/rtree/game.json @@ -0,0 +1,11252 @@ +{ + "firstLayout": "", + "gdVersion": { + "build": 99, + "major": 4, + "minor": 0, + "revision": 0 + }, + "properties": { + "adaptGameResolutionAtRuntime": true, + "folderProject": false, + "orientation": "landscape", + "packageName": "com.example.gamename", + "pixelsRounding": false, + "projectUuid": "f5e2e5ef-42bf-401f-935e-8980c937c295", + "scaleMode": "linear", + "sizeOnStartupMode": "", + "templateSlug": "", + "useExternalSourceFiles": false, + "version": "1.0.0", + "name": "R-Tree", + "description": "", + "author": "", + "windowWidth": 1280, + "windowHeight": 720, + "latestCompilationDirectory": "", + "maxFPS": 60, + "minFPS": 20, + "verticalSync": false, + "platformSpecificAssets": {}, + "loadingScreen": { + "backgroundColor": 0, + "backgroundFadeInDuration": 0.2, + "backgroundImageResourceName": "", + "gdevelopLogoStyle": "light", + "logoAndProgressFadeInDuration": 0.2, + "logoAndProgressLogoFadeInDelay": 0.2, + "minDuration": 1.5, + "progressBarColor": 16777215, + "progressBarHeight": 20, + "progressBarMaxWidth": 200, + "progressBarMinWidth": 40, + "progressBarWidthPercent": 30, + "showGDevelopSplash": true, + "showProgressBar": true + }, + "authorIds": [], + "categories": [], + "playableDevices": [], + "extensionProperties": [], + "platforms": [ + { + "name": "GDevelop JS platform" + } + ], + "currentPlatform": "GDevelop JS platform" + }, + "resources": { + "resources": [ + { + "alwaysLoaded": false, + "file": "assets/Red playerShip (1).png", + "kind": "image", + "metadata": "", + "name": "Red playerShip (1).png", + "smoothed": true, + "userAdded": false, + "origin": { + "identifier": "https://asset-resources.gdevelop.io/public-resources/Space Shooter/PNG/b331b3700315a046506f289a74e04b71f3decdd90eaddc6fefdb4af856a05d83_Red playerShip (1).png", + "name": "Red playerShip (1).png" + } + }, + { + "alwaysLoaded": false, + "file": "assets/Big Brown Meteor (1).png", + "kind": "image", + "metadata": "", + "name": "Big Brown Meteor (1).png", + "smoothed": true, + "userAdded": false, + "origin": { + "identifier": "https://asset-resources.gdevelop.io/public-resources/Space Shooter/PNG/Meteors/ae6802c87f6e3e4739b6260b23e4546582daad3fb803446401fbec2bc057f297_Big Brown Meteor (1).png", + "name": "Big Brown Meteor (1).png" + } + }, + { + "alwaysLoaded": false, + "file": "assets/Big Grey Meteor (2).png", + "kind": "image", + "metadata": "", + "name": "Big Grey Meteor (2).png", + "smoothed": true, + "userAdded": false, + "origin": { + "identifier": "https://asset-resources.gdevelop.io/public-resources/Space Shooter/PNG/Meteors/401dea3495a58458e490689209f4c600652397a44bfc31314e80d0af334173aa_Big Grey Meteor (2).png", + "name": "Big Grey Meteor (2).png" + } + }, + { + "alwaysLoaded": false, + "file": "assets/Green Ufo.png", + "kind": "image", + "metadata": "", + "name": "Green Ufo.png", + "smoothed": true, + "userAdded": false, + "origin": { + "identifier": "https://asset-resources.gdevelop.io/public-resources/Space Shooter/PNG/2b4a714caf06d48d59fdf976e24f873804cd6aa4f801accb34334dcfc109ddfa_Green Ufo.png", + "name": "Green Ufo.png" + } + }, + { + "alwaysLoaded": false, + "file": "assets/tiled_dark purple space.png", + "kind": "image", + "metadata": "", + "name": "tiled_dark purple space.png", + "smoothed": true, + "userAdded": false, + "origin": { + "identifier": "https://asset-resources.gdevelop.io/public-resources/Space Shooter/Backgrounds/59a7d361a270a586a7079a0b2b074758f56d5a1d9f9b83811686cfe95fdfce9a_tiled_dark purple space.png", + "name": "tiled_dark purple space.png" + } + } + ], + "resourceFolders": [] + }, + "objects": [], + "objectsGroups": [], + "variables": [], + "layouts": [ + { + "b": 37, + "disableInputWhenNotFocused": true, + "mangledName": "Huge_32level", + "name": "Huge level", + "r": 37, + "standardSortMethod": true, + "stopSoundsOnStartup": true, + "title": "", + "v": 37, + "uiSettings": { + "grid": false, + "gridType": "rectangular", + "gridWidth": 32, + "gridHeight": 32, + "gridOffsetX": 0, + "gridOffsetY": 0, + "gridColor": 10401023, + "gridAlpha": 0.8, + "snap": false, + "zoomFactor": 0.546875, + "windowMask": false + }, + "objectsGroups": [ + { + "name": "Obstacle", + "objects": [ + { + "name": "BigBrownMeteor1" + }, + { + "name": "BigGreyMeteor2" + } + ] + } + ], + "variables": [], + "instances": [ + { + "angle": 0, + "customSize": false, + "height": 0, + "layer": "", + "name": "RedPlayerShip1", + "persistentUuid": "2e250ef1-eb4c-4bd6-a44f-8d11cd8b7062", + "width": 0, + "x": 563, + "y": 311, + "zOrder": 1, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": true, + "height": 720, + "layer": "Background", + "name": "DarkPurpleSpace", + "persistentUuid": "1ae1b12e-866d-4bd3-996f-708d5886282f", + "width": 1280, + "x": 0, + "y": 0, + "zOrder": 0, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + } + ], + "objects": [ + { + "assetStoreId": "2b2dfbbe01d820384d341ecfa1cf553b2700019a4f78c1d6fc4c55cb4b373bf5", + "name": "RedPlayerShip1", + "tags": "", + "type": "Sprite", + "updateIfNotVisible": false, + "variables": [], + "effects": [], + "behaviors": [ + { + "name": "TopDownMovement", + "type": "TopDownMovementBehavior::TopDownMovementBehavior", + "acceleration": 400, + "allowDiagonals": true, + "angleOffset": 90, + "angularMaxSpeed": 180, + "customIsometryAngle": 30, + "deceleration": 800, + "ignoreDefaultControls": false, + "maxSpeed": 800, + "movementAngleOffset": 0, + "rotateObject": true, + "viewpoint": "TopDown" + } + ], + "animations": [ + { + "name": "", + "useMultipleDirections": false, + "directions": [ + { + "looping": true, + "timeBetweenFrames": 0.025, + "sprites": [ + { + "hasCustomCollisionMask": false, + "image": "Red playerShip (1).png", + "points": [], + "originPoint": { + "name": "origine", + "x": 0, + "y": 0 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [] + } + ] + } + ] + } + ] + }, + { + "assetStoreId": "911c6f50a4c05507c6fc1df967493f61a7ce9bad9e144cec92f6ff32be42749a", + "name": "BigBrownMeteor1", + "tags": "", + "type": "Sprite", + "updateIfNotVisible": false, + "variables": [], + "effects": [], + "behaviors": [ + { + "name": "Obstacle", + "type": "CollisionDetector::Solid", + "SolidType": "Mobile" + } + ], + "animations": [ + { + "name": "", + "useMultipleDirections": false, + "directions": [ + { + "looping": true, + "timeBetweenFrames": 0.025, + "sprites": [ + { + "hasCustomCollisionMask": false, + "image": "Big Brown Meteor (1).png", + "points": [], + "originPoint": { + "name": "origine", + "x": 0, + "y": 0 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [] + } + ] + } + ] + } + ] + }, + { + "assetStoreId": "fe9de3e97f21ea1ff6d364d2efe3e7d379cb150152cc2461b10d1ed05f803d09", + "name": "BigGreyMeteor2", + "tags": "", + "type": "Sprite", + "updateIfNotVisible": false, + "variables": [], + "effects": [], + "behaviors": [ + { + "name": "Obstacle", + "type": "CollisionDetector::Solid", + "SolidType": "Mobile" + } + ], + "animations": [ + { + "name": "", + "useMultipleDirections": false, + "directions": [ + { + "looping": true, + "timeBetweenFrames": 0.025, + "sprites": [ + { + "hasCustomCollisionMask": false, + "image": "Big Grey Meteor (2).png", + "points": [], + "originPoint": { + "name": "origine", + "x": 0, + "y": 0 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [] + } + ] + } + ] + } + ] + }, + { + "assetStoreId": "533531c482d07673a4a1afcf644e20f3e37081ca636e762a437212a8f6520fa5", + "name": "GreenUfo", + "tags": "", + "type": "Sprite", + "updateIfNotVisible": false, + "variables": [], + "effects": [], + "behaviors": [ + { + "name": "EllipseMovement", + "type": "EllipseMovement::EllipseMovement", + "RadiusX": 100, + "RadiusY": 100, + "LoopDuration": 6, + "InitialTurningLeft": false, + "InitialDirectionAngle": 0, + "ShouldRotate": false, + "RotationOffset": 0, + "CenterX": 0, + "CenterY": 0, + "MovementAngle": 0, + "OldX": 0, + "OldY": 0 + }, + { + "name": "OnScreenDetector", + "type": "CollisionDetector::OnScreenDetector", + "SolidBehavior": "Solid" + }, + { + "name": "Solid", + "type": "CollisionDetector::Solid", + "PreviousX": 0, + "PreviousY": 0, + "PreviousWidth": 0, + "PreviousHeight": 0, + "PreviousAngle": 0, + "FatFactor": 0.5, + "SolidType": "Mobile" + } + ], + "animations": [ + { + "name": "", + "useMultipleDirections": false, + "directions": [ + { + "looping": true, + "timeBetweenFrames": 0.025, + "sprites": [ + { + "hasCustomCollisionMask": false, + "image": "Green Ufo.png", + "points": [], + "originPoint": { + "name": "origine", + "x": 0, + "y": 0 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [] + } + ] + } + ] + } + ] + }, + { + "assetStoreId": "13cd7e810ccf090c3a8b9df66aa427613de5271d59507471a06f9ddbbccbcbf4", + "height": 128, + "name": "DarkPurpleSpace", + "tags": "", + "texture": "tiled_dark purple space.png", + "type": "TiledSpriteObject::TiledSprite", + "width": 128, + "variables": [], + "effects": [], + "behaviors": [] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "DepartScene" + }, + "parameters": [ + "" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "2048", + "conditions": [], + "actions": [ + { + "type": { + "value": "Create" + }, + "parameters": [ + "", + "GreenUfo", + "RandomInRange(-12800, 12800)", + "RandomInRange(-7200, 7200)", + "" + ] + }, + { + "type": { + "value": "EllipseMovement::EllipseMovement::SetMovementAngle" + }, + "parameters": [ + "GreenUfo", + "EllipseMovement", + "RandomFloat(360)", + "" + ] + }, + { + "type": { + "value": "ActivateBehavior" + }, + "parameters": [ + "GreenUfo", + "EllipseMovement", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "CollisionDetector::IsOnScreen" + }, + "parameters": [ + "", + "GreenUfo", + "OnScreenDetector", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "ActivateBehavior" + }, + "parameters": [ + "GreenUfo", + "EllipseMovement", + "yes" + ] + } + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "CollisionDetector::HasLeftScreen" + }, + "parameters": [ + "", + "GreenUfo", + "OnScreenDetector", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "ActivateBehavior" + }, + "parameters": [ + "GreenUfo", + "EllipseMovement", + "" + ] + } + ], + "events": [ + { + "disabled": true, + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "DebuggerTools::ConsoleLog" + }, + "parameters": [ + "\"Out: \" + ToString(PickedInstancesCount(GreenUfo))", + "", + "" + ] + } + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "CollisionDetector::WillEnterScreen" + }, + "parameters": [ + "", + "GreenUfo", + "OnScreenDetector", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "ActivateBehavior" + }, + "parameters": [ + "GreenUfo", + "EllipseMovement", + "yes" + ] + } + ], + "events": [ + { + "disabled": true, + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "DebuggerTools::ConsoleLog" + }, + "parameters": [ + "\"In: \" + ToString(PickedInstancesCount(GreenUfo))", + "", + "" + ] + } + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "CollisionDetector::IsOnScreen" + }, + "parameters": [ + "", + "GreenUfo", + "OnScreenDetector", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SeparateFromObjects" + }, + "parameters": [ + "RedPlayerShip1", + "GreenUfo", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "CentreCamera" + }, + "parameters": [ + "", + "RedPlayerShip1", + "", + "", + "" + ] + }, + { + "type": { + "value": "TiledSpriteObject::XOffset" + }, + "parameters": [ + "DarkPurpleSpace", + "=", + "CameraBorderLeft()" + ] + }, + { + "type": { + "value": "TiledSpriteObject::YOffset" + }, + "parameters": [ + "DarkPurpleSpace", + "=", + "CameraBorderTop()" + ] + } + ] + } + ], + "layers": [ + { + "ambientLightColorB": 8724112, + "ambientLightColorG": 6059824, + "ambientLightColorR": 8689552, + "followBaseLayerCamera": false, + "isLightingLayer": false, + "name": "Background", + "visibility": true, + "cameras": [], + "effects": [] + }, + { + "ambientLightColorB": 0, + "ambientLightColorG": 9943112, + "ambientLightColorR": 16, + "followBaseLayerCamera": false, + "isLightingLayer": false, + "name": "", + "visibility": true, + "cameras": [ + { + "defaultSize": true, + "defaultViewport": true, + "height": 0, + "viewportBottom": 1, + "viewportLeft": 0, + "viewportRight": 1, + "viewportTop": 0, + "width": 0 + } + ], + "effects": [] + } + ], + "behaviorsSharedData": [ + { + "name": "EllipseMovement", + "type": "EllipseMovement::EllipseMovement" + }, + { + "name": "Obstacle", + "type": "CollisionDetector::Solid" + }, + { + "name": "OnScreenDetector", + "type": "CollisionDetector::OnScreenDetector", + "HasCheckObjectsThisFrame": false, + "PreviousCameraX": 0, + "PreviousCameraY": 0, + "SnapSize": 128, + "Layer": "" + }, + { + "name": "Solid", + "type": "CollisionDetector::Solid" + }, + { + "name": "TopDownMovement", + "type": "TopDownMovementBehavior::TopDownMovementBehavior" + } + ] + }, + { + "b": 37, + "disableInputWhenNotFocused": true, + "mangledName": "Huge_32level_32_40legacy_41", + "name": "Huge level (legacy)", + "r": 37, + "standardSortMethod": true, + "stopSoundsOnStartup": true, + "title": "", + "v": 37, + "uiSettings": { + "grid": false, + "gridType": "rectangular", + "gridWidth": 32, + "gridHeight": 32, + "gridOffsetX": 0, + "gridOffsetY": 0, + "gridColor": 10401023, + "gridAlpha": 0.8, + "snap": false, + "zoomFactor": 0.546875, + "windowMask": false + }, + "objectsGroups": [ + { + "name": "Obstacle", + "objects": [ + { + "name": "BigBrownMeteor1" + }, + { + "name": "BigGreyMeteor2" + } + ] + } + ], + "variables": [], + "instances": [ + { + "angle": 0, + "customSize": false, + "height": 0, + "layer": "", + "name": "RedPlayerShip1", + "persistentUuid": "2e250ef1-eb4c-4bd6-a44f-8d11cd8b7062", + "width": 0, + "x": 563, + "y": 311, + "zOrder": 1, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": true, + "height": 720, + "layer": "Background", + "name": "DarkPurpleSpace", + "persistentUuid": "1ae1b12e-866d-4bd3-996f-708d5886282f", + "width": 1280, + "x": 0, + "y": 0, + "zOrder": 0, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + } + ], + "objects": [ + { + "assetStoreId": "2b2dfbbe01d820384d341ecfa1cf553b2700019a4f78c1d6fc4c55cb4b373bf5", + "name": "RedPlayerShip1", + "tags": "", + "type": "Sprite", + "updateIfNotVisible": false, + "variables": [], + "effects": [], + "behaviors": [ + { + "name": "TopDownMovement", + "type": "TopDownMovementBehavior::TopDownMovementBehavior", + "acceleration": 400, + "allowDiagonals": true, + "angleOffset": 90, + "angularMaxSpeed": 180, + "customIsometryAngle": 30, + "deceleration": 800, + "ignoreDefaultControls": false, + "maxSpeed": 800, + "movementAngleOffset": 0, + "rotateObject": true, + "viewpoint": "TopDown" + } + ], + "animations": [ + { + "name": "", + "useMultipleDirections": false, + "directions": [ + { + "looping": true, + "timeBetweenFrames": 0.025, + "sprites": [ + { + "hasCustomCollisionMask": false, + "image": "Red playerShip (1).png", + "points": [], + "originPoint": { + "name": "origine", + "x": 0, + "y": 0 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [] + } + ] + } + ] + } + ] + }, + { + "assetStoreId": "911c6f50a4c05507c6fc1df967493f61a7ce9bad9e144cec92f6ff32be42749a", + "name": "BigBrownMeteor1", + "tags": "", + "type": "Sprite", + "updateIfNotVisible": false, + "variables": [], + "effects": [], + "behaviors": [], + "animations": [ + { + "name": "", + "useMultipleDirections": false, + "directions": [ + { + "looping": true, + "timeBetweenFrames": 0.025, + "sprites": [ + { + "hasCustomCollisionMask": false, + "image": "Big Brown Meteor (1).png", + "points": [], + "originPoint": { + "name": "origine", + "x": 0, + "y": 0 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [] + } + ] + } + ] + } + ] + }, + { + "assetStoreId": "fe9de3e97f21ea1ff6d364d2efe3e7d379cb150152cc2461b10d1ed05f803d09", + "name": "BigGreyMeteor2", + "tags": "", + "type": "Sprite", + "updateIfNotVisible": false, + "variables": [], + "effects": [], + "behaviors": [], + "animations": [ + { + "name": "", + "useMultipleDirections": false, + "directions": [ + { + "looping": true, + "timeBetweenFrames": 0.025, + "sprites": [ + { + "hasCustomCollisionMask": false, + "image": "Big Grey Meteor (2).png", + "points": [], + "originPoint": { + "name": "origine", + "x": 0, + "y": 0 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [] + } + ] + } + ] + } + ] + }, + { + "assetStoreId": "533531c482d07673a4a1afcf644e20f3e37081ca636e762a437212a8f6520fa5", + "name": "GreenUfo", + "tags": "", + "type": "Sprite", + "updateIfNotVisible": false, + "variables": [], + "effects": [], + "behaviors": [ + { + "name": "EllipseMovement", + "type": "EllipseMovement::EllipseMovement", + "RadiusX": 100, + "RadiusY": 100, + "LoopDuration": 6, + "InitialTurningLeft": false, + "InitialDirectionAngle": 0, + "ShouldRotate": false, + "RotationOffset": 0, + "CenterX": 0, + "CenterY": 0, + "MovementAngle": 0, + "OldX": 0, + "OldY": 0 + } + ], + "animations": [ + { + "name": "", + "useMultipleDirections": false, + "directions": [ + { + "looping": true, + "timeBetweenFrames": 0.025, + "sprites": [ + { + "hasCustomCollisionMask": false, + "image": "Green Ufo.png", + "points": [], + "originPoint": { + "name": "origine", + "x": 0, + "y": 0 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [] + } + ] + } + ] + } + ] + }, + { + "assetStoreId": "13cd7e810ccf090c3a8b9df66aa427613de5271d59507471a06f9ddbbccbcbf4", + "height": 128, + "name": "DarkPurpleSpace", + "tags": "", + "texture": "tiled_dark purple space.png", + "type": "TiledSpriteObject::TiledSprite", + "width": 128, + "variables": [], + "effects": [], + "behaviors": [] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "DepartScene" + }, + "parameters": [ + "" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "2048", + "conditions": [], + "actions": [ + { + "type": { + "value": "Create" + }, + "parameters": [ + "", + "GreenUfo", + "RandomInRange(-12800, 12800)", + "RandomInRange(-7200, 7200)", + "" + ] + }, + { + "type": { + "value": "EllipseMovement::EllipseMovement::SetMovementAngle" + }, + "parameters": [ + "GreenUfo", + "EllipseMovement", + "RandomFloat(360)", + "" + ] + } + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SeparateFromObjects" + }, + "parameters": [ + "RedPlayerShip1", + "GreenUfo", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "CentreCamera" + }, + "parameters": [ + "", + "RedPlayerShip1", + "", + "", + "" + ] + }, + { + "type": { + "value": "TiledSpriteObject::XOffset" + }, + "parameters": [ + "DarkPurpleSpace", + "=", + "CameraBorderLeft()" + ] + }, + { + "type": { + "value": "TiledSpriteObject::YOffset" + }, + "parameters": [ + "DarkPurpleSpace", + "=", + "CameraBorderTop()" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "ActivateBehavior" + }, + "parameters": [ + "GreenUfo", + "EllipseMovement", + "no" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "PosX" + }, + "parameters": [ + "GreenUfo", + ">", + "CameraBorderLeft(GreenUfo.Layer())" + ] + }, + { + "type": { + "value": "PosX" + }, + "parameters": [ + "GreenUfo", + "<", + "CameraBorderRight(GreenUfo.Layer())" + ] + }, + { + "type": { + "value": "PosY" + }, + "parameters": [ + "GreenUfo", + ">", + "CameraBorderTop(GreenUfo.Layer())" + ] + }, + { + "type": { + "value": "PosY" + }, + "parameters": [ + "GreenUfo", + "<", + "CameraBorderBottom(GreenUfo.Layer())" + ] + } + ], + "actions": [ + { + "type": { + "value": "ActivateBehavior" + }, + "parameters": [ + "GreenUfo", + "EllipseMovement", + "yes" + ] + } + ] + } + ], + "layers": [ + { + "ambientLightColorB": 8724112, + "ambientLightColorG": 6059824, + "ambientLightColorR": 8689552, + "followBaseLayerCamera": false, + "isLightingLayer": false, + "name": "Background", + "visibility": true, + "cameras": [], + "effects": [] + }, + { + "ambientLightColorB": 0, + "ambientLightColorG": 9943112, + "ambientLightColorR": 16, + "followBaseLayerCamera": false, + "isLightingLayer": false, + "name": "", + "visibility": true, + "cameras": [ + { + "defaultSize": true, + "defaultViewport": true, + "height": 0, + "viewportBottom": 1, + "viewportLeft": 0, + "viewportRight": 1, + "viewportTop": 0, + "width": 0 + } + ], + "effects": [] + } + ], + "behaviorsSharedData": [ + { + "name": "EllipseMovement", + "type": "EllipseMovement::EllipseMovement" + }, + { + "name": "TopDownMovement", + "type": "TopDownMovementBehavior::TopDownMovementBehavior" + } + ] + }, + { + "b": 37, + "disableInputWhenNotFocused": true, + "mangledName": "Screen_32warpping", + "name": "Screen warpping", + "r": 37, + "standardSortMethod": true, + "stopSoundsOnStartup": true, + "title": "", + "v": 37, + "uiSettings": { + "grid": false, + "gridType": "rectangular", + "gridWidth": 32, + "gridHeight": 32, + "gridOffsetX": 0, + "gridOffsetY": 0, + "gridColor": 10401023, + "gridAlpha": 0.8, + "snap": false, + "zoomFactor": 0.546875, + "windowMask": false + }, + "objectsGroups": [ + { + "name": "Obstacle", + "objects": [ + { + "name": "BigBrownMeteor1" + }, + { + "name": "BigGreyMeteor2" + } + ] + } + ], + "variables": [], + "instances": [], + "objects": [ + { + "assetStoreId": "2b2dfbbe01d820384d341ecfa1cf553b2700019a4f78c1d6fc4c55cb4b373bf5", + "name": "RedPlayerShip1", + "tags": "", + "type": "Sprite", + "updateIfNotVisible": false, + "variables": [], + "effects": [], + "behaviors": [], + "animations": [ + { + "name": "", + "useMultipleDirections": false, + "directions": [ + { + "looping": true, + "timeBetweenFrames": 0.025, + "sprites": [ + { + "hasCustomCollisionMask": false, + "image": "Red playerShip (1).png", + "points": [], + "originPoint": { + "name": "origine", + "x": 0, + "y": 0 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [] + } + ] + } + ] + } + ] + }, + { + "assetStoreId": "911c6f50a4c05507c6fc1df967493f61a7ce9bad9e144cec92f6ff32be42749a", + "name": "BigBrownMeteor1", + "tags": "", + "type": "Sprite", + "updateIfNotVisible": false, + "variables": [], + "effects": [], + "behaviors": [ + { + "name": "Obstacle", + "type": "CollisionDetector::Solid", + "SolidType": "Mobile" + } + ], + "animations": [ + { + "name": "", + "useMultipleDirections": false, + "directions": [ + { + "looping": true, + "timeBetweenFrames": 0.025, + "sprites": [ + { + "hasCustomCollisionMask": false, + "image": "Big Brown Meteor (1).png", + "points": [], + "originPoint": { + "name": "origine", + "x": 0, + "y": 0 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [] + } + ] + } + ] + } + ] + }, + { + "assetStoreId": "fe9de3e97f21ea1ff6d364d2efe3e7d379cb150152cc2461b10d1ed05f803d09", + "name": "BigGreyMeteor2", + "tags": "", + "type": "Sprite", + "updateIfNotVisible": false, + "variables": [], + "effects": [], + "behaviors": [ + { + "name": "Obstacle", + "type": "CollisionDetector::Solid", + "SolidType": "Mobile" + } + ], + "animations": [ + { + "name": "", + "useMultipleDirections": false, + "directions": [ + { + "looping": true, + "timeBetweenFrames": 0.025, + "sprites": [ + { + "hasCustomCollisionMask": false, + "image": "Big Grey Meteor (2).png", + "points": [], + "originPoint": { + "name": "origine", + "x": 0, + "y": 0 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [] + } + ] + } + ] + } + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "DepartScene" + }, + "parameters": [ + "" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "512", + "conditions": [], + "actions": [ + { + "type": { + "value": "Create" + }, + "parameters": [ + "", + "BigBrownMeteor1", + "RandomInRange(0, 1280)", + "RandomInRange(0, 720)", + "" + ] + } + ] + }, + { + "disabled": true, + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "128", + "conditions": [], + "actions": [ + { + "type": { + "value": "Create" + }, + "parameters": [ + "", + "BigGreyMeteor2", + "RandomInRange(0, 1280)", + "RandomInRange(0, 720)", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "ChangeScale" + }, + "parameters": [ + "Obstacle", + "=", + "0.25" + ] + }, + { + "type": { + "value": "AddForceAL" + }, + "parameters": [ + "Obstacle", + "Random(360)", + "100", + "1" + ] + } + ] + } + ] + }, + { + "disabled": true, + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "CollisionDetector::IsAroundRectangle" + }, + "parameters": [ + "", + "Obstacle", + "Obstacle", + "MouseX()", + "MouseY()", + "MouseX()", + "MouseY()", + "" + ] + }, + { + "type": { + "value": "SourisSurObjet" + }, + "parameters": [ + "Obstacle", + "", + "", + "" + ] + }, + { + "type": { + "value": "BuiltinCommonInstructions::Once" + }, + "parameters": [] + } + ], + "actions": [ + { + "type": { + "value": "ChangeColor" + }, + "parameters": [ + "Obstacle", + "ToString(Random(255)) + \";\" + ToString(Random(255)) + \";\" + ToString(Random(255))" + ] + } + ] + }, + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Screen wrap", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "CollisionDetector::IsAroundRectangle" + }, + "parameters": [ + "", + "Obstacle", + "Obstacle", + "-128", + "-128", + "1280 + 128", + "-64", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "MettreY" + }, + "parameters": [ + "Obstacle", + "=", + "720" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "CollisionDetector::IsAroundRectangle" + }, + "parameters": [ + "", + "Obstacle", + "Obstacle", + "-128", + "720 + 64", + "1280 + 128", + "720 + 128", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "MettreY" + }, + "parameters": [ + "Obstacle", + "=", + "-32" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "CollisionDetector::IsAroundRectangle" + }, + "parameters": [ + "", + "Obstacle", + "Obstacle", + "-128", + "-128", + "-64", + "720 + 128", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "MettreX" + }, + "parameters": [ + "Obstacle", + "=", + "1280" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "CollisionDetector::IsAroundRectangle" + }, + "parameters": [ + "", + "Obstacle", + "Obstacle", + "1280 + 64", + "-128", + "1280 + 128", + "720 + 128", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "MettreX" + }, + "parameters": [ + "Obstacle", + "=", + "-32" + ] + } + ] + } + ], + "parameters": [] + } + ], + "layers": [ + { + "ambientLightColorB": 0, + "ambientLightColorG": 9943112, + "ambientLightColorR": 16, + "followBaseLayerCamera": false, + "isLightingLayer": false, + "name": "", + "visibility": true, + "cameras": [ + { + "defaultSize": true, + "defaultViewport": true, + "height": 0, + "viewportBottom": 1, + "viewportLeft": 0, + "viewportRight": 1, + "viewportTop": 0, + "width": 0 + } + ], + "effects": [] + } + ], + "behaviorsSharedData": [ + { + "name": "Obstacle", + "type": "CollisionDetector::Solid" + } + ] + }, + { + "b": 37, + "disableInputWhenNotFocused": true, + "mangledName": "Screen_32warpping_32_40legacy_41", + "name": "Screen warpping (legacy)", + "r": 37, + "standardSortMethod": true, + "stopSoundsOnStartup": true, + "title": "", + "v": 37, + "uiSettings": { + "grid": false, + "gridType": "rectangular", + "gridWidth": 32, + "gridHeight": 32, + "gridOffsetX": 0, + "gridOffsetY": 0, + "gridColor": 10401023, + "gridAlpha": 0.8, + "snap": false, + "zoomFactor": 0.546875, + "windowMask": false + }, + "objectsGroups": [ + { + "name": "Obstacle", + "objects": [ + { + "name": "BigBrownMeteor1" + }, + { + "name": "BigGreyMeteor2" + } + ] + } + ], + "variables": [], + "instances": [], + "objects": [ + { + "assetStoreId": "2b2dfbbe01d820384d341ecfa1cf553b2700019a4f78c1d6fc4c55cb4b373bf5", + "name": "RedPlayerShip1", + "tags": "", + "type": "Sprite", + "updateIfNotVisible": false, + "variables": [], + "effects": [], + "behaviors": [], + "animations": [ + { + "name": "", + "useMultipleDirections": false, + "directions": [ + { + "looping": true, + "timeBetweenFrames": 0.025, + "sprites": [ + { + "hasCustomCollisionMask": false, + "image": "Red playerShip (1).png", + "points": [], + "originPoint": { + "name": "origine", + "x": 0, + "y": 0 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [] + } + ] + } + ] + } + ] + }, + { + "assetStoreId": "911c6f50a4c05507c6fc1df967493f61a7ce9bad9e144cec92f6ff32be42749a", + "name": "BigBrownMeteor1", + "tags": "", + "type": "Sprite", + "updateIfNotVisible": false, + "variables": [], + "effects": [], + "behaviors": [ + { + "name": "ScreenWrap", + "type": "ScreenWrap::ScreenWrap", + "HorizontalWrapping": true, + "VerticalWrapping": true, + "BorderTop": 0, + "BorderLeft": 0, + "BorderRight": 0, + "BorderBottom": 0, + "TriggerOffset": 0 + } + ], + "animations": [ + { + "name": "", + "useMultipleDirections": false, + "directions": [ + { + "looping": true, + "timeBetweenFrames": 0.025, + "sprites": [ + { + "hasCustomCollisionMask": false, + "image": "Big Brown Meteor (1).png", + "points": [], + "originPoint": { + "name": "origine", + "x": 0, + "y": 0 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [] + } + ] + } + ] + } + ] + }, + { + "assetStoreId": "fe9de3e97f21ea1ff6d364d2efe3e7d379cb150152cc2461b10d1ed05f803d09", + "name": "BigGreyMeteor2", + "tags": "", + "type": "Sprite", + "updateIfNotVisible": false, + "variables": [], + "effects": [], + "behaviors": [ + { + "name": "ScreenWrap", + "type": "ScreenWrap::ScreenWrap", + "HorizontalWrapping": true, + "VerticalWrapping": true, + "BorderTop": 0, + "BorderLeft": 0, + "BorderRight": 0, + "BorderBottom": 0, + "TriggerOffset": 0 + } + ], + "animations": [ + { + "name": "", + "useMultipleDirections": false, + "directions": [ + { + "looping": true, + "timeBetweenFrames": 0.025, + "sprites": [ + { + "hasCustomCollisionMask": false, + "image": "Big Grey Meteor (2).png", + "points": [], + "originPoint": { + "name": "origine", + "x": 0, + "y": 0 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [] + } + ] + } + ] + } + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "DepartScene" + }, + "parameters": [ + "" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "512", + "conditions": [], + "actions": [ + { + "type": { + "value": "Create" + }, + "parameters": [ + "", + "BigBrownMeteor1", + "RandomInRange(0, 1280)", + "RandomInRange(0, 720)", + "" + ] + } + ] + }, + { + "disabled": true, + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "128", + "conditions": [], + "actions": [ + { + "type": { + "value": "Create" + }, + "parameters": [ + "", + "BigGreyMeteor2", + "RandomInRange(0, 1280)", + "RandomInRange(0, 720)", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "ChangeScale" + }, + "parameters": [ + "Obstacle", + "=", + "0.25" + ] + }, + { + "type": { + "value": "AddForceAL" + }, + "parameters": [ + "Obstacle", + "Random(360)", + "100", + "1" + ] + } + ] + } + ] + }, + { + "disabled": true, + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SourisSurObjet" + }, + "parameters": [ + "Obstacle", + "", + "", + "" + ] + }, + { + "type": { + "value": "BuiltinCommonInstructions::Once" + }, + "parameters": [] + } + ], + "actions": [ + { + "type": { + "value": "ChangeColor" + }, + "parameters": [ + "Obstacle", + "ToString(Random(255)) + \";\" + ToString(Random(255)) + \";\" + ToString(Random(255))" + ] + } + ] + } + ], + "layers": [ + { + "ambientLightColorB": 0, + "ambientLightColorG": 9943112, + "ambientLightColorR": 16, + "followBaseLayerCamera": false, + "isLightingLayer": false, + "name": "", + "visibility": true, + "cameras": [ + { + "defaultSize": true, + "defaultViewport": true, + "height": 0, + "viewportBottom": 1, + "viewportLeft": 0, + "viewportRight": 1, + "viewportTop": 0, + "width": 0 + } + ], + "effects": [] + } + ], + "behaviorsSharedData": [ + { + "name": "ScreenWrap", + "type": "ScreenWrap::ScreenWrap" + } + ] + }, + { + "b": 37, + "disableInputWhenNotFocused": true, + "mangledName": "Separate_32moving", + "name": "Separate moving", + "r": 37, + "standardSortMethod": true, + "stopSoundsOnStartup": true, + "title": "", + "v": 37, + "uiSettings": { + "grid": false, + "gridType": "rectangular", + "gridWidth": 32, + "gridHeight": 32, + "gridOffsetX": 0, + "gridOffsetY": 0, + "gridColor": 10401023, + "gridAlpha": 0.8, + "snap": false, + "zoomFactor": 0.546875, + "windowMask": false + }, + "objectsGroups": [ + { + "name": "Obstacle", + "objects": [ + { + "name": "BigBrownMeteor1" + }, + { + "name": "BigGreyMeteor2" + } + ] + } + ], + "variables": [], + "instances": [], + "objects": [ + { + "assetStoreId": "2b2dfbbe01d820384d341ecfa1cf553b2700019a4f78c1d6fc4c55cb4b373bf5", + "name": "RedPlayerShip1", + "tags": "", + "type": "Sprite", + "updateIfNotVisible": false, + "variables": [], + "effects": [], + "behaviors": [], + "animations": [ + { + "name": "", + "useMultipleDirections": false, + "directions": [ + { + "looping": true, + "timeBetweenFrames": 0.025, + "sprites": [ + { + "hasCustomCollisionMask": false, + "image": "Red playerShip (1).png", + "points": [], + "originPoint": { + "name": "origine", + "x": 0, + "y": 0 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [] + } + ] + } + ] + } + ] + }, + { + "assetStoreId": "911c6f50a4c05507c6fc1df967493f61a7ce9bad9e144cec92f6ff32be42749a", + "name": "BigBrownMeteor1", + "tags": "", + "type": "Sprite", + "updateIfNotVisible": false, + "variables": [], + "effects": [], + "behaviors": [ + { + "name": "Obstacle", + "type": "CollisionDetector::Solid", + "SolidType": "Mobile" + } + ], + "animations": [ + { + "name": "", + "useMultipleDirections": false, + "directions": [ + { + "looping": true, + "timeBetweenFrames": 0.025, + "sprites": [ + { + "hasCustomCollisionMask": false, + "image": "Big Brown Meteor (1).png", + "points": [], + "originPoint": { + "name": "origine", + "x": 0, + "y": 0 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [] + } + ] + } + ] + } + ] + }, + { + "assetStoreId": "fe9de3e97f21ea1ff6d364d2efe3e7d379cb150152cc2461b10d1ed05f803d09", + "name": "BigGreyMeteor2", + "tags": "", + "type": "Sprite", + "updateIfNotVisible": false, + "variables": [], + "effects": [], + "behaviors": [ + { + "name": "Obstacle", + "type": "CollisionDetector::Solid", + "SolidType": "Mobile" + } + ], + "animations": [ + { + "name": "", + "useMultipleDirections": false, + "directions": [ + { + "looping": true, + "timeBetweenFrames": 0.025, + "sprites": [ + { + "hasCustomCollisionMask": false, + "image": "Big Grey Meteor (2).png", + "points": [], + "originPoint": { + "name": "origine", + "x": 0, + "y": 0 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [] + } + ] + } + ] + } + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "DepartScene" + }, + "parameters": [ + "" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "512", + "conditions": [], + "actions": [ + { + "type": { + "value": "Create" + }, + "parameters": [ + "", + "BigBrownMeteor1", + "RandomInRange(0, 1280)", + "RandomInRange(0, 720)", + "" + ] + } + ] + }, + { + "disabled": true, + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "128", + "conditions": [], + "actions": [ + { + "type": { + "value": "Create" + }, + "parameters": [ + "", + "BigGreyMeteor2", + "RandomInRange(0, 1280)", + "RandomInRange(0, 720)", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "ChangeScale" + }, + "parameters": [ + "Obstacle", + "=", + "0.25" + ] + }, + { + "type": { + "value": "AddForceAL" + }, + "parameters": [ + "Obstacle", + "Random(360)", + "100", + "1" + ] + } + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "CollisionDetector::Separate" + }, + "parameters": [ + "", + "Obstacle", + "Obstacle", + "Obstacle", + "Obstacle", + "" + ] + } + ] + }, + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Screen wrap", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "CollisionDetector::IsAroundRectangle" + }, + "parameters": [ + "", + "Obstacle", + "Obstacle", + "-128", + "-128", + "1280 + 128", + "-64", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "MettreY" + }, + "parameters": [ + "Obstacle", + "=", + "720" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "CollisionDetector::IsAroundRectangle" + }, + "parameters": [ + "", + "Obstacle", + "Obstacle", + "-128", + "720 + 64", + "1280 + 128", + "720 + 128", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "MettreY" + }, + "parameters": [ + "Obstacle", + "=", + "-32" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "CollisionDetector::IsAroundRectangle" + }, + "parameters": [ + "", + "Obstacle", + "Obstacle", + "-128", + "-128", + "-64", + "720 + 128", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "MettreX" + }, + "parameters": [ + "Obstacle", + "=", + "1280" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "CollisionDetector::IsAroundRectangle" + }, + "parameters": [ + "", + "Obstacle", + "Obstacle", + "1280 + 64", + "-128", + "1280 + 128", + "720 + 128", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "MettreX" + }, + "parameters": [ + "Obstacle", + "=", + "-32" + ] + } + ] + } + ], + "parameters": [] + } + ], + "layers": [ + { + "ambientLightColorB": 0, + "ambientLightColorG": 9943112, + "ambientLightColorR": 16, + "followBaseLayerCamera": false, + "isLightingLayer": false, + "name": "", + "visibility": true, + "cameras": [ + { + "defaultSize": true, + "defaultViewport": true, + "height": 0, + "viewportBottom": 1, + "viewportLeft": 0, + "viewportRight": 1, + "viewportTop": 0, + "width": 0 + } + ], + "effects": [] + } + ], + "behaviorsSharedData": [ + { + "name": "Obstacle", + "type": "CollisionDetector::Solid" + } + ] + }, + { + "b": 37, + "disableInputWhenNotFocused": true, + "mangledName": "Separate_32moving_32_40legacy_41", + "name": "Separate moving (legacy)", + "r": 37, + "standardSortMethod": true, + "stopSoundsOnStartup": true, + "title": "", + "v": 37, + "uiSettings": { + "grid": false, + "gridType": "rectangular", + "gridWidth": 32, + "gridHeight": 32, + "gridOffsetX": 0, + "gridOffsetY": 0, + "gridColor": 10401023, + "gridAlpha": 0.8, + "snap": false, + "zoomFactor": 0.546875, + "windowMask": false + }, + "objectsGroups": [ + { + "name": "Obstacle", + "objects": [ + { + "name": "BigBrownMeteor1" + }, + { + "name": "BigGreyMeteor2" + } + ] + } + ], + "variables": [], + "instances": [], + "objects": [ + { + "assetStoreId": "2b2dfbbe01d820384d341ecfa1cf553b2700019a4f78c1d6fc4c55cb4b373bf5", + "name": "RedPlayerShip1", + "tags": "", + "type": "Sprite", + "updateIfNotVisible": false, + "variables": [], + "effects": [], + "behaviors": [], + "animations": [ + { + "name": "", + "useMultipleDirections": false, + "directions": [ + { + "looping": true, + "timeBetweenFrames": 0.025, + "sprites": [ + { + "hasCustomCollisionMask": false, + "image": "Red playerShip (1).png", + "points": [], + "originPoint": { + "name": "origine", + "x": 0, + "y": 0 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [] + } + ] + } + ] + } + ] + }, + { + "assetStoreId": "911c6f50a4c05507c6fc1df967493f61a7ce9bad9e144cec92f6ff32be42749a", + "name": "BigBrownMeteor1", + "tags": "", + "type": "Sprite", + "updateIfNotVisible": false, + "variables": [], + "effects": [], + "behaviors": [ + { + "name": "ScreenWrap", + "type": "ScreenWrap::ScreenWrap", + "HorizontalWrapping": true, + "VerticalWrapping": true, + "BorderTop": 0, + "BorderLeft": 0, + "BorderRight": 0, + "BorderBottom": 0, + "TriggerOffset": 0 + } + ], + "animations": [ + { + "name": "", + "useMultipleDirections": false, + "directions": [ + { + "looping": true, + "timeBetweenFrames": 0.025, + "sprites": [ + { + "hasCustomCollisionMask": false, + "image": "Big Brown Meteor (1).png", + "points": [], + "originPoint": { + "name": "origine", + "x": 0, + "y": 0 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [] + } + ] + } + ] + } + ] + }, + { + "assetStoreId": "fe9de3e97f21ea1ff6d364d2efe3e7d379cb150152cc2461b10d1ed05f803d09", + "name": "BigGreyMeteor2", + "tags": "", + "type": "Sprite", + "updateIfNotVisible": false, + "variables": [], + "effects": [], + "behaviors": [ + { + "name": "ScreenWrap", + "type": "ScreenWrap::ScreenWrap", + "HorizontalWrapping": true, + "VerticalWrapping": true, + "BorderTop": 0, + "BorderLeft": 0, + "BorderRight": 0, + "BorderBottom": 0, + "TriggerOffset": 0 + } + ], + "animations": [ + { + "name": "", + "useMultipleDirections": false, + "directions": [ + { + "looping": true, + "timeBetweenFrames": 0.025, + "sprites": [ + { + "hasCustomCollisionMask": false, + "image": "Big Grey Meteor (2).png", + "points": [], + "originPoint": { + "name": "origine", + "x": 0, + "y": 0 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [] + } + ] + } + ] + } + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "DepartScene" + }, + "parameters": [ + "" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "512", + "conditions": [], + "actions": [ + { + "type": { + "value": "Create" + }, + "parameters": [ + "", + "BigBrownMeteor1", + "RandomInRange(0, 1280)", + "RandomInRange(0, 720)", + "" + ] + } + ] + }, + { + "disabled": true, + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "128", + "conditions": [], + "actions": [ + { + "type": { + "value": "Create" + }, + "parameters": [ + "", + "BigGreyMeteor2", + "RandomInRange(0, 1280)", + "RandomInRange(0, 720)", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "ChangeScale" + }, + "parameters": [ + "Obstacle", + "=", + "0.25" + ] + }, + { + "type": { + "value": "AddForceAL" + }, + "parameters": [ + "Obstacle", + "Random(360)", + "100", + "1" + ] + } + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SeparateFromObjects" + }, + "parameters": [ + "Obstacle", + "Obstacle", + "" + ] + } + ] + } + ], + "layers": [ + { + "ambientLightColorB": 0, + "ambientLightColorG": 9943112, + "ambientLightColorR": 16, + "followBaseLayerCamera": false, + "isLightingLayer": false, + "name": "", + "visibility": true, + "cameras": [ + { + "defaultSize": true, + "defaultViewport": true, + "height": 0, + "viewportBottom": 1, + "viewportLeft": 0, + "viewportRight": 1, + "viewportTop": 0, + "width": 0 + } + ], + "effects": [] + } + ], + "behaviorsSharedData": [ + { + "name": "ScreenWrap", + "type": "ScreenWrap::ScreenWrap" + } + ] + }, + { + "b": 37, + "disableInputWhenNotFocused": true, + "mangledName": "Test_32separate", + "name": "Test separate", + "r": 37, + "standardSortMethod": true, + "stopSoundsOnStartup": true, + "title": "", + "v": 37, + "uiSettings": { + "grid": false, + "gridType": "rectangular", + "gridWidth": 32, + "gridHeight": 32, + "gridOffsetX": 0, + "gridOffsetY": 0, + "gridColor": 10401023, + "gridAlpha": 0.8, + "snap": false, + "zoomFactor": 0.546875, + "windowMask": false + }, + "objectsGroups": [ + { + "name": "Obstacle", + "objects": [ + { + "name": "BigBrownMeteor1" + }, + { + "name": "BigGreyMeteor2" + } + ] + } + ], + "variables": [], + "instances": [ + { + "angle": 0, + "customSize": false, + "height": 0, + "layer": "", + "name": "BigBrownMeteor1", + "persistentUuid": "f9c940ba-9f2e-4b8f-8333-a872187bf521", + "width": 0, + "x": 983, + "y": 85, + "zOrder": 2, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "layer": "", + "name": "BigBrownMeteor1", + "persistentUuid": "1944b1e4-d9cc-4207-8108-202660699298", + "width": 0, + "x": 504, + "y": 293, + "zOrder": 3, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "layer": "", + "name": "BigBrownMeteor1", + "persistentUuid": "ef6ae8ec-e101-48dc-83cd-80cd9339c82f", + "width": 0, + "x": 960, + "y": 138, + "zOrder": 4, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "layer": "", + "name": "BigBrownMeteor1", + "persistentUuid": "29c24acd-7e01-4587-9e78-ec611f1f1f90", + "width": 0, + "x": 157, + "y": 316, + "zOrder": 5, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "layer": "", + "name": "BigBrownMeteor1", + "persistentUuid": "20553e7b-6091-412f-99e3-744417a7a1f6", + "width": 0, + "x": 1040, + "y": 121, + "zOrder": 6, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "layer": "", + "name": "BigBrownMeteor1", + "persistentUuid": "128cd2f9-0397-44ad-9d5d-7ce7e37276c8", + "width": 0, + "x": 186, + "y": 268, + "zOrder": 7, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "layer": "", + "name": "BigBrownMeteor1", + "persistentUuid": "517150aa-0fbf-4512-b563-c6f08042dba6", + "width": 0, + "x": 570, + "y": 271, + "zOrder": 8, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "layer": "", + "name": "BigGreyMeteor2", + "persistentUuid": "a164943d-79ef-4648-bc7f-58e942730210", + "width": 0, + "x": 903, + "y": 87, + "zOrder": 9, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "layer": "", + "name": "BigGreyMeteor2", + "persistentUuid": "13e04f7b-6347-4bcd-b6f5-99211f26821d", + "width": 0, + "x": 642, + "y": 283, + "zOrder": 10, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "layer": "", + "name": "BigGreyMeteor2", + "persistentUuid": "33b31ac4-6bda-4013-b3cb-2749c5414f1b", + "width": 0, + "x": 550, + "y": 327, + "zOrder": 11, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + } + ], + "objects": [ + { + "assetStoreId": "2b2dfbbe01d820384d341ecfa1cf553b2700019a4f78c1d6fc4c55cb4b373bf5", + "name": "RedPlayerShip1", + "tags": "", + "type": "Sprite", + "updateIfNotVisible": false, + "variables": [], + "effects": [], + "behaviors": [], + "animations": [ + { + "name": "", + "useMultipleDirections": false, + "directions": [ + { + "looping": true, + "timeBetweenFrames": 0.025, + "sprites": [ + { + "hasCustomCollisionMask": false, + "image": "Red playerShip (1).png", + "points": [], + "originPoint": { + "name": "origine", + "x": 0, + "y": 0 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [] + } + ] + } + ] + } + ] + }, + { + "assetStoreId": "911c6f50a4c05507c6fc1df967493f61a7ce9bad9e144cec92f6ff32be42749a", + "name": "BigBrownMeteor1", + "tags": "", + "type": "Sprite", + "updateIfNotVisible": false, + "variables": [], + "effects": [], + "behaviors": [ + { + "name": "Obstacle", + "type": "CollisionDetector::Solid" + } + ], + "animations": [ + { + "name": "", + "useMultipleDirections": false, + "directions": [ + { + "looping": true, + "timeBetweenFrames": 0.025, + "sprites": [ + { + "hasCustomCollisionMask": false, + "image": "Big Brown Meteor (1).png", + "points": [], + "originPoint": { + "name": "origine", + "x": 0, + "y": 0 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [] + } + ] + } + ] + } + ] + }, + { + "assetStoreId": "fe9de3e97f21ea1ff6d364d2efe3e7d379cb150152cc2461b10d1ed05f803d09", + "name": "BigGreyMeteor2", + "tags": "", + "type": "Sprite", + "updateIfNotVisible": false, + "variables": [], + "effects": [], + "behaviors": [ + { + "name": "Obstacle", + "type": "CollisionDetector::Solid" + } + ], + "animations": [ + { + "name": "", + "useMultipleDirections": false, + "directions": [ + { + "looping": true, + "timeBetweenFrames": 0.025, + "sprites": [ + { + "hasCustomCollisionMask": false, + "image": "Big Grey Meteor (2).png", + "points": [], + "originPoint": { + "name": "origine", + "x": 0, + "y": 0 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [] + } + ] + } + ] + } + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "DepartScene" + }, + "parameters": [ + "" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "CollisionDetector::Separate" + }, + "parameters": [ + "", + "Obstacle", + "", + "Obstacle", + "Obstacle" + ] + } + ] + } + ] + } + ], + "layers": [ + { + "ambientLightColorB": 0, + "ambientLightColorG": 9943112, + "ambientLightColorR": 16, + "followBaseLayerCamera": false, + "isLightingLayer": false, + "name": "", + "visibility": true, + "cameras": [ + { + "defaultSize": true, + "defaultViewport": true, + "height": 0, + "viewportBottom": 1, + "viewportLeft": 0, + "viewportRight": 1, + "viewportTop": 0, + "width": 0 + } + ], + "effects": [] + } + ], + "behaviorsSharedData": [ + { + "name": "Obstacle", + "type": "CollisionDetector::Solid" + } + ] + }, + { + "b": 37, + "disableInputWhenNotFocused": true, + "mangledName": "Test_32IsAround", + "name": "Test IsAround", + "r": 37, + "standardSortMethod": true, + "stopSoundsOnStartup": true, + "title": "", + "v": 37, + "uiSettings": { + "grid": false, + "gridType": "rectangular", + "gridWidth": 32, + "gridHeight": 32, + "gridOffsetX": 0, + "gridOffsetY": 0, + "gridColor": 10401023, + "gridAlpha": 0.8, + "snap": false, + "zoomFactor": 0.546875, + "windowMask": false + }, + "objectsGroups": [ + { + "name": "Obstacle", + "objects": [ + { + "name": "BigBrownMeteor1" + }, + { + "name": "BigGreyMeteor2" + } + ] + } + ], + "variables": [], + "instances": [ + { + "angle": 0, + "customSize": false, + "height": 0, + "layer": "", + "name": "RedPlayerShip1", + "persistentUuid": "9ff2bb0e-b2eb-4b93-81af-c0444469469c", + "width": 0, + "x": 485, + "y": 369, + "zOrder": 1, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "layer": "", + "name": "BigBrownMeteor1", + "persistentUuid": "f9c940ba-9f2e-4b8f-8333-a872187bf521", + "width": 0, + "x": 983, + "y": 85, + "zOrder": 2, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "layer": "", + "name": "BigBrownMeteor1", + "persistentUuid": "1944b1e4-d9cc-4207-8108-202660699298", + "width": 0, + "x": 413, + "y": 149, + "zOrder": 3, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "layer": "", + "name": "BigBrownMeteor1", + "persistentUuid": "ef6ae8ec-e101-48dc-83cd-80cd9339c82f", + "width": 0, + "x": 691, + "y": 515, + "zOrder": 4, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "layer": "", + "name": "BigBrownMeteor1", + "persistentUuid": "29c24acd-7e01-4587-9e78-ec611f1f1f90", + "width": 0, + "x": 115, + "y": 524, + "zOrder": 5, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "layer": "", + "name": "BigBrownMeteor1", + "persistentUuid": "20553e7b-6091-412f-99e3-744417a7a1f6", + "width": 0, + "x": 1073, + "y": 494, + "zOrder": 6, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "layer": "", + "name": "BigBrownMeteor1", + "persistentUuid": "128cd2f9-0397-44ad-9d5d-7ce7e37276c8", + "width": 0, + "x": 186, + "y": 268, + "zOrder": 7, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "layer": "", + "name": "BigBrownMeteor1", + "persistentUuid": "517150aa-0fbf-4512-b563-c6f08042dba6", + "width": 0, + "x": 685, + "y": 211, + "zOrder": 8, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "layer": "", + "name": "BigGreyMeteor2", + "persistentUuid": "a164943d-79ef-4648-bc7f-58e942730210", + "width": 0, + "x": 166, + "y": 111, + "zOrder": 9, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "layer": "", + "name": "BigGreyMeteor2", + "persistentUuid": "13e04f7b-6347-4bcd-b6f5-99211f26821d", + "width": 0, + "x": 903, + "y": 292, + "zOrder": 10, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "layer": "", + "name": "BigGreyMeteor2", + "persistentUuid": "33b31ac4-6bda-4013-b3cb-2749c5414f1b", + "width": 0, + "x": 404, + "y": 574, + "zOrder": 11, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + } + ], + "objects": [ + { + "assetStoreId": "2b2dfbbe01d820384d341ecfa1cf553b2700019a4f78c1d6fc4c55cb4b373bf5", + "name": "RedPlayerShip1", + "tags": "", + "type": "Sprite", + "updateIfNotVisible": false, + "variables": [], + "effects": [], + "behaviors": [], + "animations": [ + { + "name": "", + "useMultipleDirections": false, + "directions": [ + { + "looping": true, + "timeBetweenFrames": 0.025, + "sprites": [ + { + "hasCustomCollisionMask": false, + "image": "Red playerShip (1).png", + "points": [], + "originPoint": { + "name": "origine", + "x": 0, + "y": 0 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [] + } + ] + } + ] + } + ] + }, + { + "assetStoreId": "911c6f50a4c05507c6fc1df967493f61a7ce9bad9e144cec92f6ff32be42749a", + "name": "BigBrownMeteor1", + "tags": "", + "type": "Sprite", + "updateIfNotVisible": false, + "variables": [], + "effects": [], + "behaviors": [ + { + "name": "Obstacle", + "type": "CollisionDetector::Solid" + } + ], + "animations": [ + { + "name": "", + "useMultipleDirections": false, + "directions": [ + { + "looping": true, + "timeBetweenFrames": 0.025, + "sprites": [ + { + "hasCustomCollisionMask": false, + "image": "Big Brown Meteor (1).png", + "points": [], + "originPoint": { + "name": "origine", + "x": 0, + "y": 0 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [] + } + ] + } + ] + } + ] + }, + { + "assetStoreId": "fe9de3e97f21ea1ff6d364d2efe3e7d379cb150152cc2461b10d1ed05f803d09", + "name": "BigGreyMeteor2", + "tags": "", + "type": "Sprite", + "updateIfNotVisible": false, + "variables": [], + "effects": [], + "behaviors": [ + { + "name": "Obstacle", + "type": "CollisionDetector::Solid" + } + ], + "animations": [ + { + "name": "", + "useMultipleDirections": false, + "directions": [ + { + "looping": true, + "timeBetweenFrames": 0.025, + "sprites": [ + { + "hasCustomCollisionMask": false, + "image": "Big Grey Meteor (2).png", + "points": [], + "originPoint": { + "name": "origine", + "x": 0, + "y": 0 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [] + } + ] + } + ] + } + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "DepartScene" + }, + "parameters": [ + "" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "CollisionDetector::IsAroundRectangle" + }, + "parameters": [ + "", + "Obstacle", + "Obstacle", + "640", + "0", + "1280", + "720", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "DebuggerTools::ConsoleLog" + }, + "parameters": [ + "\"Brown: \" + ToString(PickedInstancesCount(BigBrownMeteor1))", + "", + "" + ] + }, + { + "type": { + "value": "DebuggerTools::ConsoleLog" + }, + "parameters": [ + "\"Grey: \" + ToString(PickedInstancesCount(BigGreyMeteor2))", + "", + "" + ] + } + ] + } + ] + } + ], + "layers": [ + { + "ambientLightColorB": 0, + "ambientLightColorG": 9943112, + "ambientLightColorR": 16, + "followBaseLayerCamera": false, + "isLightingLayer": false, + "name": "", + "visibility": true, + "cameras": [ + { + "defaultSize": true, + "defaultViewport": true, + "height": 0, + "viewportBottom": 1, + "viewportLeft": 0, + "viewportRight": 1, + "viewportTop": 0, + "width": 0 + } + ], + "effects": [] + } + ], + "behaviorsSharedData": [ + { + "name": "Obstacle", + "type": "CollisionDetector::Solid" + } + ] + } + ], + "externalEvents": [], + "eventsFunctionsExtensions": [ + { + "author": "", + "category": "Movement", + "extensionNamespace": "", + "fullName": "Boids movement (experimental)", + "helpPath": "https://en.wikipedia.org/wiki/Boids", + "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyMy4wLjMsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iSWNvbnMiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB2aWV3Qm94PSIwIDAgMzIgMzIiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDMyIDMyOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8Zz4NCgk8cGF0aCBkPSJNMjkuMywxMC4xYy0wLjQtMC4xLTAuOCwwLTEuMSwwLjNsLTMuMiw0Yy0xLjctMi01LjktNi40LTExLTYuNGMtMC4yLDAtMC4zLDAtMC41LDBjMS40LDIuNCwyLjEsNS4xLDIuMSw4DQoJCWMwLDIuOC0wLjcsNS42LTIuMSw4YzAuMiwwLDAuMywwLDAuNSwwYzUuMSwwLDkuMy00LjMsMTEtNi40bDMuMiw0YzAuMiwwLjIsMC41LDAuNCwwLjgsMC40YzAuMSwwLDAuMiwwLDAuMy0wLjENCgkJYzAuNC0wLjEsMC43LTAuNSwwLjctMC45VjExQzMwLDEwLjYsMjkuNywxMC4yLDI5LjMsMTAuMXoiLz4NCgk8cGF0aCBkPSJNMTEuNCw4LjRjLTUuMiwxLjUtOSw2LjgtOS4yLDdjLTAuMiwwLjMtMC4yLDAuOCwwLDEuMmMwLjIsMC4zLDQsNS42LDkuMiw3YzEuNS0yLjMsMi4yLTQuOSwyLjItNy42DQoJCUMxMy42LDEzLjMsMTIuOCwxMC42LDExLjQsOC40eiBNMTAsMTZjMCwwLjYtMC40LDEtMSwxcy0xLTAuNC0xLTF2LTJjMC0wLjYsMC40LTEsMS0xczEsMC40LDEsMVYxNnoiLz4NCjwvZz4NCjwvc3ZnPg0K", + "name": "BoidsMovement", + "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/Glyphster Pack/Master/SVG/Restaurant/Restaurant_restaurant_seafood_animal_fish.svg", + "shortDescription": "Simulates flocks movement.", + "version": "0.1.6", + "description": [ + "Simulates swarms or flocks movement following the separation, alignment, cohesion principles. The flock can be attracted to a location or avoid some obstacles.", + "", + "The [Fish School example](https://editor.gdevelop.io/?project=example://fish-school) shows how properties impact on the movement." + ], + "origin": { + "identifier": "BoidsMovement", + "name": "gdevelop-extension-store" + }, + "tags": [ + "flock", + "swarm", + "boids", + "crowd", + "horde" + ], + "authorIds": [ + "rotBq28wITdtfsrE7McHQri4k2w2", + "IWykYNRvhCZBN3vEgKEbBPOR3Oc2" + ], + "dependencies": [], + "eventsFunctions": [ + { + "description": "Define JavaScript classes.", + "fullName": "Define JavaScript classes", + "functionType": "Action", + "name": "DefineJavaScript", + "private": true, + "sentence": "Define JavaScript classes", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "GlobalVariableAsBoolean" + }, + "parameters": [ + "__BoidsMovement_ClassesDefined", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetGlobalVariableAsBoolean" + }, + "parameters": [ + "__BoidsMovement_ClassesDefined", + "True" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "gdjs.__boidsExtension = gdjs.__boidsExtension || {};", + "", + "/**", + " * A vector", + " * @param {float} x - coordinate of the vectors starting position", + " * @param {float} y - coordinate of the vectors starting position", + " * @constructor", + " */", + "gdjs.__boidsExtension.Vector = /** @class */ (function () {", + " ", + " /**", + " * Create a vector.", + " * @param {number} x", + " * @param {number} y", + " */", + " function Vector(x, y) {", + " this.x = x;", + " this.y = y;", + " }", + "", + " /**", + " * @param {number} x", + " * @param {number} y", + " * @returns {Vector} this object", + " */", + " Vector.prototype.set = function (x, y) {", + " this.x = x;", + " this.y = y;", + " return this;", + " }", + "", + " /**", + " * Adds a velocity to this vector", + " * @param {Vector} referenceVector gets the velocity to be added", + " * @returns {Vector} this object", + " */", + " Vector.prototype.add = function (referenceVector) {", + " this.x += referenceVector.x;", + " this.y += referenceVector.y;", + "", + " return this;", + " }", + "", + " /**", + " * Normalize the vector", + " * @returns {Vector}", + " */", + " Vector.prototype.normalize = function () {", + " var len = this.magnitude();", + " if (len !== 0) this.multiply(1 / len);", + " return this;", + " }", + "", + " /**", + " * Multiply vectors verticies", + " * @param {float} amount", + " * @returns {Vector}", + " */", + " Vector.prototype.multiply = function (amount) {", + " this.x *= amount;", + " this.y *= amount;", + " return this;", + " }", + "", + " /**", + " * Divide vectors verticies", + " * @param {float} amount", + " * @returns {Vector}", + " */", + " Vector.prototype.divide = function (amount) {", + " this.x /= amount;", + " this.y /= amount;", + "", + " return this;", + " }", + "", + " /**", + " * Subtracts vectors verticies from a reference vector", + " * @param {Vector} referenceVector", + " * @returns {Vector}", + " */", + " Vector.prototype.subtract = function (referenceVector) {", + " this.x -= referenceVector.x;", + " this.y -= referenceVector.y;", + "", + " return this;", + " }", + "", + " /**", + " * Limits Vectors speed", + " * @returns {Vector}", + " */", + " Vector.prototype.limit = function limit(max) {", + " var mSq = this.magnitudeSquare();", + " if (mSq > max * max) {", + " this.divide(Math.sqrt(mSq)).multiply(max);", + " }", + " return this;", + " }", + "", + " /**", + " * Calculate the vectors direction", + " * @returns {float}", + " */", + " Vector.prototype.heading = function () {", + " let h = Math.atan2(this.y, this.x);", + " return h;", + " }", + "", + " /**", + " * Calculate the vectors magnitude squared", + " * @returns {float}", + " */", + " Vector.prototype.magnitudeSquare = function () {", + " var x = this.x;", + " var y = this.y;", + " return x * x + y * y;", + " };", + "", + " /**", + " * Calculate the vectors magnitude", + " * @returns {float}", + " */", + " Vector.prototype.magnitude = function () {", + " return Math.sqrt(this.magnitudeSquare());", + " }", + " ", + " return Vector;", + "}());", + "", + "/**", + " * A boid agent", + " * Methods for Separation, Cohesion, Alignment added", + " * Inspired from The Nature of Code - Daniel Shiffman", + " * http://natureofcode.com", + " * ", + " * Original source code:", + " * https://github.com/nature-of-code/noc-examples-processing/blob/master/chp06_agents/NOC_6_09_Flocking/Boid.pde", + " */", + "gdjs.__boidsExtension.Boid = /** @class */ (function () {", + "", + " /**", + " * Create a boid agent.", + " * @parameter {gdjs.RuntimeBehavior} behavior", + " */", + " function Boid(behavior) {", + " /** @type {gdjs.RuntimeBehavior} */", + " this.behavior = behavior;", + " this.acceleration = new gdjs.__boidsExtension.Vector(0, 0);", + " this.velocity = new gdjs.__boidsExtension.Vector(gdjs.randomFloatInRange(-1, 1), gdjs.randomFloatInRange(-1, 1));", + " this.separationDirection = new gdjs.__boidsExtension.Vector(0, 0);", + " this.alignmentDirection = new gdjs.__boidsExtension.Vector(0, 0);", + " this.cohesionDirection = new gdjs.__boidsExtension.Vector(0, 0);", + " this.customIntentsDirectionSum = new gdjs.__boidsExtension.Vector(0, 0);", + " this.separateWorkingVector = new gdjs.__boidsExtension.Vector(0, 0);", + " }", + "", + " /**", + " * Add a custom intent.", + " * @param {Boid} boid", + " * @param {number} directionX", + " * @param {number} directionY", + " * @param {number} weight", + " */", + " Boid.prototype.addIntent = function (directionX, directionY, weight) {", + "", + " if (directionX === 0 && directionY === 0) {", + " return;", + " }", + "", + " const length = Math.hypot(directionX, directionY);", + " const unitX = directionX / length;", + " const unitY = directionY / length;", + "", + " this.customIntentsDirectionSum.x += unitX * weight;", + " this.customIntentsDirectionSum.y += unitY * weight;", + " }", + "", + " /**", + " * Vector between 2 boids.", + " * @param {Boid} boid", + " * @param {Vector} vector the vector to return the result", + " * @returns {Vector} vector", + " */", + " Boid.prototype.getVectorTo = function (boid, vector) {", + " const object = this.behavior.owner;", + " const otherObject = boid.behavior.owner;", + " let x = otherObject.x - object.x;", + " let y = otherObject.y - object.y;", + " vector.set(x, y);", + " return vector;", + " }", + "", + " /**", + " * Applys the three rules of boids", + " */", + " Boid.prototype.flock = function () {", + " const separationDirection = this.separate();", + " const alignmentDirection = this.align();", + " const cohesionDirection = this.cohesion();", + "", + " separationDirection.multiply(this.behavior.SeparationWeight());", + " alignmentDirection.multiply(this.behavior.AlignmentWeight());", + " cohesionDirection.multiply(this.behavior.CohesionWeight());", + "", + " const direction = separationDirection.add(alignmentDirection).add(cohesionDirection).add(this.customIntentsDirectionSum);", + " this.acceleration.add(this.steer(direction));", + "", + " this.customIntentsDirectionSum.set(0, 0);", + " }", + "", + " /**", + " * Apply the acceleration from the steer force.", + " */", + " Boid.prototype.move = function () {", + " const object = this.behavior.owner;", + " const timeDelta = object.getElapsedTime(object.getInstanceContainer()) / 1000;", + " this.acceleration.multiply(timeDelta);", + "", + " const previousVelocityX = this.velocity.x;", + " const previousVelocityY = this.velocity.y;", + "", + " this.velocity.add(this.acceleration);", + " this.velocity.limit(this.behavior.MaxSpeed());", + " this.acceleration.set(0, 0);", + "", + " if (this.behavior.ShouldRotate()) {", + " let theta = this.velocity.heading() * 180 / Math.PI;", + " object.setAngle(theta);", + " }", + " // Verlet integration", + " object.setX(object.x + (previousVelocityX + this.velocity.x) / 2 * timeDelta);", + " object.setY(object.y + (previousVelocityY + this.velocity.y) / 2 * timeDelta);", + " }", + "", + " /**", + " * Calculates and applies steering force towards a direction", + " * @param desiredDirection {Vector}", + " * @return {Vector} alignment force", + " */", + " Boid.prototype.steer = function (desiredDirection) {", + " desiredDirection.normalize();", + " desiredDirection.multiply(this.behavior.MaxSpeed());", + " let steer = desiredDirection.subtract(this.velocity);", + " steer.limit(this.behavior.MaxAcceleration());", + " return steer;", + " }", + "", + " /**", + " * Separation: checks for nearby boids.", + " * @return {Vector} separation direction", + " */", + " Boid.prototype.separate = function () {", + " const runtimeScene = this.behavior.owner.getInstanceContainer();", + " /** @type {gdjs.__boidsExtension.BoidsManager} */", + " const manager = runtimeScene.__boidsExtension.boidsManager;", + " const separationRadius = this.behavior.SeparationRadius();", + " this.separationDirection.set(0, 0);", + " let diff = this.separateWorkingVector;", + " const object = this.behavior.owner;", + "", + " const nearbyBoids = manager.getAllBoidsAround(this, separationRadius);", + " for (let i = 0; i < nearbyBoids.length; i++) {", + " const boid = nearbyBoids[i];", + " const otherObject = boid.behavior.owner;", + " const distance = object.getDistanceToObject(otherObject);", + " if (distance > 0) {", + " diff = boid.getVectorTo(this, diff);", + " diff.normalize();", + " diff.divide(distance);", + " this.separationDirection.add(diff);", + " }", + " }", + " if (this.separationDirection.magnitudeSquare() > 0) {", + " this.separationDirection.normalize();", + " }", + " return this.separationDirection;", + " }", + "", + " /**", + " * Alignment: calculate the average velocity for every nearby boid in the system", + " * @return {Vector} alignment direction", + " */", + " Boid.prototype.align = function () {", + " const runtimeScene = this.behavior.owner.getInstanceContainer();", + " /** @type {gdjs.__boidsExtension.BoidsManager} */", + " const manager = runtimeScene.__boidsExtension.boidsManager;", + " const alignmentRadius = this.behavior.AlignmentRadius();", + " this.alignmentDirection.set(0, 0);", + " let count = 0;", + " const object = this.behavior.owner;", + "", + " const nearbyBoids = manager.getAllBoidsAround(this, alignmentRadius);", + " for (let i = 0; i < nearbyBoids.length; i++) {", + " const boid = nearbyBoids[i];", + " this.alignmentDirection.add(boid.velocity);", + " count++;", + " }", + " if (count > 0) {", + " this.alignmentDirection.normalize();", + " }", + " return this.alignmentDirection;", + " }", + "", + " /**", + " * Cohesion: calculate direction vector towards the average location of all nearby boids", + " * @return {Vector} cohesion direction", + " */", + " Boid.prototype.cohesion = function () {", + " const runtimeScene = this.behavior.owner.getInstanceContainer();", + " /** @type {gdjs.__boidsExtension.BoidsManager} */", + " const manager = runtimeScene.__boidsExtension.boidsManager;", + " const cohesionRadius = this.behavior.CohesionRadius();", + " let count = 0;", + " let sumX = 0;", + " let sumY = 0;", + " const object = this.behavior.owner;", + "", + " const nearbyBoids = manager.getAllBoidsAround(this, cohesionRadius);", + " for (let i = 0; i < nearbyBoids.length; i++) {", + " const boid = nearbyBoids[i];", + " const otherObject = boid.behavior.owner;", + " sumX += otherObject.getCenterXInScene();", + " sumY += otherObject.getCenterYInScene();", + " count++;", + " }", + " if (count > 0) {", + " sumX /= count;", + " sumY /= count;", + "", + " // A vector pointing from the position to the target", + " this.cohesionDirection.set(", + " sumX - object.getCenterXInScene(),", + " sumY - object.getCenterYInScene()", + " )", + " }", + " return this.cohesionDirection.normalize();", + " }", + "", + " return Boid;", + "}());", + "", + "/**", + " * A boids manager", + " */", + "gdjs.__boidsExtension.BoidsManager = /** @class */ (function () {", + " /**", + " * Create a manager.", + " */", + " function BoidsManager() {", + " /**", + " * @type {Map}", + " */", + " this.boids = new Map();", + " this.boidsRBush = new rbush();", + " }", + "", + " /**", + " * Create and register a boid.", + " * @param {gdjs.RuntimeBehavior} behavior", + " * @returns {Boid} the created Boid", + " */", + " BoidsManager.prototype.add = function (behavior) {", + " const boid = new gdjs.__boidsExtension.Boid(behavior);", + " this.boids.set(behavior.owner.id, boid);", + " this.addToRBush(boid);", + " return boid;", + " }", + "", + " /**", + " * Add a boid to the R-Tree.", + " * @param {Boid} boid", + " */", + " BoidsManager.prototype.addToRBush = function (boid) {", + " if (boid.currentRBushAABB) {", + " boid.currentRBushAABB.updateAABBFromOwner();", + " }", + " else {", + " boid.currentRBushAABB = new gdjs.BehaviorRBushAABB(", + " boid.behavior", + " );", + " }", + " this.boidsRBush.insert(boid.currentRBushAABB);", + " }", + "", + " /**", + " * Unregister the boid.", + " * @param {gdjs.RuntimeBehavior} behavior", + " */", + " BoidsManager.prototype.remove = function (behavior) {", + " this.boids.delete(behavior.owner.id);", + "", + " this.removeFromRBush(behavior.__boidsExtension.boid.currentRBushAABB);", + " }", + "", + " /**", + " * Remove a boid from the R-Tree.", + " * @param {Boid} boid", + " */", + " BoidsManager.prototype.removeFromRBush = function (boid) {", + " this.boidsRBush.remove(boid.currentRBushAABB);", + " }", + "", + " /**", + " * Move all instances.", + " */", + " BoidsManager.prototype.moveAll = function () {", + " this.boids.forEach(boid => boid.flock());", + " this.boids.forEach(boid => {", + " boid.move();", + " this.removeFromRBush(boid);", + " this.addToRBush(boid);", + " });", + " }", + "", + " /**", + " * Returns all the boids around the specified boid.", + " * @param {Boid} boid", + " * @param {number} radius", + " * @return {Boid[]} An array with all boids near the object.", + " */", + " BoidsManager.prototype.getAllBoidsAround = function (boid, radius, results) {", + " const object = boid.behavior.owner;", + "", + " const x = object.getCenterXInScene();", + " const y = object.getCenterYInScene();", + " const searchArea = gdjs.staticObject(", + " gdjs.__boidsExtension.BoidsManager.prototype.getAllBoidsAround", + " );", + " searchArea.minX = x - radius;", + " searchArea.minY = y - radius;", + " searchArea.maxX = x + radius;", + " searchArea.maxY = y + radius;", + " // TODO The R-Tree should not allocate an array.", + " const nearbys = this.boidsRBush.search(searchArea);", + "", + " const radiusSq = radius * radius;", + " const result = gdjs.staticArray(", + " gdjs.__boidsExtension.BoidsManager.prototype.getAllBoidsAround", + " );", + " result.length = 0;", + " // Cap the number of boids between 20 and 40.", + " const step = Math.ceil(nearbys.length / 40);", + " for (let i = 0; i < nearbys.length; i += step) {", + " const behavior = nearbys[i].behavior;", + " const otherObject = behavior.owner;", + " if (object === otherObject) {", + " continue;", + " }", + " const distanceSq = object.getSqDistanceToObject(otherObject);", + " if (distanceSq < radiusSq) {", + " result.push(behavior.__boidsExtension.boid);", + " }", + " }", + " return result;", + " }", + "", + " return BoidsManager;", + "}());", + "" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": true + } + ] + } + ], + "parameters": [], + "objectGroups": [] + } + ], + "eventsBasedBehaviors": [ + { + "description": "Move as part of a flock.", + "fullName": "Boids Movement (experimental)", + "name": "BoidsMovement", + "objectType": "", + "eventsFunctions": [ + { + "fullName": "", + "functionType": "Action", + "name": "onCreated", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Initiate and attach properties as objects variables", + "comment2": "" + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "BoidsMovement::DefineJavaScript" + }, + "parameters": [ + "", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "\r", + "runtimeScene.__boidsExtension = runtimeScene.__boidsExtension || {};\r", + "runtimeScene.__boidsExtension.boidsManager = runtimeScene.__boidsExtension.boidsManager || new gdjs.__boidsExtension.BoidsManager();\r", + "\r", + "const object = objects[0];\r", + "const behaviorName = eventsFunctionContext.getBehaviorName(\"Behavior\");\r", + "const behavior = object.getBehavior(behaviorName);\r", + "behavior.__boidsExtension = behavior.__boidsExtension || {};\r", + "behavior.__boidsExtension.boid = runtimeScene.__boidsExtension.boidsManager.add(behavior);" + ], + "parameterObjects": "Object", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "BoidsMovement::BoidsMovement", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "Action", + "name": "doStepPreEvents", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Update boids position every frame", + "comment2": "" + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SceneVariableAsBoolean" + }, + "parameters": [ + "__BoidsBehaviour_hasAlreadyRunThisFrame", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetSceneVariableAsBoolean" + }, + "parameters": [ + "__BoidsBehaviour_hasAlreadyRunThisFrame", + "True" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": "runtimeScene.__boidsExtension.boidsManager.moveAll();", + "parameterObjects": "Object", + "useStrict": true, + "eventsSheetExpanded": true + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "BoidsMovement::BoidsMovement", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "Action", + "name": "doStepPostEvents", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetSceneVariableAsBoolean" + }, + "parameters": [ + "__BoidsBehaviour_hasAlreadyRunThisFrame", + "False" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "BoidsMovement::BoidsMovement", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "Action", + "name": "onActivate", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const object = objects[0];", + "const behaviorName = eventsFunctionContext.getBehaviorName(\"Behavior\");", + "const behavior = object.getBehavior(behaviorName);", + "runtimeScene.__boidsExtension.boidsManager.add(behavior);" + ], + "parameterObjects": "Object", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "BoidsMovement::BoidsMovement", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "Action", + "name": "onDeActivate", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const object = objects[0];", + "const behaviorName = eventsFunctionContext.getBehaviorName(\"Behavior\");", + "const behavior = object.getBehavior(behaviorName);", + "runtimeScene.__boidsExtension.boidsManager.remove(behavior);" + ], + "parameterObjects": "Object", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "BoidsMovement::BoidsMovement", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "Action", + "name": "onDestroy", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "\r", + "const object = objects[0];\r", + "const behaviorName = eventsFunctionContext.getBehaviorName(\"Behavior\");\r", + "const behavior = object.getBehavior(behaviorName);\r", + "runtimeScene.__boidsExtension.boidsManager.remove(behavior);" + ], + "parameterObjects": "Object", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "BoidsMovement::BoidsMovement", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Intend to move in a given direction.", + "fullName": "Move in a direction", + "functionType": "Action", + "name": "MoveInDirection", + "sentence": "_PARAM0_ intent to move in the direction _PARAM2_; _PARAM3_ (decision weight: _PARAM4_)", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const object = objects[0];", + "const behaviorName = eventsFunctionContext.getBehaviorName(\"Behavior\");", + "const behavior = object.getBehavior(behaviorName);", + "const directionX = eventsFunctionContext.getArgument(\"DirectionX\");", + "const directionY = eventsFunctionContext.getArgument(\"DirectionY\");", + "const decisionWeight = eventsFunctionContext.getArgument(\"DecisionWeight\");", + "", + "behavior.__boidsExtension.boid.addIntent(directionX, directionY, decisionWeight);" + ], + "parameterObjects": "Object", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "BoidsMovement::BoidsMovement", + "type": "behavior" + }, + { + "description": "Direction X", + "name": "DirectionX", + "type": "expression" + }, + { + "description": "Direction Y", + "name": "DirectionY", + "type": "expression" + }, + { + "description": "Decision weight", + "name": "DecisionWeight", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Intend to move toward a position.", + "fullName": "Move toward a position", + "functionType": "Action", + "name": "MoveToPosition", + "sentence": "_PARAM0_ intend to move toward _PARAM2_; _PARAM3_ (decision weight: _PARAM4_)", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "BoidsMovement::BoidsMovement::MoveInDirection" + }, + "parameters": [ + "Object", + "Behavior", + "GetArgumentAsNumber(\"TargetX\") - Object.CenterX()", + "GetArgumentAsNumber(\"TargetY\") - Object.CenterY()", + "GetArgumentAsNumber(\"DecisionWeight\")", + "" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "BoidsMovement::BoidsMovement", + "type": "behavior" + }, + { + "description": "Target X", + "name": "TargetX", + "type": "expression" + }, + { + "description": "Target Y", + "name": "TargetY", + "type": "expression" + }, + { + "description": "Decision weight", + "name": "DecisionWeight", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Intend to move toward an object.", + "fullName": "Move toward an object", + "functionType": "Action", + "name": "MoveToObject", + "sentence": "_PARAM0_ intend to move toward _PARAM2_ (decision weight: _PARAM3_)", + "events": [ + { + "type": "BuiltinCommonInstructions::ForEach", + "object": "TargetedObject", + "conditions": [], + "actions": [ + { + "type": { + "value": "BoidsMovement::BoidsMovement::MoveToPosition" + }, + "parameters": [ + "Object", + "Behavior", + "TargetedObject.CenterX()", + "TargetedObject.CenterY()", + "GetArgumentAsNumber(\"DecisionWeight\")", + "GetArgumentAsNumber(\"DecisionWeight\")" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "BoidsMovement::BoidsMovement", + "type": "behavior" + }, + { + "description": "Targeted object", + "name": "TargetedObject", + "type": "objectList" + }, + { + "description": "Decision weight", + "name": "DecisionWeight", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Intend to avoid an area with a given center and radius.", + "fullName": "Avoid a position", + "functionType": "Action", + "name": "AvoidPosition", + "sentence": "_PARAM0_ intend to avoid a radius of _PARAM4_ around _PARAM2_; _PARAM3_ (decision weight: _PARAM5_)", + "events": [ + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Evaluate at which distance the object will go past a location if it were to continue in its current direction.\n\nspeedUnitX = velocityX / speed\nspeedUnitY = velocityY / speed\n\ndeltaX = centerX - object.CenterX\ndeltaY = centerY - object.CenterY\n\nnormalX = -deltaY;\nnormalY = deltaX;\n\ntrajectoryDistance = speedUnitX * normalX + speedUnitY * normalY", + "comment2": "" + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "BoidsMovement::BoidsMovement::SetPropertyTrajectoryDistance" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "(Object.Behavior::VelocityX() * (Object.CenterY() - GetArgumentAsNumber(\"CenterY\")) + Object.Behavior::VelocityY() * (GetArgumentAsNumber(\"CenterX\") - Object.CenterX())) / Object.Behavior::Speed()" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "If this distance is smaller than the specified radius, the Boid must try turn in the right direction to avoid the area.", + "comment2": "" + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BoidsMovement::BoidsMovement::PropertyTrajectoryDistance" + }, + "parameters": [ + "Object", + "Behavior", + ">", + "- GetArgumentAsNumber(\"Radius\")" + ] + }, + { + "type": { + "value": "BoidsMovement::BoidsMovement::PropertyTrajectoryDistance" + }, + "parameters": [ + "Object", + "Behavior", + "<", + "GetArgumentAsNumber(\"Radius\")" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "(normalX ; normalY)", + "comment2": "" + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BoidsMovement::BoidsMovement::PropertyTrajectoryDistance" + }, + "parameters": [ + "Object", + "Behavior", + ">", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "BoidsMovement::BoidsMovement::MoveInDirection" + }, + "parameters": [ + "Object", + "Behavior", + "-(GetArgumentAsNumber(\"CenterY\") - Object.CenterY())", + "GetArgumentAsNumber(\"CenterX\") - Object.CenterX()", + "GetArgumentAsNumber(\"DecisionWeight\")", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "(-normalX ; -normalY)", + "comment2": "" + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BoidsMovement::BoidsMovement::PropertyTrajectoryDistance" + }, + "parameters": [ + "Object", + "Behavior", + "<", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "BoidsMovement::BoidsMovement::MoveInDirection" + }, + "parameters": [ + "Object", + "Behavior", + "GetArgumentAsNumber(\"CenterY\") - Object.CenterY()", + "-(GetArgumentAsNumber(\"CenterX\") - Object.CenterX())", + "GetArgumentAsNumber(\"DecisionWeight\")", + "" + ] + } + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "BoidsMovement::BoidsMovement", + "type": "behavior" + }, + { + "description": "Center X", + "name": "CenterX", + "type": "expression" + }, + { + "description": "Center Y", + "name": "CenterY", + "type": "expression" + }, + { + "description": "Radius", + "name": "Radius", + "type": "expression" + }, + { + "description": "Decision weight", + "name": "DecisionWeight", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Intend to avoid an area from an object center and a given radius.", + "fullName": "Avoid an object", + "functionType": "Action", + "name": "AvoidObject", + "sentence": "_PARAM0_ intend to avoid a radius of _PARAM3_ around _PARAM2_ (decision weight: _PARAM4_)", + "events": [ + { + "type": "BuiltinCommonInstructions::ForEach", + "object": "AvoidedObject", + "conditions": [], + "actions": [ + { + "type": { + "value": "BoidsMovement::BoidsMovement::AvoidPosition" + }, + "parameters": [ + "Object", + "Behavior", + "AvoidedObject.CenterX()", + "AvoidedObject.CenterY()", + "GetArgumentAsNumber(\"Radius\")", + "GetArgumentAsNumber(\"DecisionWeight\")", + "" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "BoidsMovement::BoidsMovement", + "type": "behavior" + }, + { + "description": "Avoided object", + "name": "AvoidedObject", + "type": "objectList" + }, + { + "description": "Radius", + "name": "Radius", + "type": "expression" + }, + { + "description": "Decision weight", + "name": "DecisionWeight", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Return the current speed.", + "fullName": "Speed", + "functionType": "Expression", + "name": "Speed", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const object = objects[0];", + "const behaviorName = eventsFunctionContext.getBehaviorName(\"Behavior\");", + "const behavior = object.getBehavior(behaviorName);", + "const directionX = eventsFunctionContext.getArgument(\"DirectionX\");", + "const directionY = eventsFunctionContext.getArgument(\"DirectionY\");", + "const decisionWeight = eventsFunctionContext.getArgument(\"DecisionWeight\");", + "", + "eventsFunctionContext.returnValue = behavior.__boidsExtension.boid.velocity.magnitude();" + ], + "parameterObjects": "Object", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "BoidsMovement::BoidsMovement", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Return the current vertical speed.", + "fullName": "Velocity Y", + "functionType": "Expression", + "name": "VelocityX", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const object = objects[0];", + "const behaviorName = eventsFunctionContext.getBehaviorName(\"Behavior\");", + "const behavior = object.getBehavior(behaviorName);", + "const directionX = eventsFunctionContext.getArgument(\"DirectionX\");", + "const directionY = eventsFunctionContext.getArgument(\"DirectionY\");", + "const decisionWeight = eventsFunctionContext.getArgument(\"DecisionWeight\");", + "", + "eventsFunctionContext.returnValue = behavior.__boidsExtension.boid.velocity.x;" + ], + "parameterObjects": "Object", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "BoidsMovement::BoidsMovement", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Return the current horizontal speed.", + "fullName": "Velocity X", + "functionType": "Expression", + "name": "VelocityY", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const object = objects[0];", + "const behaviorName = eventsFunctionContext.getBehaviorName(\"Behavior\");", + "const behavior = object.getBehavior(behaviorName);", + "const directionX = eventsFunctionContext.getArgument(\"DirectionX\");", + "const directionY = eventsFunctionContext.getArgument(\"DirectionY\");", + "const decisionWeight = eventsFunctionContext.getArgument(\"DecisionWeight\");", + "", + "eventsFunctionContext.returnValue = behavior.__boidsExtension.boid.velocity.y;" + ], + "parameterObjects": "Object", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "BoidsMovement::BoidsMovement", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Change the maximum speed of the object.", + "fullName": "Maximum speed", + "functionType": "Action", + "group": "Boids movement configuration", + "name": "SetMaxSpeed", + "sentence": "Change the maximum speed of _PARAM0_ to _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "BoidsMovement::BoidsMovement::SetPropertyMaxSpeed" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "GetArgumentAsNumber(\"MaxSpeed\")" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "BoidsMovement::BoidsMovement", + "type": "behavior" + }, + { + "description": "Max Speed", + "name": "MaxSpeed", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Change the maximum acceleration of the object.", + "fullName": "Maximum acceleration", + "functionType": "Action", + "group": "Boids movement configuration", + "name": "SetMaxAcceleration", + "sentence": "Change the maximum acceleration of _PARAM0_ to _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "BoidsMovement::BoidsMovement::SetPropertyMaxAcceleration" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "GetArgumentAsNumber(\"SteeringForce\")" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "BoidsMovement::BoidsMovement", + "type": "behavior" + }, + { + "description": "Steering Force", + "name": "SteeringForce", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Check if the object is rotated while moving on its path.", + "fullName": "Object Rotated", + "functionType": "Condition", + "group": "Boids movement configuration", + "name": "ShouldRotate", + "sentence": "_PARAM0_ is rotated when moving", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BoidsMovement::BoidsMovement::PropertyShouldRotate" + }, + "parameters": [ + "Object", + "Behavior" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "BoidsMovement::BoidsMovement", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Return the maximum speed.", + "fullName": "Maximum speed", + "functionType": "Expression", + "group": "Boids movement configuration", + "name": "MaxSpeed", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "Object.Behavior::PropertyMaxSpeed()" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "BoidsMovement::BoidsMovement", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Return the maximum acceleration.", + "fullName": "Maximum acceleration", + "functionType": "Expression", + "group": "Boids movement configuration", + "name": "MaxAcceleration", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "Object.Behavior::PropertyMaxAcceleration()" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "BoidsMovement::BoidsMovement", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Return the cohesion sight radius.", + "fullName": "Cohesion sight radius", + "functionType": "Expression", + "group": "Boids sight configuration", + "name": "CohesionRadius", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "Object.Behavior::PropertyCohesionRadius()" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "BoidsMovement::BoidsMovement", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Change the cohesion sight radius.", + "fullName": "Cohesion sight radius", + "functionType": "Action", + "group": "Boids sight configuration", + "name": "SetCohesionRadius", + "sentence": "Change the cohesion sight radius of _PARAM0_ to _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "BoidsMovement::BoidsMovement::SetPropertyCohesionRadius" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "GetArgumentAsNumber(\"Value\")" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "BoidsMovement::BoidsMovement", + "type": "behavior" + }, + { + "description": "Value", + "name": "Value", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Return the alignment sight radius.", + "fullName": "Alignment sight radius", + "functionType": "Expression", + "group": "Boids sight configuration", + "name": "AlignmentRadius", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "Object.Behavior::PropertyAlignmentRadius()" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "BoidsMovement::BoidsMovement", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Return the alignment sight radius.", + "fullName": "Alignment sight radius", + "functionType": "Action", + "group": "Boids sight configuration", + "name": "SetAlignmentRadius", + "sentence": "Change the alignment sight radius of _PARAM0_ to _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "BoidsMovement::BoidsMovement::SetPropertyAlignmentRadius" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "GetArgumentAsNumber(\"Value\")" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "BoidsMovement::BoidsMovement", + "type": "behavior" + }, + { + "description": "Value", + "name": "Value", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Return the separation sight radius.", + "fullName": "Separation sight radius", + "functionType": "Expression", + "group": "Boids sight configuration", + "name": "SeparationRadius", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "Object.Behavior::PropertySeparationRadius()" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "BoidsMovement::BoidsMovement", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Return the separation sight radius.", + "fullName": "Separation sight radius", + "functionType": "Action", + "group": "Boids sight configuration", + "name": "SetSeparationRadius", + "sentence": "Change the separation sight radius of _PARAM0_ to _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "BoidsMovement::BoidsMovement::SetPropertySeparationRadius" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "GetArgumentAsNumber(\"Value\")" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "BoidsMovement::BoidsMovement", + "type": "behavior" + }, + { + "description": "Value", + "name": "Value", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Return which weight the cohesion takes in the chosen direction.", + "fullName": "Cohesion weight", + "functionType": "Expression", + "group": "Boids decision configuration", + "name": "CohesionWeight", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "Object.Behavior::PropertyCohesionWeight()" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "BoidsMovement::BoidsMovement", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Change the weight the cohesion takes in the chosen direction.", + "fullName": "Cohesion weight", + "functionType": "Action", + "group": "Boids decision configuration", + "name": "SetCohesionWeight", + "sentence": "Change the cohesion weight of _PARAM0_ to _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "BoidsMovement::BoidsMovement::SetPropertyCohesionWeight" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "GetArgumentAsNumber(\"Value\")" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "BoidsMovement::BoidsMovement", + "type": "behavior" + }, + { + "description": "Value", + "name": "Value", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Return which weight the alignment takes in the chosen direction.", + "fullName": "Alignment weight", + "functionType": "Expression", + "group": "Boids decision configuration", + "name": "AlignmentWeight", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "Object.Behavior::PropertyAlignmentWeight()" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "BoidsMovement::BoidsMovement", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Change the weight the alignment takes in the chosen direction.", + "fullName": "Alignment weight", + "functionType": "Action", + "group": "Boids decision configuration", + "name": "SetAlignmentWeight", + "sentence": "Change the alignment weight of _PARAM0_ to _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "BoidsMovement::BoidsMovement::SetPropertyAlignmentWeight" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "GetArgumentAsNumber(\"Value\")" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "BoidsMovement::BoidsMovement", + "type": "behavior" + }, + { + "description": "Value", + "name": "Value", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Return which weight the separation takes in the chosen direction.", + "fullName": "Separation weight", + "functionType": "Expression", + "group": "Boids decision configuration", + "name": "SeparationWeight", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "Object.Behavior::PropertySeparationWeight()" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "BoidsMovement::BoidsMovement", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Change the weight the separation takes in the chosen direction.", + "fullName": "Separation weight", + "functionType": "Action", + "group": "Boids decision configuration", + "name": "SetSeparationWeight", + "sentence": "Change the separation weight of _PARAM0_ to _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "BoidsMovement::BoidsMovement::SetPropertySeparationWeight" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "GetArgumentAsNumber(\"Value\")" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "BoidsMovement::BoidsMovement", + "type": "behavior" + }, + { + "description": "Value", + "name": "Value", + "type": "expression" + } + ], + "objectGroups": [] + } + ], + "propertyDescriptors": [ + { + "value": "360", + "type": "Number", + "label": "Maximum speed (in pixels per second)", + "description": "", + "group": "Movement", + "extraInformation": [], + "hidden": false, + "name": "MaxSpeed" + }, + { + "value": "720", + "type": "Number", + "label": "Maximum acceleration (in pixels per second per second)", + "description": "", + "group": "Movement", + "extraInformation": [], + "hidden": false, + "name": "MaxAcceleration" + }, + { + "value": "true", + "type": "Boolean", + "label": "Rotate object", + "description": "", + "group": "Movement", + "extraInformation": [], + "hidden": false, + "name": "ShouldRotate" + }, + { + "value": "64", + "type": "Number", + "label": "Cohesion sight radius", + "description": "", + "group": "Sight", + "extraInformation": [], + "hidden": false, + "name": "CohesionRadius" + }, + { + "value": "48", + "type": "Number", + "label": "Alignement sight radius", + "description": "", + "group": "Sight", + "extraInformation": [], + "hidden": false, + "name": "AlignmentRadius" + }, + { + "value": "32", + "type": "Number", + "label": "Separation sight radius", + "description": "", + "group": "Sight", + "extraInformation": [], + "hidden": false, + "name": "SeparationRadius" + }, + { + "value": "1", + "type": "Number", + "label": "Cohesion decision weight", + "description": "", + "group": "Decision", + "extraInformation": [], + "hidden": false, + "name": "CohesionWeight" + }, + { + "value": "1", + "type": "Number", + "label": "Alignment decision weight", + "description": "", + "group": "Decision", + "extraInformation": [], + "hidden": false, + "name": "AlignmentWeight" + }, + { + "value": "2", + "type": "Number", + "label": "Separation decision weight", + "description": "", + "group": "Decision", + "extraInformation": [], + "hidden": false, + "name": "SeparationWeight" + }, + { + "value": "", + "type": "Number", + "label": "", + "description": "", + "group": "", + "extraInformation": [], + "hidden": true, + "name": "TrajectoryDistance" + } + ], + "sharedPropertyDescriptors": [] + } + ], + "eventsBasedObjects": [] + }, + { + "author": "@4ian, Tristan Rhodes (https://victrisgames.itch.io/)", + "category": "Movement", + "extensionNamespace": "", + "fullName": "Ellipse movement", + "helpPath": "", + "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0ibWRpLXNpbmUtd2F2ZSIgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0IiB2aWV3Qm94PSIwIDAgMjQgMjQiPjxwYXRoIGQ9Ik0xNi41LDIxQzEzLjUsMjEgMTIuMzEsMTYuNzYgMTEuMDUsMTIuMjhDMTAuMTQsOS4wNCA5LDUgNy41LDVDNC4xMSw1IDQsMTEuOTMgNCwxMkgyQzIsMTEuNjMgMi4wNiwzIDcuNSwzQzEwLjUsMyAxMS43MSw3LjI1IDEyLjk3LDExLjc0QzEzLjgzLDE0LjggMTUsMTkgMTYuNSwxOUMxOS45NCwxOSAyMC4wMywxMi4wNyAyMC4wMywxMkgyMi4wM0MyMi4wMywxMi4zNyAyMS45NywyMSAxNi41LDIxWiIgLz48L3N2Zz4=", + "name": "EllipseMovement", + "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/sine-wave.svg", + "shortDescription": "Move objects on ellipses or smoothly back and forth in one direction.", + "version": "1.0.0", + "description": [ + "It allows objects to move:", + "- on an ellipsis or arcs", + "- smoothly vertically or horizontally (by setting one radius to 0)", + "- on a sine wave (by adding a force)", + "", + "It can be used for:", + "- Making objects float, such as powerups or coins", + "- Moving platforms", + "- Enemy movement patterns", + "- Making a player constantly turn right or left ([open the project online](https://editor.gdevelop.io/?project=example://star-seeker))" + ], + "origin": { + "identifier": "EllipseMovement", + "name": "gdevelop-extension-store" + }, + "tags": [ + "sine", + "ellipse", + "movement", + "circular", + "circle", + "floating", + "platform", + "enemy" + ], + "authorIds": [ + "wWP8BSlAW0UP4NeaHa2LcmmDzmH2", + "gqDaZjCfevOOxBYkK6zlhtZnXCg1", + "IWykYNRvhCZBN3vEgKEbBPOR3Oc2" + ], + "dependencies": [], + "eventsFunctions": [], + "eventsBasedBehaviors": [ + { + "description": "Move objects on ellipses or smoothly back and forth in one direction.", + "fullName": "Ellipse movement", + "name": "EllipseMovement", + "objectType": "", + "eventsFunctions": [ + { + "fullName": "", + "functionType": "Action", + "name": "onCreated", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "EllipseMovement::EllipseMovement::SetPropertyOldX" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "Object.X()" + ] + }, + { + "type": { + "value": "EllipseMovement::EllipseMovement::SetPropertyOldY" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "Object.Y()" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Evaluate the center of movement from the object position and properties.", + "comment2": "" + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "EllipseMovement::EllipseMovement::PropertyInitialTurningLeft" + }, + "parameters": [ + "Object", + "Behavior" + ] + } + ], + "actions": [ + { + "type": { + "value": "EllipseMovement::EllipseMovement::SetPropertyLoopDuration" + }, + "parameters": [ + "Object", + "Behavior", + "*", + "-1" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "EllipseMovement::EllipseMovement::PropertyLoopDuration" + }, + "parameters": [ + "Object", + "Behavior", + "<", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "EllipseMovement::EllipseMovement::SetPropertyMovementAngle" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "Object.Behavior::PropertyInitialDirectionAngle() + 90" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "EllipseMovement::EllipseMovement::PropertyLoopDuration" + }, + "parameters": [ + "Object", + "Behavior", + ">=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "EllipseMovement::EllipseMovement::SetPropertyMovementAngle" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "Object.Behavior::PropertyInitialDirectionAngle() - 90" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "EllipseMovement::EllipseMovement::SetPropertyCenterX" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "Object.X() - Object.Behavior::DeltaX()" + ] + }, + { + "type": { + "value": "EllipseMovement::EllipseMovement::SetPropertyCenterY" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "Object.Y() - Object.Behavior::DeltaY()" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "EllipseMovement::EllipseMovement", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "Action", + "name": "doStepPreEvents", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Update the center when the object is moved outside of the behavior.", + "comment2": "" + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "EllipseMovement::EllipseMovement::SetPropertyCenterX" + }, + "parameters": [ + "Object", + "Behavior", + "+", + "Object.X() - Object.Behavior::PropertyOldX()" + ] + }, + { + "type": { + "value": "EllipseMovement::EllipseMovement::SetPropertyCenterY" + }, + "parameters": [ + "Object", + "Behavior", + "+", + "Object.Y() - Object.Behavior::PropertyOldY()" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Place the object according to the movement angle.", + "comment2": "" + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "EllipseMovement::EllipseMovement::PropertyRadiusX" + }, + "parameters": [ + "Object", + "Behavior", + "!=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "MettreX" + }, + "parameters": [ + "Object", + "=", + "Object.Behavior::PropertyCenterX() + Object.Behavior::DeltaX()" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "EllipseMovement::EllipseMovement::PropertyRadiusY" + }, + "parameters": [ + "Object", + "Behavior", + "!=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "MettreY" + }, + "parameters": [ + "Object", + "=", + "Object.Behavior::PropertyCenterY() + Object.Behavior::DeltaY()" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "EllipseMovement::EllipseMovement::PropertyShouldRotate" + }, + "parameters": [ + "Object", + "Behavior" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetAngle" + }, + "parameters": [ + "Object", + "=", + "Object.Behavior::DirectionAngle() + Object.Behavior::PropertyRotationOffset()" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Save the position to detect when the object is moved outside of the behavior.", + "comment2": "" + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "EllipseMovement::EllipseMovement::SetPropertyOldX" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "Object.X()" + ] + }, + { + "type": { + "value": "EllipseMovement::EllipseMovement::SetPropertyOldY" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "Object.Y()" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "EllipseMovement::EllipseMovement", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "Action", + "name": "doStepPostEvents", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Update the movement angle for the next frame.", + "comment2": "" + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "EllipseMovement::EllipseMovement::SetPropertyMovementAngle" + }, + "parameters": [ + "Object", + "Behavior", + "+", + "360 * TimeDelta() / Object.Behavior::PropertyLoopDuration()" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "EllipseMovement::EllipseMovement", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Change the turning direction (left or right).", + "fullName": "Turn the other way", + "functionType": "Action", + "name": "ToggleTurningLeft", + "sentence": "_PARAM0_ turn the other way", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "EllipseMovement::EllipseMovement::SetPropertyCenterX" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "2 * Object.X() - Object.Behavior::CenterX()" + ] + }, + { + "type": { + "value": "EllipseMovement::EllipseMovement::SetPropertyCenterY" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "2 * Object.Y() - Object.Behavior::CenterY()" + ] + }, + { + "type": { + "value": "EllipseMovement::EllipseMovement::SetPropertyMovementAngle" + }, + "parameters": [ + "Object", + "Behavior", + "+", + "180" + ] + }, + { + "type": { + "value": "EllipseMovement::EllipseMovement::SetPropertyLoopDuration" + }, + "parameters": [ + "Object", + "Behavior", + "*", + "-1" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "EllipseMovement::EllipseMovement", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Change the in which side the object is turning (left or right).", + "fullName": "Turn left or right", + "functionType": "Action", + "name": "SetTurningLeft", + "sentence": "_PARAM0_ turn left: _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::Or" + }, + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "BuiltinCommonInstructions::And" + }, + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "EllipseMovement::EllipseMovement::IsTurningLeft" + }, + "parameters": [ + "Object", + "Behavior", + "yes", + "" + ] + }, + { + "type": { + "inverted": true, + "value": "GetArgumentAsBoolean" + }, + "parameters": [ + "\"TurnLeft\"" + ] + } + ] + }, + { + "type": { + "value": "BuiltinCommonInstructions::And" + }, + "parameters": [], + "subInstructions": [ + { + "type": { + "inverted": true, + "value": "EllipseMovement::EllipseMovement::IsTurningLeft" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + }, + { + "type": { + "value": "GetArgumentAsBoolean" + }, + "parameters": [ + "\"TurnLeft\"" + ] + } + ] + } + ] + } + ], + "actions": [ + { + "type": { + "value": "EllipseMovement::EllipseMovement::ToggleTurningLeft" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "EllipseMovement::EllipseMovement", + "type": "behavior" + }, + { + "description": "Turn left", + "name": "TurnLeft", + "type": "yesorno" + } + ], + "objectGroups": [] + }, + { + "description": "Check if the object is turning left.", + "fullName": "Is turning left", + "functionType": "Condition", + "name": "IsTurningLeft", + "sentence": "_PARAM0_ is turning left", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "EllipseMovement::EllipseMovement::PropertyLoopDuration" + }, + "parameters": [ + "Object", + "Behavior", + "<", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "EllipseMovement::EllipseMovement", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Return the movement angle of the object.", + "fullName": "Movement angle", + "functionType": "Expression", + "name": "MovementAngle", + "sentence": "Set initial Y of _PARAM0_ to _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "Object.Behavior::PropertyMovementAngle()" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "EllipseMovement::EllipseMovement", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Return the loop duration (in seconds).", + "fullName": "Loop duration", + "functionType": "Expression", + "group": "Configuration", + "name": "LoopDuration", + "sentence": "Set initial Y of _PARAM0_ to _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "abs(Object.Behavior::PropertyLoopDuration())" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "EllipseMovement::EllipseMovement", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Return the ellipse radius on X axis.", + "fullName": "Radius X", + "functionType": "Expression", + "group": "Configuration", + "name": "RadiusX", + "sentence": "Set initial Y of _PARAM0_ to _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "Object.Behavior::PropertyRadiusX()" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "EllipseMovement::EllipseMovement", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Return the ellipse radius on X axis.", + "fullName": "Radius Y", + "functionType": "Expression", + "group": "Configuration", + "name": "RadiusY", + "sentence": "Set initial Y of _PARAM0_ to _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "Object.Behavior::PropertyRadiusY()" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "EllipseMovement::EllipseMovement", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Return the movement center position on X axis.", + "fullName": "Movement center X", + "functionType": "Expression", + "group": "Configuration", + "name": "CenterX", + "sentence": "Set initial Y of _PARAM0_ to _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "Object.Behavior::PropertyCenterX()" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "EllipseMovement::EllipseMovement", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Return the movement center position on Y axis.", + "fullName": "Movement center Y", + "functionType": "Expression", + "group": "Configuration", + "name": "CenterY", + "sentence": "Set initial Y of _PARAM0_ to _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "Object.Behavior::PropertyCenterY()" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "EllipseMovement::EllipseMovement", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Change the radius on X axis of the movement.", + "fullName": "Radius X", + "functionType": "Action", + "group": "Elliptical movement configuration", + "name": "SetRadiusX", + "sentence": "Change the radius on X axis of the movement of _PARAM0_ to _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "EllipseMovement::EllipseMovement::SetPropertyRadiusX" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "GetArgumentAsNumber(\"Value\")" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "EllipseMovement::EllipseMovement", + "type": "behavior" + }, + { + "description": "Radius X", + "name": "Value", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Change the radius on Y axis of the movement.", + "fullName": "Radius Y", + "functionType": "Action", + "group": "Elliptical movement configuration", + "name": "SetRadiusY", + "sentence": "Change the radius on Y axis of the movement of _PARAM0_ to _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "EllipseMovement::EllipseMovement::SetPropertyRadiusY" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "GetArgumentAsNumber(\"Value\")" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "EllipseMovement::EllipseMovement", + "type": "behavior" + }, + { + "description": "Radius Y", + "name": "Value", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Change the loop duration.", + "fullName": "Loop duration", + "functionType": "Action", + "group": "Elliptical movement configuration", + "name": "SetLoopDuration", + "sentence": "Change the loop duration of _PARAM0_ to _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "EllipseMovement::EllipseMovement::IsTurningLeft" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "EllipseMovement::EllipseMovement::SetPropertyLoopDuration" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "-GetArgumentAsNumber(\"Value\")" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "EllipseMovement::EllipseMovement::IsTurningLeft" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "EllipseMovement::EllipseMovement::SetPropertyLoopDuration" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "GetArgumentAsNumber(\"Value\")" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "EllipseMovement::EllipseMovement", + "type": "behavior" + }, + { + "description": "Speed (in degrees per second)", + "name": "Value", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Change the movement angle. The object is teleported according to the angle.", + "fullName": "Teleport at an angle", + "functionType": "Action", + "name": "SetMovementAngle", + "sentence": "Teleport _PARAM0_ on the ellipse at _PARAM2_°", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "EllipseMovement::EllipseMovement::SetPropertyMovementAngle" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "GetArgumentAsNumber(\"Value\")" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "EllipseMovement::EllipseMovement", + "type": "behavior" + }, + { + "description": "Movement angle", + "name": "Value", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "fullName": "Delta X", + "functionType": "Expression", + "name": "DeltaX", + "private": true, + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "cos(ToRad(Object.Behavior::PropertyMovementAngle())) * Object.Behavior::PropertyRadiusX()" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "EllipseMovement::EllipseMovement", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "Delta Y", + "functionType": "Expression", + "name": "DeltaY", + "private": true, + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "sin(ToRad(Object.Behavior::PropertyMovementAngle())) * Object.Behavior::PropertyRadiusY()" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "EllipseMovement::EllipseMovement", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "Direction angle", + "functionType": "Expression", + "name": "DirectionAngle", + "private": true, + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "EllipseMovement::EllipseMovement::PropertyLoopDuration" + }, + "parameters": [ + "Object", + "Behavior", + "<", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "Object.Behavior::PropertyMovementAngle() + 90" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "EllipseMovement::EllipseMovement::PropertyLoopDuration" + }, + "parameters": [ + "Object", + "Behavior", + ">=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "Object.Behavior::PropertyMovementAngle() - 90" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "EllipseMovement::EllipseMovement", + "type": "behavior" + } + ], + "objectGroups": [] + } + ], + "propertyDescriptors": [ + { + "value": "100", + "type": "Number", + "label": "Radius of the movement on X axis (0 to deactivate)", + "description": "", + "group": "Ellipse", + "extraInformation": [], + "hidden": false, + "name": "RadiusX" + }, + { + "value": "0", + "type": "Number", + "label": "Radius of the movement on Y axis (0 to deactivate)", + "description": "", + "group": "Ellipse", + "extraInformation": [], + "hidden": false, + "name": "RadiusY" + }, + { + "value": "6", + "type": "Number", + "label": "Loop duration (in seconds)", + "description": "", + "group": "Speed", + "extraInformation": [], + "hidden": false, + "name": "LoopDuration" + }, + { + "value": "", + "type": "Boolean", + "label": "Turn left", + "description": "", + "group": "Speed", + "extraInformation": [], + "hidden": false, + "name": "InitialTurningLeft" + }, + { + "value": "", + "type": "Number", + "label": "Initial direction (in degree)", + "description": "", + "group": "Speed", + "extraInformation": [], + "hidden": false, + "name": "InitialDirectionAngle" + }, + { + "value": "", + "type": "Boolean", + "label": "Rotate", + "description": "", + "group": "Rotation", + "extraInformation": [], + "hidden": false, + "name": "ShouldRotate" + }, + { + "value": "0", + "type": "Number", + "label": "Rotation offset (in degree)", + "description": "", + "group": "Rotation", + "extraInformation": [], + "hidden": false, + "name": "RotationOffset" + }, + { + "value": "0", + "type": "Number", + "label": "", + "description": "", + "group": "", + "extraInformation": [], + "hidden": true, + "name": "CenterX" + }, + { + "value": "0", + "type": "Number", + "label": "", + "description": "", + "group": "", + "extraInformation": [], + "hidden": true, + "name": "CenterY" + }, + { + "value": "0", + "type": "Number", + "label": "", + "description": "", + "group": "", + "extraInformation": [], + "hidden": true, + "name": "MovementAngle" + }, + { + "value": "", + "type": "Number", + "label": "", + "description": "", + "group": "", + "extraInformation": [], + "hidden": true, + "name": "OldX" + }, + { + "value": "", + "type": "Number", + "label": "", + "description": "", + "group": "", + "extraInformation": [], + "hidden": true, + "name": "OldY" + } + ], + "sharedPropertyDescriptors": [] + } + ], + "eventsBasedObjects": [] + }, + { + "author": "Tristan Rhodes (tristan@victrisgames.com), Entropy", + "category": "Movement", + "extensionNamespace": "", + "fullName": "Screen Wrap", + "helpPath": "", + "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0ibWRpLW1vbml0b3Itc2NyZWVuc2hvdCIgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0IiB2aWV3Qm94PSIwIDAgMjQgMjQiPjxwYXRoIGQ9Ik05LDZINVYxMEg3VjhIOU0xOSwxMEgxN1YxMkgxNVYxNEgxOU0yMSwxNkgzVjRIMjFNMjEsMkgzQzEuODksMiAxLDIuODkgMSw0VjE2QTIsMiAwIDAsMCAzLDE4SDEwVjIwSDhWMjJIMTZWMjBIMTRWMThIMjFBMiwyIDAgMCwwIDIzLDE2VjRDMjMsMi44OSAyMi4xLDIgMjEsMiIgLz48L3N2Zz4=", + "name": "ScreenWrap", + "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/monitor-screenshot.svg", + "shortDescription": "Teleport object when it moves off the screen and immediately appear on the opposite side while maintaining speed and trajectory.", + "version": "0.2.2", + "description": [ + "The teleport happens when the center point of the object crosses a border. ", + "Change behavior properties to increase or decrease the margin used to trigger this teleport.", + "By default, the borders of the wrapping area match the screen size, but they can alo be changed.", + "", + "This behavior can be used to recreate the movement of the classic game \"Asteroids\"." + ], + "origin": { + "identifier": "ScreenWrap", + "name": "gdevelop-extension-store" + }, + "tags": [ + "screen", + "wrap", + "teleport", + "asteroids" + ], + "authorIds": [ + "q8ubdigLvIRXLxsJDDTaokO41mc2", + "gqDaZjCfevOOxBYkK6zlhtZnXCg1" + ], + "dependencies": [], + "eventsFunctions": [], + "eventsBasedBehaviors": [ + { + "description": "Teleport the object when leaving one side of the screen so that it immediately reappears on the opposite side, maintaining speed and trajectory.", + "fullName": "Screen Wrap", + "name": "ScreenWrap", + "objectType": "", + "eventsFunctions": [ + { + "fullName": "", + "functionType": "Action", + "name": "onCreated", + "sentence": "", + "events": [ + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Initialize variables (if needed)", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "ScreenWrap::ScreenWrap::PropertyBorderBottom" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "ScreenWrap::ScreenWrap::SetBottomBorder" + }, + "parameters": [ + "Object", + "Behavior", + "SceneWindowHeight()", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "ScreenWrap::ScreenWrap::PropertyBorderRight" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "ScreenWrap::ScreenWrap::SetRightBorder" + }, + "parameters": [ + "Object", + "Behavior", + "SceneWindowWidth()", + "" + ] + } + ] + } + ], + "parameters": [] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ScreenWrap::ScreenWrap", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "Action", + "name": "doStepPostEvents", + "sentence": "", + "events": [ + { + "colorB": 5, + "colorG": 117, + "colorR": 65, + "creationTime": 0, + "name": "ScreenWrap", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Move object to opposite side (if needed)", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [], + "parameters": [] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "ScreenWrap::ScreenWrap::PropertyHorizontalWrapping" + }, + "parameters": [ + "Object", + "Behavior" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "PosX" + }, + "parameters": [ + "Object", + "<", + "Object.Behavior::PropertyBorderLeft() - (Object.Width()/2) - Object.Behavior::PropertyTriggerOffset()" + ] + } + ], + "actions": [ + { + "type": { + "value": "MettreX" + }, + "parameters": [ + "Object", + "=", + "Object.Behavior::PropertyBorderRight() - (Object.Width()/2) + Object.Behavior::PropertyTriggerOffset()" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "PosX" + }, + "parameters": [ + "Object", + ">", + "Object.Behavior::PropertyBorderRight() - (Object.Width()/2) + Object.Behavior::PropertyTriggerOffset()" + ] + } + ], + "actions": [ + { + "type": { + "value": "MettreX" + }, + "parameters": [ + "Object", + "=", + "Object.Behavior::PropertyBorderLeft() - (Object.Width()/2) - Object.Behavior::PropertyTriggerOffset()" + ] + } + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "ScreenWrap::ScreenWrap::PropertyVerticalWrapping" + }, + "parameters": [ + "Object", + "Behavior" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "PosY" + }, + "parameters": [ + "Object", + "<", + "Object.Behavior::PropertyBorderTop() - (Object.Height()/2) - Object.Behavior::PropertyTriggerOffset()" + ] + } + ], + "actions": [ + { + "type": { + "value": "MettreY" + }, + "parameters": [ + "Object", + "=", + "Object.Behavior::PropertyBorderBottom() - (Object.Height()/2) + Object.Behavior::PropertyTriggerOffset()" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "PosY" + }, + "parameters": [ + "Object", + ">", + "Object.Behavior::PropertyBorderBottom() - (Object.Height()/2) + Object.Behavior::PropertyTriggerOffset()" + ] + } + ], + "actions": [ + { + "type": { + "value": "MettreY" + }, + "parameters": [ + "Object", + "=", + "Object.Behavior::PropertyBorderTop() - (Object.Height()/2) - Object.Behavior::PropertyTriggerOffset()" + ] + } + ] + } + ] + } + ], + "parameters": [] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ScreenWrap::ScreenWrap", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Check if the object is wrapping on the left and right borders.", + "fullName": "Is horizontal wrapping", + "functionType": "Condition", + "name": "IsHorizontalWrapping", + "sentence": "_PARAM0_ is horizontal wrapping", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "GetArgumentAsBoolean" + }, + "parameters": [ + "\"Horizontal\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "GetArgumentAsBoolean" + }, + "parameters": [ + "\"Horizontal\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ScreenWrap::ScreenWrap", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Check if the object is wrapping on the top and bottom borders.", + "fullName": "Is vertical wrapping", + "functionType": "Condition", + "name": "IsVerticalWrapping", + "sentence": "_PARAM0_ is vertical wrapping", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "GetArgumentAsBoolean" + }, + "parameters": [ + "\"Vertical\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "GetArgumentAsBoolean" + }, + "parameters": [ + "\"Vertical\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ScreenWrap::ScreenWrap", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Enable wrapping on the left and right borders.", + "fullName": "Enable horizontal wrapping", + "functionType": "Action", + "name": "EnableHorizontalWrapping", + "sentence": "Enable _PARAM0_ horizontal wrapping: _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "GetArgumentAsBoolean" + }, + "parameters": [ + "\"EnableHorizontalWrapping\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "ScreenWrap::ScreenWrap::SetPropertyHorizontalWrapping" + }, + "parameters": [ + "Object", + "Behavior", + "no" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "GetArgumentAsBoolean" + }, + "parameters": [ + "\"EnableHorizontalWrapping\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "ScreenWrap::ScreenWrap::SetPropertyHorizontalWrapping" + }, + "parameters": [ + "Object", + "Behavior", + "yes" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ScreenWrap::ScreenWrap", + "type": "behavior" + }, + { + "description": "Value", + "name": "EnableHorizontalWrapping", + "type": "yesorno" + } + ], + "objectGroups": [] + }, + { + "description": "Enable wrapping on the top and bottom borders.", + "fullName": "Enable vertical wrapping", + "functionType": "Action", + "name": "EnableVerticalWrapping", + "sentence": "Enable _PARAM0_ vertical wrapping: _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "GetArgumentAsBoolean" + }, + "parameters": [ + "\"EnableVerticalWrapping\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "ScreenWrap::ScreenWrap::SetPropertyVerticalWrapping" + }, + "parameters": [ + "Object", + "Behavior", + "no" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "GetArgumentAsBoolean" + }, + "parameters": [ + "\"EnableVerticalWrapping\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "ScreenWrap::ScreenWrap::SetPropertyVerticalWrapping" + }, + "parameters": [ + "Object", + "Behavior", + "yes" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ScreenWrap::ScreenWrap", + "type": "behavior" + }, + { + "description": "Value", + "name": "EnableVerticalWrapping", + "type": "yesorno" + } + ], + "objectGroups": [] + }, + { + "description": "Top border (Y position).", + "fullName": "Top border", + "functionType": "Expression", + "name": "BorderTop", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "Object.Behavior::PropertyBorderTop()" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ScreenWrap::ScreenWrap", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Left border (X position).", + "fullName": "Left border", + "functionType": "Expression", + "name": "BorderLeft", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "Object.Behavior::PropertyBorderLeft()" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ScreenWrap::ScreenWrap", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Right border (X position).", + "fullName": "Right border", + "functionType": "Expression", + "name": "BorderRight", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "Object.Behavior::PropertyBorderRight()" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ScreenWrap::ScreenWrap", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Bottom border (Y position).", + "fullName": "Bottom border", + "functionType": "Expression", + "name": "BorderBottom", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "Object.Behavior::PropertyBorderBottom()" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ScreenWrap::ScreenWrap", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Number of pixels past the center where the object teleports and appears.", + "fullName": "Trigger offset", + "functionType": "Expression", + "name": "TriggerOffset", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "Object.Behavior::PropertyTriggerOffset()" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ScreenWrap::ScreenWrap", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Set top border (Y position).", + "fullName": "Set top border", + "functionType": "Action", + "name": "SetTopBorder", + "sentence": "Set _PARAM0_ top border to _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "ScreenWrap::ScreenWrap::SetPropertyBorderTop" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "GetArgumentAsNumber(\"Value\")" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ScreenWrap::ScreenWrap", + "type": "behavior" + }, + { + "description": "Top border value", + "name": "Value", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Set left border (X position).", + "fullName": "Set left border", + "functionType": "Action", + "name": "SetLeftBorder", + "sentence": "Set _PARAM0_ left border to _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "ScreenWrap::ScreenWrap::SetPropertyBorderLeft" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "GetArgumentAsNumber(\"Value\")" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ScreenWrap::ScreenWrap", + "type": "behavior" + }, + { + "description": "Left border value", + "name": "Value", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Set bottom border (Y position).", + "fullName": "Set bottom border", + "functionType": "Action", + "name": "SetBottomBorder", + "sentence": "Set _PARAM0_ bottom border to _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "ScreenWrap::ScreenWrap::SetPropertyBorderBottom" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "GetArgumentAsNumber(\"Value\")" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ScreenWrap::ScreenWrap", + "type": "behavior" + }, + { + "description": "Bottom border value", + "name": "Value", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Set right border (X position).", + "fullName": "Set right border", + "functionType": "Action", + "name": "SetRightBorder", + "sentence": "Set _PARAM0_ right border to _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "ScreenWrap::ScreenWrap::SetPropertyBorderRight" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "GetArgumentAsNumber(\"Value\")" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ScreenWrap::ScreenWrap", + "type": "behavior" + }, + { + "description": "Right border value", + "name": "Value", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Set trigger offset (pixels).", + "fullName": "Set trigger offset", + "functionType": "Action", + "name": "SetTriggerOffset", + "sentence": "Set _PARAM0_ trigger offset to _PARAM2_ pixels", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "ScreenWrap::ScreenWrap::SetPropertyTriggerOffset" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "GetArgumentAsNumber(\"Value\")" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ScreenWrap::ScreenWrap", + "type": "behavior" + }, + { + "description": "SetScreen Offset Leaving Value", + "name": "Value", + "type": "expression" + } + ], + "objectGroups": [] + } + ], + "propertyDescriptors": [ + { + "value": "true", + "type": "Boolean", + "label": "Horizontal wrapping", + "description": "", + "group": "", + "extraInformation": [], + "hidden": false, + "name": "HorizontalWrapping" + }, + { + "value": "true", + "type": "Boolean", + "label": "Vertical wrapping", + "description": "", + "group": "", + "extraInformation": [], + "hidden": false, + "name": "VerticalWrapping" + }, + { + "value": "0", + "type": "Number", + "label": "Top border of wrapped area (Y)", + "description": "If blank, the value will be 0.", + "group": "", + "extraInformation": [], + "hidden": false, + "name": "BorderTop" + }, + { + "value": "0", + "type": "Number", + "label": "Left border of wrapped area (X)", + "description": "If blank, the value will be 0.", + "group": "", + "extraInformation": [], + "hidden": false, + "name": "BorderLeft" + }, + { + "value": "0", + "type": "Number", + "label": "Right border of wrapped area (X)", + "description": "If blank, the value will be the scene width.", + "group": "", + "extraInformation": [], + "hidden": false, + "name": "BorderRight" + }, + { + "value": "0", + "type": "Number", + "label": "Bottom border of wrapped area (Y)", + "description": "If blank, the value will be scene height.", + "group": "", + "extraInformation": [], + "hidden": false, + "name": "BorderBottom" + }, + { + "value": "0", + "type": "Number", + "label": "Number of pixels past the center where the object teleports and appears", + "description": "", + "group": "", + "extraInformation": [], + "hidden": false, + "name": "TriggerOffset" + } + ], + "sharedPropertyDescriptors": [] + }, + { + "description": "Teleport the object when leaving one side of the screen so that it immediately reappears on the opposite side, maintaining speed and trajectory.", + "fullName": "Screen Wrap (physics objects)", + "name": "ScreenWrapPhysics", + "objectType": "", + "eventsFunctions": [ + { + "fullName": "", + "functionType": "Action", + "name": "onCreated", + "sentence": "", + "events": [ + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Initialize variables (if needed)", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "ScreenWrap::ScreenWrap::PropertyBorderBottom" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "ScreenWrap::ScreenWrap::SetBottomBorder" + }, + "parameters": [ + "Object", + "Behavior", + "SceneWindowHeight()", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "ScreenWrap::ScreenWrap::PropertyBorderRight" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "ScreenWrap::ScreenWrap::SetRightBorder" + }, + "parameters": [ + "Object", + "Behavior", + "SceneWindowWidth()", + "" + ] + } + ] + } + ], + "parameters": [] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ScreenWrap::ScreenWrapPhysics", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "Action", + "name": "doStepPreEvents", + "sentence": "", + "events": [ + { + "colorB": 5, + "colorG": 117, + "colorR": 65, + "creationTime": 0, + "name": "ScreenWrap", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Move object to opposite side (if needed)", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [], + "parameters": [] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "ScreenWrap::ScreenWrap::PropertyHorizontalWrapping" + }, + "parameters": [ + "Object", + "Behavior" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Velocity is saved because Physics2 resets objects velocities when they are moved from the outside of the extension.", + "comment2": "" + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "PosX" + }, + "parameters": [ + "Object", + "<", + "Object.Behavior::PropertyBorderLeft() - (Object.Width()/2) - Object.Behavior::PropertyTriggerOffset()" + ] + } + ], + "actions": [ + { + "type": { + "value": "ScreenWrap::ScreenWrapPhysics::SaveCurrentVelocities" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + }, + { + "type": { + "value": "MettreX" + }, + "parameters": [ + "Object", + "=", + "Object.Behavior::PropertyBorderRight() - (Object.Width()/2) + Object.Behavior::PropertyTriggerOffset()" + ] + }, + { + "type": { + "value": "ScreenWrap::ScreenWrapPhysics::ApplySavedVelocities" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "PosX" + }, + "parameters": [ + "Object", + ">", + "Object.Behavior::PropertyBorderRight() - (Object.Width()/2) + Object.Behavior::PropertyTriggerOffset()" + ] + } + ], + "actions": [ + { + "type": { + "value": "ScreenWrap::ScreenWrapPhysics::SaveCurrentVelocities" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + }, + { + "type": { + "value": "MettreX" + }, + "parameters": [ + "Object", + "=", + "Object.Behavior::PropertyBorderLeft() - (Object.Width()/2) - Object.Behavior::PropertyTriggerOffset()" + ] + }, + { + "type": { + "value": "ScreenWrap::ScreenWrapPhysics::ApplySavedVelocities" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "ScreenWrap::ScreenWrap::PropertyVerticalWrapping" + }, + "parameters": [ + "Object", + "Behavior" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "PosY" + }, + "parameters": [ + "Object", + "<", + "Object.Behavior::PropertyBorderTop() - (Object.Height()/2) - Object.Behavior::PropertyTriggerOffset()" + ] + } + ], + "actions": [ + { + "type": { + "value": "ScreenWrap::ScreenWrapPhysics::SaveCurrentVelocities" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + }, + { + "type": { + "value": "MettreY" + }, + "parameters": [ + "Object", + "=", + "Object.Behavior::PropertyBorderBottom() - (Object.Height()/2) + Object.Behavior::PropertyTriggerOffset()" + ] + }, + { + "type": { + "value": "ScreenWrap::ScreenWrapPhysics::ApplySavedVelocities" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "PosY" + }, + "parameters": [ + "Object", + ">", + "Object.Behavior::PropertyBorderBottom() - (Object.Height()/2) + Object.Behavior::PropertyTriggerOffset()" + ] + } + ], + "actions": [ + { + "type": { + "value": "ScreenWrap::ScreenWrapPhysics::SaveCurrentVelocities" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + }, + { + "type": { + "value": "MettreY" + }, + "parameters": [ + "Object", + "=", + "Object.Behavior::PropertyBorderTop() - (Object.Height()/2) - Object.Behavior::PropertyTriggerOffset()" + ] + }, + { + "type": { + "value": "ScreenWrap::ScreenWrapPhysics::ApplySavedVelocities" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } + ] + } + ] + } + ], + "parameters": [] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ScreenWrap::ScreenWrapPhysics", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Check if the object is wrapping on the left and right borders.", + "fullName": "Is horizontal wrapping", + "functionType": "Condition", + "name": "IsHorizontalWrapping", + "sentence": "_PARAM0_ is horizontal wrapping", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "GetArgumentAsBoolean" + }, + "parameters": [ + "\"Horizontal\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "GetArgumentAsBoolean" + }, + "parameters": [ + "\"Horizontal\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ScreenWrap::ScreenWrapPhysics", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Check if the object is wrapping on the top and bottom borders.", + "fullName": "Is vertical wrapping", + "functionType": "Condition", + "name": "IsVerticalWrapping", + "sentence": "_PARAM0_ is vertical wrapping", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "GetArgumentAsBoolean" + }, + "parameters": [ + "\"Vertical\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "GetArgumentAsBoolean" + }, + "parameters": [ + "\"Vertical\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ScreenWrap::ScreenWrapPhysics", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Enable wrapping on the left and right borders.", + "fullName": "Enable horizontal wrapping", + "functionType": "Action", + "name": "EnableHorizontalWrapping", + "sentence": "Enable _PARAM0_ horizontal wrapping: _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "GetArgumentAsBoolean" + }, + "parameters": [ + "\"EnableHorizontalWrapping\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "ScreenWrap::ScreenWrap::SetPropertyHorizontalWrapping" + }, + "parameters": [ + "Object", + "Behavior", + "no" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "GetArgumentAsBoolean" + }, + "parameters": [ + "\"EnableHorizontalWrapping\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "ScreenWrap::ScreenWrap::SetPropertyHorizontalWrapping" + }, + "parameters": [ + "Object", + "Behavior", + "yes" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ScreenWrap::ScreenWrapPhysics", + "type": "behavior" + }, + { + "description": "Value", + "name": "EnableHorizontalWrapping", + "type": "yesorno" + } + ], + "objectGroups": [] + }, + { + "description": "Enable wrapping on the top and bottom borders.", + "fullName": "Enable vertical wrapping", + "functionType": "Action", + "name": "EnableVerticalWrapping", + "sentence": "Enable _PARAM0_ vertical wrapping: _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "GetArgumentAsBoolean" + }, + "parameters": [ + "\"EnableVerticalWrapping\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "ScreenWrap::ScreenWrap::SetPropertyVerticalWrapping" + }, + "parameters": [ + "Object", + "Behavior", + "no" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "GetArgumentAsBoolean" + }, + "parameters": [ + "\"EnableVerticalWrapping\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "ScreenWrap::ScreenWrap::SetPropertyVerticalWrapping" + }, + "parameters": [ + "Object", + "Behavior", + "yes" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ScreenWrap::ScreenWrapPhysics", + "type": "behavior" + }, + { + "description": "Value", + "name": "EnableVerticalWrapping", + "type": "yesorno" + } + ], + "objectGroups": [] + }, + { + "description": "Top border (Y position).", + "fullName": "Top border", + "functionType": "Expression", + "name": "BorderTop", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "Object.Behavior::PropertyBorderTop()" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ScreenWrap::ScreenWrapPhysics", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Left border (X position).", + "fullName": "Left border", + "functionType": "Expression", + "name": "BorderLeft", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "Object.Behavior::PropertyBorderLeft()" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ScreenWrap::ScreenWrapPhysics", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Right border (X position).", + "fullName": "Right border", + "functionType": "Expression", + "name": "BorderRight", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "Object.Behavior::PropertyBorderRight()" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ScreenWrap::ScreenWrapPhysics", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Bottom border (Y position).", + "fullName": "Bottom border", + "functionType": "Expression", + "name": "BorderBottom", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "Object.Behavior::PropertyBorderBottom()" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ScreenWrap::ScreenWrapPhysics", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Number of pixels past the center where the object teleports and appears.", + "fullName": "Trigger offset", + "functionType": "Expression", + "name": "TriggerOffset", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "Object.Behavior::PropertyTriggerOffset()" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ScreenWrap::ScreenWrapPhysics", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Set top border (Y position).", + "fullName": "Set top border", + "functionType": "Action", + "name": "SetTopBorder", + "sentence": "Set _PARAM0_ top border to _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "ScreenWrap::ScreenWrap::SetPropertyBorderTop" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "GetArgumentAsNumber(\"Value\")" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ScreenWrap::ScreenWrapPhysics", + "type": "behavior" + }, + { + "description": "Top border value", + "name": "Value", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Set left border (X position).", + "fullName": "Set left border", + "functionType": "Action", + "name": "SetLeftBorder", + "sentence": "Set _PARAM0_ left border to _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "ScreenWrap::ScreenWrap::SetPropertyBorderLeft" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "GetArgumentAsNumber(\"Value\")" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ScreenWrap::ScreenWrapPhysics", + "type": "behavior" + }, + { + "description": "Left border value", + "name": "Value", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Set bottom border (Y position).", + "fullName": "Set bottom border", + "functionType": "Action", + "name": "SetBottomBorder", + "sentence": "Set _PARAM0_ bottom border to _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "ScreenWrap::ScreenWrap::SetPropertyBorderBottom" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "GetArgumentAsNumber(\"Value\")" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ScreenWrap::ScreenWrapPhysics", + "type": "behavior" + }, + { + "description": "Bottom border value", + "name": "Value", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Set right border (X position).", + "fullName": "Set right border", + "functionType": "Action", + "name": "SetRightBorder", + "sentence": "Set _PARAM0_ right border to _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "ScreenWrap::ScreenWrap::SetPropertyBorderRight" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "GetArgumentAsNumber(\"Value\")" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ScreenWrap::ScreenWrapPhysics", + "type": "behavior" + }, + { + "description": "Right border value", + "name": "Value", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Set trigger offset (pixels).", + "fullName": "Set trigger offset", + "functionType": "Action", + "name": "SetTriggerOffset", + "sentence": "Set _PARAM0_ trigger offset to _PARAM2_ pixels", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "ScreenWrap::ScreenWrap::SetPropertyTriggerOffset" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "GetArgumentAsNumber(\"Value\")" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ScreenWrap::ScreenWrapPhysics", + "type": "behavior" + }, + { + "description": "SetScreen Offset Leaving Value", + "name": "Value", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Save current velocity values.", + "fullName": "Save current velocity values", + "functionType": "Action", + "name": "SaveCurrentVelocities", + "sentence": "Save current velocity values of _PARAM0_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "ScreenWrap::ScreenWrapPhysics::SetPropertyAngularVelocity" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "Object.RequiredPhysicsBehavior::AngularVelocity()" + ] + }, + { + "type": { + "value": "ScreenWrap::ScreenWrapPhysics::SetPropertyLinearVelocityX" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "Object.RequiredPhysicsBehavior::LinearVelocityX()" + ] + }, + { + "type": { + "value": "ScreenWrap::ScreenWrapPhysics::SetPropertyLinearVelocityY" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "Object.RequiredPhysicsBehavior::LinearVelocityY()" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ScreenWrap::ScreenWrapPhysics", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Apply saved velocity values.", + "fullName": "Apply saved velocity values", + "functionType": "Action", + "name": "ApplySavedVelocities", + "sentence": "Apply saved velocity values of _PARAM0_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "Physics2::AngularVelocity" + }, + "parameters": [ + "Object", + "RequiredPhysicsBehavior", + "=", + "Object.Behavior::PropertyAngularVelocity()" + ] + }, + { + "type": { + "value": "Physics2::LinearVelocityX" + }, + "parameters": [ + "Object", + "RequiredPhysicsBehavior", + "=", + "Object.Behavior::PropertyLinearVelocityX()" + ] + }, + { + "type": { + "value": "Physics2::LinearVelocityY" + }, + "parameters": [ + "Object", + "RequiredPhysicsBehavior", + "=", + "Object.Behavior::PropertyLinearVelocityY()" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ScreenWrap::ScreenWrapPhysics", + "type": "behavior" + } + ], + "objectGroups": [] + } + ], + "propertyDescriptors": [ + { + "value": "", + "type": "Behavior", + "label": "Physics Behavior", + "description": "", + "group": "", + "extraInformation": [ + "Physics2::Physics2Behavior" + ], + "hidden": false, + "name": "RequiredPhysicsBehavior" + }, + { + "value": "true", + "type": "Boolean", + "label": "Horizontal wrapping", + "description": "", + "group": "", + "extraInformation": [], + "hidden": false, + "name": "HorizontalWrapping" + }, + { + "value": "true", + "type": "Boolean", + "label": "Vertical wrapping", + "description": "", + "group": "", + "extraInformation": [], + "hidden": false, + "name": "VerticalWrapping" + }, + { + "value": "0", + "type": "Number", + "label": "Top border of wrapped area (Y). If blank, the value will be 0.", + "description": "", + "group": "", + "extraInformation": [], + "hidden": false, + "name": "BorderTop" + }, + { + "value": "0", + "type": "Number", + "label": "Left border of wrapped area (X). If blank, the value will be 0.", + "description": "", + "group": "", + "extraInformation": [], + "hidden": false, + "name": "BorderLeft" + }, + { + "value": "0", + "type": "Number", + "label": "Right border of wrapped area (X). If blank, the value will be the scene width.", + "description": "", + "group": "", + "extraInformation": [], + "hidden": false, + "name": "BorderRight" + }, + { + "value": "0", + "type": "Number", + "label": "Bottom border of wrapped area (Y). If blank, the value will be scene height.", + "description": "", + "group": "", + "extraInformation": [], + "hidden": false, + "name": "BorderBottom" + }, + { + "value": "0", + "type": "Number", + "label": "Number of pixels past the center where the object teleports and appears", + "description": "", + "group": "", + "extraInformation": [], + "hidden": false, + "name": "TriggerOffset" + }, + { + "value": "0", + "type": "Number", + "label": "Angular Velocity", + "description": "", + "group": "", + "extraInformation": [], + "hidden": true, + "name": "AngularVelocity" + }, + { + "value": "0", + "type": "Number", + "label": "Linear Velocity X", + "description": "", + "group": "", + "extraInformation": [], + "hidden": true, + "name": "LinearVelocityX" + }, + { + "value": "0", + "type": "Number", + "label": "Linear Velocity Y", + "description": "", + "group": "", + "extraInformation": [], + "hidden": true, + "name": "LinearVelocityY" + } + ], + "sharedPropertyDescriptors": [] + } + ], + "eventsBasedObjects": [] + }, + { + "author": "", + "category": "Movement", + "extensionNamespace": "", + "fullName": "Collision detector", + "helpPath": "", + "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0ibWRpLXNldC1ub25lIiB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCI+PHBhdGggZD0iTTksNUE3LDcgMCAwLDAgMiwxMkE3LDcgMCAwLDAgOSwxOUMxMC4wNCwxOSAxMS4wNiwxOC43NiAxMiwxOC4zMkMxMi45NCwxOC43NiAxMy45NiwxOSAxNSwxOUE3LDcgMCAwLDAgMjIsMTJBNyw3IDAgMCwwIDE1LDVDMTMuOTYsNSAxMi45NCw1LjI0IDEyLDUuNjhDMTEuMDYsNS4yNCAxMC4wNCw1IDksNU05LDdDOS4zNCw3IDkuNjcsNy4wMyAxMCw3LjFDOC43Miw4LjQxIDgsMTAuMTcgOCwxMkM4LDEzLjgzIDguNzIsMTUuNTkgMTAsMTYuODlDOS42NywxNi45NiA5LjM0LDE3IDksMTdBNSw1IDAgMCwxIDQsMTJBNSw1IDAgMCwxIDksN00xNSw3QTUsNSAwIDAsMSAyMCwxMkE1LDUgMCAwLDEgMTUsMTdDMTQuNjYsMTcgMTQuMzMsMTYuOTcgMTQsMTYuOUMxNS4yOCwxNS41OSAxNiwxMy44MyAxNiwxMkMxNiwxMC4xNyAxNS4yOCw4LjQxIDE0LDcuMTFDMTQuMzMsNy4wNCAxNC42Niw3IDE1LDdNMTIsOEMxMy4yNiw4Ljk1IDE0LDEwLjQzIDE0LDEyQzE0LDEzLjU3IDEzLjI2LDE1LjA1IDEyLDE2QzEwLjc0LDE1LjA1IDEwLDEzLjU3IDEwLDEyQzEwLDEwLjQzIDEwLjc0LDguOTUgMTIsOFoiIC8+PC9zdmc+", + "name": "CollisionDetector", + "previewIconUrl": "https://asset-resources.gdevelop.io/public-resources/Icons/f0512bd0e942826426e57926e62a6354b2d01670b5f3bdb086b1fb62b060c607_set-none.svg", + "shortDescription": "", + "version": "0.1.0", + "description": "", + "origin": { + "identifier": "BoidsMovement", + "name": "gdevelop-extension-store" + }, + "tags": [ + "collision", + "obstacle", + "solid", + "r-tree" + ], + "authorIds": [ + "IWykYNRvhCZBN3vEgKEbBPOR3Oc2" + ], + "dependencies": [], + "eventsFunctions": [ + { + "description": "Declare JavaScript library.", + "fullName": "Declare JavaScript library", + "functionType": "Action", + "name": "DeclareJavaScriptLibrary", + "private": true, + "sentence": "Declare JavaScript library", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "CollisionDetector::IsJavaScriptLibraryDeclared" + }, + "parameters": [ + "", + "" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "/**", + " * @param {gdjs.BehaviorRBushAABB} fatAABB", + " * @param {gdjs.AABB} aabb", + " */", + "const includesAABB = function(fatAABB, aabb) {", + " return fatAABB.minX <= aabb.min[0] && aabb.max[0] <= fatAABB.maxX", + " && fatAABB.minY <= aabb.min[1] && aabb.max[1] <= fatAABB.maxY;", + "}", + "", + "/**", + " * ", + " */", + "const SolidManager = /** @class */ (function () {", + " /**", + " * Create a manager.", + " * @param {string} behaviorName", + " */", + " function SolidManager(behaviorName) {", + " this.behaviorName = behaviorName;", + " this.rBushes = new Map();", + " }", + "", + " /**", + " * Add an object to the R-Tree.", + " * @param {gdjs.RuntimeBehavior} behavior", + " */", + " SolidManager.prototype.add = function (behavior) {", + " const rBush = this.rBushes.get(behavior.owner.getName());", + " if (!rBush) {", + " return;", + " }", + "", + " if (!behavior.currentRBushAABB) {", + " behavior.currentRBushAABB = new gdjs.BehaviorRBushAABB(", + " behavior", + " );", + " }", + " //behavior.currentRBushAABB.updateAABBFromOwner();", + " const aabb = behavior.owner.getAABB();", + " const fatFactor = behavior._getFatFactor();", + " const marginX = fatFactor * (aabb.max[0] - aabb.min[0]);", + " const marginY = fatFactor * (aabb.max[1] - aabb.min[1]);", + " const fatAABB = behavior.currentRBushAABB;", + " fatAABB.minX = aabb.min[0] - marginX;", + " fatAABB.minY = aabb.min[1] - marginY;", + " fatAABB.maxX = aabb.max[0] + marginX;", + " fatAABB.maxY = aabb.max[1] + marginY;", + " ", + " rBush.insert(fatAABB);", + " }", + "", + " /**", + " * Remove an object from the R-Tree.", + " * @param {gdjs.RuntimeBehavior} behavior", + " */", + " SolidManager.prototype.remove = function (behavior) {", + " const rBush = this.rBushes.get(behavior.owner.getName());", + " if (!rBush) {", + " return;", + " }", + " ", + " rBush.remove(behavior.currentRBushAABB);", + " }", + " ", + " /**", + " * Update an object to the R-Tree.", + " * @param {gdjs.RuntimeBehavior} behavior", + " */", + " SolidManager.prototype.update = function (behavior) {", + " const rBush = this.rBushes.get(behavior.owner.getName());", + " if (!rBush) {", + " return;", + " }", + "", + " const fatAABB = behavior.currentRBushAABB;", + " const aabb = behavior.owner.getAABB();", + "", + " if (!includesAABB(fatAABB, aabb)) {", + " this.remove(behavior);", + " this.add(behavior);", + " }", + " }", + "", + " /**", + " * @param {gdjs.RuntimeInstanceContainer} runtimeScene", + " * @param {string} objectName", + " */", + " SolidManager.prototype.getOrCreateRBush = function (runtimeScene, objectName) {", + " let rBush = this.rBushes.get(objectName);", + " if (!rBush) {", + " rBush = new rbush();", + " this.rBushes.set(objectName, rBush);", + " const objects = runtimeScene.getObjects(objectName);", + " objects.forEach(object => this.add(object.getBehavior(this.behaviorName)));", + " }", + " return rBush;", + " }", + "", + " /**", + " * Returns all the instances around the specified area.", + " * @param {gdjs.RuntimeInstanceContainer} runtimeScene", + " * @param {string} objectName", + " * @param {number} left", + " * @param {number} top", + " * @param {number} right", + " * @param {number} bottom", + " * @param {gdjs.RuntimeObject[]} results", + " * @return {gdjs.RuntimeObject[]} An array with all boids near the object.", + " */", + " SolidManager.prototype.getAllInstancesInRectangle = function (runtimeScene, objectName, left, top, right, bottom, results) {", + " const searchArea = gdjs.staticObject(", + " SolidManager.prototype.getAllInstancesInRectangle", + " );", + " searchArea.minX = left;", + " searchArea.minY = top;", + " searchArea.maxX = right;", + " searchArea.maxY = bottom;", + " const rBush = this.getOrCreateRBush(runtimeScene, objectName);", + " // TODO The R-Tree should not allocate an array.", + " const nearbys = rBush.search(searchArea);", + " results.length = 0;", + " nearbys.forEach(nearby => results.push(nearby.behavior.owner));", + " return results;", + " }", + "", + " return SolidManager;", + "}());", + "", + "gdjs.__collisionDetectorExtension = gdjs.__collisionDetectorExtension || {};", + "gdjs.__collisionDetectorExtension.SolidManager = SolidManager;", + "" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": true + } + ] + } + ], + "parameters": [], + "objectGroups": [] + }, + { + "description": "Check if JavaScript library is declared.", + "fullName": "JavaScript library declared", + "functionType": "Condition", + "name": "IsJavaScriptLibraryDeclared", + "private": true, + "sentence": "JavaScript library is declared", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": "eventsFunctionContext.returnValue = !!gdjs.__collisionDetectorExtension;", + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [], + "objectGroups": [] + }, + { + "description": "Check if obstacles are around a rectanglular area.", + "fullName": "Is around rectangle", + "functionType": "Condition", + "name": "IsAroundRectangle", + "sentence": "_PARAM1_ is around a rectangle (left: _PARAM3_, top: _PARAM4_, right: _PARAM5_, bottom: _PARAM6_)", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "\r", + "const manager = runtimeScene.__collisionDetectorExtension.solidManager;\r", + "\r", + "const solidObjectsLists = eventsFunctionContext.getObjectsLists(\"Object\");\r", + "\r", + "const left = eventsFunctionContext.getArgument(\"Left\");\r", + "const top = eventsFunctionContext.getArgument(\"Top\");\r", + "const right = eventsFunctionContext.getArgument(\"Right\");\r", + "const bottom = eventsFunctionContext.getArgument(\"Bottom\");\r", + "\r", + "for (const solidObjectName in solidObjectsLists.items) {\r", + " const pickedObjects = solidObjectsLists.items[solidObjectName];\r", + " if (pickedObjects.length === runtimeScene.getInstancesCountOnScene(solidObjectName)) {\r", + " manager.getAllInstancesInRectangle(runtimeScene, solidObjectName, left, top, right, bottom, pickedObjects);\r", + " }\r", + " else {\r", + " // TODO avoid alloction\r", + " const objects = [...pickedObjects];\r", + " pickedObjects.length = 0;\r", + " objects.forEach(pickedObject => {\r", + " const aabb = pickedObject.getAABB();\r", + " if (left < aabb.max[0] && aabb.min[0] < right\r", + " && top < aabb.max[1] && aabb.min[1] < bottom) {\r", + " pickedObjects.push(pickedObject);\r", + " }\r", + " });\r", + " }\r", + "}\r", + "eventsFunctionContext.returnValue = true;" + ], + "parameterObjects": "Object", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "objectList" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "CollisionDetector::Solid", + "type": "behavior" + }, + { + "description": "Left bound", + "name": "Left", + "type": "expression" + }, + { + "description": "Top bound", + "name": "Top", + "type": "expression" + }, + { + "description": "Right bound", + "name": "Right", + "type": "expression" + }, + { + "description": "Bottom bound", + "name": "Bottom", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Move an object away from another using collision masks.", + "fullName": "Separate objects", + "functionType": "Action", + "name": "Separate", + "sentence": "Move _PARAM1_ away from _PARAM3_ (only _PARAM1_ move)", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "\r", + "const manager = runtimeScene.__collisionDetectorExtension.solidManager;\r", + "\r", + "const objects = eventsFunctionContext.getObjects(\"Object\");\r", + "const otherObjects = eventsFunctionContext.getObjects(\"OtherObject\");\r", + "\r", + "const iteratedObjects = objects;\r", + "const searchedObjectLists = eventsFunctionContext.getObjectsLists(\"OtherObject\");\r", + "\r", + "// It's not possible because of separateFromObjects\r", + "\r", + "// // Iterate on the smaller array\r", + "// let iteratedObjects;\r", + "// let searchedObjectLists;\r", + "// if (objects.length <= otherObjects.length) {\r", + "// iteratedObjects = objects;\r", + "// searchedObjectLists = eventsFunctionContext.getObjectsLists(\"OtherObject\");\r", + "// }\r", + "// else {\r", + "// iteratedObjects = otherObjects;\r", + "// searchedObjectLists = eventsFunctionContext.getObjectsLists(\"Object\");\r", + "// }\r", + "\r", + "// TODO avoid allocation\r", + "const nearObjects = []\r", + "for (const iteratedObject of iteratedObjects) {\r", + " const left = iteratedObject.getAABBLeft();\r", + " const top = iteratedObject.getAABBTop();\r", + " const right = iteratedObject.getAABBRight();\r", + " const bottom = iteratedObject.getAABBBottom();\r", + " for (const searchedObjectName in searchedObjectLists.items) {\r", + " const pickedObjects = searchedObjectLists.items[searchedObjectName];\r", + " if (pickedObjects.length === runtimeScene.getInstancesCountOnScene(searchedObjectName)) {\r", + " nearObjects.length = 0;\r", + " manager.getAllInstancesInRectangle(runtimeScene, searchedObjectName, left, top, right, bottom, nearObjects);\r", + " iteratedObject.separateFromObjects(nearObjects);\r", + " }\r", + " else {\r", + " // It avoids to do intersection between pickedObjects and nearObjects\r", + " // as it is O(n²) and the naive collision is O(n).\r", + " object.separateFromObjects(pickedObjects);\r", + " }\r", + " }\r", + "}" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "objectList" + }, + { + "description": "Solid behavior", + "name": "Behavior", + "supplementaryInformation": "CollisionDetector::Solid", + "type": "behavior" + }, + { + "description": "Object (won't move)", + "name": "OtherObject", + "type": "objectList" + }, + { + "description": "Solid behavior", + "name": "OtherBehavior", + "supplementaryInformation": "CollisionDetector::Solid", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "Is on screen", + "functionType": "Condition", + "name": "IsOnScreen", + "sentence": "_PARAM1_ is on screen", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "\r", + "const solidObjectsLists = eventsFunctionContext.getObjectsLists(\"Object\");\r", + "const behaviorName = eventsFunctionContext.getBehaviorName(\"Behavior\");\r", + "\r", + "for (const solidObjectName in solidObjectsLists.items) {\r", + " const pickedObjects = solidObjectsLists.items[solidObjectName];\r", + "\r", + " const sharedData = pickedObjects[0].getBehavior(behaviorName)._sharedData;\r", + "\r", + " /** @type {gdjs.RuntimeObject[]} */\r", + " const onScreenObjects = sharedData.onScreenObjects;\r", + "\r", + " if (pickedObjects.length === runtimeScene.getInstancesCountOnScene(solidObjectName)) {\r", + " pickedObjects.length = 0;\r", + " pickedObjects.push.apply(pickedObjects, onScreenObjects);\r", + " }\r", + " else {\r", + " // TODO\r", + " console.error(\"The 'is on screen' condition must be used first.\");\r", + " pickedObjects.length = 0;\r", + " pickedObjects.push.apply(pickedObjects, onScreenObjects);\r", + " }\r", + "}\r", + "\r", + "eventsFunctionContext.returnValue = true;" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "objectList" + }, + { + "description": "On screen detector behavior", + "name": "Behavior", + "supplementaryInformation": "CollisionDetector::OnScreenDetector", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "Has left screen", + "functionType": "Condition", + "name": "HasLeftScreen", + "sentence": "_PARAM1_ has left screen", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "\r", + "const solidObjectsLists = eventsFunctionContext.getObjectsLists(\"Object\");\r", + "const behaviorName = eventsFunctionContext.getBehaviorName(\"Behavior\");\r", + "\r", + "for (const solidObjectName in solidObjectsLists.items) {\r", + " const pickedObjects = solidObjectsLists.items[solidObjectName];\r", + "\r", + " const sharedData = pickedObjects[0].getBehavior(behaviorName)._sharedData;\r", + "\r", + " /** @type {gdjs.RuntimeObject[]} */\r", + " const previousOnScreenObjects = sharedData.previousOnScreenObjects;\r", + " /** @type {gdjs.RuntimeObject[]} */\r", + " const onScreenObjects = sharedData.onScreenObjects;\r", + "\r", + " if (pickedObjects.length === runtimeScene.getInstancesCountOnScene(solidObjectName)) {\r", + " pickedObjects.length = 0;\r", + " previousOnScreenObjects.forEach(previousOnScreenObject => {\r", + " if (!onScreenObjects.includes(previousOnScreenObject)) {\r", + " pickedObjects.push(previousOnScreenObject);\r", + " }\r", + " });\r", + " }\r", + " else {\r", + " // TODO\r", + " console.error(\"The 'has left screen' condition must be used first.\");\r", + " pickedObjects.length = 0;\r", + " previousOnScreenObjects.forEach(previousOnScreenObject => {\r", + " if (!onScreenObjects.includes(previousOnScreenObject)) {\r", + " pickedObjects.push(previousOnScreenObject);\r", + " }\r", + " });\r", + " }\r", + "}\r", + "\r", + "eventsFunctionContext.returnValue = true;" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "objectList" + }, + { + "description": "On screen detector behavior", + "name": "Behavior", + "supplementaryInformation": "CollisionDetector::OnScreenDetector", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "Will enter screen", + "functionType": "Condition", + "name": "WillEnterScreen", + "sentence": "_PARAM1_ will enter screen", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "\r", + "const solidObjectsLists = eventsFunctionContext.getObjectsLists(\"Object\");\r", + "const behaviorName = eventsFunctionContext.getBehaviorName(\"Behavior\");\r", + "\r", + "for (const solidObjectName in solidObjectsLists.items) {\r", + " const pickedObjects = solidObjectsLists.items[solidObjectName];\r", + "\r", + " const sharedData = pickedObjects[0].getBehavior(behaviorName)._sharedData;\r", + "\r", + " /** @type {gdjs.RuntimeObject[]} */\r", + " const previousOnScreenObjects = sharedData.previousOnScreenObjects;\r", + " /** @type {gdjs.RuntimeObject[]} */\r", + " const onScreenObjects = sharedData.onScreenObjects;\r", + " //console.log(\"In: \" + previousOnScreenObjects.length + \" --> \" + onScreenObjects.length);\r", + "\r", + " if (pickedObjects.length === runtimeScene.getInstancesCountOnScene(solidObjectName)) {\r", + " pickedObjects.length = 0;\r", + " onScreenObjects.forEach(onScreenObject => {\r", + " if (!previousOnScreenObjects.includes(onScreenObject)) {\r", + " pickedObjects.push(onScreenObject);\r", + " }\r", + " });\r", + " }\r", + " else {\r", + " // TODO\r", + " console.error(\"The 'will enter screen' condition must be used first.\");\r", + " pickedObjects.length = 0;\r", + " onScreenObjects.forEach(onScreenObject => {\r", + " if (!previousOnScreenObjects.includes(onScreenObject)) {\r", + " pickedObjects.push(onScreenObject);\r", + " }\r", + " });\r", + " }\r", + "}\r", + "\r", + "eventsFunctionContext.returnValue = true;" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "objectList" + }, + { + "description": "On screen detector behavior", + "name": "Behavior", + "supplementaryInformation": "CollisionDetector::OnScreenDetector", + "type": "behavior" + } + ], + "objectGroups": [] + } + ], + "eventsBasedBehaviors": [ + { + "description": "Can be serched efficiently.", + "fullName": "Solid", + "name": "Solid", + "objectType": "", + "eventsFunctions": [ + { + "fullName": "", + "functionType": "Action", + "name": "onCreated", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "CollisionDetector::DeclareJavaScriptLibrary" + }, + "parameters": [ + "", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const behaviorName = eventsFunctionContext.getBehaviorName(\"Behavior\");", + "", + "runtimeScene.__collisionDetectorExtension = runtimeScene.__collisionDetectorExtension || {};", + "runtimeScene.__collisionDetectorExtension.solidManager =", + " runtimeScene.__collisionDetectorExtension.solidManager || new gdjs.__collisionDetectorExtension.SolidManager(behaviorName);" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "CollisionDetector::Solid::PropertySolidType" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "\"Static\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "CollisionDetector::Solid::SetPropertyFatFactor" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "0" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "CollisionDetector::Solid::AddToTree" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "CollisionDetector::Solid", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "Action", + "name": "onActivate", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "CollisionDetector::Solid::AddToTree" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "CollisionDetector::Solid", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "Action", + "name": "onDeActivate", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "CollisionDetector::Solid::RemoveFromTree" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "CollisionDetector::Solid", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "Action", + "name": "onDestroy", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "CollisionDetector::Solid::RemoveFromTree" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "CollisionDetector::Solid", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "Action", + "name": "doStepPreEvents", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "CollisionDetector::Solid::UpdateInTree" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } + ] + }, + { + "disabled": true, + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::Or" + }, + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "CollisionDetector::Solid::PropertyPreviousX" + }, + "parameters": [ + "Object", + "Behavior", + "!=", + "Object.X()" + ] + }, + { + "type": { + "value": "CollisionDetector::Solid::PropertyPreviousY" + }, + "parameters": [ + "Object", + "Behavior", + "!=", + "Object.Y()" + ] + }, + { + "type": { + "value": "CollisionDetector::Solid::PropertyPreviousWidth" + }, + "parameters": [ + "Object", + "Behavior", + "!=", + "Object.Width()" + ] + }, + { + "type": { + "value": "CollisionDetector::Solid::PropertyPreviousHeight" + }, + "parameters": [ + "Object", + "Behavior", + "!=", + "Object.Height()" + ] + }, + { + "type": { + "value": "CollisionDetector::Solid::PropertyPreviousAngle" + }, + "parameters": [ + "Object", + "Behavior", + "!=", + "Object.Angle()" + ] + } + ] + } + ], + "actions": [ + { + "type": { + "value": "CollisionDetector::Solid::UpdateInTree" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + }, + { + "type": { + "value": "CollisionDetector::Solid::SetPropertyPreviousX" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "Object.X()" + ] + }, + { + "type": { + "value": "CollisionDetector::Solid::SetPropertyPreviousY" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "Object.Y()" + ] + }, + { + "type": { + "value": "CollisionDetector::Solid::SetPropertyPreviousWidth" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "Object.Width()" + ] + }, + { + "type": { + "value": "CollisionDetector::Solid::SetPropertyPreviousHeight" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "Object.Height()" + ] + }, + { + "type": { + "value": "CollisionDetector::Solid::SetPropertyPreviousAngle" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "Object.Angle()" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "CollisionDetector::Solid", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Update the object position in the tree", + "fullName": "Update in the tree", + "functionType": "Action", + "name": "UpdateInTree", + "private": true, + "sentence": "Update _PARAM0_ in the tree", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const object = objects[0];\r", + "const behaviorName = eventsFunctionContext.getBehaviorName(\"Behavior\");\r", + "const behavior = object.getBehavior(behaviorName);\r", + "\r", + "runtimeScene.__collisionDetectorExtension.solidManager.update(behavior);" + ], + "parameterObjects": "Object", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "CollisionDetector::Solid", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Add the object position in the tree", + "fullName": "Add to the tree", + "functionType": "Action", + "name": "AddToTree", + "private": true, + "sentence": "Add _PARAM0_ to the tree", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const object = objects[0];\r", + "const behaviorName = eventsFunctionContext.getBehaviorName(\"Behavior\");\r", + "const behavior = object.getBehavior(behaviorName);\r", + "\r", + "runtimeScene.__collisionDetectorExtension.solidManager.add(behavior);" + ], + "parameterObjects": "Object", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "CollisionDetector::Solid", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Remove the object from the tree", + "fullName": "Remove from the tree", + "functionType": "Action", + "name": "RemoveFromTree", + "private": true, + "sentence": "Remove _PARAM0_ from the tree", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const object = objects[0];\r", + "const behaviorName = eventsFunctionContext.getBehaviorName(\"Behavior\");\r", + "const behavior = object.getBehavior(behaviorName);\r", + "\r", + "runtimeScene.__collisionDetectorExtension.solidManager.remove(behavior);" + ], + "parameterObjects": "Object", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "CollisionDetector::Solid", + "type": "behavior" + } + ], + "objectGroups": [] + } + ], + "propertyDescriptors": [ + { + "value": "", + "type": "Number", + "label": "", + "description": "", + "group": "", + "extraInformation": [], + "hidden": true, + "name": "PreviousX" + }, + { + "value": "", + "type": "Number", + "label": "", + "description": "", + "group": "", + "extraInformation": [], + "hidden": true, + "name": "PreviousY" + }, + { + "value": "", + "type": "Number", + "label": "", + "description": "", + "group": "", + "extraInformation": [], + "hidden": true, + "name": "PreviousWidth" + }, + { + "value": "", + "type": "Number", + "label": "", + "description": "", + "group": "", + "extraInformation": [], + "hidden": true, + "name": "PreviousHeight" + }, + { + "value": "", + "type": "Number", + "label": "", + "description": "", + "group": "", + "extraInformation": [], + "hidden": true, + "name": "PreviousAngle" + }, + { + "value": "0.5", + "type": "Number", + "label": "", + "description": "", + "group": "", + "extraInformation": [], + "hidden": true, + "name": "FatFactor" + }, + { + "value": "Automatic", + "type": "Choice", + "label": "Type", + "description": "", + "group": "", + "extraInformation": [ + "Automatic", + "Mobile", + "Static" + ], + "hidden": false, + "name": "SolidType" + } + ], + "sharedPropertyDescriptors": [] + }, + { + "description": "", + "fullName": "", + "name": "OnScreenDetector", + "objectType": "", + "eventsFunctions": [ + { + "fullName": "", + "functionType": "Action", + "name": "onCreated", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "\r", + "const behaviorName = eventsFunctionContext.getBehaviorName(\"Behavior\");\r", + "const sharedData = objects[0].getBehavior(behaviorName)._sharedData;\r", + "\r", + "sharedData.onScreenObjects = sharedData.onScreenObjects || [];\r", + "sharedData.previousOnScreenObjects = sharedData.previousOnScreenObjects || [];\r", + "" + ], + "parameterObjects": "Object", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "CollisionDetector::OnScreenDetector", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "Action", + "name": "doStepPreEvents", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "CollisionDetector::OnScreenDetector::SharedPropertyHasCheckObjectsThisFrame" + }, + "parameters": [ + "Object", + "Behavior" + ] + } + ], + "actions": [ + { + "type": { + "value": "CollisionDetector::OnScreenDetector::SetSharedPropertyHasCheckObjectsThisFrame" + }, + "parameters": [ + "Object", + "Behavior", + "yes" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::Or" + }, + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "CollisionDetector::OnScreenDetector::SharedPropertyPreviousCameraX" + }, + "parameters": [ + "Object", + "Behavior", + "!=", + "floor(CameraCenterX(Object.Behavior::SharedPropertyLayer()) / Object.Behavior::SharedPropertySnapSize()) * Object.Behavior::SharedPropertySnapSize()" + ] + }, + { + "type": { + "value": "CollisionDetector::OnScreenDetector::SharedPropertyPreviousCameraY" + }, + "parameters": [ + "Object", + "Behavior", + "!=", + "floor(CameraCenterY(Object.Behavior::SharedPropertyLayer()) / Object.Behavior::SharedPropertySnapSize()) * Object.Behavior::SharedPropertySnapSize()" + ] + } + ] + } + ], + "actions": [ + { + "type": { + "value": "CollisionDetector::OnScreenDetector::SetSharedPropertyPreviousCameraX" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "floor(CameraCenterX(Object.Behavior::SharedPropertyLayer()) / Object.Behavior::SharedPropertySnapSize()) * Object.Behavior::SharedPropertySnapSize()" + ] + }, + { + "type": { + "value": "CollisionDetector::OnScreenDetector::SetSharedPropertyPreviousCameraY" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "floor(CameraCenterY(Object.Behavior::SharedPropertyLayer()) / Object.Behavior::SharedPropertySnapSize()) * Object.Behavior::SharedPropertySnapSize()" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const object = objects[0];\r", + "const behaviorName = eventsFunctionContext.getBehaviorName(\"Behavior\");\r", + "const sharedData = object.getBehavior(behaviorName)._sharedData;\r", + "\r", + "const layerName = sharedData._getLayer();\r", + "const left = gdjs.evtTools.camera.getCameraBorderLeft(runtimeScene, layerName);\r", + "const top = gdjs.evtTools.camera.getCameraBorderTop(runtimeScene, layerName);\r", + "const right = gdjs.evtTools.camera.getCameraBorderRight(runtimeScene, layerName);\r", + "const bottom = gdjs.evtTools.camera.getCameraBorderBottom(runtimeScene, layerName);\r", + "\r", + "const previousOnScreenObjects = sharedData.onScreenObjects;\r", + "sharedData.onScreenObjects = sharedData.previousOnScreenObjects;\r", + "sharedData.previousOnScreenObjects = previousOnScreenObjects;\r", + "\r", + "const onScreenObjects = sharedData.onScreenObjects;\r", + "onScreenObjects.length = 0;\r", + "const manager = runtimeScene.__collisionDetectorExtension.solidManager;\r", + "manager.getAllInstancesInRectangle(runtimeScene, object.getName(), left, top, right, bottom, onScreenObjects);\r", + "" + ], + "parameterObjects": "Object", + "useStrict": true, + "eventsSheetExpanded": true + } + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "CollisionDetector::OnScreenDetector", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "Action", + "name": "doStepPostEvents", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "CollisionDetector::OnScreenDetector::SetSharedPropertyHasCheckObjectsThisFrame" + }, + "parameters": [ + "Object", + "Behavior", + "=" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "CollisionDetector::OnScreenDetector", + "type": "behavior" + } + ], + "objectGroups": [] + } + ], + "propertyDescriptors": [ + { + "value": "", + "type": "Behavior", + "label": "Solid behavior", + "description": "", + "group": "", + "extraInformation": [ + "CollisionDetector::Solid" + ], + "hidden": false, + "name": "SolidBehavior" + } + ], + "sharedPropertyDescriptors": [ + { + "value": "", + "type": "Boolean", + "label": "", + "description": "", + "group": "", + "extraInformation": [], + "hidden": true, + "name": "HasCheckObjectsThisFrame" + }, + { + "value": "", + "type": "Number", + "label": "", + "description": "", + "group": "", + "extraInformation": [], + "hidden": true, + "name": "PreviousCameraX" + }, + { + "value": "", + "type": "Number", + "label": "", + "description": "", + "group": "", + "extraInformation": [], + "hidden": true, + "name": "PreviousCameraY" + }, + { + "value": "128", + "type": "Number", + "label": "", + "description": "", + "group": "", + "extraInformation": [], + "hidden": false, + "name": "SnapSize" + }, + { + "value": "", + "type": "String", + "label": "Layer", + "description": "", + "group": "", + "extraInformation": [], + "hidden": false, + "name": "Layer" + } + ] + } + ], + "eventsBasedObjects": [] + } + ], + "externalLayouts": [], + "externalSourceFiles": [] +} \ No newline at end of file