diff --git a/examples/stick-objects/stick-objects.json b/examples/stick-objects/stick-objects.json index 0fffa8d25..9b5d83dc5 100644 --- a/examples/stick-objects/stick-objects.json +++ b/examples/stick-objects/stick-objects.json @@ -1,13 +1,15 @@ { "firstLayout": "", "gdVersion": { - "build": 99, - "major": 4, - "minor": 0, + "build": 238, + "major": 5, + "minor": 5, "revision": 0 }, "properties": { "adaptGameResolutionAtRuntime": true, + "antialiasingMode": "MSAA", + "antialisingEnabledOnMobile": false, "folderProject": false, "orientation": "landscape", "packageName": "com.example.sticker", @@ -15,9 +17,10 @@ "projectUuid": "0e7be71b-dcfc-456a-89bd-0291d7805074", "scaleMode": "linear", "sizeOnStartupMode": "", - "useExternalSourceFiles": false, + "templateSlug": "", "version": "1.1.0", "name": "Sticker Example", + "description": "", "author": "", "windowWidth": 800, "windowHeight": 600, @@ -42,9 +45,16 @@ "showGDevelopSplash": true, "showProgressBar": true }, + "watermark": { + "placement": "bottom-left", + "showWatermark": true + }, "authorIds": [ "IWykYNRvhCZBN3vEgKEbBPOR3Oc2" ], + "authorUsernames": [], + "categories": [], + "playableDevices": [], "extensionProperties": [], "platforms": [ { @@ -56,7 +66,6 @@ "resources": { "resources": [ { - "alwaysLoaded": false, "file": "assets/Small hull.png", "kind": "image", "metadata": "", @@ -69,7 +78,6 @@ } }, { - "alwaysLoaded": false, "file": "assets/Blue Character (1).png", "kind": "image", "metadata": "", @@ -82,7 +90,6 @@ } }, { - "alwaysLoaded": false, "file": "assets/bush (3).png", "kind": "image", "metadata": "", @@ -91,7 +98,6 @@ "userAdded": true }, { - "alwaysLoaded": false, "file": "assets/bush (3) dark.png", "kind": "image", "metadata": "", @@ -103,6 +109,9 @@ "resourceFolders": [] }, "objects": [], + "objectsFolderStructure": { + "folderName": "__ROOT" + }, "objectsGroups": [], "variables": [], "layouts": [ @@ -111,9 +120,6 @@ "disableInputWhenNotFocused": true, "mangledName": "Boat", "name": "Boat", - "oglFOV": 90, - "oglZFar": 500, - "oglZNear": 1, "r": 77, "standardSortMethod": true, "stopSoundsOnStartup": true, @@ -140,7 +146,6 @@ "customSize": true, "height": 243, "layer": "", - "locked": false, "name": "Boat", "persistentUuid": "0818b8c3-4318-42dd-9790-89faeefd250f", "width": 90, @@ -156,7 +161,6 @@ "customSize": false, "height": 0, "layer": "", - "locked": false, "name": "Directions", "persistentUuid": "3a41aebe-7b08-45c9-939a-c7ac45a768fe", "width": 0, @@ -172,7 +176,6 @@ "customSize": true, "height": 243, "layer": "", - "locked": false, "name": "Boat", "persistentUuid": "43a93a74-2d2a-4379-b905-07a6723b7435", "width": 90, @@ -188,7 +191,6 @@ "customSize": true, "height": 243, "layer": "", - "locked": false, "name": "Boat", "persistentUuid": "42d6e8ab-01ce-4a31-8a21-22ad68c47d0c", "width": 90, @@ -202,8 +204,9 @@ ], "objects": [ { + "adaptCollisionMaskAutomatically": false, + "assetStoreId": "", "name": "Boat", - "tags": "", "type": "Sprite", "updateIfNotVisible": false, "variables": [], @@ -298,8 +301,9 @@ ] }, { + "adaptCollisionMaskAutomatically": false, + "assetStoreId": "", "name": "CrewMember", - "tags": "", "type": "Sprite", "updateIfNotVisible": false, "variables": [], @@ -308,7 +312,8 @@ { "name": "Sticker", "type": "Sticker::Sticker", - "OnlyFollowPosition": false + "OnlyFollowPosition": false, + "IsDestroyedWithParent": true } ], "animations": [ @@ -344,11 +349,11 @@ ] }, { + "assetStoreId": "", "bold": false, "italic": false, "name": "Directions", "smoothed": true, - "tags": "", "type": "TextObject::Text", "underlined": false, "variables": [], @@ -356,67 +361,91 @@ "behaviors": [], "string": "Click to add a person\nPress Space to switch case\nPress Backspace to delete a random person\nPress Return to select a random person and its boat", "font": "", + "textAlignment": "", "characterSize": 20, "color": { "b": 0, "g": 0, "r": 0 + }, + "content": { + "bold": false, + "isOutlineEnabled": false, + "isShadowEnabled": false, + "italic": false, + "outlineColor": "255;255;255", + "outlineThickness": 2, + "shadowAngle": 90, + "shadowBlurRadius": 2, + "shadowColor": "0;0;0", + "shadowDistance": 4, + "shadowOpacity": 127, + "smoothed": true, + "underlined": false, + "text": "Click to add a person\nPress Space to switch case\nPress Backspace to delete a random person\nPress Return to select a random person and its boat", + "font": "", + "textAlignment": "", + "verticalTextAlignment": "top", + "characterSize": 20, + "color": "0;0;0" } } ], + "objectsFolderStructure": { + "folderName": "__ROOT", + "children": [ + { + "objectName": "Boat" + }, + { + "objectName": "CrewMember" + }, + { + "objectName": "Directions" + } + ] + }, "events": [ { "colorB": 228, "colorG": 176, "colorR": 74, "creationTime": 0, - "disabled": false, - "folded": false, "name": "Move the boat", "source": "", "type": "BuiltinCommonInstructions::Group", "events": [ { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Standard", "conditions": [], "actions": [ { "type": { - "inverted": false, "value": "Rotate" }, "parameters": [ "Boat", "20", "" - ], - "subInstructions": [] + ] } - ], - "events": [] + ] }, { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Standard", "conditions": [], "actions": [ { "type": { - "inverted": false, "value": "ChangeScale" }, "parameters": [ "Boat", "=", "2 + cos(TimeFromStart() * 360 / 2000)" - ], - "subInstructions": [] + ] } - ], - "events": [] + ] } ], "parameters": [] @@ -426,33 +455,26 @@ "colorG": 176, "colorR": 74, "creationTime": 0, - "disabled": false, - "folded": false, "name": "Add a crew member", "source": "", "type": "BuiltinCommonInstructions::Group", "events": [ { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "inverted": false, "value": "MouseButtonReleased" }, "parameters": [ "", "Left" - ], - "subInstructions": [] + ] } ], "actions": [ { "type": { - "inverted": false, "value": "Create" }, "parameters": [ @@ -461,26 +483,21 @@ "MouseX(\"\", 0) - 10", "MouseY(\"\", 0) - 15", "\"\"" - ], - "subInstructions": [] + ] }, { "type": { - "inverted": false, "value": "ChangePlan" }, "parameters": [ "CrewMember", "=", "0" - ], - "subInstructions": [] + ] } ], "events": [ { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Comment", "color": { "b": 109, @@ -490,17 +507,13 @@ "textG": 0, "textR": 0 }, - "comment": "As the crew member is \"stuck\" on the boat, it will follow the boat as if it were on it.\nThe new crew member is scaled to fit the current scale of the boat otherwise they will be of different sizes.", - "comment2": "" + "comment": "As the crew member is \"stuck\" on the boat, it will follow the boat as if it were on it.\nThe new crew member is scaled to fit the current scale of the boat otherwise they will be of different sizes." }, { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "inverted": false, "value": "CollisionNP" }, "parameters": [ @@ -509,14 +522,12 @@ "", "", "" - ], - "subInstructions": [] + ] } ], "actions": [ { "type": { - "inverted": false, "value": "Sticker::Sticker::Stick" }, "parameters": [ @@ -524,35 +535,29 @@ "Sticker", "Boat", "" - ], - "subInstructions": [] + ] }, { "type": { - "inverted": false, "value": "ChangePlan" }, "parameters": [ "CrewMember", "=", "2" - ], - "subInstructions": [] + ] }, { "type": { - "inverted": false, "value": "ChangeScale" }, "parameters": [ "CrewMember", "=", "Boat.ScaleX() / 2" - ], - "subInstructions": [] + ] } - ], - "events": [] + ] } ] } @@ -560,162 +565,163 @@ "parameters": [] }, { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "inverted": false, "value": "KeyReleased" }, "parameters": [ "", "Space" - ], - "subInstructions": [] + ] } ], "actions": [ { "type": { - "inverted": false, "value": "Scene" }, "parameters": [ "", "\"Vine\"", "" - ], - "subInstructions": [] + ] } - ], - "events": [] + ] }, { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "inverted": false, "value": "KeyReleased" }, "parameters": [ "", "Back" - ], - "subInstructions": [] + ] }, { "type": { - "inverted": false, "value": "AjoutHasard" }, "parameters": [ "", "CrewMember" - ], - "subInstructions": [] + ] } ], "actions": [ { "type": { - "inverted": false, "value": "Delete" }, "parameters": [ "CrewMember", "\"208;2;27\"" - ], - "subInstructions": [] + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "KeyReleased" + }, + "parameters": [ + "", + "Delete" + ] + }, + { + "type": { + "value": "AjoutHasard" + }, + "parameters": [ + "", + "Boat" + ] } ], - "events": [] + "actions": [ + { + "type": { + "value": "Delete" + }, + "parameters": [ + "Boat", + "\"208;2;27\"" + ] + } + ] }, { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "inverted": false, "value": "KeyReleased" }, "parameters": [ "", "Return" - ], - "subInstructions": [] + ] } ], "actions": [ { "type": { - "inverted": false, "value": "ChangeColor" }, "parameters": [ "CrewMember", "\"255;255;255\"" - ], - "subInstructions": [] + ] }, { "type": { - "inverted": false, "value": "ChangeColor" }, "parameters": [ "Boat", "\"255;255;255\"" - ], - "subInstructions": [] + ] } ], "events": [ { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "inverted": false, "value": "AjoutHasard" }, "parameters": [ "", "CrewMember" - ], - "subInstructions": [] + ] } ], "actions": [ { "type": { - "inverted": false, "value": "ChangeColor" }, "parameters": [ "CrewMember", "\"208;2;27\"" - ], - "subInstructions": [] + ] } ], "events": [ { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "inverted": false, "value": "Sticker::IsStuck" }, "parameters": [ @@ -724,24 +730,20 @@ "Sticker", "Boat", "" - ], - "subInstructions": [] + ] } ], "actions": [ { "type": { - "inverted": false, "value": "ChangeColor" }, "parameters": [ "Boat", "\"208;2;27\"" - ], - "subInstructions": [] + ] } - ], - "events": [] + ] } ] } @@ -753,9 +755,15 @@ "ambientLightColorB": 32, "ambientLightColorG": 0, "ambientLightColorR": 0, + "camera3DFarPlaneDistance": 10000, + "camera3DFieldOfView": 45, + "camera3DNearPlaneDistance": 0.1, + "cameraType": "perspective", "followBaseLayerCamera": false, "isLightingLayer": false, + "isLocked": false, "name": "", + "renderingType": "", "visibility": true, "cameras": [ { @@ -773,6 +781,30 @@ } ], "behaviorsSharedData": [ + { + "name": "Animation", + "type": "AnimatableCapability::AnimatableBehavior" + }, + { + "name": "Effect", + "type": "EffectCapability::EffectBehavior" + }, + { + "name": "Flippable", + "type": "FlippableCapability::FlippableBehavior" + }, + { + "name": "Opacity", + "type": "OpacityCapability::OpacityBehavior" + }, + { + "name": "Resizable", + "type": "ResizableCapability::ResizableBehavior" + }, + { + "name": "Scale", + "type": "ScalableCapability::ScalableBehavior" + }, { "name": "SineMovement", "type": "SineMovement::SineMovement" @@ -780,6 +812,10 @@ { "name": "Sticker", "type": "Sticker::Sticker" + }, + { + "name": "Text", + "type": "TextContainerCapability::TextContainerBehavior" } ] }, @@ -788,9 +824,6 @@ "disableInputWhenNotFocused": true, "mangledName": "Vine", "name": "Vine", - "oglFOV": 90, - "oglZFar": 500, - "oglZNear": 1, "r": 77, "standardSortMethod": true, "stopSoundsOnStartup": true, @@ -817,7 +850,6 @@ "customSize": false, "height": 0, "layer": "", - "locked": false, "name": "Direction", "persistentUuid": "46954fd1-10d6-4da5-914f-db012ca645e8", "width": 0, @@ -831,8 +863,9 @@ ], "objects": [ { + "adaptCollisionMaskAutomatically": false, + "assetStoreId": "", "name": "DarkBush", - "tags": "", "type": "Sprite", "updateIfNotVisible": false, "variables": [], @@ -876,8 +909,9 @@ ] }, { + "adaptCollisionMaskAutomatically": false, + "assetStoreId": "", "name": "LightBush", - "tags": "", "type": "Sprite", "updateIfNotVisible": false, "variables": [], @@ -921,11 +955,11 @@ ] }, { + "assetStoreId": "", "bold": false, "italic": false, "name": "Direction", "smoothed": true, - "tags": "", "type": "TextObject::Text", "underlined": false, "variables": [], @@ -933,125 +967,139 @@ "behaviors": [], "string": "Press Space to switch case", "font": "", + "textAlignment": "", "characterSize": 20, "color": { "b": 0, "g": 0, "r": 0 + }, + "content": { + "bold": false, + "isOutlineEnabled": false, + "isShadowEnabled": false, + "italic": false, + "outlineColor": "255;255;255", + "outlineThickness": 2, + "shadowAngle": 90, + "shadowBlurRadius": 2, + "shadowColor": "0;0;0", + "shadowDistance": 4, + "shadowOpacity": 127, + "smoothed": true, + "underlined": false, + "text": "Press Space to switch case", + "font": "", + "textAlignment": "", + "verticalTextAlignment": "top", + "characterSize": 20, + "color": "0;0;0" } } ], + "objectsFolderStructure": { + "folderName": "__ROOT", + "children": [ + { + "objectName": "DarkBush" + }, + { + "objectName": "LightBush" + }, + { + "objectName": "Direction" + } + ] + }, "events": [ { "colorB": 228, "colorG": 176, "colorR": 74, "creationTime": 0, - "disabled": false, - "folded": false, "name": "Create vines", "source": "", "type": "BuiltinCommonInstructions::Group", "events": [ { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "inverted": false, "value": "DepartScene" }, "parameters": [ "" - ], - "subInstructions": [] + ] } ], "actions": [ { "type": { - "inverted": false, "value": "ModVarScene" }, "parameters": [ "deltaX", "=", "200" - ], - "subInstructions": [] + ] }, { "type": { - "inverted": false, "value": "ModVarScene" }, "parameters": [ "deltaY", "=", "53" - ], - "subInstructions": [] + ] }, { "type": { - "inverted": false, "value": "ModVarScene" }, "parameters": [ "lastX", "=", "-50" - ], - "subInstructions": [] + ] } ], "events": [ { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Repeat", "repeatExpression": "3", "conditions": [], "actions": [ { "type": { - "inverted": false, "value": "ModVarScene" }, "parameters": [ "lastY", "=", "0" - ], - "subInstructions": [] + ] }, { "type": { - "inverted": false, "value": "ModVarScene" }, "parameters": [ "lastX", "+", "Variable(deltaX)" - ], - "subInstructions": [] + ] } ], "events": [ { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Repeat", "repeatExpression": "5", "conditions": [], "actions": [], "events": [ { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Comment", "color": { "b": 109, @@ -1061,18 +1109,14 @@ "textG": 0, "textR": 0 }, - "comment": "It's not possible to select 2 objects of the same kind.\nSo, there is an alternance between LighBrush and DarkBrush.", - "comment2": "" + "comment": "It's not possible to select 2 objects of the same kind.\nSo, there is an alternance between LighBrush and DarkBrush." }, { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Standard", "conditions": [], "actions": [ { "type": { - "inverted": false, "value": "Create" }, "parameters": [ @@ -1081,26 +1125,21 @@ "Variable(lastX)", "Variable(lastY)", "" - ], - "subInstructions": [] + ] }, { "type": { - "inverted": false, "value": "ModVarScene" }, "parameters": [ "lastY", "+", "Variable(deltaY)" - ], - "subInstructions": [] + ] } ], "events": [ { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Comment", "color": { "b": 109, @@ -1110,17 +1149,13 @@ "textG": 0, "textR": 0 }, - "comment": "The deltaX variable is set to more than half the height so the new brush only touches the previous one.", - "comment2": "" + "comment": "The deltaX variable is set to more than half the height so the new brush only touches the previous one." }, { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "inverted": false, "value": "CollisionNP" }, "parameters": [ @@ -1129,14 +1164,12 @@ "", "", "" - ], - "subInstructions": [] + ] } ], "actions": [ { "type": { - "inverted": false, "value": "Sticker::Sticker::Stick" }, "parameters": [ @@ -1144,23 +1177,18 @@ "Sticker", "DarkBush", "" - ], - "subInstructions": [] + ] } - ], - "events": [] + ] } ] }, { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Standard", "conditions": [], "actions": [ { "type": { - "inverted": false, "value": "Create" }, "parameters": [ @@ -1169,31 +1197,25 @@ "Variable(lastX)", "Variable(lastY)", "" - ], - "subInstructions": [] + ] }, { "type": { - "inverted": false, "value": "ModVarScene" }, "parameters": [ "lastY", "+", "Variable(deltaY)" - ], - "subInstructions": [] + ] } ], "events": [ { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "inverted": false, "value": "CollisionNP" }, "parameters": [ @@ -1202,14 +1224,12 @@ "", "", "" - ], - "subInstructions": [] + ] } ], "actions": [ { "type": { - "inverted": false, "value": "Sticker::Sticker::Stick" }, "parameters": [ @@ -1217,11 +1237,9 @@ "Sticker", "LightBush", "" - ], - "subInstructions": [] + ] } - ], - "events": [] + ] } ] } @@ -1239,15 +1257,11 @@ "colorG": 176, "colorR": 74, "creationTime": 0, - "disabled": false, - "folded": false, "name": "Move the vines", "source": "", "type": "BuiltinCommonInstructions::Group", "events": [ { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Comment", "color": { "b": 109, @@ -1257,92 +1271,73 @@ "textG": 0, "textR": 0 }, - "comment": "The stickers can move on their own while following their parent.\n\nThe formula uses trigonometry to have a cycle of acceleration and deceleration.\nIt is the integral of cos(t) from last frame to current frame.\nThe integral ensures that the loop doesn't add more than it subtracts.", - "comment2": "" + "comment": "The stickers can move on their own while following their parent.\n\nThe formula uses trigonometry to have a cycle of acceleration and deceleration.\nIt is the integral of cos(t) from last frame to current frame.\nThe integral ensures that the loop doesn't add more than it subtracts." }, { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Standard", "conditions": [], "actions": [ { "type": { - "inverted": false, "value": "SetAngle" }, "parameters": [ "LightBush", "+", "4 * (sin(TimeFromStart()) - sin(TimeFromStart() - TimeDelta()))" - ], - "subInstructions": [] + ] }, { "type": { - "inverted": false, "value": "SetAngle" }, "parameters": [ "DarkBush", "+", "4 * (sin(TimeFromStart()) - sin(TimeFromStart() - TimeDelta()))" - ], - "subInstructions": [] + ] } - ], - "events": [] + ] } ], "parameters": [] }, { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "inverted": false, "value": "KeyReleased" }, "parameters": [ "", "Space" - ], - "subInstructions": [] + ] } ], "actions": [ { "type": { - "inverted": false, "value": "Scene" }, "parameters": [ "", "\"Boat\"", "" - ], - "subInstructions": [] + ] } - ], - "events": [] + ] }, { "colorB": 228, "colorG": 176, "colorR": 74, "creationTime": 0, - "disabled": false, - "folded": false, "name": "Tests", "source": "", "type": "BuiltinCommonInstructions::Group", "events": [ { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Comment", "color": { "b": 109, @@ -1352,17 +1347,14 @@ "textG": 0, "textR": 0 }, - "comment": "Test that the condition is working.", - "comment2": "" + "comment": "Test that the condition is working." }, { "disabled": true, - "folded": false, "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "inverted": false, "value": "Sticker::Sticker::IsStuck" }, "parameters": [ @@ -1370,28 +1362,22 @@ "Sticker", "DarkBush", "" - ], - "subInstructions": [] + ] } ], "actions": [ { "type": { - "inverted": false, "value": "ChangeColor" }, "parameters": [ "LightBush", "\"255;0;0\"" - ], - "subInstructions": [] + ] } - ], - "events": [] + ] }, { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Comment", "color": { "b": 109, @@ -1401,52 +1387,43 @@ "textG": 0, "textR": 0 }, - "comment": "Test that deleting on object where another object is stuck doesn't crash.", - "comment2": "" + "comment": "Test that deleting on object where another object is stuck doesn't crash." }, { "disabled": true, - "folded": false, "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "inverted": false, "value": "MouseButtonReleased" }, "parameters": [ "", "Left" - ], - "subInstructions": [] + ] }, { "type": { - "inverted": false, "value": "CollisionPoint" }, "parameters": [ "DarkBush", "MouseX(\"\", 0)", "MouseY(\"\", 0)" - ], - "subInstructions": [] + ] } ], "actions": [ { "type": { - "inverted": false, "value": "Delete" }, "parameters": [ "DarkBush", "" - ], - "subInstructions": [] + ] } - ], - "events": [] + ] } ], "parameters": [] @@ -1457,9 +1434,15 @@ "ambientLightColorB": 2, "ambientLightColorG": 134217728, "ambientLightColorR": 1597132097, + "camera3DFarPlaneDistance": 10000, + "camera3DFieldOfView": 45, + "camera3DNearPlaneDistance": 0.1, + "cameraType": "perspective", "followBaseLayerCamera": false, "isLightingLayer": false, + "isLocked": false, "name": "", + "renderingType": "", "visibility": true, "cameras": [ { @@ -1477,9 +1460,37 @@ } ], "behaviorsSharedData": [ + { + "name": "Animation", + "type": "AnimatableCapability::AnimatableBehavior" + }, + { + "name": "Effect", + "type": "EffectCapability::EffectBehavior" + }, + { + "name": "Flippable", + "type": "FlippableCapability::FlippableBehavior" + }, + { + "name": "Opacity", + "type": "OpacityCapability::OpacityBehavior" + }, + { + "name": "Resizable", + "type": "ResizableCapability::ResizableBehavior" + }, + { + "name": "Scale", + "type": "ScalableCapability::ScalableBehavior" + }, { "name": "Sticker", "type": "Sticker::Sticker" + }, + { + "name": "Text", + "type": "TextContainerCapability::TextContainerBehavior" } ] } @@ -1488,15 +1499,39 @@ "eventsFunctionsExtensions": [ { "author": "@4ian, Tristan Rhodes (https://victrisgames.itch.io/)", - "description": "Allow an object to move smoothly on the X and/or Y axis following a sine wave, or an ellipsis.\n\n\nExample uses:\n- Floating objects, such as powerups or coins\n- Moveable platforms\n- Enemy movement patterns\n\nProperties:\n- Horizontal distance\n- Vertical distance\n- Horizontal speed\n- Vertical speed\n- Center of movement, X position\n- Center of movement, Y position\n\nTips:\n- For circular or elliptical movement, the horizontal and vertical speed need to be the same\n- For horizontal movement only, set vertical distance to 0\n- For vertical movement only, set horizontal distance to 0\n- For figure-8 movement, set horizontal speed to 1/2 of the vertical speed", + "category": "", "extensionNamespace": "", "fullName": "Sine (or ellipsis) Movement", + "gdevelopVersion": "", "helpPath": "https://victrisgames.itch.io/extension-sinemovement-and-deptheffect", "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0ibWRpLXNpbmUtd2F2ZSIgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0IiB2aWV3Qm94PSIwIDAgMjQgMjQiPjxwYXRoIGQ9Ik0xNi41LDIxQzEzLjUsMjEgMTIuMzEsMTYuNzYgMTEuMDUsMTIuMjhDMTAuMTQsOS4wNCA5LDUgNy41LDVDNC4xMSw1IDQsMTEuOTMgNCwxMkgyQzIsMTEuNjMgMi4wNiwzIDcuNSwzQzEwLjUsMyAxMS43MSw3LjI1IDEyLjk3LDExLjc0QzEzLjgzLDE0LjggMTUsMTkgMTYuNSwxOUMxOS45NCwxOSAyMC4wMywxMi4wNyAyMC4wMywxMkgyMi4wM0MyMi4wMywxMi4zNyAyMS45NywyMSAxNi41LDIxWiIgLz48L3N2Zz4=", "name": "SineMovement", "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/sine-wave.svg", "shortDescription": "Allow an object to move smoothly on the X and/or Y axis following a sine wave, or an ellipsis.", "version": "0.0.5", + "description": [ + "Allow an object to move smoothly on the X and/or Y axis following a sine wave, or an ellipsis.", + "", + "", + "Example uses:", + "- Floating objects, such as powerups or coins", + "- Moveable platforms", + "- Enemy movement patterns", + "", + "Properties:", + "- Horizontal distance", + "- Vertical distance", + "- Horizontal speed", + "- Vertical speed", + "- Center of movement, X position", + "- Center of movement, Y position", + "", + "Tips:", + "- For circular or elliptical movement, the horizontal and vertical speed need to be the same", + "- For horizontal movement only, set vertical distance to 0", + "- For vertical movement only, set horizontal distance to 0", + "- For figure-8 movement, set horizontal speed to 1/2 of the vertical speed" + ], "tags": [ "sine", "ellipsis", @@ -1509,6 +1544,8 @@ ], "authorIds": [], "dependencies": [], + "globalVariables": [], + "sceneVariables": [], "eventsFunctions": [], "eventsBasedBehaviors": [ { @@ -1518,16 +1555,12 @@ "objectType": "", "eventsFunctions": [ { - "description": "", "fullName": "", "functionType": "Action", "name": "doStepPreEvents", - "private": false, "sentence": "", "events": [ { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Comment", "color": { "b": 109, @@ -1537,17 +1570,13 @@ "textG": 0, "textR": 0 }, - "comment": "Set the center of movement to the initial location of the object", - "comment2": "" + "comment": "Set the center of movement to the initial location of the object" }, { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "inverted": false, "value": "SineMovement::SineMovement::PropertyCenterPointX" }, "parameters": [ @@ -1555,12 +1584,10 @@ "Behavior", "=", "0" - ], - "subInstructions": [] + ] }, { "type": { - "inverted": false, "value": "SineMovement::SineMovement::PropertyCenterPointY" }, "parameters": [ @@ -1568,14 +1595,12 @@ "Behavior", "=", "0" - ], - "subInstructions": [] + ] } ], "actions": [ { "type": { - "inverted": false, "value": "SineMovement::SineMovement::SetPropertyCenterPointX" }, "parameters": [ @@ -1583,12 +1608,10 @@ "Behavior", "=", "Object.X()" - ], - "subInstructions": [] + ] }, { "type": { - "inverted": false, "value": "SineMovement::SineMovement::SetPropertyCenterPointY" }, "parameters": [ @@ -1596,15 +1619,11 @@ "Behavior", "=", "Object.Y()" - ], - "subInstructions": [] + ] } - ], - "events": [] + ] }, { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Comment", "color": { "b": 109, @@ -1614,17 +1633,13 @@ "textG": 0, "textR": 0 }, - "comment": "Move the object", - "comment2": "" + "comment": "Move the object" }, { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "inverted": false, "value": "SineMovement::SineMovement::PropertyHorizontalDistance" }, "parameters": [ @@ -1632,34 +1647,27 @@ "Behavior", "!=", "0" - ], - "subInstructions": [] + ] } ], "actions": [ { "type": { - "inverted": false, "value": "MettreX" }, "parameters": [ "Object", "=", "Object.Behavior::PropertyCenterPointX() + cos(ToRad(Object.Behavior::PropertySineProgressX())) * Object.Behavior::PropertyHorizontalDistance()" - ], - "subInstructions": [] + ] } - ], - "events": [] + ] }, { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "inverted": false, "value": "SineMovement::SineMovement::PropertyVerticalDistance" }, "parameters": [ @@ -1667,29 +1675,23 @@ "Behavior", "!=", "0" - ], - "subInstructions": [] + ] } ], "actions": [ { "type": { - "inverted": false, "value": "MettreY" }, "parameters": [ "Object", "=", "Object.Behavior::PropertyCenterPointY() + sin(ToRad(Object.Behavior::PropertySineProgressY())) * Object.Behavior::PropertyVerticalDistance()" - ], - "subInstructions": [] + ] } - ], - "events": [] + ] }, { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Comment", "color": { "b": 109, @@ -1699,18 +1701,14 @@ "textG": 0, "textR": 0 }, - "comment": "Increment counters that are used to calculate movement", - "comment2": "" + "comment": "Increment counters that are used to calculate movement" }, { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Standard", "conditions": [], "actions": [ { "type": { - "inverted": false, "value": "SineMovement::SineMovement::SetPropertySineProgressX" }, "parameters": [ @@ -1718,21 +1716,16 @@ "Behavior", "+", "Object.Behavior::PropertyHorizontalSpeed() * TimeDelta()" - ], - "subInstructions": [] + ] } - ], - "events": [] + ] }, { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Standard", "conditions": [], "actions": [ { "type": { - "inverted": false, "value": "SineMovement::SineMovement::SetPropertySineProgressY" }, "parameters": [ @@ -1740,31 +1733,20 @@ "Behavior", "+", "Object.Behavior::PropertyVerticalSpeed() * TimeDelta()" - ], - "subInstructions": [] + ] } - ], - "events": [] + ] } ], "parameters": [ { - "codeOnly": false, - "defaultValue": "", "description": "Object", - "longDescription": "", "name": "Object", - "optional": false, - "supplementaryInformation": "", "type": "object" }, { - "codeOnly": false, - "defaultValue": "", "description": "Behavior", - "longDescription": "", "name": "Behavior", - "optional": false, "supplementaryInformation": "SineMovement::SineMovement", "type": "behavior" } @@ -1776,47 +1758,35 @@ "fullName": "Sine progress Y", "functionType": "Expression", "name": "SineProgressY", - "private": false, "sentence": "Set initial Y of _PARAM0_ to _PARAM2_", "events": [ { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Standard", "conditions": [], "actions": [ { "type": { - "inverted": false, "value": "SetReturnNumber" }, "parameters": [ "Object.Behavior::PropertySineProgressY()" - ], - "subInstructions": [] + ] } - ], - "events": [] + ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { - "codeOnly": false, - "defaultValue": "", "description": "Object", - "longDescription": "", "name": "Object", - "optional": false, - "supplementaryInformation": "", "type": "object" }, { - "codeOnly": false, - "defaultValue": "", "description": "Behavior", - "longDescription": "", "name": "Behavior", - "optional": false, "supplementaryInformation": "SineMovement::SineMovement", "type": "behavior" } @@ -1828,47 +1798,35 @@ "fullName": "Sine progress X", "functionType": "Expression", "name": "SineProgressX", - "private": false, "sentence": "Set initial Y of _PARAM0_ to _PARAM2_", "events": [ { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Standard", "conditions": [], "actions": [ { "type": { - "inverted": false, "value": "SetReturnNumber" }, "parameters": [ "Object.Behavior::PropertySineProgressX()" - ], - "subInstructions": [] + ] } - ], - "events": [] + ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { - "codeOnly": false, - "defaultValue": "", "description": "Object", - "longDescription": "", "name": "Object", - "optional": false, - "supplementaryInformation": "", "type": "object" }, { - "codeOnly": false, - "defaultValue": "", "description": "Behavior", - "longDescription": "", "name": "Behavior", - "optional": false, "supplementaryInformation": "SineMovement::SineMovement", "type": "behavior" } @@ -1880,47 +1838,35 @@ "fullName": "Horizontal speed ", "functionType": "Expression", "name": "HorizontalSpeed", - "private": false, "sentence": "Set initial Y of _PARAM0_ to _PARAM2_", "events": [ { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Standard", "conditions": [], "actions": [ { "type": { - "inverted": false, "value": "SetReturnNumber" }, "parameters": [ "Object.Behavior::PropertyHorizontalSpeed()" - ], - "subInstructions": [] + ] } - ], - "events": [] + ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { - "codeOnly": false, - "defaultValue": "", "description": "Object", - "longDescription": "", "name": "Object", - "optional": false, - "supplementaryInformation": "", "type": "object" }, { - "codeOnly": false, - "defaultValue": "", "description": "Behavior", - "longDescription": "", "name": "Behavior", - "optional": false, "supplementaryInformation": "SineMovement::SineMovement", "type": "behavior" } @@ -1932,47 +1878,35 @@ "fullName": "Vertical speed", "functionType": "Expression", "name": "VerticalSpeed", - "private": false, "sentence": "Set initial Y of _PARAM0_ to _PARAM2_", "events": [ { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Standard", "conditions": [], "actions": [ { "type": { - "inverted": false, "value": "SetReturnNumber" }, "parameters": [ "Object.Behavior::PropertyVerticalSpeed()" - ], - "subInstructions": [] + ] } - ], - "events": [] + ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { - "codeOnly": false, - "defaultValue": "", "description": "Object", - "longDescription": "", "name": "Object", - "optional": false, - "supplementaryInformation": "", "type": "object" }, { - "codeOnly": false, - "defaultValue": "", "description": "Behavior", - "longDescription": "", "name": "Behavior", - "optional": false, "supplementaryInformation": "SineMovement::SineMovement", "type": "behavior" } @@ -1984,47 +1918,35 @@ "fullName": "Horizontal distance", "functionType": "Expression", "name": "HorizontalDistance", - "private": false, "sentence": "Set initial Y of _PARAM0_ to _PARAM2_", "events": [ { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Standard", "conditions": [], "actions": [ { "type": { - "inverted": false, "value": "SetReturnNumber" }, "parameters": [ "Object.Behavior::PropertyHorizontalDistance()" - ], - "subInstructions": [] + ] } - ], - "events": [] + ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { - "codeOnly": false, - "defaultValue": "", "description": "Object", - "longDescription": "", "name": "Object", - "optional": false, - "supplementaryInformation": "", "type": "object" }, { - "codeOnly": false, - "defaultValue": "", "description": "Behavior", - "longDescription": "", "name": "Behavior", - "optional": false, "supplementaryInformation": "SineMovement::SineMovement", "type": "behavior" } @@ -2036,47 +1958,35 @@ "fullName": "Vertical distance", "functionType": "Expression", "name": "VerticalDistance", - "private": false, "sentence": "Set initial Y of _PARAM0_ to _PARAM2_", "events": [ { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Standard", "conditions": [], "actions": [ { "type": { - "inverted": false, "value": "SetReturnNumber" }, "parameters": [ "Object.Behavior::PropertyVerticalDistance()" - ], - "subInstructions": [] + ] } - ], - "events": [] + ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { - "codeOnly": false, - "defaultValue": "", "description": "Object", - "longDescription": "", "name": "Object", - "optional": false, - "supplementaryInformation": "", "type": "object" }, { - "codeOnly": false, - "defaultValue": "", "description": "Behavior", - "longDescription": "", "name": "Behavior", - "optional": false, "supplementaryInformation": "SineMovement::SineMovement", "type": "behavior" } @@ -2088,47 +1998,35 @@ "fullName": "Center of movement, X position", "functionType": "Expression", "name": "CenterX", - "private": false, "sentence": "Set initial Y of _PARAM0_ to _PARAM2_", "events": [ { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Standard", "conditions": [], "actions": [ { "type": { - "inverted": false, "value": "SetReturnNumber" }, "parameters": [ "Object.Behavior::PropertyCenterPointX()" - ], - "subInstructions": [] + ] } - ], - "events": [] + ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { - "codeOnly": false, - "defaultValue": "", "description": "Object", - "longDescription": "", "name": "Object", - "optional": false, - "supplementaryInformation": "", "type": "object" }, { - "codeOnly": false, - "defaultValue": "", "description": "Behavior", - "longDescription": "", "name": "Behavior", - "optional": false, "supplementaryInformation": "SineMovement::SineMovement", "type": "behavior" } @@ -2140,47 +2038,35 @@ "fullName": "Center of movement, Y position", "functionType": "Expression", "name": "CenterY", - "private": false, "sentence": "Set initial Y of _PARAM0_ to _PARAM2_", "events": [ { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Standard", "conditions": [], "actions": [ { "type": { - "inverted": false, "value": "SetReturnNumber" }, "parameters": [ "Object.Behavior::PropertyCenterPointY()" - ], - "subInstructions": [] + ] } - ], - "events": [] + ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { - "codeOnly": false, - "defaultValue": "", "description": "Object", - "longDescription": "", "name": "Object", - "optional": false, - "supplementaryInformation": "", "type": "object" }, { - "codeOnly": false, - "defaultValue": "", "description": "Behavior", - "longDescription": "", "name": "Behavior", - "optional": false, "supplementaryInformation": "SineMovement::SineMovement", "type": "behavior" } @@ -2192,18 +2078,14 @@ "fullName": "Set center Y position", "functionType": "Action", "name": "SetCenterY", - "private": false, "sentence": "Set center Y position of _PARAM0_ to _PARAM2_", "events": [ { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Standard", "conditions": [], "actions": [ { "type": { - "inverted": false, "value": "SineMovement::SineMovement::SetPropertyCenterPointY" }, "parameters": [ @@ -2211,42 +2093,26 @@ "Behavior", "=", "GetArgumentAsNumber(\"Value\")" - ], - "subInstructions": [] + ] } - ], - "events": [] + ] } ], "parameters": [ { - "codeOnly": false, - "defaultValue": "", "description": "Object", - "longDescription": "", "name": "Object", - "optional": false, - "supplementaryInformation": "", "type": "object" }, { - "codeOnly": false, - "defaultValue": "", "description": "Behavior", - "longDescription": "", "name": "Behavior", - "optional": false, "supplementaryInformation": "SineMovement::SineMovement", "type": "behavior" }, { - "codeOnly": false, - "defaultValue": "", "description": "Y position", - "longDescription": "", "name": "Value", - "optional": false, - "supplementaryInformation": "", "type": "expression" } ], @@ -2257,18 +2123,14 @@ "fullName": "Set center X position", "functionType": "Action", "name": "SetCenterX", - "private": false, "sentence": "Set center X position of _PARAM0_ to _PARAM2_", "events": [ { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Standard", "conditions": [], "actions": [ { "type": { - "inverted": false, "value": "SineMovement::SineMovement::SetPropertyCenterPointX" }, "parameters": [ @@ -2276,42 +2138,26 @@ "Behavior", "=", "GetArgumentAsNumber(\"Value\")" - ], - "subInstructions": [] + ] } - ], - "events": [] + ] } ], "parameters": [ { - "codeOnly": false, - "defaultValue": "", "description": "Object", - "longDescription": "", "name": "Object", - "optional": false, - "supplementaryInformation": "", "type": "object" }, { - "codeOnly": false, - "defaultValue": "", "description": "Behavior", - "longDescription": "", "name": "Behavior", - "optional": false, "supplementaryInformation": "SineMovement::SineMovement", "type": "behavior" }, { - "codeOnly": false, - "defaultValue": "", "description": "X position", - "longDescription": "", "name": "Value", - "optional": false, - "supplementaryInformation": "", "type": "expression" } ], @@ -2322,18 +2168,14 @@ "fullName": "Set horizontal distance", "functionType": "Action", "name": "SetHorizontalDistance", - "private": false, "sentence": "Set horizontal distance of _PARAM0_ to _PARAM2_", "events": [ { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Standard", "conditions": [], "actions": [ { "type": { - "inverted": false, "value": "SineMovement::SineMovement::SetPropertyHorizontalDistance" }, "parameters": [ @@ -2341,42 +2183,26 @@ "Behavior", "=", "GetArgumentAsNumber(\"Value\")" - ], - "subInstructions": [] + ] } - ], - "events": [] + ] } ], "parameters": [ { - "codeOnly": false, - "defaultValue": "", "description": "Object", - "longDescription": "", "name": "Object", - "optional": false, - "supplementaryInformation": "", "type": "object" }, { - "codeOnly": false, - "defaultValue": "", "description": "Behavior", - "longDescription": "", "name": "Behavior", - "optional": false, "supplementaryInformation": "SineMovement::SineMovement", "type": "behavior" }, { - "codeOnly": false, - "defaultValue": "", "description": "Distance", - "longDescription": "", "name": "Value", - "optional": false, - "supplementaryInformation": "", "type": "expression" } ], @@ -2387,18 +2213,14 @@ "fullName": "Set vertical distance", "functionType": "Action", "name": "SetVerticalDistance", - "private": false, "sentence": "Set vertical distance of _PARAM0_ to _PARAM2_", "events": [ { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Standard", "conditions": [], "actions": [ { "type": { - "inverted": false, "value": "SineMovement::SineMovement::SetPropertyVerticalDistance" }, "parameters": [ @@ -2406,42 +2228,26 @@ "Behavior", "=", "GetArgumentAsNumber(\"Value\")" - ], - "subInstructions": [] + ] } - ], - "events": [] + ] } ], "parameters": [ { - "codeOnly": false, - "defaultValue": "", "description": "Object", - "longDescription": "", "name": "Object", - "optional": false, - "supplementaryInformation": "", "type": "object" }, { - "codeOnly": false, - "defaultValue": "", "description": "Behavior", - "longDescription": "", "name": "Behavior", - "optional": false, "supplementaryInformation": "SineMovement::SineMovement", "type": "behavior" }, { - "codeOnly": false, - "defaultValue": "", "description": "Distance", - "longDescription": "", "name": "Value", - "optional": false, - "supplementaryInformation": "", "type": "expression" } ], @@ -2452,18 +2258,14 @@ "fullName": "Set horizontal speed", "functionType": "Action", "name": "SetHorizontalSpeed", - "private": false, "sentence": "Set horizontal speed of _PARAM0_ to _PARAM2_", "events": [ { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Standard", "conditions": [], "actions": [ { "type": { - "inverted": false, "value": "SineMovement::SineMovement::SetPropertyHorizontalSpeed" }, "parameters": [ @@ -2471,42 +2273,26 @@ "Behavior", "=", "GetArgumentAsNumber(\"Value\")" - ], - "subInstructions": [] + ] } - ], - "events": [] + ] } ], "parameters": [ { - "codeOnly": false, - "defaultValue": "", "description": "Object", - "longDescription": "", "name": "Object", - "optional": false, - "supplementaryInformation": "", "type": "object" }, { - "codeOnly": false, - "defaultValue": "", "description": "Behavior", - "longDescription": "", "name": "Behavior", - "optional": false, "supplementaryInformation": "SineMovement::SineMovement", "type": "behavior" }, { - "codeOnly": false, - "defaultValue": "", "description": "Speed (in degrees per second)", - "longDescription": "", "name": "Value", - "optional": false, - "supplementaryInformation": "", "type": "expression" } ], @@ -2517,18 +2303,14 @@ "fullName": "Set vertical speed", "functionType": "Action", "name": "SetVerticalSpeed", - "private": false, "sentence": "Set vertical speed of _PARAM0_ to _PARAM2_", "events": [ { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Standard", "conditions": [], "actions": [ { "type": { - "inverted": false, "value": "SineMovement::SineMovement::SetPropertyVerticalSpeed" }, "parameters": [ @@ -2536,42 +2318,26 @@ "Behavior", "=", "GetArgumentAsNumber(\"Value\")" - ], - "subInstructions": [] + ] } - ], - "events": [] + ] } ], "parameters": [ { - "codeOnly": false, - "defaultValue": "", "description": "Object", - "longDescription": "", "name": "Object", - "optional": false, - "supplementaryInformation": "", "type": "object" }, { - "codeOnly": false, - "defaultValue": "", "description": "Behavior", - "longDescription": "", "name": "Behavior", - "optional": false, "supplementaryInformation": "SineMovement::SineMovement", "type": "behavior" }, { - "codeOnly": false, - "defaultValue": "", "description": "Speed (in degrees per second)", - "longDescription": "", "name": "Value", - "optional": false, - "supplementaryInformation": "", "type": "expression" } ], @@ -2582,18 +2348,14 @@ "fullName": "Reset sine progress counters", "functionType": "Action", "name": "ResetSineCounters", - "private": false, "sentence": "Reset sine progress counters on _PARAM0_", "events": [ { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Standard", "conditions": [], "actions": [ { "type": { - "inverted": false, "value": "SineMovement::SineMovement::SetPropertySineProgressX" }, "parameters": [ @@ -2601,12 +2363,10 @@ "Behavior", "=", "0" - ], - "subInstructions": [] + ] }, { "type": { - "inverted": false, "value": "SineMovement::SineMovement::SetPropertySineProgressY" }, "parameters": [ @@ -2614,31 +2374,20 @@ "Behavior", "=", "0" - ], - "subInstructions": [] + ] } - ], - "events": [] + ] } ], "parameters": [ { - "codeOnly": false, - "defaultValue": "", "description": "Object", - "longDescription": "", "name": "Object", - "optional": false, - "supplementaryInformation": "", "type": "object" }, { - "codeOnly": false, - "defaultValue": "", "description": "Behavior", - "longDescription": "", "name": "Behavior", - "optional": false, "supplementaryInformation": "SineMovement::SineMovement", "type": "behavior" } @@ -2651,62 +2400,42 @@ "value": "60", "type": "Number", "label": "Horizontal speed, in degrees per second", - "description": "", - "extraInformation": [], - "hidden": false, "name": "HorizontalSpeed" }, { "value": "60", "type": "Number", "label": "Vertical speed, in degrees per second", - "description": "", - "extraInformation": [], - "hidden": false, "name": "VerticalSpeed" }, { "value": "100", "type": "Number", "label": "Horizontal distance: amplitude of the movement on X axis (0 to deactivate)", - "description": "", - "extraInformation": [], - "hidden": false, "name": "HorizontalDistance" }, { "value": "0", "type": "Number", "label": "Vertical distance: amplitude of the movement on Y axis (0 to deactivate)", - "description": "", - "extraInformation": [], - "hidden": false, "name": "VerticalDistance" }, { "value": "0", "type": "Number", "label": "Center of movement, X position", - "description": "", - "extraInformation": [], - "hidden": false, "name": "CenterPointX" }, { "value": "0", "type": "Number", "label": "Center of movement, Y position", - "description": "", - "extraInformation": [], - "hidden": false, "name": "CenterPointY" }, { "value": "0", "type": "Number", "label": "Counter used to change X position", - "description": "", - "extraInformation": [], "hidden": true, "name": "SineProgressX" }, @@ -2714,51 +2443,357 @@ "value": "0", "type": "Number", "label": "Counter used to change Y position", - "description": "", - "extraInformation": [], "hidden": true, "name": "SineProgressY" } - ] + ], + "sharedPropertyDescriptors": [] } - ] + ], + "eventsBasedObjects": [] }, { "author": "D8H", - "description": "This extension can be useful for:\n* Stick an accessory to a moving object,\n* Animate a skeleton.", + "category": "Movement", "extensionNamespace": "", "fullName": "Stick objects to others", + "gdevelopVersion": ">=5.5.222", "helpPath": "", "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0ibWRpLXN0aWNrZXItb3V0bGluZSIgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0IiB2aWV3Qm94PSIwIDAgMjQgMjQiPjxwYXRoIGQ9Ik01LjUgMkMzLjYgMiAyIDMuNiAyIDUuNVYxOC41QzIgMjAuNCAzLjYgMjIgNS41IDIySDE2TDIyIDE2VjUuNUMyMiAzLjYgMjAuNCAyIDE4LjUgMkg1LjVNNS44IDRIMTguM0MxOS4zIDQgMjAuMSA0LjggMjAuMSA1LjhWMTVIMTguNkMxNi43IDE1IDE1LjEgMTYuNiAxNS4xIDE4LjVWMjBINS44QzQuOCAyMCA0IDE5LjIgNCAxOC4yVjUuOEM0IDQuOCA0LjggNCA1LjggNCIgLz48L3N2Zz4=", "name": "Sticker", "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/sticker-outline.svg", - "shortDescription": "Behavior to stick objects to other objects - so that they follow the position and rotation of the object they are stuck to.", - "version": "0.3.4", + "shortDescription": "Make objects follow the position and rotation of the object they are stuck to.", + "version": "0.5.4", + "description": [ + "This extension can be useful to:", + "- Stick accessories to moving objects", + "- Animate a skeleton", + "- Delete an object with another one", + "", + "An example allows to check it out ([open the project online](https://editor.gdevelop.io/?project=example://stick-objects))." + ], + "origin": { + "identifier": "Sticker", + "name": "gdevelop-extension-store" + }, "tags": [ "sticker", "stick", "follow", "skeleton", - "joint" + "joint", + "pin", + "bind", + "glue", + "tie", + "attach", + "hold", + "paste", + "wear" ], "authorIds": [ "IWykYNRvhCZBN3vEgKEbBPOR3Oc2" ], "dependencies": [], + "globalVariables": [], + "sceneVariables": [], "eventsFunctions": [ + { + "description": "Define helper classes JavaScript code.", + "fullName": "Define helper classes", + "functionType": "Action", + "name": "DefineHelperClasses", + "private": true, + "sentence": "Define helper classes JavaScript code", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "if (gdjs._stickerExtension) {", + " return;", + "}", + "", + "// Unstick from deleted objects.", + "gdjs.registerObjectDeletedFromSceneCallback(function (runtimeScene, deletedObject) {", + " const extension = runtimeScene._stickerExtension;", + " if (!extension) {", + " return;", + " }", + " /** @type {Set} */", + " const allStickers = runtimeScene._stickerExtension.allStickers;", + " for (const behavior of allStickers) {", + " /** @type {Sticker} */", + " const sticker = behavior._sticker;", + " if (sticker.isStuckTo(deletedObject)) {", + " if (behavior._getIsDestroyedWithParent()) {", + " behavior.owner.deleteFromScene(runtimeScene);", + " }", + " sticker.unstick();", + " }", + " }", + "});", + "", + "class Sticker {", + " /** @type {gdjs.RuntimeBehavior} */", + " behavior;", + " /** @type {gdjs.RuntimeObject | null} */", + " basisObject;", + " followingDoneThisFrame = false;", + " relativeX = 0;", + " relativeY = 0;", + " relativeAngle = 0;", + " relativeRotatedX = 0;", + " relativeRotatedY = 0;", + " basisOldX = 0;", + " basisOldY = 0;", + " basisOldAngle = 0;", + " basisOldWidth = 0;", + " basisOldHeight = 0;", + " basisOldCenterXInScene = 0;", + " basisOldCenterYInScene = 0;", + "", + " /**", + " * @param {gdjs.RuntimeBehavior} behavior", + " */", + " constructor(behavior) {", + " this.behavior = behavior;", + " }", + "", + " /**", + " * @param {gdjs.RuntimeObject} basisObject", + " */", + " isStuckTo(basisObject) {", + " return this.basisObject === basisObject;", + " }", + "", + " /**", + " * @param {gdjs.RuntimeObject} basisObject", + " */", + " stickTo(basisObject) {", + " this.basisObject = basisObject;", + " this.updateOldCoordinates();", + " this.updateRelativeCoordinates();", + " }", + "", + " unstick() {", + " this.basisObject = null;", + " }", + "", + " onStepPreEvents() {", + " this.followingDoneThisFrame = false;", + " }", + "", + " /**", + " * Update the coordinates in the basisObject basis.", + " * ", + " * It uses the basisObject coordinates from the previous frame.", + " * This way, the sticker can move relatively to it and still", + " * follow basisObject.", + " * ", + " * @param {gdjs.RuntimeObject} basisObject", + " */", + " updateRelativeCoordinates() {", + " const object = this.behavior.owner;", + "", + " // Update relative coordinates", + " this.relativeX = object.getX() - this.basisOldX;", + " this.relativeY = object.getY() - this.basisOldY;", + " if (!this.behavior._getOnlyFollowPosition()) {", + " this.relativeAngle = object.getAngle() - this.basisOldAngle;", + " this.relativeWidth = object.getWidth() / this.basisOldWidth;", + " this.relativeHeight = object.getHeight() / this.basisOldHeight;", + " const deltaX = object.getCenterXInScene() - this.basisOldCenterXInScene;", + " const deltaY = object.getCenterYInScene() - this.basisOldCenterYInScene;", + " const angle = this.basisOldAngle * Math.PI / 180;", + " const cosA = Math.cos(angle);", + " const sinA = Math.sin(angle);", + " this.relativeRotatedX = (deltaX * cosA + deltaY * sinA) / this.basisOldWidth;", + " this.relativeRotatedY = (-deltaX * sinA + deltaY * cosA) / this.basisOldHeight;", + "", + " // Save initial values to avoid calculus and rounding errors", + " this.basisOriginalWidth = this.basisObject.getWidth();", + " this.basisOriginalHeight = this.basisObject.getHeight();", + " this.basisOriginalAngle = this.basisObject.getAngle();", + " }", + " }", + "", + " /**", + " * Copy the coordinates to use it the next frame.", + " */", + " updateOldCoordinates() {", + " const object = this.behavior.owner;", + "", + " this.ownerOldX = object.getX();", + " this.ownerOldY = object.getY();", + "", + " this.basisOldX = this.basisObject.getX();", + " this.basisOldY = this.basisObject.getY();", + "", + " if (!this.behavior._getOnlyFollowPosition()) {", + " this.ownerOldAngle = object.getAngle();", + " this.ownerOldWidth = object.getWidth();", + " this.ownerOldHeight = object.getHeight();", + "", + " this.basisOldAngle = this.basisObject.getAngle();", + " this.basisOldWidth = this.basisObject.getWidth();", + " this.basisOldHeight = this.basisObject.getHeight();", + " this.basisOldCenterXInScene = this.basisObject.getCenterXInScene();", + " this.basisOldCenterYInScene = this.basisObject.getCenterYInScene();", + " }", + " }", + "", + " /**", + " * Follow the basisObject (called in doStepPostEvents).", + " * ", + " * This method is also called by children to ensure", + " * parents are updated first.", + " */", + " followBasisObject() {", + " if (this.followingDoneThisFrame) {", + " return;", + " }", + " this.followingDoneThisFrame = true;", + " const basisObject = this.basisObject;", + " if (!basisObject) {", + " return;", + " }", + " // If the behavior on the basis object has a different name,", + " // the objects will still follow their basis objects", + " // but frame delays could happen.", + " const behaviorName = this.behavior.getName();", + " if (basisObject.hasBehavior(behaviorName)) {", + " const basisBehavior = basisObject.getBehavior(behaviorName);", + " if (basisBehavior.type === this.behavior.type) {", + " // Follow parents 1st to avoid frame delays", + " basisBehavior._sticker.followBasisObject();", + " }", + " }", + " if (this.behavior._getOnlyFollowPosition()) {", + " this.followPosition();", + " } else {", + " this.followTransformation();", + " }", + " this.updateOldCoordinates();", + " }", + "", + " followPosition() {", + " const object = this.behavior.owner;", + " const basisObject = this.basisObject;", + " if (!basisObject) {", + " return;", + " }", + " if (object.getX() !== this.ownerOldX", + " || object.getY() !== this.ownerOldY) {", + " this.updateRelativeCoordinates();", + " }", + " if (this.basisOldX !== basisObject.getX()", + " || this.basisOldY !== basisObject.getY()) {", + " object.setPosition(", + " basisObject.getX() + this.relativeX,", + " basisObject.getY() + this.relativeY);", + " }", + " }", + "", + " followTransformation() {", + " const object = this.behavior.owner;", + " const basisObject = this.basisObject;", + " if (!basisObject) {", + " return;", + " }", + " if (object.getX() !== this.ownerOldX", + " || object.getY() !== this.ownerOldY", + " || object.getAngle() !== this.ownerOldAngle", + " || object.getWidth() !== this.ownerOldWidth", + " || object.getHeight() !== this.ownerOldHeight) {", + " this.updateRelativeCoordinates();", + " }", + " if (this.basisOldAngle !== this.basisObject.getAngle()", + " || this.basisOldWidth !== this.basisObject.getWidth()", + " || this.basisOldHeight !== this.basisObject.getHeight()", + " || this.basisOldCenterXInScene !== this.basisObject.getCenterXInScene()", + " || this.basisOldCenterYInScene !== this.basisObject.getCenterYInScene()) {", + " // Unproportional dimensions changes won't work as expected", + " // if the object angle is not null but nothing more can be done", + " // because there is no full affine transformation on objects.", + " if (basisObject.getWidth() !== this.basisOriginalWidth) {", + " object.setWidth(this.relativeWidth * basisObject.getWidth());", + " }", + " if (basisObject.getHeight() !== this.basisOriginalHeight) {", + " object.setHeight(this.relativeHeight * basisObject.getHeight());", + " }", + " // Follow basisObject", + " if (basisObject.getAngle() === this.basisOriginalAngle", + " && this.basisOriginalAngle === 0) {", + " if (basisObject.getWidth() === this.basisOriginalWidth", + " || basisObject.getHeight() === this.basisOriginalHeight) {", + " if (this.basisOldX !== basisObject.getX() ||", + " this.basisOldY !== basisObject.getY()) {", + " object.setPosition(", + " basisObject.getX() + this.relativeX,", + " basisObject.getY() + this.relativeY);", + " }", + " } else {", + " object.setCenterPositionInScene(", + " basisObject.getCenterXInScene() + this.relativeRotatedX * basisObject.getWidth(),", + " basisObject.getCenterYInScene() + this.relativeRotatedY * basisObject.getHeight());", + " }", + " } else {", + " object.setAngle(basisObject.getAngle() + this.relativeAngle);", + "", + " const deltaX = this.relativeRotatedX * basisObject.getWidth();", + " const deltaY = this.relativeRotatedY * basisObject.getHeight();", + " const angle = -basisObject.getAngle() * Math.PI / 180;", + " const cosA = Math.cos(angle);", + " const sinA = Math.sin(angle);", + " object.setX(", + " basisObject.getCenterXInScene() + object.getX() - object.getCenterXInScene()", + " + deltaX * cosA + deltaY * sinA);", + " object.setY(", + " basisObject.getCenterYInScene() + object.getY() - object.getCenterYInScene()", + " - deltaX * sinA + deltaY * cosA);", + " }", + " }", + " }", + "}", + "", + "gdjs._stickerExtension = {", + " Sticker", + "}" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "parameters": [], + "objectGroups": [] + }, { "description": "Check if the object is stuck to another object.", "fullName": "Is stuck to another object", "functionType": "Condition", "name": "IsStuck", - "private": false, "sentence": "_PARAM1_ is stuck to _PARAM3_", "events": [ { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": "const stickerBehaviorName = eventsFunctionContext.getBehaviorName(\"Behavior\");\n/** @type {Hashtable} */\nconst stickerObjectsLists = eventsFunctionContext.getObjectsLists(\"Object\");\n/** @type {Hashtable} */\nconst basisObjectsLists = eventsFunctionContext.getObjectsLists(\"BasisObject\");\n\neventsFunctionContext.returnValue = gdjs.evtTools.object.twoListsTest(\n (stickerObject, basisObject, stickerBehaviorName) => {\n const behavior = stickerObject.getBehavior(stickerBehaviorName);\n return behavior.basisObject === basisObject;\n },\n stickerObjectsLists,\n basisObjectsLists,\n false,\n stickerBehaviorName\n);", + "inlineCode": [ + "const stickerBehaviorName = eventsFunctionContext.getBehaviorName(\"Behavior\");", + "/** @type {Hashtable} */", + "const stickerObjectsLists = eventsFunctionContext.getObjectsLists(\"Object\");", + "/** @type {Hashtable} */", + "const basisObjectsLists = eventsFunctionContext.getObjectsLists(\"BasisObject\");", + "", + "eventsFunctionContext.returnValue = gdjs.evtTools.object.twoListsTest(", + " (stickerObject, basisObject) => {", + " const sticker = stickerObject.getBehavior(stickerBehaviorName)._sticker;", + " return sticker.isStuckTo(basisObject);", + " },", + " stickerObjectsLists,", + " basisObjectsLists,", + " false", + ");" + ], "parameterObjects": "", "useStrict": true, "eventsSheetExpanded": true @@ -2766,33 +2801,19 @@ ], "parameters": [ { - "codeOnly": false, - "defaultValue": "", "description": "Sticker", - "longDescription": "", "name": "Object", - "optional": false, - "supplementaryInformation": "", "type": "objectList" }, { - "codeOnly": false, - "defaultValue": "", "description": "Sticker behavior", - "longDescription": "", "name": "Behavior", - "optional": false, "supplementaryInformation": "Sticker::Sticker", "type": "behavior" }, { - "codeOnly": false, - "defaultValue": "", "description": "Basis", - "longDescription": "", "name": "BasisObject", - "optional": false, - "supplementaryInformation": "", "type": "objectList" } ], @@ -2805,20 +2826,50 @@ "fullName": "Sticker", "name": "Sticker", "objectType": "", + "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { - "description": "", "fullName": "", "functionType": "Action", "name": "onCreated", - "private": false, "sentence": "", "events": [ { - "disabled": false, - "folded": false, + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "Sticker::DefineHelperClasses" + }, + "parameters": [ + "", + "" + ] + } + ] + }, + { "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": "const behaviorName = eventsFunctionContext.getBehaviorName(\"Behavior\");\nconst object = objects[0];\nconst behavior = object.getBehavior(behaviorName);\n\n// Set up the scene sticker objects list - if not done already.\nif (!runtimeScene.__allStickers)\n runtimeScene.__allStickers = new Set();\n\n// Set up the behavior extra methods - if not done already.\nconst prototype = Object.getPrototypeOf(behavior);\nif (!prototype.updateRelativeCoordinates) {\n // Unstick from deleted objects.\n gdjs.registerObjectDeletedFromSceneCallback(function (runtimeScene, deletedObject) {\n if (!runtimeScene.__allStickers) return;\n\n for (const sticker of runtimeScene.__allStickers) {\n if (sticker.basisObject === deletedObject) {\n sticker.basisObject = null;\n }\n }\n });\n\n /**\n * Update the coordinates in the basisObject basis.\n * \n * It uses the basisObject coordinates from the previous frame.\n * This way, the sticker can move relatively to it and still\n * follow basisObject.\n * \n * @param {gdjs.RuntimeObject} basisObject\n */\n prototype.updateRelativeCoordinates = function (basisObject) {\n const object = this.owner;\n\n // Update relative coordinates\n this.relativeX = object.getX() - this.basisOldX;\n this.relativeY = object.getY() - this.basisOldY;\n if (!this._getOnlyFollowPosition()) {\n this.relativeAngle = object.getAngle() - this.basisOldAngle;\n this.relativeWidth = object.getWidth() / this.basisOldWidth;\n this.relativeHeight = object.getHeight() / this.basisOldHeight;\n const deltaX = object.getCenterXInScene() - this.basisOldCenterXInScene;\n const deltaY = object.getCenterYInScene() - this.basisOldCenterYInScene;\n const angle = this.basisOldAngle * Math.PI / 180;\n this.relativeRotatedX = (deltaX * Math.cos(angle) + deltaY * Math.sin(angle)) / this.basisOldWidth;\n this.relativeRotatedY = (-deltaX * Math.sin(angle) + deltaY * Math.cos(angle)) / this.basisOldHeight;\n\n // Save initial values to avoid calculus and rounding errors\n this.basisOriginalWidth = basisObject.getWidth();\n this.basisOriginalHeight = basisObject.getHeight();\n this.basisOriginalAngle = basisObject.getAngle();\n }\n }\n\n /**\n * Copy the coordinates to use it the next frame.\n * @param basisObject {gdjs.RuntimeObject}\n */\n prototype.updateOldCoordinates = function (basisObject) {\n const object = this.owner;\n\n this.ownerOldX = object.getX();\n this.ownerOldY = object.getY();\n\n this.basisOldX = basisObject.getX();\n this.basisOldY = basisObject.getY();\n\n if (!this._getOnlyFollowPosition()) {\n this.ownerOldAngle = object.getAngle();\n this.ownerOldWidth = object.getWidth();\n this.ownerOldHeight = object.getHeight();\n\n this.basisOldAngle = basisObject.getAngle();\n this.basisOldWidth = basisObject.getWidth();\n this.basisOldHeight = basisObject.getHeight();\n this.basisOldCenterXInScene = basisObject.getCenterXInScene();\n this.basisOldCenterYInScene = basisObject.getCenterYInScene();\n }\n }\n /**\n * Follow the basisObject (called in doStepPostEvents).\n * \n * This method is also called by children to ensure\n * parents are updated first.\n */\n prototype.followBasisObject = function () {\n if (this.followingDoneThisFrame) {\n return;\n }\n this.followingDoneThisFrame = true;\n /** @type {gdjs.RuntimeObject} */\n const basisObject = this.basisObject;\n if (basisObject) {\n // If the behavior on the basis object has a different name,\n // the objects will still follow their basis objects\n // but frame delays could happen.\n if (basisObject.hasBehavior(behaviorName)) {\n const basisBehavior = basisObject.getBehavior(behaviorName);\n if (basisBehavior.type === this.type) {\n // Follow parents 1st to avoid frame delays\n basisBehavior.followBasisObject();\n }\n }\n\n const object = this.owner;\n\n if (this._getOnlyFollowPosition()) {\n if (object.getX() !== this.ownerOldX\n || object.getY() !== this.ownerOldY) {\n this.updateRelativeCoordinates(basisObject);\n }\n\n if (this.basisOldX !== basisObject.getX() ||\n this.basisOldY !== basisObject.getY()) {\n object.setPosition(\n basisObject.getX() + this.relativeX,\n basisObject.getY() + this.relativeY);\n }\n } else {\n if (object.getX() !== this.ownerOldX\n || object.getY() !== this.ownerOldY\n || object.getAngle() !== this.ownerOldAngle\n || object.getWidth() !== this.ownerOldWidth\n || object.getHeight() !== this.ownerOldHeight) {\n this.updateRelativeCoordinates(basisObject);\n }\n\n // Follow basisObject\n if (basisObject.getAngle() === this.basisOriginalAngle && this.basisOriginalAngle === 0) {\n if (basisObject.getWidth() === this.basisOriginalWidth ||\n basisObject.getHeight() === this.basisOriginalHeight) {\n if (this.basisOldX !== basisObject.getX() ||\n this.basisOldY !== basisObject.getY()) {\n object.setPosition(\n basisObject.getX() + this.relativeX,\n basisObject.getY() + this.relativeY);\n }\n } else {\n object.setPosition(\n basisObject.getX() + this.relativeRotatedX * basisObject.getWidth(),\n basisObject.getY() + this.relativeRotatedY * basisObject.getHeight());\n }\n } else {\n object.setAngle(basisObject.getAngle() + this.relativeAngle);\n\n const deltaX = this.relativeRotatedX * basisObject.getWidth();\n const deltaY = this.relativeRotatedY * basisObject.getHeight();\n const angle = -basisObject.getAngle() * Math.PI / 180;\n object.setX(basisObject.getCenterXInScene() + object.getX() - object.getCenterXInScene() + deltaX * Math.cos(angle) + deltaY * Math.sin(angle));\n object.setY(basisObject.getCenterYInScene() + object.getY() - object.getCenterYInScene() - deltaX * Math.sin(angle) + deltaY * Math.cos(angle));\n }\n // Unproportional dimensions changes won't work as expected\n // if the object angle is not null but nothing more can be done\n // because there is no full affine transformation on objects.\n if (basisObject.getWidth() !== this.basisOriginalWidth) {\n object.setWidth(this.relativeWidth * basisObject.getWidth());\n }\n if (basisObject.getHeight() !== this.basisOriginalHeight) {\n object.setHeight(this.relativeHeight * basisObject.getHeight());\n }\n }\n\n this.updateOldCoordinates(basisObject);\n }\n }\n}\n\n// Register this object as a sticker.\nruntimeScene.__allStickers.add(behavior);\n", + "inlineCode": [ + "const Sticker = gdjs._stickerExtension.Sticker;", + "", + "const behaviorName = eventsFunctionContext.getBehaviorName(\"Behavior\");", + "const object = objects[0];", + "const behavior = object.getBehavior(behaviorName);", + "", + "behavior._sticker = new Sticker(behavior);", + "", + "// Set up the scene sticker objects list - if not done already.", + "runtimeScene._stickerExtension = runtimeScene._stickerExtension || {", + " allStickers: new Set(),", + "};", + "// Register this object as a sticker.", + "/** @type {Set} */", + "const allStickers = runtimeScene._stickerExtension.allStickers;", + "allStickers.add(behavior);", + "" + ], "parameterObjects": "Object", "useStrict": true, "eventsSheetExpanded": true @@ -2826,22 +2877,13 @@ ], "parameters": [ { - "codeOnly": false, - "defaultValue": "", "description": "Object", - "longDescription": "", "name": "Object", - "optional": false, - "supplementaryInformation": "", "type": "object" }, { - "codeOnly": false, - "defaultValue": "", "description": "Behavior", - "longDescription": "", "name": "Behavior", - "optional": false, "supplementaryInformation": "Sticker::Sticker", "type": "behavior" } @@ -2849,18 +2891,20 @@ "objectGroups": [] }, { - "description": "", "fullName": "", "functionType": "Action", "name": "doStepPreEvents", - "private": false, "sentence": "", "events": [ { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": "const behaviorName = eventsFunctionContext.getBehaviorName(\"Behavior\");\nconst object = objects[0];\nconst behavior = object.getBehavior(behaviorName);\n\nbehavior.followingDoneThisFrame = false;", + "inlineCode": [ + "const behaviorName = eventsFunctionContext.getBehaviorName(\"Behavior\");", + "const object = objects[0];", + "const behavior = object.getBehavior(behaviorName);", + "", + "behavior._sticker.onStepPreEvents();" + ], "parameterObjects": "Object", "useStrict": true, "eventsSheetExpanded": false @@ -2868,22 +2912,13 @@ ], "parameters": [ { - "codeOnly": false, - "defaultValue": "", "description": "Object", - "longDescription": "", "name": "Object", - "optional": false, - "supplementaryInformation": "", "type": "object" }, { - "codeOnly": false, - "defaultValue": "", "description": "Behavior", - "longDescription": "", "name": "Behavior", - "optional": false, "supplementaryInformation": "Sticker::Sticker", "type": "behavior" } @@ -2891,18 +2926,20 @@ "objectGroups": [] }, { - "description": "", "fullName": "", "functionType": "Action", "name": "doStepPostEvents", - "private": false, "sentence": "", "events": [ { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": "const behaviorName = eventsFunctionContext.getBehaviorName(\"Behavior\");\nconst object = objects[0];\nconst behavior = object.getBehavior(behaviorName);\n\nbehavior.followBasisObject();", + "inlineCode": [ + "const behaviorName = eventsFunctionContext.getBehaviorName(\"Behavior\");", + "const object = objects[0];", + "const behavior = object.getBehavior(behaviorName);", + "", + "behavior._sticker.followBasisObject();" + ], "parameterObjects": "Object", "useStrict": true, "eventsSheetExpanded": true @@ -2910,22 +2947,13 @@ ], "parameters": [ { - "codeOnly": false, - "defaultValue": "", "description": "Object", - "longDescription": "", "name": "Object", - "optional": false, - "supplementaryInformation": "", "type": "object" }, { - "codeOnly": false, - "defaultValue": "", "description": "Behavior", - "longDescription": "", "name": "Behavior", - "optional": false, "supplementaryInformation": "Sticker::Sticker", "type": "behavior" } @@ -2937,14 +2965,21 @@ "fullName": "Stick", "functionType": "Action", "name": "Stick", - "private": false, "sentence": "Stick _PARAM0_ to _PARAM2_", "events": [ { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": "const object = objects[0];\nconst behaviorName = eventsFunctionContext.getBehaviorName(\"Behavior\");\nconst basisObjects = eventsFunctionContext.getObjects(\"BasisObject\");\n\nif (basisObjects.length === 0) return;\nconst basisObject = basisObjects[0];\n\nconst behavior = object.getBehavior(behaviorName);\n\nbehavior.basisObject = basisObject;\nbehavior.updateOldCoordinates(basisObject);\nbehavior.updateRelativeCoordinates(basisObject);\n", + "inlineCode": [ + "const object = objects[0];", + "const behaviorName = eventsFunctionContext.getBehaviorName(\"Behavior\");", + "const basisObjects = eventsFunctionContext.getObjects(\"BasisObject\");", + "", + "if (basisObjects.length === 0) return;", + "// An object can stick to only one object.", + "const basisObject = basisObjects[0];", + "object.getBehavior(behaviorName)._sticker.stickTo(basisObject);", + "" + ], "parameterObjects": "Object", "useStrict": true, "eventsSheetExpanded": true @@ -2952,33 +2987,19 @@ ], "parameters": [ { - "codeOnly": false, - "defaultValue": "", "description": "Object", - "longDescription": "", "name": "Object", - "optional": false, - "supplementaryInformation": "", "type": "object" }, { - "codeOnly": false, - "defaultValue": "", "description": "Behavior", - "longDescription": "", "name": "Behavior", - "optional": false, "supplementaryInformation": "Sticker::Sticker", "type": "behavior" }, { - "codeOnly": false, - "defaultValue": "", "description": "Object to stick to", - "longDescription": "", "name": "BasisObject", - "optional": false, - "supplementaryInformation": "", "type": "objectList" } ], @@ -2989,14 +3010,18 @@ "fullName": "Unstick", "functionType": "Action", "name": "Unstick", - "private": false, "sentence": "Unstick _PARAM0_", "events": [ { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": "const object = objects[0];\nconst behaviorName = eventsFunctionContext.getBehaviorName(\"Behavior\");\nconst behavior = object.getBehavior(behaviorName);\n\nbehavior.basisObject = null;", + "inlineCode": [ + "const object = objects[0];", + "const behaviorName = eventsFunctionContext.getBehaviorName(\"Behavior\");", + "const behavior = object.getBehavior(behaviorName);", + "", + "object.getBehavior(behaviorName)._sticker.unstick();", + "" + ], "parameterObjects": "Object", "useStrict": true, "eventsSheetExpanded": true @@ -3004,22 +3029,13 @@ ], "parameters": [ { - "codeOnly": false, - "defaultValue": "", "description": "Object", - "longDescription": "", "name": "Object", - "optional": false, - "supplementaryInformation": "", "type": "object" }, { - "codeOnly": false, - "defaultValue": "", "description": "Behavior", - "longDescription": "", "name": "Behavior", - "optional": false, "supplementaryInformation": "Sticker::Sticker", "type": "behavior" } @@ -3027,18 +3043,23 @@ "objectGroups": [] }, { - "description": "", "fullName": "", "functionType": "Action", "name": "onDestroy", - "private": false, "sentence": "", "events": [ { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": "const behaviorName = eventsFunctionContext.getBehaviorName(\"Behavior\");\nconst object = objects[0];\nconst behavior = object.getBehavior(behaviorName);\n\nif (runtimeScene.__allStickers)\n runtimeScene.__allStickers.delete(behavior);\n", + "inlineCode": [ + "const behaviorName = eventsFunctionContext.getBehaviorName(\"Behavior\");", + "const object = objects[0];", + "const behavior = object.getBehavior(behaviorName);", + "", + "/** @type {Set} */", + "const allStickers = runtimeScene._stickerExtension.allStickers;", + "allStickers.delete(behavior);", + "" + ], "parameterObjects": "Object", "useStrict": true, "eventsSheetExpanded": true @@ -3046,22 +3067,13 @@ ], "parameters": [ { - "codeOnly": false, - "defaultValue": "", "description": "Object", - "longDescription": "", "name": "Object", - "optional": false, - "supplementaryInformation": "", "type": "object" }, { - "codeOnly": false, - "defaultValue": "", "description": "Behavior", - "longDescription": "", "name": "Behavior", - "optional": false, "supplementaryInformation": "Sticker::Sticker", "type": "behavior" } @@ -3074,16 +3086,20 @@ "value": "", "type": "Boolean", "label": "Only follow the position", - "description": "", - "extraInformation": [], - "hidden": false, "name": "OnlyFollowPosition" + }, + { + "value": "", + "type": "Boolean", + "label": "Destroy when the object it's stuck on is destroyed", + "name": "IsDestroyedWithParent" } - ] + ], + "sharedPropertyDescriptors": [] } - ] + ], + "eventsBasedObjects": [] } ], - "externalLayouts": [], - "externalSourceFiles": [] + "externalLayouts": [] } \ No newline at end of file