From d5d89582a1dcb676faa897c36fd47729d26b3581 Mon Sep 17 00:00:00 2001 From: Tristan Rhodes Date: Thu, 10 Aug 2023 18:54:37 -0600 Subject: [PATCH] Added ability to drag red hero and change scenes repeatedly --- examples/load-testing/load-testing.json | 1801 ++++++++++++++++++++++- 1 file changed, 1765 insertions(+), 36 deletions(-) diff --git a/examples/load-testing/load-testing.json b/examples/load-testing/load-testing.json index 45f04c753..78c312a0c 100644 --- a/examples/load-testing/load-testing.json +++ b/examples/load-testing/load-testing.json @@ -931,7 +931,7 @@ }, "objectsGroups": [ { - "name": "Buttons", + "name": "CreateObjectButtons", "objects": [ { "name": "CreateSprites_Button" @@ -944,9 +944,6 @@ }, { "name": "CreateParticles_Button" - }, - { - "name": "GreyButtonWithShadow" } ] } @@ -962,8 +959,8 @@ "name": "CreateParticles_Button", "persistentUuid": "fb4b5f7f-3845-457e-9f3c-00ecc710d4d4", "width": 320, - "x": 800, - "y": 736, + "x": 1184, + "y": 320, "zOrder": 2, "numberProperties": [], "stringProperties": [], @@ -978,8 +975,8 @@ "name": "CreateTiledSprites_Button", "persistentUuid": "ab279aee-3e88-4f7c-905c-eeba2935ddbb", "width": 320, - "x": 800, - "y": 576, + "x": 768, + "y": 320, "zOrder": 4, "numberProperties": [], "stringProperties": [], @@ -994,8 +991,8 @@ "name": "CreateSprites_Button", "persistentUuid": "dcfb3b7c-cfc7-4a50-9f31-2183b1149c42", "width": 320, - "x": 800, - "y": 416, + "x": 352, + "y": 320, "zOrder": 5, "numberProperties": [], "stringProperties": [], @@ -1006,11 +1003,11 @@ "customSize": false, "height": 48, "layer": "", - "name": "SquareWhiteSlider", + "name": "ObjectCount_Slider", "persistentUuid": "e1b31e8e-179b-4141-b609-6b7611c95823", "width": 1792, "x": 64, - "y": 304, + "y": 208, "zOrder": 6, "numberProperties": [], "stringProperties": [], @@ -1025,7 +1022,7 @@ "persistentUuid": "bbfd4377-cb6b-4789-8ae0-b7848194ed6b", "width": 0, "x": 800, - "y": 192, + "y": 96, "zOrder": 7, "numberProperties": [], "stringProperties": [], @@ -1040,11 +1037,57 @@ "persistentUuid": "e7af598f-17cf-42de-bb35-83a026fefac8", "width": 0, "x": 736, - "y": 932, + "y": 580, "zOrder": 8, "numberProperties": [], "stringProperties": [], "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "layer": "", + "name": "ChangeScenes_Text", + "persistentUuid": "abe20f22-3f86-44f4-9426-640f262b4839", + "width": 0, + "x": 704, + "y": 768, + "zOrder": 9, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "layer": "", + "name": "SceneChange_Slider", + "persistentUuid": "2e30ddf9-d599-41b6-a506-ec8ea97ad049", + "width": 0, + "x": 64, + "y": 832, + "zOrder": 10, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": true, + "depth": 32, + "height": 128, + "layer": "", + "name": "ChangeScenes_Button", + "persistentUuid": "54f04daf-52db-43a5-8d74-921d8d8d3221", + "width": 416, + "x": 736, + "y": 896, + "zOrder": 11, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] } ], "objects": [ @@ -1306,7 +1349,7 @@ }, { "assetStoreId": "9cf9ca8be6e98fc23e76b6770d3f4d094dea09f30a49f38ef9a9d2e97c2460be", - "name": "GreyButtonWithShadow", + "name": "ChangeScenes_Button", "tags": "", "type": "PanelSpriteButton::PanelSpriteButton", "variables": [], @@ -1346,7 +1389,7 @@ "italic": false, "smoothed": true, "underlined": false, - "string": "BUTTON", + "string": "Start Changing Scenes", "font": "CantoraOne-Regular.ttf", "textAlignment": "center", "characterSize": 40, @@ -1370,7 +1413,7 @@ }, { "assetStoreId": "bfeeb465a4a164b560a2215e3ff9e78e66123af43cbf7ef1f22d56fca4271c80", - "name": "SquareWhiteSlider", + "name": "ObjectCount_Slider", "tags": "", "type": "PanelSpriteSlider::PanelSpriteSlider", "variables": [], @@ -1435,6 +1478,73 @@ } } }, + { + "assetStoreId": "bfeeb465a4a164b560a2215e3ff9e78e66123af43cbf7ef1f22d56fca4271c80", + "name": "SceneChange_Slider", + "tags": "", + "type": "PanelSpriteSlider::PanelSpriteSlider", + "variables": [], + "effects": [], + "behaviors": [], + "content": { + "BarTopPadding": 6, + "BarLeftPadding": 6, + "BarRightPadding": 6, + "BarBottomPadding": 6, + "LabelMargin": 6, + "InitialValue": 100, + "MaxValue": 1000, + "MinValue": 1, + "StepSize": 1 + }, + "childrenContent": { + "Background": { + "bottomMargin": 4, + "height": 48, + "leftMargin": 2, + "rightMargin": 2, + "texture": "Square White Slider Border.png", + "tiled": false, + "topMargin": 4, + "width": 1792 + }, + "FillBar": { + "bottomMargin": 2, + "height": 46, + "leftMargin": 10, + "rightMargin": 0, + "texture": "Square White Slider Fill Bar.png", + "tiled": false, + "topMargin": 0, + "width": 1782 + }, + "Label": { + "bold": true, + "italic": false, + "smoothed": true, + "underlined": false, + "string": "Quantity", + "font": "", + "textAlignment": "", + "characterSize": 20, + "color": { + "b": 255, + "g": 255, + "r": 255 + } + }, + "Thumb": { + "bottomMargin": 2, + "height": 64, + "leftMargin": 1, + "rightMargin": 1, + "texture": "Square White Slider Thumb.png", + "tiled": false, + "topMargin": 2, + "width": 32 + } + } + }, { "assetStoreId": "", "bold": true, @@ -1457,6 +1567,28 @@ "r": 255 } }, + { + "assetStoreId": "", + "bold": true, + "italic": false, + "name": "ChangeScenes_Text", + "smoothed": true, + "tags": "", + "type": "TextObject::Text", + "underlined": false, + "variables": [], + "effects": [], + "behaviors": [], + "string": "Number of Scene Changes", + "font": "", + "textAlignment": "left", + "characterSize": 40, + "color": { + "b": 255, + "g": 255, + "r": 255 + } + }, { "assetStoreId": "", "bold": true, @@ -1536,7 +1668,7 @@ "value": "PanelSpriteSlider::PanelSpriteSlider::SetValue" }, "parameters": [ - "SquareWhiteSlider", + "ObjectCount_Slider", "=", "GlobalVariable(QuantityToCreate)", "" @@ -1706,7 +1838,7 @@ "value": "PanelSpriteButton::PanelSpriteButton::IsClicked" }, "parameters": [ - "Buttons", + "CreateObjectButtons", "" ] } @@ -1718,7 +1850,7 @@ }, "parameters": [ "", - "Buttons" + "CreateObjectButtons" ] }, { @@ -1738,7 +1870,17 @@ "parameters": [ "QuantityToCreate", "=", - "SquareWhiteSlider.Value()" + "ObjectCount_Slider.Value()" + ] + }, + { + "type": { + "value": "PanelSpriteButton::PanelSpriteButton::Activate" + }, + "parameters": [ + "CreateObjectButtons", + "", + "" ] }, { @@ -1746,7 +1888,7 @@ "value": "PanelSpriteButton::PanelSpriteButton::Activate" }, "parameters": [ - "Buttons", + "ChangeScenes_Button", "", "" ] @@ -1756,7 +1898,17 @@ "value": "PanelSpriteButton::PanelSpriteButton::SetOpacity" }, "parameters": [ - "Buttons", + "CreateObjectButtons", + "=", + "128" + ] + }, + { + "type": { + "value": "PanelSpriteButton::PanelSpriteButton::SetOpacity" + }, + "parameters": [ + "ChangeScenes_Button", "=", "128" ] @@ -1772,6 +1924,92 @@ ] } ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "PanelSpriteButton::PanelSpriteButton::IsClicked" + }, + "parameters": [ + "ChangeScenes_Button", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "ModVarGlobal" + }, + "parameters": [ + "SceneEndTime", + "=", + "Time(\"timestamp\")" + ] + }, + { + "type": { + "value": "ModVarGlobal" + }, + "parameters": [ + "ChangeScenesRemaining", + "=", + "SceneChange_Slider.Value()" + ] + }, + { + "type": { + "value": "PanelSpriteButton::PanelSpriteButton::Activate" + }, + "parameters": [ + "CreateObjectButtons", + "", + "" + ] + }, + { + "type": { + "value": "PanelSpriteButton::PanelSpriteButton::Activate" + }, + "parameters": [ + "ChangeScenes_Button", + "", + "" + ] + }, + { + "type": { + "value": "PanelSpriteButton::PanelSpriteButton::SetOpacity" + }, + "parameters": [ + "CreateObjectButtons", + "=", + "128" + ] + }, + { + "type": { + "value": "PanelSpriteButton::PanelSpriteButton::SetOpacity" + }, + "parameters": [ + "ChangeScenes_Button", + "=", + "128" + ] + }, + { + "type": { + "value": "Scene" + }, + "parameters": [ + "", + "\"Red\"", + "" + ] + } + ] } ], "parameters": [] @@ -2312,8 +2550,8 @@ "density": 1, "friction": 0, "restitution": 0, - "linearDamping": 0.1, - "angularDamping": 0.1, + "linearDamping": 10, + "angularDamping": 10, "gravityScale": 0, "layers": 1, "masks": 1 @@ -2842,8 +3080,8 @@ "density": 1, "friction": 0.3, "restitution": 0.1, - "linearDamping": 0.1, - "angularDamping": 0.1, + "linearDamping": 10, + "angularDamping": 10, "gravityScale": 0, "layers": 1, "masks": 1 @@ -3034,10 +3272,26 @@ "variables": [], "effects": [], "behaviors": [ + { + "checkCollisionMask": true, + "name": "Draggable", + "type": "DraggableBehavior::Draggable" + }, + { + "name": "DraggablePhysics", + "type": "DraggablePhysics::DraggablePhysics", + "PhysicsBehavior": "Physics2", + "MouseButton": "Left", + "MaxForce": 500, + "Frequency": 10, + "Damping": 1, + "MouseJointID": 1, + "EnableAutomaticDragging": true + }, { "name": "Physics2", "type": "Physics2::Physics2Behavior", - "bodyType": "Static", + "bodyType": "Dynamic", "bullet": false, "fixedRotation": false, "canSleep": true, @@ -3051,9 +3305,9 @@ "density": 1, "friction": 0.3, "restitution": 0.1, - "linearDamping": 0.1, - "angularDamping": 0.1, - "gravityScale": 1, + "linearDamping": 10, + "angularDamping": 10, + "gravityScale": 0, "layers": 1, "masks": 1 } @@ -5418,7 +5672,7 @@ "parameters": [ "TimeToDisplay_Text", "=", - "\"Time to display: \" + ToString((Time(\"timestamp\") -GlobalVariable(SceneStartTime)) / 1000) + \" seconds\"" + "\"Time to display: \" + ToString((Time(\"timestamp\") - GlobalVariable(SceneStartTime)) / 1000) + \" seconds\"" ] }, { @@ -6268,6 +6522,16 @@ "TiledSprite", "no" ] + }, + { + "type": { + "value": "SeparateFromObjects" + }, + "parameters": [ + "Sprite", + "RedHero", + "no" + ] } ] } @@ -6831,6 +7095,10 @@ } ], "behaviorsSharedData": [ + { + "name": "DraggablePhysics", + "type": "DraggablePhysics::DraggablePhysics" + }, { "name": "FPSDisplayer", "type": "FPS::FPSDisplayer" @@ -6844,10 +7112,1471 @@ "scaleY": 100 } ] - } - ], - "externalEvents": [], - "eventsFunctionsExtensions": [ + }, + { + "b": 0, + "disableInputWhenNotFocused": true, + "mangledName": "Red", + "name": "Red", + "r": 0, + "standardSortMethod": true, + "stopSoundsOnStartup": true, + "title": "", + "v": 0, + "uiSettings": { + "grid": false, + "gridType": "rectangular", + "gridWidth": 32, + "gridHeight": 32, + "gridOffsetX": 0, + "gridOffsetY": 0, + "gridColor": 10401023, + "gridAlpha": 0.8, + "snap": false, + "zoomFactor": 0.3645833333333333, + "windowMask": false + }, + "objectsGroups": [], + "variables": [], + "instances": [ + { + "angle": 0, + "customSize": false, + "height": 0, + "layer": "", + "name": "SceneChangesRemaining_Text", + "persistentUuid": "85c4bb52-f41c-488d-831d-480e35eed043", + "width": 0, + "x": 224, + "y": 493, + "zOrder": 1, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + } + ], + "objects": [ + { + "assetStoreId": "", + "bold": true, + "italic": false, + "name": "SceneChangesRemaining_Text", + "smoothed": true, + "tags": "", + "type": "TextObject::Text", + "underlined": false, + "variables": [], + "effects": [], + "behaviors": [], + "string": "Scene Changes Remaining: 000", + "font": "", + "textAlignment": "left", + "characterSize": 100, + "color": { + "b": 35, + "g": 5, + "r": 255 + } + } + ], + "events": [ + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Automatically change scenes", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "TextObject::String" + }, + "parameters": [ + "SceneChangesRemaining_Text", + "=", + "\"Scene Changes Remaining: \" + ToString(GlobalVariable(ChangeScenesRemaining))" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "VarGlobal" + }, + "parameters": [ + "ChangeScenesRemaining", + "<=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "Scene" + }, + "parameters": [ + "", + "\"Menu\"", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "VarGlobal" + }, + "parameters": [ + "ChangeScenesRemaining", + ">", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "ModVarGlobal" + }, + "parameters": [ + "ChangeScenesRemaining", + "-", + "1" + ] + }, + { + "type": { + "value": "Scene" + }, + "parameters": [ + "", + "\"Blue\"", + "" + ] + } + ] + } + ], + "parameters": [] + } + ], + "layers": [ + { + "ambientLightColorB": 200, + "ambientLightColorG": 200, + "ambientLightColorR": 200, + "camera3DFarPlaneDistance": 10000, + "camera3DFieldOfView": 45, + "camera3DNearPlaneDistance": 0.1, + "followBaseLayerCamera": false, + "isLightingLayer": false, + "isLocked": false, + "name": "", + "renderingType": "", + "visibility": true, + "cameras": [ + { + "defaultSize": true, + "defaultViewport": true, + "height": 0, + "viewportBottom": 1, + "viewportLeft": 0, + "viewportRight": 1, + "viewportTop": 0, + "width": 0 + } + ], + "effects": [] + } + ], + "behaviorsSharedData": [] + }, + { + "b": 0, + "disableInputWhenNotFocused": true, + "mangledName": "Blue", + "name": "Blue", + "r": 0, + "standardSortMethod": true, + "stopSoundsOnStartup": true, + "title": "", + "v": 0, + "uiSettings": { + "grid": true, + "gridType": "rectangular", + "gridWidth": 32, + "gridHeight": 32, + "gridOffsetX": 0, + "gridOffsetY": 0, + "gridColor": 10401023, + "gridAlpha": 0.1, + "snap": true, + "zoomFactor": 0.3645833333333333, + "windowMask": false + }, + "objectsGroups": [], + "variables": [], + "instances": [ + { + "angle": 0, + "customSize": false, + "height": 110, + "layer": "", + "name": "SceneChangesRemaining_Text", + "persistentUuid": "7af40027-ba2c-4433-aec9-6178737face6", + "width": 170, + "x": 224, + "y": 493, + "zOrder": 1, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + } + ], + "objects": [ + { + "assetStoreId": "", + "bold": true, + "italic": false, + "name": "SceneChangesRemaining_Text", + "smoothed": true, + "tags": "", + "type": "TextObject::Text", + "underlined": false, + "variables": [], + "effects": [], + "behaviors": [], + "string": "Scene Changes Remaining: 000", + "font": "", + "textAlignment": "left", + "characterSize": 100, + "color": { + "b": 255, + "g": 112, + "r": 0 + } + } + ], + "events": [ + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Automatically change scenes", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "TextObject::String" + }, + "parameters": [ + "SceneChangesRemaining_Text", + "=", + "\"Scene Changes Remaining: \" + ToString(GlobalVariable(ChangeScenesRemaining))" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "VarGlobal" + }, + "parameters": [ + "ChangeScenesRemaining", + "<=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "ModVarGlobal" + }, + "parameters": [ + "SceneEndTime", + "=", + "Time(\"timestamp\")" + ] + }, + { + "type": { + "value": "Scene" + }, + "parameters": [ + "", + "\"Menu\"", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "VarGlobal" + }, + "parameters": [ + "ChangeScenesRemaining", + ">", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "ModVarGlobal" + }, + "parameters": [ + "ChangeScenesRemaining", + "-", + "1" + ] + }, + { + "type": { + "value": "Scene" + }, + "parameters": [ + "", + "\"Red\"", + "" + ] + } + ] + } + ], + "parameters": [] + } + ], + "layers": [ + { + "ambientLightColorB": 200, + "ambientLightColorG": 200, + "ambientLightColorR": 200, + "camera3DFarPlaneDistance": 10000, + "camera3DFieldOfView": 45, + "camera3DNearPlaneDistance": 0.1, + "followBaseLayerCamera": false, + "isLightingLayer": false, + "isLocked": false, + "name": "", + "renderingType": "", + "visibility": true, + "cameras": [ + { + "defaultSize": true, + "defaultViewport": true, + "height": 0, + "viewportBottom": 1, + "viewportLeft": 0, + "viewportRight": 1, + "viewportTop": 0, + "width": 0 + } + ], + "effects": [] + } + ], + "behaviorsSharedData": [] + } + ], + "externalEvents": [], + "eventsFunctionsExtensions": [ + { + "author": "", + "category": "Movement", + "extensionNamespace": "", + "fullName": "Draggable (for physics objects)", + "helpPath": "", + "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyMy4wLjMsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iSWNvbnMiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB2aWV3Qm94PSIwIDAgMzIgMzIiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDMyIDMyOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8cGF0aCBkPSJNMjcsMTFjMC0yLTIuMi0zLjYtNS42LTQuNEMyMC42LDMuMiwxOSwxLDE3LDFzLTMuNiwyLjItNC40LDUuNkM5LjIsNy40LDcsOSw3LDExYzAsMiwyLjIsMy42LDUuNiw0LjQNCgljMC4zLDEuMiwwLjYsMi4yLDEuMSwzLjFjMC4zLDAuNSwwLjksMC43LDEuNCwwLjRjMC41LTAuMywwLjctMC45LDAuNC0xLjRjLTAuMy0wLjUtMC41LTEuMS0wLjctMS44YzAuNywwLjEsMS41LDAuMSwyLjIsMC4xDQoJYzAuOCwwLDEuNSwwLDIuMi0wLjFjLTAuMywxLTAuNywxLjktMS4xLDIuNWMtMC4zLDAuNC0wLjIsMS4xLDAuMiwxLjRjMC4yLDAuMSwwLjQsMC4yLDAuNiwwLjJjMC4zLDAsMC42LTAuMSwwLjgtMC40DQoJYzAuNy0xLDEuMy0yLjQsMS43LTRDMjQuOCwxNC42LDI3LDEzLDI3LDExeiBNMTcsM2MwLjcsMCwxLjYsMS4yLDIuMiwzLjNjLTAuNy0wLjEtMS41LTAuMS0yLjItMC4xcy0xLjUsMC0yLjIsMC4xDQoJQzE1LjQsNC4yLDE2LjMsMywxNywzeiBNOSwxMWMwLTAuNywxLjItMS42LDMuMy0yLjJjLTAuMSwwLjctMC4xLDEuNS0wLjEsMi4yYzAsMC44LDAsMS41LDAuMSwyLjJDMTAuMiwxMi42LDksMTEuNyw5LDExeiBNMTcsMTMuOQ0KCWMtMSwwLTEuOS0wLjEtMi43LTAuMmMtMC4xLTAuOC0wLjItMS43LTAuMi0yLjdjMC0xLDAuMS0xLjksMC4yLTIuN0MxNS4xLDguMiwxNiw4LjEsMTcsOC4xczEuOSwwLjEsMi43LDAuMg0KCWMwLjEsMC44LDAuMiwxLjcsMC4yLDIuN2MwLDAuOS0wLjEsMS44LTAuMiwyLjdDMTguOSwxMy44LDE4LDEzLjksMTcsMTMuOXogTTIxLjcsMTMuMmMwLjEtMC43LDAuMS0xLjUsMC4xLTIuMg0KCWMwLTAuOCwwLTEuNS0wLjEtMi4yQzIzLjgsOS40LDI1LDEwLjMsMjUsMTFDMjUsMTEuNywyMy44LDEyLjYsMjEuNywxMy4yeiIvPg0KPHBhdGggZD0iTTI5LjksMTcuNUMyOS43LDE3LjIsMjkuNCwxNywyOSwxN2MtMi4yLDAtNC4zLDEtNS42LDIuOEwyMi41LDIxYy0xLjEsMS4zLTIuOCwyLTQuNSwyaC0zYy0wLjYsMC0xLTAuNC0xLTFzMC40LTEsMS0xaDEuOQ0KCWMxLjYsMCwzLjEtMS4zLDMuMS0yLjljMCwwLDAtMC4xLDAtMC4xYzAtMC41LTAuNS0xLTEtMWwtNi4xLDBjLTMuNiwwLTYuNSwxLjYtOC4xLDQuMmwtMi43LDQuMmMtMC4yLDAuMy0wLjIsMC43LDAsMWwzLDUNCgljMC4xLDAuMiwwLjQsMC40LDAuNiwwLjVjMC4xLDAsMC4xLDAsMC4yLDBjMC4yLDAsMC40LTAuMSwwLjYtMC4yYzMuOC0yLjUsOC4yLTMuOCwxMi43LTMuOGMzLjMsMCw2LjMtMS44LDcuOS00LjdsMi43LTQuOA0KCUMzMCwxOC4yLDMwLDE3LjgsMjkuOSwxNy41eiIvPg0KPC9zdmc+DQo=", + "name": "DraggablePhysics", + "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/Glyphster Pack/Master/SVG/Virtual Reality/Virtual Reality_hand_vr_ar_360.svg", + "shortDescription": "Drag a physics object with the mouse (or touch).", + "version": "1.2.0", + "description": [ + "Enables players to click and drag on physics objects to move them. The object retains velocity when the click is released, allowing players to fling objects across the screen.", + "", + "Note:", + "- The default \"draggable\" behavior will not work on objects with the physics behavior. This extension should be used instead.", + "- This extension will only work on objects that have the physics behavior.", + "- Kinematic physics mode is incompatible with this extension. The object will be changed to dynamic mode.", + "", + "The Parking Jam example uses this extension ([open the project online](https://editor.gdevelop.io/?project=example://parking-jam))." + ], + "origin": { + "identifier": "DraggablePhysics", + "name": "gdevelop-extension-store" + }, + "tags": [ + "draggable", + "mouse", + "pointer", + "cursor", + "touch", + "physics", + "object", + "joint", + "fling" + ], + "authorIds": [ + "gqDaZjCfevOOxBYkK6zlhtZnXCg1" + ], + "dependencies": [], + "eventsFunctions": [], + "eventsBasedBehaviors": [ + { + "description": "Drag a physics object with the mouse (or touch).", + "fullName": "Draggable (for physics objects)", + "name": "DraggablePhysics", + "objectType": "", + "eventsFunctions": [ + { + "fullName": "", + "functionType": "Action", + "name": "doStepPreEvents", + "sentence": "", + "events": [ + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Change \"kinematic\" to \"dynamic\" to prevent crash", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Physics2::IsKinematic" + }, + "parameters": [ + "Object", + "PhysicsBehavior" + ] + } + ], + "actions": [ + { + "type": { + "value": "Physics2::SetDynamic" + }, + "parameters": [ + "Object", + "PhysicsBehavior" + ] + } + ] + } + ], + "parameters": [] + }, + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Mouse", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Create mouse joints and save the joint ID" + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "DraggablePhysics::DraggablePhysics::PropertyEnableAutomaticDragging" + }, + "parameters": [ + "Object", + "Behavior" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "MouseButtonFromTextPressed" + }, + "parameters": [ + "", + "Object.Behavior::PropertyMouseButton()" + ] + }, + { + "type": { + "value": "BuiltinCommonInstructions::Once" + }, + "parameters": [] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "DraggablePhysics::DraggablePhysics::IsBeingDragged" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + }, + { + "type": { + "value": "SourisSurObjet" + }, + "parameters": [ + "Object", + "", + "", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "Physics2::AddMouseJoint" + }, + "parameters": [ + "Object", + "PhysicsBehavior", + "MouseX(Object.Layer(),0)", + "MouseY(Object.Layer(),0)", + "Object.Behavior::PropertyMaxForce()", + "Object.Behavior::PropertyFrequency()", + "Object.Behavior::PropertyDamping()", + "__DraggablePhysics.MouseJointID" + ] + }, + { + "type": { + "value": "DraggablePhysics::DraggablePhysics::SetPropertyMouseJointID" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "Variable(__DraggablePhysics.MouseJointID)" + ] + } + ] + } + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Delete the mouse joint" + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "DraggablePhysics::DraggablePhysics::PropertyEnableAutomaticDragging" + }, + "parameters": [ + "Object", + "Behavior" + ] + }, + { + "type": { + "value": "MouseButtonFromTextReleased" + }, + "parameters": [ + "", + "Object.Behavior::PropertyMouseButton()" + ] + } + ], + "actions": [ + { + "type": { + "value": "DraggablePhysics::DraggablePhysics::ReleaseDrag" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Update the position of the mouse joint to follow the mouse" + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "DraggablePhysics::DraggablePhysics::IsBeingDragged" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "Physics2::MouseJointTarget" + }, + "parameters": [ + "Object", + "PhysicsBehavior", + "Object.Behavior::PropertyMouseJointID()", + "MouseX(Object.Layer(),0)", + "MouseY(Object.Layer(),0)" + ] + } + ] + } + ], + "parameters": [] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "DraggablePhysics::DraggablePhysics", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Start dragging object.", + "fullName": "Start dragging object", + "functionType": "Action", + "name": "StartDragging", + "sentence": "Start dragging (physics) _PARAM0_ ", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "DraggablePhysics::DraggablePhysics::IsBeingDragged" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "Physics2::AddMouseJoint" + }, + "parameters": [ + "Object", + "PhysicsBehavior", + "MouseX(Object.Layer(),0)", + "MouseY(Object.Layer(),0)", + "Object.Behavior::PropertyMaxForce()", + "Object.Behavior::PropertyFrequency()", + "Object.Behavior::PropertyDamping()", + "__DraggablePhysics.MouseJointID" + ] + }, + { + "type": { + "value": "DraggablePhysics::DraggablePhysics::SetPropertyMouseJointID" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "Variable(__DraggablePhysics.MouseJointID)" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "DraggablePhysics::DraggablePhysics", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Release dragged object.", + "fullName": "Release dragged object", + "functionType": "Action", + "name": "ReleaseDrag", + "sentence": "Release _PARAM0_ from being dragged (physics)", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "DraggablePhysics::DraggablePhysics::IsBeingDragged" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "Physics2::Remove joint" + }, + "parameters": [ + "Object", + "PhysicsBehavior", + "Object.Behavior::PropertyMouseJointID()" + ] + }, + { + "type": { + "value": "DraggablePhysics::DraggablePhysics::SetPropertyMouseJointID" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "0" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "DraggablePhysics::DraggablePhysics", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Check if object is being dragged.", + "fullName": "Is being dragged", + "functionType": "Condition", + "name": "IsBeingDragged", + "sentence": "_PARAM0_ is being dragged (physics)", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "DraggablePhysics::DraggablePhysics::PropertyMouseJointID" + }, + "parameters": [ + "Object", + "Behavior", + "!=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "DraggablePhysics::DraggablePhysics", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "Action", + "name": "onDeActivate", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "DraggablePhysics::DraggablePhysics::ReleaseDrag" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "DraggablePhysics::DraggablePhysics", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "the mouse button used to move the object.", + "fullName": "Mouse button", + "functionType": "ExpressionAndCondition", + "group": "Draggable (for physics objects) configuration", + "name": "MouseButton", + "sentence": "the dragging mouse button", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnString" + }, + "parameters": [ + "Object.Behavior::PropertyMouseButton()" + ] + } + ] + } + ], + "expressionType": { + "supplementaryInformation": "[\"Left\",\"Right\",\"Middle\"]", + "type": "stringWithSelector" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "DraggablePhysics::DraggablePhysics", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "MouseButton", + "name": "SetMouseButton", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "DraggablePhysics::DraggablePhysics::SetPropertyMouseButton" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "GetArgumentAsString(\"Value\")" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "DraggablePhysics::DraggablePhysics", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "the maximum joint force (in Newtons) of the object.", + "fullName": "Maximum force", + "functionType": "ExpressionAndCondition", + "group": "Draggable configuration", + "name": "MaxForce", + "sentence": "the maximum force", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "Object.Behavior::PropertyMaxForce()" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "DraggablePhysics::DraggablePhysics", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "MaxForce", + "name": "SetMaxForce", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "DraggablePhysics::DraggablePhysics::SetPropertyMaxForce" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "GetArgumentAsNumber(\"Value\")" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "DraggablePhysics::DraggablePhysics", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "the joint frequency (per second) of the object.", + "fullName": "Frequency", + "functionType": "ExpressionAndCondition", + "group": "Draggable configuration", + "name": "Frequency", + "sentence": "the frequency", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "Object.Behavior::PropertyFrequency()" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "DraggablePhysics::DraggablePhysics", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "Frequency", + "name": "SetFrequency", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "DraggablePhysics::DraggablePhysics::SetPropertyFrequency" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "GetArgumentAsNumber(\"Value\")" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "DraggablePhysics::DraggablePhysics", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "the joint damping ratio (range: 0 to 1) of the object. ", + "fullName": "Damping ratio", + "functionType": "ExpressionAndCondition", + "group": "Draggable configuration", + "name": "Damping", + "sentence": "the damping ratio (range: 0 to 1)", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "Object.Behavior::PropertyDamping()" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "DraggablePhysics::DraggablePhysics", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "Damping", + "name": "SetDamping", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "DraggablePhysics::DraggablePhysics::SetPropertyDamping" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "GetArgumentAsNumber(\"Value\")" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "DraggablePhysics::DraggablePhysics", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Check if automatic dragging is enabled.", + "fullName": "Automatic dragging", + "functionType": "Condition", + "group": "Draggable (for physics objects) configuration", + "name": "IsAutomaticDraggingEnabled", + "sentence": "Automatic dragging is enabled on _PARAM0_ ", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "DraggablePhysics::DraggablePhysics::PropertyEnableAutomaticDragging" + }, + "parameters": [ + "Object", + "Behavior" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "DraggablePhysics::DraggablePhysics", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Enable (or disable) automatic dragging with the mouse or touch.", + "fullName": "Enable (or disable) automatic dragging", + "functionType": "Action", + "group": "Draggable (for physics objects) configuration", + "name": "SetEnableAutomaticDragging", + "sentence": "Enable automatic dragging on _PARAM0_: _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "GetArgumentAsBoolean" + }, + "parameters": [ + "\"Value\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "DraggablePhysics::DraggablePhysics::SetPropertyEnableAutomaticDragging" + }, + "parameters": [ + "Object", + "Behavior", + "no" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "GetArgumentAsBoolean" + }, + "parameters": [ + "\"Value\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "DraggablePhysics::DraggablePhysics::SetPropertyEnableAutomaticDragging" + }, + "parameters": [ + "Object", + "Behavior", + "yes" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "DraggablePhysics::DraggablePhysics", + "type": "behavior" + }, + { + "defaultValue": "yes", + "description": "EnableAutomaticDragging", + "name": "Value", + "optional": true, + "type": "yesorno" + } + ], + "objectGroups": [] + } + ], + "propertyDescriptors": [ + { + "value": "", + "type": "Behavior", + "label": "Physics behavior", + "description": "", + "group": "", + "extraInformation": [ + "Physics2::Physics2Behavior" + ], + "hidden": false, + "name": "PhysicsBehavior" + }, + { + "value": "Left", + "type": "Choice", + "label": "Mouse button", + "description": "", + "group": "", + "extraInformation": [ + "Left", + "Right", + "Middle" + ], + "hidden": false, + "name": "MouseButton" + }, + { + "value": "500", + "type": "Number", + "unit": "Newton", + "label": "Maximum force", + "description": "", + "group": "", + "extraInformation": [], + "hidden": false, + "name": "MaxForce" + }, + { + "value": "10", + "type": "Number", + "label": "Frequency (Hz) ", + "description": "", + "group": "", + "extraInformation": [], + "hidden": false, + "name": "Frequency" + }, + { + "value": "1", + "type": "Number", + "label": "Damping ratio (Range: 0 to 1)", + "description": "", + "group": "", + "extraInformation": [], + "hidden": false, + "name": "Damping" + }, + { + "value": "", + "type": "Number", + "label": "", + "description": "", + "group": "", + "extraInformation": [], + "hidden": true, + "name": "MouseJointID" + }, + { + "value": "true", + "type": "Boolean", + "label": "Enable automatic dragging", + "description": "If automatic dragging is disabled, use the \"Start drag\" and \"Release drag\" actions.", + "group": "", + "extraInformation": [], + "hidden": false, + "name": "EnableAutomaticDragging" + } + ], + "sharedPropertyDescriptors": [] + } + ], + "eventsBasedObjects": [] + }, { "author": "", "category": "User interface",