From 0c9bda6dec96828f7b41a1e427700b1536705dd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Davy=20H=C3=A9lard?= Date: Mon, 6 Oct 2025 17:42:00 +0200 Subject: [PATCH 01/12] [3D bomber bunny] Update the extensions --- examples/3d-bomber-bunny/3d-bomber-bunny.json | 15597 +++++++++------- 1 file changed, 9316 insertions(+), 6281 deletions(-) diff --git a/examples/3d-bomber-bunny/3d-bomber-bunny.json b/examples/3d-bomber-bunny/3d-bomber-bunny.json index a6a9b37aa..05629f4f1 100644 --- a/examples/3d-bomber-bunny/3d-bomber-bunny.json +++ b/examples/3d-bomber-bunny/3d-bomber-bunny.json @@ -1,9 +1,9 @@ { "firstLayout": "Selection", "gdVersion": { - "build": 213, + "build": 242, "major": 5, - "minor": 4, + "minor": 5, "revision": 0 }, "properties": { @@ -18,7 +18,6 @@ "scaleMode": "linear", "sizeOnStartupMode": "", "templateSlug": "", - "useExternalSourceFiles": false, "version": "1.0.0", "name": "Bomber Bunny", "description": "This is a game example to show how to do a Bomberman clone with GDevelop. The source can be found directly in GDevelop in the examples list.\n\nControls are:\n\n- arrows and RShift\n- ESDF and LShift\n- IJKL and H\n- 8456 and 0\n- or gamepads\n\nAsset sources:\n\n- Bunnies, bombs and rocks are from Quaternius\n- Cabbages and walls are from Kenney", @@ -102,7 +101,6 @@ "resources": { "resources": [ { - "alwaysLoaded": false, "file": "assets/BombeBonus.png", "kind": "image", "metadata": "", @@ -111,7 +109,6 @@ "userAdded": true }, { - "alwaysLoaded": false, "file": "assets/ClassicLevel.png", "kind": "image", "metadata": "", @@ -120,7 +117,6 @@ "userAdded": false }, { - "alwaysLoaded": false, "file": "assets/EmptyLevel.png", "kind": "image", "metadata": "", @@ -129,7 +125,6 @@ "userAdded": false }, { - "alwaysLoaded": false, "file": "assets/JoueurSelectionMask.png", "kind": "image", "metadata": "{\"localFilePath\":\"assets/JoueurSelectionMask.png\",\"extension\":\".png\"}", @@ -138,7 +133,6 @@ "userAdded": true }, { - "alwaysLoaded": false, "file": "assets/FlammeBonus.png", "kind": "image", "metadata": "", @@ -147,7 +141,6 @@ "userAdded": true }, { - "alwaysLoaded": false, "file": "preview.png", "kind": "image", "metadata": "", @@ -185,7 +178,6 @@ "userAdded": true }, { - "alwaysLoaded": false, "file": "assets/NewSprite.png", "kind": "image", "metadata": "", @@ -226,7 +218,6 @@ "userAdded": false }, { - "alwaysLoaded": false, "file": "assets/Purple.png", "kind": "image", "metadata": "{\"localFilePath\":\"assets/Purple.png\",\"extension\":\".png\"}", @@ -235,7 +226,6 @@ "userAdded": false }, { - "alwaysLoaded": false, "file": "assets/Orange.png", "kind": "image", "metadata": "{\"localFilePath\":\"assets/Orange.png\",\"extension\":\".png\"}", @@ -244,7 +234,6 @@ "userAdded": false }, { - "alwaysLoaded": false, "file": "assets/Pink.png", "kind": "image", "metadata": "{\"localFilePath\":\"assets/Pink.png\",\"extension\":\".png\"}", @@ -253,7 +242,6 @@ "userAdded": false }, { - "alwaysLoaded": false, "file": "assets/ExplosionCentre-Anim5.png", "kind": "image", "metadata": "{\"extension\":\".png\"}", @@ -262,7 +250,6 @@ "userAdded": true }, { - "alwaysLoaded": false, "file": "assets/Bomb.png", "kind": "image", "metadata": "{\"extension\":\".png\"}", @@ -271,7 +258,6 @@ "userAdded": true }, { - "alwaysLoaded": false, "file": "assets/SmoothParticle.png", "kind": "image", "metadata": "", @@ -287,7 +273,6 @@ "userAdded": true }, { - "alwaysLoaded": false, "file": "assets/Soil2.png", "kind": "image", "metadata": "", @@ -296,7 +281,6 @@ "userAdded": true }, { - "alwaysLoaded": false, "file": "assets/New image.png", "kind": "image", "metadata": "{\"extension\":\".png\",\"pskl\":{},\"localFilePath\":\"assets/New image.png\"}", @@ -305,7 +289,6 @@ "userAdded": true }, { - "alwaysLoaded": false, "file": "assets/BlueBunnyIcon.png", "kind": "image", "metadata": "", @@ -314,7 +297,6 @@ "userAdded": true }, { - "alwaysLoaded": false, "file": "assets/PurpleBunnyIcon.png", "kind": "image", "metadata": "", @@ -323,7 +305,6 @@ "userAdded": true }, { - "alwaysLoaded": false, "file": "assets/OrangeBunnyIcon.png", "kind": "image", "metadata": "", @@ -332,7 +313,6 @@ "userAdded": true }, { - "alwaysLoaded": false, "file": "assets/PinkBunnyIcon.png", "kind": "image", "metadata": "", @@ -348,7 +328,6 @@ "userAdded": true }, { - "alwaysLoaded": false, "file": "assets/New image.png", "kind": "image", "metadata": "", @@ -357,7 +336,6 @@ "userAdded": true }, { - "alwaysLoaded": false, "file": "assets/SoilBorder.png", "kind": "image", "metadata": "", @@ -366,7 +344,6 @@ "userAdded": true }, { - "alwaysLoaded": false, "file": "assets/SoilCorner.png", "kind": "image", "metadata": "", @@ -375,7 +352,6 @@ "userAdded": false }, { - "alwaysLoaded": false, "file": "assets/NewObject.png", "kind": "image", "metadata": "{\"extension\":\".png\"}", @@ -865,8 +841,11 @@ ], "content": { "centerLocation": "ModelOrigin", + "crossfadeDuration": 0, "depth": 120, "height": 120, + "isCastingShadow": false, + "isReceivingShadow": false, "keepAspectRatio": true, "materialType": "StandardWithoutMetalness", "modelResourceName": "assets\\BlueBunny.glb", @@ -1139,8 +1118,11 @@ ], "content": { "centerLocation": "ModelOrigin", + "crossfadeDuration": 0, "depth": 120, "height": 120, + "isCastingShadow": false, + "isReceivingShadow": false, "keepAspectRatio": true, "materialType": "StandardWithoutMetalness", "modelResourceName": "assets\\PurpleBunny.glb", @@ -1413,8 +1395,11 @@ ], "content": { "centerLocation": "ModelOrigin", + "crossfadeDuration": 0, "depth": 120, "height": 120, + "isCastingShadow": false, + "isReceivingShadow": false, "keepAspectRatio": true, "materialType": "StandardWithoutMetalness", "modelResourceName": "assets\\OrangeBunny.glb", @@ -1687,8 +1672,11 @@ ], "content": { "centerLocation": "ModelOrigin", + "crossfadeDuration": 0, "depth": 120, "height": 120, + "isCastingShadow": false, + "isReceivingShadow": false, "keepAspectRatio": true, "materialType": "StandardWithoutMetalness", "modelResourceName": "assets\\PinkBunny.glb", @@ -1908,8 +1896,11 @@ ], "content": { "centerLocation": "ObjectCenter", + "crossfadeDuration": 0, "depth": 82.77, "height": 60, + "isCastingShadow": false, + "isReceivingShadow": false, "keepAspectRatio": false, "materialType": "StandardWithoutMetalness", "modelResourceName": "Bomb.glb", @@ -2110,7 +2101,9 @@ "text": "Score", "font": "", "textAlignment": "", + "verticalTextAlignment": "top", "characterSize": 20, + "lineHeight": 0, "color": "26;56;46" } }, @@ -2320,8 +2313,11 @@ ], "content": { "centerLocation": "ObjectCenter", + "crossfadeDuration": 0, "depth": 40, "height": 60, + "isCastingShadow": false, + "isReceivingShadow": false, "keepAspectRatio": false, "materialType": "StandardWithoutMetalness", "modelResourceName": "assets\\FlashyRock.glb", @@ -2348,8 +2344,11 @@ ], "content": { "centerLocation": "ObjectCenter", + "crossfadeDuration": 0, "depth": 60, "height": 60, + "isCastingShadow": false, + "isReceivingShadow": false, "keepAspectRatio": false, "materialType": "StandardWithoutMetalness", "modelResourceName": "Cabbage.glb", @@ -2376,8 +2375,11 @@ ], "content": { "centerLocation": "ModelOrigin", + "crossfadeDuration": 0, "depth": 40, "height": 120, + "isCastingShadow": false, + "isReceivingShadow": false, "keepAspectRatio": false, "materialType": "StandardWithoutMetalness", "modelResourceName": "assets\\GreyBlock.glb", @@ -2393,6 +2395,7 @@ "assetStoreId": "", "name": "ExplosionParticleEmitter", "type": "ParticleEmitter3D::ParticleEmitter3D", + "variant": "", "variables": [], "effects": [], "behaviors": [], @@ -2474,6 +2477,7 @@ "assetStoreId": "", "name": "UpgradeParticleEmitter", "type": "ParticleEmitter3D::ParticleEmitter3D", + "variant": "", "variables": [], "effects": [], "behaviors": [ @@ -5184,7 +5188,9 @@ "text": "arrows\nESDF\nIJKL\n8456\n\nor gamepads", "font": "", "textAlignment": "", + "verticalTextAlignment": "top", "characterSize": 30, + "lineHeight": 0, "color": "157;212;194" } }, @@ -5225,7 +5231,9 @@ "text": "RShift\nLShift\nH\n0", "font": "", "textAlignment": "", + "verticalTextAlignment": "top", "characterSize": 30, + "lineHeight": 0, "color": "157;212;194" } } @@ -5541,7 +5549,6 @@ "externalEvents": [ { "associatedLayout": "Game", - "lastChangeTimeStamp": 0, "name": "Print score", "events": [ { @@ -5595,26 +5602,25 @@ "category": "User interface", "extensionNamespace": "", "fullName": "Button states and effects", + "gdevelopVersion": ">=5.5.222", "helpPath": "/objects/button", "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0ibWRpLWdlc3R1cmUtdGFwLWJ1dHRvbiIgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0IiB2aWV3Qm94PSIwIDAgMjQgMjQiPjxwYXRoIGQ9Ik0xMyA1QzE1LjIxIDUgMTcgNi43OSAxNyA5QzE3IDEwLjUgMTYuMiAxMS43NyAxNSAxMi40NlYxMS4yNEMxNS42MSAxMC42OSAxNiA5Ljg5IDE2IDlDMTYgNy4zNCAxNC42NiA2IDEzIDZTMTAgNy4zNCAxMCA5QzEwIDkuODkgMTAuMzkgMTAuNjkgMTEgMTEuMjRWMTIuNDZDOS44IDExLjc3IDkgMTAuNSA5IDlDOSA2Ljc5IDEwLjc5IDUgMTMgNU0yMCAyMC41QzE5Ljk3IDIxLjMyIDE5LjMyIDIxLjk3IDE4LjUgMjJIMTNDMTIuNjIgMjIgMTIuMjYgMjEuODUgMTIgMjEuNTdMOCAxNy4zN0w4Ljc0IDE2LjZDOC45MyAxNi4zOSA5LjIgMTYuMjggOS41IDE2LjI4SDkuN0wxMiAxOFY5QzEyIDguNDUgMTIuNDUgOCAxMyA4UzE0IDguNDUgMTQgOVYxMy40N0wxNS4yMSAxMy42TDE5LjE1IDE1Ljc5QzE5LjY4IDE2LjAzIDIwIDE2LjU2IDIwIDE3LjE0VjIwLjVNMjAgMkg0QzIuOSAyIDIgMi45IDIgNFYxMkMyIDEzLjExIDIuOSAxNCA0IDE0SDhWMTJMNCAxMkw0IDRIMjBMMjAgMTJIMThWMTRIMjBWMTMuOTZMMjAuMDQgMTRDMjEuMTMgMTQgMjIgMTMuMDkgMjIgMTJWNEMyMiAyLjkgMjEuMTEgMiAyMCAyWiIgLz48L3N2Zz4=", "name": "ButtonStates", "previewIconUrl": "https://asset-resources.gdevelop.io/public-resources/Icons/753a9a794bd885058159b7509f06f5a8f67f72decfccb9a1b0efee26f41c3c4c_gesture-tap-button.svg", - "shortDescription": "Use any object as a button and change appearance during user interaction.", - "version": "1.1.0", + "shortDescription": "Use any object as a button and change appearance according to user interactions.", + "version": "1.3.1", "description": [ - "Use the \"Button states\" behavior to track user interaction with an object, including:", + "Use the \"Button states\" behavior to track user interactions with an object, including:", "", "- Hovered", "- Pressed", "- Clicked", "- Idle", "", - "Add additional behaviors to make a juicy button with animated responses to user input:", + "Add additional behaviors to make juicy buttons with animated responses to user input:", "", "- Size", "- Color", - "- Angle", - "- Opacity", "- Animation", "- Object effects" ], @@ -5636,7 +5642,7 @@ "eventsFunctions": [], "eventsBasedBehaviors": [ { - "description": "Use any object as a button.", + "description": "Use objects as buttons.", "fullName": "Button states", "name": "ButtonFSM", "objectType": "", @@ -5644,7 +5650,7 @@ { "fullName": "", "functionType": "Action", - "name": "doStepPostEvents", + "name": "doStepPreEvents", "sentence": "", "events": [ { @@ -5673,11 +5679,10 @@ "conditions": [ { "type": { - "value": "ButtonStates::ButtonFSM::PropertyState" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "State", "=", "\"Validated\"" ] @@ -5686,11 +5691,10 @@ "actions": [ { "type": { - "value": "ButtonStates::ButtonFSM::SetPropertyState" + "value": "SetStringVariable" }, "parameters": [ - "Object", - "Behavior", + "State", "=", "\"Idle\"" ] @@ -5724,12 +5728,12 @@ "actions": [ { "type": { - "value": "ButtonStates::ButtonFSM::SetPropertyMouseIsInside" + "value": "SetBooleanVariable" }, "parameters": [ - "Object", - "Behavior", - "no" + "MouseIsInside", + "False", + "" ] } ] @@ -5739,11 +5743,12 @@ "conditions": [ { "type": { - "value": "ButtonStates::ButtonFSM::PropertyShouldCheckHovering" + "value": "BooleanVariable" }, "parameters": [ - "Object", - "Behavior" + "ShouldCheckHovering", + "True", + "" ] }, { @@ -5760,12 +5765,12 @@ "actions": [ { "type": { - "value": "ButtonStates::ButtonFSM::SetPropertyMouseIsInside" + "value": "SetBooleanVariable" }, "parameters": [ - "Object", - "Behavior", - "yes" + "MouseIsInside", + "True", + "" ] } ] @@ -5788,12 +5793,12 @@ "actions": [ { "type": { - "value": "ButtonStates::ButtonFSM::SetPropertyTouchIsInside" + "value": "SetBooleanVariable" }, "parameters": [ - "Object", - "Behavior", - "no" + "TouchIsInside", + "False", + "" ] } ] @@ -5803,11 +5808,10 @@ "conditions": [ { "type": { - "value": "ButtonStates::ButtonFSM::PropertyTouchId" + "value": "NumberVariable" }, "parameters": [ - "Object", - "Behavior", + "TouchId", "!=", "0" ] @@ -5818,20 +5822,20 @@ }, "parameters": [ "Object", - "TouchX(Object.Behavior::PropertyTouchId(), Object.Layer(), 0)", - "TouchY(Object.Behavior::PropertyTouchId(), Object.Layer(), 0)" + "TouchX(TouchId, Object.Layer(), 0)", + "TouchY(TouchId, Object.Layer(), 0)" ] } ], "actions": [ { "type": { - "value": "ButtonStates::ButtonFSM::SetPropertyTouchIsInside" + "value": "SetBooleanVariable" }, "parameters": [ - "Object", - "Behavior", - "yes" + "TouchIsInside", + "True", + "" ] } ] @@ -5863,11 +5867,10 @@ "actions": [ { "type": { - "value": "ButtonStates::ButtonFSM::SetPropertyIndex" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "Index", "=", "0" ] @@ -5889,31 +5892,30 @@ }, "parameters": [ "Object", - "TouchX(StartedTouchOrMouseId(Object.Behavior::PropertyIndex()), Object.Layer(), 0)", - "TouchY(StartedTouchOrMouseId(Object.Behavior::PropertyIndex()), Object.Layer(), 0)" + "TouchX(StartedTouchOrMouseId(Index), Object.Layer(), 0)", + "TouchY(StartedTouchOrMouseId(Index), Object.Layer(), 0)" ] } ], "actions": [ { "type": { - "value": "ButtonStates::ButtonFSM::SetPropertyTouchId" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "TouchId", "=", - "StartedTouchOrMouseId(Object.Behavior::PropertyIndex())" + "StartedTouchOrMouseId(Index)" ] }, { "type": { - "value": "ButtonStates::ButtonFSM::SetPropertyTouchIsInside" + "value": "SetBooleanVariable" }, "parameters": [ - "Object", - "Behavior", - "yes" + "TouchIsInside", + "True", + "" ] } ], @@ -5929,22 +5931,20 @@ "subInstructions": [ { "type": { - "value": "ButtonStates::ButtonFSM::PropertyState" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "State", "=", "\"Hovered\"" ] }, { "type": { - "value": "ButtonStates::ButtonFSM::PropertyState" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "State", "=", "\"Idle\"" ] @@ -5955,11 +5955,10 @@ "actions": [ { "type": { - "value": "ButtonStates::ButtonFSM::SetPropertyState" + "value": "SetStringVariable" }, "parameters": [ - "Object", - "Behavior", + "State", "=", "\"PressedInside\"" ] @@ -5974,11 +5973,10 @@ "actions": [ { "type": { - "value": "ButtonStates::ButtonFSM::SetPropertyIndex" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "Index", "+", "1" ] @@ -6007,20 +6005,20 @@ { "type": { "inverted": true, - "value": "ButtonStates::ButtonFSM::PropertyMouseIsInside" + "value": "BooleanVariable" }, "parameters": [ - "Object", - "Behavior" + "MouseIsInside", + "True", + "" ] }, { "type": { - "value": "ButtonStates::ButtonFSM::PropertyState" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "State", "=", "\"Hovered\"" ] @@ -6029,11 +6027,10 @@ "actions": [ { "type": { - "value": "ButtonStates::ButtonFSM::SetPropertyState" + "value": "SetStringVariable" }, "parameters": [ - "Object", - "Behavior", + "State", "=", "\"Idle\"" ] @@ -6045,20 +6042,20 @@ "conditions": [ { "type": { - "value": "ButtonStates::ButtonFSM::PropertyMouseIsInside" + "value": "BooleanVariable" }, "parameters": [ - "Object", - "Behavior" + "MouseIsInside", + "True", + "" ] }, { "type": { - "value": "ButtonStates::ButtonFSM::PropertyState" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "State", "=", "\"Idle\"" ] @@ -6067,11 +6064,10 @@ "actions": [ { "type": { - "value": "ButtonStates::ButtonFSM::SetPropertyState" + "value": "SetStringVariable" }, "parameters": [ - "Object", - "Behavior", + "State", "=", "\"Hovered\"" ] @@ -6084,20 +6080,20 @@ { "type": { "inverted": true, - "value": "ButtonStates::ButtonFSM::PropertyTouchIsInside" + "value": "BooleanVariable" }, "parameters": [ - "Object", - "Behavior" + "TouchIsInside", + "True", + "" ] }, { "type": { - "value": "ButtonStates::ButtonFSM::PropertyState" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "State", "=", "\"PressedInside\"" ] @@ -6106,11 +6102,10 @@ "actions": [ { "type": { - "value": "ButtonStates::ButtonFSM::SetPropertyState" + "value": "SetStringVariable" }, "parameters": [ - "Object", - "Behavior", + "State", "=", "\"PressedOutside\"" ] @@ -6122,20 +6117,20 @@ "conditions": [ { "type": { - "value": "ButtonStates::ButtonFSM::PropertyTouchIsInside" + "value": "BooleanVariable" }, "parameters": [ - "Object", - "Behavior" + "TouchIsInside", + "True", + "" ] }, { "type": { - "value": "ButtonStates::ButtonFSM::PropertyState" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "State", "=", "\"PressedOutside\"" ] @@ -6144,11 +6139,10 @@ "actions": [ { "type": { - "value": "ButtonStates::ButtonFSM::SetPropertyState" + "value": "SetStringVariable" }, "parameters": [ - "Object", - "Behavior", + "State", "=", "\"PressedInside\"" ] @@ -6176,18 +6170,17 @@ }, "parameters": [ "", - "Object.Behavior::PropertyTouchId()" + "TouchId" ] } ], "actions": [ { "type": { - "value": "ButtonStates::ButtonFSM::SetPropertyTouchId" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "TouchId", "=", "0" ] @@ -6199,11 +6192,10 @@ "conditions": [ { "type": { - "value": "ButtonStates::ButtonFSM::PropertyState" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "State", "=", "\"PressedInside\"" ] @@ -6212,11 +6204,10 @@ "actions": [ { "type": { - "value": "ButtonStates::ButtonFSM::SetPropertyState" + "value": "SetStringVariable" }, "parameters": [ - "Object", - "Behavior", + "State", "=", "\"Validated\"" ] @@ -6229,11 +6220,10 @@ { "type": { "inverted": true, - "value": "ButtonStates::ButtonFSM::PropertyState" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "State", "=", "\"PressedInside\"" ] @@ -6241,11 +6231,10 @@ { "type": { "inverted": true, - "value": "ButtonStates::ButtonFSM::PropertyState" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "State", "=", "\"Validated\"" ] @@ -6254,11 +6243,10 @@ "actions": [ { "type": { - "value": "ButtonStates::ButtonFSM::SetPropertyState" + "value": "SetStringVariable" }, "parameters": [ - "Object", - "Behavior", + "State", "=", "\"Idle\"" ] @@ -6341,22 +6329,20 @@ "actions": [ { "type": { - "value": "ButtonStates::ButtonFSM::SetPropertyState" + "value": "SetStringVariable" }, "parameters": [ - "Object", - "Behavior", + "State", "=", "\"Idle\"" ] }, { "type": { - "value": "ButtonStates::ButtonFSM::SetPropertyTouchId" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "TouchId", "=", "0" ] @@ -6391,11 +6377,10 @@ "conditions": [ { "type": { - "value": "ButtonStates::ButtonFSM::PropertyState" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "State", "=", "\"Idle\"" ] @@ -6440,11 +6425,10 @@ "conditions": [ { "type": { - "value": "ButtonStates::ButtonFSM::PropertyState" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "State", "=", "\"Validated\"" ] @@ -6489,11 +6473,10 @@ "conditions": [ { "type": { - "value": "ButtonStates::ButtonFSM::PropertyState" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "State", "=", "\"Hovered\"" ] @@ -6538,11 +6521,10 @@ "conditions": [ { "type": { - "value": "ButtonStates::ButtonFSM::PropertyState" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "State", "=", "\"Hovered\"" ] @@ -6564,11 +6546,10 @@ "conditions": [ { "type": { - "value": "ButtonStates::ButtonFSM::PropertyState" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "State", "=", "\"PressedOutside\"" ] @@ -6613,11 +6594,10 @@ "conditions": [ { "type": { - "value": "ButtonStates::ButtonFSM::PropertyState" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "State", "=", "\"PressedInside\"" ] @@ -6662,11 +6642,10 @@ "conditions": [ { "type": { - "value": "ButtonStates::ButtonFSM::PropertyState" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "State", "=", "\"PressedOutside\"" ] @@ -6715,7 +6694,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "Object.Behavior::PropertyTouchId()" + "TouchId" ] } ] @@ -6746,8 +6725,6 @@ "type": "Boolean", "label": "", "description": "Should check hovering", - "group": "", - "extraInformation": [], "hidden": true, "name": "ShouldCheckHovering" }, @@ -6755,14 +6732,27 @@ "value": "Idle", "type": "Choice", "label": "State", - "description": "", - "group": "", - "extraInformation": [ - "Idle", - "Hovered", - "PressedInside", - "PressedOutside", - "Validated" + "choices": [ + { + "label": "Idle", + "value": "Idle" + }, + { + "label": "Hovered", + "value": "Hovered" + }, + { + "label": "PressedInside", + "value": "PressedInside" + }, + { + "label": "PressedOutside", + "value": "PressedOutside" + }, + { + "label": "Validated", + "value": "Validated" + } ], "hidden": true, "name": "State" @@ -6771,9 +6761,6 @@ "value": "0", "type": "Number", "label": "Touch id", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "TouchId" }, @@ -6781,9 +6768,6 @@ "value": "", "type": "Boolean", "label": "Touch is inside", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "TouchIsInside" }, @@ -6791,9 +6775,6 @@ "value": "", "type": "Boolean", "label": "Mouse is inside", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "MouseIsInside" }, @@ -6801,9 +6782,6 @@ "value": "", "type": "Number", "label": "", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "Index" } @@ -6833,7 +6811,7 @@ "parameters": [ "Object", "Effect", - "Object.Behavior::PropertyIdleEffect()", + "IdleEffect", "yes" ] }, @@ -6844,7 +6822,7 @@ "parameters": [ "Object", "Effect", - "Object.Behavior::PropertyFocusedEffect()", + "FocusedEffect", "no" ] }, @@ -6855,7 +6833,7 @@ "parameters": [ "Object", "Effect", - "Object.Behavior::PropertyPressedEffect()", + "PressedEffect", "no" ] } @@ -6903,7 +6881,7 @@ "parameters": [ "Object", "Effect", - "Object.Behavior::PropertyIdleEffect()", + "IdleEffect", "no" ] }, @@ -6914,7 +6892,7 @@ "parameters": [ "Object", "Effect", - "Object.Behavior::PropertyFocusedEffect()", + "FocusedEffect", "no" ] }, @@ -6925,7 +6903,7 @@ "parameters": [ "Object", "Effect", - "Object.Behavior::PropertyPressedEffect()", + "PressedEffect", "no" ] } @@ -6936,11 +6914,10 @@ "conditions": [ { "type": { - "value": "ButtonStates::ButtonObjectEffects::PropertyIdleEffect" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "IdleEffect", "!=", "\"\"" ] @@ -6964,7 +6941,7 @@ "parameters": [ "Object", "Effect", - "Object.Behavior::PropertyIdleEffect()", + "IdleEffect", "yes" ] } @@ -6975,11 +6952,10 @@ "conditions": [ { "type": { - "value": "ButtonStates::ButtonObjectEffects::PropertyFocusedEffect" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "FocusedEffect", "!=", "\"\"" ] @@ -7003,7 +6979,7 @@ "parameters": [ "Object", "Effect", - "Object.Behavior::PropertyFocusedEffect()", + "FocusedEffect", "yes" ] } @@ -7014,11 +6990,10 @@ "conditions": [ { "type": { - "value": "ButtonStates::ButtonObjectEffects::PropertyPressedEffect" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "PressedEffect", "!=", "\"\"" ] @@ -7042,7 +7017,7 @@ "parameters": [ "Object", "Effect", - "Object.Behavior::PropertyPressedEffect()", + "PressedEffect", "yes" ] } @@ -7066,6 +7041,246 @@ } ], "objectGroups": [] + }, + { + "description": "the idle state effect of the object.", + "fullName": "Idle state effect", + "functionType": "ExpressionAndCondition", + "group": "Button object effects configuration", + "name": "IdleEffect", + "sentence": "the idle state effect", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnString" + }, + "parameters": [ + "IdleEffect" + ] + } + ] + } + ], + "expressionType": { + "type": "string" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ButtonStates::ButtonObjectEffects", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "IdleEffect", + "name": "SetIdleEffect", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "IdleEffect", + "=", + "Value" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ButtonStates::ButtonObjectEffects", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "the focused state effect of the object. The state is Focused when the button is hovered or held outside.", + "fullName": "Focused state effect", + "functionType": "ExpressionAndCondition", + "group": "Button object effects configuration", + "name": "FocusedEffect", + "sentence": "the focused state effect", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnString" + }, + "parameters": [ + "FocusedEffect" + ] + } + ] + } + ], + "expressionType": { + "type": "string" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ButtonStates::ButtonObjectEffects", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "FocusedEffect", + "name": "SetFocusedEffect", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "FocusedEffect", + "=", + "Value" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ButtonStates::ButtonObjectEffects", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "the pressed state effect of the object.", + "fullName": "Pressed state effect", + "functionType": "ExpressionAndCondition", + "group": "Button object effects configuration", + "name": "PressedEffect", + "sentence": "the pressed state effect", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnString" + }, + "parameters": [ + "PressedEffect" + ] + } + ] + } + ], + "expressionType": { + "type": "string" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ButtonStates::ButtonObjectEffects", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "PressedEffect", + "name": "SetPressedEffect", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "PressedEffect", + "=", + "Value" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ButtonStates::ButtonObjectEffects", + "type": "behavior" + } + ], + "objectGroups": [] } ], "propertyDescriptors": [ @@ -7073,31 +7288,27 @@ "value": "", "type": "Behavior", "label": "Button states", - "description": "", - "group": "", "extraInformation": [ "ButtonStates::ButtonFSM" ], + "choices": [], "name": "ButtonFSM" }, { "value": "", "type": "Behavior", "label": "Effect capability", - "description": "", - "group": "", "extraInformation": [ "EffectCapability::EffectBehavior" ], + "choices": [], "name": "Effect" }, { "value": "", "type": "String", "label": "Idle state effect", - "description": "", "group": "Effects", - "extraInformation": [], "name": "IdleEffect" }, { @@ -7106,26 +7317,23 @@ "label": "Focused state effect", "description": "The state is Focused when the button is hovered or held outside.", "group": "Effects", - "extraInformation": [], "name": "FocusedEffect" }, { "value": "", "type": "String", "label": "Pressed state effect", - "description": "", "group": "Effects", - "extraInformation": [], "name": "PressedEffect" } ], "sharedPropertyDescriptors": [] }, { - "description": "Change the current animation number of a button according to their state.", - "fullName": "Button animation (number)", - "name": "ButtonAnimationNumber", - "objectType": "Sprite", + "description": "Change the animation of buttons according to their state.", + "fullName": "Button animation", + "name": "ButtonAnimationName", + "objectType": "", "eventsFunctions": [ { "fullName": "", @@ -7139,13 +7347,13 @@ "actions": [ { "type": { - "value": "AnimatableCapability::AnimatableBehavior::SetIndex" + "value": "AnimatableCapability::AnimatableBehavior::SetName" }, "parameters": [ "Object", "Animation", "=", - "Object.Behavior::PropertyIdleAnimation()" + "IdleAnimationName" ] } ] @@ -7155,13 +7363,12 @@ { "description": "Object", "name": "Object", - "supplementaryInformation": "Sprite", "type": "object" }, { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "ButtonStates::ButtonAnimationNumber", + "supplementaryInformation": "ButtonStates::ButtonAnimationName", "type": "behavior" } ], @@ -7178,7 +7385,7 @@ "colorG": 176, "colorR": 74, "creationTime": 0, - "name": "States", + "name": "Change based on state", "source": "", "type": "BuiltinCommonInstructions::Group", "events": [ @@ -7199,13 +7406,13 @@ "actions": [ { "type": { - "value": "AnimatableCapability::AnimatableBehavior::SetIndex" + "value": "AnimatableCapability::AnimatableBehavior::SetName" }, "parameters": [ "Object", "Animation", "=", - "Object.Behavior::PropertyIdleAnimation()" + "IdleAnimationName" ] } ] @@ -7227,13 +7434,13 @@ "actions": [ { "type": { - "value": "AnimatableCapability::AnimatableBehavior::SetIndex" + "value": "AnimatableCapability::AnimatableBehavior::SetName" }, "parameters": [ "Object", "Animation", "=", - "Object.Behavior::PropertyFocusedAnimation()" + "FocusedAnimationName" ] } ] @@ -7255,13 +7462,13 @@ "actions": [ { "type": { - "value": "AnimatableCapability::AnimatableBehavior::SetIndex" + "value": "AnimatableCapability::AnimatableBehavior::SetName" }, "parameters": [ "Object", "Animation", "=", - "Object.Behavior::PropertyPressedAnimation()" + "PressedAnimationName" ] } ] @@ -7274,74 +7481,63 @@ { "description": "Object", "name": "Object", - "supplementaryInformation": "Sprite", "type": "object" }, { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "ButtonStates::ButtonAnimationNumber", + "supplementaryInformation": "ButtonStates::ButtonAnimationName", "type": "behavior" } ], "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "", - "type": "Behavior", - "label": "Button states", - "description": "", - "group": "", - "extraInformation": [ - "ButtonStates::ButtonFSM" - ], - "name": "ButtonFSM" - }, - { - "value": "0", - "type": "Number", - "unit": "Dimensionless", - "label": "Idle state animation number", - "description": "", - "group": "Animation", - "extraInformation": [], - "name": "IdleAnimation" }, { - "value": "1", - "type": "Number", - "unit": "Dimensionless", - "label": "Focused state animation number", - "description": "", - "group": "Animation", - "extraInformation": [], - "name": "FocusedAnimation" + "description": "the idle state animation name of the object.", + "fullName": "Idle state animation name", + "functionType": "ExpressionAndCondition", + "group": "Button animation configuration", + "name": "IdleAnimationName", + "sentence": "the idle state animation name", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnString" + }, + "parameters": [ + "IdleAnimationName" + ] + } + ] + } + ], + "expressionType": { + "type": "string" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ButtonStates::ButtonAnimationName", + "type": "behavior" + } + ], + "objectGroups": [] }, - { - "value": "2", - "type": "Number", - "unit": "Dimensionless", - "label": "Pressed state animation number", - "description": "", - "group": "Animation", - "extraInformation": [], - "name": "PressedAnimation" - } - ], - "sharedPropertyDescriptors": [] - }, - { - "description": "Change the animation of buttons according to their state.", - "fullName": "Button animation (name)", - "name": "ButtonAnimationName", - "objectType": "Sprite", - "eventsFunctions": [ { "fullName": "", - "functionType": "Action", - "name": "onCreated", + "functionType": "ActionWithOperator", + "getterName": "IdleAnimationName", + "name": "SetIdleAnimationName", "sentence": "", "events": [ { @@ -7350,13 +7546,12 @@ "actions": [ { "type": { - "value": "AnimatableCapability::AnimatableBehavior::SetName" + "value": "SetStringVariable" }, "parameters": [ - "Object", - "Animation", + "IdleAnimationName", "=", - "Object.Behavior::PropertyIdleAnimationName()" + "Value" ] } ] @@ -7366,7 +7561,47 @@ { "description": "Object", "name": "Object", - "supplementaryInformation": "Sprite", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ButtonStates::ButtonAnimationName", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "the focused state animation name of the object. The state is Focused when the button is hovered or held outside.", + "fullName": "Focused state animation name", + "functionType": "ExpressionAndCondition", + "group": "Button animation configuration", + "name": "FocusedAnimationName", + "sentence": "the focused state animation name", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnString" + }, + "parameters": [ + "FocusedAnimationName" + ] + } + ] + } + ], + "expressionType": { + "type": "string" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", "type": "object" }, { @@ -7380,112 +7615,112 @@ }, { "fullName": "", - "functionType": "Action", - "name": "doStepPreEvents", + "functionType": "ActionWithOperator", + "getterName": "FocusedAnimationName", + "name": "SetFocusedAnimationName", "sentence": "", "events": [ { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Change based on state", - "source": "", - "type": "BuiltinCommonInstructions::Group", - "events": [ + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "ButtonStates::ButtonFSM::IsIdle" - }, - "parameters": [ - "Object", - "ButtonFSM", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "AnimatableCapability::AnimatableBehavior::SetName" - }, - "parameters": [ - "Object", - "Animation", - "=", - "Object.Behavior::PropertyIdleAnimationName()" - ] - } + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "FocusedAnimationName", + "=", + "Value" ] - }, + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ButtonStates::ButtonAnimationName", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "the pressed state animation name of the object.", + "fullName": "Pressed state animation name", + "functionType": "ExpressionAndCondition", + "group": "Button animation configuration", + "name": "PressedAnimationName", + "sentence": "the pressed state animation name", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "ButtonStates::ButtonFSM::IsFocused" - }, - "parameters": [ - "Object", - "ButtonFSM", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "AnimatableCapability::AnimatableBehavior::SetName" - }, - "parameters": [ - "Object", - "Animation", - "=", - "Object.Behavior::PropertyFocusedAnimationName()" - ] - } + "type": { + "value": "SetReturnString" + }, + "parameters": [ + "PressedAnimationName" ] - }, + } + ] + } + ], + "expressionType": { + "type": "string" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ButtonStates::ButtonAnimationName", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "PressedAnimationName", + "name": "SetPressedAnimationName", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "ButtonStates::ButtonFSM::IsPressed" - }, - "parameters": [ - "Object", - "ButtonFSM", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "AnimatableCapability::AnimatableBehavior::SetName" - }, - "parameters": [ - "Object", - "Animation", - "=", - "Object.Behavior::PropertyPressedAnimationName()" - ] - } + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "PressedAnimationName", + "=", + "Value" ] } - ], - "parameters": [] + ] } ], "parameters": [ { "description": "Object", "name": "Object", - "supplementaryInformation": "Sprite", "type": "object" }, { @@ -7499,42 +7734,46 @@ } ], "propertyDescriptors": [ + { + "value": "", + "type": "Behavior", + "label": "Animatable capability", + "extraInformation": [ + "AnimatableCapability::AnimatableBehavior" + ], + "choices": [], + "name": "Animation" + }, { "value": "", "type": "Behavior", "label": "Button states", - "description": "", - "group": "", "extraInformation": [ "ButtonStates::ButtonFSM" ], + "choices": [], "name": "ButtonFSM" }, { "value": "Idle", "type": "String", "label": "Idle state animation name", - "description": "", "group": "Animation", - "extraInformation": [], "name": "IdleAnimationName" }, { "value": "Focused", "type": "String", "label": "Focused state animation name", - "description": "", + "description": "The state is Focused when the button is hovered or held outside.", "group": "Animation", - "extraInformation": [], "name": "FocusedAnimationName" }, { "value": "Pressed", "type": "String", "label": "Pressed state animation name", - "description": "", "group": "Animation", - "extraInformation": [], "name": "PressedAnimationName" } ], @@ -7558,13 +7797,12 @@ "actions": [ { "type": { - "value": "ButtonStates::ButtonObjectEffectTween::SetPropertyEffectValue" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "EffectValue", "=", - "Object.Behavior::PropertyIdleValue()" + "IdleValue" ] } ] @@ -7615,11 +7853,10 @@ }, { "type": { - "value": "ButtonStates::ButtonObjectEffectTween::PropertyPreviousState" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "PreviousState", "!=", "\"Idle\"" ] @@ -7628,11 +7865,10 @@ "actions": [ { "type": { - "value": "ButtonStates::ButtonObjectEffectTween::SetPropertyPreviousState" + "value": "SetStringVariable" }, "parameters": [ - "Object", - "Behavior", + "PreviousState", "=", "\"Idle\"" ] @@ -7644,7 +7880,7 @@ "parameters": [ "Object", "Behavior", - "Object.Behavior::PropertyIdleValue()", + "IdleValue", "" ] } @@ -7671,11 +7907,10 @@ "conditions": [ { "type": { - "value": "ButtonStates::ButtonObjectEffectTween::PropertyPreviousState" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "PreviousState", "=", "\"Idle\"" ] @@ -7684,11 +7919,10 @@ "actions": [ { "type": { - "value": "ButtonStates::ButtonObjectEffectTween::SetPropertyPreviousState" + "value": "SetStringVariable" }, "parameters": [ - "Object", - "Behavior", + "PreviousState", "=", "\"Focused\"" ] @@ -7700,7 +7934,7 @@ "parameters": [ "Object", "Behavior", - "Object.Behavior::PropertyFocusedValue()", + "FocusedValue", "" ] } @@ -7711,11 +7945,10 @@ "conditions": [ { "type": { - "value": "ButtonStates::ButtonObjectEffectTween::PropertyPreviousState" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "PreviousState", "=", "\"Pressed\"" ] @@ -7724,11 +7957,10 @@ "actions": [ { "type": { - "value": "ButtonStates::ButtonObjectEffectTween::SetPropertyPreviousState" + "value": "SetStringVariable" }, "parameters": [ - "Object", - "Behavior", + "PreviousState", "=", "\"Focused\"" ] @@ -7740,7 +7972,7 @@ "parameters": [ "Object", "Behavior", - "Object.Behavior::PropertyFocusedValue()", + "FocusedValue", "" ] } @@ -7763,11 +7995,10 @@ }, { "type": { - "value": "ButtonStates::ButtonAngleTween::PropertyPreviousState" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "PreviousState", "!=", "\"Pressed\"" ] @@ -7776,11 +8007,10 @@ "actions": [ { "type": { - "value": "ButtonStates::ButtonObjectEffectTween::SetPropertyPreviousState" + "value": "SetStringVariable" }, "parameters": [ - "Object", - "Behavior", + "PreviousState", "=", "\"Pressed\"" ] @@ -7792,7 +8022,7 @@ "parameters": [ "Object", "Behavior", - "Object.Behavior::PropertyPressedValue()", + "PressedValue", "" ] } @@ -7815,11 +8045,10 @@ "conditions": [ { "type": { - "value": "ButtonStates::ButtonObjectEffectTween::PropertyTweenState" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "TweenState", "=", "\"FadeIn\"" ] @@ -7833,8 +8062,8 @@ "parameters": [ "Object", "Behavior", - "Object.Behavior::PropertyFadeInDuration()", - "Object.Behavior::PropertyFadeInEasing()", + "FadeInDuration", + "FadeInEasing", "" ] } @@ -7845,11 +8074,10 @@ "conditions": [ { "type": { - "value": "ButtonStates::ButtonObjectEffectTween::PropertyTweenState" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "TweenState", "=", "\"FadeOut\"" ] @@ -7863,8 +8091,8 @@ "parameters": [ "Object", "Behavior", - "Object.Behavior::PropertyFadeOutDuration()", - "Object.Behavior::PropertyFadeOutEasing()", + "FadeOutDuration", + "FadeOutEasing", "" ] } @@ -7942,46 +8170,42 @@ "actions": [ { "type": { - "value": "ButtonStates::ButtonObjectEffectTween::SetPropertyTweenTime" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "TweenTime", "=", "0" ] }, { "type": { - "value": "ButtonStates::ButtonObjectEffectTween::SetPropertyTweenState" + "value": "SetStringVariable" }, "parameters": [ - "Object", - "Behavior", + "TweenState", "=", "\"FadeIn\"" ] }, { "type": { - "value": "ButtonStates::ButtonObjectEffectTween::SetPropertyTweenInitialValue" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "TweenInitialValue", "=", - "Object.Behavior::PropertyEffectValue()" + "EffectValue" ] }, { "type": { - "value": "ButtonStates::ButtonObjectEffectTween::SetPropertyTweenTargetedValue" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "TweenTargetedValue", "=", - "GetArgumentAsNumber(\"Value\")" + "Value" ] } ] @@ -8020,46 +8244,42 @@ "actions": [ { "type": { - "value": "ButtonStates::ButtonObjectEffectTween::SetPropertyTweenTime" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "TweenTime", "=", "0" ] }, { "type": { - "value": "ButtonStates::ButtonObjectEffectTween::SetPropertyTweenState" + "value": "SetStringVariable" }, "parameters": [ - "Object", - "Behavior", + "TweenState", "=", "\"FadeOut\"" ] }, { "type": { - "value": "ButtonStates::ButtonObjectEffectTween::SetPropertyTweenInitialValue" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "TweenInitialValue", "=", - "Object.Behavior::PropertyEffectValue()" + "EffectValue" ] }, { "type": { - "value": "ButtonStates::ButtonObjectEffectTween::SetPropertyTweenTargetedValue" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "TweenTargetedValue", "=", - "GetArgumentAsNumber(\"Value\")" + "Value" ] } ] @@ -8097,37 +8317,34 @@ "conditions": [ { "type": { - "value": "ButtonStates::ButtonObjectEffectTween::PropertyTweenTime" + "value": "NumberVariable" }, "parameters": [ - "Object", - "Behavior", + "TweenTime", "<", - "GetArgumentAsNumber(\"Duration\")" + "Duration" ] } ], "actions": [ { "type": { - "value": "ButtonStates::ButtonObjectEffectTween::SetPropertyTweenTime" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "TweenTime", "+", "Object.Behavior::TimeDelta()" ] }, { "type": { - "value": "ButtonStates::ButtonObjectEffectTween::SetPropertyEffectValue" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "EffectValue", "=", - "Tween::Ease(GetArgumentAsString(\"Easing\"), Object.Behavior::PropertyTweenInitialValue(), Object.Behavior::PropertyTweenTargetedValue(), Object.Behavior::PropertyTweenTime() / GetArgumentAsNumber(\"Duration\"))" + "Tween::Ease(Easing, TweenInitialValue, TweenTargetedValue, TweenTime / Duration)" ] } ] @@ -8137,37 +8354,34 @@ "conditions": [ { "type": { - "value": "ButtonStates::ButtonObjectEffectTween::PropertyTweenTime" + "value": "NumberVariable" }, "parameters": [ - "Object", - "Behavior", + "TweenTime", ">=", - "GetArgumentAsNumber(\"Duration\")" + "Duration" ] } ], "actions": [ { "type": { - "value": "ButtonStates::ButtonObjectEffectTween::SetPropertyTweenState" + "value": "SetStringVariable" }, "parameters": [ - "Object", - "Behavior", + "TweenState", "=", "\"NoTween\"" ] }, { "type": { - "value": "ButtonStates::ButtonObjectEffectTween::SetPropertyEffectValue" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "EffectValue", "=", - "Object.Behavior::PropertyTweenTargetedValue()" + "TweenTargetedValue" ] } ] @@ -8183,9 +8397,9 @@ "parameters": [ "Object", "Effect", - "Object.Behavior::PropertyEffectName()", - "Object.Behavior::PropertyEffectProperty()", - "Object.Behavior::PropertyEffectValue()" + "EffectName", + "EffectProperty", + "EffectValue" ] } ] @@ -8216,264 +8430,55 @@ } ], "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "", - "type": "Behavior", - "label": "Button states", - "description": "", - "group": "", - "extraInformation": [ - "ButtonStates::ButtonFSM" - ], - "name": "ButtonFSM" - }, - { - "value": "", - "type": "Behavior", - "label": "Effect capability", - "description": "", - "group": "", - "extraInformation": [ - "EffectCapability::EffectBehavior" - ], - "name": "Effect" - }, - { - "value": "Effect", - "type": "String", - "label": "Effect name", - "description": "", - "group": "Effect", - "extraInformation": [], - "name": "EffectName" - }, - { - "value": "", - "type": "String", - "label": "Effect property", - "description": "", - "group": "Effect", - "extraInformation": [], - "name": "EffectProperty" - }, - { - "value": "0", - "type": "Number", - "label": "Idle effect property value", - "description": "", - "group": "Value", - "extraInformation": [], - "name": "IdleValue" - }, - { - "value": "0", - "type": "Number", - "label": "Focused effect property value", - "description": "The state is Focused when the button is hovered or held outside.", - "group": "Value", - "extraInformation": [], - "name": "FocusedValue" - }, - { - "value": "0", - "type": "Number", - "label": "Pressed effect property value", - "description": "", - "group": "Value", - "extraInformation": [], - "name": "PressedValue" - }, - { - "value": "easeInOutQuad", - "type": "Choice", - "label": "Fade-in easing", - "description": "", - "group": "Speed", - "extraInformation": [ - "linear", - "easeInQuad", - "easeOutQuad", - "easeInOutQuad", - "easeInCubic", - "easeOutCubic", - "easeInOutCubic", - "easeInQuart", - "easeOutQuart", - "easeInOutQuart", - "easeInQuint", - "easeOutQuint", - "easeInOutQuint", - "easeInOutSine", - "easeInExpo", - "easeOutExpo", - "easeInOutExpo", - "easeInCirc", - "easeOutCirc", - "easeInOutCirc", - "easeOutBounce", - "easeInBack", - "easeOutBack", - "easeInOutBack", - "elastic", - "swingFromTo", - "swingFrom", - "swingTo", - "bounce", - "bouncePast", - "easeFromTo", - "easeFrom", - "easeTo" - ], - "name": "FadeInEasing" - }, - { - "value": "easeInOutQuad", - "type": "Choice", - "label": "Fade-out easing", - "description": "", - "group": "Speed", - "extraInformation": [ - "linear", - "easeInQuad", - "easeOutQuad", - "easeInOutQuad", - "easeInCubic", - "easeOutCubic", - "easeInOutCubic", - "easeInQuart", - "easeOutQuart", - "easeInOutQuart", - "easeInQuint", - "easeOutQuint", - "easeInOutQuint", - "easeInOutSine", - "easeInExpo", - "easeOutExpo", - "easeInOutExpo", - "easeInCirc", - "easeOutCirc", - "easeInOutCirc", - "easeOutBounce", - "easeInBack", - "easeOutBack", - "easeInOutBack", - "elastic", - "swingFromTo", - "swingFrom", - "swingTo", - "bounce", - "bouncePast", - "easeFromTo", - "easeFrom", - "easeTo" - ], - "name": "FadeOutEasing" - }, - { - "value": "0.125", - "type": "Number", - "unit": "Second", - "label": "Fade-in duration", - "description": "", - "group": "Speed", - "extraInformation": [], - "name": "FadeInDuration" - }, - { - "value": "0.5", - "type": "Number", - "unit": "Second", - "label": "Fade-out duration", - "description": "", - "group": "Speed", - "extraInformation": [], - "name": "FadeOutDuration" }, { - "value": "Idle", - "type": "Choice", - "label": "", - "description": "", - "group": "", - "extraInformation": [ - "Idle", - "Focused", - "Pressed" + "description": "the effect name of the object.", + "fullName": "Effect name", + "functionType": "ExpressionAndCondition", + "group": "Button effect tween configuration", + "name": "EffectName", + "sentence": "the effect name", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnString" + }, + "parameters": [ + "EffectName" + ] + } + ] + } ], - "hidden": true, - "name": "PreviousState" - }, - { - "value": "0", - "type": "Number", - "label": "", - "description": "", - "group": "", - "extraInformation": [], - "hidden": true, - "name": "TweenInitialValue" - }, - { - "value": "0", - "type": "Number", - "label": "", - "description": "", - "group": "", - "extraInformation": [], - "hidden": true, - "name": "TweenTargetedValue" - }, - { - "value": "0", - "type": "Number", - "label": "", - "description": "", - "group": "", - "extraInformation": [], - "hidden": true, - "name": "TweenTime" - }, - { - "value": "NoTween", - "type": "Choice", - "label": "", - "description": "", - "group": "", - "extraInformation": [ - "NoTween", - "FadeIn", - "FadeOut" + "expressionType": { + "type": "string" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ButtonStates::ButtonObjectEffectTween", + "type": "behavior" + } ], - "hidden": true, - "name": "TweenState" + "objectGroups": [] }, { - "value": "0", - "type": "Number", - "label": "", - "description": "", - "group": "", - "extraInformation": [], - "hidden": true, - "name": "EffectValue" - } - ], - "sharedPropertyDescriptors": [] - }, - { - "description": "Smoothly resize buttons according to their state.", - "fullName": "Button scale", - "name": "ButtonScaleTween", - "objectType": "Sprite", - "eventsFunctions": [ - { - "fullName": "", - "functionType": "Action", - "name": "onCreated", - "sentence": "", + "description": "the effect parameter of the object. The effect parameter names can be found in the effects tab with the \"Show parameter names\" action of the drop down menu.", + "fullName": "Effect parameter", + "functionType": "ExpressionAndCondition", + "group": "Button effect tween configuration", + "name": "EffectProperty", + "sentence": "the effect parameter", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -8481,273 +8486,101 @@ "actions": [ { "type": { - "value": "ScalableCapability::ScalableBehavior::SetValue" + "value": "SetReturnString" }, "parameters": [ - "Object", - "Scale", - "=", - "Object.Behavior::PropertyIdleScale()" + "EffectProperty" ] } ] } ], + "expressionType": { + "type": "string" + }, "parameters": [ { "description": "Object", "name": "Object", - "supplementaryInformation": "Sprite", "type": "object" }, { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "ButtonStates::ButtonScaleTween", + "supplementaryInformation": "ButtonStates::ButtonObjectEffectTween", "type": "behavior" } ], "objectGroups": [] }, { - "fullName": "", + "description": "Change the effect parameter of the object. The effect parameter names can be found in the effects tab with the \"Show parameter names\" action of the drop down menu.", + "fullName": "Effect parameter", "functionType": "Action", - "name": "doStepPreEvents", - "sentence": "", + "getterName": "EffectName", + "group": "Button effect tween configuration", + "name": "SetEffectProperty", + "sentence": "Change the tweened effect of _PARAM0_ to _PARAM2_ with parameter _PARAM3_", "events": [ { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Change based on state", - "source": "", - "type": "BuiltinCommonInstructions::Group", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "ButtonStates::ButtonFSM::IsIdle" - }, - "parameters": [ - "Object", - "ButtonStatesBehavior", - "" - ] - }, - { - "type": { - "value": "ButtonStates::ButtonScaleTween::PropertyPreviousState" - }, - "parameters": [ - "Object", - "Behavior", - "!=", - "\"Idle\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "ButtonStates::ButtonScaleTween::SetPropertyPreviousState" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "\"Idle\"" - ] - }, - { - "type": { - "value": "ButtonStates::ButtonScaleTween::FadeOut" - }, - "parameters": [ - "Object", - "Behavior", - "Object.Behavior::PropertyIdleScale()", - "" - ] - } - ] - }, + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "ButtonStates::ButtonFSM::IsFocused" - }, - "parameters": [ - "Object", - "ButtonStatesBehavior", - "" - ] - } - ], - "actions": [], - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "ButtonStates::ButtonScaleTween::PropertyPreviousState" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "\"Idle\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "ButtonStates::ButtonScaleTween::SetPropertyPreviousState" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "\"Focused\"" - ] - }, - { - "type": { - "value": "ButtonStates::ButtonScaleTween::FadeIn" - }, - "parameters": [ - "Object", - "Behavior", - "Object.Behavior::PropertyFocusedScale()", - "" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "ButtonStates::ButtonScaleTween::PropertyPreviousState" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "\"Pressed\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "ButtonStates::ButtonScaleTween::SetPropertyPreviousState" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "\"Focused\"" - ] - }, - { - "type": { - "value": "ButtonStates::ButtonScaleTween::FadeOut" - }, - "parameters": [ - "Object", - "Behavior", - "Object.Behavior::PropertyFocusedScale()", - "" - ] - } - ] - } + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "EffectName", + "=", + "NewEffectName" ] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "ButtonStates::ButtonFSM::IsPressed" - }, - "parameters": [ - "Object", - "ButtonStatesBehavior", - "" - ] - }, - { - "type": { - "value": "ButtonStates::ButtonScaleTween::PropertyPreviousState" - }, - "parameters": [ - "Object", - "Behavior", - "!=", - "\"Pressed\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "ButtonStates::ButtonScaleTween::SetPropertyPreviousState" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "\"Pressed\"" - ] - }, - { - "type": { - "value": "ButtonStates::ButtonScaleTween::FadeIn" - }, - "parameters": [ - "Object", - "Behavior", - "Object.Behavior::PropertyPressedScale()", - "" - ] - } + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "EffectProperty", + "=", + "NewPropertyName" ] } - ], - "parameters": [] + ] } ], "parameters": [ { "description": "Object", "name": "Object", - "supplementaryInformation": "Sprite", "type": "object" }, { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "ButtonStates::ButtonScaleTween", + "supplementaryInformation": "ButtonStates::ButtonObjectEffectTween", "type": "behavior" + }, + { + "description": "Effect name", + "name": "NewEffectName", + "type": "string" + }, + { + "description": "Parameter name", + "name": "NewPropertyName", + "type": "string" } ], "objectGroups": [] }, { - "fullName": "Fade in", - "functionType": "Action", - "name": "FadeIn", - "private": true, - "sentence": "_PARAM0_ fade in to _PARAM2_", + "description": "the idle effect parameter value of the object.", + "fullName": "Idle effect parameter value", + "functionType": "ExpressionAndCondition", + "group": "Button effect tween configuration", + "name": "IdleValue", + "sentence": "the idle effect parameter value", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -8755,50 +8588,39 @@ "actions": [ { "type": { - "value": "Tween::AddObjectScaleTween" + "value": "SetReturnNumber" }, "parameters": [ - "Object", - "TweenBehavior", - "\"__ButtonScaleTween.Fade\"", - "GetArgumentAsNumber(\"Value\")", - "GetArgumentAsNumber(\"Value\")", - "Object.Behavior::PropertyFadeInEasing()", - "1000 * Object.Behavior::PropertyFadeInDuration()", - "no", - "yes" + "IdleValue" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", "name": "Object", - "supplementaryInformation": "Sprite", "type": "object" }, { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "ButtonStates::ButtonScaleTween", + "supplementaryInformation": "ButtonStates::ButtonObjectEffectTween", "type": "behavior" - }, - { - "description": "Value", - "name": "Value", - "type": "expression" } ], "objectGroups": [] }, { - "fullName": "Fade out", - "functionType": "Action", - "name": "FadeOut", - "private": true, - "sentence": "_PARAM0_ fade out to _PARAM2_", + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "IdleValue", + "name": "SetIdleValue", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -8806,18 +8628,12 @@ "actions": [ { "type": { - "value": "Tween::AddObjectScaleTween" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "TweenBehavior", - "\"__ButtonScaleTween.Fade\"", - "GetArgumentAsNumber(\"Value\")", - "GetArgumentAsNumber(\"Value\")", - "Object.Behavior::PropertyFadeOutEasing()", - "1000 * Object.Behavior::PropertyFadeOutDuration()", - "no", - "yes" + "IdleValue", + "=", + "Value" ] } ] @@ -8827,261 +8643,123 @@ { "description": "Object", "name": "Object", - "supplementaryInformation": "Sprite", "type": "object" }, { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "ButtonStates::ButtonScaleTween", + "supplementaryInformation": "ButtonStates::ButtonObjectEffectTween", "type": "behavior" - }, - { - "description": "Value", - "name": "Value", - "type": "expression" } ], "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "", - "type": "Behavior", - "label": "Button states behavior (required)", - "description": "", - "group": "", - "extraInformation": [ - "ButtonStates::ButtonFSM" - ], - "name": "ButtonStatesBehavior" - }, - { - "value": "", - "type": "Behavior", - "label": "Tween behavior (required)", - "description": "", - "group": "", - "extraInformation": [ - "Tween::TweenBehavior" - ], - "name": "TweenBehavior" }, { - "value": "0.1", - "type": "Number", - "unit": "Second", - "label": "Fade-in duration", - "description": "", - "group": "Speed", - "extraInformation": [], - "name": "FadeInDuration" - }, - { - "value": "0.2", - "type": "Number", - "unit": "Second", - "label": "Fade-out duration", - "description": "", - "group": "Speed", - "extraInformation": [], - "name": "FadeOutDuration" - }, - { - "value": "1", - "type": "Number", - "unit": "Dimensionless", - "label": "Idle state size scale", - "description": "", - "group": "Size", - "extraInformation": [], - "name": "IdleScale" - }, - { - "value": "1", - "type": "Number", - "unit": "Dimensionless", - "label": "Focused state size scale", - "description": "", - "group": "Size", - "extraInformation": [], - "name": "FocusedScale" - }, - { - "value": "0.95", - "type": "Number", - "unit": "Dimensionless", - "label": "Pressed state size scale", - "description": "", - "group": "Size", - "extraInformation": [], - "name": "PressedScale" - }, - { - "value": "easeInOutQuad", - "type": "Choice", - "label": "Fade-in easing", - "description": "", - "group": "Speed", - "extraInformation": [ - "linear", - "easeInQuad", - "easeOutQuad", - "easeInOutQuad", - "easeInCubic", - "easeOutCubic", - "easeInOutCubic", - "easeInQuart", - "easeOutQuart", - "easeInOutQuart", - "easeInQuint", - "easeOutQuint", - "easeInOutQuint", - "easeInOutSine", - "easeInExpo", - "easeOutExpo", - "easeInOutExpo", - "easeInCirc", - "easeOutCirc", - "easeInOutCirc", - "easeOutBounce", - "easeInBack", - "easeOutBack", - "easeInOutBack", - "elastic", - "swingFromTo", - "swingFrom", - "swingTo", - "bounce", - "bouncePast", - "easeFromTo", - "easeFrom", - "easeTo" + "description": "the focused effect parameter value of the object. The state is Focused when the button is hovered or held outside.", + "fullName": "Focused effect parameter value", + "functionType": "ExpressionAndCondition", + "group": "Button effect tween configuration", + "name": "FocusedValue", + "sentence": "the focused effect parameter value", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "FocusedValue" + ] + } + ] + } ], - "name": "FadeInEasing" - }, - { - "value": "easeInOutQuad", - "type": "Choice", - "label": "Fade-out easing", - "description": "", - "group": "Speed", - "extraInformation": [ - "linear", - "easeInQuad", - "easeOutQuad", - "easeInOutQuad", - "easeInCubic", - "easeOutCubic", - "easeInOutCubic", - "easeInQuart", - "easeOutQuart", - "easeInOutQuart", - "easeInQuint", - "easeOutQuint", - "easeInOutQuint", - "easeInOutSine", - "easeInExpo", - "easeOutExpo", - "easeInOutExpo", - "easeInCirc", - "easeOutCirc", - "easeInOutCirc", - "easeOutBounce", - "easeInBack", - "easeOutBack", - "easeInOutBack", - "elastic", - "swingFromTo", - "swingFrom", - "swingTo", - "bounce", - "bouncePast", - "easeFromTo", - "easeFrom", - "easeTo" + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ButtonStates::ButtonObjectEffectTween", + "type": "behavior" + } ], - "name": "FadeOutEasing" + "objectGroups": [] }, - { - "value": "Idle", - "type": "Choice", - "label": "", - "description": "", - "group": "", - "extraInformation": [ - "Idle", - "Focused", - "Pressed" - ], - "hidden": true, - "name": "PreviousState" - } - ], - "sharedPropertyDescriptors": [] - }, - { - "description": "Smoothly rotate buttons according to their state.", - "fullName": "Button angle tween", - "name": "ButtonAngleTween", - "objectType": "", - "eventsFunctions": [ { "fullName": "", - "functionType": "Action", - "name": "doStepPostEvents", + "functionType": "ActionWithOperator", + "getterName": "FocusedValue", + "name": "SetFocusedValue", "sentence": "", "events": [ - { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 - }, - "comment": "Angle can't be changed in onCreate." - }, { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "conditions": [], + "actions": [ { "type": { - "value": "ButtonStates::ButtonAngleTween::PropertyHasJustBeenCreated" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior" + "FocusedValue", + "=", + "Value" ] } - ], + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ButtonStates::ButtonObjectEffectTween", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "the pressed effect parameter value of the object.", + "fullName": "Pressed effect parameter value", + "functionType": "ExpressionAndCondition", + "group": "Button effect tween configuration", + "name": "PressedValue", + "sentence": "the pressed effect parameter value", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], "actions": [ { "type": { - "value": "ButtonStates::ButtonAngleTween::SetPropertyHasJustBeenCreated" - }, - "parameters": [ - "Object", - "Behavior", - "no" - ] - }, - { - "type": { - "value": "SetAngle" + "value": "SetReturnNumber" }, "parameters": [ - "Object", - "=", - "Object.Behavior::PropertyIdleAngle()" + "PressedValue" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -9091,7 +8769,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "ButtonStates::ButtonAngleTween", + "supplementaryInformation": "ButtonStates::ButtonObjectEffectTween", "type": "behavior" } ], @@ -9099,219 +8777,26 @@ }, { "fullName": "", - "functionType": "Action", - "name": "doStepPreEvents", + "functionType": "ActionWithOperator", + "getterName": "PressedValue", + "name": "SetPressedValue", "sentence": "", "events": [ { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "States", - "source": "", - "type": "BuiltinCommonInstructions::Group", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "ButtonStates::ButtonFSM::IsIdle" - }, - "parameters": [ - "Object", - "ButtonFSM", - "" - ] - }, - { - "type": { - "value": "ButtonStates::ButtonAngleTween::PropertyPreviousState" - }, - "parameters": [ - "Object", - "Behavior", - "!=", - "\"Idle\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "ButtonStates::ButtonAngleTween::SetPropertyPreviousState" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "\"Idle\"" - ] - }, - { - "type": { - "value": "ButtonStates::ButtonAngleTween::FadeOut" - }, - "parameters": [ - "Object", - "Behavior", - "Object.Behavior::PropertyIdleAngle()", - "" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "ButtonStates::ButtonFSM::IsFocused" - }, - "parameters": [ - "Object", - "ButtonFSM", - "" - ] - } - ], - "actions": [], - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "ButtonStates::ButtonAngleTween::PropertyPreviousState" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "\"Idle\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "ButtonStates::ButtonAngleTween::SetPropertyPreviousState" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "\"Focused\"" - ] - }, - { - "type": { - "value": "ButtonStates::ButtonAngleTween::FadeIn" - }, - "parameters": [ - "Object", - "Behavior", - "Object.Behavior::PropertyFocusedAngle()", - "" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "ButtonStates::ButtonAngleTween::PropertyPreviousState" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "\"Pressed\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "ButtonStates::ButtonAngleTween::SetPropertyPreviousState" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "\"Focused\"" - ] - }, - { - "type": { - "value": "ButtonStates::ButtonAngleTween::FadeOut" - }, - "parameters": [ - "Object", - "Behavior", - "Object.Behavior::PropertyFocusedAngle()", - "" - ] - } - ] - } - ] - }, + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "ButtonStates::ButtonFSM::IsPressed" - }, - "parameters": [ - "Object", - "ButtonFSM", - "" - ] - }, - { - "type": { - "value": "ButtonStates::ButtonAngleTween::PropertyPreviousState" - }, - "parameters": [ - "Object", - "Behavior", - "!=", - "\"Pressed\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "ButtonStates::ButtonAngleTween::SetPropertyPreviousState" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "\"Pressed\"" - ] - }, - { - "type": { - "value": "ButtonStates::ButtonAngleTween::FadeIn" - }, - "parameters": [ - "Object", - "Behavior", - "Object.Behavior::PropertyPressedAngle()", - "" - ] - } + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "PressedValue", + "=", + "Value" ] } - ], - "parameters": [] + ] } ], "parameters": [ @@ -9323,18 +8808,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "ButtonStates::ButtonAngleTween", + "supplementaryInformation": "ButtonStates::ButtonObjectEffectTween", "type": "behavior" } ], "objectGroups": [] }, { - "fullName": "Fade in", - "functionType": "Action", - "name": "FadeIn", - "private": true, - "sentence": "_PARAM0_ fade in to _PARAM2_", + "description": "the fade-in easing of the object.", + "fullName": "Fade-in easing", + "functionType": "ExpressionAndCondition", + "group": "Button effect tween configuration", + "name": "FadeInEasing", + "sentence": "the fade-in easing", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -9342,21 +8828,19 @@ "actions": [ { "type": { - "value": "Tween::AddObjectAngleTween" + "value": "SetReturnString" }, "parameters": [ - "Object", - "Tween", - "\"__ButtonAngleTween.Fade\"", - "GetArgumentAsNumber(\"Value\")", - "Object.Behavior::PropertyFadeInEasing()", - "1000 * Object.Behavior::PropertyFadeInDuration()", - "no" + "FadeInEasing" ] } ] } ], + "expressionType": { + "supplementaryInformation": "[\"linear\",\"easeInQuad\",\"easeOutQuad\",\"easeInOutQuad\",\"easeInCubic\",\"easeOutCubic\",\"easeInOutCubic\",\"easeInQuart\",\"easeOutQuart\",\"easeInOutQuart\",\"easeInQuint\",\"easeOutQuint\",\"easeInOutQuint\",\"easeInOutSine\",\"easeInExpo\",\"easeOutExpo\",\"easeInOutExpo\",\"easeInCirc\",\"easeOutCirc\",\"easeInOutCirc\",\"easeOutBounce\",\"easeInBack\",\"easeOutBack\",\"easeInOutBack\",\"elastic\",\"swingFromTo\",\"swingFrom\",\"swingTo\",\"bounce\",\"bouncePast\",\"easeFromTo\",\"easeFrom\",\"easeTo\"]", + "type": "stringWithSelector" + }, "parameters": [ { "description": "Object", @@ -9366,23 +8850,18 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "ButtonStates::ButtonAngleTween", + "supplementaryInformation": "ButtonStates::ButtonObjectEffectTween", "type": "behavior" - }, - { - "description": "Value", - "name": "Value", - "type": "expression" } ], "objectGroups": [] }, { - "fullName": "Fade out", - "functionType": "Action", - "name": "FadeOut", - "private": true, - "sentence": "_PARAM0_ fade out to _PARAM2_", + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "FadeInEasing", + "name": "SetFadeInEasing", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -9390,16 +8869,12 @@ "actions": [ { "type": { - "value": "Tween::AddObjectAngleTween" + "value": "SetStringVariable" }, "parameters": [ - "Object", - "Tween", - "\"__ButtonAngleTween.Fade\"", - "GetArgumentAsNumber(\"Value\")", - "Object.Behavior::PropertyFadeOutEasing()", - "1000 * Object.Behavior::PropertyFadeOutDuration()", - "no" + "FadeInEasing", + "=", + "Value" ] } ] @@ -9414,215 +8889,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "ButtonStates::ButtonAngleTween", + "supplementaryInformation": "ButtonStates::ButtonObjectEffectTween", "type": "behavior" - }, - { - "description": "Value", - "name": "Value", - "type": "expression" } ], "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "", - "type": "Behavior", - "label": "Button states", - "description": "", - "group": "", - "extraInformation": [ - "ButtonStates::ButtonFSM" - ], - "name": "ButtonFSM" - }, - { - "value": "", - "type": "Behavior", - "label": "Tween", - "description": "", - "group": "", - "extraInformation": [ - "Tween::TweenBehavior" - ], - "name": "Tween" - }, - { - "value": "20", - "type": "Number", - "unit": "DegreeAngle", - "label": "Idle state angle", - "description": "", - "group": "Rotation", - "extraInformation": [], - "name": "IdleAngle" - }, - { - "value": "0", - "type": "Number", - "unit": "DegreeAngle", - "label": "Focussed state angle", - "description": "", - "group": "Rotation", - "extraInformation": [], - "name": "FocusedAngle" - }, - { - "value": "180", - "type": "Number", - "unit": "DegreeAngle", - "label": "Pressed state angle", - "description": "", - "group": "Rotation", - "extraInformation": [], - "name": "PressedAngle" - }, - { - "value": "0.3", - "type": "Number", - "unit": "Second", - "label": "Fade-in duration", - "description": "", - "group": "Speed", - "extraInformation": [], - "name": "FadeInDuration" - }, - { - "value": "0.6", - "type": "Number", - "unit": "Second", - "label": "Fade-out duration", - "description": "", - "group": "Speed", - "extraInformation": [], - "name": "FadeOutDuration" - }, - { - "value": "easeOutBounce", - "type": "Choice", - "label": "Fade-in easing", - "description": "", - "group": "Speed", - "extraInformation": [ - "linear", - "easeInQuad", - "easeOutQuad", - "easeInOutQuad", - "easeInCubic", - "easeOutCubic", - "easeInOutCubic", - "easeInQuart", - "easeOutQuart", - "easeInOutQuart", - "easeInQuint", - "easeOutQuint", - "easeInOutQuint", - "easeInOutSine", - "easeInExpo", - "easeOutExpo", - "easeInOutExpo", - "easeInCirc", - "easeOutCirc", - "easeInOutCirc", - "easeOutBounce", - "easeInBack", - "easeOutBack", - "easeInOutBack", - "elastic", - "swingFromTo", - "swingFrom", - "swingTo", - "bounce", - "bouncePast", - "easeFromTo", - "easeFrom", - "easeTo" - ], - "name": "FadeInEasing" - }, - { - "value": "easeOutBounce", - "type": "Choice", - "label": "Fade-out easing", - "description": "", - "group": "Speed", - "extraInformation": [ - "linear", - "easeInQuad", - "easeOutQuad", - "easeInOutQuad", - "easeInCubic", - "easeOutCubic", - "easeInOutCubic", - "easeInQuart", - "easeOutQuart", - "easeInOutQuart", - "easeInQuint", - "easeOutQuint", - "easeInOutQuint", - "easeInOutSine", - "easeInExpo", - "easeOutExpo", - "easeInOutExpo", - "easeInCirc", - "easeOutCirc", - "easeInOutCirc", - "easeOutBounce", - "easeInBack", - "easeOutBack", - "easeInOutBack", - "elastic", - "swingFromTo", - "swingFrom", - "swingTo", - "bounce", - "bouncePast", - "easeFromTo", - "easeFrom", - "easeTo" - ], - "name": "FadeOutEasing" - }, - { - "value": "Idle", - "type": "Choice", - "label": "", - "description": "", - "group": "", - "extraInformation": [ - "Idle", - "Focused", - "Pressed" - ], - "hidden": true, - "name": "PreviousState" }, { - "value": "true", - "type": "Boolean", - "label": "", - "description": "", - "group": "", - "extraInformation": [], - "hidden": true, - "name": "HasJustBeenCreated" - } - ], - "sharedPropertyDescriptors": [] - }, - { - "description": "Smoothly change the opacity of buttons according to their state.", - "fullName": "Button opacity tween", - "name": "ButtonOpacityTween", - "objectType": "Sprite", - "eventsFunctions": [ - { - "fullName": "", - "functionType": "Action", - "name": "onCreated", - "sentence": "", + "description": "the fade-out easing of the object.", + "fullName": "Fade-out easing", + "functionType": "ExpressionAndCondition", + "group": "Button effect tween configuration", + "name": "FadeOutEasing", + "sentence": "the fade-out easing", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -9630,29 +8909,29 @@ "actions": [ { "type": { - "value": "OpacityCapability::OpacityBehavior::SetValue" + "value": "SetReturnString" }, "parameters": [ - "Object", - "Opacity", - "=", - "Object.Behavior::PropertyIdleOpacity()" + "FadeOutEasing" ] } ] } ], + "expressionType": { + "supplementaryInformation": "[\"linear\",\"easeInQuad\",\"easeOutQuad\",\"easeInOutQuad\",\"easeInCubic\",\"easeOutCubic\",\"easeInOutCubic\",\"easeInQuart\",\"easeOutQuart\",\"easeInOutQuart\",\"easeInQuint\",\"easeOutQuint\",\"easeInOutQuint\",\"easeInOutSine\",\"easeInExpo\",\"easeOutExpo\",\"easeInOutExpo\",\"easeInCirc\",\"easeOutCirc\",\"easeInOutCirc\",\"easeOutBounce\",\"easeInBack\",\"easeOutBack\",\"easeInOutBack\",\"elastic\",\"swingFromTo\",\"swingFrom\",\"swingTo\",\"bounce\",\"bouncePast\",\"easeFromTo\",\"easeFrom\",\"easeTo\"]", + "type": "stringWithSelector" + }, "parameters": [ { "description": "Object", "name": "Object", - "supplementaryInformation": "Sprite", "type": "object" }, { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "ButtonStates::ButtonOpacityTween", + "supplementaryInformation": "ButtonStates::ButtonObjectEffectTween", "type": "behavior" } ], @@ -9660,243 +8939,50 @@ }, { "fullName": "", - "functionType": "Action", - "name": "doStepPreEvents", + "functionType": "ActionWithOperator", + "getterName": "FadeOutEasing", + "name": "SetFadeOutEasing", "sentence": "", "events": [ { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "States", - "source": "", - "type": "BuiltinCommonInstructions::Group", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "ButtonStates::ButtonFSM::IsIdle" - }, - "parameters": [ - "Object", - "ButtonFSM", - "" - ] - }, - { - "type": { - "value": "ButtonStates::ButtonOpacityTween::PropertyPreviousState" - }, - "parameters": [ - "Object", - "Behavior", - "!=", - "\"Idle\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "ButtonStates::ButtonOpacityTween::SetPropertyPreviousState" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "\"Idle\"" - ] - }, - { - "type": { - "value": "ButtonStates::ButtonAngleTween::FadeOut" - }, - "parameters": [ - "Object", - "Behavior", - "Object.Behavior::PropertyIdleOpacity()", - "" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "ButtonStates::ButtonFSM::IsFocused" - }, - "parameters": [ - "Object", - "ButtonFSM", - "" - ] - } - ], - "actions": [], - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "ButtonStates::ButtonOpacityTween::PropertyPreviousState" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "\"Idle\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "ButtonStates::ButtonOpacityTween::SetPropertyPreviousState" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "\"Focused\"" - ] - }, - { - "type": { - "value": "ButtonStates::ButtonAngleTween::FadeIn" - }, - "parameters": [ - "Object", - "Behavior", - "Object.Behavior::PropertyFocusedOpacity()", - "" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "ButtonStates::ButtonOpacityTween::PropertyPreviousState" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "\"Pressed\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "ButtonStates::ButtonOpacityTween::SetPropertyPreviousState" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "\"Focused\"" - ] - }, - { - "type": { - "value": "ButtonStates::ButtonAngleTween::FadeOut" - }, - "parameters": [ - "Object", - "Behavior", - "Object.Behavior::PropertyFocusedOpacity()", - "" - ] - } - ] - } - ] - }, + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "ButtonStates::ButtonFSM::IsPressed" - }, - "parameters": [ - "Object", - "ButtonFSM", - "" - ] - }, - { - "type": { - "value": "ButtonStates::ButtonOpacityTween::PropertyPreviousState" - }, - "parameters": [ - "Object", - "Behavior", - "!=", - "\"Pressed\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "ButtonStates::ButtonOpacityTween::SetPropertyPreviousState" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "\"Pressed\"" - ] - }, - { - "type": { - "value": "ButtonStates::ButtonAngleTween::FadeIn" - }, - "parameters": [ - "Object", - "Behavior", - "Object.Behavior::PropertyPressedOpacity()", - "" - ] - } + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "FadeOutEasing", + "=", + "Value" ] } - ], - "parameters": [] + ] } ], "parameters": [ { "description": "Object", "name": "Object", - "supplementaryInformation": "Sprite", "type": "object" }, { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "ButtonStates::ButtonOpacityTween", + "supplementaryInformation": "ButtonStates::ButtonObjectEffectTween", "type": "behavior" } ], "objectGroups": [] }, { - "fullName": "Fade in", - "functionType": "Action", - "name": "FadeIn", - "private": true, - "sentence": "_PARAM0_ fade in to _PARAM2_", + "description": "the fade-in duration of the object.", + "fullName": "Fade-in duration", + "functionType": "ExpressionAndCondition", + "group": "Button effect tween configuration", + "name": "FadeInDuration", + "sentence": "the fade-in duration", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -9904,48 +8990,79 @@ "actions": [ { "type": { - "value": "Tween::AddObjectOpacityTween" + "value": "SetReturnNumber" }, "parameters": [ - "Object", - "Tween", - "\"__ButtonOpacityTween.Fade\"", - "GetArgumentAsNumber(\"Value\")", - "Object.Behavior::PropertyFadeInEasing()", - "1000 * Object.Behavior::PropertyFadeInDuration()", - "no" + "FadeInDuration" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", "name": "Object", - "supplementaryInformation": "Sprite", "type": "object" }, { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "ButtonStates::ButtonOpacityTween", + "supplementaryInformation": "ButtonStates::ButtonObjectEffectTween", "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "FadeInDuration", + "name": "SetFadeInDuration", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "FadeInDuration", + "=", + "Value" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" }, { - "description": "Value", - "name": "Value", - "type": "expression" + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ButtonStates::ButtonObjectEffectTween", + "type": "behavior" } ], "objectGroups": [] }, { - "fullName": "Fade out", - "functionType": "Action", - "name": "FadeOut", - "private": true, - "sentence": "_PARAM0_ fade out to _PARAM2_", + "description": "the fade-out duration of the object.", + "fullName": "Fade-out duration", + "functionType": "ExpressionAndCondition", + "group": "Button effect tween configuration", + "name": "FadeOutDuration", + "sentence": "the fade-out duration", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -9953,38 +9070,68 @@ "actions": [ { "type": { - "value": "Tween::AddObjectOpacityTween" + "value": "SetReturnNumber" }, "parameters": [ - "Object", - "Tween", - "\"__ButtonOpacityTween.Fade\"", - "GetArgumentAsNumber(\"Value\")", - "Object.Behavior::PropertyFadeOutEasing()", - "1000 * Object.Behavior::PropertyFadeOutDuration()", - "no" + "FadeOutDuration" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", "name": "Object", - "supplementaryInformation": "Sprite", "type": "object" }, { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "ButtonStates::ButtonOpacityTween", + "supplementaryInformation": "ButtonStates::ButtonObjectEffectTween", "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "FadeOutDuration", + "name": "SetFadeOutDuration", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "FadeOutDuration", + "=", + "Value" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" }, { - "description": "Value", - "name": "Value", - "type": "expression" + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ButtonStates::ButtonObjectEffectTween", + "type": "behavior" } ], "objectGroups": [] @@ -9995,114 +9142,197 @@ "value": "", "type": "Behavior", "label": "Button states", - "description": "", - "group": "", "extraInformation": [ "ButtonStates::ButtonFSM" ], + "choices": [], "name": "ButtonFSM" }, { "value": "", "type": "Behavior", - "label": "Tween", - "description": "", - "group": "", + "label": "Effect capability", "extraInformation": [ - "Tween::TweenBehavior" + "EffectCapability::EffectBehavior" ], - "name": "Tween" + "choices": [], + "name": "Effect" }, { - "value": "0.1", - "type": "Number", - "unit": "Second", - "label": "Fade-in duration", - "description": "", - "group": "Speed", - "extraInformation": [], - "name": "FadeInDuration" + "value": "Effect", + "type": "String", + "label": "Effect name", + "group": "Effect", + "name": "EffectName" }, { - "value": "0.2", - "type": "Number", - "unit": "Second", - "label": "Fade-out duration", - "description": "", - "group": "Speed", - "extraInformation": [], - "name": "FadeOutDuration" + "value": "", + "type": "String", + "label": "Effect parameter", + "description": "The effect parameter names can be found in the effects tab with the \"Show parameter names\" action of the drop down menu.", + "group": "Effect", + "name": "EffectProperty" }, { - "value": "200", + "value": "0", "type": "Number", - "unit": "Dimensionless", - "label": "Idle state opacity", - "description": "", - "group": "Opacity", - "extraInformation": [], - "name": "IdleOpacity" + "label": "Idle effect parameter value", + "group": "Value", + "name": "IdleValue" }, { - "value": "255", + "value": "0", "type": "Number", - "unit": "Dimensionless", - "label": "Focused state opacity", - "description": "", - "group": "Opacity", - "extraInformation": [], - "name": "FocusedOpacity" + "label": "Focused effect parameter value", + "description": "The state is Focused when the button is hovered or held outside.", + "group": "Value", + "name": "FocusedValue" }, { - "value": "255", + "value": "0", "type": "Number", - "unit": "Dimensionless", - "label": "Pressed state opacity", - "description": "", - "group": "Opacity", - "extraInformation": [], - "name": "PressedOpacity" + "label": "Pressed effect parameter value", + "group": "Value", + "name": "PressedValue" }, { "value": "easeInOutQuad", "type": "Choice", "label": "Fade-in easing", - "description": "", "group": "Speed", - "extraInformation": [ - "linear", - "easeInQuad", - "easeOutQuad", - "easeInOutQuad", - "easeInCubic", - "easeOutCubic", - "easeInOutCubic", - "easeInQuart", - "easeOutQuart", - "easeInOutQuart", - "easeInQuint", - "easeOutQuint", - "easeInOutQuint", - "easeInOutSine", - "easeInExpo", - "easeOutExpo", - "easeInOutExpo", - "easeInCirc", - "easeOutCirc", - "easeInOutCirc", - "easeOutBounce", - "easeInBack", - "easeOutBack", - "easeInOutBack", - "elastic", - "swingFromTo", - "swingFrom", - "swingTo", - "bounce", - "bouncePast", - "easeFromTo", - "easeFrom", - "easeTo" + "choices": [ + { + "label": "linear", + "value": "linear" + }, + { + "label": "easeInQuad", + "value": "easeInQuad" + }, + { + "label": "easeOutQuad", + "value": "easeOutQuad" + }, + { + "label": "easeInOutQuad", + "value": "easeInOutQuad" + }, + { + "label": "easeInCubic", + "value": "easeInCubic" + }, + { + "label": "easeOutCubic", + "value": "easeOutCubic" + }, + { + "label": "easeInOutCubic", + "value": "easeInOutCubic" + }, + { + "label": "easeInQuart", + "value": "easeInQuart" + }, + { + "label": "easeOutQuart", + "value": "easeOutQuart" + }, + { + "label": "easeInOutQuart", + "value": "easeInOutQuart" + }, + { + "label": "easeInQuint", + "value": "easeInQuint" + }, + { + "label": "easeOutQuint", + "value": "easeOutQuint" + }, + { + "label": "easeInOutQuint", + "value": "easeInOutQuint" + }, + { + "label": "easeInOutSine", + "value": "easeInOutSine" + }, + { + "label": "easeInExpo", + "value": "easeInExpo" + }, + { + "label": "easeOutExpo", + "value": "easeOutExpo" + }, + { + "label": "easeInOutExpo", + "value": "easeInOutExpo" + }, + { + "label": "easeInCirc", + "value": "easeInCirc" + }, + { + "label": "easeOutCirc", + "value": "easeOutCirc" + }, + { + "label": "easeInOutCirc", + "value": "easeInOutCirc" + }, + { + "label": "easeOutBounce", + "value": "easeOutBounce" + }, + { + "label": "easeInBack", + "value": "easeInBack" + }, + { + "label": "easeOutBack", + "value": "easeOutBack" + }, + { + "label": "easeInOutBack", + "value": "easeInOutBack" + }, + { + "label": "elastic", + "value": "elastic" + }, + { + "label": "swingFromTo", + "value": "swingFromTo" + }, + { + "label": "swingFrom", + "value": "swingFrom" + }, + { + "label": "swingTo", + "value": "swingTo" + }, + { + "label": "bounce", + "value": "bounce" + }, + { + "label": "bouncePast", + "value": "bouncePast" + }, + { + "label": "easeFromTo", + "value": "easeFromTo" + }, + { + "label": "easeFrom", + "value": "easeFrom" + }, + { + "label": "easeTo", + "value": "easeTo" + } ], "name": "FadeInEasing" }, @@ -10110,73 +9340,243 @@ "value": "easeInOutQuad", "type": "Choice", "label": "Fade-out easing", - "description": "", "group": "Speed", - "extraInformation": [ - "linear", - "easeInQuad", - "easeOutQuad", - "easeInOutQuad", - "easeInCubic", - "easeOutCubic", - "easeInOutCubic", - "easeInQuart", - "easeOutQuart", - "easeInOutQuart", - "easeInQuint", - "easeOutQuint", - "easeInOutQuint", - "easeInOutSine", - "easeInExpo", - "easeOutExpo", - "easeInOutExpo", - "easeInCirc", - "easeOutCirc", - "easeInOutCirc", - "easeOutBounce", - "easeInBack", - "easeOutBack", - "easeInOutBack", - "elastic", - "swingFromTo", - "swingFrom", - "swingTo", - "bounce", - "bouncePast", - "easeFromTo", - "easeFrom", - "easeTo" + "choices": [ + { + "label": "linear", + "value": "linear" + }, + { + "label": "easeInQuad", + "value": "easeInQuad" + }, + { + "label": "easeOutQuad", + "value": "easeOutQuad" + }, + { + "label": "easeInOutQuad", + "value": "easeInOutQuad" + }, + { + "label": "easeInCubic", + "value": "easeInCubic" + }, + { + "label": "easeOutCubic", + "value": "easeOutCubic" + }, + { + "label": "easeInOutCubic", + "value": "easeInOutCubic" + }, + { + "label": "easeInQuart", + "value": "easeInQuart" + }, + { + "label": "easeOutQuart", + "value": "easeOutQuart" + }, + { + "label": "easeInOutQuart", + "value": "easeInOutQuart" + }, + { + "label": "easeInQuint", + "value": "easeInQuint" + }, + { + "label": "easeOutQuint", + "value": "easeOutQuint" + }, + { + "label": "easeInOutQuint", + "value": "easeInOutQuint" + }, + { + "label": "easeInOutSine", + "value": "easeInOutSine" + }, + { + "label": "easeInExpo", + "value": "easeInExpo" + }, + { + "label": "easeOutExpo", + "value": "easeOutExpo" + }, + { + "label": "easeInOutExpo", + "value": "easeInOutExpo" + }, + { + "label": "easeInCirc", + "value": "easeInCirc" + }, + { + "label": "easeOutCirc", + "value": "easeOutCirc" + }, + { + "label": "easeInOutCirc", + "value": "easeInOutCirc" + }, + { + "label": "easeOutBounce", + "value": "easeOutBounce" + }, + { + "label": "easeInBack", + "value": "easeInBack" + }, + { + "label": "easeOutBack", + "value": "easeOutBack" + }, + { + "label": "easeInOutBack", + "value": "easeInOutBack" + }, + { + "label": "elastic", + "value": "elastic" + }, + { + "label": "swingFromTo", + "value": "swingFromTo" + }, + { + "label": "swingFrom", + "value": "swingFrom" + }, + { + "label": "swingTo", + "value": "swingTo" + }, + { + "label": "bounce", + "value": "bounce" + }, + { + "label": "bouncePast", + "value": "bouncePast" + }, + { + "label": "easeFromTo", + "value": "easeFromTo" + }, + { + "label": "easeFrom", + "value": "easeFrom" + }, + { + "label": "easeTo", + "value": "easeTo" + } ], "name": "FadeOutEasing" }, + { + "value": "0.125", + "type": "Number", + "unit": "Second", + "label": "Fade-in duration", + "group": "Speed", + "name": "FadeInDuration" + }, + { + "value": "0.5", + "type": "Number", + "unit": "Second", + "label": "Fade-out duration", + "group": "Speed", + "name": "FadeOutDuration" + }, { "value": "Idle", "type": "Choice", "label": "", - "description": "", - "group": "", - "extraInformation": [ - "Idle", - "Focused", - "Pressed" + "choices": [ + { + "label": "Idle", + "value": "Idle" + }, + { + "label": "Focused", + "value": "Focused" + }, + { + "label": "Pressed", + "value": "Pressed" + } ], "hidden": true, "name": "PreviousState" - } - ], - "sharedPropertyDescriptors": [] - }, - { - "description": "Smoothly change the color tint of buttons according to their state.", - "fullName": "Button color tint tween", - "name": "ButtonColorTintTween", - "objectType": "Sprite", - "eventsFunctions": [ + }, { - "fullName": "", - "functionType": "Action", - "name": "onCreated", - "sentence": "", + "value": "0", + "type": "Number", + "label": "", + "hidden": true, + "name": "TweenInitialValue" + }, + { + "value": "0", + "type": "Number", + "label": "", + "hidden": true, + "name": "TweenTargetedValue" + }, + { + "value": "0", + "type": "Number", + "label": "", + "hidden": true, + "name": "TweenTime" + }, + { + "value": "NoTween", + "type": "Choice", + "label": "", + "choices": [ + { + "label": "NoTween", + "value": "NoTween" + }, + { + "label": "FadeIn", + "value": "FadeIn" + }, + { + "label": "FadeOut", + "value": "FadeOut" + } + ], + "hidden": true, + "name": "TweenState" + }, + { + "value": "0", + "type": "Number", + "label": "", + "hidden": true, + "name": "EffectValue" + } + ], + "sharedPropertyDescriptors": [] + }, + { + "description": "Smoothly resize buttons according to their state.", + "fullName": "Button scale tween", + "name": "ButtonScaleTween", + "objectType": "", + "eventsFunctions": [ + { + "fullName": "", + "functionType": "Action", + "name": "onCreated", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -10184,11 +9584,13 @@ "actions": [ { "type": { - "value": "ChangeColor" + "value": "ScalableCapability::ScalableBehavior::SetValue" }, "parameters": [ "Object", - "Object.Behavior::PropertyIdleColorTint()" + "Scale", + "=", + "IdleScale" ] } ] @@ -10198,13 +9600,12 @@ { "description": "Object", "name": "Object", - "supplementaryInformation": "Sprite", "type": "object" }, { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "ButtonStates::ButtonColorTintTween", + "supplementaryInformation": "ButtonStates::ButtonScaleTween", "type": "behavior" } ], @@ -10221,7 +9622,7 @@ "colorG": 176, "colorR": 74, "creationTime": 0, - "name": "States", + "name": "Change based on state", "source": "", "type": "BuiltinCommonInstructions::Group", "events": [ @@ -10240,11 +9641,10 @@ }, { "type": { - "value": "ButtonStates::ButtonColorTintTween::PropertyPreviousState" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "PreviousState", "!=", "\"Idle\"" ] @@ -10253,23 +9653,22 @@ "actions": [ { "type": { - "value": "ButtonStates::ButtonAngleTween::SetPropertyPreviousState" + "value": "SetStringVariable" }, "parameters": [ - "Object", - "Behavior", + "PreviousState", "=", "\"Idle\"" ] }, { "type": { - "value": "ButtonStates::ButtonColorTintTween::FadeOut" + "value": "ButtonStates::ButtonScaleTween::FadeOut" }, "parameters": [ "Object", "Behavior", - "Object.Behavior::PropertyIdleColorTint()", + "IdleScale", "" ] } @@ -10296,11 +9695,10 @@ "conditions": [ { "type": { - "value": "ButtonStates::ButtonColorTintTween::PropertyPreviousState" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "PreviousState", "=", "\"Idle\"" ] @@ -10309,23 +9707,22 @@ "actions": [ { "type": { - "value": "ButtonStates::ButtonColorTintTween::SetPropertyPreviousState" + "value": "SetStringVariable" }, "parameters": [ - "Object", - "Behavior", + "PreviousState", "=", "\"Focused\"" ] }, { "type": { - "value": "ButtonStates::ButtonColorTintTween::FadeIn" + "value": "ButtonStates::ButtonScaleTween::FadeIn" }, "parameters": [ "Object", "Behavior", - "Object.Behavior::PropertyFocusedColorTint()", + "FocusedScale", "" ] } @@ -10336,11 +9733,10 @@ "conditions": [ { "type": { - "value": "ButtonStates::ButtonColorTintTween::PropertyPreviousState" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "PreviousState", "=", "\"Pressed\"" ] @@ -10349,23 +9745,22 @@ "actions": [ { "type": { - "value": "ButtonStates::ButtonColorTintTween::SetPropertyPreviousState" + "value": "SetStringVariable" }, "parameters": [ - "Object", - "Behavior", + "PreviousState", "=", "\"Focused\"" ] }, { "type": { - "value": "ButtonStates::ButtonColorTintTween::FadeOut" + "value": "ButtonStates::ButtonScaleTween::FadeOut" }, "parameters": [ "Object", "Behavior", - "Object.Behavior::PropertyFocusedColorTint()", + "FocusedScale", "" ] } @@ -10388,11 +9783,10 @@ }, { "type": { - "value": "ButtonStates::ButtonColorTintTween::PropertyPreviousState" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "PreviousState", "!=", "\"Pressed\"" ] @@ -10401,23 +9795,22 @@ "actions": [ { "type": { - "value": "ButtonStates::ButtonColorTintTween::SetPropertyPreviousState" + "value": "SetStringVariable" }, "parameters": [ - "Object", - "Behavior", + "PreviousState", "=", "\"Pressed\"" ] }, { "type": { - "value": "ButtonStates::ButtonColorTintTween::FadeIn" + "value": "ButtonStates::ButtonScaleTween::FadeIn" }, "parameters": [ "Object", "Behavior", - "Object.Behavior::PropertyPressedColorTint()", + "PressedScale", "" ] } @@ -10431,13 +9824,12 @@ { "description": "Object", "name": "Object", - "supplementaryInformation": "Sprite", "type": "object" }, { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "ButtonStates::ButtonColorTintTween", + "supplementaryInformation": "ButtonStates::ButtonScaleTween", "type": "behavior" } ], @@ -10456,15 +9848,16 @@ "actions": [ { "type": { - "value": "Tween::AddObjectColorTween" + "value": "Tween::AddObjectScaleTween" }, "parameters": [ "Object", "Tween", - "\"__ButtonColorTintTween.Fade\"", - "GetArgumentAsString(\"Value\")", - "Object.Behavior::PropertyFadeInEasing()", - "1000 * Object.Behavior::PropertyFadeInDuration()", + "\"__ButtonScaleTween.Fade\"", + "Value", + "Value", + "FadeInEasing", + "1000 * FadeInDuration", "no", "yes" ] @@ -10476,19 +9869,18 @@ { "description": "Object", "name": "Object", - "supplementaryInformation": "Sprite", "type": "object" }, { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "ButtonStates::ButtonColorTintTween", + "supplementaryInformation": "ButtonStates::ButtonScaleTween", "type": "behavior" }, { "description": "Value", "name": "Value", - "type": "color" + "type": "expression" } ], "objectGroups": [] @@ -10506,15 +9898,16 @@ "actions": [ { "type": { - "value": "Tween::AddObjectColorTween" + "value": "Tween::AddObjectScaleTween" }, "parameters": [ "Object", "Tween", - "\"__ButtonColorTintTween.Fade\"", - "GetArgumentAsString(\"Value\")", - "Object.Behavior::PropertyFadeOutEasing()", - "1000 * Object.Behavior::PropertyFadeOutDuration()", + "\"__ButtonScaleTween.Fade\"", + "Value", + "Value", + "FadeOutEasing", + "1000 * FadeOutDuration", "no", "yes" ] @@ -10526,264 +9919,2345 @@ { "description": "Object", "name": "Object", - "supplementaryInformation": "Sprite", "type": "object" }, { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "ButtonStates::ButtonColorTintTween", + "supplementaryInformation": "ButtonStates::ButtonScaleTween", "type": "behavior" }, { "description": "Value", "name": "Value", - "type": "color" + "type": "expression" } ], "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "", - "type": "Behavior", - "label": "Button states", - "description": "", - "group": "", - "extraInformation": [ - "ButtonStates::ButtonFSM" - ], - "name": "ButtonFSM" }, { - "value": "", - "type": "Behavior", - "label": "Tween", - "description": "", - "group": "", - "extraInformation": [ - "Tween::TweenBehavior" + "description": "the idle state size scale of the object.", + "fullName": "Idle state size scale", + "functionType": "ExpressionAndCondition", + "group": "Button scale tween configuration", + "name": "IdleScale", + "sentence": "the idle state size scale", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "IdleScale" + ] + } + ] + } ], - "name": "Tween" - }, - { - "value": "0.1", - "type": "Number", - "unit": "Second", - "label": "Fade-in duration", - "description": "", - "group": "Speed", - "extraInformation": [], - "name": "FadeInDuration" + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ButtonStates::ButtonScaleTween", + "type": "behavior" + } + ], + "objectGroups": [] }, { - "value": "0.2", - "type": "Number", - "unit": "Second", - "label": "Fade-out duration", - "description": "", - "group": "Speed", - "extraInformation": [], - "name": "FadeOutDuration" + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "IdleScale", + "name": "SetIdleScale", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "IdleScale", + "=", + "Value" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ButtonStates::ButtonScaleTween", + "type": "behavior" + } + ], + "objectGroups": [] }, { - "value": "255;255;255", - "type": "Color", - "label": "Idle state color tint", - "description": "", - "group": "Color", - "extraInformation": [], - "name": "IdleColorTint" + "description": "the focused state size scale of the object. The state is Focused when the button is hovered or held outside.", + "fullName": "Focused state size scale", + "functionType": "ExpressionAndCondition", + "group": "Button scale tween configuration", + "name": "FocusedScale", + "sentence": "the focused state size scale", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "FocusedScale" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ButtonStates::ButtonScaleTween", + "type": "behavior" + } + ], + "objectGroups": [] }, { - "value": "192;192;192", - "type": "Color", - "label": "Focused state color tint", - "description": "", - "group": "Color", - "extraInformation": [], - "name": "FocusedColorTint" + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "FocusedScale", + "name": "SetFocusedScale", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "FocusedScale", + "=", + "Value" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ButtonStates::ButtonScaleTween", + "type": "behavior" + } + ], + "objectGroups": [] }, { - "value": "64;64;64", - "type": "Color", - "label": "Pressed state color tint", - "description": "", - "group": "Color", - "extraInformation": [], - "name": "PressedColorTint" + "description": "the pressed state size scale of the object.", + "fullName": "Pressed state size scale", + "functionType": "ExpressionAndCondition", + "group": "Button scale tween configuration", + "name": "PressedScale", + "sentence": "the pressed state size scale", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "PressedScale" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ButtonStates::ButtonScaleTween", + "type": "behavior" + } + ], + "objectGroups": [] }, { - "value": "easeInOutQuad", - "type": "Choice", - "label": "Fade-in easing", - "description": "", - "group": "Speed", - "extraInformation": [ - "linear", - "easeInQuad", - "easeOutQuad", - "easeInOutQuad", - "easeInCubic", - "easeOutCubic", - "easeInOutCubic", - "easeInQuart", - "easeOutQuart", - "easeInOutQuart", - "easeInQuint", - "easeOutQuint", - "easeInOutQuint", - "easeInOutSine", - "easeInExpo", - "easeOutExpo", - "easeInOutExpo", - "easeInCirc", - "easeOutCirc", - "easeInOutCirc", - "easeOutBounce", - "easeInBack", - "easeOutBack", - "easeInOutBack", - "elastic", - "swingFromTo", - "swingFrom", - "swingTo", - "bounce", - "bouncePast", - "easeFromTo", - "easeFrom", - "easeTo" + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "PressedScale", + "name": "SetPressedScale", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "PressedScale", + "=", + "Value" + ] + } + ] + } ], - "name": "FadeInEasing" + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ButtonStates::ButtonScaleTween", + "type": "behavior" + } + ], + "objectGroups": [] }, { - "value": "easeInOutQuad", - "type": "Choice", - "label": "Fade-out easing", - "description": "", - "group": "Speed", - "extraInformation": [ - "linear", - "easeInQuad", - "easeOutQuad", - "easeInOutQuad", - "easeInCubic", - "easeOutCubic", - "easeInOutCubic", - "easeInQuart", - "easeOutQuart", - "easeInOutQuart", - "easeInQuint", - "easeOutQuint", - "easeInOutQuint", - "easeInOutSine", - "easeInExpo", - "easeOutExpo", - "easeInOutExpo", - "easeInCirc", - "easeOutCirc", - "easeInOutCirc", - "easeOutBounce", - "easeInBack", - "easeOutBack", - "easeInOutBack", - "elastic", - "swingFromTo", - "swingFrom", - "swingTo", - "bounce", - "bouncePast", - "easeFromTo", - "easeFrom", - "easeTo" + "description": "the fade-in duration of the object.", + "fullName": "Fade-in duration", + "functionType": "ExpressionAndCondition", + "group": "Button scale tween configuration", + "name": "FadeInDuration", + "sentence": "the fade-in duration", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "FadeInDuration" + ] + } + ] + } ], - "name": "FadeOutEasing" + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ButtonStates::ButtonScaleTween", + "type": "behavior" + } + ], + "objectGroups": [] }, { - "value": "Idle", - "type": "Choice", - "label": "", - "description": "", - "group": "", - "extraInformation": [ - "Idle", - "Focused", - "Pressed" + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "FadeInDuration", + "name": "SetFadeInDuration", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "FadeInDuration", + "=", + "Value" + ] + } + ] + } ], - "hidden": true, - "name": "PreviousState" - } - ], - "sharedPropertyDescriptors": [] - } - ], - "eventsBasedObjects": [] - }, - { - "author": "", - "category": "Visual effect", - "extensionNamespace": "", - "fullName": "3D object shake", - "helpPath": "", - "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0ibWRpLXZlY3Rvci1kaWZmZXJlbmNlLWFiIiB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCI+PHBhdGggZD0iTTMsMUMxLjg5LDEgMSwxLjg5IDEsM1Y1SDNWM0g1VjFIM003LDFWM0gxMFYxSDdNMTIsMVYzSDE0VjVIMTZWM0MxNiwxLjg5IDE1LjExLDEgMTQsMUgxMk0xLDdWMTBIM1Y3SDFNMTQsN0MxNCw3IDE0LDExLjY3IDE0LDE0QzExLjY3LDE0IDcsMTQgNywxNEM3LDE0IDcsMTggNywyMEM3LDIxLjExIDcuODksMjIgOSwyMkgyMEMyMS4xMSwyMiAyMiwyMS4xMSAyMiwyMFY5QzIyLDcuODkgMjEuMTEsNyAyMCw3QzE4LDcgMTQsNyAxNCw3TTE2LDlIMjBWMjBIOVYxNkgxNEMxNS4xMSwxNiAxNiwxNS4xMSAxNiwxNFY5TTEsMTJWMTRDMSwxNS4xMSAxLjg5LDE2IDMsMTZINVYxNEgzVjEySDFaIiAvPjwvc3ZnPg==", - "name": "ShakeObject3D", - "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/vector-difference-ab.svg", - "shortDescription": "Shake 3D objects.", - "version": "2.0.4", - "description": [ - "Shake 3D objects with translation and rotation.", - "", - "The 3D racing game example uses this extension ([open the project online](https://editor.gdevelop.io/?project=example://3d-racing-game)).", - "", - "Breaking changes from 2.0.0", - "- The behavior for 3D box has been removed. The other behavior can be used for both models and boxes." - ], - "origin": { - "identifier": "ShakeObject3D", - "name": "gdevelop-extension-store" - }, - "tags": [ - "3d", - "shaking", - "effect", - "shake", - "translate", - "rotate" - ], - "authorIds": [ - "IWykYNRvhCZBN3vEgKEbBPOR3Oc2" - ], - "dependencies": [], - "globalVariables": [], - "sceneVariables": [], - "eventsFunctions": [ - { - "fullName": "", - "functionType": "Action", - "name": "onFirstSceneLoaded", - "sentence": "", - "events": [ + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ButtonStates::ButtonScaleTween", + "type": "behavior" + } + ], + "objectGroups": [] + }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ + "description": "the fade-out duration of the object.", + "fullName": "Fade-out duration", + "functionType": "ExpressionAndCondition", + "group": "Button scale tween configuration", + "name": "FadeOutDuration", + "sentence": "the fade-out duration", + "events": [ { - "type": { - "value": "ShakeObject3D::DefineHelperClasses" - }, - "parameters": [ - "", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "FadeOutDuration" + ] + } ] } - ] - } - ], - "parameters": [], - "objectGroups": [] - }, - { + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ButtonStates::ButtonScaleTween", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "FadeOutDuration", + "name": "SetFadeOutDuration", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "FadeOutDuration", + "=", + "Value" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ButtonStates::ButtonScaleTween", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "the fade-in easing of the object.", + "fullName": "Fade-in easing", + "functionType": "ExpressionAndCondition", + "group": "Button scale tween configuration", + "name": "FadeInEasing", + "sentence": "the fade-in easing", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnString" + }, + "parameters": [ + "FadeInEasing" + ] + } + ] + } + ], + "expressionType": { + "supplementaryInformation": "[\"linear\",\"easeInQuad\",\"easeOutQuad\",\"easeInOutQuad\",\"easeInCubic\",\"easeOutCubic\",\"easeInOutCubic\",\"easeInQuart\",\"easeOutQuart\",\"easeInOutQuart\",\"easeInQuint\",\"easeOutQuint\",\"easeInOutQuint\",\"easeInOutSine\",\"easeInExpo\",\"easeOutExpo\",\"easeInOutExpo\",\"easeInCirc\",\"easeOutCirc\",\"easeInOutCirc\",\"easeOutBounce\",\"easeInBack\",\"easeOutBack\",\"easeInOutBack\",\"elastic\",\"swingFromTo\",\"swingFrom\",\"swingTo\",\"bounce\",\"bouncePast\",\"easeFromTo\",\"easeFrom\",\"easeTo\"]", + "type": "stringWithSelector" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ButtonStates::ButtonScaleTween", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "FadeInEasing", + "name": "SetFadeInEasing", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "FadeInEasing", + "=", + "Value" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ButtonStates::ButtonScaleTween", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "the fade-out easing of the object.", + "fullName": "Fade-out easing", + "functionType": "ExpressionAndCondition", + "group": "Button scale tween configuration", + "name": "FadeOutEasing", + "sentence": "the fade-out easing", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnString" + }, + "parameters": [ + "FadeOutEasing" + ] + } + ] + } + ], + "expressionType": { + "supplementaryInformation": "[\"linear\",\"easeInQuad\",\"easeOutQuad\",\"easeInOutQuad\",\"easeInCubic\",\"easeOutCubic\",\"easeInOutCubic\",\"easeInQuart\",\"easeOutQuart\",\"easeInOutQuart\",\"easeInQuint\",\"easeOutQuint\",\"easeInOutQuint\",\"easeInOutSine\",\"easeInExpo\",\"easeOutExpo\",\"easeInOutExpo\",\"easeInCirc\",\"easeOutCirc\",\"easeInOutCirc\",\"easeOutBounce\",\"easeInBack\",\"easeOutBack\",\"easeInOutBack\",\"elastic\",\"swingFromTo\",\"swingFrom\",\"swingTo\",\"bounce\",\"bouncePast\",\"easeFromTo\",\"easeFrom\",\"easeTo\"]", + "type": "stringWithSelector" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ButtonStates::ButtonScaleTween", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "FadeOutEasing", + "name": "SetFadeOutEasing", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "FadeOutEasing", + "=", + "Value" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ButtonStates::ButtonScaleTween", + "type": "behavior" + } + ], + "objectGroups": [] + } + ], + "propertyDescriptors": [ + { + "value": "", + "type": "Behavior", + "label": "Scalable capability", + "extraInformation": [ + "ScalableCapability::ScalableBehavior" + ], + "choices": [], + "name": "Scale" + }, + { + "value": "", + "type": "Behavior", + "label": "Button states behavior (required)", + "extraInformation": [ + "ButtonStates::ButtonFSM" + ], + "choices": [], + "name": "ButtonFSM" + }, + { + "value": "", + "type": "Behavior", + "label": "Tween behavior (required)", + "extraInformation": [ + "Tween::TweenBehavior" + ], + "choices": [], + "name": "Tween" + }, + { + "value": "1", + "type": "Number", + "unit": "Dimensionless", + "label": "Idle state size scale", + "group": "Size", + "name": "IdleScale" + }, + { + "value": "1", + "type": "Number", + "unit": "Dimensionless", + "label": "Focused state size scale", + "description": "The state is Focused when the button is hovered or held outside.", + "group": "Size", + "name": "FocusedScale" + }, + { + "value": "0.1", + "type": "Number", + "unit": "Second", + "label": "Fade-in duration", + "group": "Speed", + "name": "FadeInDuration" + }, + { + "value": "0.2", + "type": "Number", + "unit": "Second", + "label": "Fade-out duration", + "group": "Speed", + "name": "FadeOutDuration" + }, + { + "value": "0.95", + "type": "Number", + "unit": "Dimensionless", + "label": "Pressed state size scale", + "group": "Size", + "name": "PressedScale" + }, + { + "value": "easeInOutQuad", + "type": "Choice", + "label": "Fade-in easing", + "group": "Speed", + "choices": [ + { + "label": "linear", + "value": "linear" + }, + { + "label": "easeInQuad", + "value": "easeInQuad" + }, + { + "label": "easeOutQuad", + "value": "easeOutQuad" + }, + { + "label": "easeInOutQuad", + "value": "easeInOutQuad" + }, + { + "label": "easeInCubic", + "value": "easeInCubic" + }, + { + "label": "easeOutCubic", + "value": "easeOutCubic" + }, + { + "label": "easeInOutCubic", + "value": "easeInOutCubic" + }, + { + "label": "easeInQuart", + "value": "easeInQuart" + }, + { + "label": "easeOutQuart", + "value": "easeOutQuart" + }, + { + "label": "easeInOutQuart", + "value": "easeInOutQuart" + }, + { + "label": "easeInQuint", + "value": "easeInQuint" + }, + { + "label": "easeOutQuint", + "value": "easeOutQuint" + }, + { + "label": "easeInOutQuint", + "value": "easeInOutQuint" + }, + { + "label": "easeInOutSine", + "value": "easeInOutSine" + }, + { + "label": "easeInExpo", + "value": "easeInExpo" + }, + { + "label": "easeOutExpo", + "value": "easeOutExpo" + }, + { + "label": "easeInOutExpo", + "value": "easeInOutExpo" + }, + { + "label": "easeInCirc", + "value": "easeInCirc" + }, + { + "label": "easeOutCirc", + "value": "easeOutCirc" + }, + { + "label": "easeInOutCirc", + "value": "easeInOutCirc" + }, + { + "label": "easeOutBounce", + "value": "easeOutBounce" + }, + { + "label": "easeInBack", + "value": "easeInBack" + }, + { + "label": "easeOutBack", + "value": "easeOutBack" + }, + { + "label": "easeInOutBack", + "value": "easeInOutBack" + }, + { + "label": "elastic", + "value": "elastic" + }, + { + "label": "swingFromTo", + "value": "swingFromTo" + }, + { + "label": "swingFrom", + "value": "swingFrom" + }, + { + "label": "swingTo", + "value": "swingTo" + }, + { + "label": "bounce", + "value": "bounce" + }, + { + "label": "bouncePast", + "value": "bouncePast" + }, + { + "label": "easeFromTo", + "value": "easeFromTo" + }, + { + "label": "easeFrom", + "value": "easeFrom" + }, + { + "label": "easeTo", + "value": "easeTo" + } + ], + "name": "FadeInEasing" + }, + { + "value": "easeInOutQuad", + "type": "Choice", + "label": "Fade-out easing", + "group": "Speed", + "choices": [ + { + "label": "linear", + "value": "linear" + }, + { + "label": "easeInQuad", + "value": "easeInQuad" + }, + { + "label": "easeOutQuad", + "value": "easeOutQuad" + }, + { + "label": "easeInOutQuad", + "value": "easeInOutQuad" + }, + { + "label": "easeInCubic", + "value": "easeInCubic" + }, + { + "label": "easeOutCubic", + "value": "easeOutCubic" + }, + { + "label": "easeInOutCubic", + "value": "easeInOutCubic" + }, + { + "label": "easeInQuart", + "value": "easeInQuart" + }, + { + "label": "easeOutQuart", + "value": "easeOutQuart" + }, + { + "label": "easeInOutQuart", + "value": "easeInOutQuart" + }, + { + "label": "easeInQuint", + "value": "easeInQuint" + }, + { + "label": "easeOutQuint", + "value": "easeOutQuint" + }, + { + "label": "easeInOutQuint", + "value": "easeInOutQuint" + }, + { + "label": "easeInOutSine", + "value": "easeInOutSine" + }, + { + "label": "easeInExpo", + "value": "easeInExpo" + }, + { + "label": "easeOutExpo", + "value": "easeOutExpo" + }, + { + "label": "easeInOutExpo", + "value": "easeInOutExpo" + }, + { + "label": "easeInCirc", + "value": "easeInCirc" + }, + { + "label": "easeOutCirc", + "value": "easeOutCirc" + }, + { + "label": "easeInOutCirc", + "value": "easeInOutCirc" + }, + { + "label": "easeOutBounce", + "value": "easeOutBounce" + }, + { + "label": "easeInBack", + "value": "easeInBack" + }, + { + "label": "easeOutBack", + "value": "easeOutBack" + }, + { + "label": "easeInOutBack", + "value": "easeInOutBack" + }, + { + "label": "elastic", + "value": "elastic" + }, + { + "label": "swingFromTo", + "value": "swingFromTo" + }, + { + "label": "swingFrom", + "value": "swingFrom" + }, + { + "label": "swingTo", + "value": "swingTo" + }, + { + "label": "bounce", + "value": "bounce" + }, + { + "label": "bouncePast", + "value": "bouncePast" + }, + { + "label": "easeFromTo", + "value": "easeFromTo" + }, + { + "label": "easeFrom", + "value": "easeFrom" + }, + { + "label": "easeTo", + "value": "easeTo" + } + ], + "name": "FadeOutEasing" + }, + { + "value": "Idle", + "type": "Choice", + "label": "", + "choices": [ + { + "label": "Idle", + "value": "Idle" + }, + { + "label": "Focused", + "value": "Focused" + }, + { + "label": "Pressed", + "value": "Pressed" + } + ], + "hidden": true, + "name": "PreviousState" + } + ], + "sharedPropertyDescriptors": [] + }, + { + "description": "Smoothly change the color tint of buttons according to their state.", + "fullName": "Button color tint tween", + "name": "ButtonColorTintTween", + "objectType": "Sprite", + "eventsFunctions": [ + { + "fullName": "", + "functionType": "Action", + "name": "onCreated", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "ChangeColor" + }, + "parameters": [ + "Object", + "IdleColorTint" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "Sprite", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ButtonStates::ButtonColorTintTween", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "Action", + "name": "doStepPreEvents", + "sentence": "", + "events": [ + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "States", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "ButtonStates::ButtonFSM::IsIdle" + }, + "parameters": [ + "Object", + "ButtonFSM", + "" + ] + }, + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "PreviousState", + "!=", + "\"Idle\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "PreviousState", + "=", + "\"Idle\"" + ] + }, + { + "type": { + "value": "ButtonStates::ButtonColorTintTween::FadeOut" + }, + "parameters": [ + "Object", + "Behavior", + "IdleColorTint", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "ButtonStates::ButtonFSM::IsFocused" + }, + "parameters": [ + "Object", + "ButtonFSM", + "" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "PreviousState", + "=", + "\"Idle\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "PreviousState", + "=", + "\"Focused\"" + ] + }, + { + "type": { + "value": "ButtonStates::ButtonColorTintTween::FadeIn" + }, + "parameters": [ + "Object", + "Behavior", + "FocusedColorTint", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "PreviousState", + "=", + "\"Pressed\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "PreviousState", + "=", + "\"Focused\"" + ] + }, + { + "type": { + "value": "ButtonStates::ButtonColorTintTween::FadeOut" + }, + "parameters": [ + "Object", + "Behavior", + "FocusedColorTint", + "" + ] + } + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "ButtonStates::ButtonFSM::IsPressed" + }, + "parameters": [ + "Object", + "ButtonFSM", + "" + ] + }, + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "PreviousState", + "!=", + "\"Pressed\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "PreviousState", + "=", + "\"Pressed\"" + ] + }, + { + "type": { + "value": "ButtonStates::ButtonColorTintTween::FadeIn" + }, + "parameters": [ + "Object", + "Behavior", + "PressedColorTint", + "" + ] + } + ] + } + ], + "parameters": [] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "Sprite", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ButtonStates::ButtonColorTintTween", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "Fade in", + "functionType": "Action", + "name": "FadeIn", + "private": true, + "sentence": "_PARAM0_ fade in to _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "Tween::AddObjectColorTween" + }, + "parameters": [ + "Object", + "Tween", + "\"__ButtonColorTintTween.Fade\"", + "Value", + "FadeInEasing", + "1000 * FadeInDuration", + "no", + "yes" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "Sprite", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ButtonStates::ButtonColorTintTween", + "type": "behavior" + }, + { + "description": "Value", + "name": "Value", + "type": "color" + } + ], + "objectGroups": [] + }, + { + "fullName": "Fade out", + "functionType": "Action", + "name": "FadeOut", + "private": true, + "sentence": "_PARAM0_ fade out to _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "Tween::AddObjectColorTween" + }, + "parameters": [ + "Object", + "Tween", + "\"__ButtonColorTintTween.Fade\"", + "Value", + "FadeOutEasing", + "1000 * FadeOutDuration", + "no", + "yes" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "Sprite", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ButtonStates::ButtonColorTintTween", + "type": "behavior" + }, + { + "description": "Value", + "name": "Value", + "type": "color" + } + ], + "objectGroups": [] + }, + { + "description": "the idle state color tint of the object.", + "fullName": "Idle state color tint", + "functionType": "ExpressionAndCondition", + "group": "Button color tint tween", + "name": "IdleColorTint", + "sentence": "the idle state color tint", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnString" + }, + "parameters": [ + "IdleColorTint" + ] + } + ] + } + ], + "expressionType": { + "type": "color" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "Sprite", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ButtonStates::ButtonColorTintTween", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "IdleColorTint", + "name": "SetIdleColorTint", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "IdleColorTint", + "=", + "Value" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "Sprite", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ButtonStates::ButtonColorTintTween", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "the focused state color tint of the object. The state is Focused when the button is hovered or held outside.", + "fullName": "Focused state color tint", + "functionType": "ExpressionAndCondition", + "group": "Button color tint tween", + "name": "FocusedColorTint", + "sentence": "the focused state color tint", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnString" + }, + "parameters": [ + "FocusedColorTint" + ] + } + ] + } + ], + "expressionType": { + "type": "color" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "Sprite", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ButtonStates::ButtonColorTintTween", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "FocusedColorTint", + "name": "SetFocusedColorTint", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "FocusedColorTint", + "=", + "Value" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "Sprite", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ButtonStates::ButtonColorTintTween", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "the pressed state color tint of the object.", + "fullName": "Pressed state color tint", + "functionType": "ExpressionAndCondition", + "group": "Button color tint tween", + "name": "PressedColorTint", + "sentence": "the pressed state color tint", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnString" + }, + "parameters": [ + "PressedColorTint" + ] + } + ] + } + ], + "expressionType": { + "type": "color" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "Sprite", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ButtonStates::ButtonColorTintTween", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "PressedColorTint", + "name": "SetPressedColorTint", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "PressedColorTint", + "=", + "Value" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "Sprite", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ButtonStates::ButtonColorTintTween", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "the fade-in duration of the object.", + "fullName": "Fade-in duration", + "functionType": "ExpressionAndCondition", + "group": "Button color tint tween", + "name": "FadeInDuration", + "sentence": "the fade-in duration", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "FadeInDuration" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "Sprite", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ButtonStates::ButtonColorTintTween", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "FadeInDuration", + "name": "SetFadeInDuration", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "FadeInDuration", + "=", + "Value" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "Sprite", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ButtonStates::ButtonColorTintTween", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "the fade-out duration of the object.", + "fullName": "Fade-out duration", + "functionType": "ExpressionAndCondition", + "group": "Button color tint tween", + "name": "FadeOutDuration", + "sentence": "the fade-out duration", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "FadeOutDuration" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "Sprite", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ButtonStates::ButtonColorTintTween", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "FadeOutDuration", + "name": "SetFadeOutDuration", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "FadeOutDuration", + "=", + "Value" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "Sprite", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ButtonStates::ButtonColorTintTween", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "the fade-in easing of the object.", + "fullName": "Fade-in easing", + "functionType": "ExpressionAndCondition", + "group": "Button color tint tween", + "name": "FadeInEasing", + "sentence": "the fade-in easing", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnString" + }, + "parameters": [ + "FadeInEasing" + ] + } + ] + } + ], + "expressionType": { + "supplementaryInformation": "[\"linear\",\"easeInQuad\",\"easeOutQuad\",\"easeInOutQuad\",\"easeInCubic\",\"easeOutCubic\",\"easeInOutCubic\",\"easeInQuart\",\"easeOutQuart\",\"easeInOutQuart\",\"easeInQuint\",\"easeOutQuint\",\"easeInOutQuint\",\"easeInOutSine\",\"easeInExpo\",\"easeOutExpo\",\"easeInOutExpo\",\"easeInCirc\",\"easeOutCirc\",\"easeInOutCirc\",\"easeOutBounce\",\"easeInBack\",\"easeOutBack\",\"easeInOutBack\",\"elastic\",\"swingFromTo\",\"swingFrom\",\"swingTo\",\"bounce\",\"bouncePast\",\"easeFromTo\",\"easeFrom\",\"easeTo\"]", + "type": "stringWithSelector" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "Sprite", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ButtonStates::ButtonColorTintTween", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "FadeInEasing", + "name": "SetFadeInEasing", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "FadeInEasing", + "=", + "Value" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "Sprite", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ButtonStates::ButtonColorTintTween", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "the fade-out easing of the object.", + "fullName": "Fade-out easing", + "functionType": "ExpressionAndCondition", + "group": "Button color tint tween", + "name": "FadeOutEasing", + "sentence": "the fade-out easing", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnString" + }, + "parameters": [ + "FadeOutEasing" + ] + } + ] + } + ], + "expressionType": { + "supplementaryInformation": "[\"linear\",\"easeInQuad\",\"easeOutQuad\",\"easeInOutQuad\",\"easeInCubic\",\"easeOutCubic\",\"easeInOutCubic\",\"easeInQuart\",\"easeOutQuart\",\"easeInOutQuart\",\"easeInQuint\",\"easeOutQuint\",\"easeInOutQuint\",\"easeInOutSine\",\"easeInExpo\",\"easeOutExpo\",\"easeInOutExpo\",\"easeInCirc\",\"easeOutCirc\",\"easeInOutCirc\",\"easeOutBounce\",\"easeInBack\",\"easeOutBack\",\"easeInOutBack\",\"elastic\",\"swingFromTo\",\"swingFrom\",\"swingTo\",\"bounce\",\"bouncePast\",\"easeFromTo\",\"easeFrom\",\"easeTo\"]", + "type": "stringWithSelector" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "Sprite", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ButtonStates::ButtonColorTintTween", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "FadeOutEasing", + "name": "SetFadeOutEasing", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "FadeOutEasing", + "=", + "Value" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "Sprite", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "ButtonStates::ButtonColorTintTween", + "type": "behavior" + } + ], + "objectGroups": [] + } + ], + "propertyDescriptors": [ + { + "value": "", + "type": "Behavior", + "label": "Button states", + "extraInformation": [ + "ButtonStates::ButtonFSM" + ], + "choices": [], + "name": "ButtonFSM" + }, + { + "value": "", + "type": "Behavior", + "label": "Tween", + "extraInformation": [ + "Tween::TweenBehavior" + ], + "choices": [], + "name": "Tween" + }, + { + "value": "255;255;255", + "type": "Color", + "label": "Idle state color tint", + "group": "Color", + "name": "IdleColorTint" + }, + { + "value": "192;192;192", + "type": "Color", + "label": "Focused state color tint", + "description": "The state is Focused when the button is hovered or held outside.", + "group": "Color", + "name": "FocusedColorTint" + }, + { + "value": "64;64;64", + "type": "Color", + "label": "Pressed state color tint", + "group": "Color", + "name": "PressedColorTint" + }, + { + "value": "0.1", + "type": "Number", + "unit": "Second", + "label": "Fade-in duration", + "group": "Speed", + "name": "FadeInDuration" + }, + { + "value": "0.2", + "type": "Number", + "unit": "Second", + "label": "Fade-out duration", + "group": "Speed", + "name": "FadeOutDuration" + }, + { + "value": "easeInOutQuad", + "type": "Choice", + "label": "Fade-in easing", + "group": "Speed", + "choices": [ + { + "label": "linear", + "value": "linear" + }, + { + "label": "easeInQuad", + "value": "easeInQuad" + }, + { + "label": "easeOutQuad", + "value": "easeOutQuad" + }, + { + "label": "easeInOutQuad", + "value": "easeInOutQuad" + }, + { + "label": "easeInCubic", + "value": "easeInCubic" + }, + { + "label": "easeOutCubic", + "value": "easeOutCubic" + }, + { + "label": "easeInOutCubic", + "value": "easeInOutCubic" + }, + { + "label": "easeInQuart", + "value": "easeInQuart" + }, + { + "label": "easeOutQuart", + "value": "easeOutQuart" + }, + { + "label": "easeInOutQuart", + "value": "easeInOutQuart" + }, + { + "label": "easeInQuint", + "value": "easeInQuint" + }, + { + "label": "easeOutQuint", + "value": "easeOutQuint" + }, + { + "label": "easeInOutQuint", + "value": "easeInOutQuint" + }, + { + "label": "easeInOutSine", + "value": "easeInOutSine" + }, + { + "label": "easeInExpo", + "value": "easeInExpo" + }, + { + "label": "easeOutExpo", + "value": "easeOutExpo" + }, + { + "label": "easeInOutExpo", + "value": "easeInOutExpo" + }, + { + "label": "easeInCirc", + "value": "easeInCirc" + }, + { + "label": "easeOutCirc", + "value": "easeOutCirc" + }, + { + "label": "easeInOutCirc", + "value": "easeInOutCirc" + }, + { + "label": "easeOutBounce", + "value": "easeOutBounce" + }, + { + "label": "easeInBack", + "value": "easeInBack" + }, + { + "label": "easeOutBack", + "value": "easeOutBack" + }, + { + "label": "easeInOutBack", + "value": "easeInOutBack" + }, + { + "label": "elastic", + "value": "elastic" + }, + { + "label": "swingFromTo", + "value": "swingFromTo" + }, + { + "label": "swingFrom", + "value": "swingFrom" + }, + { + "label": "swingTo", + "value": "swingTo" + }, + { + "label": "bounce", + "value": "bounce" + }, + { + "label": "bouncePast", + "value": "bouncePast" + }, + { + "label": "easeFromTo", + "value": "easeFromTo" + }, + { + "label": "easeFrom", + "value": "easeFrom" + }, + { + "label": "easeTo", + "value": "easeTo" + } + ], + "name": "FadeInEasing" + }, + { + "value": "easeInOutQuad", + "type": "Choice", + "label": "Fade-out easing", + "group": "Speed", + "choices": [ + { + "label": "linear", + "value": "linear" + }, + { + "label": "easeInQuad", + "value": "easeInQuad" + }, + { + "label": "easeOutQuad", + "value": "easeOutQuad" + }, + { + "label": "easeInOutQuad", + "value": "easeInOutQuad" + }, + { + "label": "easeInCubic", + "value": "easeInCubic" + }, + { + "label": "easeOutCubic", + "value": "easeOutCubic" + }, + { + "label": "easeInOutCubic", + "value": "easeInOutCubic" + }, + { + "label": "easeInQuart", + "value": "easeInQuart" + }, + { + "label": "easeOutQuart", + "value": "easeOutQuart" + }, + { + "label": "easeInOutQuart", + "value": "easeInOutQuart" + }, + { + "label": "easeInQuint", + "value": "easeInQuint" + }, + { + "label": "easeOutQuint", + "value": "easeOutQuint" + }, + { + "label": "easeInOutQuint", + "value": "easeInOutQuint" + }, + { + "label": "easeInOutSine", + "value": "easeInOutSine" + }, + { + "label": "easeInExpo", + "value": "easeInExpo" + }, + { + "label": "easeOutExpo", + "value": "easeOutExpo" + }, + { + "label": "easeInOutExpo", + "value": "easeInOutExpo" + }, + { + "label": "easeInCirc", + "value": "easeInCirc" + }, + { + "label": "easeOutCirc", + "value": "easeOutCirc" + }, + { + "label": "easeInOutCirc", + "value": "easeInOutCirc" + }, + { + "label": "easeOutBounce", + "value": "easeOutBounce" + }, + { + "label": "easeInBack", + "value": "easeInBack" + }, + { + "label": "easeOutBack", + "value": "easeOutBack" + }, + { + "label": "easeInOutBack", + "value": "easeInOutBack" + }, + { + "label": "elastic", + "value": "elastic" + }, + { + "label": "swingFromTo", + "value": "swingFromTo" + }, + { + "label": "swingFrom", + "value": "swingFrom" + }, + { + "label": "swingTo", + "value": "swingTo" + }, + { + "label": "bounce", + "value": "bounce" + }, + { + "label": "bouncePast", + "value": "bouncePast" + }, + { + "label": "easeFromTo", + "value": "easeFromTo" + }, + { + "label": "easeFrom", + "value": "easeFrom" + }, + { + "label": "easeTo", + "value": "easeTo" + } + ], + "name": "FadeOutEasing" + }, + { + "value": "Idle", + "type": "Choice", + "label": "", + "choices": [ + { + "label": "Idle", + "value": "Idle" + }, + { + "label": "Focused", + "value": "Focused" + }, + { + "label": "Pressed", + "value": "Pressed" + } + ], + "hidden": true, + "name": "PreviousState" + } + ], + "sharedPropertyDescriptors": [] + } + ], + "eventsBasedObjects": [] + }, + { + "author": "", + "category": "Visual effect", + "extensionNamespace": "", + "fullName": "3D object shake", + "gdevelopVersion": ">=5.5.222", + "helpPath": "", + "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0ibWRpLXZlY3Rvci1kaWZmZXJlbmNlLWFiIiB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCI+PHBhdGggZD0iTTMsMUMxLjg5LDEgMSwxLjg5IDEsM1Y1SDNWM0g1VjFIM003LDFWM0gxMFYxSDdNMTIsMVYzSDE0VjVIMTZWM0MxNiwxLjg5IDE1LjExLDEgMTQsMUgxMk0xLDdWMTBIM1Y3SDFNMTQsN0MxNCw3IDE0LDExLjY3IDE0LDE0QzExLjY3LDE0IDcsMTQgNywxNEM3LDE0IDcsMTggNywyMEM3LDIxLjExIDcuODksMjIgOSwyMkgyMEMyMS4xMSwyMiAyMiwyMS4xMSAyMiwyMFY5QzIyLDcuODkgMjEuMTEsNyAyMCw3QzE4LDcgMTQsNyAxNCw3TTE2LDlIMjBWMjBIOVYxNkgxNEMxNS4xMSwxNiAxNiwxNS4xMSAxNiwxNFY5TTEsMTJWMTRDMSwxNS4xMSAxLjg5LDE2IDMsMTZINVYxNEgzVjEySDFaIiAvPjwvc3ZnPg==", + "name": "ShakeObject3D", + "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/vector-difference-ab.svg", + "shortDescription": "Shake 3D objects.", + "version": "2.1.0", + "description": [ + "Shake 3D objects with translation and rotation.", + "", + "The 3D racing game example uses this extension ([open the project online](https://editor.gdevelop.io/?project=example://3d-racing-game))." + ], + "origin": { + "identifier": "ShakeObject3D", + "name": "gdevelop-extension-store" + }, + "tags": [ + "3d", + "shaking", + "effect", + "shake", + "translate", + "rotate" + ], + "authorIds": [ + "IWykYNRvhCZBN3vEgKEbBPOR3Oc2" + ], + "changelog": [ + { + "version": "2.0.0", + "breaking": "- The behavior for 3D box has been removed. The other behavior can be used for both models and boxes." + } + ], + "dependencies": [], + "globalVariables": [], + "sceneVariables": [], + "eventsFunctions": [ + { + "fullName": "", + "functionType": "Action", + "name": "onFirstSceneLoaded", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "ShakeObject3D::DefineHelperClasses" + }, + "parameters": [ + "", + "" + ] + } + ] + } + ], + "parameters": [], + "objectGroups": [] + }, + { "description": "Define helper classes JavaScript code.", "fullName": "Define helper classes", "functionType": "Action", @@ -12063,11 +13537,12 @@ "conditions": [ { "type": { - "value": "ShakeObject3D::ShakeModel3D::PropertyIsStartingAtCreation" + "value": "BooleanVariable" }, "parameters": [ - "Object", - "Behavior" + "IsStartingAtCreation", + "True", + "" ] } ], @@ -12134,11 +13609,10 @@ "actions": [ { "type": { - "value": "ShakeObject3D::ShakeModel3D::SetPropertyTime" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "Time", "+", "TimeDelta()" ] @@ -12162,11 +13636,10 @@ "actions": [ { "type": { - "value": "ShakeObject3D::ShakeModel3D::SetPropertyNoiseTime" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "NoiseTime", "+", "TimeDelta() * Frequency" ] @@ -12201,11 +13674,10 @@ "conditions": [ { "type": { - "value": "ShakeObject3D::ShakeModel3D::PropertyTranslationAmplitudeX" + "value": "NumberVariable" }, "parameters": [ - "Object", - "Behavior", + "TranslationAmplitudeX", "!=", "0" ] @@ -12214,11 +13686,10 @@ "actions": [ { "type": { - "value": "ShakeObject3D::ShakeModel3D::SetPropertyDeltaX" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "DeltaX", "=", "ShakeObject3D::Noise2d(\"\", NoiseTime, 1000) * TranslationAmplitudeX * EasingFactor" ] @@ -12240,11 +13711,10 @@ "conditions": [ { "type": { - "value": "ShakeObject3D::ShakeModel3D::PropertyTranslationAmplitudeY" + "value": "NumberVariable" }, "parameters": [ - "Object", - "Behavior", + "TranslationAmplitudeY", "!=", "0" ] @@ -12253,11 +13723,10 @@ "actions": [ { "type": { - "value": "ShakeObject3D::ShakeModel3D::SetPropertyDeltaY" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "DeltaY", "=", "ShakeObject3D::Noise2d(\"\", NoiseTime, 2000) * TranslationAmplitudeY * EasingFactor" ] @@ -12279,11 +13748,10 @@ "conditions": [ { "type": { - "value": "ShakeObject3D::ShakeModel3D::PropertyTranslationAmplitudeZ" + "value": "NumberVariable" }, "parameters": [ - "Object", - "Behavior", + "TranslationAmplitudeZ", "!=", "0" ] @@ -12292,11 +13760,10 @@ "actions": [ { "type": { - "value": "ShakeObject3D::ShakeModel3D::SetPropertyDeltaZ" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "DeltaZ", "=", "ShakeObject3D::Noise2d(\"\", NoiseTime, 3000) * TranslationAmplitudeZ * EasingFactor" ] @@ -12319,11 +13786,10 @@ "conditions": [ { "type": { - "value": "ShakeObject3D::ShakeModel3D::PropertyRotationAmplitudeX" + "value": "NumberVariable" }, "parameters": [ - "Object", - "Behavior", + "RotationAmplitudeX", "!=", "0" ] @@ -12332,11 +13798,10 @@ "actions": [ { "type": { - "value": "ShakeObject3D::ShakeModel3D::SetPropertyDeltaAngleX" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "DeltaAngleX", "=", "ShakeObject3D::Noise2d(\"\", NoiseTime, 4000) * RotationAmplitudeX * EasingFactor" ] @@ -12359,11 +13824,10 @@ "conditions": [ { "type": { - "value": "ShakeObject3D::ShakeModel3D::PropertyRotationAmplitudeY" + "value": "NumberVariable" }, "parameters": [ - "Object", - "Behavior", + "RotationAmplitudeY", "!=", "0" ] @@ -12372,11 +13836,10 @@ "actions": [ { "type": { - "value": "ShakeObject3D::ShakeModel3D::SetPropertyDeltaAngleY" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "DeltaAngleY", "=", "ShakeObject3D::Noise2d(\"\", NoiseTime, 5000) * RotationAmplitudeY * EasingFactor" ] @@ -12399,11 +13862,10 @@ "conditions": [ { "type": { - "value": "ShakeObject3D::ShakeModel3D::PropertyRotationAmplitudeZ" + "value": "NumberVariable" }, "parameters": [ - "Object", - "Behavior", + "RotationAmplitudeZ", "!=", "0" ] @@ -12412,11 +13874,10 @@ "actions": [ { "type": { - "value": "ShakeObject3D::ShakeModel3D::SetPropertyDeltaAngleZ" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "DeltaAngleZ", "=", "ShakeObject3D::Noise2d(\"\", NoiseTime, 6000) * RotationAmplitudeZ * EasingFactor" ] @@ -12490,11 +13951,10 @@ "conditions": [ { "type": { - "value": "ShakeObject3D::ShakeModel3D::PropertyTranslationAmplitudeX" + "value": "NumberVariable" }, "parameters": [ - "Object", - "Behavior", + "TranslationAmplitudeX", "!=", "0" ] @@ -12518,11 +13978,10 @@ "conditions": [ { "type": { - "value": "ShakeObject3D::ShakeModel3D::PropertyTranslationAmplitudeY" + "value": "NumberVariable" }, "parameters": [ - "Object", - "Behavior", + "TranslationAmplitudeY", "!=", "0" ] @@ -12546,11 +14005,10 @@ "conditions": [ { "type": { - "value": "ShakeObject3D::ShakeModel3D::PropertyTranslationAmplitudeZ" + "value": "NumberVariable" }, "parameters": [ - "Object", - "Behavior", + "TranslationAmplitudeZ", "!=", "0" ] @@ -12575,11 +14033,10 @@ "conditions": [ { "type": { - "value": "ShakeObject3D::ShakeModel3D::PropertyRotationAmplitudeX" + "value": "NumberVariable" }, "parameters": [ - "Object", - "Behavior", + "RotationAmplitudeX", "!=", "0" ] @@ -12604,11 +14061,10 @@ "conditions": [ { "type": { - "value": "ShakeObject3D::ShakeModel3D::PropertyRotationAmplitudeY" + "value": "NumberVariable" }, "parameters": [ - "Object", - "Behavior", + "RotationAmplitudeY", "!=", "0" ] @@ -12633,11 +14089,10 @@ "conditions": [ { "type": { - "value": "ShakeObject3D::ShakeModel3D::PropertyRotationAmplitudeZ" + "value": "NumberVariable" }, "parameters": [ - "Object", - "Behavior", + "RotationAmplitudeZ", "!=", "0" ] @@ -12687,55 +14142,50 @@ "actions": [ { "type": { - "value": "ShakeObject3D::ShakeModel3D::SetPropertyTime" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "Time", "=", "0" ] }, { "type": { - "value": "ShakeObject3D::ShakeModel3D::SetPropertyNoiseTime" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "NoiseTime", "=", "TimeFromStart() * Frequency" ] }, { "type": { - "value": "ShakeObject3D::ShakeModel3D::SetPropertyDuration" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "Duration", "=", "NewDuration" ] }, { "type": { - "value": "ShakeObject3D::ShakeModel3D::SetPropertyStartEasingDuration" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "StartEasingDuration", "=", "StartEaseDuration" ] }, { "type": { - "value": "ShakeObject3D::ShakeModel3D::SetPropertyStopEasingDuration" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "StopEasingDuration", "=", "StopEaseDuration" ] @@ -12747,10 +14197,10 @@ "conditions": [ { "type": { - "value": "CompareArgumentAsNumber" + "value": "NumberVariable" }, "parameters": [ - "\"NewDuration\"", + "NewDuration", "<", "StartEaseDuration + StopEaseDuration" ] @@ -12759,22 +14209,20 @@ "actions": [ { "type": { - "value": "ShakeObject3D::ShakeModel3D::SetPropertyStartEasingDuration" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "StartEasingDuration", "=", "StartEaseDuration * NewDuration / (StartEaseDuration + StopEaseDuration)" ] }, { "type": { - "value": "ShakeObject3D::ShakeModel3D::SetPropertyStopEasingDuration" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "StopEasingDuration", "=", "StopEaseDuration * NewDuration / (StartEaseDuration + StopEaseDuration)" ] @@ -12825,44 +14273,40 @@ "actions": [ { "type": { - "value": "ShakeObject3D::ShakeModel3D::SetPropertyTime" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "Time", "=", "0" ] }, { "type": { - "value": "ShakeObject3D::ShakeModel3D::SetPropertyNoiseTime" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "NoiseTime", "=", "TimeFromStart() * Frequency" ] }, { "type": { - "value": "ShakeObject3D::ShakeModel3D::SetPropertyDuration" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "Duration", "=", "1234567890" ] }, { "type": { - "value": "ShakeObject3D::ShakeModel3D::SetPropertyStartEasingDuration" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "StartEasingDuration", "=", "EaseDuration" ] @@ -12914,33 +14358,30 @@ "actions": [ { "type": { - "value": "ShakeObject3D::ShakeModel3D::SetPropertyTime" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "Time", "=", "0" ] }, { "type": { - "value": "ShakeObject3D::ShakeModel3D::SetPropertyDuration" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "Duration", "=", "EaseDuration" ] }, { "type": { - "value": "ShakeObject3D::ShakeModel3D::SetPropertyStopEasingDuration" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "StopEasingDuration", "=", "EaseDuration" ] @@ -12980,22 +14421,20 @@ "conditions": [ { "type": { - "value": "ShakeObject3D::ShakeModel3D::PropertyTime" + "value": "NumberVariable" }, "parameters": [ - "Object", - "Behavior", + "Time", "<", "Duration" ] }, { "type": { - "value": "ShakeObject3D::ShakeModel3D::PropertyTime" + "value": "NumberVariable" }, "parameters": [ - "Object", - "Behavior", + "Time", ">", "0" ] @@ -13142,11 +14581,10 @@ "actions": [ { "type": { - "value": "ShakeObject3D::ShakeModel3D::SetPropertyFrequency" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "Frequency", "=", "Value" ] @@ -13182,11 +14620,10 @@ "conditions": [ { "type": { - "value": "ShakeObject3D::ShakeModel3D::PropertyStartEasingDuration" + "value": "NumberVariable" }, "parameters": [ - "Object", - "Behavior", + "StartEasingDuration", "<=", "0" ] @@ -13208,11 +14645,10 @@ "conditions": [ { "type": { - "value": "ShakeObject3D::ShakeModel3D::PropertyStartEasingDuration" + "value": "NumberVariable" }, "parameters": [ - "Object", - "Behavior", + "StartEasingDuration", ">", "0" ] @@ -13261,11 +14697,10 @@ "conditions": [ { "type": { - "value": "ShakeObject3D::ShakeModel3D::PropertyStopEasingDuration" + "value": "NumberVariable" }, "parameters": [ - "Object", - "Behavior", + "StopEasingDuration", "<=", "0" ] @@ -13278,11 +14713,10 @@ "conditions": [ { "type": { - "value": "ShakeObject3D::ShakeModel3D::PropertyTime" + "value": "NumberVariable" }, "parameters": [ - "Object", - "Behavior", + "Time", "<", "Duration" ] @@ -13304,11 +14738,10 @@ "conditions": [ { "type": { - "value": "ShakeObject3D::ShakeModel3D::PropertyTime" + "value": "NumberVariable" }, "parameters": [ - "Object", - "Behavior", + "Time", ">=", "Duration" ] @@ -13332,11 +14765,10 @@ "conditions": [ { "type": { - "value": "ShakeObject3D::ShakeModel3D::PropertyStopEasingDuration" + "value": "NumberVariable" }, "parameters": [ - "Object", - "Behavior", + "StopEasingDuration", ">", "0" ] @@ -13379,9 +14811,6 @@ "type": "Number", "unit": "Pixel", "label": "Translation amplitude on X axis", - "description": "", - "group": "", - "extraInformation": [], "name": "TranslationAmplitudeX" }, { @@ -13389,9 +14818,6 @@ "type": "Number", "unit": "Pixel", "label": "Translation amplitude on Y axis", - "description": "", - "group": "", - "extraInformation": [], "name": "TranslationAmplitudeY" }, { @@ -13399,9 +14825,6 @@ "type": "Number", "unit": "Pixel", "label": "Translation amplitude on Z axis", - "description": "", - "group": "", - "extraInformation": [], "name": "TranslationAmplitudeZ" }, { @@ -13409,9 +14832,6 @@ "type": "Number", "unit": "DegreeAngle", "label": "Rotation amplitude around X axis", - "description": "", - "group": "", - "extraInformation": [], "name": "RotationAmplitudeX" }, { @@ -13419,9 +14839,6 @@ "type": "Number", "unit": "DegreeAngle", "label": "Rotation amplitude around Y axis", - "description": "", - "group": "", - "extraInformation": [], "name": "RotationAmplitudeY" }, { @@ -13429,18 +14846,12 @@ "type": "Number", "unit": "DegreeAngle", "label": "Rotation amplitude around Z axis", - "description": "", - "group": "", - "extraInformation": [], "name": "RotationAmplitudeZ" }, { "value": "", "type": "Number", "label": "", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "Time" }, @@ -13448,9 +14859,6 @@ "value": "", "type": "Number", "label": "", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "Duration" }, @@ -13458,9 +14866,6 @@ "value": "", "type": "Number", "label": "", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "StartEasingDuration" }, @@ -13468,9 +14873,6 @@ "value": "", "type": "Number", "label": "", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "StopEasingDuration" }, @@ -13478,18 +14880,12 @@ "value": "", "type": "Number", "label": "Frequency", - "description": "", - "group": "", - "extraInformation": [], "name": "Frequency" }, { "value": "", "type": "Number", "label": "", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "DeltaX" }, @@ -13497,9 +14893,6 @@ "value": "", "type": "Number", "label": "", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "DeltaY" }, @@ -13507,9 +14900,6 @@ "value": "", "type": "Number", "label": "", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "DeltaZ" }, @@ -13517,9 +14907,6 @@ "value": "", "type": "Number", "label": "", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "DeltaAngleX" }, @@ -13527,9 +14914,6 @@ "value": "", "type": "Number", "label": "", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "DeltaAngleY" }, @@ -13537,9 +14921,6 @@ "value": "", "type": "Number", "label": "", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "DeltaAngleZ" }, @@ -13547,9 +14928,6 @@ "value": "", "type": "Number", "label": "", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "NoiseTime" }, @@ -13557,20 +14935,16 @@ "value": "", "type": "Behavior", "label": "3D capability", - "description": "", - "group": "", "extraInformation": [ "Scene3D::Base3DBehavior" ], + "choices": [], "name": "Object3D" }, { "value": "", "type": "Boolean", "label": "Start to shake at the object creation", - "description": "", - "group": "", - "extraInformation": [], "name": "IsStartingAtCreation" } ], @@ -13579,9 +14953,6 @@ "value": "", "type": "Number", "label": "", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "EasingFactor" } @@ -13595,14 +14966,15 @@ "category": "Visual effect", "extensionNamespace": "", "fullName": "Flash object", + "gdevelopVersion": ">=5.5.222", "helpPath": "", "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0ibWRpLWZsYXNoLW91dGxpbmUiIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNNywySDE3TDEzLjUsOUgxN0wxMCwyMlYxNEg3VjJNOSw0VjEySDEyVjE0LjY2TDE0LDExSDEwLjI0TDEzLjc2LDRIOVoiIC8+PC9zdmc+", "name": "Flash", "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/flash-outline.svg", "shortDescription": "Make an object flash visibility (blink), color tint, object effect, or opacity (fade).", - "version": "1.2.0", + "version": "1.4.0", "description": [ - "Make an object flash for a period of time so that it alternates between two different states.", + "Make a 2D object flash for a period of time so that it alternates between two different states.", "Includes the ability to flash visibility (blink), color tint, object effect, or opacity (fade).", "", "After adding a behavior to an object, you **trigger the effect** by using the **Flash action**.", @@ -13643,6 +15015,7 @@ "fullName": "Color tint applied to an object", "functionType": "ExpressionAndCondition", "name": "ColorTint", + "private": true, "sentence": "Color tint applied to _PARAM1_", "events": [ { @@ -13688,6 +15061,7 @@ "fullName": "Is a color tint applied to an object", "functionType": "StringExpression", "name": "IsTinted", + "private": true, "sentence": "_PARAM1_ is color tinted", "events": [ { @@ -13732,117 +15106,6 @@ ], "objectGroups": [] }, - { - "description": "Toggle an object effect.", - "fullName": "Toggle an object effect", - "functionType": "Action", - "name": "ToggleEffect", - "sentence": "Toggle effect _PARAM2_ on _PARAM1_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetObjectVariableAsBoolean" - }, - "parameters": [ - "Object", - "__Flash_EffectToggled", - "False" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "IsEffectEnabled" - }, - "parameters": [ - "Object", - "GetArgumentAsString(\"EffectName\")" - ] - } - ], - "actions": [ - { - "type": { - "value": "EnableEffect" - }, - "parameters": [ - "Object", - "GetArgumentAsString(\"EffectName\")", - "" - ] - }, - { - "type": { - "value": "SetObjectVariableAsBoolean" - }, - "parameters": [ - "Object", - "__Flash_EffectToggled", - "True" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "ObjectVariableAsBoolean" - }, - "parameters": [ - "Object", - "__Flash_EffectToggled", - "False" - ] - }, - { - "type": { - "inverted": true, - "value": "IsEffectEnabled" - }, - "parameters": [ - "Object", - "GetArgumentAsString(\"EffectName\")" - ] - } - ], - "actions": [ - { - "type": { - "value": "EnableEffect" - }, - "parameters": [ - "Object", - "GetArgumentAsString(\"EffectName\")", - "yes" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "objectList" - }, - { - "description": "Effect name to toggle", - "name": "EffectName", - "type": "objectEffectName" - } - ], - "objectGroups": [] - }, { "description": "Toggle color tint between the starting tint and a given value.", "fullName": "Toggle a color tint", @@ -13910,7 +15173,7 @@ }, "parameters": [ "Object", - "GetArgumentAsString(\"ColorTint\")" + "ColorTint" ] }, { @@ -13988,6 +15251,7 @@ "fullName": "Toggle object visibility", "functionType": "Action", "name": "ToggleVisibility", + "private": true, "sentence": "Toggle visibility of _PARAM1_", "events": [ { @@ -14103,11 +15367,12 @@ "conditions": [ { "type": { - "value": "Flash::Flash::PropertyIsFlashing" + "value": "BooleanVariable" }, "parameters": [ - "Object", - "Behavior" + "IsFlashing", + "True", + "" ] } ], @@ -14133,7 +15398,7 @@ "Object", "\"Flash_Visibility_Timer\"", ">", - "Object.Behavior::PropertyHalfPeriodTime()" + "HalfPeriodTime" ] } ], @@ -14176,11 +15441,10 @@ "conditions": [ { "type": { - "value": "Flash::Flash::PropertyFlashDuration" + "value": "NumberVariable" }, "parameters": [ - "Object", - "Behavior", + "FlashDuration", ">", "0" ] @@ -14193,7 +15457,7 @@ "Object", "\"Flash_Visibility_Duration_Timer\"", ">", - "Object.Behavior::PropertyFlashDuration()" + "FlashDuration" ] } ], @@ -14266,12 +15530,12 @@ }, { "type": { - "value": "Flash::Flash::SetPropertyIsFlashing" + "value": "SetBooleanVariable" }, "parameters": [ - "Object", - "Behavior", - "yes" + "IsFlashing", + "True", + "" ] }, { @@ -14300,13 +15564,12 @@ }, { "type": { - "value": "Flash::Flash::SetPropertyFlashDuration" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "FlashDuration", "=", - "GetArgumentAsNumber(\"FlashDuration\")" + "NewFlashDuration" ] } ] @@ -14327,7 +15590,7 @@ { "description": "Duration of the flashing, in seconds", "longDescription": "Use \"0\" to keep flashing until stopped.", - "name": "FlashDuration", + "name": "NewFlashDuration", "type": "expression" } ], @@ -14359,11 +15622,12 @@ "conditions": [ { "type": { - "value": "Flash::Flash::PropertyIsFlashing" + "value": "BooleanVariable" }, "parameters": [ - "Object", - "Behavior" + "IsFlashing", + "True", + "" ] } ], @@ -14444,11 +15708,12 @@ "conditions": [ { "type": { - "value": "Flash::Flash::PropertyIsFlashing" + "value": "BooleanVariable" }, "parameters": [ - "Object", - "Behavior" + "IsFlashing", + "True", + "" ] } ], @@ -14464,12 +15729,12 @@ }, { "type": { - "value": "Flash::Flash::SetPropertyIsFlashing" + "value": "SetBooleanVariable" }, "parameters": [ - "Object", - "Behavior", - "no" + "IsFlashing", + "False", + "" ] }, { @@ -14525,7 +15790,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "Object.Behavior::PropertyHalfPeriodTime()" + "HalfPeriodTime" ] } ] @@ -14562,13 +15827,12 @@ "actions": [ { "type": { - "value": "Flash::Flash::SetPropertyHalfPeriodTime" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "HalfPeriodTime", "=", - "GetArgumentAsNumber(\"Value\")" + "Value" ] } ] @@ -14597,17 +15861,12 @@ "unit": "Second", "label": "Half period ", "description": "Time that the object is invisible", - "group": "", - "extraInformation": [], "name": "HalfPeriodTime" }, { "value": "", "type": "Boolean", "label": "", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "IsFlashing" }, @@ -14617,8 +15876,6 @@ "unit": "Second", "label": "Flash duration", "description": "Use \"0\" to keep flashing until stopped", - "group": "", - "extraInformation": [], "hidden": true, "name": "FlashDuration" } @@ -14642,11 +15899,12 @@ "conditions": [ { "type": { - "value": "Flash::FlashColor::PropertyIsFlashing" + "value": "BooleanVariable" }, "parameters": [ - "Object", - "Behavior" + "IsFlashing", + "True", + "" ] } ], @@ -14672,7 +15930,7 @@ "Object", "\"Flash_Color_Timer\"", ">", - "Object.Behavior::PropertyHalfPeriodTime()" + "HalfPeriodTime" ] } ], @@ -14693,7 +15951,7 @@ "parameters": [ "", "Object", - "Object.Behavior::PropertyTintColor()", + "TintColor", "" ] } @@ -14716,11 +15974,10 @@ "conditions": [ { "type": { - "value": "Flash::FlashColor::PropertyFlashDuration" + "value": "NumberVariable" }, "parameters": [ - "Object", - "Behavior", + "FlashDuration", ">", "0" ] @@ -14733,7 +15990,7 @@ "Object", "\"Flash_Color_Duration_Timer\"", ">", - "Object.Behavior::PropertyFlashDuration()" + "FlashDuration" ] } ], @@ -14785,11 +16042,12 @@ { "type": { "inverted": true, - "value": "Flash::FlashColor::PropertyIsFlashing" + "value": "BooleanVariable" }, "parameters": [ - "Object", - "Behavior" + "IsFlashing", + "True", + "" ] } ], @@ -14821,18 +16079,18 @@ "parameters": [ "", "Object", - "GetArgumentAsString(\"ColorTint\")", + "NewColorTint", "" ] }, { "type": { - "value": "Flash::FlashColor::SetPropertyIsFlashing" + "value": "SetBooleanVariable" }, "parameters": [ - "Object", - "Behavior", - "yes" + "IsFlashing", + "True", + "" ] } ] @@ -14852,24 +16110,22 @@ }, { "type": { - "value": "Flash::FlashColor::SetPropertyTintColor" + "value": "SetStringVariable" }, "parameters": [ - "Object", - "Behavior", + "TintColor", "=", - "GetArgumentAsString(\"ColorTint\")" + "NewColorTint" ] }, { "type": { - "value": "Flash::FlashColor::SetPropertyFlashDuration" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "FlashDuration", "=", - "GetArgumentAsNumber(\"FlashDuration\")" + "NewFlashDuration" ] } ] @@ -14891,12 +16147,12 @@ { "description": "Duration of the flashing, in seconds", "longDescription": "Use \"0\" to keep flashing until stopped.", - "name": "FlashDuration", + "name": "NewFlashDuration", "type": "expression" }, { "description": "Color tint", - "name": "ColorTint", + "name": "NewColorTint", "type": "color" } ], @@ -14928,11 +16184,12 @@ "conditions": [ { "type": { - "value": "Flash::FlashColor::PropertyIsFlashing" + "value": "BooleanVariable" }, "parameters": [ - "Object", - "Behavior" + "IsFlashing", + "True", + "" ] } ], @@ -15015,23 +16272,24 @@ "conditions": [ { "type": { - "value": "Flash::FlashColor::PropertyIsFlashing" + "value": "BooleanVariable" }, "parameters": [ - "Object", - "Behavior" + "IsFlashing", + "True", + "" ] } ], "actions": [ { "type": { - "value": "Flash::FlashColor::SetPropertyIsFlashing" + "value": "SetBooleanVariable" }, "parameters": [ - "Object", - "Behavior", - "no" + "IsFlashing", + "False", + "" ] }, { @@ -15097,7 +16355,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "Object.Behavior::PropertyHalfPeriodTime()" + "HalfPeriodTime" ] } ] @@ -15135,13 +16393,12 @@ "actions": [ { "type": { - "value": "Flash::FlashColor::SetPropertyHalfPeriodTime" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "HalfPeriodTime", "=", - "GetArgumentAsNumber(\"Value\")" + "Value" ] } ] @@ -15171,17 +16428,12 @@ "unit": "Second", "label": "Half period", "description": "Time between flashes", - "group": "", - "extraInformation": [], "name": "HalfPeriodTime" }, { "value": "", "type": "Boolean", "label": "", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "IsFlashing" }, @@ -15191,8 +16443,6 @@ "unit": "Second", "label": "Flash duration", "description": "Use \"0\" to keep flashing until stopped", - "group": "", - "extraInformation": [], "hidden": true, "name": "FlashDuration" }, @@ -15200,9 +16450,6 @@ "value": "\"255;255;255\"", "type": "String", "label": "Tint color", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "TintColor" } @@ -15213,7 +16460,7 @@ "description": "Flash opacity smoothly (fade) in a repeating loop.", "fullName": "Flash opacity smothly (fade)", "name": "FlashOpacity", - "objectType": "Sprite", + "objectType": "", "eventsFunctions": [ { "fullName": "", @@ -15269,9 +16516,9 @@ "Object", "TweenBehavior", "\"__Flash.ToStartingOpacity\"", - "Object.Behavior::PropertyStartingOpacity()", + "StartingOpacity", "\"easeInOutCubic\"", - "1000 * Object.Behavior::PropertyHalfPeriodTime()", + "1000 * HalfPeriodTime", "" ] }, @@ -15310,9 +16557,9 @@ "Object", "TweenBehavior", "\"__Flash.ToTargetOpacity\"", - "Object.Behavior::PropertyTargetOpacity()", + "TargetOpacity", "\"easeInOutCubic\"", - "1000 * Object.Behavior::PropertyHalfPeriodTime()", + "1000 * HalfPeriodTime", "" ] }, @@ -15345,11 +16592,10 @@ "conditions": [ { "type": { - "value": "Flash::FlashOpacity::PropertyFlashDuration" + "value": "NumberVariable" }, "parameters": [ - "Object", - "Behavior", + "FlashDuration", ">", "0" ] @@ -15362,7 +16608,7 @@ "Object", "\"Flash_Opacity_Duration_Timer\"", ">", - "Object.Behavior::PropertyFlashDuration()" + "FlashDuration" ] } ], @@ -15389,7 +16635,6 @@ { "description": "Object", "name": "Object", - "supplementaryInformation": "Sprite", "type": "object" }, { @@ -15414,24 +16659,24 @@ { "type": { "inverted": true, - "value": "Flash::FlashOpacity::PropertyIsFlashing" + "value": "BooleanVariable" }, "parameters": [ - "Object", - "Behavior" + "IsFlashing", + "True", + "" ] } ], "actions": [ { "type": { - "value": "Flash::FlashOpacity::SetPropertyStartingOpacity" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "StartingOpacity", "=", - "Object.Opacity()" + "Object.Opacity::Value()" ] }, { @@ -15442,20 +16687,20 @@ "Object", "TweenBehavior", "\"__Flash.ToTargetOpacity\"", - "GetArgumentAsNumber(\"TargetOpacity\")", + "NewTargetOpacity", "\"easeInOutCubic\"", - "1000 * Object.Behavior::PropertyHalfPeriodTime()", + "1000 * HalfPeriodTime", "" ] }, { "type": { - "value": "Flash::FlashOpacity::SetPropertyIsFlashing" + "value": "SetBooleanVariable" }, "parameters": [ - "Object", - "Behavior", - "yes" + "IsFlashing", + "True", + "" ] } ] @@ -15475,24 +16720,22 @@ }, { "type": { - "value": "Flash::FlashOpacity::SetPropertyFlashDuration" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "FlashDuration", "=", - "GetArgumentAsNumber(\"FlashDuration\")" + "NewFlashDuration" ] }, { "type": { - "value": "Flash::FlashOpacity::SetPropertyTargetOpacity" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "TargetOpacity", "=", - "GetArgumentAsNumber(\"TargetOpacity\")" + "NewTargetOpacity" ] } ] @@ -15502,7 +16745,6 @@ { "description": "Object", "name": "Object", - "supplementaryInformation": "Sprite", "type": "object" }, { @@ -15520,12 +16762,12 @@ { "description": "Duration of the flashing, in seconds", "longDescription": "Use \"0\" to keep flashing until stopped.", - "name": "FlashDuration", + "name": "NewFlashDuration", "type": "expression" }, { "description": "Target opacity", - "name": "TargetOpacity", + "name": "NewTargetOpacity", "type": "expression" } ], @@ -15557,11 +16799,12 @@ "conditions": [ { "type": { - "value": "Flash::FlashColor::PropertyIsFlashing" + "value": "BooleanVariable" }, "parameters": [ - "Object", - "Behavior" + "IsFlashing", + "True", + "" ] } ], @@ -15581,7 +16824,6 @@ { "description": "Object", "name": "Object", - "supplementaryInformation": "Sprite", "type": "object" }, { @@ -15620,7 +16862,6 @@ { "description": "Object", "name": "Object", - "supplementaryInformation": "Sprite", "type": "object" }, { @@ -15656,12 +16897,12 @@ "actions": [ { "type": { - "value": "Flash::FlashOpacity::SetPropertyIsFlashing" + "value": "SetBooleanVariable" }, "parameters": [ - "Object", - "Behavior", - "no" + "IsFlashing", + "False", + "" ] }, { @@ -15695,12 +16936,13 @@ }, { "type": { - "value": "Opacity" + "value": "OpacityCapability::OpacityBehavior::SetValue" }, "parameters": [ "Object", + "Opacity", "=", - "Object.Behavior::PropertyStartingOpacity()" + "StartingOpacity" ] } ] @@ -15710,7 +16952,6 @@ { "description": "Object", "name": "Object", - "supplementaryInformation": "Sprite", "type": "object" }, { @@ -15739,7 +16980,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "Object.Behavior::PropertyHalfPeriodTime()" + "HalfPeriodTime" ] } ] @@ -15752,7 +16993,6 @@ { "description": "Object", "name": "Object", - "supplementaryInformation": "Sprite", "type": "object" }, { @@ -15777,13 +17017,12 @@ "actions": [ { "type": { - "value": "Flash::FlashOpacity::SetPropertyHalfPeriodTime" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "HalfPeriodTime", "=", - "GetArgumentAsNumber(\"Value\")" + "Value" ] } ] @@ -15793,7 +17032,6 @@ { "description": "Object", "name": "Object", - "supplementaryInformation": "Sprite", "type": "object" }, { @@ -15807,15 +17045,24 @@ } ], "propertyDescriptors": [ + { + "value": "", + "type": "Behavior", + "label": "Opacity capability", + "extraInformation": [ + "OpacityCapability::OpacityBehavior" + ], + "choices": [], + "name": "Opacity" + }, { "value": "", "type": "Behavior", "label": "Tween Behavior (required)", - "description": "", - "group": "", "extraInformation": [ "Tween::TweenBehavior" ], + "choices": [], "name": "TweenBehavior" }, { @@ -15824,17 +17071,12 @@ "unit": "Second", "label": "Half period", "description": "Time between flashes", - "group": "", - "extraInformation": [], "name": "HalfPeriodTime" }, { "value": "", "type": "Boolean", "label": "", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "IsFlashing" }, @@ -15844,8 +17086,6 @@ "unit": "Second", "label": "Flash duration", "description": "Use \"0\" to keep flashing until stopped", - "group": "", - "extraInformation": [], "hidden": true, "name": "FlashDuration" }, @@ -15855,8 +17095,6 @@ "unit": "Dimensionless", "label": "Target opacity (Range: 0 - 255)", "description": "Opacity will fade between the starting value and a target value", - "group": "", - "extraInformation": [], "hidden": true, "name": "TargetOpacity" }, @@ -15866,8 +17104,6 @@ "unit": "Dimensionless", "label": "Starting opacity", "description": "Opacity will fade between the starting value and a target value", - "group": "", - "extraInformation": [], "hidden": true, "name": "StartingOpacity" } @@ -15878,7 +17114,7 @@ "description": "Make the object flash an effect for a period of time.", "fullName": "Flash effect", "name": "FlashEffect", - "objectType": "Sprite", + "objectType": "", "eventsFunctions": [ { "fullName": "", @@ -15922,7 +17158,7 @@ "Object", "\"Flash_Effect_Timer\"", ">", - "Object.Behavior::PropertyHalfPeriodTime()" + "HalfPeriodTime" ] } ], @@ -15938,12 +17174,12 @@ }, { "type": { - "value": "Flash::ToggleEffect" + "value": "Flash::FlashEffect::ToggleEffect" }, "parameters": [ - "", "Object", - "Object.Behavior::PropertyEffectName()", + "Behavior", + "EffectName", "" ] } @@ -15966,11 +17202,10 @@ "conditions": [ { "type": { - "value": "Flash::FlashEffect::PropertyFlashDuration" + "value": "NumberVariable" }, "parameters": [ - "Object", - "Behavior", + "FlashDuration", ">", "0" ] @@ -15983,7 +17218,7 @@ "Object", "\"Flash_Effect_Duration_Timer\"", ">", - "Object.Behavior::PropertyFlashDuration()" + "FlashDuration" ] } ], @@ -16010,7 +17245,6 @@ { "description": "Object", "name": "Object", - "supplementaryInformation": "Sprite", "type": "object" }, { @@ -16056,13 +17290,12 @@ }, { "type": { - "value": "Flash::FlashEffect::PropertyEffectName" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "EffectName", "!=", - "GetArgumentAsString(\"EffectName\")" + "NewEffectName" ] } ], @@ -16101,11 +17334,12 @@ "conditions": [ { "type": { - "value": "IsEffectEnabled" + "value": "EffectCapability::EffectBehavior::IsEffectEnabled" }, "parameters": [ "Object", - "GetArgumentAsString(\"EffectName\")" + "Effect", + "NewEffectName" ] } ], @@ -16128,11 +17362,12 @@ { "type": { "inverted": true, - "value": "IsEffectEnabled" + "value": "EffectCapability::EffectBehavior::IsEffectEnabled" }, "parameters": [ "Object", - "GetArgumentAsString(\"EffectName\")" + "Effect", + "NewEffectName" ] } ], @@ -16155,12 +17390,12 @@ "actions": [ { "type": { - "value": "Flash::ToggleEffect" + "value": "Flash::FlashEffect::ToggleEffect" }, "parameters": [ - "", "Object", - "GetArgumentAsString(\"EffectName\")", + "Behavior", + "NewEffectName", "" ] }, @@ -16175,12 +17410,12 @@ }, { "type": { - "value": "Flash::FlashEffect::SetPropertyIsFlashing" + "value": "SetBooleanVariable" }, "parameters": [ - "Object", - "Behavior", - "yes" + "IsFlashing", + "True", + "" ] } ] @@ -16202,24 +17437,22 @@ }, { "type": { - "value": "Flash::FlashEffect::SetPropertyFlashDuration" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "FlashDuration", "=", - "GetArgumentAsNumber(\"FlashDuration\")" + "NewFlashDuration" ] }, { "type": { - "value": "Flash::FlashEffect::SetPropertyEffectName" + "value": "SetStringVariable" }, "parameters": [ - "Object", - "Behavior", + "EffectName", "=", - "GetArgumentAsString(\"EffectName\")" + "NewEffectName" ] } ] @@ -16229,7 +17462,6 @@ { "description": "Object", "name": "Object", - "supplementaryInformation": "Sprite", "type": "object" }, { @@ -16241,12 +17473,12 @@ { "description": "Duration of the flashing, in seconds", "longDescription": "Use \"0\" to keep flashing until stopped.", - "name": "FlashDuration", + "name": "NewFlashDuration", "type": "expression" }, { "description": "Name of effect", - "name": "EffectName", + "name": "NewEffectName", "type": "objectEffectName" } ], @@ -16278,11 +17510,12 @@ "conditions": [ { "type": { - "value": "Flash::FlashEffect::PropertyIsFlashing" + "value": "BooleanVariable" }, "parameters": [ - "Object", - "Behavior" + "IsFlashing", + "True", + "" ] } ], @@ -16302,7 +17535,6 @@ { "description": "Object", "name": "Object", - "supplementaryInformation": "Sprite", "type": "object" }, { @@ -16341,7 +17573,6 @@ { "description": "Object", "name": "Object", - "supplementaryInformation": "Sprite", "type": "object" }, { @@ -16365,23 +17596,24 @@ "conditions": [ { "type": { - "value": "Flash::FlashColor::PropertyIsFlashing" + "value": "BooleanVariable" }, "parameters": [ - "Object", - "Behavior" + "IsFlashing", + "True", + "" ] } ], "actions": [ { "type": { - "value": "Flash::FlashEffect::SetPropertyIsFlashing" + "value": "SetBooleanVariable" }, "parameters": [ - "Object", - "Behavior", - "no" + "IsFlashing", + "False", + "" ] }, { @@ -16421,11 +17653,12 @@ "actions": [ { "type": { - "value": "EnableEffect" + "value": "EffectCapability::EffectBehavior::EnableEffect" }, "parameters": [ "Object", - "Object.Behavior::PropertyEffectName()", + "Effect", + "EffectName", "yes" ] } @@ -16448,11 +17681,12 @@ "actions": [ { "type": { - "value": "EnableEffect" + "value": "EffectCapability::EffectBehavior::EnableEffect" }, "parameters": [ "Object", - "Object.Behavior::PropertyEffectName()", + "Effect", + "EffectName", "" ] } @@ -16465,7 +17699,6 @@ { "description": "Object", "name": "Object", - "supplementaryInformation": "Sprite", "type": "object" }, { @@ -16494,7 +17727,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "Object.Behavior::PropertyHalfPeriodTime()" + "HalfPeriodTime" ] } ] @@ -16507,7 +17740,6 @@ { "description": "Object", "name": "Object", - "supplementaryInformation": "Sprite", "type": "object" }, { @@ -16532,13 +17764,129 @@ "actions": [ { "type": { - "value": "Flash::FlashEffect::SetPropertyHalfPeriodTime" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "HalfPeriodTime", "=", - "GetArgumentAsNumber(\"Value\")" + "Value" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "Flash::FlashEffect", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Toggle an object effect.", + "fullName": "Toggle an object effect", + "functionType": "Action", + "name": "ToggleEffect", + "private": true, + "sentence": "Toggle effect _PARAM2_ on _PARAM0_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetObjectVariableAsBoolean" + }, + "parameters": [ + "Object", + "__Flash_EffectToggled", + "False" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "EffectCapability::EffectBehavior::IsEffectEnabled" + }, + "parameters": [ + "Object", + "Effect", + "EffectName" + ] + } + ], + "actions": [ + { + "type": { + "value": "EffectCapability::EffectBehavior::EnableEffect" + }, + "parameters": [ + "Object", + "Effect", + "EffectName", + "" + ] + }, + { + "type": { + "value": "SetObjectVariableAsBoolean" + }, + "parameters": [ + "Object", + "__Flash_EffectToggled", + "True" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "ObjectVariableAsBoolean" + }, + "parameters": [ + "Object", + "__Flash_EffectToggled", + "False" + ] + }, + { + "type": { + "inverted": true, + "value": "EffectCapability::EffectBehavior::IsEffectEnabled" + }, + "parameters": [ + "Object", + "Effect", + "EffectName" + ] + } + ], + "actions": [ + { + "type": { + "value": "EffectCapability::EffectBehavior::EnableEffect" + }, + "parameters": [ + "Object", + "Effect", + "EffectName", + "yes" ] } ] @@ -16548,7 +17896,6 @@ { "description": "Object", "name": "Object", - "supplementaryInformation": "Sprite", "type": "object" }, { @@ -16556,29 +17903,39 @@ "name": "Behavior", "supplementaryInformation": "Flash::FlashEffect", "type": "behavior" + }, + { + "description": "Effect name to toggle", + "name": "EffectName", + "type": "objectEffectName" } ], "objectGroups": [] } ], "propertyDescriptors": [ + { + "value": "", + "type": "Behavior", + "label": "Effect capability", + "extraInformation": [ + "EffectCapability::EffectBehavior" + ], + "choices": [], + "name": "Effect" + }, { "value": "0.1", "type": "Number", "unit": "Second", "label": "Half period", "description": "Time between flashes", - "group": "", - "extraInformation": [], "name": "HalfPeriodTime" }, { "value": "", "type": "Boolean", "label": "", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "IsFlashing" }, @@ -16588,8 +17945,6 @@ "unit": "Second", "label": "Flash duration", "description": "Use \"0\" to keep flashing until stopped", - "group": "", - "extraInformation": [], "hidden": true, "name": "FlashDuration" }, @@ -16597,9 +17952,6 @@ "value": "", "type": "String", "label": "Name of effect", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "EffectName" } @@ -16614,17 +17966,18 @@ "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": "Make objects follow the position and rotation of the object they are stuck to.", - "version": "0.5.1", + "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", + "- 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))." ], @@ -16675,8 +18028,10 @@ " 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()) {", @@ -16759,8 +18114,10 @@ " const deltaX = object.getCenterXInScene() - this.basisOldCenterXInScene;", " const deltaY = object.getCenterYInScene() - this.basisOldCenterYInScene;", " const angle = this.basisOldAngle * Math.PI / 180;", - " this.relativeRotatedX = (deltaX * Math.cos(angle) + deltaY * Math.sin(angle)) / this.basisOldWidth;", - " this.relativeRotatedY = (-deltaX * Math.sin(angle) + deltaY * Math.cos(angle)) / this.basisOldHeight;", + " 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();", @@ -16806,78 +18163,104 @@ " }", " this.followingDoneThisFrame = true;", " const basisObject = this.basisObject;", - " if (basisObject) {", - " // 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 (!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();", + " }", "", - " const object = this.behavior.owner;", - "", - " if (this.behavior._getOnlyFollowPosition()) {", - " 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);", - " }", - " } else {", - " if (object.getX() !== this.ownerOldX", - " || object.getY() !== this.ownerOldY", - " || object.getAngle() !== this.ownerOldAngle", - " || object.getWidth() !== this.ownerOldWidth", - " || object.getHeight() !== this.ownerOldHeight) {", - " this.updateRelativeCoordinates();", - " }", + " 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);", + " }", + " }", "", - " // 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());", + " 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.setAngle(basisObject.getAngle() + this.relativeAngle);", - "", - " const deltaX = this.relativeRotatedX * basisObject.getWidth();", - " const deltaY = this.relativeRotatedY * basisObject.getHeight();", - " const angle = -basisObject.getAngle() * Math.PI / 180;", - " object.setX(basisObject.getCenterXInScene() + object.getX() - object.getCenterXInScene() + deltaX * Math.cos(angle) + deltaY * Math.sin(angle));", - " object.setY(basisObject.getCenterYInScene() + object.getY() - object.getCenterYInScene() - deltaX * Math.sin(angle) + deltaY * Math.cos(angle));", - " }", - " // 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());", + " 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);", " }", - "", - " this.updateOldCoordinates();", " }", " }", "}", @@ -16952,6 +18335,7 @@ "fullName": "Sticker", "name": "Sticker", "objectType": "", + "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -16990,7 +18374,9 @@ " allStickers: new Set(),", "};", "// Register this object as a sticker.", - "runtimeScene._stickerExtension.allStickers.add(behavior);", + "/** @type {Set} */", + "const allStickers = runtimeScene._stickerExtension.allStickers;", + "allStickers.add(behavior);", "" ], "parameterObjects": "Object", @@ -17178,7 +18564,9 @@ "const object = objects[0];", "const behavior = object.getBehavior(behaviorName);", "", - "runtimeScene._stickerExtension.allStickers.delete(behavior._sticker);", + "/** @type {Set} */", + "const allStickers = runtimeScene._stickerExtension.allStickers;", + "allStickers.delete(behavior);", "" ], "parameterObjects": "Object", @@ -17207,18 +18595,12 @@ "value": "", "type": "Boolean", "label": "Only follow the position", - "description": "", - "group": "", - "extraInformation": [], "name": "OnlyFollowPosition" }, { "value": "", "type": "Boolean", "label": "Destroy when the object it's stuck on is destroyed", - "description": "", - "group": "", - "extraInformation": [], "name": "IsDestroyedWithParent" } ], @@ -17232,20 +18614,18 @@ "category": "Visual effect", "extensionNamespace": "", "fullName": "Advanced 3D tween", + "gdevelopVersion": ">=5.5.222", "helpPath": "", "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0ibWRpLXRlbm5pcy1iYWxsIiB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCI+PHBhdGggZD0iTTEyLDJDMTQuNSwyIDE2Ljc1LDIuOSAxOC41LDQuNEMxNi4zNiw2LjIzIDE1LDguOTYgMTUsMTJDMTUsMTUuMDQgMTYuMzYsMTcuNzcgMTguNSwxOS42QzE2Ljc1LDIxLjEgMTQuNSwyMiAxMiwyMkM5LjUsMjIgNy4yNSwyMS4xIDUuNSwxOS42QzcuNjQsMTcuNzcgOSwxNS4wNCA5LDEyQzksOC45NiA3LjY0LDYuMjMgNS41LDQuNEM3LjI1LDIuOSA5LjUsMiAxMiwyTTIyLDEyQzIyLDE0LjMyIDIxLjIxLDE2LjQ1IDE5Ljg4LDE4LjE1QzE4LjEyLDE2LjY4IDE3LDE0LjQ3IDE3LDEyQzE3LDkuNTMgMTguMTIsNy4zMiAxOS44OCw1Ljg1QzIxLjIxLDcuNTUgMjIsOS42OCAyMiwxMk0yLDEyQzIsOS42OCAyLjc5LDcuNTUgNC4xMiw1Ljg1QzUuODgsNy4zMiA3LDkuNTMgNywxMkM3LDE0LjQ3IDUuODgsMTYuNjggNC4xMiwxOC4xNUMyLjc5LDE2LjQ1IDIsMTQuMzIgMiwxMloiIC8+PC9zdmc+", "name": "Tween3D", "previewIconUrl": "https://asset-resources.gdevelop.io/public-resources/Icons/30bc03f9cf5f2f42960246a605352a6937ae6b603f0177396a83193849a4724a_tennis-ball.svg", "shortDescription": "Smoothly squash, strentch, tint and wobble 3D models.", - "version": "0.2.0", + "version": "0.3.1", "description": [ "Change 3D models proportions over time to make smooth animations like wobbling.", "", "It's used in this example:", - "* a 3D Bomberman-like game ([open the project online](https://editor.gdevelop.io/?project=example://3d-bomber-bunny))", - "", - "Breaking changes of 0.1.0:", - "- The Tween behavior is now required by the 3D Tween behavior. Add the Tween behavior on any object that uses the 3D Tween behavior" + "* a 3D Bomberman-like game ([open the project online](https://editor.gdevelop.io/?project=example://3d-bomber-bunny))" ], "origin": { "identifier": "Tween3D", @@ -17263,6 +18643,12 @@ "IWykYNRvhCZBN3vEgKEbBPOR3Oc2", "dt0tRnf2kHWJnjkrpnzTzNj9Yc63" ], + "changelog": [ + { + "version": "0.1.0", + "breaking": "- The Tween behavior is now required by the 3D Tween behavior. Add the Tween behavior on any object that uses the 3D Tween behavior." + } + ], "dependencies": [], "globalVariables": [], "sceneVariables": [], @@ -17345,12 +18731,18 @@ " setColor(tintColor, originalTint) {", " const originalMaterials = originalTint.materials;", " for (const [materialId, material] of this.materials) {", - " const originalColor = originalMaterials.get(materialId).color;", - " const color = material.color;", - " color.setHex(tintColor);", - " color.r *= originalColor.r;", - " color.g *= originalColor.g;", - " color.b *= originalColor.b;", + " const originalMaterial = originalMaterials.get(materialId);", + " if (!originalMaterial) {", + " // A new material may have been changed by another extension.", + " continue;", + " }", + " const originalColor = originalMaterial.color;", + "", + " const color = material.color;", + " color.setHex(tintColor);", + " color.r *= originalColor.r;", + " color.g *= originalColor.g;", + " color.b *= originalColor.b;", " }", " }", "", @@ -17369,7 +18761,7 @@ " tints = new Map();", " /**", " * Materials by material `id`.", - " * @type {Map}", + " * @type {Tint}", " */", " originalTint;", " /**", @@ -17438,19 +18830,11 @@ " }", " else {", " const materials = new Map();", - " object.get3DRendererObject().traverse((mesh) => {", - " if (mesh.material && mesh.material.color) {", - " const material = mesh.material;", - " const originalId = material.id;", - " if (materials.has(originalId)) {", - " // Meshes can share the same material.", - " return;", - " }", - " const tintedMaterial = mesh.material.clone();", - " tintedMaterial.originalId = originalId;", - " materials.set(originalId, tintedMaterial);", - " }", - " });", + " for (const [originalId, material] of this.originalTint.materials) {", + " const tintedMaterial = material.clone();", + " tintedMaterial.originalId = originalId;", + " materials.set(originalId, tintedMaterial);", + " }", " tint = new Tint(materials);", " }", " tint.setColor(color, this.originalTint);", @@ -17470,15 +18854,15 @@ "}", "", "gdjs.registerObjectDeletedFromSceneCallback(function (runtimeScene, deletedObject) {", - " const extension = runtimeScene.__tween3DExtension;", - " if (!extension) {", - " return;", - " }", - " const managers = extension.tintManagers;", - " const manager = managers.get(deletedObject.getName());", - " if (manager) {", - " manager.applyTint(deletedObject, 0xffffff);", - " }", + " const extension = runtimeScene.__tween3DExtension;", + " if (!extension) {", + " return;", + " }", + " const managers = extension.tintManagers;", + " const manager = managers.get(deletedObject.getName());", + " if (manager) {", + " manager.applyTint(deletedObject, 0xffffff);", + " }", "});", "", "", @@ -17983,7 +19367,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "exp(Tween::Ease(GetArgumentAsString(\"Easing\"), log(GetArgumentAsNumber(\"InitialValue\")), log(GetArgumentAsNumber(\"TargetedValue\")), GetArgumentAsNumber(\"Weighting\")))" + "exp(Tween::Ease(Easing, log(InitialValue), log(TargetedValue), Weighting))" ] } ] @@ -18023,6 +19407,7 @@ "fullName": "Advanced 3D tween", "name": "Tween3D", "objectType": "", + "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -18142,7 +19527,7 @@ "Object", "Object3D", "=", - "pow(Variable(_Tween3D.Volume) * GetArgumentAsNumber(\"Value\") * GetArgumentAsNumber(\"Value\"), 1/3)" + "pow(Variable(_Tween3D.Volume) * Value * Value, 1/3)" ] }, { @@ -18287,7 +19672,7 @@ "Object", "Scale", "=", - "pow(Variable(_Tween3D.Volume) * GetArgumentAsNumber(\"Value\") * GetArgumentAsNumber(\"Value\"), 1/3)" + "pow(Variable(_Tween3D.Volume) * Value * Value, 1/3)" ] }, { @@ -18421,7 +19806,7 @@ "parameters": [ "_Tween3D.Ratio", "=", - "pow(GetArgumentAsNumber(\"Value\") / Object.Behavior::ScaleVolume(), 1 / 3)" + "pow(Value / Object.Behavior::ScaleVolume(), 1 / 3)" ] }, { @@ -18561,10 +19946,10 @@ "parameters": [ "Object", "Behavior", - "GetArgumentAsString(\"TweenIdentifier\")", - "GetArgumentAsNumber(\"TargetedValue\")", - "GetArgumentAsNumber(\"Duration\")", - "GetArgumentAsString(\"Easing\")", + "TweenIdentifier", + "TargetedValue", + "Duration", + "Easing", "\"StretchZ\"", "" ] @@ -18628,10 +20013,10 @@ "parameters": [ "Object", "Behavior", - "GetArgumentAsString(\"TweenIdentifier\")", - "GetArgumentAsNumber(\"TargetedValue\")", - "GetArgumentAsNumber(\"Duration\")", - "GetArgumentAsString(\"Easing\")", + "TweenIdentifier", + "TargetedValue", + "Duration", + "Easing", "\"StretchY\"", "" ] @@ -18695,10 +20080,10 @@ "parameters": [ "Object", "Behavior", - "GetArgumentAsString(\"TweenIdentifier\")", - "GetArgumentAsNumber(\"TargetedValue\")", - "GetArgumentAsNumber(\"Duration\")", - "GetArgumentAsString(\"Easing\")", + "TweenIdentifier", + "TargetedValue", + "Duration", + "Easing", "\"ScaleVolume\"", "" ] @@ -18831,10 +20216,10 @@ "Object", "Tween", "Object3D", - "GetArgumentAsString(\"TweenIdentifier\")", - "GetArgumentAsNumber(\"TargetedValue\")", - "GetArgumentAsString(\"Easing\")", - "GetArgumentAsNumber(\"Duration\")", + "TweenIdentifier", + "TargetedValue", + "Easing", + "Duration", "" ] } @@ -18899,10 +20284,10 @@ "Object", "Tween", "Object3D", - "GetArgumentAsString(\"TweenIdentifier\")", - "GetArgumentAsNumber(\"TargetedValue\")", - "GetArgumentAsString(\"Easing\")", - "GetArgumentAsNumber(\"Duration\")", + "TweenIdentifier", + "TargetedValue", + "Easing", + "Duration", "" ] } @@ -18967,10 +20352,10 @@ "Object", "Tween", "Object3D", - "GetArgumentAsString(\"TweenIdentifier\")", - "GetArgumentAsNumber(\"TargetedValue\")", - "GetArgumentAsString(\"Easing\")", - "GetArgumentAsNumber(\"Duration\")", + "TweenIdentifier", + "TargetedValue", + "Easing", + "Duration", "" ] } @@ -19035,10 +20420,10 @@ "Object", "Tween", "Object3D", - "GetArgumentAsString(\"TweenIdentifier\")", - "GetArgumentAsNumber(\"TargetedValue\")", - "GetArgumentAsString(\"Easing\")", - "GetArgumentAsNumber(\"Duration\")", + "TweenIdentifier", + "TargetedValue", + "Easing", + "Duration", "" ] } @@ -19569,10 +20954,10 @@ "conditions": [ { "type": { - "value": "CompareArgumentAsString" + "value": "StringVariable" }, "parameters": [ - "\"Type\"", + "Type", "=", "\"StretchZ\"" ] @@ -19599,10 +20984,10 @@ "conditions": [ { "type": { - "value": "CompareArgumentAsString" + "value": "StringVariable" }, "parameters": [ - "\"Type\"", + "Type", "=", "\"StretchY\"" ] @@ -19629,10 +21014,10 @@ "conditions": [ { "type": { - "value": "CompareArgumentAsString" + "value": "StringVariable" }, "parameters": [ - "\"Type\"", + "Type", "=", "\"ScaleVolume\"" ] @@ -19659,10 +21044,10 @@ "conditions": [ { "type": { - "value": "CompareArgumentAsString" + "value": "StringVariable" }, "parameters": [ - "\"Type\"", + "Type", "=", "\"Tint\"" ] @@ -19744,7 +21129,7 @@ "value": "SetReturnString" }, "parameters": [ - "Object.VariableString(_Tween3D.Tweens[GetArgumentAsString(\"TweenIdentifier\")].Type)" + "Object.VariableString(_Tween3D.Tweens[TweenIdentifier].Type)" ] } ] @@ -19792,9 +21177,9 @@ }, "parameters": [ "Object", - "_Tween3D.Tweens[GetArgumentAsString(\"TweenIdentifier\")].Type", + "_Tween3D.Tweens[TweenIdentifier].Type", "=", - "GetArgumentAsString(\"Value\")" + "Value" ] } ] @@ -19838,7 +21223,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "Object.Variable(_Tween3D.Tweens[GetArgumentAsString(\"TweenIdentifier\")].Time)" + "Object.Variable(_Tween3D.Tweens[TweenIdentifier].Time)" ] } ] @@ -19886,9 +21271,9 @@ }, "parameters": [ "Object", - "_Tween3D.Tweens[GetArgumentAsString(\"TweenIdentifier\")].Time", + "_Tween3D.Tweens[TweenIdentifier].Time", "=", - "GetArgumentAsNumber(\"Value\")" + "Value" ] } ] @@ -19932,7 +21317,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "Object.Variable(_Tween3D.Tweens[GetArgumentAsString(\"TweenIdentifier\")].Duration)" + "Object.Variable(_Tween3D.Tweens[TweenIdentifier].Duration)" ] } ] @@ -19980,9 +21365,9 @@ }, "parameters": [ "Object", - "_Tween3D.Tweens[GetArgumentAsString(\"TweenIdentifier\")].Duration", + "_Tween3D.Tweens[TweenIdentifier].Duration", "=", - "GetArgumentAsNumber(\"Value\")" + "Value" ] } ] @@ -20026,7 +21411,7 @@ "value": "SetReturnString" }, "parameters": [ - "Object.VariableString(_Tween3D.Tweens[GetArgumentAsString(\"TweenIdentifier\")].Easing)" + "Object.VariableString(_Tween3D.Tweens[TweenIdentifier].Easing)" ] } ] @@ -20074,9 +21459,9 @@ }, "parameters": [ "Object", - "_Tween3D.Tweens[GetArgumentAsString(\"TweenIdentifier\")].Easing", + "_Tween3D.Tweens[TweenIdentifier].Easing", "=", - "GetArgumentAsString(\"Value\")" + "Value" ] } ] @@ -20308,7 +21693,7 @@ }, "parameters": [ "Object", - "_Tween3D.Tweens[GetArgumentAsString(\"TweenIdentifier\")].IsPaused", + "_Tween3D.Tweens[TweenIdentifier].IsPaused", "True" ] } @@ -20359,10 +21744,12 @@ "conditions": [ { "type": { - "value": "GetArgumentAsBoolean" + "value": "BooleanVariable" }, "parameters": [ - "\"IsPaused\"" + "IsPaused", + "True", + "" ] } ], @@ -20373,7 +21760,7 @@ }, "parameters": [ "Object", - "_Tween3D.Tweens[GetArgumentAsString(\"TweenIdentifier\")].IsPaused", + "_Tween3D.Tweens[TweenIdentifier].IsPaused", "True" ] } @@ -20385,10 +21772,12 @@ { "type": { "inverted": true, - "value": "GetArgumentAsBoolean" + "value": "BooleanVariable" }, "parameters": [ - "\"IsPaused\"" + "IsPaused", + "True", + "" ] } ], @@ -20399,7 +21788,7 @@ }, "parameters": [ "Object", - "_Tween3D.Tweens[GetArgumentAsString(\"TweenIdentifier\")].IsPaused", + "_Tween3D.Tweens[TweenIdentifier].IsPaused", "False" ] } @@ -20449,7 +21838,7 @@ "parameters": [ "Object", "Behavior", - "GetArgumentAsString(\"TweenIdentifier\")", + "TweenIdentifier", "" ] } @@ -20463,8 +21852,8 @@ "Object", "Behavior", "=", - "Object.Behavior::Duration(GetArgumentAsString(\"TweenIdentifier\"))", - "GetArgumentAsString(\"TweenIdentifier\")", + "Object.Behavior::Duration(TweenIdentifier)", + "TweenIdentifier", "" ] } @@ -20475,10 +21864,12 @@ "conditions": [ { "type": { - "value": "GetArgumentAsBoolean" + "value": "BooleanVariable" }, "parameters": [ - "\"JumpToEnd\"" + "JumpToEnd", + "True", + "" ] } ], @@ -20530,7 +21921,7 @@ "parameters": [ "Object", "Behavior", - "GetArgumentAsString(\"TweenIdentifier\")", + "TweenIdentifier", "" ] } @@ -20543,7 +21934,7 @@ "parameters": [ "Object", "Behavior", - "GetArgumentAsString(\"TweenIdentifier\")", + "TweenIdentifier", "yes", "" ] @@ -20589,7 +21980,7 @@ "parameters": [ "Object", "Behavior", - "GetArgumentAsString(\"TweenIdentifier\")", + "TweenIdentifier", "" ] } @@ -20602,7 +21993,7 @@ "parameters": [ "Object", "Behavior", - "GetArgumentAsString(\"TweenIdentifier\")", + "TweenIdentifier", "no", "" ] @@ -20648,7 +22039,7 @@ "parameters": [ "Object", "Behavior", - "GetArgumentAsString(\"TweenIdentifier\")", + "TweenIdentifier", "" ] } @@ -20661,7 +22052,7 @@ "parameters": [ "Object", "_Tween3D.Tweens", - "GetArgumentAsString(\"TweenIdentifier\")" + "TweenIdentifier" ] }, { @@ -20715,7 +22106,7 @@ "parameters": [ "Object", "_Tween3D.Tweens", - "GetArgumentAsString(\"TweenIdentifier\")" + "TweenIdentifier" ] } ], @@ -20769,7 +22160,7 @@ "parameters": [ "Object", "Behavior", - "GetArgumentAsString(\"TweenIdentifier\")", + "TweenIdentifier", "" ] }, @@ -20781,7 +22172,7 @@ "parameters": [ "Object", "Behavior", - "GetArgumentAsString(\"TweenIdentifier\")", + "TweenIdentifier", "" ] }, @@ -20793,7 +22184,7 @@ "parameters": [ "Object", "Behavior", - "GetArgumentAsString(\"TweenIdentifier\")", + "TweenIdentifier", "" ] } @@ -20850,7 +22241,7 @@ "Behavior", ">=", "1", - "GetArgumentAsString(\"TweenIdentifier\")", + "TweenIdentifier", "" ] } @@ -20905,7 +22296,7 @@ "parameters": [ "Object", "Behavior", - "GetArgumentAsString(\"TweenIdentifier\")", + "TweenIdentifier", "" ] } @@ -20916,7 +22307,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "Object.Behavior::Time(GetArgumentAsString(\"TweenIdentifier\")) / Object.Behavior::Duration(GetArgumentAsString(\"TweenIdentifier\"))" + "Object.Behavior::Time(TweenIdentifier) / Object.Behavior::Duration(TweenIdentifier)" ] } ] @@ -21040,33 +22431,30 @@ "value": "", "type": "Behavior", "label": "3D capability", - "description": "", - "group": "", "extraInformation": [ "Scene3D::Base3DBehavior" ], + "choices": [], "name": "Object3D" }, { "value": "", "type": "Behavior", "label": "Scalable capacity", - "description": "", - "group": "", "extraInformation": [ "ScalableCapability::ScalableBehavior" ], + "choices": [], "name": "Scale" }, { "value": "", "type": "Behavior", "label": "Tween", - "description": "", - "group": "", "extraInformation": [ "Tween::TweenBehavior" ], + "choices": [], "name": "Tween" } ], @@ -21077,6 +22465,7 @@ "fullName": "3D wobble", "name": "Wobble", "objectType": "", + "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -21146,37 +22535,34 @@ "conditions": [ { "type": { - "value": "Tween3D::Wobble::PropertyScaleMinTweenTime" + "value": "NumberVariable" }, "parameters": [ - "Object", - "Behavior", + "ScaleMinTweenTime", "<", - "Object.Behavior::PropertyScaleMinTweenDuration()" + "ScaleMinTweenDuration" ] } ], "actions": [ { "type": { - "value": "Tween3D::Wobble::SetPropertyScaleMinTweenTime" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "ScaleMinTweenTime", "+", "Object.Behavior::TimeDelta()" ] }, { "type": { - "value": "Tween3D::Wobble::SetPropertyScaleMin" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "ScaleMin", "=", - "Tween3D::EaseExp(Object.Behavior::PropertyScaleMinTweenEasing(), Object.Behavior::PropertyScaleMinTweenInitialValue(), Object.Behavior::PropertyScaleMinTweenTarget(), Object.Behavior::PropertyScaleMinTweenTime() / Object.Behavior::PropertyScaleMinTweenDuration())" + "Tween3D::EaseExp(ScaleMinTweenEasing, ScaleMinTweenInitialValue, ScaleMinTweenTarget, ScaleMinTweenTime / ScaleMinTweenDuration)" ] } ], @@ -21186,26 +22572,24 @@ "conditions": [ { "type": { - "value": "Tween3D::Wobble::PropertyScaleMinTweenTime" + "value": "NumberVariable" }, "parameters": [ - "Object", - "Behavior", + "ScaleMinTweenTime", ">=", - "Object.Behavior::PropertyScaleMinTweenDuration()" + "ScaleMinTweenDuration" ] } ], "actions": [ { "type": { - "value": "Tween3D::Wobble::SetPropertyScaleMin" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "ScaleMin", "=", - "Object.Behavior::PropertyScaleMinTweenTarget()" + "ScaleMinTweenTarget" ] } ] @@ -21217,37 +22601,34 @@ "conditions": [ { "type": { - "value": "Tween3D::Wobble::PropertyScaleMaxTweenTime" + "value": "NumberVariable" }, "parameters": [ - "Object", - "Behavior", + "ScaleMaxTweenTime", "<", - "Object.Behavior::PropertyScaleMaxTweenDuration()" + "ScaleMaxTweenDuration" ] } ], "actions": [ { "type": { - "value": "Tween3D::Wobble::SetPropertyScaleMaxTweenTime" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "ScaleMaxTweenTime", "+", "Object.Behavior::TimeDelta()" ] }, { "type": { - "value": "Tween3D::Wobble::SetPropertyScaleMax" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "ScaleMax", "=", - "Tween3D::EaseExp(Object.Behavior::PropertyScaleMaxTweenEasing(), Object.Behavior::PropertyScaleMaxTweenInitialValue(), Object.Behavior::PropertyScaleMaxTweenTarget(), Object.Behavior::PropertyScaleMaxTweenTime() / Object.Behavior::PropertyScaleMaxTweenDuration())" + "Tween3D::EaseExp(ScaleMaxTweenEasing, ScaleMaxTweenInitialValue, ScaleMaxTweenTarget, ScaleMaxTweenTime / ScaleMaxTweenDuration)" ] } ], @@ -21257,26 +22638,24 @@ "conditions": [ { "type": { - "value": "Tween3D::Wobble::PropertyScaleMaxTweenTime" + "value": "NumberVariable" }, "parameters": [ - "Object", - "Behavior", + "ScaleMaxTweenTime", ">=", - "Object.Behavior::PropertyScaleMaxTweenDuration()" + "ScaleMaxTweenDuration" ] } ], "actions": [ { "type": { - "value": "Tween3D::Wobble::SetPropertyScaleMin" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "ScaleMin", "=", - "Object.Behavior::PropertyScaleMinTweenTarget()" + "ScaleMinTweenTarget" ] } ] @@ -21327,13 +22706,12 @@ "actions": [ { "type": { - "value": "Tween3D::Wobble::SetPropertyAngle" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "Angle", "+", - "mod(Object.Behavior::TimeDelta() * 2 * Pi()\n / Object.Behavior::PropertyPeriodDuration(), 2 * Pi())" + "mod(Object.Behavior::TimeDelta() * 2 * Pi()\n / PeriodDuration, 2 * Pi())" ] } ] @@ -21374,7 +22752,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "Object.Behavior::PropertyScaleMin()" + "ScaleMin" ] } ] @@ -21411,13 +22789,12 @@ "actions": [ { "type": { - "value": "Tween3D::Wobble::SetPropertyScaleMin" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "ScaleMin", "=", - "GetArgumentAsNumber(\"Value\")" + "Value" ] } ] @@ -21455,7 +22832,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "Object.Behavior::PropertyScaleMax()" + "ScaleMax" ] } ] @@ -21492,13 +22869,12 @@ "actions": [ { "type": { - "value": "Tween3D::Wobble::SetPropertyScaleMax" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "ScaleMax", "=", - "GetArgumentAsNumber(\"Value\")" + "Value" ] } ] @@ -21533,57 +22909,52 @@ "actions": [ { "type": { - "value": "Tween3D::Wobble::SetPropertyScaleMinTweenInitialValue" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "ScaleMinTweenInitialValue", "=", "Object.Behavior::ScaleMin()" ] }, { "type": { - "value": "Tween3D::Wobble::SetPropertyScaleMinTweenTime" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "ScaleMinTweenTime", "=", "0" ] }, { "type": { - "value": "Tween3D::Wobble::SetPropertyScaleMinTweenTarget" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "ScaleMinTweenTarget", "=", - "GetArgumentAsNumber(\"TargetedValue\")" + "TargetedValue" ] }, { "type": { - "value": "Tween3D::Wobble::SetPropertyScaleMinTweenDuration" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "ScaleMinTweenDuration", "=", - "GetArgumentAsNumber(\"Duration\")" + "Duration" ] }, { "type": { - "value": "Tween3D::Wobble::SetPropertyScaleMinTweenEasing" + "value": "SetStringVariable" }, "parameters": [ - "Object", - "Behavior", + "ScaleMinTweenEasing", "=", - "GetArgumentAsString(\"Easing\")" + "Easing" ] } ] @@ -21634,57 +23005,52 @@ "actions": [ { "type": { - "value": "Tween3D::Wobble::SetPropertyScaleMaxTweenInitialValue" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "ScaleMaxTweenInitialValue", "=", "Object.Behavior::ScaleMax()" ] }, { "type": { - "value": "Tween3D::Wobble::SetPropertyScaleMaxTweenTime" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "ScaleMaxTweenTime", "=", "0" ] }, { "type": { - "value": "Tween3D::Wobble::SetPropertyScaleMaxTweenTarget" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "ScaleMaxTweenTarget", "=", - "GetArgumentAsNumber(\"TargetedValue\")" + "TargetedValue" ] }, { "type": { - "value": "Tween3D::Wobble::SetPropertyScaleMaxTweenDuration" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "ScaleMaxTweenDuration", "=", - "GetArgumentAsNumber(\"Duration\")" + "Duration" ] }, { "type": { - "value": "Tween3D::Wobble::SetPropertyScaleMaxTweenEasing" + "value": "SetStringVariable" }, "parameters": [ - "Object", - "Behavior", + "ScaleMaxTweenEasing", "=", - "GetArgumentAsString(\"Easing\")" + "Easing" ] } ] @@ -21780,7 +23146,7 @@ "Object", "Tween3D", "=", - "exp(log(Object.Behavior::PropertyScaleMin()) + (log(Object.Behavior::PropertyScaleMax()) - log(Object.Behavior::PropertyScaleMin())) * sin(Object.Behavior::PropertyAngle() + Object.Behavior::PropertyScalePeriodOffset() / Object.Behavior::PropertyPeriodDuration() * 2 * Pi()))", + "exp(log(ScaleMin) + (log(ScaleMax) - log(ScaleMin)) * sin(Angle + ScalePeriodOffset / PeriodDuration * 2 * Pi()))", "Object3D" ] } @@ -21814,11 +23180,10 @@ "conditions": [ { "type": { - "value": "Tween3D::Wobble::PropertyTop" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "Top", "=", "\"Z+\"" ] @@ -21833,7 +23198,7 @@ "Object", "Tween3D", "=", - "exp(log(Object.Behavior::PropertyStretchMin()) + (log(Object.Behavior::PropertyStretchMax()) - log(Object.Behavior::PropertyStretchMin())) * sin(Object.Behavior::PropertyAngle() + Object.Behavior::PropertyStretchPeriodOffset() / Object.Behavior::PropertyPeriodDuration() * 2 * Pi()))", + "exp(log(StretchMin) + (log(StretchMax) - log(StretchMin)) * sin(Angle + StretchPeriodOffset / PeriodDuration * 2 * Pi()))", "Object3D" ] } @@ -21844,11 +23209,10 @@ "conditions": [ { "type": { - "value": "Tween3D::Wobble::PropertyTop" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "Top", "=", "\"Y-\"" ] @@ -21863,7 +23227,7 @@ "Object", "Tween3D", "=", - "exp(log(Object.Behavior::PropertyStretchMin()) + (log(Object.Behavior::PropertyStretchMax()) - log(Object.Behavior::PropertyStretchMin())) * sin(Object.Behavior::PropertyAngle() + Object.Behavior::PropertyStretchPeriodOffset() / Object.Behavior::PropertyPeriodDuration() * 2 * Pi()))", + "exp(log(StretchMin) + (log(StretchMax) - log(StretchMin)) * sin(Angle + StretchPeriodOffset / PeriodDuration * 2 * Pi()))", "Object3D" ] } @@ -21902,7 +23266,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "Object.Behavior::PropertyPeriodDuration()" + "PeriodDuration" ] } ] @@ -21939,13 +23303,12 @@ "actions": [ { "type": { - "value": "Tween3D::Wobble::SetPropertyPeriodDuration" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "PeriodDuration", "=", - "GetArgumentAsNumber(\"Value\")" + "Value" ] } ] @@ -21983,7 +23346,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "Object.Behavior::PropertyScalePeriodOffset()" + "ScalePeriodOffset" ] } ] @@ -22020,13 +23383,12 @@ "actions": [ { "type": { - "value": "Tween3D::Wobble::SetPropertyScalePeriodOffset" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "ScalePeriodOffset", "=", - "GetArgumentAsNumber(\"Value\")" + "Value" ] } ] @@ -22064,7 +23426,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "Object.Behavior::PropertyStretchMin()" + "StretchMin" ] } ] @@ -22101,13 +23463,12 @@ "actions": [ { "type": { - "value": "Tween3D::Wobble::SetPropertyStretchMin" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "StretchMin", "=", - "GetArgumentAsNumber(\"Value\")" + "Value" ] } ] @@ -22145,7 +23506,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "Object.Behavior::PropertyStretchMax()" + "StretchMax" ] } ] @@ -22182,13 +23543,12 @@ "actions": [ { "type": { - "value": "Tween3D::Wobble::SetPropertyStretchMax" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "StretchMax", "=", - "GetArgumentAsNumber(\"Value\")" + "Value" ] } ] @@ -22226,7 +23586,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "Object.Behavior::PropertyStretchPeriodOffset()" + "StretchPeriodOffset" ] } ] @@ -22263,13 +23623,12 @@ "actions": [ { "type": { - "value": "Tween3D::Wobble::SetPropertyStretchPeriodOffset" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "StretchPeriodOffset", "=", - "GetArgumentAsNumber(\"Value\")" + "Value" ] } ] @@ -22297,9 +23656,7 @@ "type": "Number", "unit": "Dimensionless", "label": "Minimum scale volume", - "description": "", "group": "Scale", - "extraInformation": [], "name": "ScaleMin" }, { @@ -22307,9 +23664,7 @@ "type": "Number", "unit": "Dimensionless", "label": "Maximum scale volume", - "description": "", "group": "Scale", - "extraInformation": [], "name": "ScaleMax" }, { @@ -22317,9 +23672,6 @@ "type": "Number", "unit": "Second", "label": "Cycle duration", - "description": "", - "group": "", - "extraInformation": [], "name": "PeriodDuration" }, { @@ -22327,9 +23679,7 @@ "type": "Number", "unit": "Second", "label": "Scale cycle offset", - "description": "", "group": "Scale", - "extraInformation": [], "name": "ScalePeriodOffset" }, { @@ -22337,9 +23687,7 @@ "type": "Number", "unit": "Dimensionless", "label": "Minimum stretch", - "description": "", "group": "Stretch", - "extraInformation": [], "name": "StretchMin" }, { @@ -22347,9 +23695,7 @@ "type": "Number", "unit": "Dimensionless", "label": "Maximum stretch", - "description": "", "group": "Stretch", - "extraInformation": [], "name": "StretchMax" }, { @@ -22357,9 +23703,7 @@ "type": "Number", "unit": "Second", "label": "Stretch cycle offset", - "description": "", "group": "Stretch", - "extraInformation": [], "name": "StretchPeriodOffset" }, { @@ -22367,9 +23711,6 @@ "type": "Number", "unit": "DegreeAngle", "label": "", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "Angle" }, @@ -22378,9 +23719,6 @@ "type": "Number", "unit": "Dimensionless", "label": "", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "ScaleMinTweenTarget" }, @@ -22389,9 +23727,6 @@ "type": "Number", "unit": "Second", "label": "", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "ScaleMinTweenDuration" }, @@ -22399,9 +23734,6 @@ "value": "", "type": "String", "label": "", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "ScaleMinTweenEasing" }, @@ -22410,9 +23742,6 @@ "type": "Number", "unit": "Dimensionless", "label": "", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "ScaleMaxTweenTarget" }, @@ -22421,9 +23750,6 @@ "type": "Number", "unit": "Second", "label": "", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "ScaleMaxTweenDuration" }, @@ -22431,9 +23757,6 @@ "value": "", "type": "String", "label": "", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "ScaleMaxTweenEasing" }, @@ -22442,9 +23765,6 @@ "type": "Number", "unit": "Second", "label": "", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "ScaleMinTweenTime" }, @@ -22453,9 +23773,6 @@ "type": "Number", "unit": "Second", "label": "", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "ScaleMaxTweenTime" }, @@ -22463,9 +23780,6 @@ "value": "0", "type": "Number", "label": "", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "ScaleMinTweenInitialValue" }, @@ -22473,9 +23787,6 @@ "value": "0", "type": "Number", "label": "", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "ScaleMaxTweenInitialValue" }, @@ -22483,11 +23794,15 @@ "value": "Z+", "type": "Choice", "label": "Top orientation", - "description": "", - "group": "", - "extraInformation": [ - "Z+", - "Y-" + "choices": [ + { + "label": "Z+", + "value": "Z+" + }, + { + "label": "Y-", + "value": "Y-" + } ], "name": "Top" }, @@ -22495,11 +23810,10 @@ "value": "", "type": "Behavior", "label": "3D tween", - "description": "", - "group": "", "extraInformation": [ "Tween3D::Tween3D" ], + "choices": [], "name": "Tween3D" } ], @@ -22513,24 +23827,19 @@ "category": "Visual effect", "extensionNamespace": "", "fullName": "3D particle emitter", + "gdevelopVersion": ">=5.5.222", "helpPath": "", "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0ibWRpLWZpcmUiIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNMTcuNjYgMTEuMkMxNy40MyAxMC45IDE3LjE1IDEwLjY0IDE2Ljg5IDEwLjM4QzE2LjIyIDkuNzggMTUuNDYgOS4zNSAxNC44MiA4LjcyQzEzLjMzIDcuMjYgMTMgNC44NSAxMy45NSAzQzEzIDMuMjMgMTIuMTcgMy43NSAxMS40NiA0LjMyQzguODcgNi40IDcuODUgMTAuMDcgOS4wNyAxMy4yMkM5LjExIDEzLjMyIDkuMTUgMTMuNDIgOS4xNSAxMy41NUM5LjE1IDEzLjc3IDkgMTMuOTcgOC44IDE0LjA1QzguNTcgMTQuMTUgOC4zMyAxNC4wOSA4LjE0IDEzLjkzQzguMDggMTMuODggOC4wNCAxMy44MyA4IDEzLjc2QzYuODcgMTIuMzMgNi42OSAxMC4yOCA3LjQ1IDguNjRDNS43OCAxMCA0Ljg3IDEyLjMgNSAxNC40N0M1LjA2IDE0Ljk3IDUuMTIgMTUuNDcgNS4yOSAxNS45N0M1LjQzIDE2LjU3IDUuNyAxNy4xNyA2IDE3LjdDNy4wOCAxOS40MyA4Ljk1IDIwLjY3IDEwLjk2IDIwLjkyQzEzLjEgMjEuMTkgMTUuMzkgMjAuOCAxNy4wMyAxOS4zMkMxOC44NiAxNy42NiAxOS41IDE1IDE4LjU2IDEyLjcyTDE4LjQzIDEyLjQ2QzE4LjIyIDEyIDE3LjY2IDExLjIgMTcuNjYgMTEuMk0xNC41IDE3LjVDMTQuMjIgMTcuNzQgMTMuNzYgMTggMTMuNCAxOC4xQzEyLjI4IDE4LjUgMTEuMTYgMTcuOTQgMTAuNSAxNy4yOEMxMS42OSAxNyAxMi40IDE2LjEyIDEyLjYxIDE1LjIzQzEyLjc4IDE0LjQzIDEyLjQ2IDEzLjc3IDEyLjMzIDEzQzEyLjIxIDEyLjI2IDEyLjIzIDExLjYzIDEyLjUgMTAuOTRDMTIuNjkgMTEuMzIgMTIuODkgMTEuNyAxMy4xMyAxMkMxMy45IDEzIDE1LjExIDEzLjQ0IDE1LjM3IDE0LjhDMTUuNDEgMTQuOTQgMTUuNDMgMTUuMDggMTUuNDMgMTUuMjNDMTUuNDYgMTYuMDUgMTUuMSAxNi45NSAxNC41IDE3LjVIMTQuNVoiIC8+PC9zdmc+", "name": "ParticleEmitter3D", "previewIconUrl": "https://asset-resources.gdevelop.io/public-resources/Icons/f2e5a34bf465f781866677762d385d6c8e9e8d203383f2df9a3b7e0fad6a2cb5_fire.svg", - "shortDescription": "Display a large number of particles to create visual effects.", - "version": "2.0.2", + "shortDescription": "Display a large number of particles in 3D to create visual effects in a 3D game.", + "version": "3.0.1", "description": [ - "Particle emitters can be used to display:", - "- Fire", - "- Smoke", - "- Splashes", - "- Lights", + "3D particle emitters let you create and display many small particles to simulate visual effects in your game — like fire, explosions, smoke, or dust.", "", - "Breaking change", - "- 2.0.0", - " - Object properties for position and rotation have been removed. They must be set with the instance editor or the action.", - "- 1.0.0", - " - Particles were 3 times too small" + "The parameters of the object can be configured in multiple different ways to create a specific desired effect. GDevelop will give a set of a pre-configured 3D particle emitters that you should try first.", + "", + "Use these 3D particle emitters in 3D games. For 2D games or particles that appear on a game's 2D user interface, use the 2D particle emitter object instead." ], "origin": { "identifier": "ParticleEmitter3D", @@ -22548,6 +23857,20 @@ "authorIds": [ "IWykYNRvhCZBN3vEgKEbBPOR3Oc2" ], + "changelog": [ + { + "version": "3.0.0", + "breaking": "- the object rotates the other way around X axis." + }, + { + "version": "2.0.0", + "breaking": "- Object properties for position and rotation have been removed. They must be set with the instance editor or the action." + }, + { + "version": "1.0.0", + "breaking": "- Particles were 3 times too small." + } + ], "dependencies": [], "globalVariables": [], "sceneVariables": [], @@ -22567,6 +23890,8 @@ " return;", "}", "", + "const game = runtimeScene.getGame();", + "", "class ParticleEmitter3DRenderer extends gdjs.CustomRuntimeObject3DRenderer {", " constructor(", " object,", @@ -22582,15 +23907,16 @@ " threeObject3D.rotation.set(", " gdjs.toRad(this._object.getRotationX()),", " gdjs.toRad(this._object.getRotationY()),", - " -gdjs.toRad(this._object.angle)", + " gdjs.toRad(this._object.angle)", " );", "", " threeObject3D.position.set(", " this._object.getX(),", - " -this._object.getY(),", + " this._object.getY(),", " this._object.getZ()", " );", "", + " // Force the scale to 1 because the particle emitter doesn't really has a size.", " threeObject3D.scale.set(", " this._object.isFlippedX() ? -1 : 1,", " this._object.isFlippedY() ? -1 : 1,", @@ -22603,6 +23929,89 @@ " }", "}", "", + "const coneLength = 64;", + "", + "class ParticleEmitterHelper extends THREE.Object3D {", + " /** @type {gdjs.CustomRuntimeObject3D} */", + " object;", + " /** @type {THREE.LineSegments} */", + " cone;", + " /** @type {THREE.LineSegments} */", + " centerLine;", + " /** @type {THREE.Mesh} */", + " originBox;", + "", + "\t/**", + " * @param gdjs.CustomRuntimeObject3D object", + "\t */", + " constructor(object) {", + " super();", + " this.object = object;", + " this.type = 'ParticleEmitterHelper';", + "", + " const coneGeometry = new THREE.BufferGeometry();", + " const conePositions = [", + " 0, 0, 0, 0, 0, 1,", + " 0, 0, 0, 1, 0, 1,", + " 0, 0, 0, - 1, 0, 1,", + " 0, 0, 0, 0, 1, 1,", + " 0, 0, 0, 0, - 1, 1", + " ];", + " for (let i = 0, j = 1, l = 32; i < l; i++ , j++) {", + " const p1 = (i / l) * Math.PI * 2;", + " const p2 = (j / l) * Math.PI * 2;", + " conePositions.push(", + " Math.cos(p1), Math.sin(p1), 1,", + " Math.cos(p2), Math.sin(p2), 1", + " );", + " }", + " coneGeometry.setAttribute('position', new THREE.Float32BufferAttribute(conePositions, 3));", + " this.cone = new THREE.LineSegments(", + " coneGeometry,", + " new THREE.LineBasicMaterial({ fog: false, toneMapped: false })", + " );", + " this.add(this.cone);", + " const centerLineGeometry = new THREE.BufferGeometry();", + " centerLineGeometry.setAttribute('position', new THREE.Float32BufferAttribute([", + " 0, 0, 0, 0, 0, coneLength", + " ], 3));", + " this.centerLine = new THREE.LineSegments(", + " centerLineGeometry,", + " new THREE.LineBasicMaterial({ fog: false, toneMapped: false })", + " );", + " this.add(this.centerLine);", + "", + " this.originBox = new THREE.Mesh(", + " new THREE.BoxGeometry(16, 16, 16),", + " new THREE.MeshBasicMaterial({ fog: false, toneMapped: false })", + " );", + " this.add(this.originBox);", + " this.update();", + "", + " this.originBox.gdjsRuntimeObject = object;", + " }", + "", + " dispose() {", + " this.cone.geometry.dispose();", + " this.cone.material.dispose();", + " this.centerLine.geometry.dispose();", + " this.centerLine.material.dispose();", + " this.originBox.geometry.dispose();", + " this.originBox.material.dispose();", + " }", + "", + " update() {", + " const coneWidth = coneLength * Math.sin(gdjs.toRad(this.object._getSpayConeAngle()));", + " const coneHeight = coneLength * Math.cos(gdjs.toRad(this.object._getSpayConeAngle()));", + " this.cone.scale.set(coneWidth, coneWidth, coneHeight);", + " const startColor = gdjs.rgbOrHexStringToNumber(this.object._getStartColor())", + " const endColor = gdjs.rgbOrHexStringToNumber(this.object._getEndColor());", + " this.cone.material.color.set(endColor);", + " this.centerLine.material.color.set(startColor);", + " this.originBox.material.color.set(startColor);", + " }", + "}", + "", "/**", " * @param {string} colorString", " * @param {THREE.Vector4} threeColor", @@ -22793,6 +24202,11 @@ " break;", " }", " }", + "", + " setImage(resourceName) {", + " const texture = game.getImageManager().getThreeTexture(resourceName);", + " this.particleSystem.texture = texture;", + " }", "}", "", "", @@ -22803,6 +24217,9 @@ " * Copyright 2024 Alchemist0823 , MIT", " */", "", + "// The migration to addUpdateRange was backported without updating the library", + "// because GDevelop still uses Three.js 0.160.0.", + "", "class ParticleEmitter extends THREE.Object3D {", " constructor(system) {", " super();", @@ -27421,27 +28838,34 @@ " });", " this.geometry.instanceCount = index;", " if (index > 0) {", - " this.offsetBuffer.updateRange.count = index * 3;", + " this.offsetBuffer.clearUpdateRanges();", + " this.offsetBuffer.addUpdateRange(0, index * 3);", " this.offsetBuffer.needsUpdate = true;", - " this.sizeBuffer.updateRange.count = index;", + " this.sizeBuffer.clearUpdateRanges();", + " this.sizeBuffer.addUpdateRange(0, index);", " this.sizeBuffer.needsUpdate = true;", - " this.colorBuffer.updateRange.count = index * 4;", + " this.colorBuffer.clearUpdateRanges();", + " this.colorBuffer.addUpdateRange(0, index * 4);", " this.colorBuffer.needsUpdate = true;", - " this.uvTileBuffer.updateRange.count = index;", + " this.uvTileBuffer.clearUpdateRanges();", + " this.uvTileBuffer.addUpdateRange(0, index);", " this.uvTileBuffer.needsUpdate = true;", " if (this.settings.renderMode === RenderMode.StretchedBillBoard && this.velocityBuffer) {", - " this.velocityBuffer.updateRange.count = index * 4;", + " this.velocityBuffer.clearUpdateRanges();", + " this.velocityBuffer.addUpdateRange(0, index * 4);", " this.velocityBuffer.needsUpdate = true;", " }", " if (this.settings.renderMode === RenderMode.Mesh) {", - " this.rotationBuffer.updateRange.count = index * 4;", + " this.rotationBuffer.clearUpdateRanges();", + " this.rotationBuffer.addUpdateRange(0, index * 4);", " this.rotationBuffer.needsUpdate = true;", " }", " else if (this.settings.renderMode === RenderMode.StretchedBillBoard ||", " this.settings.renderMode === RenderMode.HorizontalBillBoard ||", " this.settings.renderMode === RenderMode.VerticalBillBoard ||", " this.settings.renderMode === RenderMode.BillBoard) {", - " this.rotationBuffer.updateRange.count = index;", + " this.rotationBuffer.clearUpdateRanges();", + " this.rotationBuffer.addUpdateRange(0, index);", " this.rotationBuffer.needsUpdate = true;", " }", " }", @@ -27784,21 +29208,29 @@ " }", " }", " });", - " this.positionBuffer.updateRange.count = index * 3;", + " this.positionBuffer.clearUpdateRanges();", + " this.positionBuffer.addUpdateRange(0, index * 3);", " this.positionBuffer.needsUpdate = true;", - " this.previousBuffer.updateRange.count = index * 3;", + " this.previousBuffer.clearUpdateRanges();", + " this.previousBuffer.addUpdateRange(0, index * 3);", " this.previousBuffer.needsUpdate = true;", - " this.nextBuffer.updateRange.count = index * 3;", + " this.nextBuffer.clearUpdateRanges();", + " this.nextBuffer.addUpdateRange(0, index * 3);", " this.nextBuffer.needsUpdate = true;", - " this.sideBuffer.updateRange.count = index;", + " this.sideBuffer.clearUpdateRanges();", + " this.sideBuffer.addUpdateRange(0, index);", " this.sideBuffer.needsUpdate = true;", - " this.widthBuffer.updateRange.count = index;", + " this.widthBuffer.clearUpdateRanges();", + " this.widthBuffer.addUpdateRange(0, index);", " this.widthBuffer.needsUpdate = true;", - " this.uvBuffer.updateRange.count = index * 2;", + " this.uvBuffer.clearUpdateRanges();", + " this.uvBuffer.addUpdateRange(0, index * 2);", " this.uvBuffer.needsUpdate = true;", - " this.colorBuffer.updateRange.count = index * 4;", + " this.colorBuffer.clearUpdateRanges();", + " this.colorBuffer.addUpdateRange(0, index * 4);", " this.colorBuffer.needsUpdate = true;", - " this.indexBuffer.updateRange.count = triangles * 3;", + " this.indexBuffer.clearUpdateRanges();", + " this.indexBuffer.addUpdateRange(0, triangles * 3);", " this.indexBuffer.needsUpdate = true;", " this.geometry.setDrawRange(0, triangles * 3);", " }", @@ -29151,6 +30583,7 @@ "gdjs.__particleEmmiter3DExtension = {", " ParticleEmitter3DRenderer,", " ParticleEmitterAdapter,", + " ParticleEmitterHelper,", "", " ApplyCollision,", " ApplyForce,", @@ -29274,6 +30707,71 @@ "is3D": true, "isUsingLegacyInstancesRenderer": true, "name": "ParticleEmitter3D", + "objects": [ + { + "adaptCollisionMaskAutomatically": true, + "assetStoreId": "", + "name": "Particle", + "type": "Sprite", + "updateIfNotVisible": false, + "variables": [], + "effects": [], + "behaviors": [], + "animations": [ + { + "name": "Image", + "useMultipleDirections": false, + "directions": [ + { + "looping": false, + "timeBetweenFrames": 0.08, + "sprites": [] + } + ] + } + ] + } + ], + "objectsFolderStructure": { + "folderName": "__ROOT", + "children": [ + { + "objectName": "Particle" + } + ] + }, + "objectsGroups": [], + "layers": [ + { + "ambientLightColorB": 200, + "ambientLightColorG": 200, + "ambientLightColorR": 200, + "camera3DFarPlaneDistance": 10000, + "camera3DFieldOfView": 45, + "camera3DNearPlaneDistance": 3, + "cameraType": "", + "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": [] + } + ], + "instances": [], "eventsFunctions": [ { "fullName": "", @@ -29299,37 +30797,47 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "const BatchedRenderer = gdjs.__particleEmmiter3DExtension.BatchedRenderer;", - "const ParticleSystem = gdjs.__particleEmmiter3DExtension.ParticleSystem;", - "const TextureLoader = gdjs.__particleEmmiter3DExtension.TextureLoader;", - "const IntervalValue = gdjs.__particleEmmiter3DExtension.IntervalValue;", - "const ConstantValue = gdjs.__particleEmmiter3DExtension.ConstantValue;", - "const ConstantColor = gdjs.__particleEmmiter3DExtension.ConstantColor;", - "const ColorOverLife = gdjs.__particleEmmiter3DExtension.ColorOverLife;", - "const SizeOverLife = gdjs.__particleEmmiter3DExtension.SizeOverLife;", - "const ApplyForce = gdjs.__particleEmmiter3DExtension.ApplyForce;", - "const Gradient = gdjs.__particleEmmiter3DExtension.Gradient;", - "const PiecewiseBezier = gdjs.__particleEmmiter3DExtension.PiecewiseBezier;", - "const Bezier = gdjs.__particleEmmiter3DExtension.Bezier;", - "const PointEmitter = gdjs.__particleEmmiter3DExtension.PointEmitter;", - "const ConeEmitter = gdjs.__particleEmmiter3DExtension.ConeEmitter;", - "const RenderMode = gdjs.__particleEmmiter3DExtension.RenderMode;", + "const {", + " ParticleEmitterAdapter,", + " ParticleEmitter3DRenderer,", + " ParticleEmitterHelper,", "", - "const { ParticleEmitterAdapter, ParticleEmitter3DRenderer } = gdjs.__particleEmmiter3DExtension;", + " ParticleSystem,", + " IntervalValue,", + " ConstantValue,", + " ConstantColor,", + " ColorOverLife,", + " SizeOverLife,", + " ApplyForce,", + " Gradient,", + " PiecewiseBezier,", + " Bezier,", + " PointEmitter,", + " ConeEmitter,", + " RenderMode", + "} = gdjs.__particleEmmiter3DExtension;", "", "/** @type {gdjs.CustomRuntimeObject} */", "const object = objects[0];", + "// Force the size of the object because it doesn't contain any instance.", + "object._innerArea = {", + " min: [-16, -16, -16],", + " max: [16, 16, 16],", + " };", + "const hitbox = new gdjs.Polygon();", + "hitbox.vertices = [[-16, -16], [16, -16], [16, 16], [-16, 16]];", + "object._untransformedHitBoxes = [hitbox];", + "object._unrotatedAABB.min[0] = -16;", + "object._unrotatedAABB.min[1] = -16;", + "object._unrotatedAABB.max[0] = 16;", + "object._unrotatedAABB.max[1] = 16;", + "object._updateUntransformedHitBoxes = () => {};", "", "// Here runtimeScene is the gdjs.CustomRuntimeObjectInstanceContainer inside the custom object.", "const gameScene = object.getRuntimeScene();", + "const game = runtimeScene.getGame();", "", - "/** @type {SpriteObjectDataType} */", - "const particleSpriteData = object._instanceContainer._objects.get(\"Particle\");", - "const resourceName = particleSpriteData.animations[0].directions[0].sprites[0].image;", - "const texture = object", - " .getInstanceContainer()", - " .getGame()", - " .getImageManager().getThreeTexture(resourceName);", + "const texture = game.getImageManager().getThreeTexture('');", "", "// Set the blending here because changes are not applied after the emitter creation.", "const blendingString = object._getBlending();", @@ -29402,7 +30910,7 @@ "", "// This is a hack that may break in future releases.", "// Replace the group that would hold children objects by the emmiter.", - "const layer = gameScene.getLayer(object.getLayer());", + "const layer = object.getInstanceContainer().getLayer(object.getLayer());", "const group = object.getRenderer()._threeGroup;", "layer.getRenderer().remove3DRendererObject(group);", "particleSystem.emitter.position.copy(group.position);", @@ -29411,8 +30919,15 @@ "", "const particleEmitter3DRenderer = new ParticleEmitter3DRenderer(object, object._instanceContainer, object.getInstanceContainer());", "object._renderer = particleEmitter3DRenderer;", - "particleEmitter3DRenderer._threeGroup = particleSystem.emitter;", - "layer.getRenderer().add3DRendererObject(particleSystem.emitter);", + "if (game.isInGameEdition && game.isInGameEdition()) {", + " const particleEmitterHelper = new ParticleEmitterHelper(object);", + " particleEmitter3DRenderer._threeGroup = particleEmitterHelper;", + " layer.getRenderer().add3DRendererObject(particleEmitterHelper);", + "}", + "else {", + " particleEmitter3DRenderer._threeGroup = particleSystem.emitter;", + " layer.getRenderer().add3DRendererObject(particleSystem.emitter);", + "}", "", "particleSystem.emitter.updateMatrixWorld(true);", "", @@ -29492,7 +31007,7 @@ " for (const layerName of layerNames) {", " const layer = gameScene.getLayer(layerName);", " if (layer.__particleEmmiter3DExtension) {", - " layer.__particleEmmiter3DExtension.batchSystem.update(object.getElapsedTime() / 1000);", + " layer.__particleEmmiter3DExtension.batchSystem.update(layer.getElapsedTime() / 1000);", " }", " }", "}" @@ -29764,6 +31279,15 @@ "Object.GravityTop()", "" ] + }, + { + "type": { + "value": "ParticleEmitter3D::ParticleEmitter3D::UpdateImage" + }, + "parameters": [ + "Object", + "" + ] } ], "events": [ @@ -29773,10 +31297,12 @@ { "type": { "inverted": true, - "value": "ParticleEmitter3D::ParticleEmitter3D::PropertyAreParticlesRelative" + "value": "BooleanVariable" }, "parameters": [ - "Object" + "AreParticlesRelative", + "True", + "" ] } ], @@ -29798,10 +31324,12 @@ "conditions": [ { "type": { - "value": "ParticleEmitter3D::ParticleEmitter3D::PropertyAreParticlesRelative" + "value": "BooleanVariable" }, "parameters": [ - "Object" + "AreParticlesRelative", + "True", + "" ] } ], @@ -29849,6 +31377,87 @@ ] } ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "ParticleEmitter3D::ParticleEmitter3D::UpdateHelper" + }, + "parameters": [ + "Object", + "" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "ParticleEmitter3D::ParticleEmitter3D", + "type": "object" + } + ], + "objectGroups": [] + }, + { + "fullName": "Update helper", + "functionType": "Action", + "name": "UpdateHelper", + "private": true, + "sentence": "Update graphical helper of _PARAM0_", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const game = runtimeScene.getGame();", + "if (game.isInGameEdition && game.isInGameEdition()) {", + " const particleEmitterHelper = objects[0].get3DRendererObject();", + " particleEmitterHelper.update();", + "}" + ], + "parameterObjects": "Object", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "ParticleEmitter3D::ParticleEmitter3D", + "type": "object" + } + ], + "objectGroups": [] + }, + { + "fullName": "Update particle image", + "functionType": "Action", + "name": "UpdateImage", + "private": true, + "sentence": "Update particle image of _PARAM0_", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "/** @type {gdjs.CustomRuntimeObject3D} */\r", + "const object = objects[0];\r", + "/** @type {SpriteObjectDataType} */\r", + "const particleSpriteData = object._instanceContainer._objects.get(\"Particle\");\r", + "/** @type {gdjs.SpriteAnimationData} */\r", + "const animation = particleSpriteData.animations[0];\r", + "const animationFrame = animation ? animation.directions[0].sprites[0] : null;\r", + "const resourceName = animationFrame ? animationFrame.image : '';\r", + "object.__particleEmitterAdapter.setImage(resourceName);" + ], + "parameterObjects": "Object", + "useStrict": true, + "eventsSheetExpanded": true } ], "parameters": [ @@ -29936,7 +31545,7 @@ " for (const layerName of layerNames) {", " const layer = gameScene.getLayer(layerName);", " if (layer.__particleEmmiter3DExtension) {", - " layer.__particleEmmiter3DExtension.batchSystem.update(object.getElapsedTime() / 1000);", + " layer.__particleEmmiter3DExtension.batchSystem.update(layer.getElapsedTime() / 1000);", " }", " }", "}" @@ -29976,10 +31585,16 @@ " // Here runtimeScene is the gdjs.CustomRuntimeObjectInstanceContainer inside the custom object.", " const gameScene = object.getRuntimeScene();", "", - " const layer = gameScene.getLayer(object.getLayer());", + " let rootObject = object;", + " while (rootObject.getInstanceContainer().getOwner) {", + " rootObject = rootObject.getInstanceContainer().getOwner();", + " }", + "", + " const layer = gameScene.getLayer(rootObject.getLayer());", " layer.__particleEmmiter3DExtension = layer.__particleEmmiter3DExtension || {};", " if (!layer.__particleEmmiter3DExtension.batchSystem) {", " const batchSystem = new gdjs.__particleEmmiter3DExtension.BatchedRenderer();", + " batchSystem.scale.y *= -1;", " const threeScene = layer.getRenderer().getThreeScene();", " if (threeScene) {", " threeScene.add(batchSystem);", @@ -30023,7 +31638,7 @@ ], "parameterObjects": "Object", "useStrict": true, - "eventsSheetExpanded": false + "eventsSheetExpanded": true } ], "parameters": [ @@ -30151,12 +31766,12 @@ "actions": [ { "type": { - "value": "ParticleEmitter3D::ParticleEmitter3D::SetPropertyZ" + "value": "SetNumberVariable" }, "parameters": [ - "Object", + "Z", "=", - "GetArgumentAsNumber(\"Value\")" + "Value" ] } ] @@ -30223,12 +31838,12 @@ "actions": [ { "type": { - "value": "ParticleEmitter3D::ParticleEmitter3D::SetPropertyRotationX" + "value": "SetNumberVariable" }, "parameters": [ - "Object", + "RotationX", "=", - "GetArgumentAsNumber(\"Value\")" + "Value" ] } ] @@ -30306,12 +31921,12 @@ "actions": [ { "type": { - "value": "ParticleEmitter3D::ParticleEmitter3D::SetPropertyRotationY" + "value": "SetNumberVariable" }, "parameters": [ - "Object", + "RotationY", "=", - "GetArgumentAsNumber(\"Value\")" + "Value" ] } ] @@ -30387,12 +32002,12 @@ "actions": [ { "type": { - "value": "ParticleEmitter3D::ParticleEmitter3D::SetPropertyStartColor" + "value": "SetStringVariable" }, "parameters": [ - "Object", + "StartColor", "=", - "GetArgumentAsString(\"Value\")" + "Value" ] } ] @@ -30469,12 +32084,12 @@ "actions": [ { "type": { - "value": "ParticleEmitter3D::ParticleEmitter3D::SetPropertyEndColor" + "value": "SetStringVariable" }, "parameters": [ - "Object", + "EndColor", "=", - "GetArgumentAsString(\"Value\")" + "Value" ] } ] @@ -30551,12 +32166,12 @@ "actions": [ { "type": { - "value": "ParticleEmitter3D::ParticleEmitter3D::SetPropertyStartOpacity" + "value": "SetNumberVariable" }, "parameters": [ - "Object", + "StartOpacity", "=", - "GetArgumentAsNumber(\"Value\")" + "Value" ] } ] @@ -30633,12 +32248,12 @@ "actions": [ { "type": { - "value": "ParticleEmitter3D::ParticleEmitter3D::SetPropertyEndOpacity" + "value": "SetNumberVariable" }, "parameters": [ - "Object", + "EndOpacity", "=", - "GetArgumentAsNumber(\"Value\")" + "Value" ] } ] @@ -30715,12 +32330,12 @@ "actions": [ { "type": { - "value": "ParticleEmitter3D::ParticleEmitter3D::SetPropertyFlow" + "value": "SetNumberVariable" }, "parameters": [ - "Object", + "Flow", "=", - "GetArgumentAsNumber(\"Value\")" + "Value" ] } ] @@ -30798,12 +32413,12 @@ "actions": [ { "type": { - "value": "ParticleEmitter3D::ParticleEmitter3D::SetPropertyStartSizeMin" + "value": "SetNumberVariable" }, "parameters": [ - "Object", + "StartSizeMin", "=", - "GetArgumentAsNumber(\"Value\")" + "Value" ] } ] @@ -30880,12 +32495,12 @@ "actions": [ { "type": { - "value": "ParticleEmitter3D::ParticleEmitter3D::SetPropertyStartSizeMax" + "value": "SetNumberVariable" }, "parameters": [ - "Object", + "StartSizeMax", "=", - "GetArgumentAsNumber(\"Value\")" + "Value" ] } ] @@ -30963,12 +32578,12 @@ "actions": [ { "type": { - "value": "ParticleEmitter3D::ParticleEmitter3D::SetPropertyEndScale" + "value": "SetNumberVariable" }, "parameters": [ - "Object", + "EndScale", "=", - "GetArgumentAsNumber(\"Value\")" + "Value" ] } ] @@ -31046,12 +32661,12 @@ "actions": [ { "type": { - "value": "ParticleEmitter3D::ParticleEmitter3D::SetPropertyStartSpeedMin" + "value": "SetNumberVariable" }, "parameters": [ - "Object", + "StartSpeedMin", "=", - "GetArgumentAsNumber(\"Value\")" + "Value" ] } ] @@ -31128,12 +32743,12 @@ "actions": [ { "type": { - "value": "ParticleEmitter3D::ParticleEmitter3D::SetPropertyStartSpeedMax" + "value": "SetNumberVariable" }, "parameters": [ - "Object", + "StartSpeedMax", "=", - "GetArgumentAsNumber(\"Value\")" + "Value" ] } ] @@ -31210,12 +32825,12 @@ "actions": [ { "type": { - "value": "ParticleEmitter3D::ParticleEmitter3D::SetPropertyLifespanMin" + "value": "SetNumberVariable" }, "parameters": [ - "Object", + "LifespanMin", "=", - "GetArgumentAsNumber(\"Value\")" + "Value" ] } ] @@ -31293,12 +32908,12 @@ "actions": [ { "type": { - "value": "ParticleEmitter3D::ParticleEmitter3D::SetPropertyLifespanMax" + "value": "SetNumberVariable" }, "parameters": [ - "Object", + "LifespanMax", "=", - "GetArgumentAsNumber(\"Value\")" + "Value" ] } ] @@ -31376,12 +32991,12 @@ "actions": [ { "type": { - "value": "ParticleEmitter3D::ParticleEmitter3D::SetPropertyDuration" + "value": "SetNumberVariable" }, "parameters": [ - "Object", + "Duration", "=", - "GetArgumentAsNumber(\"Value\")" + "Value" ] } ] @@ -31423,10 +33038,12 @@ "conditions": [ { "type": { - "value": "ParticleEmitter3D::ParticleEmitter3D::PropertyAreParticlesRelative" + "value": "BooleanVariable" }, "parameters": [ - "Object" + "AreParticlesRelative", + "True", + "" ] } ], @@ -31466,21 +33083,24 @@ { "type": { "inverted": true, - "value": "GetArgumentAsBoolean" + "value": "BooleanVariable" }, "parameters": [ - "\"Value\"" + "Value", + "True", + "" ] } ], "actions": [ { "type": { - "value": "ParticleEmitter3D::ParticleEmitter3D::SetPropertyAreParticlesRelative" + "value": "SetBooleanVariable" }, "parameters": [ - "Object", - "no" + "AreParticlesRelative", + "False", + "" ] } ] @@ -31490,21 +33110,24 @@ "conditions": [ { "type": { - "value": "GetArgumentAsBoolean" + "value": "BooleanVariable" }, "parameters": [ - "\"Value\"" + "Value", + "True", + "" ] } ], "actions": [ { "type": { - "value": "ParticleEmitter3D::ParticleEmitter3D::SetPropertyAreParticlesRelative" + "value": "SetBooleanVariable" }, "parameters": [ - "Object", - "yes" + "AreParticlesRelative", + "True", + "" ] } ] @@ -31589,12 +33212,12 @@ "actions": [ { "type": { - "value": "ParticleEmitter3D::ParticleEmitter3D::SetPropertySpayConeAngle" + "value": "SetNumberVariable" }, "parameters": [ - "Object", + "SpayConeAngle", "=", - "GetArgumentAsNumber(\"Value\")" + "Value" ] } ] @@ -31674,12 +33297,12 @@ "actions": [ { "type": { - "value": "ParticleEmitter3D::ParticleEmitter3D::SetPropertyBlending" + "value": "SetStringVariable" }, "parameters": [ - "Object", + "Blending", "=", - "GetArgumentAsString(\"Value\")" + "Value" ] } ] @@ -31758,12 +33381,12 @@ "actions": [ { "type": { - "value": "ParticleEmitter3D::ParticleEmitter3D::SetPropertyGravityTop" + "value": "SetStringVariable" }, "parameters": [ - "Object", + "GravityTop", "=", - "GetArgumentAsString(\"Value\")" + "Value" ] } ] @@ -31841,12 +33464,12 @@ "actions": [ { "type": { - "value": "ParticleEmitter3D::ParticleEmitter3D::SetPropertyGravity" + "value": "SetNumberVariable" }, "parameters": [ - "Object", + "Gravity", "=", - "GetArgumentAsNumber(\"Value\")" + "Value" ] } ] @@ -31888,10 +33511,12 @@ "conditions": [ { "type": { - "value": "ParticleEmitter3D::ParticleEmitter3D::PropertyShouldAutodestruct" + "value": "BooleanVariable" }, "parameters": [ - "Object" + "ShouldAutodestruct", + "True", + "" ] } ], @@ -31931,21 +33556,24 @@ { "type": { "inverted": true, - "value": "GetArgumentAsBoolean" + "value": "BooleanVariable" }, "parameters": [ - "\"Value\"" + "Value", + "True", + "" ] } ], "actions": [ { "type": { - "value": "ParticleEmitter3D::ParticleEmitter3D::SetPropertyShouldAutodestruct" + "value": "SetBooleanVariable" }, "parameters": [ - "Object", - "no" + "ShouldAutodestruct", + "False", + "" ] } ] @@ -31955,21 +33583,24 @@ "conditions": [ { "type": { - "value": "GetArgumentAsBoolean" + "value": "BooleanVariable" }, "parameters": [ - "\"Value\"" + "Value", + "True", + "" ] } ], "actions": [ { "type": { - "value": "ParticleEmitter3D::ParticleEmitter3D::SetPropertyShouldAutodestruct" + "value": "SetBooleanVariable" }, "parameters": [ - "Object", - "yes" + "ShouldAutodestruct", + "True", + "" ] } ] @@ -31998,18 +33629,14 @@ "value": "255;0;0", "type": "Color", "label": "Start color", - "description": "", "group": "Color", - "extraInformation": [], "name": "StartColor" }, { "value": "255;255;0", "type": "Color", "label": "End color", - "description": "", "group": "Color", - "extraInformation": [], "name": "EndColor" }, { @@ -32017,9 +33644,7 @@ "type": "Number", "unit": "Dimensionless", "label": "Start opacity", - "description": "", "group": "Color", - "extraInformation": [], "name": "StartOpacity" }, { @@ -32027,18 +33652,13 @@ "type": "Number", "unit": "Dimensionless", "label": "End opacity", - "description": "", "group": "Color", - "extraInformation": [], "name": "EndOpacity" }, { "value": "50", "type": "Number", "label": "Flow of particles (particles per second)", - "description": "", - "group": "", - "extraInformation": [], "name": "Flow" }, { @@ -32046,9 +33666,7 @@ "type": "Number", "unit": "Pixel", "label": "Start min size", - "description": "", "group": "Size", - "extraInformation": [], "name": "StartSizeMin" }, { @@ -32056,9 +33674,7 @@ "type": "Number", "unit": "Pixel", "label": "Start max size", - "description": "", "group": "Size", - "extraInformation": [], "name": "StartSizeMax" }, { @@ -32066,9 +33682,7 @@ "type": "Number", "unit": "Dimensionless", "label": "End scale", - "description": "", "group": "Size", - "extraInformation": [], "name": "EndScale" }, { @@ -32076,9 +33690,7 @@ "type": "Number", "unit": "PixelSpeed", "label": "Start min speed", - "description": "", "group": "Speed", - "extraInformation": [], "name": "StartSpeedMin" }, { @@ -32086,9 +33698,7 @@ "type": "Number", "unit": "PixelSpeed", "label": "Start max speed", - "description": "", "group": "Speed", - "extraInformation": [], "name": "StartSpeedMax" }, { @@ -32096,9 +33706,6 @@ "type": "Number", "unit": "Second", "label": "Min lifespan", - "description": "", - "group": "", - "extraInformation": [], "name": "LifespanMin" }, { @@ -32106,9 +33713,6 @@ "type": "Number", "unit": "Second", "label": "Max lifespan", - "description": "", - "group": "", - "extraInformation": [], "name": "LifespanMax" }, { @@ -32116,18 +33720,13 @@ "type": "Number", "unit": "Second", "label": "Emission duration", - "description": "", - "group": "", - "extraInformation": [], "name": "Duration" }, { "value": "", "type": "Boolean", "label": "Particles move with the emitter", - "description": "", "group": "Speed", - "extraInformation": [], "name": "AreParticlesRelative" }, { @@ -32135,23 +33734,35 @@ "type": "Number", "unit": "DegreeAngle", "label": "Spay cone angle", - "description": "", "group": "Position", - "extraInformation": [], "name": "SpayConeAngle" }, { "value": "Additive", "type": "Choice", "label": "Blending", - "description": "", "group": "Color", - "extraInformation": [ - "Normal", - "Additive", - "Subtractive", - "Multiply", - "None" + "choices": [ + { + "label": "Normal", + "value": "Normal" + }, + { + "label": "Additive", + "value": "Additive" + }, + { + "label": "Subtractive", + "value": "Subtractive" + }, + { + "label": "Multiply", + "value": "Multiply" + }, + { + "label": "None", + "value": "None" + } ], "name": "Blending" }, @@ -32159,11 +33770,16 @@ "value": "Y-", "type": "Choice", "label": "Gravity top", - "description": "", "group": "Speed", - "extraInformation": [ - "Y-", - "Z+" + "choices": [ + { + "label": "Y-", + "value": "Y-" + }, + { + "label": "Z+", + "value": "Z+" + } ], "name": "GravityTop" }, @@ -32172,18 +33788,13 @@ "type": "Number", "unit": "PixelAcceleration", "label": "Gravity", - "description": "", "group": "Speed", - "extraInformation": [], "name": "Gravity" }, { "value": "true", "type": "Boolean", "label": "Delete when emission ends", - "description": "", - "group": "", - "extraInformation": [], "name": "ShouldAutodestruct" }, { @@ -32191,8 +33802,6 @@ "type": "String", "label": "", "description": "Only used by the scene editor.", - "group": "", - "extraInformation": [], "hidden": true, "name": "ParentOrigin" }, @@ -32203,7 +33812,6 @@ "label": "Z (elevation)", "description": "Deprecated", "group": "Position", - "extraInformation": [], "hidden": true, "name": "Z" }, @@ -32212,9 +33820,7 @@ "type": "Number", "unit": "DegreeAngle", "label": "Rotation on X axis", - "description": "", "group": "Position", - "extraInformation": [], "hidden": true, "name": "RotationX" }, @@ -32223,78 +33829,12 @@ "type": "Number", "unit": "DegreeAngle", "label": "Rotation on Y axis", - "description": "", "group": "Position", - "extraInformation": [], "hidden": true, "name": "RotationY" } ], - "objects": [ - { - "adaptCollisionMaskAutomatically": true, - "assetStoreId": "", - "name": "Particle", - "type": "Sprite", - "updateIfNotVisible": false, - "variables": [], - "effects": [], - "behaviors": [], - "animations": [ - { - "name": "Image", - "useMultipleDirections": false, - "directions": [ - { - "looping": false, - "timeBetweenFrames": 0.08, - "sprites": [] - } - ] - } - ] - } - ], - "objectsFolderStructure": { - "folderName": "__ROOT", - "children": [ - { - "objectName": "Particle" - } - ] - }, - "objectsGroups": [], - "layers": [ - { - "ambientLightColorB": 200, - "ambientLightColorG": 200, - "ambientLightColorR": 200, - "camera3DFarPlaneDistance": 10000, - "camera3DFieldOfView": 45, - "camera3DNearPlaneDistance": 3, - "cameraType": "", - "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": [] - } - ], - "instances": [] + "variants": [] } ] }, @@ -32302,13 +33842,14 @@ "author": "", "category": "Input", "extensionNamespace": "", - "fullName": "Behavior Remapper", + "fullName": "Platformer and top-down remapper", + "gdevelopVersion": ">=5.5.222", "helpPath": "", "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0ibWRpLWFscGhhLXctYm94LW91dGxpbmUiIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNOSwxN0EyLDIgMCAwLDEgNywxNVY3SDlWMTVIMTFWOEgxM1YxNUgxNVY3SDE3VjE1QTIsMiAwIDAsMSAxNSwxN0g5TTUsM0gxOUEyLDIgMCAwLDEgMjEsNVYxOUEyLDIgMCAwLDEgMTksMjFINUEyLDIgMCAwLDEgMywxOVY1QTIsMiAwIDAsMSA1LDNNNSw1VjE5SDE5VjVINVoiIC8+PC9zdmc+", "name": "BehaviorRemapper", "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/alpha-w-box-outline.svg", - "shortDescription": "Quickly remap Behavior controls to different keys. ", - "version": "1.0.0", + "shortDescription": "Quickly remap keyboard controls.", + "version": "1.1.1", "description": [ "Make sure to disable default controls unless you want two keys to do the same action.", "", @@ -32355,6 +33896,7 @@ "bindings", "presets", "platformer", + "platform", "top-down" ], "authorIds": [ @@ -32366,8 +33908,8 @@ "eventsFunctions": [], "eventsBasedBehaviors": [ { - "description": "Allows for the controls of a Top-Down behavior to be re-mapped via a single action.", - "fullName": "Remap Top-down", + "description": "Remap keyboard controls of the top-down movement.", + "fullName": "Top-down keyboard remapper", "name": "RemapForTopdown", "objectType": "", "eventsFunctions": [ @@ -32386,7 +33928,7 @@ }, "parameters": [ "", - "Object.Behavior::PropertyUp()" + "Up" ] } ], @@ -32411,7 +33953,7 @@ }, "parameters": [ "", - "Object.Behavior::PropertyLeft()" + "Left" ] } ], @@ -32436,7 +33978,7 @@ }, "parameters": [ "", - "Object.Behavior::PropertyRight()" + "Right" ] } ], @@ -32461,7 +34003,7 @@ }, "parameters": [ "", - "Object.Behavior::PropertyDown()" + "Down" ] } ], @@ -32513,46 +34055,42 @@ "actions": [ { "type": { - "value": "BehaviorRemapper::RemapForTopdown::SetPropertyUp" + "value": "SetStringVariable" }, "parameters": [ - "Object", - "Behavior", + "Up", "=", - "GetArgumentAsString(\"up\")" + "up" ] }, { "type": { - "value": "BehaviorRemapper::RemapForTopdown::SetPropertyLeft" + "value": "SetStringVariable" }, "parameters": [ - "Object", - "Behavior", + "Left", "=", - "GetArgumentAsString(\"left\")" + "left" ] }, { "type": { - "value": "BehaviorRemapper::RemapForTopdown::SetPropertyRight" + "value": "SetStringVariable" }, "parameters": [ - "Object", - "Behavior", + "Right", "=", - "GetArgumentAsString(\"right\")" + "right" ] }, { "type": { - "value": "BehaviorRemapper::RemapForTopdown::SetPropertyDown" + "value": "SetStringVariable" }, "parameters": [ - "Object", - "Behavior", + "Down", "=", - "GetArgumentAsString(\"down\")" + "down" ] } ] @@ -32573,22 +34111,22 @@ { "description": "Up key", "name": "up", - "type": "key" + "type": "keyboardKey" }, { "description": "Left key", "name": "left", - "type": "key" + "type": "keyboardKey" }, { "description": "Down key", "name": "down", - "type": "key" + "type": "keyboardKey" }, { "description": "Right key", "name": "right", - "type": "key" + "type": "keyboardKey" } ], "objectGroups": [] @@ -32620,7 +34158,7 @@ "value": "StrEqual" }, "parameters": [ - "GetArgumentAsString(\"options\")", + "options", "=", "\"WASD\"" ] @@ -32629,44 +34167,40 @@ "actions": [ { "type": { - "value": "BehaviorRemapper::RemapForTopdown::SetPropertyUp" + "value": "SetStringVariable" }, "parameters": [ - "Object", - "Behavior", + "Up", "=", "\"w\"" ] }, { "type": { - "value": "BehaviorRemapper::RemapForTopdown::SetPropertyLeft" + "value": "SetStringVariable" }, "parameters": [ - "Object", - "Behavior", + "Left", "=", "\"a\"" ] }, { "type": { - "value": "BehaviorRemapper::RemapForTopdown::SetPropertyDown" + "value": "SetStringVariable" }, "parameters": [ - "Object", - "Behavior", + "Down", "=", "\"s\"" ] }, { "type": { - "value": "BehaviorRemapper::RemapForTopdown::SetPropertyRight" + "value": "SetStringVariable" }, "parameters": [ - "Object", - "Behavior", + "Right", "=", "\"d\"" ] @@ -32693,7 +34227,7 @@ "value": "StrEqual" }, "parameters": [ - "GetArgumentAsString(\"options\")", + "options", "=", "\"ZQSD\"" ] @@ -32702,44 +34236,40 @@ "actions": [ { "type": { - "value": "BehaviorRemapper::RemapForTopdown::SetPropertyUp" + "value": "SetStringVariable" }, "parameters": [ - "Object", - "Behavior", + "Up", "=", "\"z\"" ] }, { "type": { - "value": "BehaviorRemapper::RemapForTopdown::SetPropertyLeft" + "value": "SetStringVariable" }, "parameters": [ - "Object", - "Behavior", + "Left", "=", "\"q\"" ] }, { "type": { - "value": "BehaviorRemapper::RemapForTopdown::SetPropertyDown" + "value": "SetStringVariable" }, "parameters": [ - "Object", - "Behavior", + "Down", "=", "\"s\"" ] }, { "type": { - "value": "BehaviorRemapper::RemapForTopdown::SetPropertyDown" + "value": "SetStringVariable" }, "parameters": [ - "Object", - "Behavior", + "Down", "=", "\"d\"" ] @@ -32766,7 +34296,7 @@ "value": "StrEqual" }, "parameters": [ - "GetArgumentAsString(\"options\")", + "options", "=", "\"Numpad\"" ] @@ -32775,44 +34305,40 @@ "actions": [ { "type": { - "value": "BehaviorRemapper::RemapForTopdown::SetPropertyUp" + "value": "SetStringVariable" }, "parameters": [ - "Object", - "Behavior", + "Up", "=", "\"NumpadUp\"" ] }, { "type": { - "value": "BehaviorRemapper::RemapForTopdown::SetPropertyLeft" + "value": "SetStringVariable" }, "parameters": [ - "Object", - "Behavior", + "Left", "=", "\"NumpadLeft\"" ] }, { "type": { - "value": "BehaviorRemapper::RemapForTopdown::SetPropertyDown" + "value": "SetStringVariable" }, "parameters": [ - "Object", - "Behavior", + "Down", "=", "\"NumpadDown\"" ] }, { "type": { - "value": "BehaviorRemapper::RemapForTopdown::SetPropertyRight" + "value": "SetStringVariable" }, "parameters": [ - "Object", - "Behavior", + "Right", "=", "\"NumpadRight\"" ] @@ -32839,7 +34365,7 @@ "value": "StrEqual" }, "parameters": [ - "GetArgumentAsString(\"options\")", + "options", "=", "\"IJKL\"" ] @@ -32848,44 +34374,40 @@ "actions": [ { "type": { - "value": "BehaviorRemapper::RemapForTopdown::SetPropertyUp" + "value": "SetStringVariable" }, "parameters": [ - "Object", - "Behavior", + "Up", "=", "\"i\"" ] }, { "type": { - "value": "BehaviorRemapper::RemapForTopdown::SetPropertyLeft" + "value": "SetStringVariable" }, "parameters": [ - "Object", - "Behavior", + "Left", "=", "\"j\"" ] }, { "type": { - "value": "BehaviorRemapper::RemapForTopdown::SetPropertyDown" + "value": "SetStringVariable" }, "parameters": [ - "Object", - "Behavior", + "Down", "=", "\"k\"" ] }, { "type": { - "value": "BehaviorRemapper::RemapForTopdown::SetPropertyRight" + "value": "SetStringVariable" }, "parameters": [ - "Object", - "Behavior", + "Right", "=", "\"l\"" ] @@ -32918,57 +34440,44 @@ "propertyDescriptors": [ { "value": "w", - "type": "String", + "type": "KeyboardKey", "label": "Up key", - "description": "", - "group": "", - "extraInformation": [], "name": "Up" }, { "value": "a", - "type": "String", + "type": "KeyboardKey", "label": "Left key", - "description": "", - "group": "", - "extraInformation": [], "name": "Left" }, { "value": "d", - "type": "String", + "type": "KeyboardKey", "label": "Right key", - "description": "", - "group": "", - "extraInformation": [], "name": "Right" }, { "value": "s", - "type": "String", + "type": "KeyboardKey", "label": "Down key", - "description": "", - "group": "", - "extraInformation": [], "name": "Down" }, { "value": "", "type": "Behavior", "label": "", - "description": "", - "group": "", "extraInformation": [ "TopDownMovementBehavior::TopDownMovementBehavior" ], + "choices": [], "name": "Topdown" } ], "sharedPropertyDescriptors": [] }, { - "description": "Allows for the controls of a platformer behavior to be re-mapped via a single action.", - "fullName": "Remap Platformer controls", + "description": "Remap keyboard controls of the platformer character movement.", + "fullName": "Platformer keyboard mapper", "name": "RemapForPlatformer", "objectType": "", "eventsFunctions": [ @@ -32987,7 +34496,7 @@ }, "parameters": [ "", - "Object.Behavior::PropertyUp()" + "Up" ] } ], @@ -33021,7 +34530,7 @@ }, "parameters": [ "", - "Object.Behavior::PropertyLeft()" + "Left" ] } ], @@ -33046,7 +34555,7 @@ }, "parameters": [ "", - "Object.Behavior::PropertyRight()" + "Right" ] } ], @@ -33071,7 +34580,7 @@ }, "parameters": [ "", - "Object.Behavior::PropertyDown()" + "Down" ] } ], @@ -33105,7 +34614,7 @@ }, "parameters": [ "", - "Object.Behavior::PropertyJump()" + "Jump" ] } ], @@ -33157,57 +34666,52 @@ "actions": [ { "type": { - "value": "BehaviorRemapper::RemapForPlatformer::SetPropertyUp" + "value": "SetStringVariable" }, "parameters": [ - "Object", - "Behavior", + "Up", "=", - "GetArgumentAsString(\"up\")" + "up" ] }, { "type": { - "value": "BehaviorRemapper::RemapForPlatformer::SetPropertyLeft" + "value": "SetStringVariable" }, "parameters": [ - "Object", - "Behavior", + "Left", "=", - "GetArgumentAsString(\"left\")" + "left" ] }, { "type": { - "value": "BehaviorRemapper::RemapForPlatformer::SetPropertyRight" + "value": "SetStringVariable" }, "parameters": [ - "Object", - "Behavior", + "Right", "=", - "GetArgumentAsString(\"right\")" + "right" ] }, { "type": { - "value": "BehaviorRemapper::RemapForPlatformer::SetPropertyDown" + "value": "SetStringVariable" }, "parameters": [ - "Object", - "Behavior", + "Down", "=", - "GetArgumentAsString(\"down\")" + "down" ] }, { "type": { - "value": "BehaviorRemapper::RemapForPlatformer::SetPropertyJump" + "value": "SetStringVariable" }, "parameters": [ - "Object", - "Behavior", + "Jump", "=", - "GetArgumentAsString(\"jump\")" + "jump" ] } ] @@ -33228,27 +34732,27 @@ { "description": "Up key", "name": "up", - "type": "key" + "type": "keyboardKey" }, { "description": "Left key", "name": "left", - "type": "key" + "type": "keyboardKey" }, { "description": "Down key", "name": "down", - "type": "key" + "type": "keyboardKey" }, { "description": "Right key", "name": "right", - "type": "key" + "type": "keyboardKey" }, { "description": "Jump key", "name": "jump", - "type": "key" + "type": "keyboardKey" } ], "objectGroups": [] @@ -33280,7 +34784,7 @@ "value": "StrEqual" }, "parameters": [ - "GetArgumentAsString(\"options\")", + "options", "=", "\"WASD\"" ] @@ -33289,55 +34793,50 @@ "actions": [ { "type": { - "value": "BehaviorRemapper::RemapForPlatformer::SetPropertyUp" + "value": "SetStringVariable" }, "parameters": [ - "Object", - "Behavior", + "Up", "=", "\"w\"" ] }, { "type": { - "value": "BehaviorRemapper::RemapForPlatformer::SetPropertyLeft" + "value": "SetStringVariable" }, "parameters": [ - "Object", - "Behavior", + "Left", "=", "\"a\"" ] }, { "type": { - "value": "BehaviorRemapper::RemapForPlatformer::SetPropertyDown" + "value": "SetStringVariable" }, "parameters": [ - "Object", - "Behavior", + "Down", "=", "\"s\"" ] }, { "type": { - "value": "BehaviorRemapper::RemapForPlatformer::SetPropertyRight" + "value": "SetStringVariable" }, "parameters": [ - "Object", - "Behavior", + "Right", "=", "\"d\"" ] }, { "type": { - "value": "BehaviorRemapper::RemapForPlatformer::SetPropertyJump" + "value": "SetStringVariable" }, "parameters": [ - "Object", - "Behavior", + "Jump", "=", "\"Space\"" ] @@ -33364,7 +34863,7 @@ "value": "StrEqual" }, "parameters": [ - "GetArgumentAsString(\"options\")", + "options", "=", "\"ZQSD\"" ] @@ -33373,55 +34872,50 @@ "actions": [ { "type": { - "value": "BehaviorRemapper::RemapForPlatformer::SetPropertyUp" + "value": "SetStringVariable" }, "parameters": [ - "Object", - "Behavior", + "Up", "=", "\"z\"" ] }, { "type": { - "value": "BehaviorRemapper::RemapForPlatformer::SetPropertyLeft" + "value": "SetStringVariable" }, "parameters": [ - "Object", - "Behavior", + "Left", "=", "\"q\"" ] }, { "type": { - "value": "BehaviorRemapper::RemapForPlatformer::SetPropertyDown" + "value": "SetStringVariable" }, "parameters": [ - "Object", - "Behavior", + "Down", "=", "\"s\"" ] }, { "type": { - "value": "BehaviorRemapper::RemapForPlatformer::SetPropertyRight" + "value": "SetStringVariable" }, "parameters": [ - "Object", - "Behavior", + "Right", "=", "\"d\"" ] }, { "type": { - "value": "BehaviorRemapper::RemapForPlatformer::SetPropertyJump" + "value": "SetStringVariable" }, "parameters": [ - "Object", - "Behavior", + "Jump", "=", "\"Space\"" ] @@ -33448,7 +34942,7 @@ "value": "StrEqual" }, "parameters": [ - "GetArgumentAsString(\"options\")", + "options", "=", "\"Numpad\"" ] @@ -33457,55 +34951,50 @@ "actions": [ { "type": { - "value": "BehaviorRemapper::RemapForPlatformer::SetPropertyUp" + "value": "SetStringVariable" }, "parameters": [ - "Object", - "Behavior", + "Up", "=", "\"NumpadUp\"" ] }, { "type": { - "value": "BehaviorRemapper::RemapForPlatformer::SetPropertyLeft" + "value": "SetStringVariable" }, "parameters": [ - "Object", - "Behavior", + "Left", "=", "\"NumpadLeft\"" ] }, { "type": { - "value": "BehaviorRemapper::RemapForPlatformer::SetPropertyDown" + "value": "SetStringVariable" }, "parameters": [ - "Object", - "Behavior", + "Down", "=", "\"NumpadDown\"" ] }, { "type": { - "value": "BehaviorRemapper::RemapForPlatformer::SetPropertyRight" + "value": "SetStringVariable" }, "parameters": [ - "Object", - "Behavior", + "Right", "=", "\"NumpadRight\"" ] }, { "type": { - "value": "BehaviorRemapper::RemapForPlatformer::SetPropertyJump" + "value": "SetStringVariable" }, "parameters": [ - "Object", - "Behavior", + "Jump", "=", "\"NumpadReturn\"" ] @@ -33532,7 +35021,7 @@ "value": "StrEqual" }, "parameters": [ - "GetArgumentAsString(\"options\")", + "options", "=", "\"IJKL\"" ] @@ -33541,55 +35030,50 @@ "actions": [ { "type": { - "value": "BehaviorRemapper::RemapForPlatformer::SetPropertyUp" + "value": "SetStringVariable" }, "parameters": [ - "Object", - "Behavior", + "Up", "=", "\"i\"" ] }, { "type": { - "value": "BehaviorRemapper::RemapForPlatformer::SetPropertyLeft" + "value": "SetStringVariable" }, "parameters": [ - "Object", - "Behavior", + "Left", "=", "\"j\"" ] }, { "type": { - "value": "BehaviorRemapper::RemapForPlatformer::SetPropertyDown" + "value": "SetStringVariable" }, "parameters": [ - "Object", - "Behavior", + "Down", "=", "\"k\"" ] }, { "type": { - "value": "BehaviorRemapper::RemapForPlatformer::SetPropertyRight" + "value": "SetStringVariable" }, "parameters": [ - "Object", - "Behavior", + "Right", "=", "\"l\"" ] }, { "type": { - "value": "BehaviorRemapper::RemapForPlatformer::SetPropertyJump" + "value": "SetStringVariable" }, "parameters": [ - "Object", - "Behavior", + "Jump", "=", "\"Return\"" ] @@ -33622,58 +35106,42 @@ "propertyDescriptors": [ { "value": "", - "type": "String", + "type": "KeyboardKey", "label": "Up key", - "description": "", - "group": "", - "extraInformation": [], "name": "Up" }, { "value": "", - "type": "String", + "type": "KeyboardKey", "label": "Left key", - "description": "", - "group": "", - "extraInformation": [], "name": "Left" }, { "value": "", - "type": "String", + "type": "KeyboardKey", "label": "Down key", - "description": "", - "group": "", - "extraInformation": [], "name": "Down" }, { "value": "", - "type": "String", + "type": "KeyboardKey", "label": "Right key", - "description": "", - "group": "", - "extraInformation": [], "name": "Right" }, { "value": "", - "type": "String", + "type": "KeyboardKey", "label": "Jump key", - "description": "", - "group": "", - "extraInformation": [], "name": "Jump" }, { "value": "", "type": "Behavior", "label": "", - "description": "", - "group": "", "extraInformation": [ "PlatformBehavior::PlatformerObjectBehavior" ], + "choices": [], "name": "Platformer" } ], @@ -33687,6 +35155,7 @@ "category": "Movement", "extensionNamespace": "", "fullName": "Top-down corner sliding", + "gdevelopVersion": "", "helpPath": "", "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0ibWRpLXN1YmRpcmVjdG9yeS1hcnJvdy1yaWdodCIgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0IiB2aWV3Qm94PSIwIDAgMjQgMjQiPjxwYXRoIGQ9Ik0xOSwxNUwxMywyMUwxMS41OCwxOS41OEwxNS4xNywxNkg0VjRINlYxNEgxNS4xN0wxMS41OCwxMC40MkwxMyw5TDE5LDE1WiIgLz48L3N2Zz4=", "name": "TopDownCornerSliding", @@ -34964,111 +36433,1202 @@ ], "parameters": [], "objectGroups": [] - } - ], - "eventsBasedBehaviors": [ + } + ], + "eventsBasedBehaviors": [ + { + "description": "Slide on corners of rectangular obstacles.", + "fullName": "Top-down corner slider", + "name": "TopDownCornerSlider", + "objectType": "", + "eventsFunctions": [ + { + "fullName": "", + "functionType": "Action", + "name": "onCreated", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "TopDownCornerSliding::DefineJavaScriptForTopDown" + }, + "parameters": [ + "", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "\r", + "const object = objects[0];\r", + "const behaviorName = eventsFunctionContext.getBehaviorName(\"Behavior\");\r", + "const behavior = object.getBehavior(behaviorName);\r", + "\r", + "/** @type {gdjs.TopDownMovementRuntimeBehavior} */\r", + "const topDownBehavior = object.getBehavior(behavior._getTopDownMovement());\r", + "\r", + "behavior.__topDownCornerSlidingExtension = {\r", + " cornerSlider: new gdjs.__topDownCornerSlidingExtension.CornerSlider(runtimeScene, behavior, topDownBehavior)\r", + "};\r", + "" + ], + "parameterObjects": "Object", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "TopDownCornerSliding::TopDownCornerSlider", + "type": "behavior" + } + ], + "objectGroups": [] + } + ], + "propertyDescriptors": [ + { + "value": "", + "type": "Behavior", + "label": "Top-down movement behavior", + "extraInformation": [ + "TopDownMovementBehavior::TopDownMovementBehavior" + ], + "choices": [], + "name": "TopDownMovement" + } + ], + "sharedPropertyDescriptors": [] + }, + { + "description": "Flag objects as obstacles for top-down characters.", + "fullName": "Top-down corner slider obstacle", + "name": "TopDownCornerSliderObstacle", + "objectType": "", + "eventsFunctions": [ + { + "fullName": "", + "functionType": "Action", + "name": "onCreated", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Initiate and attach properties as objects variables" + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "TopDownCornerSliding::DefineJavaScriptForTopDown" + }, + "parameters": [ + "", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const object = objects[0];\r", + "const behaviorName = eventsFunctionContext.getBehaviorName(\"Behavior\");\r", + "const behavior = object.getBehavior(behaviorName);\r", + "\r", + "const obstacle = new gdjs.__topDownCornerSlidingExtension.Obstacle(runtimeScene, behavior)\r", + "behavior.__topDownCornerSlidingExtension = { obstacle };\r", + "obstacle.onCreated(runtimeScene, behavior);\r", + "" + ], + "parameterObjects": "Object", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "TopDownCornerSliding::TopDownCornerSliderObstacle", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "Action", + "name": "doStepPreEvents", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const object = objects[0];\r", + "const behaviorName = eventsFunctionContext.getBehaviorName(\"Behavior\");\r", + "const behavior = object.getBehavior(behaviorName);\r", + "\r", + "behavior.__topDownCornerSlidingExtension.obstacle.doStepPreEvents(runtimeScene);\r", + "" + ], + "parameterObjects": "Object", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "TopDownCornerSliding::TopDownCornerSliderObstacle", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "Action", + "name": "onActivate", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const object = objects[0];", + "const behaviorName = eventsFunctionContext.getBehaviorName(\"Behavior\");", + "const behavior = object.getBehavior(behaviorName);", + "", + "behavior.__topDownCornerSlidingExtension.obstacle.onActivate(runtimeScene);", + "" + ], + "parameterObjects": "Object", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "TopDownCornerSliding::TopDownCornerSliderObstacle", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "Action", + "name": "onDeActivate", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const object = objects[0];", + "const behaviorName = eventsFunctionContext.getBehaviorName(\"Behavior\");", + "const behavior = object.getBehavior(behaviorName);", + "", + "behavior.__topDownCornerSlidingExtension.obstacle.onDeActivate(runtimeScene);", + "" + ], + "parameterObjects": "Object", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "TopDownCornerSliding::TopDownCornerSliderObstacle", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "Action", + "name": "onDestroy", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const object = objects[0];", + "const behaviorName = eventsFunctionContext.getBehaviorName(\"Behavior\");", + "const behavior = object.getBehavior(behaviorName);", + "", + "behavior.__topDownCornerSlidingExtension.obstacle.onDestroy(runtimeScene);", + "" + ], + "parameterObjects": "Object", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "TopDownCornerSliding::TopDownCornerSliderObstacle", + "type": "behavior" + } + ], + "objectGroups": [] + } + ], + "propertyDescriptors": [ + { + "value": "0", + "type": "Number", + "unit": "Pixel", + "label": "Sliding corner size", + "name": "SlidingCornerSize" + } + ], + "sharedPropertyDescriptors": [] + } + ], + "eventsBasedObjects": [] + }, + { + "author": "Bouh", + "category": "Input", + "extensionNamespace": "", + "fullName": "Gamepads (controllers)", + "gdevelopVersion": ">=5.5.222", + "helpPath": "/all-features/gamepad", + "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0ibWRpLWdhbWVwYWQtdmFyaWFudC1vdXRsaW5lIiB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCI+PHBhdGggZD0iTTYsOUg4VjExSDEwVjEzSDhWMTVINlYxM0g0VjExSDZWOU0xOC41LDlBMS41LDEuNSAwIDAsMSAyMCwxMC41QTEuNSwxLjUgMCAwLDEgMTguNSwxMkExLjUsMS41IDAgMCwxIDE3LDEwLjVBMS41LDEuNSAwIDAsMSAxOC41LDlNMTUuNSwxMkExLjUsMS41IDAgMCwxIDE3LDEzLjVBMS41LDEuNSAwIDAsMSAxNS41LDE1QTEuNSwxLjUgMCAwLDEgMTQsMTMuNUExLjUsMS41IDAgMCwxIDE1LjUsMTJNMTcsNUE3LDcgMCAwLDEgMjQsMTJBNyw3IDAgMCwxIDE3LDE5QzE1LjA0LDE5IDEzLjI3LDE4LjIgMTIsMTYuOUMxMC43MywxOC4yIDguOTYsMTkgNywxOUE3LDcgMCAwLDEgMCwxMkE3LDcgMCAwLDEgNyw1SDE3TTcsN0E1LDUgMCAwLDAgMiwxMkE1LDUgMCAwLDAgNywxN0M4LjY0LDE3IDEwLjA5LDE2LjIxIDExLDE1SDEzQzEzLjkxLDE2LjIxIDE1LjM2LDE3IDE3LDE3QTUsNSAwIDAsMCAyMiwxMkE1LDUgMCAwLDAgMTcsN0g3WiIgLz48L3N2Zz4=", + "name": "Gamepads", + "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/gamepad-variant-outline.svg", + "shortDescription": "Add support for gamepads (or other controllers) to your game, giving access to information such as button presses, axis positions, trigger pressure, etc...", + "version": "0.9.0", + "description": [ + "Add support for gamepads (or other physical controllers).", + "", + "It gives access to:", + "- button presses,", + "- axis positions and force,", + "- trigger pressure,", + "- configurable deadzone,", + "- vibration,", + "- automatic \"gamepad mapper\" behaviors for 2D and 3D movement behaviors (platformer characters, top-down movement, 3D character etc...). Add one of these to the object with the movement behavior (i.e: the player most of the time) and the behavior will then be controlled automatically by the gamepad (it works by reading the gamepad state and simulating controls). No need for additional events to make it work once the behaviors are set up.", + "", + "The Bomberman-like example handles 4 players with gamepads ([open the project online](https://editor.gdevelop.io/?project=example://goose-bomberman))." + ], + "origin": { + "identifier": "Gamepads", + "name": "gdevelop-extension-store" + }, + "tags": [ + "controllers", + "gamepads", + "joysticks", + "axis", + "xbox", + "ps4", + "platformer", + "platform", + "top-down" + ], + "authorIds": [ + "2OwwM8ToR9dx9RJ2sAKTcrLmCB92", + "taRwmWxwAFYFL9yyBwB3cwBw0BO2", + "mnImQKdn8nQxwzkS5D6a1JB27V23", + "IWykYNRvhCZBN3vEgKEbBPOR3Oc2" + ], + "dependencies": [], + "globalVariables": [], + "sceneVariables": [ + { + "name": "Buttons", + "type": "structure", + "children": [ + { + "name": "A or Cross", + "type": "string", + "value": "A" + }, + { + "name": "B or Circle", + "type": "string", + "value": "B" + }, + { + "name": "LB or L1", + "type": "string", + "value": "LB" + }, + { + "name": "LT or L2", + "type": "string", + "value": "LT" + }, + { + "name": "RB or R1", + "type": "string", + "value": "RB" + }, + { + "name": "RT or R2", + "type": "string", + "value": "RT" + }, + { + "name": "X or Square", + "type": "string", + "value": "X" + }, + { + "name": "Y or Triangle", + "type": "string", + "value": "Y" + } + ] + } + ], + "eventsFunctions": [ + { + "fullName": "", + "functionType": "Action", + "name": "onFirstSceneLoaded", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "if (gdjs._extensionController) {\r", + " return;\r", + "}\r", + "\r", + "/**\r", + " * Associate controller button ids to button names\r", + " */\r", + "const controllerButtonNames = {\r", + " \"XBOX\": {\r", + " 0: \"A\",\r", + " 1: \"B\",\r", + " 2: \"X\",\r", + " 3: \"Y\",\r", + " 4: \"LB\",\r", + " 5: \"RB\",\r", + " 6: \"LT\",\r", + " 7: \"RT\",\r", + " 8: \"BACK\",\r", + " 9: \"START\",\r", + " 10: \"CLICK_STICK_LEFT\",\r", + " 11: \"CLICK_STICK_RIGHT\",\r", + " 12: \"UP\",\r", + " 13: \"DOWN\",\r", + " 14: \"LEFT\",\r", + " 15: \"RIGHT\",\r", + " 16: \"NONE\",\r", + " 17: \"NONE\"\r", + " },\r", + " \"PS4\": {\r", + " 0: \"CROSS\",\r", + " 1: \"CIRCLE\",\r", + " 2: \"SQUARE\",\r", + " 3: \"TRIANGLE\",\r", + " 4: \"L1\",\r", + " 5: \"R1\",\r", + " 6: \"L2\",\r", + " 7: \"R2\",\r", + " 8: \"SHARE\",\r", + " 9: \"OPTIONS\",\r", + " 10: \"CLICK_STICK_LEFT\",\r", + " 11: \"CLICK_STICK_RIGHT\",\r", + " 12: \"UP\",\r", + " 13: \"DOWN\",\r", + " 14: \"LEFT\",\r", + " 15: \"RIGHT\",\r", + " 16: \"PS_BUTTON\",\r", + " 17: \"CLICK_TOUCHPAD\"\r", + " }\r", + "};\r", + "\r", + "/**\r", + " * @param {number} playerId\r", + " */\r", + "function getGamepad(playerId) {\r", + " /** @type {Gamepad[]} */\r", + " const gamepads = navigator.getGamepads ? navigator.getGamepads() : [];\r", + " return gamepads[playerId];\r", + "}\r", + "\r", + "/** @type {{[playerId: number]: Player}} */\r", + "const players = {};\r", + "\r", + "/**\r", + " * @param {number} playerId\r", + " */\r", + "function getPlayer(playerId) {\r", + " let player = players[playerId];\r", + " if (!player) {\r", + " player = new Player(playerId);\r", + " players[playerId] = player;\r", + " }\r", + " return player;\r", + "}\r", + "\r", + "class Player {\r", + " /** @type {number} */\r", + " playerId;\r", + " mapping = 'DEFAULT';\r", + " lastButtonUsed = -1;\r", + " deadzone = 0.2;\r", + " /** @type {{[buttonId: number]: ButtonState}} */\r", + " buttonStates = {};\r", + " rumble = { elapsedTime: 0, duration: 0, weakMagnitude: 0, strongMagnitude: 0 };\r", + "\r", + " /**\r", + " * @param {number} playerId\r", + " */\r", + " constructor(playerId) {\r", + " this.playerId = playerId;\r", + " }\r", + "\r", + " /**\r", + " * @param {number} buttonId\r", + " */\r", + " getButtonState(buttonId) {\r", + " let buttonState = this.buttonStates[buttonId];\r", + " if (!buttonState) {\r", + " buttonState = new ButtonState();\r", + " this.buttonStates[buttonId] = buttonState;\r", + " }\r", + " return buttonState;\r", + " }\r", + "\r", + " /**\r", + " * @param {number} buttonId\r", + " */\r", + " isButtonPressed(buttonId) {\r", + " return this.getButtonState(buttonId).isPressed;\r", + " }\r", + "\r", + " /**\r", + " * @param {number} buttonId\r", + " */\r", + " isButtonJustPressed(buttonId) {\r", + " return this.getButtonState(buttonId).isJustPressed();\r", + " }\r", + "\r", + " /**\r", + " * @param {number} buttonId\r", + " */\r", + " isButtonReleased(buttonId) {\r", + " return this.getButtonState(buttonId).isReleased();\r", + " }\r", + "\r", + " isAnyButtonReleased() {\r", + " for (const buttonId in this.buttonStates) {\r", + " const buttonState = this.buttonStates[buttonId];\r", + " if (buttonState.isReleased()) {\r", + " return true;\r", + " }\r", + " }\r", + " return false;\r", + " }\r", + "\r", + " isAnyButtonPressed() {\r", + " for (const buttonId in this.buttonStates) {\r", + " const buttonState = this.buttonStates[buttonId];\r", + " if (buttonState.isPressed) {\r", + " return true;\r", + " }\r", + " }\r", + " return false;\r", + " }\r", + "}\r", + "\r", + "class ButtonState {\r", + " wasPressed = false;\r", + " isPressed = false;\r", + "\r", + " isReleased() {\r", + " return this.wasPressed && !this.isPressed;\r", + " }\r", + "\r", + " isJustPressed() {\r", + " return !this.wasPressed && this.isPressed;\r", + " }\r", + "}\r", + "\r", + "// Async tasks are run before everything.\r", + "// This is a hack to make sure that button states are updated\r", + "// before mapping behavior events.\r", + "const frameBeginningTask = new class extends gdjs.AsyncTask {\r", + " update() {\r", + " /** @type {Gamepad[]} */\r", + " const gamepads = navigator.getGamepads ? navigator.getGamepads() : [];\r", + " for (let playerId = 0; playerId < gamepads.length; playerId++) {\r", + " const gamepad = gamepads[playerId];\r", + " if (gamepad == null) {\r", + " // The gamepad is not connected.\r", + " continue;\r", + " }\r", + " const player = getPlayer(playerId);\r", + "\r", + " for (let buttonId = 0; buttonId < Object.keys(gamepad.buttons).length; buttonId++) {\r", + " const buttonState = player.getButtonState(buttonId);\r", + " buttonState.wasPressed = buttonState.isPressed;\r", + " buttonState.isPressed = gamepad.buttons[buttonId].pressed;\r", + " if (buttonState.isJustPressed()) {\r", + " player.lastButtonUsed = buttonId;\r", + " }\r", + " }\r", + " }\r", + " return false;\r", + " }\r", + "}();\r", + "\r", + "function onScenePostEvents() {\r", + " /** @type {Gamepad[]} */\r", + " const gamepads = navigator.getGamepads ? navigator.getGamepads() : [];\r", + " for (let playerId = 0; playerId < gamepads.length; playerId++) {\r", + " let gamepad = gamepads[playerId];\r", + " if (gamepad == null) {\r", + " // The gamepad is not connected.\r", + " continue;\r", + " }\r", + " const player = getPlayer(playerId);\r", + " const rumble = player.rumble;\r", + " rumble.elapsedTime += runtimeScene.getElapsedTime(runtimeScene) / 1000;\r", + " if (rumble.duration - rumble.elapsedTime <= 0 &&\r", + " (rumble.weakMagnitude || rumble.strongMagnitude)\r", + " ) {\r", + " rumble.weakMagnitude = 0;\r", + " rumble.strongMagnitude = 0;\r", + " }\r", + " }\r", + "}\r", + "\r", + "/**\r", + " * @param {string} type\r", + " * @param {number} buttonId\r", + " */\r", + "function getInputString(type, buttonId) {\r", + " if (!controllerButtonNames[type]) {\r", + " return \"UNKNOWN_BUTTON\";\r", + " }\r", + " return controllerButtonNames[type][buttonId];\r", + "}\r", + "\r", + "function getButtonId(buttonName) {\r", + " switch (buttonName) {\r", + " case 'A':\r", + " case 'CROSS':\r", + " return 0;\r", + " case 'B':\r", + " case 'CIRCLE':\r", + " return 1;\r", + " case 'X':\r", + " case 'SQUARE':\r", + " return 2;\r", + " case 'Y':\r", + " case 'TRIANGLE':\r", + " return 3;\r", + " case 'LB':\r", + " case 'L1':\r", + " return 4;\r", + " case 'RB':\r", + " case 'R1':\r", + " return 5;\r", + " case 'LT':\r", + " case 'L2':\r", + " return 6;\r", + " case 'RT':\r", + " case 'R2':\r", + " return 7;\r", + " case 'UP':\r", + " return 12;\r", + " case 'DOWN':\r", + " return 13;\r", + " case 'LEFT':\r", + " return 14;\r", + " case 'RIGHT':\r", + " return 15;\r", + " case 'BACK':\r", + " case 'SHARE':\r", + " return 8;\r", + " case 'START':\r", + " case 'OPTIONS':\r", + " return 9;\r", + " case 'CLICK_STICK_LEFT':\r", + " return 10;\r", + " case 'CLICK_STICK_RIGHT':\r", + " return 11;\r", + " //PS4\r", + " case 'PS_BUTTON':\r", + " return 16;\r", + " case 'CLICK_TOUCHPAD':\r", + " return 17;\r", + " default:\r", + " console.error('The gamepad button: ' + buttonName + ' is not valid.');\r", + " return null;\r", + " }\r", + "}\r", + "\r", + "/**\r", + " * @param {number} playerId\r", + " * @param {string} directionName\r", + " * @param {number} axisValueX\r", + " * @param {number} axisValueY\r", + " */\r", + "function isAxisPushed(playerId, directionName, axisValueX, axisValueY) {\r", + " switch (directionName) {\r", + " case 'LEFT':\r", + " return getNormalizedAxisValue(axisValueX, playerId) < 0;\r", + " case 'RIGHT':\r", + " return getNormalizedAxisValue(axisValueX, playerId) > 0;\r", + " case 'UP':\r", + " return getNormalizedAxisValue(axisValueY, playerId) < 0;\r", + " case 'DOWN':\r", + " return getNormalizedAxisValue(axisValueY, playerId) > 0;\r", + " case 'ANY':\r", + " return getNormalizedAxisValue(axisValueX, playerId) < 0\r", + " || getNormalizedAxisValue(axisValueX, playerId) > 0\r", + " || getNormalizedAxisValue(axisValueY, playerId) < 0\r", + " || getNormalizedAxisValue(axisValueY, playerId) > 0\r", + " default:\r", + " console.error('The value stick direction is not valid.');\r", + " return false;\r", + " }\r", + "}\r", + "\r", + "/**\r", + " * @param {number} deltaX\r", + " * @param {number} deltaY\r", + " */\r", + "function axisToAngle(deltaX, deltaY) {\r", + " const rad = Math.atan2(deltaY, deltaX);\r", + " const deg = rad * (180 / Math.PI);\r", + " return deg;\r", + "}\r", + "\r", + "/**\r", + " * @param {{id: string}} gamepad\r", + " */\r", + "function isXbox(gamepad) {\r", + " return (gamepad ? (\r", + " gamepad.id.toUpperCase().indexOf(\"XBOX\") !== -1\r", + " // \"XINPUT\" cannot be used to check if it is a xbox controller is just a generic\r", + " // name reported in Firefox corresponding to the driver being used by the controller\r", + " // https://gamefaqs.gamespot.com/boards/916373-pc/73341312?page=1\r", + " ) : false);\r", + "}\r", + "\r", + "/**\r", + " * Returns the new value taking into account the dead zone for the player_ID given\r", + " * @param {number} value\r", + " * @param {number} playerID\r", + " */\r", + "function getNormalizedAxisValue(value, playerID) {\r", + " // gdjs._extensionController = gdjs._extensionController || { deadzone: 0.2 };\r", + "\r", + " // Anything smaller than this is assumed to be 0,0\r", + " const deadzone = getPlayer(playerID).deadzone;\r", + "\r", + " if (Math.abs(value) < deadzone) {\r", + " return 0;\r", + " } else {\r", + " // We're outside the dead zone, but we'd like to smooth\r", + " // this value out so it still runs nicely between 0..1.\r", + " // That is, we don't want it to jump suddenly from 0 to\r", + " // deadzone.\r", + "\r", + " // Remap value from\r", + " // deadzone..1 to 0..(1-deadzone)\r", + " // or from\r", + " // -1..-deadzone to -(1-deadzone)..0\r", + " value = value - Math.sign(value) * deadzone;\r", + "\r", + " // Remap value from\r", + " // 0..(1-deadzone) to 0..1\r", + " // or from\r", + " // -(1-deadzone)..0 to -1..0\r", + " return value / (1 - deadzone);\r", + " }\r", + "}\r", + "\r", + "gdjs._extensionController = {\r", + " getPlayer,\r", + " controllerButtonNames,\r", + " getInputString,\r", + " getButtonId,\r", + " axisToAngle,\r", + " isXbox,\r", + " getNormalizedAxisValue,\r", + " isAxisPushed,\r", + " getGamepad,\r", + " onScenePostEvents,\r", + " frameBeginningTask,\r", + "}" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "parameters": [], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "Action", + "name": "onSceneLoaded", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "// Async tasks are run before everything.\r", + "// This is a hack to make sure that button states are updated\r", + "// before mapping behavior events.\r", + "runtimeScene.getAsyncTasksManager().addTask(gdjs._extensionController.frameBeginningTask);" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "Action", + "name": "onScenePostEvents", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "gdjs._extensionController.onScenePostEvents();", + "" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "parameters": [], + "objectGroups": [] + }, { - "description": "Slide on corners of rectangular obstacles.", - "fullName": "Top-down corner slider", - "name": "TopDownCornerSlider", - "objectType": "", - "eventsFunctions": [ + "fullName": "Accelerated speed", + "functionType": "Expression", + "name": "AcceleratedSpeed", + "private": true, + "sentence": "", + "events": [ { - "fullName": "", - "functionType": "Action", - "name": "onCreated", - "sentence": "", + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "AcceleratedSpeed", + "=", + "CurrentSpeed" + ] + } + ], "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TargetedSpeed", + "<", + "0" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Reduce the speed to match the stick force." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "CurrentSpeed", + "<", + "TargetedSpeed" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "AcceleratedSpeed", + "=", + "min(TargetedSpeed, CurrentSpeed + Acceleration * TimeDelta())" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "CurrentSpeed", + ">", + "TargetedSpeed" + ] + }, + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "CurrentSpeed", + "<", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "AcceleratedSpeed", + "-", + "Acceleration * TimeDelta()" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Turn back at least as fast as it would stop." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "CurrentSpeed", + ">=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "AcceleratedSpeed", + "=", + "max(TargetedSpeed, CurrentSpeed - max(Acceleration , Deceleration) * TimeDelta())" + ] + } + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TargetedSpeed", + ">", + "0" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Reduce the speed to match the stick force." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "CurrentSpeed", + ">", + "TargetedSpeed" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "AcceleratedSpeed", + "=", + "max(TargetedSpeed, CurrentSpeed - Acceleration * TimeDelta())" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "CurrentSpeed", + "<", + "TargetedSpeed" + ] + }, + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "CurrentSpeed", + ">", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "AcceleratedSpeed", + "+", + "Acceleration * TimeDelta()" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Turn back at least as fast as it would stop." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "CurrentSpeed", + "<=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "AcceleratedSpeed", + "=", + "min(TargetedSpeed, CurrentSpeed + max(Acceleration , Deceleration) * TimeDelta())" + ] + } + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { "type": { - "value": "TopDownCornerSliding::DefineJavaScriptForTopDown" + "value": "NumberVariable" }, "parameters": [ - "", - "" + "TargetedSpeed", + "=", + "0" ] } - ] - }, - { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "\r", - "const object = objects[0];\r", - "const behaviorName = eventsFunctionContext.getBehaviorName(\"Behavior\");\r", - "const behavior = object.getBehavior(behaviorName);\r", - "\r", - "/** @type {gdjs.TopDownMovementRuntimeBehavior} */\r", - "const topDownBehavior = object.getBehavior(behavior._getTopDownMovement());\r", - "\r", - "behavior.__topDownCornerSlidingExtension = {\r", - " cornerSlider: new gdjs.__topDownCornerSlidingExtension.CornerSlider(runtimeScene, behavior, topDownBehavior)\r", - "};\r", - "" ], - "parameterObjects": "Object", - "useStrict": true, - "eventsSheetExpanded": true - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "TopDownCornerSliding::TopDownCornerSlider", - "type": "behavior" - } - ], - "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "", - "type": "Behavior", - "label": "Top-down movement behavior", - "description": "", - "group": "", - "extraInformation": [ - "TopDownMovementBehavior::TopDownMovementBehavior" - ], - "name": "TopDownMovement" - } - ], - "sharedPropertyDescriptors": [] - }, - { - "description": "Flag objects as obstacles for top-down characters.", - "fullName": "Top-down corner slider obstacle", - "name": "TopDownCornerSliderObstacle", - "objectType": "", - "eventsFunctions": [ - { - "fullName": "", - "functionType": "Action", - "name": "onCreated", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 - }, - "comment": "Initiate and attach properties as objects variables" + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "CurrentSpeed", + "<", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "AcceleratedSpeed", + "=", + "min(0, CurrentSpeed + Acceleration * TimeDelta())" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "CurrentSpeed", + ">", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "AcceleratedSpeed", + "=", + "max(0, CurrentSpeed - Acceleration * TimeDelta())" + ] + } + ] + } + ] }, { "type": "BuiltinCommonInstructions::Standard", @@ -35076,257 +37636,56 @@ "actions": [ { "type": { - "value": "TopDownCornerSliding::DefineJavaScriptForTopDown" + "value": "SetReturnNumber" }, "parameters": [ - "", - "" + "clamp(AcceleratedSpeed, -SpeedMax, SpeedMax)" ] } ] - }, - { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "const object = objects[0];\r", - "const behaviorName = eventsFunctionContext.getBehaviorName(\"Behavior\");\r", - "const behavior = object.getBehavior(behaviorName);\r", - "\r", - "const obstacle = new gdjs.__topDownCornerSlidingExtension.Obstacle(runtimeScene, behavior)\r", - "behavior.__topDownCornerSlidingExtension = { obstacle };\r", - "obstacle.onCreated(runtimeScene, behavior);\r", - "" - ], - "parameterObjects": "Object", - "useStrict": true, - "eventsSheetExpanded": true } ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, + "variables": [ { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "TopDownCornerSliding::TopDownCornerSliderObstacle", - "type": "behavior" + "name": "AcceleratedSpeed", + "type": "number", + "value": 0 } - ], - "objectGroups": [] - }, + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ { - "fullName": "", - "functionType": "Action", - "name": "doStepPreEvents", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "const object = objects[0];\r", - "const behaviorName = eventsFunctionContext.getBehaviorName(\"Behavior\");\r", - "const behavior = object.getBehavior(behaviorName);\r", - "\r", - "behavior.__topDownCornerSlidingExtension.obstacle.doStepPreEvents(runtimeScene);\r", - "" - ], - "parameterObjects": "Object", - "useStrict": true, - "eventsSheetExpanded": true - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "TopDownCornerSliding::TopDownCornerSliderObstacle", - "type": "behavior" - } - ], - "objectGroups": [] + "description": "Current speed", + "name": "CurrentSpeed", + "type": "expression" }, { - "fullName": "", - "functionType": "Action", - "name": "onActivate", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "const object = objects[0];", - "const behaviorName = eventsFunctionContext.getBehaviorName(\"Behavior\");", - "const behavior = object.getBehavior(behaviorName);", - "", - "behavior.__topDownCornerSlidingExtension.obstacle.onActivate(runtimeScene);", - "" - ], - "parameterObjects": "Object", - "useStrict": true, - "eventsSheetExpanded": false - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "TopDownCornerSliding::TopDownCornerSliderObstacle", - "type": "behavior" - } - ], - "objectGroups": [] + "description": "Targeted speed", + "name": "TargetedSpeed", + "type": "expression" }, { - "fullName": "", - "functionType": "Action", - "name": "onDeActivate", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "const object = objects[0];", - "const behaviorName = eventsFunctionContext.getBehaviorName(\"Behavior\");", - "const behavior = object.getBehavior(behaviorName);", - "", - "behavior.__topDownCornerSlidingExtension.obstacle.onDeActivate(runtimeScene);", - "" - ], - "parameterObjects": "Object", - "useStrict": true, - "eventsSheetExpanded": false - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "TopDownCornerSliding::TopDownCornerSliderObstacle", - "type": "behavior" - } - ], - "objectGroups": [] + "description": "Max speed", + "name": "SpeedMax", + "type": "expression" }, { - "fullName": "", - "functionType": "Action", - "name": "onDestroy", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "const object = objects[0];", - "const behaviorName = eventsFunctionContext.getBehaviorName(\"Behavior\");", - "const behavior = object.getBehavior(behaviorName);", - "", - "behavior.__topDownCornerSlidingExtension.obstacle.onDestroy(runtimeScene);", - "" - ], - "parameterObjects": "Object", - "useStrict": true, - "eventsSheetExpanded": false - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "TopDownCornerSliding::TopDownCornerSliderObstacle", - "type": "behavior" - } - ], - "objectGroups": [] - } - ], - "propertyDescriptors": [ + "description": "Acceleration", + "name": "Acceleration", + "type": "expression" + }, { - "value": "0", - "type": "Number", - "unit": "Pixel", - "label": "Sliding corner size", - "description": "", - "group": "", - "extraInformation": [], - "name": "SlidingCornerSize" + "description": "Deceleration", + "name": "Deceleration", + "type": "expression" } ], - "sharedPropertyDescriptors": [] - } - ], - "eventsBasedObjects": [] - }, - { - "author": "Bouh", - "category": "Input", - "extensionNamespace": "", - "fullName": "Gamepads (controllers)", - "helpPath": "/all-features/gamepad", - "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0ibWRpLWdhbWVwYWQtdmFyaWFudC1vdXRsaW5lIiB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCI+PHBhdGggZD0iTTYsOUg4VjExSDEwVjEzSDhWMTVINlYxM0g0VjExSDZWOU0xOC41LDlBMS41LDEuNSAwIDAsMSAyMCwxMC41QTEuNSwxLjUgMCAwLDEgMTguNSwxMkExLjUsMS41IDAgMCwxIDE3LDEwLjVBMS41LDEuNSAwIDAsMSAxOC41LDlNMTUuNSwxMkExLjUsMS41IDAgMCwxIDE3LDEzLjVBMS41LDEuNSAwIDAsMSAxNS41LDE1QTEuNSwxLjUgMCAwLDEgMTQsMTMuNUExLjUsMS41IDAgMCwxIDE1LjUsMTJNMTcsNUE3LDcgMCAwLDEgMjQsMTJBNyw3IDAgMCwxIDE3LDE5QzE1LjA0LDE5IDEzLjI3LDE4LjIgMTIsMTYuOUMxMC43MywxOC4yIDguOTYsMTkgNywxOUE3LDcgMCAwLDEgMCwxMkE3LDcgMCAwLDEgNyw1SDE3TTcsN0E1LDUgMCAwLDAgMiwxMkE1LDUgMCAwLDAgNywxN0M4LjY0LDE3IDEwLjA5LDE2LjIxIDExLDE1SDEzQzEzLjkxLDE2LjIxIDE1LjM2LDE3IDE3LDE3QTUsNSAwIDAsMCAyMiwxMkE1LDUgMCAwLDAgMTcsN0g3WiIgLz48L3N2Zz4=", - "name": "Gamepads", - "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/gamepad-variant-outline.svg", - "shortDescription": "Add support for gamepads (or other controllers) to your game, giving access to information such as button presses, axis positions, trigger pressure, etc...", - "version": "0.6.1", - "description": [ - "Add support for gamepads (or other controllers).", - "", - "It gives access to:", - "- button presses", - "- axis positions and force", - "- trigger pressure", - "- configurable deadzone", - "- vibration", - "- automatic mappers for platformer characters and top-down movement", - "", - "The Bomberman-like example handles 4 players with gamepads ([open the project online](https://editor.gdevelop.io/?project=example://goose-bomberman))." - ], - "origin": { - "identifier": "Gamepads", - "name": "gdevelop-extension-store" - }, - "tags": [ - "controllers", - "gamepads", - "joysticks", - "axis", - "xbox", - "ps4", - "platformer", - "platform", - "top-down" - ], - "authorIds": [ - "2OwwM8ToR9dx9RJ2sAKTcrLmCB92", - "taRwmWxwAFYFL9yyBwB3cwBw0BO2", - "mnImQKdn8nQxwzkS5D6a1JB27V23" - ], - "dependencies": [], - "globalVariables": [], - "sceneVariables": [], - "eventsFunctions": [ + "objectGroups": [] + }, { "description": "Get the value of the pressure on a gamepad trigger.", "fullName": "Pressure on a gamepad trigger", @@ -35337,27 +37696,20 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", "\r", - "//Get function parameters\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", - "const trigger = eventsFunctionContext.getArgument(\"trigger\").toUpperCase();\r", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "const trigger = eventsFunctionContext.getArgument(\"Trigger\").toUpperCase();\r", "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier in expression: \"Pressure on a gamepad trigger\", is not valid number, must be between 0 and 4.');\r", - " return;\r", - "}\r", "if (trigger != \"LT\" && trigger != \"RT\" && trigger != \"L2\" && trigger != \"R2\") {\r", " console.error('Parameter trigger is not valid in expression: \"Pressure on a gamepad trigger\"');\r", " return;\r", "}\r", - "\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", - "if (gamepad == null) return;\r", - "\r", + "/** @type {Gamepad} */\r", + "const gamepad = gdjs._extensionController.getGamepad(playerId);\r", + "if (!gamepad) {\r", + " // The gamepad is not connected.\r", + " return;\r", + "}\r", "switch (trigger) {\r", " case 'LT':\r", " case 'L2':\r", @@ -35385,12 +37737,12 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" }, { "description": "Trigger button", - "name": "trigger", + "name": "Trigger", "supplementaryInformation": "[\"LT\",\"RT\",\"L2\",\"R2\"]", "type": "stringWithSelector" } @@ -35407,43 +37759,28 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", + "const { getNormalizedAxisValue } = gdjs._extensionController;\r", "\r", - "//Get function parameters\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", - "const stick = eventsFunctionContext.getArgument(\"stick\").toUpperCase();\r", - "\r", - "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier is not valid in expression: \"Value of a stick force\"');\r", - " return;\r", - "}\r", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "const stick = eventsFunctionContext.getArgument(\"Stick\").toUpperCase();\r", "\r", "if (stick !== \"LEFT\" && stick !== \"RIGHT\") {\r", " console.error('Parameter stick is not valid in expression: \"Value of a stick force\"');\r", " return;\r", "}\r", + "/** @type {Gamepad} */\r", + "const gamepad = gdjs._extensionController.getGamepad(playerId);\r", + "if (!gamepad) {\r", + " // The gamepad is not connected.\r", + " return;\r", + "}\r", + "const axisValueX = stick === 'RIGHT' ? gamepad.axes[2] : gamepad.axes[0];\r", + "const axisValueY = stick === 'RIGHT' ? gamepad.axes[3] : gamepad.axes[1];\r", "\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", - "if (gamepad == null) return;\r", - "\r", - "\r", - "switch (stick) {\r", - " case 'LEFT':\r", - " eventsFunctionContext.returnValue = gdjs.evtTools.common.clamp(Math.abs(gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[0], playerId)) + Math.abs(gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[1], playerId)), 0, 1);\r", - " break;\r", - "\r", - " case 'RIGHT':\r", - " eventsFunctionContext.returnValue = gdjs.evtTools.common.clamp(Math.abs(gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[2], playerId)) + Math.abs(gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[3], playerId)), 0, 1);\r", - " break;\r", - "\r", - " default:\r", - " eventsFunctionContext.returnValue = -1;\r", - " break;\r", - "}" + "eventsFunctionContext.returnValue = gdjs.evtTools.common.clamp(\r", + " Math.abs(getNormalizedAxisValue(axisValueX, playerId)) +\r", + " Math.abs(getNormalizedAxisValue(axisValueY, playerId)), 0, 1);\r", + "" ], "parameterObjects": "", "useStrict": true, @@ -35456,12 +37793,12 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" }, { "description": "Stick: \"Left\" or \"Right\"", - "name": "stick", + "name": "Stick", "supplementaryInformation": "[\"Left\",\"Right\"]", "type": "stringWithSelector" } @@ -35485,7 +37822,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "Gamepads::StickAngle(GetArgumentAsNumber(\"player_ID\"), GetArgumentAsString(\"stick\"))" + "Gamepads::StickAngle(PlayerId, Stick)" ] } ] @@ -35497,12 +37834,12 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" }, { "description": "Stick: \"Left\" or \"Right\"", - "name": "stick", + "name": "Stick", "supplementaryInformation": "[\"Left\",\"Right\"]", "type": "stringWithSelector" } @@ -35519,40 +37856,27 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", - "\r", - "//Get function parameters\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", - "const stick = eventsFunctionContext.getArgument(\"stick\").toUpperCase();\r", + "const { getNormalizedAxisValue } = gdjs._extensionController;\r", "\r", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "const stick = eventsFunctionContext.getArgument(\"Stick\").toUpperCase();\r", "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier is not valid in expression: \"Value of a stick rotation\"');\r", - " return;\r", - "}\r", "if (stick !== \"LEFT\" && stick !== \"RIGHT\") {\r", " console.error('Parameter stick is not valid in expression: \"Value of a stick rotation\"');\r", " return;\r", "}\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", - "if (gamepad == null) return;\r", - "\r", - "switch (stick) {\r", - " case 'LEFT':\r", - " eventsFunctionContext.returnValue = gdjs._extensionController.axisToAngle(gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[0], playerId), gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[1], playerId));\r", - " break;\r", - "\r", - " case 'RIGHT':\r", - " eventsFunctionContext.returnValue = gdjs._extensionController.axisToAngle(gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[2], playerId), gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[3], playerId));\r", - " break;\r", + "/** @type {Gamepad} */\r", + "const gamepad = gdjs._extensionController.getGamepad(playerId);\r", + "if (!gamepad) {\r", + " // The gamepad is not connected.\r", + " return;\r", + "}\r", + "const axisValueX = stick === 'RIGHT' ? gamepad.axes[2] : gamepad.axes[0];\r", + "const axisValueY = stick === 'RIGHT' ? gamepad.axes[3] : gamepad.axes[1];\r", "\r", - " default:\r", - " eventsFunctionContext.returnValue = -1;\r", - " break;\r", - "}" + "eventsFunctionContext.returnValue = gdjs._extensionController.axisToAngle(\r", + " getNormalizedAxisValue(axisValueX, playerId),\r", + " getNormalizedAxisValue(axisValueY, playerId));" ], "parameterObjects": "", "useStrict": true, @@ -35565,12 +37889,12 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" }, { "description": "Stick: \"Left\" or \"Right\"", - "name": "stick", + "name": "Stick", "supplementaryInformation": "[\"Left\",\"Right\"]", "type": "stringWithSelector" } @@ -35588,18 +37912,11 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", "\r", - "//Get function parameters\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", "const stick = eventsFunctionContext.getArgument(\"stick\").toUpperCase();\r", "const direction = eventsFunctionContext.getArgument(\"direction\").toUpperCase();\r", "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier is not valid in expression: \"Value of a gamepad axis\"');\r", - " return;\r", - "}\r", "if (stick != \"LEFT\" && stick != \"RIGHT\") {\r", " console.error('Parameter stick is not valid in expression: \"Value of a gamepad axis\"');\r", " return;\r", @@ -35608,11 +37925,12 @@ " console.error('Parameter direction is not valid in expression: \"Value of a gamepad axis\"');\r", " return;\r", "}\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", - "if (gamepad == null) return;\r", - "\r", + "/** @type {Gamepad} */\r", + "const gamepad = gdjs._extensionController.getGamepad(playerId);\r", + "if (!gamepad) {\r", + " // The gamepad is not connected.\r", + " return;\r", + "}\r", "let parameterError = false;\r", "switch (stick) {\r", " case 'LEFT':\r", @@ -35709,7 +38027,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" }, { @@ -35737,26 +38055,20 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", "\r", - "//Get function parameters\r", "const playerId = eventsFunctionContext.getArgument(\"Gamepad\") - 1;\r", "const stick = eventsFunctionContext.getArgument(\"Stick\").toLowerCase();\r", "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier is not valid in expression: \"Value of a gamepad axis\"');\r", - " return;\r", - "}\r", "if (stick != \"left\" && stick != \"right\") {\r", " console.error('Parameter stick is not valid in expression: \"Value of a gamepad axis\"');\r", " return;\r", "}\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", - "if (gamepad == null) return;\r", - "\r", + "/** @type {Gamepad} */\r", + "const gamepad = gdjs._extensionController.getGamepad(playerId);\r", + "if (!gamepad) {\r", + " // The gamepad is not connected.\r", + " return;\r", + "}\r", "const axisIndex = stick === 'right' ? 2 : 0;\r", "eventsFunctionContext.returnValue = gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[axisIndex], playerId);\r", "" @@ -35794,26 +38106,20 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", "\r", - "//Get function parameters\r", "const playerId = eventsFunctionContext.getArgument(\"Gamepad\") - 1;\r", "const stick = eventsFunctionContext.getArgument(\"Stick\").toLowerCase();\r", "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier is not valid in expression: \"Value of a gamepad axis\"');\r", - " return;\r", - "}\r", "if (stick != \"left\" && stick != \"right\") {\r", " console.error('Parameter stick is not valid in expression: \"Value of a gamepad axis\"');\r", " return;\r", "}\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", - "if (gamepad == null) return;\r", - "\r", + "/** @type {Gamepad} */\r", + "const gamepad = gdjs._extensionController.getGamepad(playerId);\r", + "if (!gamepad) {\r", + " // The gamepad is not connected.\r", + " return;\r", + "}\r", "const axisIndex = stick === 'right' ? 3 : 1;\r", "eventsFunctionContext.returnValue = gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[axisIndex], playerId);\r", "" @@ -35845,142 +38151,63 @@ "description": "Test if a button is released on a gamepad. Buttons can be:\n* Xbox: \"A\", \"B\", \"X\", \"Y\", \"LB\", \"RB\", \"LT\", \"RT\", \"BACK\", \"START\",\n* PS4: \"CROSS\", \"SQUARE\", \"CIRCLE\", \"TRIANGLE\", \"L1\", \"L2\", \"R1\", \"R2\", \"SHARE\", \"OPTIONS\", \"PS_BUTTON\", \"CLICK_TOUCHPAD\",\n* Other: \"UP\", \"DOWN\", \"LEFT\", \"RIGHT\", \"CLICK_STICK_LEFT\", \"CLICK_STICK_RIGHT\".", "fullName": "Gamepad button released", "functionType": "Condition", - "name": "C_Button_released", - "sentence": "Button _PARAM2_ of gamepad _PARAM1_ is released", + "name": "C_Button_released", + "sentence": "Button _PARAM2_ of gamepad _PARAM1_ is released", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "\r", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "const button = eventsFunctionContext.getArgument(\"Button\").toUpperCase();\r", + "\r", + "let buttonId = gdjs._extensionController.getButtonId(button);\r", + "if (buttonId === null) {\r", + " return;\r", + "}\r", + "const player = gdjs._extensionController.getPlayer(playerId)\r", + "eventsFunctionContext.returnValue = player.isButtonReleased(buttonId);" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "parameters": [ + { + "description": "The gamepad identifier: 1, 2, 3 or 4", + "name": "PlayerId", + "type": "expression" + }, + { + "description": "Name of the button", + "name": "Button", + "supplementaryInformation": "[\"A\",\"Cross\",\"B\",\"Circle\",\"X\",\"Square\",\"Y\",\"Triangle\",\"LB\",\"L1\",\"RB\",\"R1\",\"LT\",\"L2\",\"RT\",\"R2\",\"Up\",\"Down\",\"Left\",\"Right\",\"Back\",\"Share\",\"Start\",\"Options\",\"Click_Stick_Left\",\"Click_Stick_Right\",\"PS_Button\",\"Click_Touchpad\"]", + "type": "stringWithSelector" + } + ], + "objectGroups": [] + }, + { + "description": "Check if a button was just pressed on a gamepad. Buttons can be:\n* Xbox: \"A\", \"B\", \"X\", \"Y\", \"LB\", \"RB\", \"LT\", \"RT\", \"BACK\", \"START\",\n* PS4: \"CROSS\", \"SQUARE\", \"CIRCLE\", \"TRIANGLE\", \"L1\", \"L2\", \"R1\", \"R2\", \"SHARE\", \"OPTIONS\", \"PS_BUTTON\", \"CLICK_TOUCHPAD\",\n* Other: \"UP\", \"DOWN\", \"LEFT\", \"RIGHT\", \"CLICK_STICK_LEFT\", \"CLICK_STICK_RIGHT\".", + "fullName": "Gamepad button just pressed", + "functionType": "Condition", + "name": "IsButtonJustPressed", + "sentence": "Button _PARAM2_ of gamepad _PARAM1_ was just pressed", "events": [ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", - "\r", - "//Get function parameters\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", - "const button = eventsFunctionContext.getArgument(\"button\").toUpperCase();\r", - "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier in condition: \"Gamepad button released\", is not valid number, must be between 0 and 4.');\r", - " return;\r", - "}\r", - "if (button === \"\") {\r", - " console.error('Parameter button is not valid in condition: \"Gamepad button released\"');\r", - " return;\r", - "}\r", - "\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", - "if (gamepad == null) return;\r", - "\r", - "let buttonId;\r", - "\r", - "switch (button) {\r", - " case 'A':\r", - " case 'CROSS':\r", - " buttonId = 0;\r", - " break;\r", - " case 'B':\r", - " case 'CIRCLE':\r", - " buttonId = 1;\r", - " break;\r", - " case 'X':\r", - " case 'SQUARE':\r", - " buttonId = 2;\r", - " break;\r", - " case 'Y':\r", - " case 'TRIANGLE':\r", - " buttonId = 3;\r", - " break;\r", - " case 'LB':\r", - " case 'L1':\r", - " buttonId = 4;\r", - " break;\r", - " case 'RB':\r", - " case 'R1':\r", - " buttonId = 5;\r", - " break;\r", - " case 'LT':\r", - " case 'L2':\r", - " buttonId = 6;\r", - " break;\r", - " case 'RT':\r", - " case 'R2':\r", - " buttonId = 7;\r", - " break;\r", - "\r", - " case 'UP':\r", - " buttonId = 12;\r", - " break;\r", - " case 'DOWN':\r", - " buttonId = 13;\r", - " break;\r", - " case 'LEFT':\r", - " buttonId = 14;\r", - " break;\r", - " case 'RIGHT':\r", - " buttonId = 15;\r", - " break;\r", "\r", - " case 'BACK':\r", - " case 'SHARE':\r", - " buttonId = 8;\r", - " break;\r", - " case 'START':\r", - " case 'OPTIONS':\r", - " buttonId = 9;\r", - " break;\r", - "\r", - " case 'CLICK_STICK_LEFT':\r", - " buttonId = 10;\r", - " break;\r", - " case 'CLICK_STICK_RIGHT':\r", - " buttonId = 11;\r", - " break;\r", - "\r", - " //PS4\r", - " case 'PS_BUTTON':\r", - " buttonId = 16;\r", - " break;\r", - " case 'CLICK_TOUCHPAD':\r", - " buttonId = 17;\r", - " break;\r", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "const button = eventsFunctionContext.getArgument(\"Button\").toUpperCase();\r", "\r", - " default:\r", - " console.error('The button: ' + button + ' in condition: \"Gamepad button released\" is not valid.');\r", - " break;\r", - "}\r", - "\r", - "if (buttonId === undefined) {\r", - " console.error('There is no buttons valid in condition: \"Gamepad button released\"');\r", - " eventsFunctionContext.returnValue = false;\r", + "let buttonId = gdjs._extensionController.getButtonId(button);\r", + "if (buttonId === null) {\r", " return;\r", "}\r", - "\r", - "if (gamepad.buttons == null || gamepad.buttons[buttonId] == null) {\r", - " console.error('Buttons on the gamepad are not accessible in condition: \"Gamepad button released\"');\r", - " eventsFunctionContext.returnValue = false;\r", - " return;\r", - "}\r", - "\r", - "//Define default value on pressed button or use previous value\r", - "gdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId] = gdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId] || { pressed: false };\r", - "\r", - "//Get state of button at previous frame\r", - "const previousStateButton = gdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId].pressed;\r", - "\r", - "//When previousStateButton is true and actual button state is not pressed\r", - "//Player have release the button\r", - "if (previousStateButton === true && gamepad.buttons[buttonId].pressed === false) {\r", - " // Save the last button used for the player \r", - " gdjs._extensionController.players[playerId].lastButtonUsed = buttonId;\r", - " gdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId].pressed = true;\r", - " eventsFunctionContext.returnValue = true;\r", - "\r", - "} else {\r", - " gdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId].pressed = false;\r", - " eventsFunctionContext.returnValue = false;\r", - "}\r", - "" + "const player = gdjs._extensionController.getPlayer(playerId)\r", + "eventsFunctionContext.returnValue = player.isButtonJustPressed(buttonId);" ], "parameterObjects": "", "useStrict": true, @@ -35990,12 +38217,12 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" }, { "description": "Name of the button", - "name": "button", + "name": "Button", "supplementaryInformation": "[\"A\",\"Cross\",\"B\",\"Circle\",\"X\",\"Square\",\"Y\",\"Triangle\",\"LB\",\"L1\",\"RB\",\"R1\",\"LT\",\"L2\",\"RT\",\"R2\",\"Up\",\"Down\",\"Left\",\"Right\",\"Back\",\"Share\",\"Start\",\"Options\",\"Click_Stick_Left\",\"Click_Stick_Right\",\"PS_Button\",\"Click_Touchpad\"]", "type": "stringWithSelector" } @@ -36012,17 +38239,9 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "//Get function parameter\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", - "\r", - "//Player id is not valid\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier in expression: \"Last pressed button (id)\", is not valid number, must be between 0 and 4.');\r", - " return;\r", - "}\r", "\r", - "//Return the last button used by the player\r", - "eventsFunctionContext.returnValue = gdjs._extensionController.players[playerId].lastButtonUsed;" + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "eventsFunctionContext.returnValue = gdjs._extensionController.getPlayer(playerId).lastButtonUsed;" ], "parameterObjects": "", "useStrict": true, @@ -36035,7 +38254,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" } ], @@ -36051,46 +38270,10 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", - "\r", - "//Get function parameter\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", - "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier in condition: \"Any gamepad button pressed\", is not valid number, must be between 0 and 4.');\r", - " return;\r", - "}\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", - "if (gamepad == null) return;\r", - "\r", - "let buttonId;\r", - "for (let i = 0; i < gamepad.buttons.length; i++) { //For each buttons\r", - " if (gamepad.buttons[i].pressed) { //One of them is pressed\r", - " buttonId = i; //Save the button pressed\r", - " break;\r", - " }\r", - "}\r", - "\r", - "if (buttonId === undefined) {\r", - " // No buttons are pressed.\r", - " eventsFunctionContext.returnValue = false;\r", - " return;\r", - "}\r", - "\r", - "if (gamepad.buttons == null || gamepad.buttons[buttonId] == null) {\r", - " console.error('Buttons on the gamepad are not accessible in condition: \"Any gamepad button pressed\"');\r", - " eventsFunctionContext.returnValue = false;\r", - " return;\r", - "}\r", - "\r", - "//When a button is pressed, save the button in lastButtonUsed for each players\r", - "if (gamepad.buttons[buttonId].pressed) gdjs._extensionController.players[playerId].lastButtonUsed = buttonId;\r", - "eventsFunctionContext.returnValue = gamepad.buttons[buttonId].pressed;\r", - "\r", "\r", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "const player = gdjs._extensionController.getPlayer(playerId)\r", + "eventsFunctionContext.returnValue = player.isAnyButtonPressed();\r", "" ], "parameterObjects": "", @@ -36101,7 +38284,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" } ], @@ -36117,35 +38300,18 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", "\r", - "//Get function parameters\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", "const controllerType = eventsFunctionContext.getArgument(\"controller_type\").toUpperCase();\r", - "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier in string expression: \"Last pressed button (LastButtonString)\", is not valid number, must be between 0 and 4.');\r", - " return;\r", - "}\r", - "if (controllerType === \"\") {\r", - " console.error('Parameter controller type is not valid in string expression: \"Last pressed button (LastButtonString)\"');\r", + "/** @type {Gamepad} */\r", + "const gamepad = gdjs._extensionController.getGamepad(playerId);\r", + "if (!gamepad) {\r", + " // The gamepad is not connected.\r", " return;\r", "}\r", - "\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "if (gamepad !== null) { //Gamepad exist\r", - " //Get last btn id\r", - " const lastButtonUsedID = gdjs._extensionController.players[playerId].lastButtonUsed;\r", - "\r", - " //Return last button as string \r", - " eventsFunctionContext.returnValue = gdjs._extensionController.getInputString(controllerType, lastButtonUsedID);\r", - "\r", - "} else { //Gamepad dosen't exist\r", - " console.error('Your controller is not supported or the gamepad wasn\\'t detected in string expression: \"Last pressed button (LastButtonString)\"');\r", - " eventsFunctionContext.returnValue = \"Gamepad not connected\";\r", - "}" + "const lastButtonUsedID = gdjs._extensionController.getPlayer(playerId).lastButtonUsed;\r", + "eventsFunctionContext.returnValue = gdjs._extensionController.getInputString(controllerType, lastButtonUsedID);\r", + "" ], "parameterObjects": "", "useStrict": true, @@ -36158,7 +38324,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" }, { @@ -36180,20 +38346,16 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", - "\r", - "//Get the last activated controller\r", - "const controllerId = gdjs._extensionController.lastActiveController;\r", "\r", - "// Check if controller is active\r", - "const gamepad = gamepads[controllerId];\r", - "if (gamepad == null) {\r", - " eventsFunctionContext.returnValue = 0;\r", - "} else {\r", - " // Return active controller id\r", - " eventsFunctionContext.returnValue = controllerId + 1;\r", + "const gamepads = navigator.getGamepads ? navigator.getGamepads() : [];\r", + "let lastGamepadIndex = -1;\r", + "for (let playerId = 0; playerId < gamepads.length; playerId++) {\r", + " // Gamepads can be disconnected and become null\r", + " if (gamepads[playerId]) {\r", + " lastGamepadIndex = playerId\r", + " }\r", "}\r", - "" + "eventsFunctionContext.returnValue = lastGamepadIndex + 1;" ], "parameterObjects": "", "useStrict": true, @@ -36216,127 +38378,16 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", "\r", - "//Get function parameters\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", "const button = eventsFunctionContext.getArgument(\"button\").toUpperCase();\r", "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier in condition: \"Gamepad button pressed\", is not valid number, must be between 0 and 4.');\r", - " return;\r", - "}\r", - "if (button === \"\") {\r", - " console.error('Parameter button is not valid in condition: \"Gamepad button pressed\"');\r", - " eventsFunctionContext.returnValue = false;\r", - " return;\r", - "}\r", - "\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", - "if (gamepad == null) return;\r", - "\r", - "let buttonId;\r", - "\r", - "switch (button) {\r", - " case 'A':\r", - " case 'CROSS':\r", - " buttonId = 0;\r", - " break;\r", - " case 'B':\r", - " case 'CIRCLE':\r", - " buttonId = 1;\r", - " break;\r", - " case 'X':\r", - " case 'SQUARE':\r", - " buttonId = 2;\r", - " break;\r", - " case 'Y':\r", - " case 'TRIANGLE':\r", - " buttonId = 3;\r", - " break;\r", - " case 'LB':\r", - " case 'L1':\r", - " buttonId = 4;\r", - " break;\r", - " case 'RB':\r", - " case 'R1':\r", - " buttonId = 5;\r", - " break;\r", - " case 'LT':\r", - " case 'L2':\r", - " buttonId = 6;\r", - " break;\r", - " case 'RT':\r", - " case 'R2':\r", - " buttonId = 7;\r", - " break;\r", - "\r", - " case 'UP':\r", - " buttonId = 12;\r", - " break;\r", - " case 'DOWN':\r", - " buttonId = 13;\r", - " break;\r", - " case 'LEFT':\r", - " buttonId = 14;\r", - " break;\r", - " case 'RIGHT':\r", - " buttonId = 15;\r", - " break;\r", - "\r", - " case 'BACK':\r", - " case 'SHARE':\r", - " buttonId = 8;\r", - " break;\r", - " case 'START':\r", - " case 'OPTIONS':\r", - " buttonId = 9;\r", - " break;\r", - "\r", - " case 'CLICK_STICK_LEFT':\r", - " buttonId = 10;\r", - " break;\r", - " case 'CLICK_STICK_RIGHT':\r", - " buttonId = 11;\r", - " break;\r", - "\r", - " //PS4\r", - " case 'PS_BUTTON':\r", - " buttonId = 16;\r", - " break;\r", - " case 'CLICK_TOUCHPAD':\r", - " buttonId = 17;\r", - " break;\r", - "\r", - " default:\r", - " console.error('The button: ' + button + ' in condition: \"Gamepad button pressed\" is not valid.');\r", - " eventsFunctionContext.returnValue = false;\r", - " break;\r", - "}\r", - "\r", - "\r", - "\r", - "if (buttonId === undefined) {\r", - " console.error('There is no buttons valid in condition: \"Gamepad button pressed\"');\r", - " eventsFunctionContext.returnValue = false;\r", - " return;\r", - "}\r", - "\r", - "if (gamepad.buttons == null || gamepad.buttons[buttonId] == null) {\r", - " console.error('Buttons on the gamepad are not accessible in condition: \"Gamepad button pressed\"');\r", - " eventsFunctionContext.returnValue = false;\r", + "const buttonId = gdjs._extensionController.getButtonId(button);\r", + "if (buttonId === null) {\r", " return;\r", "}\r", - "\r", - "//When a button is pressed, save the button in lastButtonUsed for each players\r", - "if (gamepad.buttons[buttonId].pressed) gdjs._extensionController.players[playerId].lastButtonUsed = buttonId;\r", - "eventsFunctionContext.returnValue = gamepad.buttons[buttonId].pressed;\r", - "\r", - "\r", - "\r", + "const player = gdjs._extensionController.getPlayer(playerId)\r", + "eventsFunctionContext.returnValue = player.isButtonPressed(buttonId);\r", "" ], "parameterObjects": "", @@ -36347,7 +38398,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" }, { @@ -36374,15 +38425,9 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "//Get function parameter\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier in expression: \"Gamepad deadzone for sticks\", is not valid number, must be between 0 and 4.');\r", - " return;\r", - "}\r", - "///Return the deadzone value for a given player\r", - "eventsFunctionContext.returnValue = gdjs._extensionController.players[playerId].deadzone;" + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "eventsFunctionContext.returnValue = gdjs._extensionController.getPlayer(playerId).deadzone;" ], "parameterObjects": "", "useStrict": true, @@ -36395,7 +38440,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" } ], @@ -36411,18 +38456,12 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "//Get function parameter\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", - "const newDeadzone = eventsFunctionContext.getArgument(\"deadzone\");\r", "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier in action: \"Set gamepad deadzone for sticks\", is not valid, must be between 0 and 4.');\r", - " return;\r", - "}\r", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "const newDeadzone = eventsFunctionContext.getArgument(\"deadzone\");\r", "\r", - "// clamp the newDeadzone in range [0, 1].\r", "// https://github.com/4ian/GDevelop-extensions/pull/33#issuecomment-618224857\r", - "gdjs._extensionController.players[playerId].deadzone = gdjs.evtTools.common.clamp(newDeadzone, 0, 1);\r", + "gdjs._extensionController.getPlayer(playerId).deadzone = gdjs.evtTools.common.clamp(newDeadzone, 0, 1);\r", "" ], "parameterObjects": "", @@ -36433,7 +38472,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" }, { @@ -36454,142 +38493,392 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", "\r", - "//Get function parameters\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", "const stick = eventsFunctionContext.getArgument(\"stick\").toUpperCase();\r", "const direction = eventsFunctionContext.getArgument(\"direction\").toUpperCase();\r", "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier in condition: \"Gamepad stick pushed (axis)\", is not valid number, must be between 0 and 4.');\r", - " return;\r", - "}\r", "if (stick != \"LEFT\" && stick != \"RIGHT\") {\r", " console.error('Parameter stick in condition: \"Gamepad stick pushed (axis)\", is not valid, must be LEFT or RIGHT');\r", " return;\r", "}\r", "if (direction != \"UP\" && direction != \"DOWN\" && direction != \"LEFT\" && direction != \"RIGHT\" && direction != \"ANY\") {\r", - " console.error('Parameter deadzone in condition: \"Gamepad stick pushed (axis)\", is not valid, must be UP, DOWN, LEFT or RIGHT');\r", + " console.error('Parameter direction in condition: \"Gamepad stick pushed (axis)\", is not valid, must be UP, DOWN, LEFT or RIGHT');\r", " return;\r", "}\r", - "\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", - "if (gamepad == null) {\r", - " eventsFunctionContext.returnValue = false;\r", + "/** @type {Gamepad} */\r", + "const gamepad = gdjs._extensionController.getGamepad(playerId);\r", + "if (!gamepad) {\r", + " // The gamepad is not connected.\r", " return;\r", "}\r", + "const axisValueX = stick === 'RIGHT' ? gamepad.axes[2] : gamepad.axes[0];\r", + "const axisValueY = stick === 'RIGHT' ? gamepad.axes[3] : gamepad.axes[1];\r", + "eventsFunctionContext.returnValue = gdjs._extensionController.isAxisPushed(playerId, direction, axisValueX, axisValueY);\r", + "" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "parameters": [ + { + "description": "The gamepad identifier: 1, 2, 3 or 4", + "name": "PlayerId", + "type": "expression" + }, + { + "description": "Stick: \"Left\" or \"Right\"", + "name": "stick", + "supplementaryInformation": "[\"Left\",\"Right\"]", + "type": "stringWithSelector" + }, + { + "description": "Direction", + "name": "direction", + "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\",\"Any\"]", + "type": "stringWithSelector" + } + ], + "objectGroups": [] + }, + { + "description": "Return the number of connected gamepads.", + "fullName": "Connected gamepads count", + "functionType": "Expression", + "name": "ConnectedGamepadsCount", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ "\r", - "\r", - "//Define in onFirstSceneLoaded function\r", - "const getNormalizedAxisValue = gdjs._extensionController.getNormalizedAxisValue;\r", - "\r", - "switch (stick) {\r", - " case 'LEFT':\r", - " switch (direction) {\r", - " case 'LEFT':\r", - " if (getNormalizedAxisValue(gamepad.axes[0], playerId) < 0) {\r", - " eventsFunctionContext.returnValue = true;\r", - " return;\r", - " }\r", - " break;\r", - "\r", - " case 'RIGHT':\r", - " if (getNormalizedAxisValue(gamepad.axes[0], playerId) > 0) {\r", - " eventsFunctionContext.returnValue = true;\r", - " return;\r", - " }\r", - " break;\r", - "\r", - " case 'UP':\r", - " if (getNormalizedAxisValue(gamepad.axes[1], playerId) < 0) {\r", - " eventsFunctionContext.returnValue = true;\r", - " return;\r", - " }\r", - " break;\r", - "\r", - " case 'DOWN':\r", - " if (getNormalizedAxisValue(gamepad.axes[1], playerId) > 0) {\r", - " eventsFunctionContext.returnValue = true;\r", - " return;\r", - " }\r", - " break;\r", - "\r", - " case 'ANY':\r", - " if ( getNormalizedAxisValue(gamepad.axes[0], playerId) < 0\r", - " || getNormalizedAxisValue(gamepad.axes[0], playerId) > 0\r", - " || getNormalizedAxisValue(gamepad.axes[1], playerId) < 0 \r", - " || getNormalizedAxisValue(gamepad.axes[1], playerId) > 0) {\r", - " eventsFunctionContext.returnValue = true;\r", - " return;\r", - " }\r", - " break;\r", - "\r", - " default:\r", - " console.error('The value Direction on stick Left on the condition: \"Gamepad stick pushed (axis)\" is not valid.');\r", - " eventsFunctionContext.returnValue = false;\r", - " break;\r", - " }\r", - " break;\r", - "\r", - " case 'RIGHT':\r", - " switch (direction) {\r", - " case 'LEFT':\r", - " if (getNormalizedAxisValue(gamepad.axes[2], playerId) < 0) {\r", - " eventsFunctionContext.returnValue = true;\r", - " return;\r", - " }\r", - " break;\r", - "\r", - " case 'RIGHT':\r", - " if (getNormalizedAxisValue(gamepad.axes[2], playerId) > 0) {\r", - " eventsFunctionContext.returnValue = true;\r", - " return;\r", - " }\r", - " break;\r", - "\r", - " case 'UP':\r", - " if (getNormalizedAxisValue(gamepad.axes[3], playerId) < 0) {\r", - " eventsFunctionContext.returnValue = true;\r", - " return;\r", - " }\r", - " break;\r", - "\r", - " case 'DOWN':\r", - " if (getNormalizedAxisValue(gamepad.axes[3], playerId) > 0) {\r", - " eventsFunctionContext.returnValue = true;\r", - " return;\r", - " }\r", - " break;\r", - "\r", - " case 'ANY':\r", - " if ( getNormalizedAxisValue(gamepad.axes[2], playerId) < 0\r", - " || getNormalizedAxisValue(gamepad.axes[2], playerId) > 0\r", - " || getNormalizedAxisValue(gamepad.axes[3], playerId) < 0 \r", - " || getNormalizedAxisValue(gamepad.axes[3], playerId) > 0) {\r", - " eventsFunctionContext.returnValue = true;\r", - " return;\r", - " }\r", - " break;\r", - "\r", - " default:\r", - " console.error('The value Direction on stick Right on the condition: \"Gamepad stick pushed (axis)\" is not valid.');\r", - " eventsFunctionContext.returnValue = false;\r", - " break;\r", - " }\r", - " break;\r", - "\r", - " default:\r", - " console.error('The value Stick on the condition: \"Gamepad stick pushed (axis)\" is not valid.');\r", - " eventsFunctionContext.returnValue = false;\r", - " break;\r", + "const gamepads = navigator.getGamepads ? navigator.getGamepads() : [];\r", + "let connectedGamepadCount = 0;\r", + "for (let playerId = 0; playerId < gamepads.length; playerId++) {\r", + " // Gamepads can be disconnected and become null\r", + " if (gamepads[playerId]) {\r", + " connectedGamepadCount++;\r", + " }\r", "}\r", + "eventsFunctionContext.returnValue = connectedGamepadCount;\r", + "" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [], + "objectGroups": [] + }, + { + "description": "Return a string containing informations about the specified gamepad.", + "fullName": "Gamepad type", + "functionType": "StringExpression", + "name": "GamepadType", + "sentence": "Player _PARAM1_ use _PARAM2_ controller", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;", + "/** @type {Gamepad} */", + "const gamepad = gdjs._extensionController.getGamepad(playerId);", + "if (!gamepad) {", + " // The gamepad is not connected.", + " return;", + "}", + "eventsFunctionContext.returnValue = (gamepad && gamepad.id) ? gamepad.id : \"No information for player \" + (playerId + 1)", + "" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "expressionType": { + "type": "string" + }, + "parameters": [ + { + "description": "The gamepad identifier: 1, 2, 3 or 4", + "name": "PlayerId", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Check if the specified gamepad has the specified information in its description. Useful to know if the gamepad is a Xbox or PS4 controller.", + "fullName": "Gamepad type", + "functionType": "Condition", + "name": "C_Controller_type", + "sentence": "Gamepad _PARAM1_ is a _PARAM2_ controller", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;", + "const controllerType = eventsFunctionContext.getArgument(\"controller_type\").toUpperCase();", + "/** @type {Gamepad} */", + "const gamepad = gdjs._extensionController.getGamepad(playerId);", + "if (!gamepad) {", + " // The gamepad is not connected.", + " return;", + "}", + "if (controllerType == \"XBOX\") {", + " eventsFunctionContext.returnValue = gdjs._extensionController.isXbox(gamepad);", + "} else {", + " eventsFunctionContext.returnValue = gamepad ? gamepad.id.toUpperCase().indexOf(controllerType) !== -1 : false;", + "}" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "parameters": [ + { + "description": "The gamepad identifier: 1, 2, 3 or 4", + "name": "PlayerId", + "type": "expression" + }, + { + "description": "Type: \"Xbox\", \"PS4\", \"Steam\" or \"PS3\" (among other)", + "name": "controller_type", + "type": "string" + } + ], + "objectGroups": [] + }, + { + "description": "Check if a gamepad is connected.", + "fullName": "Gamepad connected", + "functionType": "Condition", + "name": "C_Controller_X_is_connected", + "sentence": "Gamepad _PARAM1_ is plugged and connected", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;", + "/** @type {Gamepad[]} */", + "const gamepads = navigator.getGamepads ? navigator.getGamepads() : [];", + "// If gamepad was disconnected it will be null (so this will return false)", + "// If gamepad was never connected it will be undefined (so this will return false)", + "eventsFunctionContext.returnValue = !!gamepads[playerId];" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "parameters": [ + { + "description": "The gamepad identifier: 1, 2, 3 or 4", + "name": "PlayerId", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Generate a vibration on the specified controller. Might only work if the game is running in a recent web browser.", + "fullName": "Gamepad vibration", + "functionType": "Action", + "name": "A_Vibrate_controller", + "sentence": "Make gamepad _PARAM1_ vibrate for _PARAM2_ seconds", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;", + "const duration = eventsFunctionContext.getArgument(\"Duration\") || 1;", + "/** @type {Gamepad} */", + "const gamepad = gdjs._extensionController.getGamepad(playerId);", + "if (!gamepad) {", + " // The gamepad is not connected.", + " return;", + "}", + "//Vibration work only on game in browser.", + "if (gamepad.vibrationActuator) {", + " gamepad.vibrationActuator.playEffect(\"dual-rumble\", {", + " startDelay: 0,", + " duration: duration * 1000,", + " weakMagnitude: 1.0,", + " strongMagnitude: 1.0", + " });", + "}" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "parameters": [ + { + "description": "The gamepad identifier: 1, 2, 3 or 4", + "name": "PlayerId", + "type": "expression" + }, + { + "description": "Time of the vibration, in seconds (optional, default value is 1)", + "name": "Duration", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Generate an advanced vibration on the specified controller. Incompatible with Firefox.", + "fullName": "Advanced gamepad vibration", + "functionType": "Action", + "name": "A_Advanced_Vibration_Controller", + "sentence": "Make gamepad _PARAM1_ vibrate for _PARAM2_ seconds with the vibration magnitude of _PARAM3_ and _PARAM4_", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const { clamp } = gdjs.evtTools.common;", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;", + "const duration = eventsFunctionContext.getArgument(\"Duration\") || 1;", + "const strongRumbleMagnitude = clamp(eventsFunctionContext.getArgument(\"StrongMagnitude\"), 0, 1);", + "const weakRumbleMagnitude = clamp(eventsFunctionContext.getArgument(\"WeakMagnitude\"), 0, 1);", + "/** @type {Gamepad} */", + "const gamepad = gdjs._extensionController.getGamepad(playerId);", + "if (!gamepad) {", + " // The gamepad is not connected.", + " return;", + "}", + "//Vibration work only on game in browser.", + "if (gamepad.vibrationActuator) {", + " gamepad.vibrationActuator.playEffect(\"dual-rumble\", {", + " startDelay: 0,", + " duration: duration * 1000,", + " weakMagnitude: weakRumbleMagnitude,", + " strongMagnitude: strongRumbleMagnitude", + " });", + "}", + "const player = gdjs._extensionController.getPlayer(playerId)", + "player.rumble.duration = duration;", + "player.rumble.elapsedTime = 0;", + "player.rumble.weakMagnitude = weakRumbleMagnitude;", + "player.rumble.strongMagnitude = strongRumbleMagnitude;" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "parameters": [ + { + "description": "The gamepad identifier: 1, 2, 3 or 4", + "name": "PlayerId", + "type": "expression" + }, + { + "description": "Time of the vibration, in seconds (optional, default value is 1)", + "name": "Duration", + "type": "expression" + }, + { + "description": "Strong rumble magnitude (from 0 to 1)", + "name": "StrongMagnitude", + "type": "expression" + }, + { + "description": "Weak rumble magnitude (from 0 to 1)", + "name": "WeakMagnitude", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Change a vibration on the specified controller. Incompatible with Firefox.", + "fullName": "Change gamepad active vibration", + "functionType": "Action", + "name": "A_Change_Vibration_Magnitude", + "sentence": "Change the vibration magnitude of _PARAM2_ & _PARAM3_ on gamepad _PARAM1_", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const { clamp } = gdjs.evtTools.common;", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;", + "const player = gdjs._extensionController.getPlayer(playerId);", + "const elapsedTime = player.rumble.elapsedTime || 0;", + "const originalDuration = player.rumble.duration || 1;", + "const strongRumbleMagnitude = clamp(eventsFunctionContext.getArgument(\"StrongMagnitude\"), 0, 1);", + "const weakRumbleMagnitude = clamp(eventsFunctionContext.getArgument(\"WeakMagnitude\"), 0, 1);", + "/** @type {Gamepad} */", + "const gamepad = gdjs._extensionController.getGamepad(playerId);", + "if (!gamepad) {", + " // The gamepad is not connected.", + " return;", + "}", + "if (originalDuration - elapsedTime <= 0) return;", + "//Vibration work only on game in browser.", + "if (gamepad.vibrationActuator) {", + " gamepad.vibrationActuator.playEffect(\"dual-rumble\", {", + " startDelay: 0,", + " duration: 1000 * (originalDuration - elapsedTime),", + " weakMagnitude: weakRumbleMagnitude,", + " strongMagnitude: strongRumbleMagnitude", + " });", + "}", + "", + "player.rumble.weakMagnitude = weakRumbleMagnitude;", + "player.rumble.strongMagnitude = strongRumbleMagnitude;" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "parameters": [ + { + "description": "The gamepad identifier: 1, 2, 3 or 4", + "name": "PlayerId", + "type": "expression" + }, + { + "description": "Strong rumble magnitude (from 0 to 1)", + "name": "StrongMagnitude", + "type": "expression" + }, + { + "description": "Weak rumble magnitude (from 0 to 1)", + "name": "WeakMagnitude", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Check if any button is released on a gamepad.", + "fullName": "Any gamepad button released", + "functionType": "Condition", + "name": "C_any_button_released", + "sentence": "Any button of gamepad _PARAM1_ is released", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [] + }, + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ "\r", - "eventsFunctionContext.returnValue = false;\r", - "" + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "const player = gdjs._extensionController.getPlayer(playerId)\r", + "eventsFunctionContext.returnValue = player.isAnyButtonReleased();" ], "parameterObjects": "", "useStrict": true, @@ -36599,1344 +38888,2178 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" - }, - { - "description": "Stick: \"Left\" or \"Right\"", - "name": "stick", - "supplementaryInformation": "[\"Left\",\"Right\"]", - "type": "stringWithSelector" - }, - { - "description": "Direction", - "name": "direction", - "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\",\"Any\"]", - "type": "stringWithSelector" } ], "objectGroups": [] }, { - "description": "Return the number of connected gamepads.", - "fullName": "Connected gamepads number", + "description": "Return the strength of the weak vibration motor on the gamepad of a player.", + "fullName": "Weak rumble magnitude", "functionType": "Expression", - "name": "ConnectedGamepadsCount", + "name": "WeakVibrationMagnitude", "sentence": "", "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [] - }, { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", - "\r", - "// Gamepads can be disconnected and become null, so we have to filter them.\r", - "eventsFunctionContext.returnValue = Object.keys(gamepads).filter(key => !!gamepads[key]).length;\r", - "" + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "eventsFunctionContext.returnValue = gdjs._extensionController.getPlayer(playerId).rumble.weakMagnitude;" ], "parameterObjects": "", "useStrict": true, - "eventsSheetExpanded": true + "eventsSheetExpanded": false } ], "expressionType": { "type": "expression" }, - "parameters": [], + "parameters": [ + { + "description": "The gamepad identifier: 1, 2, 3 or 4", + "name": "PlayerId", + "type": "expression" + } + ], "objectGroups": [] }, { - "description": "Return a string containing informations about the specified gamepad.", - "fullName": "Gamepad type", - "functionType": "StringExpression", - "name": "GamepadType", - "sentence": "Player _PARAM1_ use _PARAM2_ controller", + "description": "Return the strength of the strong vibration motor on the gamepad of a player.", + "fullName": "Strong rumble magnitude", + "functionType": "Expression", + "name": "StrongVibrationMagnitude", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);", - "", - "//Get function parameter", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;", - "", - "if (playerId < 0 || playerId > 4) {", - " console.error('Parameter gamepad identifier in string expression: \"Gamepad type\", is not valid number, must be between 0 and 4');", - " return;", - "}", - "", - "const gamepad = gamepads[playerId];", - "", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.", - "if (gamepad == null) return;", - "", - "eventsFunctionContext.returnValue = (gamepad && gamepad.id) ? gamepad.id : \"No information for player \" + (playerId + 1)", - "" + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "eventsFunctionContext.returnValue = gdjs._extensionController.getPlayer(playerId).rumble.strongMagnitude;" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "The gamepad identifier: 1, 2, 3 or 4", + "name": "PlayerId", + "type": "expression" + } + ], + "objectGroups": [] + } + ], + "eventsBasedBehaviors": [ + { + "description": "Control a platformer character with a gamepad.", + "fullName": "Platformer gamepad mapper", + "name": "PlatformerGamepadMapper", + "objectType": "", + "quickCustomizationVisibility": "hidden", + "eventsFunctions": [ + { + "fullName": "", + "functionType": "Action", + "name": "doStepPreEvents", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::C_Controller_X_is_connected" + }, + "parameters": [ + "", + "GamepadIdentifier", + "" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "UseArrows", + "True", + "" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::C_Button_pressed" + }, + "parameters": [ + "", + "GamepadIdentifier", + "\"Left\"", + "\"Left\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "PlatformBehavior::SimulateLeftKey" + }, + "parameters": [ + "Object", + "PlatformerCharacter" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::C_Button_pressed" + }, + "parameters": [ + "", + "GamepadIdentifier", + "\"Right\"", + "\"Left\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "PlatformBehavior::SimulateRightKey" + }, + "parameters": [ + "Object", + "PlatformerCharacter" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::C_Button_pressed" + }, + "parameters": [ + "", + "GamepadIdentifier", + "\"Up\"", + "\"Left\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "PlatformBehavior::SimulateUpKey" + }, + "parameters": [ + "Object", + "PlatformerCharacter" + ] + }, + { + "type": { + "value": "PlatformBehavior::SimulateLadderKey" + }, + "parameters": [ + "Object", + "PlatformerCharacter" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::C_Button_pressed" + }, + "parameters": [ + "", + "GamepadIdentifier", + "\"Down\"", + "\"Left\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "PlatformBehavior::SimulateDownKey" + }, + "parameters": [ + "Object", + "PlatformerCharacter" + ] + } + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "UseLeftStick", + "True", + "" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::C_Axis_pushed" + }, + "parameters": [ + "", + "GamepadIdentifier", + "\"Left\"", + "\"Left\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "PlatformBehavior::SimulateLeftKey" + }, + "parameters": [ + "Object", + "PlatformerCharacter" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::C_Axis_pushed" + }, + "parameters": [ + "", + "GamepadIdentifier", + "\"Left\"", + "\"Right\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "PlatformBehavior::SimulateRightKey" + }, + "parameters": [ + "Object", + "PlatformerCharacter" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::C_Axis_pushed" + }, + "parameters": [ + "", + "GamepadIdentifier", + "\"Left\"", + "\"Up\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "PlatformBehavior::SimulateUpKey" + }, + "parameters": [ + "Object", + "PlatformerCharacter" + ] + }, + { + "type": { + "value": "PlatformBehavior::SimulateLadderKey" + }, + "parameters": [ + "Object", + "PlatformerCharacter" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::C_Axis_pushed" + }, + "parameters": [ + "", + "GamepadIdentifier", + "\"Left\"", + "\"Down\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "PlatformBehavior::SimulateDownKey" + }, + "parameters": [ + "Object", + "PlatformerCharacter" + ] + } + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "UseRightStick", + "True", + "" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::C_Axis_pushed" + }, + "parameters": [ + "", + "GamepadIdentifier", + "\"Right\"", + "\"Left\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "PlatformBehavior::SimulateLeftKey" + }, + "parameters": [ + "Object", + "PlatformerCharacter" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::C_Axis_pushed" + }, + "parameters": [ + "", + "GamepadIdentifier", + "\"Right\"", + "\"Right\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "PlatformBehavior::SimulateRightKey" + }, + "parameters": [ + "Object", + "PlatformerCharacter" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::C_Axis_pushed" + }, + "parameters": [ + "", + "GamepadIdentifier", + "\"Right\"", + "\"Up\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "PlatformBehavior::SimulateUpKey" + }, + "parameters": [ + "Object", + "PlatformerCharacter" + ] + }, + { + "type": { + "value": "PlatformBehavior::SimulateLadderKey" + }, + "parameters": [ + "Object", + "PlatformerCharacter" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::C_Axis_pushed" + }, + "parameters": [ + "", + "GamepadIdentifier", + "\"Right\"", + "\"Down\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "PlatformBehavior::SimulateDownKey" + }, + "parameters": [ + "Object", + "PlatformerCharacter" + ] + } + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::C_Button_pressed" + }, + "parameters": [ + "", + "GamepadIdentifier", + "Buttons[JumpButton]", + "\"Left\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "PlatformBehavior::SimulateJumpKey" + }, + "parameters": [ + "Object", + "PlatformerCharacter" + ] + } + ] + } + ] + } ], - "parameterObjects": "", - "useStrict": true, - "eventsSheetExpanded": true - } - ], - "expressionType": { - "type": "string" - }, - "parameters": [ - { - "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", - "type": "expression" - } - ], - "objectGroups": [] - }, - { - "description": "Check if the specified gamepad has the specified information in its description. Useful to know if the gamepad is a Xbox or PS4 controller.", - "fullName": "Gamepad type", - "functionType": "Condition", - "name": "C_Controller_type", - "sentence": "Gamepad _PARAM1_ is a _PARAM2_ controller", - "events": [ - { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "/** @type {Gamepad[]} */", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);", - "", - "//Get function parameters", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;", - "const controllerType = eventsFunctionContext.getArgument(\"controller_type\").toUpperCase();", - "", - "if (playerId < 0 || playerId > 4) {", - " console.error('Parameter gamepad identifier in condition: \"Gamepad type\", is not valid number, must be between 0 and 4.');", - " return;", - "}", - "if (controllerType === \"\") {", - " console.error('Parameter type in condition: \"Gamepad type\", is not a string.');", - " return;", - "}", - "", - "const gamepad = gamepads[playerId];", - "", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.", - "if (gamepad == null) return;", - "", - "", - "if (controllerType == \"XBOX\") {", - " eventsFunctionContext.returnValue = gdjs._extensionController.isXbox(gamepad);", - "} else {", - " eventsFunctionContext.returnValue = gamepad ? gamepad.id.toUpperCase().indexOf(controllerType) !== -1 : false;", - "}" + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "Gamepads::PlatformerGamepadMapper", + "type": "behavior" + } ], - "parameterObjects": "", - "useStrict": true, - "eventsSheetExpanded": true + "objectGroups": [] } ], - "parameters": [ + "propertyDescriptors": [ { - "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", - "type": "expression" + "value": "", + "type": "Behavior", + "label": "Platformer character behavior", + "extraInformation": [ + "PlatformBehavior::PlatformerObjectBehavior" + ], + "choices": [], + "name": "PlatformerCharacter" }, { - "description": "Type: \"Xbox\", \"PS4\", \"Steam\" or \"PS3\" (among other)", - "name": "controller_type", - "type": "string" - } - ], - "objectGroups": [] - }, - { - "description": "Check if a gamepad is connected.", - "fullName": "Gamepad connected", - "functionType": "Condition", - "name": "C_Controller_X_is_connected", - "sentence": "Gamepad _PARAM1_ is plugged and connected", - "events": [ - { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "/** @type {Gamepad[]} */", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);", - "", - "//Get function parameter", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;", - "", - "if (playerId < 0 || playerId > 4) {", - " console.error('Parameter gamepad identifier in condition: \"Gamepad connected\", is not valid number, must be between 0 and 4.');", - " return;", - "}", - "", - "// If gamepad was disconnected it will be null (so this will return false)", - "// If gamepad was never connected it will be undefined (so this will return false)", - "eventsFunctionContext.returnValue = !!gamepads[playerId];" - ], - "parameterObjects": "", - "useStrict": true, - "eventsSheetExpanded": true - } - ], - "parameters": [ + "value": "1", + "type": "Number", + "label": "Gamepad identifier (1, 2, 3 or 4)", + "name": "GamepadIdentifier" + }, { - "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", - "type": "expression" - } - ], - "objectGroups": [] - }, - { - "description": "Generate a vibration on the specified controller. Might only work if the game is running in a recent web browser.", - "fullName": "Gamepad vibration", - "functionType": "Action", - "name": "A_Vibrate_controller", - "sentence": "Make gamepad _PARAM1_ vibrate for _PARAM2_ seconds", - "events": [ + "value": "true", + "type": "Boolean", + "label": "Use directional pad", + "group": "Controls", + "name": "UseArrows" + }, { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "/** @type {Gamepad[]} */", - "//Vibration work only on game in browser.", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);", - "", - "//Get function parameters", - "const playerId = eventsFunctionContext.getArgument(\"Player_ID\") - 1;", - "const duration = eventsFunctionContext.getArgument(\"Duration\") || 1;", - "", - "if (playerId < 0 || playerId > 4) {", - " console.error('Parameter gamepad identifier in action: \"Gamepad connected\", is not valid number, must be between 0 and 4.');", - " return;", - "}", - "", - "const gamepad = gamepads[playerId];", - "", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.", - "if (gamepad == null) return;", - "", - "if (gamepad && gamepad.vibrationActuator) {", - " gamepad.vibrationActuator.playEffect(\"dual-rumble\", {", - " startDelay: 0,", - " duration: duration * 1000,", - " weakMagnitude: 1.0,", - " strongMagnitude: 1.0", - " });", - "}" - ], - "parameterObjects": "", - "useStrict": true, - "eventsSheetExpanded": true - } - ], - "parameters": [ + "value": "true", + "type": "Boolean", + "label": "Use left stick", + "group": "Controls", + "name": "UseLeftStick" + }, { - "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "Player_ID", - "type": "expression" + "value": "", + "type": "Boolean", + "label": "Use right stick", + "group": "Controls", + "name": "UseRightStick" }, { - "description": "Time of the vibration, in seconds (optional, default value is 1)", - "name": "Duration", - "type": "expression" + "value": "A or Cross", + "type": "Choice", + "label": "Jump button", + "group": "Controls", + "choices": [ + { + "label": "A or Cross", + "value": "A or Cross" + }, + { + "label": "B or Circle", + "value": "B or Circle" + }, + { + "label": "X or Square", + "value": "X or Square" + }, + { + "label": "Y or Triangle", + "value": "Y or Triangle" + }, + { + "label": "LB or L1", + "value": "LB or L1" + }, + { + "label": "RB or R1", + "value": "RB or R1" + }, + { + "label": "LT or L2", + "value": "LT or L2" + }, + { + "label": "RT or R2", + "value": "RT or R2" + } + ], + "name": "JumpButton" } ], - "objectGroups": [] + "sharedPropertyDescriptors": [] }, { - "description": "Generate an advanced vibration on the specified controller. Incompatible with Firefox.", - "fullName": "Advanced gamepad vibration", - "functionType": "Action", - "name": "A_Advanced_Vibration_Controller", - "sentence": "Make gamepad _PARAM1_ vibrate for _PARAM2_ seconds with the vibration magnitude of _PARAM3_ and _PARAM4_", - "events": [ + "description": "Control a 3D physics character with a gamepad.", + "fullName": "3D platformer gamepad mapper", + "name": "Platformer3DGamepadMapper", + "objectType": "", + "quickCustomizationVisibility": "hidden", + "eventsFunctions": [ { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "/** @type {Gamepad[]} */", - "//Vibration work only on game in browser.", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);", - "", - "//Get function parameters", - "const playerId = eventsFunctionContext.getArgument(\"Player_ID\") - 1;", - "const duration = eventsFunctionContext.getArgument(\"Duration\") || 1;", - "const strongRumbleMagnitude = eventsFunctionContext.getArgument(\"StrongMagnitude\");", - "const weakRumbleMagnitude = eventsFunctionContext.getArgument(\"WeakMagnitude\");", - "", - "if (playerId < 0 || playerId > 4) {", - " console.error('Parameter gamepad identifier in action: \"Advanced gamepad vibration\", is not valid number, must be between 0 and 4.');", - " return;", - "}", - "if (weakRumbleMagnitude < 0 || weakRumbleMagnitude > 1) {", - " console.error('Parameter weakRumble identifier in action: \"Advanced gamepad vibration\", is not valid number, must be between 0 and 1.');", - " return;", - "}", - "if (strongRumbleMagnitude < 0 || strongRumbleMagnitude > 1) {", - " console.error('Parameter strongRumble identifier in action: \"Advanced gamepad vibration\", is not valid number, must be between 0 and 1.');", - " return;", - "}", - "", - "const gamepad = gamepads[playerId];", - "", - "//we need keep this condition because when use have not yet plug the controller we can't get the controller in the gamepad variable.", - "if (gamepad == null) return;", - "", - "if (gamepad && gamepad.vibrationActuator) {", - " gamepad.vibrationActuator.playEffect(\"dual-rumble\", {", - " startDelay: 0,", - " duration: duration * 1000,", - " weakMagnitude: weakRumbleMagnitude,", - " strongMagnitude: strongRumbleMagnitude", - " });", - "}", - "", - "gdjs._extensionController.players[playerId].rumble.duration = duration;", - "gdjs._extensionController.players[playerId].rumble.elapsedTime = 0;", - "gdjs._extensionController.players[playerId].rumble.weakMagnitude = weakRumbleMagnitude;", - "gdjs._extensionController.players[playerId].rumble.strongMagnitude = strongRumbleMagnitude;" + "fullName": "", + "functionType": "Action", + "name": "doStepPreEvents", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::C_Controller_X_is_connected" + }, + "parameters": [ + "", + "GamepadIdentifier", + "" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::StickForce" + }, + "parameters": [ + "", + ">", + "0", + "GamepadIdentifier", + "JoystickIdentifier", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "Physics3D::PhysicsCharacter3D::SetForwardAngle" + }, + "parameters": [ + "Object", + "PhysicsCharacter3D", + "=", + "Gamepads::StickAngle(GamepadIdentifier, JoystickIdentifier) + CameraAngle(Object.Layer())" + ] + }, + { + "type": { + "value": "Physics3D::PhysicsCharacter3D::SimulateStick" + }, + "parameters": [ + "Object", + "PhysicsCharacter3D", + "-90", + "Gamepads::StickForce(GamepadIdentifier, JoystickIdentifier)" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::C_Button_pressed" + }, + "parameters": [ + "", + "GamepadIdentifier", + "Buttons[JumpButton]", + "\"Left\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" + }, + "parameters": [ + "Object", + "PhysicsCharacter3D" + ] + } + ] + } + ] + } ], - "parameterObjects": "", - "useStrict": true, - "eventsSheetExpanded": true + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "Gamepads::Platformer3DGamepadMapper", + "type": "behavior" + } + ], + "objectGroups": [] } ], - "parameters": [ + "propertyDescriptors": [ { - "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "Player_ID", - "type": "expression" + "value": "", + "type": "Behavior", + "label": "3D physics character", + "extraInformation": [ + "Physics3D::PhysicsCharacter3D" + ], + "choices": [], + "name": "PhysicsCharacter3D" }, { - "description": "Time of the vibration, in seconds (optional, default value is 1)", - "name": "Duration", - "type": "expression" + "value": "1", + "type": "Number", + "label": "Gamepad identifier (1, 2, 3 or 4)", + "name": "GamepadIdentifier" }, { - "description": "Strong rumble magnitude (from 0 to 1)", - "name": "StrongMagnitude", - "type": "expression" + "value": "Left", + "type": "Choice", + "label": "Walk joystick", + "group": "Controls", + "choices": [ + { + "label": "Left", + "value": "Left" + }, + { + "label": "Right", + "value": "Right" + } + ], + "name": "JoystickIdentifier" }, { - "description": "Weak rumble magnitude (from 0 to 1)", - "name": "WeakMagnitude", - "type": "expression" + "value": "A or Cross", + "type": "Choice", + "label": "Jump button", + "group": "Controls", + "choices": [ + { + "label": "A or Cross", + "value": "A or Cross" + }, + { + "label": "B or Circle", + "value": "B or Circle" + }, + { + "label": "X or Square", + "value": "X or Square" + }, + { + "label": "Y or Triangle", + "value": "Y or Triangle" + }, + { + "label": "LB or L1", + "value": "LB or L1" + }, + { + "label": "RB or R1", + "value": "RB or R1" + }, + { + "label": "LT or L2", + "value": "LT or L2" + }, + { + "label": "RT or R2", + "value": "RT or R2" + } + ], + "name": "JumpButton" } ], - "objectGroups": [] + "sharedPropertyDescriptors": [] }, { - "description": "Change a vibration on the specified controller. Incompatible with Firefox.", - "fullName": "Change gamepad active vibration", - "functionType": "Action", - "name": "A_Change_Vibration_Magnitude", - "sentence": "Change the vibration magnitude of _PARAM2_ & _PARAM3_ on gamepad _PARAM1_", - "events": [ + "description": "Control a 3D physics character with a gamepad.", + "fullName": "3D shooter gamepad mapper", + "name": "Shooter3DGamepadMapper", + "objectType": "", + "quickCustomizationVisibility": "hidden", + "eventsFunctions": [ { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "/** @type {Gamepad[]} */", - "//Vibration work only on game in browser.", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);", - "", - "//Get function parameters", - "const playerId = eventsFunctionContext.getArgument(\"Player_ID\") - 1;", - "const elapsedTime = gdjs._extensionController.players[playerId].rumble.elapsedTime || 0;", - "const originalDuration = gdjs._extensionController.players[playerId].rumble.duration || 1;", - "const strongRumbleMagnitude = eventsFunctionContext.getArgument(\"StrongMagnitude\");", - "const weakRumbleMagnitude = eventsFunctionContext.getArgument(\"WeakMagnitude\");", - "", - "", - "if (playerId < 0 || playerId > 4) {", - " console.error('Parameter gamepad identifier in action: \"Change gamepad active vibration\", is not valid number, must be between 0 and 4.');", - " return;", - "}", - "if (weakRumbleMagnitude < 0 || weakRumbleMagnitude > 1) {", - " console.error('Parameter weakRumble identifier in action: \"Change gamepad active vibration\", is not valid number, must be between 0 and 1.');", - " return;", - "}", - "if (strongRumbleMagnitude < 0 || strongRumbleMagnitude > 1) {", - " console.error('Parameter strongRumble identifier in action: \"Change gamepad active vibration\", is not valid number, must be between 0 and 1.');", - " return;", - "}", - "", - "const gamepad = gamepads[playerId];", - "", - "//we need keep this condition because when use have not yet plug the controller we can't get the controller in the gamepad variable.", - "if (gamepad == null) return;", - "", - "if (originalDuration - elapsedTime <= 0) return;", - "", - "if (gamepad && gamepad.vibrationActuator) {", - " gamepad.vibrationActuator.playEffect(\"dual-rumble\", {", - " startDelay: 0,", - " duration: 1000 * (originalDuration - elapsedTime),", - " weakMagnitude: weakRumbleMagnitude,", - " strongMagnitude: strongRumbleMagnitude", - " });", - "}", - "", - "gdjs._extensionController.players[playerId].rumble.weakMagnitude = weakRumbleMagnitude;", - "gdjs._extensionController.players[playerId].rumble.strongMagnitude = strongRumbleMagnitude;" + "fullName": "", + "functionType": "Action", + "name": "doStepPreEvents", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::C_Controller_X_is_connected" + }, + "parameters": [ + "", + "GamepadIdentifier", + "" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::StickForce" + }, + "parameters": [ + "", + ">", + "0", + "GamepadIdentifier", + "WalkStick", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "Physics3D::PhysicsCharacter3D::SimulateStick" + }, + "parameters": [ + "Object", + "PhysicsCharacter3D", + "Gamepads::StickAngle(GamepadIdentifier, WalkStick)", + "Gamepads::StickForce(GamepadIdentifier, WalkStick)" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::C_Button_pressed" + }, + "parameters": [ + "", + "GamepadIdentifier", + "Buttons[JumpButton]", + "\"Left\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" + }, + "parameters": [ + "Object", + "PhysicsCharacter3D" + ] + } + ] + } + ] + } ], - "parameterObjects": "", - "useStrict": true, - "eventsSheetExpanded": true + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "Gamepads::Shooter3DGamepadMapper", + "type": "behavior" + } + ], + "objectGroups": [] } ], - "parameters": [ + "propertyDescriptors": [ + { + "value": "", + "type": "Behavior", + "label": "3D physics character", + "extraInformation": [ + "Physics3D::PhysicsCharacter3D" + ], + "choices": [], + "name": "PhysicsCharacter3D" + }, { - "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "Player_ID", - "type": "expression" + "value": "1", + "type": "Number", + "label": "Gamepad identifier (1, 2, 3 or 4)", + "name": "GamepadIdentifier" }, { - "description": "Strong rumble magnitude (from 0 to 1)", - "name": "StrongMagnitude", - "type": "expression" + "value": "Left", + "type": "Choice", + "label": "Walk joystick", + "group": "Controls", + "choices": [ + { + "label": "Left", + "value": "Left" + }, + { + "label": "Right", + "value": "Right" + } + ], + "name": "WalkStick" }, { - "description": "Weak rumble magnitude (from 0 to 1)", - "name": "WeakMagnitude", - "type": "expression" + "value": "Right", + "type": "Choice", + "label": "Camera joystick", + "group": "Controls", + "choices": [ + { + "label": "Left", + "value": "Left" + }, + { + "label": "Right", + "value": "Right" + } + ], + "name": "CameraStick" + }, + { + "value": "A or Cross", + "type": "Choice", + "label": "Jump button", + "group": "Controls", + "choices": [ + { + "label": "A or Cross", + "value": "A or Cross" + }, + { + "label": "B or Circle", + "value": "B or Circle" + }, + { + "label": "X or Square", + "value": "X or Square" + }, + { + "label": "Y or Triangle", + "value": "Y or Triangle" + }, + { + "label": "LB or L1", + "value": "LB or L1" + }, + { + "label": "RB or R1", + "value": "RB or R1" + }, + { + "label": "LT or L2", + "value": "LT or L2" + }, + { + "label": "RT or R2", + "value": "RT or R2" + } + ], + "name": "JumpButton" } ], - "objectGroups": [] + "sharedPropertyDescriptors": [] }, { - "fullName": "", - "functionType": "Action", - "name": "onFirstSceneLoaded", - "sentence": "", - "events": [ + "description": "Control camera rotations with a gamepad.", + "fullName": "First person camera gamepad mapper", + "name": "FirstPersonGamepadMapper", + "objectType": "", + "quickCustomizationVisibility": "hidden", + "eventsFunctions": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [] + "fullName": "", + "functionType": "Action", + "name": "doStepPreEvents", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "TODO It's probably a bad idea to rotate the object around Y." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "CurrentRotationSpeedZ", + "=", + "Gamepads::AcceleratedSpeed(CurrentRotationSpeedZ, Gamepads::StickForceX(GamepadIdentifier, CameraStick) * HorizontalRotationSpeedMax, HorizontalRotationSpeedMax, HorizontalRotationAcceleration, HorizontalRotationDeceleration)" + ] + }, + { + "type": { + "value": "SetAngle" + }, + "parameters": [ + "Object", + "+", + "CurrentRotationSpeedZ * TimeDelta()" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "CurrentRotationSpeedY", + "=", + "Gamepads::AcceleratedSpeed(CurrentRotationSpeedY, Gamepads::StickForceY(GamepadIdentifier, CameraStick) * VerticalRotationSpeedMax, VerticalRotationSpeedMax, VerticalRotationAcceleration, VerticalRotationDeceleration)" + ] + }, + { + "type": { + "value": "Scene3D::Base3DBehavior::SetRotationY" + }, + "parameters": [ + "Object", + "Object3D", + "+", + "CurrentRotationSpeedY * TimeDelta()" + ] + }, + { + "type": { + "value": "Scene3D::Base3DBehavior::SetRotationY" + }, + "parameters": [ + "Object", + "Object3D", + "=", + "clamp(Object.Object3D::RotationY(), VerticalAngleMin, VerticalAngleMax)" + ] + }, + { + "type": { + "value": "Gamepads::FirstPersonGamepadMapper::LookFromObjectEyes" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "Gamepads::FirstPersonGamepadMapper", + "type": "behavior" + } + ], + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "//Define an new private object javascript for the gamepad extension\r", - "gdjs._extensionController = {\r", - " players: {\r", - " 0: { mapping: 'DEFAULT', lastButtonUsed: -1, deadzone: 0.2, previousFrameStateButtons: {}, rumble: {} },\r", - " 1: { mapping: 'DEFAULT', lastButtonUsed: -1, deadzone: 0.2, previousFrameStateButtons: {}, rumble: {} },\r", - " 2: { mapping: 'DEFAULT', lastButtonUsed: -1, deadzone: 0.2, previousFrameStateButtons: {}, rumble: {} },\r", - " 3: { mapping: 'DEFAULT', lastButtonUsed: -1, deadzone: 0.2, previousFrameStateButtons: {}, rumble: {} },\r", - " },\r", - " lastActiveController: -1, // Last active controller\r", - " controllerButtonNames: { //Map associating controller button ids to button names\r", - " \"XBOX\": {\r", - " 0: \"A\",\r", - " 1: \"B\",\r", - " 2: \"X\",\r", - " 3: \"Y\",\r", - " 4: \"LB\",\r", - " 5: \"RB\",\r", - " 6: \"LT\",\r", - " 7: \"RT\",\r", - " 8: \"BACK\",\r", - " 9: \"START\",\r", - " 10: \"CLICK_STICK_LEFT\",\r", - " 11: \"CLICK_STICK_RIGHT\",\r", - " 12: \"UP\",\r", - " 13: \"DOWN\",\r", - " 14: \"LEFT\",\r", - " 15: \"RIGHT\",\r", - " 16: \"NONE\",\r", - " 17: \"NONE\"\r", - " },\r", - " \"PS4\": {\r", - " 0: \"CROSS\",\r", - " 1: \"CIRCLE\",\r", - " 2: \"SQUARE\",\r", - " 3: \"TRIANGLE\",\r", - " 4: \"L1\",\r", - " 5: \"R1\",\r", - " 6: \"L2\",\r", - " 7: \"R2\",\r", - " 8: \"SHARE\",\r", - " 9: \"OPTIONS\",\r", - " 10: \"CLICK_STICK_LEFT\",\r", - " 11: \"CLICK_STICK_RIGHT\",\r", - " 12: \"UP\",\r", - " 13: \"DOWN\",\r", - " 14: \"LEFT\",\r", - " 15: \"RIGHT\",\r", - " 16: \"PS_BUTTON\",\r", - " 17: \"CLICK_TOUCHPAD\"\r", - " }\r", - " }\r", - "};\r", - "\r", - "gdjs._extensionController.getInputString = function (type, buttonId) {\r", - " const controllerButtonNames = gdjs._extensionController.controllerButtonNames;\r", - " if (controllerButtonNames[type] !== undefined) {\r", - " return controllerButtonNames[type][buttonId];\r", - " }\r", - "\r", - " return \"UNKNOWN_BUTTON\";\r", - "}\r", - "\r", - "gdjs._extensionController.axisToAngle = function (deltaX, deltaY) {\r", - " const rad = Math.atan2(deltaY, deltaX);\r", - " const deg = rad * (180 / Math.PI);\r", - " return deg;\r", - "}\r", - "\r", - "gdjs._extensionController.isXbox = function (gamepad) {\r", - " return (gamepad ? (\r", - " gamepad.id.toUpperCase().indexOf(\"XBOX\") !== -1\r", - " // \"XINPUT\" cannot be used to check if it is a xbox controller is just a generic\r", - " // name reported in Firefox corresponding to the driver being used by the controller\r", - " // https://gamefaqs.gamespot.com/boards/916373-pc/73341312?page=1\r", - " ) : false);\r", - "}\r", - "\r", - "//Returns the new value taking into account the dead zone for the player_ID given\r", - "gdjs._extensionController.getNormalizedAxisValue = function (v, player_ID) {\r", - " // gdjs._extensionController = gdjs._extensionController || { deadzone: 0.2 };\r", - "\r", - " // Anything smaller than this is assumed to be 0,0\r", - " const DEADZONE = gdjs._extensionController.players[player_ID].deadzone;\r", - "\r", - " if (Math.abs(v) < DEADZONE) {\r", - " // In the dead zone, set to 0\r", - " v = 0;\r", - "\r", - " if (v == null) {\r", - " return 0;\r", - " } else {\r", - " return v;\r", - " }\r", - "\r", - " } else {\r", - " // We're outside the dead zone, but we'd like to smooth\r", - " // this value out so it still runs nicely between 0..1.\r", - " // That is, we don't want it to jump suddenly from 0 to\r", - " // DEADZONE.\r", - "\r", - " // Remap v from\r", - " // DEADZONE..1 to 0..(1-DEADZONE)\r", - " // or from\r", - " // -1..-DEADZONE to -(1-DEADZONE)..0\r", - "\r", - " v = v - Math.sign(v) * DEADZONE;\r", - "\r", - " // Remap v from\r", - " // 0..(1-DEADZONE) to 0..1\r", - " // or from\r", - " // -(1-DEADZONE)..0 to -1..0\r", - "\r", - " return v / (1 - DEADZONE);\r", - " }\r", - "};" + "description": "Move the camera to look though _PARAM1_ eyes. The object must look to the right when all its angles are 0 and the top of its head be toward Z+.", + "fullName": "Look through object eyes", + "functionType": "Action", + "group": "Layers and cameras", + "name": "LookFromObjectEyes", + "private": true, + "sentence": "Move the camera to look though _PARAM0_ eyes", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "CentreCamera" + }, + "parameters": [ + "", + "Object", + "", + "Object.Layer()", + "" + ] + }, + { + "type": { + "value": "Scene3D::SetCameraZ" + }, + "parameters": [ + "", + "=", + "Object.Object3D::Z() + Object.Object3D::Depth() + OffsetZ", + "", + "" + ] + }, + { + "type": { + "value": "Scene3D::SetCameraRotationX" + }, + "parameters": [ + "", + "=", + "- Object.Object3D::RotationY() + 90", + "GetArgumentAsString(\"Layer\")", + "" + ] + }, + { + "type": { + "value": "Scene3D::SetCameraRotationY" + }, + "parameters": [ + "", + "=", + "Object.Object3D::RotationX()", + "GetArgumentAsString(\"Layer\")", + "" + ] + }, + { + "type": { + "value": "SetCameraAngle" + }, + "parameters": [ + "", + "=", + "Object.Angle() + 90", + "Object.Layer()", + "" + ] + } + ] + } ], - "parameterObjects": "", - "useStrict": true, - "eventsSheetExpanded": true - } - ], - "parameters": [], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "Action", - "name": "onScenePostEvents", - "sentence": "", - "events": [ + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "Gamepads::FirstPersonGamepadMapper", + "type": "behavior" + } + ], + "objectGroups": [] + }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [] + "description": "the maximum horizontal rotation speed of the object.", + "fullName": "Maximum horizontal rotation speed", + "functionType": "ExpressionAndCondition", + "group": "First person camera gamepad mapper horizontal rotation configuration", + "name": "HorizontalRotationSpeedMax", + "sentence": "the maximum horizontal rotation speed", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "HorizontalRotationSpeedMax" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "Gamepads::FirstPersonGamepadMapper", + "type": "behavior" + } + ], + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "//Each time a player press a button i save the last button pressed for the next frame", - "/** @type {Gamepad[]} */", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);", - "", - "//Get function parameter", - "let countPlayers = Object.keys(gdjs._extensionController.players).length;", - "", - "//Repeat for each players", - "for (let i = 0; i < countPlayers; i++) {", - " let gamepad = gamepads[i]; // Get the gamepad of the player", - "", - " //We have to keep this condition because if the user hasn't plugged in his controller yet, we can't get the controller in the gamepad variable.", - " if (gamepad == null) {", - " continue;", - " }", - "", - " for (let b = 0; b < Object.keys(gamepad.buttons).length; b++) { //For each buttons", - " if (gamepad.buttons[b].pressed) { //One of them is pressed", - " gdjs._extensionController.players[i].lastButtonUsed = b; //Save the button pressed", - "", - " //Save the state of the button for the next frame.", - " gdjs._extensionController.players[i].previousFrameStateButtons[b] = { pressed: true };", - "", - " // Update Last Active Controller", - " gdjs._extensionController.lastActiveController = i;", - " } else {", - " gdjs._extensionController.players[i].previousFrameStateButtons[b] = { pressed: false };", - " }", - " }", - "", - "", - " gdjs._extensionController.players[i].rumble.elapsedTime += runtimeScene.getElapsedTime(runtimeScene) / 1000;", - " if (", - " gdjs._extensionController.players[i].rumble.duration - gdjs._extensionController.players[i].rumble.elapsedTime <= 0 &&", - " (gdjs._extensionController.players[i].rumble.weakMagnitude || gdjs._extensionController.players[i].rumble.strongMagnitude)", - " ) {", - " gdjs._extensionController.players[i].rumble.weakMagnitude = 0;", - " gdjs._extensionController.players[i].rumble.strongMagnitude = 0;", - " }", - "", - "", - "}", - "" + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "HorizontalRotationSpeedMax", + "name": "SetHorizontalRotationSpeedMax", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "HorizontalRotationSpeedMax", + "=", + "Value" + ] + } + ] + } ], - "parameterObjects": "", - "useStrict": true, - "eventsSheetExpanded": true - } - ], - "parameters": [], - "objectGroups": [] - }, - { - "description": "Check if any button is released on a gamepad.", - "fullName": "Any gamepad button released", - "functionType": "Condition", - "name": "C_any_button_released", - "sentence": "Any button of gamepad _PARAM1_ is released", - "events": [ + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "Gamepads::FirstPersonGamepadMapper", + "type": "behavior" + } + ], + "objectGroups": [] + }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [] + "description": "the horizontal rotation acceleration of the object.", + "fullName": "Horizontal rotation acceleration", + "functionType": "ExpressionAndCondition", + "group": "First person camera gamepad mapper horizontal rotation configuration", + "name": "HorizontalRotationAcceleration", + "sentence": "the horizontal rotation acceleration", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "HorizontalRotationAcceleration" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "Gamepads::FirstPersonGamepadMapper", + "type": "behavior" + } + ], + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", - "\r", - "//Get function parameters\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", - "\r", - "if (playerId < 0 || playerId > 4) {\r", - "\tconsole.error('Parameter gamepad identifier in condition: \"Any gamepad button released\", is not valid number, must be between 0 and 4.');\r", - "\treturn;\r", - "}\r", - "\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", - "if (gamepad == null) return;\r", - "\r", - "for (let buttonId = 0; buttonId < gamepad.buttons.length; buttonId++) { //For each buttons on current frame.\r", - "\r", - "\tif (buttonId === undefined) {\r", - "\t\teventsFunctionContext.returnValue = false;\r", - "\t\treturn;\r", - "\t}\r", - "\r", - "\t//Get previous value or define value by default for the current button\r", - "\tgdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId] = gdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId] || { pressed: false };\r", - "\r", - "\t//Get state of the button at previous frame\r", - "\tconst previousStateButtonIsPressed = gdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId].pressed;\r", - "\r", - "\t//Get the state of the button on the current frame.\r", - "\tconst currentFrameStateButtonIsPressed = gamepad.buttons[buttonId].pressed;\r", - "\r", - "\t//When previousStateButtonIsPressed is true and actual button state is not pressed\r", - "\t//Player have release the button\r", - "\tif (previousStateButtonIsPressed === true && currentFrameStateButtonIsPressed === false) {\r", - "\t\tgdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId].pressed = true;\r", - "\t\teventsFunctionContext.returnValue = true;\r", - "\t\t//break;\r", - "\t\treturn;\r", - "\t} else {\r", - "\t\t//The player didn't released the button yet, the previous frame state is still true\r", - "\t\tgdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId].pressed = false;\r", - "\t\teventsFunctionContext.returnValue = false;\r", - "\t}\r", - "\r", - "\tif (currentFrameStateButtonIsPressed) gdjs._extensionController.players[playerId].lastButtonUsed = buttonId;\r", - "}\r", - "" + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "HorizontalRotationAcceleration", + "name": "SetHorizontalRotationAcceleration", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "HorizontalRotationAcceleration", + "=", + "Value" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "Gamepads::FirstPersonGamepadMapper", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "the horizontal rotation deceleration of the object.", + "fullName": "Horizontal rotation deceleration", + "functionType": "ExpressionAndCondition", + "group": "First person camera gamepad mapper horizontal rotation configuration", + "name": "HorizontalRotationDeceleration", + "sentence": "the horizontal rotation deceleration", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "HorizontalRotationDeceleration" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "Gamepads::FirstPersonGamepadMapper", + "type": "behavior" + } ], - "parameterObjects": "", - "useStrict": true, - "eventsSheetExpanded": true - } - ], - "parameters": [ - { - "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", - "type": "expression" - } - ], - "objectGroups": [] - }, - { - "description": "Return the strength of the weak vibration motor on the gamepad of a player.", - "fullName": "Weak rumble magnitude", - "functionType": "Expression", - "name": "WeakVibrationMagnitude", - "sentence": "", - "events": [ + "objectGroups": [] + }, { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "const playerId = eventsFunctionContext.getArgument(\"Player_ID\") - 1;\r", - "eventsFunctionContext.returnValue = gdjs._extensionController.players[playerId].rumble.weakMagnitude;" + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "HorizontalRotationDeceleration", + "name": "SetHorizontalRotationDeceleration", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "HorizontalRotationDeceleration", + "=", + "Value" + ] + } + ] + } ], - "parameterObjects": "", - "useStrict": true, - "eventsSheetExpanded": false - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "Gamepads::FirstPersonGamepadMapper", + "type": "behavior" + } + ], + "objectGroups": [] + }, { - "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "Player_ID", - "type": "expression" - } - ], - "objectGroups": [] - }, - { - "description": "Return the strength of the strong vibration motor on the gamepad of a player.", - "fullName": "Strong rumble magnitude", - "functionType": "Expression", - "name": "StrongVibrationMagnitude", - "sentence": "", - "events": [ + "description": "the maximum vertical rotation speed of the object.", + "fullName": "Maximum vertical rotation speed", + "functionType": "ExpressionAndCondition", + "group": "First person camera gamepad mapper vertical rotation configuration", + "name": "VerticalRotationSpeedMax", + "sentence": "the maximum vertical rotation speed", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "VerticalRotationSpeedMax" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "Gamepads::FirstPersonGamepadMapper", + "type": "behavior" + } + ], + "objectGroups": [] + }, { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "const playerId = eventsFunctionContext.getArgument(\"Player_ID\") - 1;\r", - "eventsFunctionContext.returnValue = gdjs._extensionController.players[playerId].rumble.strongMagnitude;" + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "VerticalRotationSpeedMax", + "name": "SetVerticalRotationSpeedMax", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "VerticalRotationSpeedMax", + "=", + "Value" + ] + } + ] + } ], - "parameterObjects": "", - "useStrict": true, - "eventsSheetExpanded": false - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "Gamepads::FirstPersonGamepadMapper", + "type": "behavior" + } + ], + "objectGroups": [] + }, { - "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "Player_ID", - "type": "expression" - } - ], - "objectGroups": [] - } - ], - "eventsBasedBehaviors": [ - { - "description": "Control a platformer character with a gamepad.", - "fullName": "Platformer gamepad mapper", - "name": "PlatformerGamepadMapper", - "objectType": "", - "eventsFunctions": [ + "description": "the vertical rotation acceleration of the object.", + "fullName": "Vertical rotation acceleration", + "functionType": "ExpressionAndCondition", + "group": "First person camera gamepad mapper vertical rotation configuration", + "name": "VerticalRotationAcceleration", + "sentence": "the vertical rotation acceleration", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "VerticalRotationAcceleration" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "Gamepads::FirstPersonGamepadMapper", + "type": "behavior" + } + ], + "objectGroups": [] + }, { "fullName": "", - "functionType": "Action", - "name": "doStepPreEvents", + "functionType": "ActionWithOperator", + "getterName": "VerticalRotationAcceleration", + "name": "SetVerticalRotationAcceleration", "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "conditions": [], + "actions": [ { "type": { - "value": "Gamepads::C_Controller_X_is_connected" + "value": "SetNumberVariable" }, "parameters": [ - "", - "Object.Behavior::PropertyGamepadIdentifier()", - "" + "VerticalRotationAcceleration", + "=", + "Value" ] } - ], - "actions": [], - "events": [ + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "Gamepads::FirstPersonGamepadMapper", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "the vertical rotation deceleration of the object.", + "fullName": "Vertical rotation deceleration", + "functionType": "ExpressionAndCondition", + "group": "First person camera gamepad mapper vertical rotation configuration", + "name": "VerticalRotationDeceleration", + "sentence": "the vertical rotation deceleration", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "Gamepads::PlatformerGamepadMapper::PropertyUseArrows" - }, - "parameters": [ - "Object", - "Behavior" - ] - } - ], - "actions": [], - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "Gamepads::C_Button_pressed" - }, - "parameters": [ - "", - "Object.Behavior::PropertyGamepadIdentifier()", - "\"Left\"", - "\"Left\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateLeftKey" - }, - "parameters": [ - "Object", - "PlatformerCharacter" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "Gamepads::C_Button_pressed" - }, - "parameters": [ - "", - "Object.Behavior::PropertyGamepadIdentifier()", - "\"Right\"", - "\"Left\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateRightKey" - }, - "parameters": [ - "Object", - "PlatformerCharacter" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "Gamepads::C_Button_pressed" - }, - "parameters": [ - "", - "Object.Behavior::PropertyGamepadIdentifier()", - "\"Up\"", - "\"Left\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateUpKey" - }, - "parameters": [ - "Object", - "PlatformerCharacter" - ] - }, - { - "type": { - "value": "PlatformBehavior::SimulateLadderKey" - }, - "parameters": [ - "Object", - "PlatformerCharacter" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "Gamepads::C_Button_pressed" - }, - "parameters": [ - "", - "Object.Behavior::PropertyGamepadIdentifier()", - "\"Down\"", - "\"Left\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateDownKey" - }, - "parameters": [ - "Object", - "PlatformerCharacter" - ] - } - ] - } + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "VerticalRotationDeceleration" ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "Gamepads::PlatformerGamepadMapper::PropertyUseLeftStick" - }, - "parameters": [ - "Object", - "Behavior" - ] - } - ], - "actions": [], - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "Gamepads::C_Axis_pushed" - }, - "parameters": [ - "", - "Object.Behavior::PropertyGamepadIdentifier()", - "\"Left\"", - "\"Left\"", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateLeftKey" - }, - "parameters": [ - "Object", - "PlatformerCharacter" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "Gamepads::C_Axis_pushed" - }, - "parameters": [ - "", - "Object.Behavior::PropertyGamepadIdentifier()", - "\"Left\"", - "\"Right\"", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateRightKey" - }, - "parameters": [ - "Object", - "PlatformerCharacter" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "Gamepads::C_Axis_pushed" - }, - "parameters": [ - "", - "Object.Behavior::PropertyGamepadIdentifier()", - "\"Left\"", - "\"Up\"", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateUpKey" - }, - "parameters": [ - "Object", - "PlatformerCharacter" - ] - }, - { - "type": { - "value": "PlatformBehavior::SimulateLadderKey" - }, - "parameters": [ - "Object", - "PlatformerCharacter" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "Gamepads::C_Axis_pushed" - }, - "parameters": [ - "", - "Object.Behavior::PropertyGamepadIdentifier()", - "\"Left\"", - "\"Down\"", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateDownKey" - }, - "parameters": [ - "Object", - "PlatformerCharacter" - ] - } - ] - } + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "Gamepads::FirstPersonGamepadMapper", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "VerticalRotationDeceleration", + "name": "SetVerticalRotationDeceleration", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "VerticalRotationDeceleration", + "=", + "Value" ] - }, + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "Gamepads::FirstPersonGamepadMapper", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "the minimum vertical camera angle of the object.", + "fullName": "Minimum vertical camera angle", + "functionType": "ExpressionAndCondition", + "group": "First person camera gamepad mapper vertical rotation configuration", + "name": "VerticalAngleMin", + "sentence": "the minimum vertical camera angle", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "Gamepads::PlatformerGamepadMapper::PropertyUseRightStick" - }, - "parameters": [ - "Object", - "Behavior" - ] - } - ], - "actions": [], - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "Gamepads::C_Axis_pushed" - }, - "parameters": [ - "", - "Object.Behavior::PropertyGamepadIdentifier()", - "\"Right\"", - "\"Left\"", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateLeftKey" - }, - "parameters": [ - "Object", - "PlatformerCharacter" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "Gamepads::C_Axis_pushed" - }, - "parameters": [ - "", - "Object.Behavior::PropertyGamepadIdentifier()", - "\"Right\"", - "\"Right\"", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateRightKey" - }, - "parameters": [ - "Object", - "PlatformerCharacter" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "Gamepads::C_Axis_pushed" - }, - "parameters": [ - "", - "Object.Behavior::PropertyGamepadIdentifier()", - "\"Right\"", - "\"Up\"", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateUpKey" - }, - "parameters": [ - "Object", - "PlatformerCharacter" - ] - }, - { - "type": { - "value": "PlatformBehavior::SimulateLadderKey" - }, - "parameters": [ - "Object", - "PlatformerCharacter" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "Gamepads::C_Axis_pushed" - }, - "parameters": [ - "", - "Object.Behavior::PropertyGamepadIdentifier()", - "\"Right\"", - "\"Down\"", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateDownKey" - }, - "parameters": [ - "Object", - "PlatformerCharacter" - ] - } - ] - } + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "VerticalAngleMin" ] - }, + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "Gamepads::FirstPersonGamepadMapper", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "VerticalAngleMin", + "name": "SetVerticalAngleMin", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "Gamepads::PlatformerGamepadMapper::PropertyJumpButton" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "\"A or Cross\"" - ] - }, - { - "type": { - "value": "Gamepads::C_Button_pressed" - }, - "parameters": [ - "", - "Object.Behavior::PropertyGamepadIdentifier()", - "\"A\"", - "\"Left\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateJumpKey" - }, - "parameters": [ - "Object", - "PlatformerCharacter" - ] - } + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "VerticalAngleMin", + "=", + "Value" ] - }, + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "Gamepads::FirstPersonGamepadMapper", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "the maximum vertical camera angle of the object.", + "fullName": "Maximum vertical camera angle", + "functionType": "ExpressionAndCondition", + "group": "First person camera gamepad mapper vertical rotation configuration", + "name": "VerticalAngleMax", + "sentence": "the maximum vertical camera angle", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "Gamepads::PlatformerGamepadMapper::PropertyJumpButton" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "\"B or Circle\"" - ] - }, - { - "type": { - "value": "Gamepads::C_Button_pressed" - }, - "parameters": [ - "", - "Object.Behavior::PropertyGamepadIdentifier()", - "\"B\"", - "\"Left\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateJumpKey" - }, - "parameters": [ - "Object", - "PlatformerCharacter" - ] - } + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "VerticalAngleMax" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "Gamepads::FirstPersonGamepadMapper", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "VerticalAngleMax", + "name": "SetVerticalAngleMax", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "VerticalAngleMax", + "=", + "Value" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "Gamepads::FirstPersonGamepadMapper", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "the z position offset of the object.", + "fullName": "Z position offset", + "functionType": "ExpressionAndCondition", + "group": "First person camera gamepad mapper position configuration", + "name": "OffsetZ", + "sentence": "the z position offset", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "OffsetZ" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "Gamepads::FirstPersonGamepadMapper", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "OffsetZ", + "name": "SetOffsetZ", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "OffsetZ", + "=", + "Value" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "Gamepads::FirstPersonGamepadMapper", + "type": "behavior" + } + ], + "objectGroups": [] + } + ], + "propertyDescriptors": [ + { + "value": "", + "type": "Behavior", + "label": "3D capability", + "extraInformation": [ + "Scene3D::Base3DBehavior" + ], + "choices": [], + "name": "Object3D" + }, + { + "value": "1", + "type": "Number", + "label": "Gamepad identifier (1, 2, 3 or 4)", + "name": "GamepadIdentifier" + }, + { + "value": "Right", + "type": "Choice", + "label": "Camera joystick", + "choices": [ + { + "label": "Left", + "value": "Left" + }, + { + "label": "Right", + "value": "Right" + } + ], + "name": "CameraStick" + }, + { + "value": "180", + "type": "Number", + "unit": "AngularSpeed", + "label": "Maximum rotation speed", + "group": "Horizontal rotation", + "name": "HorizontalRotationSpeedMax" + }, + { + "value": "360", + "type": "Number", + "label": "Rotation acceleration", + "group": "Horizontal rotation", + "name": "HorizontalRotationAcceleration" + }, + { + "value": "720", + "type": "Number", + "label": "Rotation deceleration", + "group": "Horizontal rotation", + "name": "HorizontalRotationDeceleration" + }, + { + "value": "120", + "type": "Number", + "unit": "AngularSpeed", + "label": "Maximum rotation speed", + "group": "Vertical rotation", + "name": "VerticalRotationSpeedMax" + }, + { + "value": "240", + "type": "Number", + "label": "Rotation acceleration", + "group": "Vertical rotation", + "name": "VerticalRotationAcceleration" + }, + { + "value": "480", + "type": "Number", + "label": "Rotation deceleration", + "group": "Vertical rotation", + "name": "VerticalRotationDeceleration" + }, + { + "value": "-90", + "type": "Number", + "unit": "DegreeAngle", + "label": "Minimum angle", + "group": "Vertical rotation", + "name": "VerticalAngleMin" + }, + { + "value": "90", + "type": "Number", + "unit": "DegreeAngle", + "label": "Maximum angle", + "group": "Vertical rotation", + "name": "VerticalAngleMax" + }, + { + "value": "0", + "type": "Number", + "unit": "Pixel", + "label": "Z position offset", + "group": "Position", + "name": "OffsetZ" + }, + { + "value": "0", + "type": "Number", + "unit": "AngularSpeed", + "label": "Current rotation speed Z", + "hidden": true, + "name": "CurrentRotationSpeedZ" + }, + { + "value": "0", + "type": "Number", + "unit": "AngularSpeed", + "label": "Current rotation speed Y", + "hidden": true, + "name": "CurrentRotationSpeedY" + } + ], + "sharedPropertyDescriptors": [] + }, + { + "description": "Control a 3D physics car with a gamepad.", + "fullName": "3D car gamepad mapper", + "name": "PhysicsCar3DGamepadMapper", + "objectType": "", + "quickCustomizationVisibility": "hidden", + "eventsFunctions": [ + { + "fullName": "", + "functionType": "Action", + "name": "doStepPreEvents", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::C_Controller_X_is_connected" + }, + "parameters": [ + "", + "GamepadIdentifier", + "" ] - }, + } + ], + "actions": [], + "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "value": "Gamepads::PlatformerGamepadMapper::PropertyJumpButton" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "\"X or Square\"" - ] - }, - { - "type": { - "value": "Gamepads::C_Button_pressed" + "value": "BooleanVariable" }, "parameters": [ - "", - "Object.Behavior::PropertyGamepadIdentifier()", - "\"X\"", - "\"Left\"" + "UseArrows", + "True", + "" ] } ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateJumpKey" - }, - "parameters": [ - "Object", - "PlatformerCharacter" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "actions": [], + "events": [ { - "type": { - "value": "Gamepads::PlatformerGamepadMapper::PropertyJumpButton" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "\"Y or Triangle\"" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::C_Button_pressed" + }, + "parameters": [ + "", + "GamepadIdentifier", + "\"Left\"", + "\"Left\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "Physics3D::PhysicsCar3D::SimulateLeftKey" + }, + "parameters": [ + "Object", + "PhysicsCar3D" + ] + } ] }, { - "type": { - "value": "Gamepads::C_Button_pressed" - }, - "parameters": [ - "", - "Object.Behavior::PropertyGamepadIdentifier()", - "\"Y\"", - "\"Left\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateJumpKey" - }, - "parameters": [ - "Object", - "PlatformerCharacter" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::C_Button_pressed" + }, + "parameters": [ + "", + "GamepadIdentifier", + "\"Right\"", + "\"Left\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "Physics3D::PhysicsCar3D::SimulateRightKey" + }, + "parameters": [ + "Object", + "PhysicsCar3D" + ] + } ] } ] @@ -37946,35 +41069,44 @@ "conditions": [ { "type": { - "value": "Gamepads::PlatformerGamepadMapper::PropertyJumpButton" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "\"LB or L1\"" - ] - }, - { - "type": { - "value": "Gamepads::C_Button_pressed" + "value": "BooleanVariable" }, "parameters": [ - "", - "Object.Behavior::PropertyGamepadIdentifier()", - "\"LB\"", - "\"Left\"" + "UseLeftStick", + "True", + "" ] } ], - "actions": [ + "actions": [], + "events": [ { - "type": { - "value": "PlatformBehavior::SimulateJumpKey" - }, - "parameters": [ - "Object", - "PlatformerCharacter" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::C_Axis_pushed" + }, + "parameters": [ + "", + "1", + "\"Left\"", + "\"Any\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "Physics3D::PhysicsCar3D::SimulateSteeringStick" + }, + "parameters": [ + "Object", + "PhysicsCar3D", + "Gamepads::StickForceX(GamepadIdentifier, \"Left\")" + ] + } ] } ] @@ -37984,35 +41116,44 @@ "conditions": [ { "type": { - "value": "Gamepads::PlatformerGamepadMapper::PropertyJumpButton" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "\"RB or R1\"" - ] - }, - { - "type": { - "value": "Gamepads::C_Button_pressed" + "value": "BooleanVariable" }, "parameters": [ - "", - "Object.Behavior::PropertyGamepadIdentifier()", - "\"RB\"", - "\"Left\"" + "UseRightStick", + "True", + "" ] } ], - "actions": [ + "actions": [], + "events": [ { - "type": { - "value": "PlatformBehavior::SimulateJumpKey" - }, - "parameters": [ - "Object", - "PlatformerCharacter" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::C_Axis_pushed" + }, + "parameters": [ + "", + "1", + "\"Right\"", + "\"Any\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "Physics3D::PhysicsCar3D::SimulateSteeringStick" + }, + "parameters": [ + "Object", + "PhysicsCar3D", + "Gamepads::StickForceX(GamepadIdentifier, \"Right\")" + ] + } ] } ] @@ -38022,35 +41163,44 @@ "conditions": [ { "type": { - "value": "Gamepads::PlatformerGamepadMapper::PropertyJumpButton" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "\"LT or L2\"" - ] - }, - { - "type": { - "value": "Gamepads::C_Button_pressed" + "value": "BuiltinCommonInstructions::Or" }, - "parameters": [ - "", - "Object.Behavior::PropertyGamepadIdentifier()", - "\"LT\"", - "\"Left\"" + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "Gamepads::C_Button_pressed" + }, + "parameters": [ + "", + "1", + "\"LT\"", + "\"Up\"" + ] + }, + { + "type": { + "value": "Gamepads::C_Button_pressed" + }, + "parameters": [ + "", + "1", + "\"RT\"", + "\"Up\"" + ] + } ] } ], "actions": [ { "type": { - "value": "PlatformBehavior::SimulateJumpKey" + "value": "Physics3D::PhysicsCar3D::SimulateAcceleratorStick" }, "parameters": [ "Object", - "PlatformerCharacter" + "PhysicsCar3D", + "Gamepads::TriggerPressure(GamepadIdentifier, \"RT\") - Gamepads::TriggerPressure(GamepadIdentifier, \"LT\")" ] } ] @@ -38058,25 +41208,14 @@ { "type": "BuiltinCommonInstructions::Standard", "conditions": [ - { - "type": { - "value": "Gamepads::PlatformerGamepadMapper::PropertyJumpButton" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "\"RT or R2\"" - ] - }, { "type": { "value": "Gamepads::C_Button_pressed" }, "parameters": [ "", - "Object.Behavior::PropertyGamepadIdentifier()", - "\"RT\"", + "GamepadIdentifier", + "Buttons[HandBrakeButton]", "\"Left\"" ] } @@ -38084,11 +41223,11 @@ "actions": [ { "type": { - "value": "PlatformBehavior::SimulateJumpKey" + "value": "Physics3D::PhysicsCar3D::SimulateHandBrakeKey" }, "parameters": [ "Object", - "PlatformerCharacter" + "PhysicsCar3D" ] } ] @@ -38105,7 +41244,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "Gamepads::PlatformerGamepadMapper", + "supplementaryInformation": "Gamepads::PhysicsCar3DGamepadMapper", "type": "behavior" } ], @@ -38116,67 +41255,80 @@ { "value": "", "type": "Behavior", - "label": "Platformer character behavior", - "description": "", - "group": "", + "label": "3D physics car", "extraInformation": [ - "PlatformBehavior::PlatformerObjectBehavior" + "Physics3D::PhysicsCar3D" ], - "name": "PlatformerCharacter" + "choices": [], + "name": "PhysicsCar3D" }, { "value": "1", "type": "Number", "label": "Gamepad identifier (1, 2, 3 or 4)", - "description": "", - "group": "", - "extraInformation": [], "name": "GamepadIdentifier" }, { "value": "true", "type": "Boolean", "label": "Use directional pad", - "description": "", "group": "Controls", - "extraInformation": [], "name": "UseArrows" }, { "value": "true", "type": "Boolean", "label": "Use left stick", - "description": "", "group": "Controls", - "extraInformation": [], "name": "UseLeftStick" }, { "value": "", "type": "Boolean", "label": "Use right stick", - "description": "", "group": "Controls", - "extraInformation": [], "name": "UseRightStick" }, { - "value": "A or Cross", + "value": "B or Circle", "type": "Choice", - "label": "Jump button", - "description": "", + "label": "Hand brake button", "group": "Controls", - "extraInformation": [ - "A or Cross", - "B or Circle", - "X or Square", - "Y or Triangle", - "LB or L1", - "RB or R1", - "LT or L2", - "RT or R2" + "choices": [ + { + "label": "A or Cross", + "value": "A or Cross" + }, + { + "label": "B or Circle", + "value": "B or Circle" + }, + { + "label": "X or Square", + "value": "X or Square" + }, + { + "label": "Y or Triangle", + "value": "Y or Triangle" + }, + { + "label": "LB or L1", + "value": "LB or L1" + }, + { + "label": "RB or R1", + "value": "RB or R1" + }, + { + "label": "LT or L2", + "value": "LT or L2" + }, + { + "label": "RT or R2", + "value": "RT or R2" + } ], - "name": "JumpButton" + "name": "HandBrakeButton" } ], "sharedPropertyDescriptors": [] @@ -38186,6 +41338,7 @@ "fullName": "Top-down gamepad mapper", "name": "TopDownGamepadMapper", "objectType": "", + "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -38202,7 +41355,7 @@ }, "parameters": [ "", - "Object.Behavior::PropertyGamepadIdentifier()", + "GamepadIdentifier", "" ] } @@ -38214,11 +41367,12 @@ "conditions": [ { "type": { - "value": "Gamepads::PlatformerGamepadMapper::PropertyUseArrows" + "value": "BooleanVariable" }, "parameters": [ - "Object", - "Behavior" + "UseArrows", + "True", + "" ] } ], @@ -38233,7 +41387,7 @@ }, "parameters": [ "", - "Object.Behavior::PropertyGamepadIdentifier()", + "GamepadIdentifier", "\"Left\"", "\"Left\"" ] @@ -38260,7 +41414,7 @@ }, "parameters": [ "", - "Object.Behavior::PropertyGamepadIdentifier()", + "GamepadIdentifier", "\"Right\"", "\"Left\"" ] @@ -38287,7 +41441,7 @@ }, "parameters": [ "", - "Object.Behavior::PropertyGamepadIdentifier()", + "GamepadIdentifier", "\"Up\"", "\"Left\"" ] @@ -38314,7 +41468,7 @@ }, "parameters": [ "", - "Object.Behavior::PropertyGamepadIdentifier()", + "GamepadIdentifier", "\"Down\"", "\"Left\"" ] @@ -38339,11 +41493,12 @@ "conditions": [ { "type": { - "value": "Gamepads::PlatformerGamepadMapper::PropertyUseLeftStick" + "value": "BooleanVariable" }, "parameters": [ - "Object", - "Behavior" + "UseLeftStick", + "True", + "" ] } ], @@ -38354,11 +41509,10 @@ "conditions": [ { "type": { - "value": "Gamepads::TopDownGamepadMapper::PropertyStickMode" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "StickMode", "=", "\"Analog\"" ] @@ -38372,8 +41526,8 @@ "parameters": [ "Object", "TopDownMovement", - "Gamepads::StickRotationValue(Object.Behavior::PropertyGamepadIdentifier(), \"Left\")", - "Gamepads::StickForce(Object.Behavior::PropertyGamepadIdentifier(), \"Left\")" + "Gamepads::StickRotationValue(GamepadIdentifier, \"Left\")", + "Gamepads::StickForce(GamepadIdentifier, \"Left\")" ] } ] @@ -38383,11 +41537,10 @@ "conditions": [ { "type": { - "value": "Gamepads::TopDownGamepadMapper::PropertyStickMode" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "StickMode", "=", "\"360°\"" ] @@ -38401,8 +41554,8 @@ "parameters": [ "Object", "TopDownMovement", - "Gamepads::StickRotationValue(Object.Behavior::PropertyGamepadIdentifier(), \"Left\")", - "sign(Gamepads::StickForce(Object.Behavior::PropertyGamepadIdentifier(), \"Left\"))" + "Gamepads::StickRotationValue(GamepadIdentifier, \"Left\")", + "sign(Gamepads::StickForce(GamepadIdentifier, \"Left\"))" ] } ] @@ -38412,11 +41565,10 @@ "conditions": [ { "type": { - "value": "Gamepads::TopDownGamepadMapper::PropertyStickMode" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "StickMode", "=", "\"8 Directions\"" ] @@ -38433,7 +41585,7 @@ }, "parameters": [ "", - "Object.Behavior::PropertyGamepadIdentifier()", + "GamepadIdentifier", "\"Left\"", "\"Left\"", "" @@ -38461,7 +41613,7 @@ }, "parameters": [ "", - "Object.Behavior::PropertyGamepadIdentifier()", + "GamepadIdentifier", "\"Left\"", "\"Right\"", "" @@ -38489,7 +41641,7 @@ }, "parameters": [ "", - "Object.Behavior::PropertyGamepadIdentifier()", + "GamepadIdentifier", "\"Left\"", "\"Up\"", "" @@ -38517,7 +41669,7 @@ }, "parameters": [ "", - "Object.Behavior::PropertyGamepadIdentifier()", + "GamepadIdentifier", "\"Left\"", "\"Down\"", "" @@ -38545,11 +41697,12 @@ "conditions": [ { "type": { - "value": "Gamepads::PlatformerGamepadMapper::PropertyUseRightStick" + "value": "BooleanVariable" }, "parameters": [ - "Object", - "Behavior" + "UseRightStick", + "True", + "" ] } ], @@ -38560,11 +41713,10 @@ "conditions": [ { "type": { - "value": "Gamepads::TopDownGamepadMapper::PropertyStickMode" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "StickMode", "=", "\"Analog\"" ] @@ -38578,8 +41730,8 @@ "parameters": [ "Object", "TopDownMovement", - "Gamepads::StickRotationValue(Object.Behavior::PropertyGamepadIdentifier(), \"Right\")", - "Gamepads::StickForce(Object.Behavior::PropertyGamepadIdentifier(), \"Right\")" + "Gamepads::StickRotationValue(GamepadIdentifier, \"Right\")", + "Gamepads::StickForce(GamepadIdentifier, \"Right\")" ] } ] @@ -38589,11 +41741,10 @@ "conditions": [ { "type": { - "value": "Gamepads::TopDownGamepadMapper::PropertyStickMode" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "StickMode", "=", "\"360°\"" ] @@ -38607,7 +41758,7 @@ "parameters": [ "Object", "TopDownMovement", - "sign(Gamepads::StickForce(Object.Behavior::PropertyGamepadIdentifier(), \"Right\"))", + "sign(Gamepads::StickForce(GamepadIdentifier, \"Right\"))", "1" ] } @@ -38618,11 +41769,10 @@ "conditions": [ { "type": { - "value": "Gamepads::TopDownGamepadMapper::PropertyStickMode" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "StickMode", "=", "\"8 Directions\"" ] @@ -38639,7 +41789,7 @@ }, "parameters": [ "", - "Object.Behavior::PropertyGamepadIdentifier()", + "GamepadIdentifier", "\"Right\"", "\"Left\"", "" @@ -38667,7 +41817,7 @@ }, "parameters": [ "", - "Object.Behavior::PropertyGamepadIdentifier()", + "GamepadIdentifier", "\"Right\"", "\"Right\"", "" @@ -38695,7 +41845,7 @@ }, "parameters": [ "", - "Object.Behavior::PropertyGamepadIdentifier()", + "GamepadIdentifier", "\"Right\"", "\"Up\"", "" @@ -38723,7 +41873,7 @@ }, "parameters": [ "", - "Object.Behavior::PropertyGamepadIdentifier()", + "GamepadIdentifier", "\"Right\"", "\"Down\"", "" @@ -38770,59 +41920,57 @@ "value": "", "type": "Behavior", "label": "Top-down movement behavior", - "description": "", - "group": "", "extraInformation": [ "TopDownMovementBehavior::TopDownMovementBehavior" ], + "choices": [], "name": "TopDownMovement" }, { "value": "1", "type": "Number", "label": "Gamepad identifier (1, 2, 3 or 4)", - "description": "", - "group": "", - "extraInformation": [], "name": "GamepadIdentifier" }, { "value": "true", "type": "Boolean", "label": "Use directional pad", - "description": "", "group": "Controls", - "extraInformation": [], "name": "UseArrows" }, { "value": "true", "type": "Boolean", "label": "Use left stick", - "description": "", "group": "Controls", - "extraInformation": [], "name": "UseLeftStick" }, { "value": "", "type": "Boolean", "label": "Use right stick", - "description": "", "group": "Controls", - "extraInformation": [], "name": "UseRightStick" }, { "value": "Analog", "type": "Choice", "label": "Stick mode", - "description": "", "group": "Controls", - "extraInformation": [ - "Analog", - "360°", - "8 Directions" + "choices": [ + { + "label": "Analog", + "value": "Analog" + }, + { + "label": "360°", + "value": "360°" + }, + { + "label": "8 Directions", + "value": "8 Directions" + } ], "name": "StickMode" } @@ -38837,6 +41985,7 @@ "category": "", "extensionNamespace": "", "fullName": "", + "gdevelopVersion": "", "helpPath": "", "iconUrl": "", "name": "Respawn", @@ -38871,22 +42020,20 @@ "actions": [ { "type": { - "value": "Respawn::Respawn::SetPropertyOriginX" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "OriginX", "=", "Object.X()" ] }, { "type": { - "value": "Respawn::Respawn::SetPropertyOriginY" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "OriginY", "=", "Object.Y()" ] @@ -39078,22 +42225,20 @@ "actions": [ { "type": { - "value": "Respawn::Respawn::SetPropertyOriginX" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "OriginX", "=", "Object.X()" ] }, { "type": { - "value": "Respawn::Respawn::SetPropertyOriginY" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "OriginY", "=", "Object.Y()" ] @@ -39122,9 +42267,6 @@ "value": "5", "type": "Number", "label": "The invincibility time after been respawn (in seconds).", - "description": "", - "group": "", - "extraInformation": [], "name": "InvincibilityTime" }, { @@ -39132,9 +42274,6 @@ "type": "Number", "unit": "Pixel", "label": "", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "OriginX" }, @@ -39143,9 +42282,6 @@ "type": "Number", "unit": "Pixel", "label": "", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "OriginY" } @@ -39160,6 +42296,7 @@ "category": "", "extensionNamespace": "", "fullName": "", + "gdevelopVersion": "", "helpPath": "", "iconUrl": "", "name": "Bomb", @@ -39407,24 +42544,22 @@ "actions": [ { "type": { - "value": "Bomb::BombBehavior::SetPropertyPlayerId" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "PlayerId", "=", - "PlayerId" + "InitialPlayerId" ] }, { "type": { - "value": "Bomb::BombBehavior::SetPropertyExplosionRange" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "ExplosionRange", "=", - "Range" + "InitialRange" ] } ] @@ -39444,12 +42579,12 @@ }, { "description": "Player id", - "name": "PlayerId", + "name": "InitialPlayerId", "type": "expression" }, { "description": "Range", - "name": "Range", + "name": "InitialRange", "supplementaryInformation": "Player::PlayerBehavior", "type": "expression" } @@ -40083,9 +43218,6 @@ "type": "Number", "unit": "Second", "label": "Delay", - "description": "", - "group": "", - "extraInformation": [], "name": "Delay" }, { @@ -40093,9 +43225,6 @@ "type": "Number", "unit": "Dimensionless", "label": "Player id", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "PlayerId" }, @@ -40104,9 +43233,6 @@ "type": "Number", "unit": "Dimensionless", "label": "", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "ExplosionRange" } @@ -40352,33 +43478,30 @@ "value": "", "type": "Behavior", "label": "3D tween", - "description": "", - "group": "", "extraInformation": [ "Tween3D::Tween3D" ], + "choices": [], "name": "Tween3D" }, { "value": "", "type": "Behavior", "label": "2D tween", - "description": "", - "group": "", "extraInformation": [ "Tween::TweenBehavior" ], + "choices": [], "name": "Tween" }, { "value": "", "type": "Behavior", "label": "3D wobble", - "description": "", - "group": "", "extraInformation": [ "Tween3D::Wobble" ], + "choices": [], "name": "Wobble" } ], @@ -40439,35 +43562,32 @@ "actions": [ { "type": { - "value": "Bomb::ExplosionBehavior::SetPropertyPlayerId" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "PlayerId", "=", - "PlayerId" + "InitialPlayerId" ] }, { "type": { - "value": "Bomb::ExplosionBehavior::SetPropertyDirectionX" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "DirectionX", "=", - "DirectionX" + "InitialDirectionX" ] }, { "type": { - "value": "Bomb::ExplosionBehavior::SetPropertyDirectionY" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "DirectionY", "=", - "DirectionY" + "InitialDirectionY" ] } ] @@ -40487,17 +43607,17 @@ }, { "description": "Player id", - "name": "PlayerId", + "name": "InitialPlayerId", "type": "expression" }, { "description": "Direction X", - "name": "DirectionX", + "name": "InitialDirectionX", "type": "expression" }, { "description": "Direction Y", - "name": "DirectionY", + "name": "InitialDirectionY", "type": "expression" } ], @@ -40731,9 +43851,6 @@ "type": "Number", "unit": "Dimensionless", "label": "", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "PlayerId" }, @@ -40742,9 +43859,6 @@ "type": "Number", "unit": "Dimensionless", "label": "", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "DirectionX" }, @@ -40753,9 +43867,6 @@ "type": "Number", "unit": "Dimensionless", "label": "", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "DirectionY" } @@ -40770,6 +43881,7 @@ "category": "", "extensionNamespace": "", "fullName": "", + "gdevelopVersion": "", "helpPath": "", "iconUrl": "", "name": "Player", @@ -40998,11 +44110,10 @@ "actions": [ { "type": { - "value": "Player::PlayerBehavior::SetPropertyBombCapacity" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "BombCapacity", "+", "1" ] @@ -41027,11 +44138,10 @@ "actions": [ { "type": { - "value": "Player::PlayerBehavior::SetPropertyBombRange" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "BombRange", "+", "1" ] @@ -41271,22 +44381,20 @@ "actions": [ { "type": { - "value": "Player::PlayerBehavior::SetPropertyBombCapacity" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "BombCapacity", "=", "InitialBombCapacity" ] }, { "type": { - "value": "Player::PlayerBehavior::SetPropertyBombRange" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "BombRange", "=", "InitialBombRange" ] @@ -41595,17 +44703,6 @@ "BombRange", "" ] - }, - { - "type": { - "value": "Player::PlayerBehavior::SetPropertyUsedBomb" - }, - "parameters": [ - "Object", - "Behavior", - "+", - "1" - ] } ] } @@ -41775,11 +44872,10 @@ "actions": [ { "type": { - "value": "Player::PlayerBehavior::SetPropertyInitialBombCapacity" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "InitialBombCapacity", "=", "Value" ] @@ -41866,11 +44962,10 @@ "actions": [ { "type": { - "value": "Player::PlayerBehavior::SetPropertyInitialBombRange" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "InitialBombRange", "=", "Value" ] @@ -41916,11 +45011,12 @@ "conditions": [ { "type": { - "value": "Player::PlayerBehavior::PropertyIsDead" + "value": "BooleanVariable" }, "parameters": [ - "Object", - "Behavior" + "IsDead", + "True", + "" ] } ], @@ -41961,26 +45057,16 @@ "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "inverted": true, - "value": "GetArgumentAsBoolean" - }, - "parameters": [ - "\"Value\"" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "Player::PlayerBehavior::SetPropertyIsDead" + "value": "SetBooleanVariable" }, "parameters": [ - "Object", - "Behavior", - "no" + "IsDead", + "False", + "" ] } ] @@ -41990,22 +45076,24 @@ "conditions": [ { "type": { - "value": "GetArgumentAsBoolean" + "value": "BooleanVariable" }, "parameters": [ - "\"Value\"" + "Value", + "True", + "" ] } ], "actions": [ { "type": { - "value": "Player::PlayerBehavior::SetPropertyIsDead" + "value": "SetBooleanVariable" }, "parameters": [ - "Object", - "Behavior", - "yes" + "IsDead", + "True", + "" ] } ] @@ -42040,9 +45128,6 @@ "type": "Number", "unit": "Dimensionless", "label": "Player id", - "description": "", - "group": "", - "extraInformation": [], "name": "Id" }, { @@ -42050,18 +45135,12 @@ "type": "Number", "unit": "Dimensionless", "label": "Initial bomb capacity", - "description": "", - "group": "", - "extraInformation": [], "name": "InitialBombCapacity" }, { "value": "2", "type": "Number", "label": "Initial bomb range", - "description": "", - "group": "", - "extraInformation": [], "name": "InitialBombRange" }, { @@ -42069,9 +45148,6 @@ "type": "Number", "unit": "Dimensionless", "label": "", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "BombCapacity" }, @@ -42080,9 +45156,6 @@ "type": "Number", "unit": "Dimensionless", "label": "", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "BombRange" }, @@ -42090,9 +45163,6 @@ "value": "", "type": "Boolean", "label": "", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "IsDead" } @@ -42127,11 +45197,10 @@ }, { "type": { - "value": "Player::PlayerAnimator::SetPropertyAngle" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "Angle", "=", "90" ] @@ -42166,11 +45235,10 @@ "conditions": [ { "type": { - "value": "Player::PlayerAnimator::PropertyState" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "State", "=", "\"CanRespawn\"" ] @@ -42179,11 +45247,10 @@ "actions": [ { "type": { - "value": "Player::PlayerAnimator::SetPropertyState" + "value": "SetStringVariable" }, "parameters": [ - "Object", - "Behavior", + "State", "=", "\"Alive\"" ] @@ -42206,11 +45273,10 @@ }, { "type": { - "value": "Player::PlayerAnimator::PropertyState" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "State", "=", "\"DeathAnimation\"" ] @@ -42219,11 +45285,10 @@ "actions": [ { "type": { - "value": "Player::PlayerAnimator::SetPropertyState" + "value": "SetStringVariable" }, "parameters": [ - "Object", - "Behavior", + "State", "=", "\"CanRespawn\"" ] @@ -42235,11 +45300,10 @@ "conditions": [ { "type": { - "value": "Player::PlayerAnimator::PropertyState" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "State", "=", "\"Alive\"" ] @@ -42270,11 +45334,10 @@ }, { "type": { - "value": "Player::PlayerAnimator::SetPropertyAngle" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "Angle", "+", "sign(AngleDifference(MovementAngle, Angle)) * min(abs(AngleDifference(MovementAngle, Angle)), 720 * TimeDelta())" ] @@ -42306,11 +45369,10 @@ "conditions": [ { "type": { - "value": "Player::PlayerAnimator::PropertyState" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "State", "=", "\"DeathAnimation\"" ] @@ -42448,11 +45510,10 @@ "actions": [ { "type": { - "value": "Player::PlayerAnimator::SetPropertyMovementAngle" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "MovementAngle", "=", "Value" ] @@ -42667,6 +45728,36 @@ "type": "BuiltinCommonInstructions::Standard", "conditions": [], "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "State", + "=", + "\"DeathAnimation\"" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "ExplosionDirectionX", + "=", + "NewExplosionDirectionX" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "ExplosionDirectionY", + "=", + "NewExplosionDirectionY" + ] + }, { "type": { "value": "Scene3D::Base3DBehavior::SetRotationX" @@ -42696,10 +45787,10 @@ "conditions": [ { "type": { - "value": "CompareArgumentAsNumber" + "value": "NumberVariable" }, "parameters": [ - "\"ExplosionDirectionY\"", + "NewExplosionDirectionY", "=", "0" ] @@ -42714,7 +45805,7 @@ "Object", "Tween", "\"FlyAway\"", - "Object.X() + ExplosionDirectionX * 1000", + "Object.X() + NewExplosionDirectionX * 1000", "\"easeInQuad\"", "0.75", "" @@ -42741,10 +45832,10 @@ "conditions": [ { "type": { - "value": "CompareArgumentAsNumber" + "value": "NumberVariable" }, "parameters": [ - "\"ExplosionDirectionX\"", + "NewExplosionDirectionX", "=", "0" ] @@ -42759,7 +45850,7 @@ "Object", "Tween", "\"FlyAway\"", - "Object.Y() + ExplosionDirectionY * 600", + "Object.Y() + NewExplosionDirectionY * 600", "\"easeInQuad\"", "0.75", "" @@ -42772,10 +45863,10 @@ "conditions": [ { "type": { - "value": "CompareArgumentAsNumber" + "value": "NumberVariable" }, "parameters": [ - "\"ExplosionDirectionY\"", + "NewExplosionDirectionY", "<", "0" ] @@ -42803,10 +45894,10 @@ "conditions": [ { "type": { - "value": "CompareArgumentAsNumber" + "value": "NumberVariable" }, "parameters": [ - "\"ExplosionDirectionY\"", + "NewExplosionDirectionY", ">", "0" ] @@ -42830,45 +45921,6 @@ ] } ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "Player::PlayerAnimator::SetPropertyExplosionDirectionX" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "ExplosionDirectionX" - ] - }, - { - "type": { - "value": "Player::PlayerAnimator::SetPropertyExplosionDirectionY" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "ExplosionDirectionY" - ] - }, - { - "type": { - "value": "Player::PlayerAnimator::SetPropertyState" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "\"DeathAnimation\"" - ] - } - ] } ], "parameters": [ @@ -42886,12 +45938,12 @@ }, { "description": "Explosion direction X", - "name": "ExplosionDirectionX", + "name": "NewExplosionDirectionX", "type": "expression" }, { "description": "Explosion direction Y", - "name": "ExplosionDirectionY", + "name": "NewExplosionDirectionY", "type": "expression" } ], @@ -42957,11 +46009,10 @@ "conditions": [ { "type": { - "value": "Player::PlayerAnimator::PropertyState" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "State", "=", "\"CanRespawn\"" ] @@ -43058,14 +46109,12 @@ "actions": [ { "type": { - "value": "Player::PlayerAnimator::SetMovementAngle" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "MovementAngle", "=", - "Player.TopDownMovement::Angle()", - "" + "Player.TopDownMovement::Angle()" ] } ] @@ -43183,25 +46232,22 @@ }, { "type": { - "value": "Player::PlayerAnimator::SetPropertyAngle" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "Angle", "=", "90" ] }, { "type": { - "value": "Player::PlayerAnimator::SetMovementAngle" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "MovementAngle", "=", - "90", - "" + "90" ] }, { @@ -43282,33 +46328,30 @@ "value": "", "type": "Behavior", "label": "2D tween", - "description": "", - "group": "", "extraInformation": [ "Tween::TweenBehavior" ], + "choices": [], "name": "Tween" }, { "value": "", "type": "Behavior", "label": "3D tween", - "description": "", - "group": "", "extraInformation": [ "Tween3D::Tween3D" ], + "choices": [], "name": "Tween3D" }, { "value": "", "type": "Behavior", "label": "Flash visibility", - "description": "", - "group": "", "extraInformation": [ "Flash::Flash" ], + "choices": [], "name": "Flash" }, { @@ -43316,9 +46359,6 @@ "type": "Number", "unit": "DegreeAngle", "label": "", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "MovementAngle" }, @@ -43326,12 +46366,19 @@ "value": "Alive", "type": "Choice", "label": "", - "description": "", - "group": "", - "extraInformation": [ - "Alive", - "DeathAnimation", - "CanRespawn" + "choices": [ + { + "label": "Alive", + "value": "Alive" + }, + { + "label": "DeathAnimation", + "value": "DeathAnimation" + }, + { + "label": "CanRespawn", + "value": "CanRespawn" + } ], "hidden": true, "name": "State" @@ -43341,9 +46388,6 @@ "type": "Number", "unit": "DegreeAngle", "label": "", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "Angle" }, @@ -43352,9 +46396,6 @@ "type": "Number", "unit": "Dimensionless", "label": "", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "ExplosionDirectionX" }, @@ -43363,9 +46404,6 @@ "type": "Number", "unit": "Dimensionless", "label": "", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "ExplosionDirectionY" } @@ -43380,6 +46418,7 @@ "category": "", "extensionNamespace": "", "fullName": "", + "gdevelopVersion": "", "helpPath": "", "iconUrl": "", "name": "Bonus", @@ -43619,33 +46658,30 @@ "value": "", "type": "Behavior", "label": "3D tween", - "description": "", - "group": "", "extraInformation": [ "Tween3D::Tween3D" ], + "choices": [], "name": "Tween3D" }, { "value": "", "type": "Behavior", "label": "2D tween", - "description": "", - "group": "", "extraInformation": [ "Tween::TweenBehavior" ], + "choices": [], "name": "Tween" }, { "value": "", "type": "Behavior", "label": "3D shake", - "description": "", - "group": "", "extraInformation": [ "ShakeObject3D::ShakeModel3D" ], + "choices": [], "name": "Shake3D" } ], @@ -47967,6 +51003,5 @@ "windowMask": false } } - ], - "externalSourceFiles": [] + ] } \ No newline at end of file From d7c5a173dff4fc2f88fda7ef2d4952f20bed9e32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Davy=20H=C3=A9lard?= Date: Mon, 6 Oct 2025 18:41:17 +0200 Subject: [PATCH 02/12] [3D car coin hunt] Update the extensions --- .../3d-car-coin-hunt/3d-car-coin-hunt.json | 2370 +++++++++-------- examples/3d-car-coin-hunt/assets/RoadWide.png | Bin 360 -> 0 bytes .../assets/rotate-screen-icon2.png | Bin 881 -> 0 bytes 3 files changed, 1268 insertions(+), 1102 deletions(-) delete mode 100644 examples/3d-car-coin-hunt/assets/RoadWide.png delete mode 100644 examples/3d-car-coin-hunt/assets/rotate-screen-icon2.png diff --git a/examples/3d-car-coin-hunt/3d-car-coin-hunt.json b/examples/3d-car-coin-hunt/3d-car-coin-hunt.json index 6a5f31455..9027382bc 100644 --- a/examples/3d-car-coin-hunt/3d-car-coin-hunt.json +++ b/examples/3d-car-coin-hunt/3d-car-coin-hunt.json @@ -539,17 +539,9 @@ "metadata": "", "name": "rotate-screen-icon.png", "smoothed": true, - "userAdded": false - }, - { - "file": "assets/rotate-screen-icon2.png", - "kind": "image", - "metadata": "", - "name": "rotate-screen-icon.png2", - "smoothed": true, "userAdded": false, "origin": { - "identifier": "https://asset-resources.gdevelop.io/public-resources/Mobile Layouts/assets/6a8102ce3340bf9f62300ee1a81ef0b2327b2c6e8d62d7dda68d547f5e2b5969_rotate-screen-icon.png", + "identifier": "https://asset-resources.gdevelop.io/public-resources/Mobile Layouts/6a8102ce3340bf9f62300ee1a81ef0b2327b2c6e8d62d7dda68d547f5e2b5969_rotate-screen-icon.png", "name": "rotate-screen-icon.png" } }, @@ -2751,7 +2743,7 @@ "assetStoreId": "e5919fb86a559b00001678c710efe55f4e9f2e032a9ff9610087370f998d57de", "name": "ScreenOrientationChecker", "type": "ScreenOrientationChecker::ScreenOrientationChecker", - "variant": "", + "variant": "Black screen orientation checker", "variables": [], "effects": [], "behaviors": [ @@ -2771,117 +2763,6 @@ "BackgroundColor": "24;24;24", "CornerRadius": 8, "Padding": 5 - }, - "childrenContent": { - "BackgroundPainter": { - "fillOpacity": 255, - "outlineSize": 0, - "outlineOpacity": 255, - "absoluteCoordinates": true, - "clearBetweenFrames": true, - "antialiasing": "none", - "fillColor": { - "r": 0, - "g": 0, - "b": 0 - }, - "outlineColor": { - "r": 0, - "g": 0, - "b": 0 - } - }, - "Icon": { - "adaptCollisionMaskAutomatically": true, - "updateIfNotVisible": false, - "animations": [ - { - "name": "", - "useMultipleDirections": false, - "directions": [ - { - "looping": false, - "timeBetweenFrames": 0.08, - "sprites": [ - { - "hasCustomCollisionMask": true, - "image": "rotate-screen-icon.png2", - "points": [], - "originPoint": { - "name": "origine", - "x": 52.5, - "y": 56.5 - }, - "centerPoint": { - "automatic": true, - "name": "centre", - "x": 0, - "y": 0 - }, - "customCollisionMask": [ - [ - { - "x": 0, - "y": 1 - }, - { - "x": 105, - "y": 1 - }, - { - "x": 105, - "y": 113 - }, - { - "x": 0, - "y": 113 - } - ] - ] - } - ] - } - ] - } - ] - }, - "Text": { - "bold": true, - "italic": false, - "smoothed": true, - "underlined": false, - "string": "Rotate screen to play", - "font": "", - "textAlignment": "center", - "characterSize": 30, - "color": { - "b": 255, - "g": 255, - "r": 255 - }, - "content": { - "bold": true, - "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": "Rotate screen to play", - "font": "", - "textAlignment": "center", - "verticalTextAlignment": "top", - "characterSize": 30, - "lineHeight": 0, - "color": "255;255;255" - } - } } }, { @@ -5177,7 +5058,7 @@ "name": "ScreenOrientationChecker", "previewIconUrl": "https://asset-resources.gdevelop.io/public-resources/Icons/0126888931a4a4f82bb2824df9f096347ace1c47f510c44df42aa8dc9e49e24a_screen-rotation.svg", "shortDescription": "Display a customizable screen asking the user to rotate their phone/tablet if not in the right orientation.", - "version": "0.1.2", + "version": "0.2.0", "description": "Display a customizable screen asking the user to rotate their phone/tablet if not in the right orientation.", "origin": { "identifier": "ScreenOrientationChecker", @@ -5541,12 +5422,69 @@ } ], "eventsFunctions": [ + { + "fullName": "", + "functionType": "Action", + "name": "onCreated", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "PrimitiveDrawing::ClearBetweenFrames" + }, + "parameters": [ + "BackgroundPainter", + "" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "ScreenOrientationChecker::ScreenOrientationChecker", + "type": "object" + } + ], + "objectGroups": [] + }, { "fullName": "", "functionType": "Action", "name": "doStepPostEvents", "sentence": "", "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "ScreenOrientationChecker::IsInGameEdition" + }, + "parameters": [ + "", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "ScreenOrientationChecker::ScreenOrientationChecker::DrawBackground" + }, + "parameters": [ + "Object", + "" + ] + } + ] + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ @@ -5780,24 +5718,11 @@ "actions": [ { "type": { - "value": "PrimitiveDrawing::FillColor" + "value": "ScreenOrientationChecker::ScreenOrientationChecker::DrawBackground" }, "parameters": [ - "BackgroundPainter", - "BackgroundColor" - ] - }, - { - "type": { - "value": "PrimitiveDrawing::RoundedRectangle" - }, - "parameters": [ - "BackgroundPainter", - "Padding", - "Padding", - "Object.Width()-Padding", - "Object.Height()-Padding", - "CornerRadius" + "Object", + "" ] }, { @@ -6014,11 +5939,48 @@ ], "objectGroups": [] }, + { + "description": "Draw the background.", + "fullName": "Draw the background", + "functionType": "Action", + "name": "DrawBackground", + "private": true, + "sentence": "Draw the background of _PARAM0_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "PrimitiveDrawing::RoundedRectangle" + }, + "parameters": [ + "BackgroundPainter", + "Padding", + "Padding", + "Object.Width()-Padding", + "Object.Height()-Padding", + "CornerRadius" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "ScreenOrientationChecker::ScreenOrientationChecker", + "type": "object" + } + ], + "objectGroups": [] + }, { "description": "Check if the screen should be forced to be shown. Use this to test the screen in your game.", "fullName": "Force show the screen", "functionType": "Condition", - "group": "Screen Orientation Checker configuration", "name": "IsForceShown", "sentence": "_PARAM0_ is forced to be shown", "events": [ @@ -6062,7 +6024,6 @@ "description": "Change if the screen should be forced to be shown. Use this to test the screen in your game.", "fullName": "Force show the screen", "functionType": "Action", - "group": "Screen Orientation Checker configuration", "name": "SetIsForceShown", "sentence": "Force _PARAM0_ to be shown: _PARAM1_", "events": [ @@ -6138,6 +6099,76 @@ } ], "objectGroups": [] + }, + { + "description": "the message of the object.", + "fullName": "Message", + "functionType": "ExpressionAndCondition", + "name": "Message", + "sentence": "the message", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnString" + }, + "parameters": [ + "Text.Text::Value()" + ] + } + ] + } + ], + "expressionType": { + "type": "string" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "ScreenOrientationChecker::ScreenOrientationChecker", + "type": "object" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "Message", + "name": "SetMessage", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "TextContainerCapability::TextContainerBehavior::SetValue" + }, + "parameters": [ + "Text", + "Text", + "=", + "Value" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "ScreenOrientationChecker::ScreenOrientationChecker", + "type": "object" + } + ], + "objectGroups": [] } ], "propertyDescriptors": [ @@ -6171,16 +6202,276 @@ "description": "Corner radius for the background", "group": "Appearance", "name": "CornerRadius" - }, - { - "value": "0;0;0", - "type": "Color", - "label": "Background color", - "group": "Appearance", - "name": "BackgroundColor" } ], - "variants": [] + "variants": [ + { + "areaMaxX": 400, + "areaMaxY": 200, + "areaMaxZ": 0, + "areaMinX": 0, + "areaMinY": 0, + "areaMinZ": 0, + "assetStoreAssetId": "2743bcd6cf431c6c00cda3a59684eb152b3a09d598b799b15383e4f77daf8b37", + "assetStoreOriginalName": "Black screen orientation checker", + "name": "Black screen orientation checker", + "objects": [ + { + "assetStoreId": "", + "bold": true, + "italic": false, + "name": "Text", + "smoothed": true, + "type": "TextObject::Text", + "underlined": false, + "variables": [], + "effects": [], + "behaviors": [ + { + "name": "Anchor", + "type": "AnchorBehavior::AnchorBehavior", + "bottomEdgeAnchor": 0, + "leftEdgeAnchor": 4, + "relativeToOriginalWindowSize": true, + "rightEdgeAnchor": 0, + "topEdgeAnchor": 4, + "useLegacyBottomAndRightAnchors": false + }, + { + "name": "Tween", + "type": "Tween::TweenBehavior" + } + ], + "string": "Rotate screen to play", + "font": "", + "textAlignment": "center", + "characterSize": 30, + "color": { + "b": 255, + "g": 255, + "r": 255 + }, + "content": { + "bold": true, + "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": "Rotate screen to play", + "font": "", + "textAlignment": "center", + "verticalTextAlignment": "top", + "characterSize": 30, + "lineHeight": 0, + "color": "255;255;255" + } + }, + { + "assetStoreId": "", + "name": "BackgroundPainter", + "type": "PrimitiveDrawing::Drawer", + "variables": [], + "effects": [], + "behaviors": [], + "fillOpacity": 255, + "outlineSize": 0, + "outlineOpacity": 255, + "absoluteCoordinates": true, + "clearBetweenFrames": true, + "antialiasing": "none", + "fillColor": { + "r": 0, + "g": 0, + "b": 0 + }, + "outlineColor": { + "r": 0, + "g": 0, + "b": 0 + } + }, + { + "adaptCollisionMaskAutomatically": true, + "assetStoreId": "", + "name": "Icon", + "type": "Sprite", + "updateIfNotVisible": false, + "variables": [], + "effects": [], + "behaviors": [ + { + "name": "Anchor", + "type": "AnchorBehavior::AnchorBehavior", + "bottomEdgeAnchor": 0, + "leftEdgeAnchor": 4, + "topEdgeAnchor": 4, + "relativeToOriginalWindowSize": true, + "rightEdgeAnchor": 0, + "useLegacyBottomAndRightAnchors": false + }, + { + "name": "Tween", + "type": "Tween::TweenBehavior" + } + ], + "animations": [ + { + "name": "", + "useMultipleDirections": false, + "directions": [ + { + "looping": false, + "timeBetweenFrames": 0.08, + "sprites": [ + { + "hasCustomCollisionMask": true, + "image": "rotate-screen-icon.png", + "points": [], + "originPoint": { + "name": "origine", + "x": 52.5, + "y": 56.5 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [ + [ + { + "x": 0, + "y": 1 + }, + { + "x": 105, + "y": 1 + }, + { + "x": 105, + "y": 113 + }, + { + "x": 0, + "y": 113 + } + ] + ] + } + ] + } + ] + } + ] + } + ], + "objectsFolderStructure": { + "folderName": "__ROOT", + "children": [ + { + "objectName": "Text" + }, + { + "objectName": "BackgroundPainter" + }, + { + "objectName": "Icon" + } + ] + }, + "objectsGroups": [], + "layers": [ + { + "ambientLightColorB": 200, + "ambientLightColorG": 200, + "ambientLightColorR": 200, + "camera3DFarPlaneDistance": 10000, + "camera3DFieldOfView": 45, + "camera3DNearPlaneDistance": 3, + "cameraType": "", + "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": [] + } + ], + "instances": [ + { + "angle": 0, + "customSize": true, + "depth": 1, + "height": 35, + "keepRatio": true, + "layer": "", + "name": "Text", + "persistentUuid": "65c003ea-19c0-4f18-a189-a02a24378f35", + "width": 207, + "x": 104, + "y": 120, + "zOrder": 15, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "keepRatio": true, + "layer": "", + "name": "BackgroundPainter", + "persistentUuid": "49ff4576-6406-41de-a43b-1355529d61fe", + "width": 0, + "x": 38, + "y": 17, + "zOrder": 14, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "keepRatio": true, + "layer": "", + "name": "Icon", + "persistentUuid": "39cbfc66-13f4-43dc-b6ef-2bda83153277", + "width": 0, + "x": 204, + "y": 64, + "zOrder": 16, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + } + ] + } + ] } ] }, @@ -6195,17 +6486,17 @@ "name": "Gamepads", "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/gamepad-variant-outline.svg", "shortDescription": "Add support for gamepads (or other controllers) to your game, giving access to information such as button presses, axis positions, trigger pressure, etc...", - "version": "0.8.1", + "version": "0.9.0", "description": [ - "Add support for gamepads (or other controllers).", + "Add support for gamepads (or other physical controllers).", "", "It gives access to:", - "- button presses", - "- axis positions and force", - "- trigger pressure", - "- configurable deadzone", - "- vibration", - "- automatic mappers for platformer characters and top-down movement", + "- button presses,", + "- axis positions and force,", + "- trigger pressure,", + "- configurable deadzone,", + "- vibration,", + "- automatic \"gamepad mapper\" behaviors for 2D and 3D movement behaviors (platformer characters, top-down movement, 3D character etc...). Add one of these to the object with the movement behavior (i.e: the player most of the time) and the behavior will then be controlled automatically by the gamepad (it works by reading the gamepad state and simulating controls). No need for additional events to make it work once the behaviors are set up.", "", "The Bomberman-like example handles 4 players with gamepads ([open the project online](https://editor.gdevelop.io/?project=example://goose-bomberman))." ], @@ -6227,7 +6518,8 @@ "authorIds": [ "2OwwM8ToR9dx9RJ2sAKTcrLmCB92", "taRwmWxwAFYFL9yyBwB3cwBw0BO2", - "mnImQKdn8nQxwzkS5D6a1JB27V23" + "mnImQKdn8nQxwzkS5D6a1JB27V23", + "IWykYNRvhCZBN3vEgKEbBPOR3Oc2" ], "dependencies": [], "globalVariables": [], @@ -6286,83 +6578,323 @@ "name": "onFirstSceneLoaded", "sentence": "", "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [] - }, { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "//Define an new private object javascript for the gamepad extension\r", - "gdjs._extensionController = {\r", - " players: {\r", - " 0: { mapping: 'DEFAULT', lastButtonUsed: -1, deadzone: 0.2, previousFrameStateButtons: {}, rumble: {} },\r", - " 1: { mapping: 'DEFAULT', lastButtonUsed: -1, deadzone: 0.2, previousFrameStateButtons: {}, rumble: {} },\r", - " 2: { mapping: 'DEFAULT', lastButtonUsed: -1, deadzone: 0.2, previousFrameStateButtons: {}, rumble: {} },\r", - " 3: { mapping: 'DEFAULT', lastButtonUsed: -1, deadzone: 0.2, previousFrameStateButtons: {}, rumble: {} },\r", + "if (gdjs._extensionController) {\r", + " return;\r", + "}\r", + "\r", + "/**\r", + " * Associate controller button ids to button names\r", + " */\r", + "const controllerButtonNames = {\r", + " \"XBOX\": {\r", + " 0: \"A\",\r", + " 1: \"B\",\r", + " 2: \"X\",\r", + " 3: \"Y\",\r", + " 4: \"LB\",\r", + " 5: \"RB\",\r", + " 6: \"LT\",\r", + " 7: \"RT\",\r", + " 8: \"BACK\",\r", + " 9: \"START\",\r", + " 10: \"CLICK_STICK_LEFT\",\r", + " 11: \"CLICK_STICK_RIGHT\",\r", + " 12: \"UP\",\r", + " 13: \"DOWN\",\r", + " 14: \"LEFT\",\r", + " 15: \"RIGHT\",\r", + " 16: \"NONE\",\r", + " 17: \"NONE\"\r", " },\r", - " lastActiveController: -1, // Last active controller\r", - " controllerButtonNames: { //Map associating controller button ids to button names\r", - " \"XBOX\": {\r", - " 0: \"A\",\r", - " 1: \"B\",\r", - " 2: \"X\",\r", - " 3: \"Y\",\r", - " 4: \"LB\",\r", - " 5: \"RB\",\r", - " 6: \"LT\",\r", - " 7: \"RT\",\r", - " 8: \"BACK\",\r", - " 9: \"START\",\r", - " 10: \"CLICK_STICK_LEFT\",\r", - " 11: \"CLICK_STICK_RIGHT\",\r", - " 12: \"UP\",\r", - " 13: \"DOWN\",\r", - " 14: \"LEFT\",\r", - " 15: \"RIGHT\",\r", - " 16: \"NONE\",\r", - " 17: \"NONE\"\r", - " },\r", - " \"PS4\": {\r", - " 0: \"CROSS\",\r", - " 1: \"CIRCLE\",\r", - " 2: \"SQUARE\",\r", - " 3: \"TRIANGLE\",\r", - " 4: \"L1\",\r", - " 5: \"R1\",\r", - " 6: \"L2\",\r", - " 7: \"R2\",\r", - " 8: \"SHARE\",\r", - " 9: \"OPTIONS\",\r", - " 10: \"CLICK_STICK_LEFT\",\r", - " 11: \"CLICK_STICK_RIGHT\",\r", - " 12: \"UP\",\r", - " 13: \"DOWN\",\r", - " 14: \"LEFT\",\r", - " 15: \"RIGHT\",\r", - " 16: \"PS_BUTTON\",\r", - " 17: \"CLICK_TOUCHPAD\"\r", - " }\r", + " \"PS4\": {\r", + " 0: \"CROSS\",\r", + " 1: \"CIRCLE\",\r", + " 2: \"SQUARE\",\r", + " 3: \"TRIANGLE\",\r", + " 4: \"L1\",\r", + " 5: \"R1\",\r", + " 6: \"L2\",\r", + " 7: \"R2\",\r", + " 8: \"SHARE\",\r", + " 9: \"OPTIONS\",\r", + " 10: \"CLICK_STICK_LEFT\",\r", + " 11: \"CLICK_STICK_RIGHT\",\r", + " 12: \"UP\",\r", + " 13: \"DOWN\",\r", + " 14: \"LEFT\",\r", + " 15: \"RIGHT\",\r", + " 16: \"PS_BUTTON\",\r", + " 17: \"CLICK_TOUCHPAD\"\r", " }\r", "};\r", "\r", - "gdjs._extensionController.getInputString = function (type, buttonId) {\r", - " const controllerButtonNames = gdjs._extensionController.controllerButtonNames;\r", - " if (controllerButtonNames[type] !== undefined) {\r", - " return controllerButtonNames[type][buttonId];\r", + "/**\r", + " * @param {number} playerId\r", + " */\r", + "function getGamepad(playerId) {\r", + " /** @type {Gamepad[]} */\r", + " const gamepads = navigator.getGamepads ? navigator.getGamepads() : [];\r", + " return gamepads[playerId];\r", + "}\r", + "\r", + "/** @type {{[playerId: number]: Player}} */\r", + "const players = {};\r", + "\r", + "/**\r", + " * @param {number} playerId\r", + " */\r", + "function getPlayer(playerId) {\r", + " let player = players[playerId];\r", + " if (!player) {\r", + " player = new Player(playerId);\r", + " players[playerId] = player;\r", + " }\r", + " return player;\r", + "}\r", + "\r", + "class Player {\r", + " /** @type {number} */\r", + " playerId;\r", + " mapping = 'DEFAULT';\r", + " lastButtonUsed = -1;\r", + " deadzone = 0.2;\r", + " /** @type {{[buttonId: number]: ButtonState}} */\r", + " buttonStates = {};\r", + " rumble = { elapsedTime: 0, duration: 0, weakMagnitude: 0, strongMagnitude: 0 };\r", + "\r", + " /**\r", + " * @param {number} playerId\r", + " */\r", + " constructor(playerId) {\r", + " this.playerId = playerId;\r", + " }\r", + "\r", + " /**\r", + " * @param {number} buttonId\r", + " */\r", + " getButtonState(buttonId) {\r", + " let buttonState = this.buttonStates[buttonId];\r", + " if (!buttonState) {\r", + " buttonState = new ButtonState();\r", + " this.buttonStates[buttonId] = buttonState;\r", + " }\r", + " return buttonState;\r", + " }\r", + "\r", + " /**\r", + " * @param {number} buttonId\r", + " */\r", + " isButtonPressed(buttonId) {\r", + " return this.getButtonState(buttonId).isPressed;\r", + " }\r", + "\r", + " /**\r", + " * @param {number} buttonId\r", + " */\r", + " isButtonJustPressed(buttonId) {\r", + " return this.getButtonState(buttonId).isJustPressed();\r", + " }\r", + "\r", + " /**\r", + " * @param {number} buttonId\r", + " */\r", + " isButtonReleased(buttonId) {\r", + " return this.getButtonState(buttonId).isReleased();\r", + " }\r", + "\r", + " isAnyButtonReleased() {\r", + " for (const buttonId in this.buttonStates) {\r", + " const buttonState = this.buttonStates[buttonId];\r", + " if (buttonState.isReleased()) {\r", + " return true;\r", + " }\r", + " }\r", + " return false;\r", + " }\r", + "\r", + " isAnyButtonPressed() {\r", + " for (const buttonId in this.buttonStates) {\r", + " const buttonState = this.buttonStates[buttonId];\r", + " if (buttonState.isPressed) {\r", + " return true;\r", + " }\r", + " }\r", + " return false;\r", + " }\r", + "}\r", + "\r", + "class ButtonState {\r", + " wasPressed = false;\r", + " isPressed = false;\r", + "\r", + " isReleased() {\r", + " return this.wasPressed && !this.isPressed;\r", " }\r", "\r", - " return \"UNKNOWN_BUTTON\";\r", + " isJustPressed() {\r", + " return !this.wasPressed && this.isPressed;\r", + " }\r", "}\r", "\r", - "gdjs._extensionController.axisToAngle = function (deltaX, deltaY) {\r", + "// Async tasks are run before everything.\r", + "// This is a hack to make sure that button states are updated\r", + "// before mapping behavior events.\r", + "const frameBeginningTask = new class extends gdjs.AsyncTask {\r", + " update() {\r", + " /** @type {Gamepad[]} */\r", + " const gamepads = navigator.getGamepads ? navigator.getGamepads() : [];\r", + " for (let playerId = 0; playerId < gamepads.length; playerId++) {\r", + " const gamepad = gamepads[playerId];\r", + " if (gamepad == null) {\r", + " // The gamepad is not connected.\r", + " continue;\r", + " }\r", + " const player = getPlayer(playerId);\r", + "\r", + " for (let buttonId = 0; buttonId < Object.keys(gamepad.buttons).length; buttonId++) {\r", + " const buttonState = player.getButtonState(buttonId);\r", + " buttonState.wasPressed = buttonState.isPressed;\r", + " buttonState.isPressed = gamepad.buttons[buttonId].pressed;\r", + " if (buttonState.isJustPressed()) {\r", + " player.lastButtonUsed = buttonId;\r", + " }\r", + " }\r", + " }\r", + " return false;\r", + " }\r", + "}();\r", + "\r", + "function onScenePostEvents() {\r", + " /** @type {Gamepad[]} */\r", + " const gamepads = navigator.getGamepads ? navigator.getGamepads() : [];\r", + " for (let playerId = 0; playerId < gamepads.length; playerId++) {\r", + " let gamepad = gamepads[playerId];\r", + " if (gamepad == null) {\r", + " // The gamepad is not connected.\r", + " continue;\r", + " }\r", + " const player = getPlayer(playerId);\r", + " const rumble = player.rumble;\r", + " rumble.elapsedTime += runtimeScene.getElapsedTime(runtimeScene) / 1000;\r", + " if (rumble.duration - rumble.elapsedTime <= 0 &&\r", + " (rumble.weakMagnitude || rumble.strongMagnitude)\r", + " ) {\r", + " rumble.weakMagnitude = 0;\r", + " rumble.strongMagnitude = 0;\r", + " }\r", + " }\r", + "}\r", + "\r", + "/**\r", + " * @param {string} type\r", + " * @param {number} buttonId\r", + " */\r", + "function getInputString(type, buttonId) {\r", + " if (!controllerButtonNames[type]) {\r", + " return \"UNKNOWN_BUTTON\";\r", + " }\r", + " return controllerButtonNames[type][buttonId];\r", + "}\r", + "\r", + "function getButtonId(buttonName) {\r", + " switch (buttonName) {\r", + " case 'A':\r", + " case 'CROSS':\r", + " return 0;\r", + " case 'B':\r", + " case 'CIRCLE':\r", + " return 1;\r", + " case 'X':\r", + " case 'SQUARE':\r", + " return 2;\r", + " case 'Y':\r", + " case 'TRIANGLE':\r", + " return 3;\r", + " case 'LB':\r", + " case 'L1':\r", + " return 4;\r", + " case 'RB':\r", + " case 'R1':\r", + " return 5;\r", + " case 'LT':\r", + " case 'L2':\r", + " return 6;\r", + " case 'RT':\r", + " case 'R2':\r", + " return 7;\r", + " case 'UP':\r", + " return 12;\r", + " case 'DOWN':\r", + " return 13;\r", + " case 'LEFT':\r", + " return 14;\r", + " case 'RIGHT':\r", + " return 15;\r", + " case 'BACK':\r", + " case 'SHARE':\r", + " return 8;\r", + " case 'START':\r", + " case 'OPTIONS':\r", + " return 9;\r", + " case 'CLICK_STICK_LEFT':\r", + " return 10;\r", + " case 'CLICK_STICK_RIGHT':\r", + " return 11;\r", + " //PS4\r", + " case 'PS_BUTTON':\r", + " return 16;\r", + " case 'CLICK_TOUCHPAD':\r", + " return 17;\r", + " default:\r", + " console.error('The gamepad button: ' + buttonName + ' is not valid.');\r", + " return null;\r", + " }\r", + "}\r", + "\r", + "/**\r", + " * @param {number} playerId\r", + " * @param {string} directionName\r", + " * @param {number} axisValueX\r", + " * @param {number} axisValueY\r", + " */\r", + "function isAxisPushed(playerId, directionName, axisValueX, axisValueY) {\r", + " switch (directionName) {\r", + " case 'LEFT':\r", + " return getNormalizedAxisValue(axisValueX, playerId) < 0;\r", + " case 'RIGHT':\r", + " return getNormalizedAxisValue(axisValueX, playerId) > 0;\r", + " case 'UP':\r", + " return getNormalizedAxisValue(axisValueY, playerId) < 0;\r", + " case 'DOWN':\r", + " return getNormalizedAxisValue(axisValueY, playerId) > 0;\r", + " case 'ANY':\r", + " return getNormalizedAxisValue(axisValueX, playerId) < 0\r", + " || getNormalizedAxisValue(axisValueX, playerId) > 0\r", + " || getNormalizedAxisValue(axisValueY, playerId) < 0\r", + " || getNormalizedAxisValue(axisValueY, playerId) > 0\r", + " default:\r", + " console.error('The value stick direction is not valid.');\r", + " return false;\r", + " }\r", + "}\r", + "\r", + "/**\r", + " * @param {number} deltaX\r", + " * @param {number} deltaY\r", + " */\r", + "function axisToAngle(deltaX, deltaY) {\r", " const rad = Math.atan2(deltaY, deltaX);\r", " const deg = rad * (180 / Math.PI);\r", " return deg;\r", "}\r", "\r", - "gdjs._extensionController.isXbox = function (gamepad) {\r", + "/**\r", + " * @param {{id: string}} gamepad\r", + " */\r", + "function isXbox(gamepad) {\r", " return (gamepad ? (\r", " gamepad.id.toUpperCase().indexOf(\"XBOX\") !== -1\r", " // \"XINPUT\" cannot be used to check if it is a xbox controller is just a generic\r", @@ -6371,44 +6903,52 @@ " ) : false);\r", "}\r", "\r", - "//Returns the new value taking into account the dead zone for the player_ID given\r", - "gdjs._extensionController.getNormalizedAxisValue = function (v, player_ID) {\r", + "/**\r", + " * Returns the new value taking into account the dead zone for the player_ID given\r", + " * @param {number} value\r", + " * @param {number} playerID\r", + " */\r", + "function getNormalizedAxisValue(value, playerID) {\r", " // gdjs._extensionController = gdjs._extensionController || { deadzone: 0.2 };\r", "\r", " // Anything smaller than this is assumed to be 0,0\r", - " const DEADZONE = gdjs._extensionController.players[player_ID].deadzone;\r", - "\r", - " if (Math.abs(v) < DEADZONE) {\r", - " // In the dead zone, set to 0\r", - " v = 0;\r", - "\r", - " if (v == null) {\r", - " return 0;\r", - " } else {\r", - " return v;\r", - " }\r", + " const deadzone = getPlayer(playerID).deadzone;\r", "\r", + " if (Math.abs(value) < deadzone) {\r", + " return 0;\r", " } else {\r", " // We're outside the dead zone, but we'd like to smooth\r", " // this value out so it still runs nicely between 0..1.\r", " // That is, we don't want it to jump suddenly from 0 to\r", - " // DEADZONE.\r", + " // deadzone.\r", "\r", - " // Remap v from\r", - " // DEADZONE..1 to 0..(1-DEADZONE)\r", + " // Remap value from\r", + " // deadzone..1 to 0..(1-deadzone)\r", " // or from\r", - " // -1..-DEADZONE to -(1-DEADZONE)..0\r", - "\r", - " v = v - Math.sign(v) * DEADZONE;\r", + " // -1..-deadzone to -(1-deadzone)..0\r", + " value = value - Math.sign(value) * deadzone;\r", "\r", - " // Remap v from\r", - " // 0..(1-DEADZONE) to 0..1\r", + " // Remap value from\r", + " // 0..(1-deadzone) to 0..1\r", " // or from\r", - " // -(1-DEADZONE)..0 to -1..0\r", - "\r", - " return v / (1 - DEADZONE);\r", + " // -(1-deadzone)..0 to -1..0\r", + " return value / (1 - deadzone);\r", " }\r", - "};" + "}\r", + "\r", + "gdjs._extensionController = {\r", + " getPlayer,\r", + " controllerButtonNames,\r", + " getInputString,\r", + " getButtonId,\r", + " axisToAngle,\r", + " isXbox,\r", + " getNormalizedAxisValue,\r", + " isAxisPushed,\r", + " getGamepad,\r", + " onScenePostEvents,\r", + " frameBeginningTask,\r", + "}" ], "parameterObjects": "", "useStrict": true, @@ -6421,59 +6961,35 @@ { "fullName": "", "functionType": "Action", - "name": "onScenePostEvents", + "name": "onSceneLoaded", "sentence": "", "events": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [] - }, + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "// Async tasks are run before everything.\r", + "// This is a hack to make sure that button states are updated\r", + "// before mapping behavior events.\r", + "runtimeScene.getAsyncTasksManager().addTask(gdjs._extensionController.frameBeginningTask);" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "Action", + "name": "onScenePostEvents", + "sentence": "", + "events": [ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "//Each time a player press a button i save the last button pressed for the next frame", - "/** @type {Gamepad[]} */", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);", - "", - "//Get function parameter", - "let countPlayers = Object.keys(gdjs._extensionController.players).length;", - "", - "//Repeat for each players", - "for (let i = 0; i < countPlayers; i++) {", - " let gamepad = gamepads[i]; // Get the gamepad of the player", - "", - " //We have to keep this condition because if the user hasn't plugged in his controller yet, we can't get the controller in the gamepad variable.", - " if (gamepad == null) {", - " continue;", - " }", - "", - " for (let b = 0; b < Object.keys(gamepad.buttons).length; b++) { //For each buttons", - " if (gamepad.buttons[b].pressed) { //One of them is pressed", - " gdjs._extensionController.players[i].lastButtonUsed = b; //Save the button pressed", - "", - " //Save the state of the button for the next frame.", - " gdjs._extensionController.players[i].previousFrameStateButtons[b] = { pressed: true };", - "", - " // Update Last Active Controller", - " gdjs._extensionController.lastActiveController = i;", - " } else {", - " gdjs._extensionController.players[i].previousFrameStateButtons[b] = { pressed: false };", - " }", - " }", - "", - "", - " gdjs._extensionController.players[i].rumble.elapsedTime += runtimeScene.getElapsedTime(runtimeScene) / 1000;", - " if (", - " gdjs._extensionController.players[i].rumble.duration - gdjs._extensionController.players[i].rumble.elapsedTime <= 0 &&", - " (gdjs._extensionController.players[i].rumble.weakMagnitude || gdjs._extensionController.players[i].rumble.strongMagnitude)", - " ) {", - " gdjs._extensionController.players[i].rumble.weakMagnitude = 0;", - " gdjs._extensionController.players[i].rumble.strongMagnitude = 0;", - " }", - "", - "", - "}", + "gdjs._extensionController.onScenePostEvents();", "" ], "parameterObjects": "", @@ -6911,27 +7427,20 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", "\r", - "//Get function parameters\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", - "const trigger = eventsFunctionContext.getArgument(\"trigger\").toUpperCase();\r", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "const trigger = eventsFunctionContext.getArgument(\"Trigger\").toUpperCase();\r", "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier in expression: \"Pressure on a gamepad trigger\", is not valid number, must be between 0 and 4.');\r", - " return;\r", - "}\r", "if (trigger != \"LT\" && trigger != \"RT\" && trigger != \"L2\" && trigger != \"R2\") {\r", " console.error('Parameter trigger is not valid in expression: \"Pressure on a gamepad trigger\"');\r", " return;\r", "}\r", - "\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", - "if (gamepad == null) return;\r", - "\r", + "/** @type {Gamepad} */\r", + "const gamepad = gdjs._extensionController.getGamepad(playerId);\r", + "if (!gamepad) {\r", + " // The gamepad is not connected.\r", + " return;\r", + "}\r", "switch (trigger) {\r", " case 'LT':\r", " case 'L2':\r", @@ -6959,12 +7468,12 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" }, { "description": "Trigger button", - "name": "trigger", + "name": "Trigger", "supplementaryInformation": "[\"LT\",\"RT\",\"L2\",\"R2\"]", "type": "stringWithSelector" } @@ -6981,43 +7490,28 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", - "\r", - "//Get function parameters\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", - "const stick = eventsFunctionContext.getArgument(\"stick\").toUpperCase();\r", + "const { getNormalizedAxisValue } = gdjs._extensionController;\r", "\r", - "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier is not valid in expression: \"Value of a stick force\"');\r", - " return;\r", - "}\r", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "const stick = eventsFunctionContext.getArgument(\"Stick\").toUpperCase();\r", "\r", "if (stick !== \"LEFT\" && stick !== \"RIGHT\") {\r", " console.error('Parameter stick is not valid in expression: \"Value of a stick force\"');\r", " return;\r", "}\r", + "/** @type {Gamepad} */\r", + "const gamepad = gdjs._extensionController.getGamepad(playerId);\r", + "if (!gamepad) {\r", + " // The gamepad is not connected.\r", + " return;\r", + "}\r", + "const axisValueX = stick === 'RIGHT' ? gamepad.axes[2] : gamepad.axes[0];\r", + "const axisValueY = stick === 'RIGHT' ? gamepad.axes[3] : gamepad.axes[1];\r", "\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", - "if (gamepad == null) return;\r", - "\r", - "\r", - "switch (stick) {\r", - " case 'LEFT':\r", - " eventsFunctionContext.returnValue = gdjs.evtTools.common.clamp(Math.abs(gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[0], playerId)) + Math.abs(gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[1], playerId)), 0, 1);\r", - " break;\r", - "\r", - " case 'RIGHT':\r", - " eventsFunctionContext.returnValue = gdjs.evtTools.common.clamp(Math.abs(gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[2], playerId)) + Math.abs(gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[3], playerId)), 0, 1);\r", - " break;\r", - "\r", - " default:\r", - " eventsFunctionContext.returnValue = -1;\r", - " break;\r", - "}" + "eventsFunctionContext.returnValue = gdjs.evtTools.common.clamp(\r", + " Math.abs(getNormalizedAxisValue(axisValueX, playerId)) +\r", + " Math.abs(getNormalizedAxisValue(axisValueY, playerId)), 0, 1);\r", + "" ], "parameterObjects": "", "useStrict": true, @@ -7030,12 +7524,12 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" }, { "description": "Stick: \"Left\" or \"Right\"", - "name": "stick", + "name": "Stick", "supplementaryInformation": "[\"Left\",\"Right\"]", "type": "stringWithSelector" } @@ -7059,7 +7553,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "Gamepads::StickAngle(player_ID, stick)" + "Gamepads::StickAngle(PlayerId, Stick)" ] } ] @@ -7071,12 +7565,12 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" }, { "description": "Stick: \"Left\" or \"Right\"", - "name": "stick", + "name": "Stick", "supplementaryInformation": "[\"Left\",\"Right\"]", "type": "stringWithSelector" } @@ -7093,40 +7587,27 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", - "\r", - "//Get function parameters\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", - "const stick = eventsFunctionContext.getArgument(\"stick\").toUpperCase();\r", + "const { getNormalizedAxisValue } = gdjs._extensionController;\r", "\r", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "const stick = eventsFunctionContext.getArgument(\"Stick\").toUpperCase();\r", "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier is not valid in expression: \"Value of a stick rotation\"');\r", - " return;\r", - "}\r", "if (stick !== \"LEFT\" && stick !== \"RIGHT\") {\r", " console.error('Parameter stick is not valid in expression: \"Value of a stick rotation\"');\r", " return;\r", "}\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", - "if (gamepad == null) return;\r", - "\r", - "switch (stick) {\r", - " case 'LEFT':\r", - " eventsFunctionContext.returnValue = gdjs._extensionController.axisToAngle(gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[0], playerId), gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[1], playerId));\r", - " break;\r", - "\r", - " case 'RIGHT':\r", - " eventsFunctionContext.returnValue = gdjs._extensionController.axisToAngle(gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[2], playerId), gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[3], playerId));\r", - " break;\r", + "/** @type {Gamepad} */\r", + "const gamepad = gdjs._extensionController.getGamepad(playerId);\r", + "if (!gamepad) {\r", + " // The gamepad is not connected.\r", + " return;\r", + "}\r", + "const axisValueX = stick === 'RIGHT' ? gamepad.axes[2] : gamepad.axes[0];\r", + "const axisValueY = stick === 'RIGHT' ? gamepad.axes[3] : gamepad.axes[1];\r", "\r", - " default:\r", - " eventsFunctionContext.returnValue = -1;\r", - " break;\r", - "}" + "eventsFunctionContext.returnValue = gdjs._extensionController.axisToAngle(\r", + " getNormalizedAxisValue(axisValueX, playerId),\r", + " getNormalizedAxisValue(axisValueY, playerId));" ], "parameterObjects": "", "useStrict": true, @@ -7139,12 +7620,12 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" }, { "description": "Stick: \"Left\" or \"Right\"", - "name": "stick", + "name": "Stick", "supplementaryInformation": "[\"Left\",\"Right\"]", "type": "stringWithSelector" } @@ -7162,18 +7643,11 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", "\r", - "//Get function parameters\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", "const stick = eventsFunctionContext.getArgument(\"stick\").toUpperCase();\r", "const direction = eventsFunctionContext.getArgument(\"direction\").toUpperCase();\r", "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier is not valid in expression: \"Value of a gamepad axis\"');\r", - " return;\r", - "}\r", "if (stick != \"LEFT\" && stick != \"RIGHT\") {\r", " console.error('Parameter stick is not valid in expression: \"Value of a gamepad axis\"');\r", " return;\r", @@ -7182,11 +7656,12 @@ " console.error('Parameter direction is not valid in expression: \"Value of a gamepad axis\"');\r", " return;\r", "}\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", - "if (gamepad == null) return;\r", - "\r", + "/** @type {Gamepad} */\r", + "const gamepad = gdjs._extensionController.getGamepad(playerId);\r", + "if (!gamepad) {\r", + " // The gamepad is not connected.\r", + " return;\r", + "}\r", "let parameterError = false;\r", "switch (stick) {\r", " case 'LEFT':\r", @@ -7283,7 +7758,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" }, { @@ -7311,26 +7786,20 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", "\r", - "//Get function parameters\r", "const playerId = eventsFunctionContext.getArgument(\"Gamepad\") - 1;\r", "const stick = eventsFunctionContext.getArgument(\"Stick\").toLowerCase();\r", "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier is not valid in expression: \"Value of a gamepad axis\"');\r", - " return;\r", - "}\r", "if (stick != \"left\" && stick != \"right\") {\r", " console.error('Parameter stick is not valid in expression: \"Value of a gamepad axis\"');\r", " return;\r", "}\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", - "if (gamepad == null) return;\r", - "\r", + "/** @type {Gamepad} */\r", + "const gamepad = gdjs._extensionController.getGamepad(playerId);\r", + "if (!gamepad) {\r", + " // The gamepad is not connected.\r", + " return;\r", + "}\r", "const axisIndex = stick === 'right' ? 2 : 0;\r", "eventsFunctionContext.returnValue = gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[axisIndex], playerId);\r", "" @@ -7368,26 +7837,20 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", "\r", - "//Get function parameters\r", "const playerId = eventsFunctionContext.getArgument(\"Gamepad\") - 1;\r", "const stick = eventsFunctionContext.getArgument(\"Stick\").toLowerCase();\r", "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier is not valid in expression: \"Value of a gamepad axis\"');\r", - " return;\r", - "}\r", "if (stick != \"left\" && stick != \"right\") {\r", " console.error('Parameter stick is not valid in expression: \"Value of a gamepad axis\"');\r", " return;\r", "}\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", - "if (gamepad == null) return;\r", - "\r", + "/** @type {Gamepad} */\r", + "const gamepad = gdjs._extensionController.getGamepad(playerId);\r", + "if (!gamepad) {\r", + " // The gamepad is not connected.\r", + " return;\r", + "}\r", "const axisIndex = stick === 'right' ? 3 : 1;\r", "eventsFunctionContext.returnValue = gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[axisIndex], playerId);\r", "" @@ -7425,136 +7888,57 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", "\r", - "//Get function parameters\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", - "const button = eventsFunctionContext.getArgument(\"button\").toUpperCase();\r", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "const button = eventsFunctionContext.getArgument(\"Button\").toUpperCase();\r", "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier in condition: \"Gamepad button released\", is not valid number, must be between 0 and 4.');\r", - " return;\r", - "}\r", - "if (button === \"\") {\r", - " console.error('Parameter button is not valid in condition: \"Gamepad button released\"');\r", + "let buttonId = gdjs._extensionController.getButtonId(button);\r", + "if (buttonId === null) {\r", " return;\r", "}\r", + "const player = gdjs._extensionController.getPlayer(playerId)\r", + "eventsFunctionContext.returnValue = player.isButtonReleased(buttonId);" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "parameters": [ + { + "description": "The gamepad identifier: 1, 2, 3 or 4", + "name": "PlayerId", + "type": "expression" + }, + { + "description": "Name of the button", + "name": "Button", + "supplementaryInformation": "[\"A\",\"Cross\",\"B\",\"Circle\",\"X\",\"Square\",\"Y\",\"Triangle\",\"LB\",\"L1\",\"RB\",\"R1\",\"LT\",\"L2\",\"RT\",\"R2\",\"Up\",\"Down\",\"Left\",\"Right\",\"Back\",\"Share\",\"Start\",\"Options\",\"Click_Stick_Left\",\"Click_Stick_Right\",\"PS_Button\",\"Click_Touchpad\"]", + "type": "stringWithSelector" + } + ], + "objectGroups": [] + }, + { + "description": "Check if a button was just pressed on a gamepad. Buttons can be:\n* Xbox: \"A\", \"B\", \"X\", \"Y\", \"LB\", \"RB\", \"LT\", \"RT\", \"BACK\", \"START\",\n* PS4: \"CROSS\", \"SQUARE\", \"CIRCLE\", \"TRIANGLE\", \"L1\", \"L2\", \"R1\", \"R2\", \"SHARE\", \"OPTIONS\", \"PS_BUTTON\", \"CLICK_TOUCHPAD\",\n* Other: \"UP\", \"DOWN\", \"LEFT\", \"RIGHT\", \"CLICK_STICK_LEFT\", \"CLICK_STICK_RIGHT\".", + "fullName": "Gamepad button just pressed", + "functionType": "Condition", + "name": "IsButtonJustPressed", + "sentence": "Button _PARAM2_ of gamepad _PARAM1_ was just pressed", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ "\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", - "if (gamepad == null) return;\r", - "\r", - "let buttonId;\r", - "\r", - "switch (button) {\r", - " case 'A':\r", - " case 'CROSS':\r", - " buttonId = 0;\r", - " break;\r", - " case 'B':\r", - " case 'CIRCLE':\r", - " buttonId = 1;\r", - " break;\r", - " case 'X':\r", - " case 'SQUARE':\r", - " buttonId = 2;\r", - " break;\r", - " case 'Y':\r", - " case 'TRIANGLE':\r", - " buttonId = 3;\r", - " break;\r", - " case 'LB':\r", - " case 'L1':\r", - " buttonId = 4;\r", - " break;\r", - " case 'RB':\r", - " case 'R1':\r", - " buttonId = 5;\r", - " break;\r", - " case 'LT':\r", - " case 'L2':\r", - " buttonId = 6;\r", - " break;\r", - " case 'RT':\r", - " case 'R2':\r", - " buttonId = 7;\r", - " break;\r", - "\r", - " case 'UP':\r", - " buttonId = 12;\r", - " break;\r", - " case 'DOWN':\r", - " buttonId = 13;\r", - " break;\r", - " case 'LEFT':\r", - " buttonId = 14;\r", - " break;\r", - " case 'RIGHT':\r", - " buttonId = 15;\r", - " break;\r", - "\r", - " case 'BACK':\r", - " case 'SHARE':\r", - " buttonId = 8;\r", - " break;\r", - " case 'START':\r", - " case 'OPTIONS':\r", - " buttonId = 9;\r", - " break;\r", - "\r", - " case 'CLICK_STICK_LEFT':\r", - " buttonId = 10;\r", - " break;\r", - " case 'CLICK_STICK_RIGHT':\r", - " buttonId = 11;\r", - " break;\r", - "\r", - " //PS4\r", - " case 'PS_BUTTON':\r", - " buttonId = 16;\r", - " break;\r", - " case 'CLICK_TOUCHPAD':\r", - " buttonId = 17;\r", - " break;\r", - "\r", - " default:\r", - " console.error('The button: ' + button + ' in condition: \"Gamepad button released\" is not valid.');\r", - " break;\r", - "}\r", - "\r", - "if (buttonId === undefined) {\r", - " console.error('There is no buttons valid in condition: \"Gamepad button released\"');\r", - " eventsFunctionContext.returnValue = false;\r", - " return;\r", - "}\r", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "const button = eventsFunctionContext.getArgument(\"Button\").toUpperCase();\r", "\r", - "if (gamepad.buttons == null || gamepad.buttons[buttonId] == null) {\r", - " console.error('Buttons on the gamepad are not accessible in condition: \"Gamepad button released\"');\r", - " eventsFunctionContext.returnValue = false;\r", + "let buttonId = gdjs._extensionController.getButtonId(button);\r", + "if (buttonId === null) {\r", " return;\r", "}\r", - "\r", - "//Define default value on pressed button or use previous value\r", - "gdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId] = gdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId] || { pressed: false };\r", - "\r", - "//Get state of button at previous frame\r", - "const previousStateButton = gdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId].pressed;\r", - "\r", - "//When previousStateButton is true and actual button state is not pressed\r", - "//Player have release the button\r", - "if (previousStateButton === true && gamepad.buttons[buttonId].pressed === false) {\r", - " // Save the last button used for the player \r", - " gdjs._extensionController.players[playerId].lastButtonUsed = buttonId;\r", - " gdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId].pressed = true;\r", - " eventsFunctionContext.returnValue = true;\r", - "\r", - "} else {\r", - " gdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId].pressed = false;\r", - " eventsFunctionContext.returnValue = false;\r", - "}\r", - "" + "const player = gdjs._extensionController.getPlayer(playerId)\r", + "eventsFunctionContext.returnValue = player.isButtonJustPressed(buttonId);" ], "parameterObjects": "", "useStrict": true, @@ -7564,12 +7948,12 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" }, { "description": "Name of the button", - "name": "button", + "name": "Button", "supplementaryInformation": "[\"A\",\"Cross\",\"B\",\"Circle\",\"X\",\"Square\",\"Y\",\"Triangle\",\"LB\",\"L1\",\"RB\",\"R1\",\"LT\",\"L2\",\"RT\",\"R2\",\"Up\",\"Down\",\"Left\",\"Right\",\"Back\",\"Share\",\"Start\",\"Options\",\"Click_Stick_Left\",\"Click_Stick_Right\",\"PS_Button\",\"Click_Touchpad\"]", "type": "stringWithSelector" } @@ -7586,17 +7970,9 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "//Get function parameter\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", "\r", - "//Player id is not valid\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier in expression: \"Last pressed button (id)\", is not valid number, must be between 0 and 4.');\r", - " return;\r", - "}\r", - "\r", - "//Return the last button used by the player\r", - "eventsFunctionContext.returnValue = gdjs._extensionController.players[playerId].lastButtonUsed;" + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "eventsFunctionContext.returnValue = gdjs._extensionController.getPlayer(playerId).lastButtonUsed;" ], "parameterObjects": "", "useStrict": true, @@ -7609,7 +7985,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" } ], @@ -7625,46 +8001,10 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", - "\r", - "//Get function parameter\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", - "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier in condition: \"Any gamepad button pressed\", is not valid number, must be between 0 and 4.');\r", - " return;\r", - "}\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", - "if (gamepad == null) return;\r", - "\r", - "let buttonId;\r", - "for (let i = 0; i < gamepad.buttons.length; i++) { //For each buttons\r", - " if (gamepad.buttons[i].pressed) { //One of them is pressed\r", - " buttonId = i; //Save the button pressed\r", - " break;\r", - " }\r", - "}\r", - "\r", - "if (buttonId === undefined) {\r", - " // No buttons are pressed.\r", - " eventsFunctionContext.returnValue = false;\r", - " return;\r", - "}\r", - "\r", - "if (gamepad.buttons == null || gamepad.buttons[buttonId] == null) {\r", - " console.error('Buttons on the gamepad are not accessible in condition: \"Any gamepad button pressed\"');\r", - " eventsFunctionContext.returnValue = false;\r", - " return;\r", - "}\r", - "\r", - "//When a button is pressed, save the button in lastButtonUsed for each players\r", - "if (gamepad.buttons[buttonId].pressed) gdjs._extensionController.players[playerId].lastButtonUsed = buttonId;\r", - "eventsFunctionContext.returnValue = gamepad.buttons[buttonId].pressed;\r", - "\r", "\r", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "const player = gdjs._extensionController.getPlayer(playerId)\r", + "eventsFunctionContext.returnValue = player.isAnyButtonPressed();\r", "" ], "parameterObjects": "", @@ -7675,7 +8015,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" } ], @@ -7691,35 +8031,18 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", "\r", - "//Get function parameters\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", "const controllerType = eventsFunctionContext.getArgument(\"controller_type\").toUpperCase();\r", - "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier in string expression: \"Last pressed button (LastButtonString)\", is not valid number, must be between 0 and 4.');\r", - " return;\r", - "}\r", - "if (controllerType === \"\") {\r", - " console.error('Parameter controller type is not valid in string expression: \"Last pressed button (LastButtonString)\"');\r", + "/** @type {Gamepad} */\r", + "const gamepad = gdjs._extensionController.getGamepad(playerId);\r", + "if (!gamepad) {\r", + " // The gamepad is not connected.\r", " return;\r", "}\r", - "\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "if (gamepad !== null) { //Gamepad exist\r", - " //Get last btn id\r", - " const lastButtonUsedID = gdjs._extensionController.players[playerId].lastButtonUsed;\r", - "\r", - " //Return last button as string \r", - " eventsFunctionContext.returnValue = gdjs._extensionController.getInputString(controllerType, lastButtonUsedID);\r", - "\r", - "} else { //Gamepad dosen't exist\r", - " console.error('Your controller is not supported or the gamepad wasn\\'t detected in string expression: \"Last pressed button (LastButtonString)\"');\r", - " eventsFunctionContext.returnValue = \"Gamepad not connected\";\r", - "}" + "const lastButtonUsedID = gdjs._extensionController.getPlayer(playerId).lastButtonUsed;\r", + "eventsFunctionContext.returnValue = gdjs._extensionController.getInputString(controllerType, lastButtonUsedID);\r", + "" ], "parameterObjects": "", "useStrict": true, @@ -7732,7 +8055,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" }, { @@ -7754,20 +8077,16 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", "\r", - "//Get the last activated controller\r", - "const controllerId = gdjs._extensionController.lastActiveController;\r", - "\r", - "// Check if controller is active\r", - "const gamepad = gamepads[controllerId];\r", - "if (gamepad == null) {\r", - " eventsFunctionContext.returnValue = 0;\r", - "} else {\r", - " // Return active controller id\r", - " eventsFunctionContext.returnValue = controllerId + 1;\r", + "const gamepads = navigator.getGamepads ? navigator.getGamepads() : [];\r", + "let lastGamepadIndex = -1;\r", + "for (let playerId = 0; playerId < gamepads.length; playerId++) {\r", + " // Gamepads can be disconnected and become null\r", + " if (gamepads[playerId]) {\r", + " lastGamepadIndex = playerId\r", + " }\r", "}\r", - "" + "eventsFunctionContext.returnValue = lastGamepadIndex + 1;" ], "parameterObjects": "", "useStrict": true, @@ -7790,127 +8109,16 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", "\r", - "//Get function parameters\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", "const button = eventsFunctionContext.getArgument(\"button\").toUpperCase();\r", "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier in condition: \"Gamepad button pressed\", is not valid number, must be between 0 and 4.');\r", - " return;\r", - "}\r", - "if (button === \"\") {\r", - " console.error('Parameter button is not valid in condition: \"Gamepad button pressed\"');\r", - " eventsFunctionContext.returnValue = false;\r", + "const buttonId = gdjs._extensionController.getButtonId(button);\r", + "if (buttonId === null) {\r", " return;\r", "}\r", - "\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", - "if (gamepad == null) return;\r", - "\r", - "let buttonId;\r", - "\r", - "switch (button) {\r", - " case 'A':\r", - " case 'CROSS':\r", - " buttonId = 0;\r", - " break;\r", - " case 'B':\r", - " case 'CIRCLE':\r", - " buttonId = 1;\r", - " break;\r", - " case 'X':\r", - " case 'SQUARE':\r", - " buttonId = 2;\r", - " break;\r", - " case 'Y':\r", - " case 'TRIANGLE':\r", - " buttonId = 3;\r", - " break;\r", - " case 'LB':\r", - " case 'L1':\r", - " buttonId = 4;\r", - " break;\r", - " case 'RB':\r", - " case 'R1':\r", - " buttonId = 5;\r", - " break;\r", - " case 'LT':\r", - " case 'L2':\r", - " buttonId = 6;\r", - " break;\r", - " case 'RT':\r", - " case 'R2':\r", - " buttonId = 7;\r", - " break;\r", - "\r", - " case 'UP':\r", - " buttonId = 12;\r", - " break;\r", - " case 'DOWN':\r", - " buttonId = 13;\r", - " break;\r", - " case 'LEFT':\r", - " buttonId = 14;\r", - " break;\r", - " case 'RIGHT':\r", - " buttonId = 15;\r", - " break;\r", - "\r", - " case 'BACK':\r", - " case 'SHARE':\r", - " buttonId = 8;\r", - " break;\r", - " case 'START':\r", - " case 'OPTIONS':\r", - " buttonId = 9;\r", - " break;\r", - "\r", - " case 'CLICK_STICK_LEFT':\r", - " buttonId = 10;\r", - " break;\r", - " case 'CLICK_STICK_RIGHT':\r", - " buttonId = 11;\r", - " break;\r", - "\r", - " //PS4\r", - " case 'PS_BUTTON':\r", - " buttonId = 16;\r", - " break;\r", - " case 'CLICK_TOUCHPAD':\r", - " buttonId = 17;\r", - " break;\r", - "\r", - " default:\r", - " console.error('The button: ' + button + ' in condition: \"Gamepad button pressed\" is not valid.');\r", - " eventsFunctionContext.returnValue = false;\r", - " break;\r", - "}\r", - "\r", - "\r", - "\r", - "if (buttonId === undefined) {\r", - " console.error('There is no buttons valid in condition: \"Gamepad button pressed\"');\r", - " eventsFunctionContext.returnValue = false;\r", - " return;\r", - "}\r", - "\r", - "if (gamepad.buttons == null || gamepad.buttons[buttonId] == null) {\r", - " console.error('Buttons on the gamepad are not accessible in condition: \"Gamepad button pressed\"');\r", - " eventsFunctionContext.returnValue = false;\r", - " return;\r", - "}\r", - "\r", - "//When a button is pressed, save the button in lastButtonUsed for each players\r", - "if (gamepad.buttons[buttonId].pressed) gdjs._extensionController.players[playerId].lastButtonUsed = buttonId;\r", - "eventsFunctionContext.returnValue = gamepad.buttons[buttonId].pressed;\r", - "\r", - "\r", - "\r", + "const player = gdjs._extensionController.getPlayer(playerId)\r", + "eventsFunctionContext.returnValue = player.isButtonPressed(buttonId);\r", "" ], "parameterObjects": "", @@ -7921,7 +8129,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" }, { @@ -7948,15 +8156,9 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "//Get function parameter\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier in expression: \"Gamepad deadzone for sticks\", is not valid number, must be between 0 and 4.');\r", - " return;\r", - "}\r", - "///Return the deadzone value for a given player\r", - "eventsFunctionContext.returnValue = gdjs._extensionController.players[playerId].deadzone;" + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "eventsFunctionContext.returnValue = gdjs._extensionController.getPlayer(playerId).deadzone;" ], "parameterObjects": "", "useStrict": true, @@ -7969,7 +8171,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" } ], @@ -7985,18 +8187,12 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "//Get function parameter\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", - "const newDeadzone = eventsFunctionContext.getArgument(\"deadzone\");\r", "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier in action: \"Set gamepad deadzone for sticks\", is not valid, must be between 0 and 4.');\r", - " return;\r", - "}\r", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "const newDeadzone = eventsFunctionContext.getArgument(\"deadzone\");\r", "\r", - "// clamp the newDeadzone in range [0, 1].\r", "// https://github.com/4ian/GDevelop-extensions/pull/33#issuecomment-618224857\r", - "gdjs._extensionController.players[playerId].deadzone = gdjs.evtTools.common.clamp(newDeadzone, 0, 1);\r", + "gdjs._extensionController.getPlayer(playerId).deadzone = gdjs.evtTools.common.clamp(newDeadzone, 0, 1);\r", "" ], "parameterObjects": "", @@ -8007,7 +8203,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" }, { @@ -8028,141 +8224,28 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", "\r", - "//Get function parameters\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", "const stick = eventsFunctionContext.getArgument(\"stick\").toUpperCase();\r", "const direction = eventsFunctionContext.getArgument(\"direction\").toUpperCase();\r", "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier in condition: \"Gamepad stick pushed (axis)\", is not valid number, must be between 0 and 4.');\r", - " return;\r", - "}\r", "if (stick != \"LEFT\" && stick != \"RIGHT\") {\r", " console.error('Parameter stick in condition: \"Gamepad stick pushed (axis)\", is not valid, must be LEFT or RIGHT');\r", " return;\r", "}\r", "if (direction != \"UP\" && direction != \"DOWN\" && direction != \"LEFT\" && direction != \"RIGHT\" && direction != \"ANY\") {\r", - " console.error('Parameter deadzone in condition: \"Gamepad stick pushed (axis)\", is not valid, must be UP, DOWN, LEFT or RIGHT');\r", + " console.error('Parameter direction in condition: \"Gamepad stick pushed (axis)\", is not valid, must be UP, DOWN, LEFT or RIGHT');\r", " return;\r", "}\r", - "\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", - "if (gamepad == null) {\r", - " eventsFunctionContext.returnValue = false;\r", + "/** @type {Gamepad} */\r", + "const gamepad = gdjs._extensionController.getGamepad(playerId);\r", + "if (!gamepad) {\r", + " // The gamepad is not connected.\r", " return;\r", "}\r", - "\r", - "\r", - "//Define in onFirstSceneLoaded function\r", - "const getNormalizedAxisValue = gdjs._extensionController.getNormalizedAxisValue;\r", - "\r", - "switch (stick) {\r", - " case 'LEFT':\r", - " switch (direction) {\r", - " case 'LEFT':\r", - " if (getNormalizedAxisValue(gamepad.axes[0], playerId) < 0) {\r", - " eventsFunctionContext.returnValue = true;\r", - " return;\r", - " }\r", - " break;\r", - "\r", - " case 'RIGHT':\r", - " if (getNormalizedAxisValue(gamepad.axes[0], playerId) > 0) {\r", - " eventsFunctionContext.returnValue = true;\r", - " return;\r", - " }\r", - " break;\r", - "\r", - " case 'UP':\r", - " if (getNormalizedAxisValue(gamepad.axes[1], playerId) < 0) {\r", - " eventsFunctionContext.returnValue = true;\r", - " return;\r", - " }\r", - " break;\r", - "\r", - " case 'DOWN':\r", - " if (getNormalizedAxisValue(gamepad.axes[1], playerId) > 0) {\r", - " eventsFunctionContext.returnValue = true;\r", - " return;\r", - " }\r", - " break;\r", - "\r", - " case 'ANY':\r", - " if ( getNormalizedAxisValue(gamepad.axes[0], playerId) < 0\r", - " || getNormalizedAxisValue(gamepad.axes[0], playerId) > 0\r", - " || getNormalizedAxisValue(gamepad.axes[1], playerId) < 0 \r", - " || getNormalizedAxisValue(gamepad.axes[1], playerId) > 0) {\r", - " eventsFunctionContext.returnValue = true;\r", - " return;\r", - " }\r", - " break;\r", - "\r", - " default:\r", - " console.error('The value Direction on stick Left on the condition: \"Gamepad stick pushed (axis)\" is not valid.');\r", - " eventsFunctionContext.returnValue = false;\r", - " break;\r", - " }\r", - " break;\r", - "\r", - " case 'RIGHT':\r", - " switch (direction) {\r", - " case 'LEFT':\r", - " if (getNormalizedAxisValue(gamepad.axes[2], playerId) < 0) {\r", - " eventsFunctionContext.returnValue = true;\r", - " return;\r", - " }\r", - " break;\r", - "\r", - " case 'RIGHT':\r", - " if (getNormalizedAxisValue(gamepad.axes[2], playerId) > 0) {\r", - " eventsFunctionContext.returnValue = true;\r", - " return;\r", - " }\r", - " break;\r", - "\r", - " case 'UP':\r", - " if (getNormalizedAxisValue(gamepad.axes[3], playerId) < 0) {\r", - " eventsFunctionContext.returnValue = true;\r", - " return;\r", - " }\r", - " break;\r", - "\r", - " case 'DOWN':\r", - " if (getNormalizedAxisValue(gamepad.axes[3], playerId) > 0) {\r", - " eventsFunctionContext.returnValue = true;\r", - " return;\r", - " }\r", - " break;\r", - "\r", - " case 'ANY':\r", - " if ( getNormalizedAxisValue(gamepad.axes[2], playerId) < 0\r", - " || getNormalizedAxisValue(gamepad.axes[2], playerId) > 0\r", - " || getNormalizedAxisValue(gamepad.axes[3], playerId) < 0 \r", - " || getNormalizedAxisValue(gamepad.axes[3], playerId) > 0) {\r", - " eventsFunctionContext.returnValue = true;\r", - " return;\r", - " }\r", - " break;\r", - "\r", - " default:\r", - " console.error('The value Direction on stick Right on the condition: \"Gamepad stick pushed (axis)\" is not valid.');\r", - " eventsFunctionContext.returnValue = false;\r", - " break;\r", - " }\r", - " break;\r", - "\r", - " default:\r", - " console.error('The value Stick on the condition: \"Gamepad stick pushed (axis)\" is not valid.');\r", - " eventsFunctionContext.returnValue = false;\r", - " break;\r", - "}\r", - "\r", - "eventsFunctionContext.returnValue = false;\r", + "const axisValueX = stick === 'RIGHT' ? gamepad.axes[2] : gamepad.axes[0];\r", + "const axisValueY = stick === 'RIGHT' ? gamepad.axes[3] : gamepad.axes[1];\r", + "eventsFunctionContext.returnValue = gdjs._extensionController.isAxisPushed(playerId, direction, axisValueX, axisValueY);\r", "" ], "parameterObjects": "", @@ -8173,7 +8256,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" }, { @@ -8193,24 +8276,24 @@ }, { "description": "Return the number of connected gamepads.", - "fullName": "Connected gamepads number", + "fullName": "Connected gamepads count", "functionType": "Expression", "name": "ConnectedGamepadsCount", "sentence": "", "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [] - }, { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", "\r", - "// Gamepads can be disconnected and become null, so we have to filter them.\r", - "eventsFunctionContext.returnValue = Object.keys(gamepads).filter(key => !!gamepads[key]).length;\r", + "const gamepads = navigator.getGamepads ? navigator.getGamepads() : [];\r", + "let connectedGamepadCount = 0;\r", + "for (let playerId = 0; playerId < gamepads.length; playerId++) {\r", + " // Gamepads can be disconnected and become null\r", + " if (gamepads[playerId]) {\r", + " connectedGamepadCount++;\r", + " }\r", + "}\r", + "eventsFunctionContext.returnValue = connectedGamepadCount;\r", "" ], "parameterObjects": "", @@ -8234,22 +8317,13 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);", - "", - "//Get function parameter", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;", - "", - "if (playerId < 0 || playerId > 4) {", - " console.error('Parameter gamepad identifier in string expression: \"Gamepad type\", is not valid number, must be between 0 and 4');", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;", + "/** @type {Gamepad} */", + "const gamepad = gdjs._extensionController.getGamepad(playerId);", + "if (!gamepad) {", + " // The gamepad is not connected.", " return;", "}", - "", - "const gamepad = gamepads[playerId];", - "", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.", - "if (gamepad == null) return;", - "", "eventsFunctionContext.returnValue = (gamepad && gamepad.id) ? gamepad.id : \"No information for player \" + (playerId + 1)", "" ], @@ -8264,7 +8338,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" } ], @@ -8280,28 +8354,14 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);", - "", - "//Get function parameters", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;", "const controllerType = eventsFunctionContext.getArgument(\"controller_type\").toUpperCase();", - "", - "if (playerId < 0 || playerId > 4) {", - " console.error('Parameter gamepad identifier in condition: \"Gamepad type\", is not valid number, must be between 0 and 4.');", + "/** @type {Gamepad} */", + "const gamepad = gdjs._extensionController.getGamepad(playerId);", + "if (!gamepad) {", + " // The gamepad is not connected.", " return;", "}", - "if (controllerType === \"\") {", - " console.error('Parameter type in condition: \"Gamepad type\", is not a string.');", - " return;", - "}", - "", - "const gamepad = gamepads[playerId];", - "", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.", - "if (gamepad == null) return;", - "", - "", "if (controllerType == \"XBOX\") {", " eventsFunctionContext.returnValue = gdjs._extensionController.isXbox(gamepad);", "} else {", @@ -8316,7 +8376,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" }, { @@ -8337,17 +8397,9 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;", "/** @type {Gamepad[]} */", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);", - "", - "//Get function parameter", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;", - "", - "if (playerId < 0 || playerId > 4) {", - " console.error('Parameter gamepad identifier in condition: \"Gamepad connected\", is not valid number, must be between 0 and 4.');", - " return;", - "}", - "", + "const gamepads = navigator.getGamepads ? navigator.getGamepads() : [];", "// If gamepad was disconnected it will be null (so this will return false)", "// If gamepad was never connected it will be undefined (so this will return false)", "eventsFunctionContext.returnValue = !!gamepads[playerId];" @@ -8360,7 +8412,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" } ], @@ -8376,25 +8428,16 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */", - "//Vibration work only on game in browser.", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);", - "", - "//Get function parameters", - "const playerId = eventsFunctionContext.getArgument(\"Player_ID\") - 1;", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;", "const duration = eventsFunctionContext.getArgument(\"Duration\") || 1;", - "", - "if (playerId < 0 || playerId > 4) {", - " console.error('Parameter gamepad identifier in action: \"Gamepad connected\", is not valid number, must be between 0 and 4.');", - " return;", + "/** @type {Gamepad} */", + "const gamepad = gdjs._extensionController.getGamepad(playerId);", + "if (!gamepad) {", + " // The gamepad is not connected.", + " return;", "}", - "", - "const gamepad = gamepads[playerId];", - "", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.", - "if (gamepad == null) return;", - "", - "if (gamepad && gamepad.vibrationActuator) {", + "//Vibration work only on game in browser.", + "if (gamepad.vibrationActuator) {", " gamepad.vibrationActuator.playEffect(\"dual-rumble\", {", " startDelay: 0,", " duration: duration * 1000,", @@ -8411,7 +8454,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "Player_ID", + "name": "PlayerId", "type": "expression" }, { @@ -8432,35 +8475,19 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */", - "//Vibration work only on game in browser.", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);", - "", - "//Get function parameters", - "const playerId = eventsFunctionContext.getArgument(\"Player_ID\") - 1;", + "const { clamp } = gdjs.evtTools.common;", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;", "const duration = eventsFunctionContext.getArgument(\"Duration\") || 1;", - "const strongRumbleMagnitude = eventsFunctionContext.getArgument(\"StrongMagnitude\");", - "const weakRumbleMagnitude = eventsFunctionContext.getArgument(\"WeakMagnitude\");", - "", - "if (playerId < 0 || playerId > 4) {", - " console.error('Parameter gamepad identifier in action: \"Advanced gamepad vibration\", is not valid number, must be between 0 and 4.');", - " return;", - "}", - "if (weakRumbleMagnitude < 0 || weakRumbleMagnitude > 1) {", - " console.error('Parameter weakRumble identifier in action: \"Advanced gamepad vibration\", is not valid number, must be between 0 and 1.');", - " return;", - "}", - "if (strongRumbleMagnitude < 0 || strongRumbleMagnitude > 1) {", - " console.error('Parameter strongRumble identifier in action: \"Advanced gamepad vibration\", is not valid number, must be between 0 and 1.');", - " return;", + "const strongRumbleMagnitude = clamp(eventsFunctionContext.getArgument(\"StrongMagnitude\"), 0, 1);", + "const weakRumbleMagnitude = clamp(eventsFunctionContext.getArgument(\"WeakMagnitude\"), 0, 1);", + "/** @type {Gamepad} */", + "const gamepad = gdjs._extensionController.getGamepad(playerId);", + "if (!gamepad) {", + " // The gamepad is not connected.", + " return;", "}", - "", - "const gamepad = gamepads[playerId];", - "", - "//we need keep this condition because when use have not yet plug the controller we can't get the controller in the gamepad variable.", - "if (gamepad == null) return;", - "", - "if (gamepad && gamepad.vibrationActuator) {", + "//Vibration work only on game in browser.", + "if (gamepad.vibrationActuator) {", " gamepad.vibrationActuator.playEffect(\"dual-rumble\", {", " startDelay: 0,", " duration: duration * 1000,", @@ -8468,11 +8495,11 @@ " strongMagnitude: strongRumbleMagnitude", " });", "}", - "", - "gdjs._extensionController.players[playerId].rumble.duration = duration;", - "gdjs._extensionController.players[playerId].rumble.elapsedTime = 0;", - "gdjs._extensionController.players[playerId].rumble.weakMagnitude = weakRumbleMagnitude;", - "gdjs._extensionController.players[playerId].rumble.strongMagnitude = strongRumbleMagnitude;" + "const player = gdjs._extensionController.getPlayer(playerId)", + "player.rumble.duration = duration;", + "player.rumble.elapsedTime = 0;", + "player.rumble.weakMagnitude = weakRumbleMagnitude;", + "player.rumble.strongMagnitude = strongRumbleMagnitude;" ], "parameterObjects": "", "useStrict": true, @@ -8482,7 +8509,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "Player_ID", + "name": "PlayerId", "type": "expression" }, { @@ -8513,39 +8540,22 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */", - "//Vibration work only on game in browser.", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);", - "", - "//Get function parameters", - "const playerId = eventsFunctionContext.getArgument(\"Player_ID\") - 1;", - "const elapsedTime = gdjs._extensionController.players[playerId].rumble.elapsedTime || 0;", - "const originalDuration = gdjs._extensionController.players[playerId].rumble.duration || 1;", - "const strongRumbleMagnitude = eventsFunctionContext.getArgument(\"StrongMagnitude\");", - "const weakRumbleMagnitude = eventsFunctionContext.getArgument(\"WeakMagnitude\");", - "", - "", - "if (playerId < 0 || playerId > 4) {", - " console.error('Parameter gamepad identifier in action: \"Change gamepad active vibration\", is not valid number, must be between 0 and 4.');", - " return;", - "}", - "if (weakRumbleMagnitude < 0 || weakRumbleMagnitude > 1) {", - " console.error('Parameter weakRumble identifier in action: \"Change gamepad active vibration\", is not valid number, must be between 0 and 1.');", - " return;", - "}", - "if (strongRumbleMagnitude < 0 || strongRumbleMagnitude > 1) {", - " console.error('Parameter strongRumble identifier in action: \"Change gamepad active vibration\", is not valid number, must be between 0 and 1.');", - " return;", + "const { clamp } = gdjs.evtTools.common;", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;", + "const player = gdjs._extensionController.getPlayer(playerId);", + "const elapsedTime = player.rumble.elapsedTime || 0;", + "const originalDuration = player.rumble.duration || 1;", + "const strongRumbleMagnitude = clamp(eventsFunctionContext.getArgument(\"StrongMagnitude\"), 0, 1);", + "const weakRumbleMagnitude = clamp(eventsFunctionContext.getArgument(\"WeakMagnitude\"), 0, 1);", + "/** @type {Gamepad} */", + "const gamepad = gdjs._extensionController.getGamepad(playerId);", + "if (!gamepad) {", + " // The gamepad is not connected.", + " return;", "}", - "", - "const gamepad = gamepads[playerId];", - "", - "//we need keep this condition because when use have not yet plug the controller we can't get the controller in the gamepad variable.", - "if (gamepad == null) return;", - "", "if (originalDuration - elapsedTime <= 0) return;", - "", - "if (gamepad && gamepad.vibrationActuator) {", + "//Vibration work only on game in browser.", + "if (gamepad.vibrationActuator) {", " gamepad.vibrationActuator.playEffect(\"dual-rumble\", {", " startDelay: 0,", " duration: 1000 * (originalDuration - elapsedTime),", @@ -8554,8 +8564,8 @@ " });", "}", "", - "gdjs._extensionController.players[playerId].rumble.weakMagnitude = weakRumbleMagnitude;", - "gdjs._extensionController.players[playerId].rumble.strongMagnitude = strongRumbleMagnitude;" + "player.rumble.weakMagnitude = weakRumbleMagnitude;", + "player.rumble.strongMagnitude = strongRumbleMagnitude;" ], "parameterObjects": "", "useStrict": true, @@ -8565,7 +8575,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "Player_ID", + "name": "PlayerId", "type": "expression" }, { @@ -8596,54 +8606,10 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", - "\r", - "//Get function parameters\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", "\r", - "if (playerId < 0 || playerId > 4) {\r", - "\tconsole.error('Parameter gamepad identifier in condition: \"Any gamepad button released\", is not valid number, must be between 0 and 4.');\r", - "\treturn;\r", - "}\r", - "\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", - "if (gamepad == null) return;\r", - "\r", - "for (let buttonId = 0; buttonId < gamepad.buttons.length; buttonId++) { //For each buttons on current frame.\r", - "\r", - "\tif (buttonId === undefined) {\r", - "\t\teventsFunctionContext.returnValue = false;\r", - "\t\treturn;\r", - "\t}\r", - "\r", - "\t//Get previous value or define value by default for the current button\r", - "\tgdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId] = gdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId] || { pressed: false };\r", - "\r", - "\t//Get state of the button at previous frame\r", - "\tconst previousStateButtonIsPressed = gdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId].pressed;\r", - "\r", - "\t//Get the state of the button on the current frame.\r", - "\tconst currentFrameStateButtonIsPressed = gamepad.buttons[buttonId].pressed;\r", - "\r", - "\t//When previousStateButtonIsPressed is true and actual button state is not pressed\r", - "\t//Player have release the button\r", - "\tif (previousStateButtonIsPressed === true && currentFrameStateButtonIsPressed === false) {\r", - "\t\tgdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId].pressed = true;\r", - "\t\teventsFunctionContext.returnValue = true;\r", - "\t\t//break;\r", - "\t\treturn;\r", - "\t} else {\r", - "\t\t//The player didn't released the button yet, the previous frame state is still true\r", - "\t\tgdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId].pressed = false;\r", - "\t\teventsFunctionContext.returnValue = false;\r", - "\t}\r", - "\r", - "\tif (currentFrameStateButtonIsPressed) gdjs._extensionController.players[playerId].lastButtonUsed = buttonId;\r", - "}\r", - "" + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "const player = gdjs._extensionController.getPlayer(playerId)\r", + "eventsFunctionContext.returnValue = player.isAnyButtonReleased();" ], "parameterObjects": "", "useStrict": true, @@ -8653,7 +8619,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" } ], @@ -8669,8 +8635,8 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "const playerId = eventsFunctionContext.getArgument(\"Player_ID\") - 1;\r", - "eventsFunctionContext.returnValue = gdjs._extensionController.players[playerId].rumble.weakMagnitude;" + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "eventsFunctionContext.returnValue = gdjs._extensionController.getPlayer(playerId).rumble.weakMagnitude;" ], "parameterObjects": "", "useStrict": true, @@ -8683,7 +8649,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "Player_ID", + "name": "PlayerId", "type": "expression" } ], @@ -8699,8 +8665,8 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "const playerId = eventsFunctionContext.getArgument(\"Player_ID\") - 1;\r", - "eventsFunctionContext.returnValue = gdjs._extensionController.players[playerId].rumble.strongMagnitude;" + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "eventsFunctionContext.returnValue = gdjs._extensionController.getPlayer(playerId).rumble.strongMagnitude;" ], "parameterObjects": "", "useStrict": true, @@ -8713,7 +8679,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "Player_ID", + "name": "PlayerId", "type": "expression" } ], @@ -11756,7 +11722,7 @@ "name": "SpriteMultitouchJoystick", "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/Line Hero Pack/Master/SVG/Videogames/Videogames_controller_joystick_arrows_direction.svg", "shortDescription": "Joysticks or buttons for touchscreens.", - "version": "1.8.4", + "version": "1.9.0", "description": [ "Multitouch joysticks are objects showing a joystick on the screen, useful for mobile. They work like a physical gamepad:", "- 4 or 8 directions", @@ -12266,11 +12232,11 @@ "objectGroups": [] }, { - "description": "Check if a button is pressed on a gamepad.", - "fullName": "Multitouch controller button pressed", + "description": "Check if a button was just pressed on a multitouch controller.", + "fullName": "Multitouch controller button just pressed", "functionType": "Condition", - "name": "IsButtonPressed", - "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", + "name": "IsButtonJustPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ was just pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -12282,7 +12248,73 @@ "parameters": [ "Controllers[ControllerIdentifier].Buttons[Button].State", "=", - "\"Pressed\"" + "\"JustPressed\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier", + "type": "expression" + }, + { + "description": "Button name", + "name": "Button", + "supplementaryInformation": "[\"A\",\"CROSS\",\"B\",\"CIRCLE\",\"X\",\"SQUARE\",\"Y\",\"TRIANGLE\",\"LB\",\"L1\",\"RB\",\"R1\",\"LT\",\"L2\",\"RT\",\"R2\",\"UP\",\"DOWN\",\"LEFT\",\"RIGHT\",\"BACK\",\"SHARE\",\"START\",\"OPTIONS\",\"CLICK_STICK_LEFT\",\"CLICK_STICK_RIGHT\",\"PS_BUTTON\",\"CLICK_TOUCHPAD\"]", + "type": "string" + } + ], + "objectGroups": [] + }, + { + "description": "Check if a button is pressed on a multitouch controller.", + "fullName": "Multitouch controller button pressed", + "functionType": "Condition", + "name": "IsButtonPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::Or" + }, + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"Pressed\"" + ] + }, + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"JustPressed\"" + ] + } ] } ], @@ -12314,7 +12346,7 @@ "objectGroups": [] }, { - "description": "Check if a button is released on a gamepad.", + "description": "Check if a button is released on a multitouch controller.", "fullName": "Multitouch controller button released", "functionType": "Condition", "name": "IsButtonReleased", @@ -12400,7 +12432,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"JustPressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -14890,11 +14922,11 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::IsReleased" + "value": "BooleanVariable" }, "parameters": [ - "Object", - "Behavior", + "IsReleased", + "True", "" ] } @@ -14923,6 +14955,44 @@ } ] }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "False", + "" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + }, + "parameters": [ + "Object", + "Behavior", + "\"Pressed\"", + "" + ] + } + ] + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ @@ -15015,7 +15085,17 @@ "parameters": [ "Object", "Behavior", - "\"Pressed\"", + "\"JustPressed\"", + "" + ] + }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "True", "" ] } @@ -15086,6 +15166,16 @@ "" ] }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "False", + "" + ] + }, { "type": { "value": "SetNumberVariable" @@ -15115,11 +15205,11 @@ "objectGroups": [] }, { - "description": "Check if button is released.", - "fullName": "Button released", + "description": "Check if the button was just pressed.", + "fullName": "Button just pressed", "functionType": "Condition", - "name": "IsReleased", - "sentence": "Button _PARAM0_ is released", + "name": "IsJustPressed", + "sentence": "Button _PARAM0_ was just pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -15129,7 +15219,7 @@ "value": "BooleanVariable" }, "parameters": [ - "IsReleased", + "IsJustPressed", "True", "" ] @@ -15163,7 +15253,7 @@ "objectGroups": [] }, { - "description": "Check if button is pressed.", + "description": "Check if the button is pressed.", "fullName": "Button pressed", "functionType": "Condition", "name": "IsPressed", @@ -15210,6 +15300,54 @@ ], "objectGroups": [] }, + { + "description": "Check if the button is released.", + "fullName": "Button released", + "functionType": "Condition", + "name": "IsReleased", + "sentence": "Button _PARAM0_ is released", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsReleased", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "type": "behavior" + } + ], + "objectGroups": [] + }, { "fullName": "Button state", "functionType": "Action", @@ -15251,7 +15389,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"JustPressed\",\"Pressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -15292,6 +15430,13 @@ "hidden": true, "name": "IsReleased" }, + { + "value": "", + "type": "Boolean", + "label": "Button just pressed", + "hidden": true, + "name": "IsJustPressed" + }, { "value": "0", "type": "Number", @@ -24466,7 +24611,7 @@ "name": "ParticleEmitter3D", "previewIconUrl": "https://asset-resources.gdevelop.io/public-resources/Icons/f2e5a34bf465f781866677762d385d6c8e9e8d203383f2df9a3b7e0fad6a2cb5_fire.svg", "shortDescription": "Display a large number of particles in 3D to create visual effects in a 3D game.", - "version": "2.2.0", + "version": "3.0.1", "description": [ "3D particle emitters let you create and display many small particles to simulate visual effects in your game — like fire, explosions, smoke, or dust.", "", @@ -24491,6 +24636,10 @@ "IWykYNRvhCZBN3vEgKEbBPOR3Oc2" ], "changelog": [ + { + "version": "3.0.0", + "breaking": "- the object rotates the other way around X axis." + }, { "version": "2.0.0", "breaking": "- Object properties for position and rotation have been removed. They must be set with the instance editor or the action." @@ -24534,9 +24683,7 @@ " const threeObject3D = this.get3DRendererObject();", "", " threeObject3D.rotation.set(", - " // TODO The rotation on X goes the wrong way.", - " // Increment the major and remove this sign.", - " - gdjs.toRad(this._object.getRotationX()),", + " gdjs.toRad(this._object.getRotationX()),", " gdjs.toRad(this._object.getRotationY()),", " gdjs.toRad(this._object.angle)", " );", @@ -31450,6 +31597,19 @@ "", "/** @type {gdjs.CustomRuntimeObject} */", "const object = objects[0];", + "// Force the size of the object because it doesn't contain any instance.", + "object._innerArea = {", + " min: [-16, -16, -16],", + " max: [16, 16, 16],", + " };", + "const hitbox = new gdjs.Polygon();", + "hitbox.vertices = [[-16, -16], [16, -16], [16, 16], [-16, 16]];", + "object._untransformedHitBoxes = [hitbox];", + "object._unrotatedAABB.min[0] = -16;", + "object._unrotatedAABB.min[1] = -16;", + "object._unrotatedAABB.max[0] = 16;", + "object._unrotatedAABB.max[1] = 16;", + "object._updateUntransformedHitBoxes = () => {};", "", "// Here runtimeScene is the gdjs.CustomRuntimeObjectInstanceContainer inside the custom object.", "const gameScene = object.getRuntimeScene();", @@ -38093,7 +38253,7 @@ "name": "Sticker", "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/sticker-outline.svg", "shortDescription": "Make objects follow the position and rotation of the object they are stuck to.", - "version": "0.5.3", + "version": "0.5.4", "description": [ "This extension can be useful to:", "- Stick accessories to moving objects", @@ -38149,8 +38309,10 @@ " 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()) {", @@ -38493,7 +38655,9 @@ " allStickers: new Set(),", "};", "// Register this object as a sticker.", - "runtimeScene._stickerExtension.allStickers.add(behavior);", + "/** @type {Set} */", + "const allStickers = runtimeScene._stickerExtension.allStickers;", + "allStickers.add(behavior);", "" ], "parameterObjects": "Object", @@ -38681,7 +38845,9 @@ "const object = objects[0];", "const behavior = object.getBehavior(behaviorName);", "", - "runtimeScene._stickerExtension.allStickers.delete(behavior._sticker);", + "/** @type {Set} */", + "const allStickers = runtimeScene._stickerExtension.allStickers;", + "allStickers.delete(behavior);", "" ], "parameterObjects": "Object", diff --git a/examples/3d-car-coin-hunt/assets/RoadWide.png b/examples/3d-car-coin-hunt/assets/RoadWide.png deleted file mode 100644 index 7a0c17150190e2a61b74a525a597a729a1f1d001..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 360 zcmeAS@N?(olHy`uVBq!ia0y~yU~B-g8#tJOq-ma?C6E#d@Ck8UcJlO`1BYH@iU0cb z>)pF|x08hG%hntO%5oNXL>4nJa0`PlBg3pY58&OGn)THD}UKA;v{fRRCgfq{jgfq_AQfq{v^fq@}| z`M@iI1Ck9_li6`;LMY|{`Uq-58AHT{4T>O-VFgGk;oASmD@Yrm+745O)eMFQRtMN~ Wt$i57Jb(IwRCv1jxvXEaktaqI0Z&q;?B zcvu6BqYM83-qve8gC)6^YvT*9+v`qcH%jnCiMee~n|Vbe)7sn1^J32dpHsPR2`?`` zVGe$IwT1ce%PS%~J%c_4#bzXHDCkZp%Rafp!RXFwO6rF zu~W(NC&5g?CyySoROx)OZRh4i+SejdDob5O5t`H zW8;+D(-f|9CQe~fdn4WwAa=uFTfjl{pF*gjnd_f@yBl^)NmBozdSr3O+;ZLySIs;t z6GgVvor-rIzE4S0yQf>?ovXcHmicbLnVJO0+^*}DJ}W#c{hn`JD7N+QLEaX=u2+`t z+MSLcyP)29;nAy`HUC8$oh&t0$%Q;hc=5>m{Sv+m|MXSgm&ePR`e4*kxt=StI4^ve}ZimMqA9^o?)1qocrMsYjEV6b|p4wrjx# z*|OBTYeF=6jLvjl=VF~FDN>&OW06Bf?)jx`tWGU9OyVLOGZ|_>&C?KZvafvndFk0l z0R|tMCtfP7=VVs=@?yry#p@VaK7@w^WyE@_Z|N6wT@rMRZJ|>8E9NgPPAmR&tx^jq ze>zWi<+2rfR&<91SA6|jq8r%0Nmu&e>OZcFUMRXJc)73J@NDO!nkk=qa*pj^J>gE^ zRnhHA3 Date: Mon, 6 Oct 2025 18:41:40 +0200 Subject: [PATCH 03/12] [3D endless terrain] Update the extensions --- .../3d-endless-terrain.json | 5644 ++++++++++------- .../assets/rotate-screen-icon.png | Bin 881 -> 1165 bytes 2 files changed, 3320 insertions(+), 2324 deletions(-) diff --git a/examples/3d-endless-terrain/3d-endless-terrain.json b/examples/3d-endless-terrain/3d-endless-terrain.json index 8ca9c3278..1ff1717c3 100644 --- a/examples/3d-endless-terrain/3d-endless-terrain.json +++ b/examples/3d-endless-terrain/3d-endless-terrain.json @@ -1,7 +1,7 @@ { "firstLayout": "", "gdVersion": { - "build": 231, + "build": 242, "major": 5, "minor": 5, "revision": 0 @@ -91,14 +91,6 @@ "smoothed": true, "userAdded": false }, - { - "file": "assets/rotate-screen-icon.png", - "kind": "image", - "metadata": "", - "name": "rotate-screen-icon.png", - "smoothed": true, - "userAdded": false - }, { "file": "assets/Rover 1.glb", "kind": "model3D", @@ -109,6 +101,18 @@ "identifier": "https://asset-resources.gdevelop.io/public-resources/3D Space Station/Vehicles/79f8b0b9d51820ceb5681de2c6be7e971c32d03c4efdb0d2f37a12cd8e150dc5_Rover 1.glb", "name": "Rover 1.glb" } + }, + { + "file": "assets/rotate-screen-icon.png", + "kind": "image", + "metadata": "", + "name": "rotate-screen-icon.png", + "smoothed": true, + "userAdded": false, + "origin": { + "identifier": "https://asset-resources.gdevelop.io/public-resources/Mobile Layouts/6a8102ce3340bf9f62300ee1a81ef0b2327b2c6e8d62d7dda68d547f5e2b5969_rotate-screen-icon.png", + "name": "rotate-screen-icon.png" + } } ], "resourceFolders": [] @@ -365,6 +369,8 @@ "crossfadeDuration": 0.10000000149011612, "depth": 74, "height": 74, + "isCastingShadow": false, + "isReceivingShadow": false, "keepAspectRatio": true, "materialType": "StandardWithoutMetalness", "modelResourceName": "Rover 1.glb", @@ -439,6 +445,8 @@ "crossfadeDuration": 0, "depth": 74, "height": 74, + "isCastingShadow": false, + "isReceivingShadow": false, "keepAspectRatio": true, "materialType": "StandardWithoutMetalness", "modelResourceName": "Sedan Sports.glb", @@ -639,7 +647,7 @@ "assetStoreId": "e5919fb86a559b00001678c710efe55f4e9f2e032a9ff9610087370f998d57de", "name": "ScreenOrientationChecker", "type": "ScreenOrientationChecker::ScreenOrientationChecker", - "variant": "", + "variant": "Black screen orientation checker", "variables": [], "effects": [], "behaviors": [ @@ -659,116 +667,6 @@ "BackgroundColor": "24;24;24", "CornerRadius": 8, "Padding": 5 - }, - "childrenContent": { - "BackgroundPainter": { - "fillOpacity": 255, - "outlineSize": 0, - "outlineOpacity": 255, - "absoluteCoordinates": true, - "clearBetweenFrames": true, - "antialiasing": "none", - "fillColor": { - "r": 0, - "g": 0, - "b": 0 - }, - "outlineColor": { - "r": 0, - "g": 0, - "b": 0 - } - }, - "Icon": { - "adaptCollisionMaskAutomatically": true, - "updateIfNotVisible": false, - "animations": [ - { - "name": "", - "useMultipleDirections": false, - "directions": [ - { - "looping": false, - "timeBetweenFrames": 0.08, - "sprites": [ - { - "hasCustomCollisionMask": true, - "image": "rotate-screen-icon.png", - "points": [], - "originPoint": { - "name": "origine", - "x": 0, - "y": 0 - }, - "centerPoint": { - "automatic": true, - "name": "centre", - "x": 0, - "y": 0 - }, - "customCollisionMask": [ - [ - { - "x": 0, - "y": 1 - }, - { - "x": 105, - "y": 1 - }, - { - "x": 105, - "y": 113 - }, - { - "x": 0, - "y": 113 - } - ] - ] - } - ] - } - ] - } - ] - }, - "Text": { - "bold": true, - "italic": false, - "smoothed": true, - "underlined": false, - "string": "Rotate screen to play", - "font": "", - "textAlignment": "center", - "characterSize": 30, - "color": { - "b": 255, - "g": 255, - "r": 255 - }, - "content": { - "bold": true, - "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": "Rotate screen to play", - "font": "", - "textAlignment": "center", - "verticalTextAlignment": "top", - "characterSize": 30, - "color": "255;255;255" - } - } } } ], @@ -2028,7 +1926,7 @@ "name": "HeightMap3D", "previewIconUrl": "https://asset-resources.gdevelop.io/public-resources/Icons/10e0a26c0d500830dfe23b94138beb0ef61607ba62bca05a5aa5c849777f1b06_terrain.svg", "shortDescription": "A terrain with hills where 3D physics objects can stand.", - "version": "1.0.0", + "version": "1.0.1", "description": [ "A terrain with hills where objects with the 3D physics behavior can stand.", "", @@ -2037,6 +1935,10 @@ "- noise function ([open the project online](https://editor.gdevelop.io/?project=example://3d-endless-terrain))", "" ], + "origin": { + "identifier": "HeightMap3D", + "name": "gdevelop-extension-store" + }, "tags": [ "3d", "field", @@ -2097,17 +1999,35 @@ " this.dimX = dimX;", " this.dimY = dimY;", "", + " this.rebuildPlane();", + " this.setColor(color);", + " this.setWireframe(wireframe);", + " }", + "", + " /**", + " * @param dimX {integer}", + " * @param dimY {integer}", + " */", + " clearAndResize(dimX, dimY) {", + " this.dimX = dimX;", + " this.dimY = dimY;", + " this.rebuildPlane();", + " }", + "", + " rebuildPlane() {", + " const material = this.mesh ? this.mesh.material : new THREE.MeshStandardMaterial();", + " if (this.mesh) {", + " this.mesh.removeFromParent();", + " }", " const geometry = new THREE.PlaneGeometry(64, 64, this.dimX - 1, this.dimY - 1);", " this.vertices = geometry.attributes.position.array;", - " this.mesh = new THREE.Mesh(", - " geometry,", - " new THREE.MeshStandardMaterial({ color: gdjs.rgbOrHexStringToNumber(color), wireframe })", - " );", + " this.mesh = new THREE.Mesh(geometry, material);", " this.mesh.rotation.order = 'ZYX';", " this.mesh.position.x = defaultWidth / 2;", " this.mesh.position.y = defaultHeight / 2;", " this.mesh.scale.y = -1;", - " object.get3DRendererObject().add(this.mesh);", + " this.object.get3DRendererObject().add(this.mesh);", + " this.hasChangedThisFrame = true;", " }", "", " forceUpdate() {", @@ -2221,6 +2141,24 @@ " }", " this.setAsDirty(true);", " }", + "", + " /**", + " * @param color {string}", + " */", + " setColor(color) {", + " /** @type {THREE.MeshStandardMaterial} */", + " const material = this.mesh.material;", + " material.color.set(gdjs.rgbOrHexStringToNumber(color));", + " }", + "", + " /**", + " * @param wireframe {boolean}", + " */", + " setWireframe(wireframe) {", + " /** @type {THREE.MeshStandardMaterial} */", + " const material = this.mesh.material;", + " material.wireframe = wireframe;", + " }", "}", "", "/**", @@ -2445,6 +2383,28 @@ ], "parameters": [], "objectGroups": [] + }, + { + "description": "Check if the events are running for the editor.", + "fullName": "Editor is running", + "functionType": "Condition", + "name": "IsInGameEdition", + "private": true, + "sentence": "Events are running for the editor", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const game = runtimeScene.getGame();\r", + "eventsFunctionContext.returnValue = game.isInGameEdition && game.isInGameEdition();" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [], + "objectGroups": [] } ], "eventsBasedBehaviors": [ @@ -2476,19 +2436,37 @@ ] }, { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "/** @type {gdjs.CustomRuntimeObject} */\r", - "const object = objects[0];\r", - "\r", - "const physics = object.getBehavior(eventsFunctionContext.getBehaviorName(\"Physics3D\"));\r", - "\r", - "object.__heightMap3DExtension.physicsHeightMap = new gdjs.__heightMap3DExtension.PhysicsHeightMap(physics, object.__heightMap3DExtension.heightMap);\r", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "HeightMap3D::IsInGameEdition" + }, + "parameters": [ + "", + "" + ] + } ], - "parameterObjects": "Object", - "useStrict": true, - "eventsSheetExpanded": true + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "/** @type {gdjs.CustomRuntimeObject} */\r", + "const object = objects[0];\r", + "\r", + "const physics = object.getBehavior(eventsFunctionContext.getBehaviorName(\"Physics3D\"));\r", + "\r", + "object.__heightMap3DExtension.physicsHeightMap = new gdjs.__heightMap3DExtension.PhysicsHeightMap(physics, object.__heightMap3DExtension.heightMap);\r", + "" + ], + "parameterObjects": "Object", + "useStrict": true, + "eventsSheetExpanded": true + } + ] } ], "parameters": [ @@ -2514,17 +2492,35 @@ "sentence": "", "events": [ { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "/** @type {gdjs.CustomRuntimeObject} */\r", - "const object = objects[0];\r", - "\r", - "object.__heightMap3DExtension.physicsHeightMap.updateIfNeeded();\r", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "HeightMap3D::IsInGameEdition" + }, + "parameters": [ + "", + "" + ] + } ], - "parameterObjects": "Object", - "useStrict": true, - "eventsSheetExpanded": true + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "/** @type {gdjs.CustomRuntimeObject} */\r", + "const object = objects[0];\r", + "\r", + "object.__heightMap3DExtension.physicsHeightMap.updateIfNeeded();\r", + "" + ], + "parameterObjects": "Object", + "useStrict": true, + "eventsSheetExpanded": true + } + ] } ], "parameters": [ @@ -2549,11 +2545,10 @@ "value": "", "type": "Behavior", "label": "3D physics engine", - "description": "", - "group": "", "extraInformation": [ "Physics3D::Physics3DBehavior" ], + "choices": [], "name": "Physics3D" } ], @@ -2681,14 +2676,6 @@ "type": "BuiltinCommonInstructions::Standard", "conditions": [], "actions": [ - { - "type": { - "value": "Cache" - }, - "parameters": [ - "Placeholder" - ] - }, { "type": { "value": "HeightMap3D::DefineHelperClasses" @@ -2700,234 +2687,119 @@ } ] }, - { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "/** @type {gdjs.CustomRuntimeObject} */\r", - "const object = objects[0];\r", - "\r", - "const dimX = object._getGridDimensionX();\r", - "const dimY = object._getGridDimensionY();\r", - "const color = object._getColor();\r", - "const wireframe = object._getWireframe();\r", - "\r", - "object.__heightMap3DExtension = {\r", - " heightMap: new gdjs.__heightMap3DExtension.HeightMap(object, dimX, dimY, color, wireframe)\r", - "};\r", - "\r", - "const imageResourceName = object._getHeightMapImage();\r", - "if (imageResourceName) {\r", - " const offsetX = object._getImageOffsetX();\r", - " const offsetY = object._getImageOffsetY();\r", - "\r", - " const texture = runtimeScene\r", - " .getGame()\r", - " .getImageManager()\r", - " .getPIXITexture(imageResourceName);\r", - " object.__heightMap3DExtension.heightMap.loadHeightMapFromTexture(\r", - " texture, offsetX, offsetY);\r", - "}" - ], - "parameterObjects": "Object", - "useStrict": true, - "eventsSheetExpanded": true - }, { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "supplementaryInformation": "HeightMap3D::HeightMap3D", - "type": "object" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "Action", - "name": "doStepPostEvents", - "sentence": "", - "events": [ + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::Or" + }, + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "HeightMapImage", + "!=", + "\"\"" + ] + }, + { + "type": { + "inverted": true, + "value": "HeightMap3D::IsInGameEdition" + }, + "parameters": [ + "", + "" + ] + } + ] + } + ], + "actions": [ + { + "type": { + "value": "Cache" + }, + "parameters": [ + "Placeholder" + ] + } + ] + }, { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ "/** @type {gdjs.CustomRuntimeObject} */\r", "const object = objects[0];\r", - "\r", - "object.__heightMap3DExtension.heightMap.updateIfNeeded();\r", - "" - ], - "parameterObjects": "Object", - "useStrict": true, - "eventsSheetExpanded": true - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "supplementaryInformation": "HeightMap3D::HeightMap3D", - "type": "object" - } - ], - "objectGroups": [] - }, - { - "description": "Load a height map from an image file.", - "fullName": "Load height map", - "functionType": "Action", - "name": "LoadFromImage", - "sentence": "Load the height map of _PARAM0_ from _PARAM1_ offseted by _PARAM2_ ; _PARAM3_", - "events": [ - { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "/** @type {gdjs.CustomRuntimeObject} */", - "const object = objects[0];", - "", - "const imageResourceName = eventsFunctionContext.getArgument(\"Image\");", - "const offsetX = eventsFunctionContext.getArgument(\"OffsetX\");", - "const offsetY = eventsFunctionContext.getArgument(\"OffsetY\");", - "", - "const texture = runtimeScene", - " .getGame()", - " .getImageManager()", - " .getPIXITexture(imageResourceName);", - "object.__heightMap3DExtension.heightMap.loadHeightMapFromTexture(texture, offsetX, offsetY);", - "" + "const dimX = object._getGridDimensionX();\r", + "const dimY = object._getGridDimensionY();\r", + "const color = object._getColor();\r", + "const wireframe = object._getWireframe();\r", + "object.__heightMap3DExtension = {\r", + " heightMap: new gdjs.__heightMap3DExtension.HeightMap(object, dimX, dimY, color, wireframe)\r", + "};" ], "parameterObjects": "Object", "useStrict": true, - "eventsSheetExpanded": true - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "supplementaryInformation": "HeightMap3D::HeightMap3D", - "type": "object" - }, - { - "description": "Image", - "name": "Image", - "type": "imageResource" - }, - { - "description": "Image cropping offset on X", - "name": "OffsetX", - "type": "expression" + "eventsSheetExpanded": false }, { - "description": "Image cropping offset on Y", - "name": "OffsetY", - "type": "expression" - } - ], - "objectGroups": [] - }, - { - "description": "Update the height map. This is done automatically at the end of every frame, but it can be used manually to avoid a 1-frame delay.", - "fullName": "Update height map", - "functionType": "Action", - "name": "ForceUpdate", - "sentence": "Update the height map of _PARAM0_", - "events": [ - { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "/** @type {gdjs.CustomRuntimeObject} */", - "const object = objects[0];", - "", - "eventsFunctionContext.returnValue = object.__heightMap3DExtension.heightMap.forceUpdate();", - "" - ], - "parameterObjects": "Object", - "useStrict": true, - "eventsSheetExpanded": true - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "supplementaryInformation": "HeightMap3D::HeightMap3D", - "type": "object" - } - ], - "objectGroups": [] - }, - { - "description": "the field value at a grid index. The value is bewteen 0 and 1.", - "fullName": "Grid value", - "functionType": "ExpressionAndCondition", - "name": "GridValue", - "sentence": "the grid value at index _PARAM1_ ; _PARAM2_", - "events": [ - { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "/** @type {gdjs.CustomRuntimeObject} */", - "const object = objects[0];", - "", - "const indexX = eventsFunctionContext.getArgument(\"IndexX\");", - "const indexY = eventsFunctionContext.getArgument(\"IndexY\");", - "", - "eventsFunctionContext.returnValue = object.__heightMap3DExtension.heightMap.getGridValue(indexX, indexY);", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "HeightMapImage", + "!=", + "\"\"" + ] + } ], - "parameterObjects": "Object", - "useStrict": true, - "eventsSheetExpanded": true + "actions": [ + { + "type": { + "value": "HeightMap3D::HeightMap3D::SetHeightMapImage" + }, + "parameters": [ + "Object", + "HeightMapImage", + "ImageOffsetX", + "ImageOffsetY", + "" + ] + } + ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", "name": "Object", "supplementaryInformation": "HeightMap3D::HeightMap3D", "type": "object" - }, - { - "description": "X grid index", - "name": "IndexX", - "type": "expression" - }, - { - "description": "Y grid index", - "name": "IndexY", - "type": "expression" } ], "objectGroups": [] }, { "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "GridValue", - "name": "SetGridValue", + "functionType": "Action", + "name": "doStepPostEvents", "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {gdjs.CustomRuntimeObject} */", - "const object = objects[0];", - "", - "const indexX = eventsFunctionContext.getArgument(\"IndexX\");", - "const indexY = eventsFunctionContext.getArgument(\"IndexY\");", - "const value = eventsFunctionContext.getArgument(\"Value\");", - "", - "object.__heightMap3DExtension.heightMap.setGridValue(indexX, indexY, value);", + "/** @type {gdjs.CustomRuntimeObject} */\r", + "const object = objects[0];\r", + "\r", + "object.__heightMap3DExtension.heightMap.updateIfNeeded();\r", "" ], "parameterObjects": "Object", @@ -2941,31 +2813,15 @@ "name": "Object", "supplementaryInformation": "HeightMap3D::HeightMap3D", "type": "object" - }, - { - "description": "X grid index", - "name": "IndexX", - "type": "expression" - }, - { - "description": "Y grid index", - "name": "IndexY", - "type": "expression" - }, - { - "description": "Field value", - "name": "Value", - "type": "expression" } ], "objectGroups": [] }, { - "description": "the number of points in the grid on X axis.", - "fullName": "Grid dimension X", - "functionType": "ExpressionAndCondition", - "name": "GridDimensionX", - "sentence": "the grid dimension on X axis", + "fullName": "", + "functionType": "Action", + "name": "onHotReloading", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -2973,53 +2829,259 @@ "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "HeightMap3D::HeightMap3D::SetColor" }, "parameters": [ - "GridDimensionX" + "Object", + "=", + "Color", + "" ] } ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ + }, { - "description": "Object", - "name": "Object", - "supplementaryInformation": "HeightMap3D::HeightMap3D", - "type": "object" - } - ], - "objectGroups": [] - }, - { - "description": "the number of points in the grid on Y axis.", - "fullName": "Grid dimension Y", - "functionType": "ExpressionAndCondition", - "name": "GridDimensionY", - "sentence": "the grid dimension on Y axis", - "events": [ + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "Wireframe", + "!=", + "InitialColor" + ] + } + ], + "actions": [ + { + "type": { + "value": "HeightMap3D::HeightMap3D::SetWireframe" + }, + "parameters": [ + "Object", + "no", + "" + ] + } + ] + }, { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "Wireframe", + "True", + "InitialColor" + ] + } + ], "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "HeightMap3D::HeightMap3D::SetWireframe" }, "parameters": [ - "GridDimensionY" + "Object", + "", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::Or" + }, + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "GridDimensionX", + "!=", + "InitialGridDimensionX" + ] + }, + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "GridDimensionY", + "!=", + "InitialGridDimensionY" + ] + } + ] + } + ], + "actions": [ + { + "type": { + "value": "HeightMap3D::HeightMap3D::ClearAndResize" + }, + "parameters": [ + "Object", + "GridDimensionX", + "GridDimensionY", + "" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "InitialGridDimensionX", + "=", + "GridDimensionX" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "InitialGridDimensionY", + "=", + "GridDimensionY" + ] + }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "HasResized", + "True", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::Or" + }, + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "HeightMapImage", + "!=", + "InitialHeightMapImage" + ] + }, + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "ImageOffsetX", + "!=", + "InitialHeightMapImage" + ] + }, + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "ImageOffsetY", + "!=", + "InitialHeightMapImage" + ] + }, + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "HasResized", + "True", + "InitialHeightMapImage" + ] + } + ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "InitialHeightMapImage", + "=", + "HeightMapImage" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "InitialImageOffsetX", + "=", + "ImageOffsetX" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "InitialImageOffsetY", + "=", + "ImageOffsetY" + ] + }, + { + "type": { + "value": "HeightMap3D::HeightMap3D::SetHeightMapImage" + }, + "parameters": [ + "Object", + "HeightMapImage", + "ImageOffsetX", + "ImageOffsetY", + "" + ] + } ] } + ], + "variables": [ + { + "name": "HasResized", + "type": "boolean", + "value": false + } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -3031,11 +3093,11 @@ "objectGroups": [] }, { - "description": "the field Z for a given position in the scene.", - "fullName": "Field point Z", - "functionType": "ExpressionAndCondition", - "name": "FieldZ", - "sentence": "the field Z for position _PARAM1_ ; _PARAM2_", + "description": "Load a height map from an image file.", + "fullName": "Load height map", + "functionType": "Action", + "name": "LoadFromImage", + "sentence": "Load the height map of _PARAM0_ from _PARAM1_ offseted by _PARAM2_ ; _PARAM3_", "events": [ { "type": "BuiltinCommonInstructions::JsCode", @@ -3043,19 +3105,22 @@ "/** @type {gdjs.CustomRuntimeObject} */", "const object = objects[0];", "", - "const pointX = eventsFunctionContext.getArgument(\"PointX\");", - "const pointY = eventsFunctionContext.getArgument(\"PointY\");", + "const imageResourceName = eventsFunctionContext.getArgument(\"Image\");", + "const offsetX = eventsFunctionContext.getArgument(\"OffsetX\");", + "const offsetY = eventsFunctionContext.getArgument(\"OffsetY\");", "", - "eventsFunctionContext.returnValue = object.__heightMap3DExtension.heightMap.getFieldZ(pointX, pointY);" + "const texture = runtimeScene", + " .getGame()", + " .getImageManager()", + " .getPIXITexture(imageResourceName);", + "object.__heightMap3DExtension.heightMap.loadHeightMapFromTexture(texture, offsetX, offsetY);", + "" ], "parameterObjects": "Object", "useStrict": true, "eventsSheetExpanded": true } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -3064,17 +3129,657 @@ "type": "object" }, { - "description": "X position in the scene", - "name": "PointX", + "description": "Image", + "name": "Image", + "type": "imageResource" + }, + { + "description": "Image cropping offset on X", + "name": "OffsetX", "type": "expression" }, { - "description": "Y position in the scene", - "name": "PointY", + "description": "Image cropping offset on Y", + "name": "OffsetY", "type": "expression" } ], "objectGroups": [] + }, + { + "description": "Set a height map from an image file.", + "fullName": "Height map image", + "functionType": "Action", + "name": "SetHeightMapImage", + "private": true, + "sentence": "Set the height map of _PARAM0_ from _PARAM1_ offseted by _PARAM2_ ; _PARAM3_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "HeightMapImage", + "=", + "HeightMapImage" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "ImageOffsetX", + "=", + "OffsetX" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "ImageOffsetY", + "=", + "OffsetY" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "/** @type {gdjs.CustomRuntimeObject} */", + "const object = objects[0];", + "", + "const imageResourceName = eventsFunctionContext.getArgument(\"Image\");", + "const offsetX = eventsFunctionContext.getArgument(\"OffsetX\");", + "const offsetY = eventsFunctionContext.getArgument(\"OffsetY\");", + "", + "const texture = runtimeScene", + " .getGame()", + " .getImageManager()", + " .getPIXITexture(imageResourceName);", + "object.__heightMap3DExtension.heightMap.loadHeightMapFromTexture(texture, offsetX, offsetY);", + "", + "" + ], + "parameterObjects": "Object", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "HeightMap3D::HeightMap3D", + "type": "object" + }, + { + "description": "Image", + "name": "Image", + "type": "string" + }, + { + "description": "Image cropping offset on X", + "name": "OffsetX", + "type": "expression" + }, + { + "description": "Image cropping offset on Y", + "name": "OffsetY", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Change the dimensions of the height map.", + "fullName": "Clear and resize", + "functionType": "Action", + "name": "ClearAndResize", + "private": true, + "sentence": "Clear and resize _PARAM0_ to _PARAM1_ ; _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "GridDimensionX", + "=", + "NewDimensionX" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "GridDimensionY", + "=", + "NewDimensionY" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "/** @type {gdjs.CustomRuntimeObject} */", + "const object = objects[0];", + "", + "const dimensionX = eventsFunctionContext.getArgument(\"NewDimensionX\");", + "const dimensionY = eventsFunctionContext.getArgument(\"NewDimensionY\");", + "", + "object.__heightMap3DExtension.heightMap.clearAndResize(dimensionX, dimensionY);", + "" + ], + "parameterObjects": "Object", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "HeightMap3D::HeightMap3D", + "type": "object" + }, + { + "description": "Dimension X", + "name": "NewDimensionX", + "type": "expression" + }, + { + "description": "Dimension Y", + "name": "NewDimensionY", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Update the height map. This is done automatically at the end of every frame, but it can be used manually to avoid a 1-frame delay.", + "fullName": "Update height map", + "functionType": "Action", + "name": "ForceUpdate", + "sentence": "Update the height map of _PARAM0_", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "/** @type {gdjs.CustomRuntimeObject} */", + "const object = objects[0];", + "", + "eventsFunctionContext.returnValue = object.__heightMap3DExtension.heightMap.forceUpdate();", + "" + ], + "parameterObjects": "Object", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "HeightMap3D::HeightMap3D", + "type": "object" + } + ], + "objectGroups": [] + }, + { + "description": "the field value at a grid index. The value is bewteen 0 and 1.", + "fullName": "Grid value", + "functionType": "ExpressionAndCondition", + "name": "GridValue", + "sentence": "the grid value at index _PARAM1_ ; _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "/** @type {gdjs.CustomRuntimeObject} */", + "const object = objects[0];", + "", + "const indexX = eventsFunctionContext.getArgument(\"IndexX\");", + "const indexY = eventsFunctionContext.getArgument(\"IndexY\");", + "", + "eventsFunctionContext.returnValue = object.__heightMap3DExtension.heightMap.getGridValue(indexX, indexY);", + "" + ], + "parameterObjects": "Object", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "HeightMap3D::HeightMap3D", + "type": "object" + }, + { + "description": "X grid index", + "name": "IndexX", + "type": "expression" + }, + { + "description": "Y grid index", + "name": "IndexY", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "GridValue", + "name": "SetGridValue", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "/** @type {gdjs.CustomRuntimeObject} */", + "const object = objects[0];", + "", + "const indexX = eventsFunctionContext.getArgument(\"IndexX\");", + "const indexY = eventsFunctionContext.getArgument(\"IndexY\");", + "const value = eventsFunctionContext.getArgument(\"Value\");", + "", + "object.__heightMap3DExtension.heightMap.setGridValue(indexX, indexY, value);", + "" + ], + "parameterObjects": "Object", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "HeightMap3D::HeightMap3D", + "type": "object" + }, + { + "description": "X grid index", + "name": "IndexX", + "type": "expression" + }, + { + "description": "Y grid index", + "name": "IndexY", + "type": "expression" + }, + { + "description": "Field value", + "name": "Value", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "the number of points in the grid on X axis.", + "fullName": "Grid dimension X", + "functionType": "ExpressionAndCondition", + "name": "GridDimensionX", + "sentence": "the grid dimension on X axis", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "GridDimensionX" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "HeightMap3D::HeightMap3D", + "type": "object" + } + ], + "objectGroups": [] + }, + { + "description": "the number of points in the grid on Y axis.", + "fullName": "Grid dimension Y", + "functionType": "ExpressionAndCondition", + "name": "GridDimensionY", + "sentence": "the grid dimension on Y axis", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "GridDimensionY" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "HeightMap3D::HeightMap3D", + "type": "object" + } + ], + "objectGroups": [] + }, + { + "description": "the field Z for a given position in the scene.", + "fullName": "Field point Z", + "functionType": "ExpressionAndCondition", + "name": "FieldZ", + "sentence": "the field Z for position _PARAM1_ ; _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "/** @type {gdjs.CustomRuntimeObject} */", + "const object = objects[0];", + "", + "const pointX = eventsFunctionContext.getArgument(\"PointX\");", + "const pointY = eventsFunctionContext.getArgument(\"PointY\");", + "", + "eventsFunctionContext.returnValue = object.__heightMap3DExtension.heightMap.getFieldZ(pointX, pointY);" + ], + "parameterObjects": "Object", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "HeightMap3D::HeightMap3D", + "type": "object" + }, + { + "description": "X position in the scene", + "name": "PointX", + "type": "expression" + }, + { + "description": "Y position in the scene", + "name": "PointY", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "the color of the object.", + "fullName": "Color", + "functionType": "ExpressionAndCondition", + "group": "3D height map style configuration", + "name": "Color", + "private": true, + "sentence": "the color", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnString" + }, + "parameters": [ + "Color" + ] + } + ] + } + ], + "expressionType": { + "type": "color" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "HeightMap3D::HeightMap3D", + "type": "object" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "Color", + "name": "SetColor", + "private": true, + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "Color", + "=", + "Value" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "/** @type {gdjs.CustomRuntimeObject} */", + "const object = objects[0];", + "", + "const value = eventsFunctionContext.getArgument(\"Value\");", + "", + "object.__heightMap3DExtension.heightMap.setColor(value);", + "" + ], + "parameterObjects": "Object", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "HeightMap3D::HeightMap3D", + "type": "object" + } + ], + "objectGroups": [] + }, + { + "description": "Check if wireframe.", + "fullName": "Wireframe", + "functionType": "Condition", + "group": "3D height map style configuration", + "name": "IsWireframe", + "private": true, + "sentence": "_PARAM0_ wireframe", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "Wireframe", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "HeightMap3D::HeightMap3D", + "type": "object" + } + ], + "objectGroups": [] + }, + { + "description": "Change if wireframe.", + "fullName": "Wireframe", + "functionType": "Action", + "group": "3D height map style configuration", + "name": "SetWireframe", + "private": true, + "sentence": "_PARAM0_ wireframe: _PARAM1_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "Value", + "False", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "Wireframe", + "False", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "Value", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "Wireframe", + "True", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "/** @type {gdjs.CustomRuntimeObject} */", + "const object = objects[0];", + "", + "const value = eventsFunctionContext.getArgument(\"Value\");", + "", + "object.__heightMap3DExtension.heightMap.setWireframe(value);", + "" + ], + "parameterObjects": "Object", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "HeightMap3D::HeightMap3D", + "type": "object" + }, + { + "defaultValue": "yes", + "description": "Wireframe", + "name": "Value", + "optional": true, + "type": "yesorno" + } + ], + "objectGroups": [] } ], "propertyDescriptors": [ @@ -3082,68 +3787,95 @@ "value": "65", "type": "Number", "label": "Grid dimension X", - "description": "", - "group": "", - "extraInformation": [], "name": "GridDimensionX" }, + { + "value": "65", + "type": "Number", + "label": "", + "hidden": true, + "name": "InitialGridDimensionX" + }, { "value": "65", "type": "Number", "label": "Grid dimension Y", - "description": "", - "group": "", - "extraInformation": [], "name": "GridDimensionY" }, + { + "value": "65", + "type": "Number", + "label": "", + "hidden": true, + "name": "InitialGridDimensionY" + }, { "value": "255;255;255", "type": "Color", "label": "Color", - "description": "", "group": "Style", - "extraInformation": [], "name": "Color" }, { "value": "", "type": "Boolean", "label": "Wireframe", - "description": "", "group": "Style", - "extraInformation": [], "name": "Wireframe" }, { "value": "", "type": "Resource", "label": "Height map (optional)", - "description": "", "group": "Image", "extraInformation": [ "image" ], + "choices": [], "name": "HeightMapImage" }, + { + "value": "", + "type": "Resource", + "label": "", + "extraInformation": [ + "image" + ], + "choices": [], + "hidden": true, + "name": "InitialHeightMapImage" + }, { "value": "0", "type": "Number", "unit": "Pixel", "label": "Image offset X", - "description": "", "group": "Image", - "extraInformation": [], "name": "ImageOffsetX" }, + { + "value": "0", + "type": "Number", + "unit": "Pixel", + "label": "", + "hidden": true, + "name": "InitialImageOffsetX" + }, { "value": "0", "type": "Number", "unit": "Pixel", "label": "Image offset Y", - "description": "", "group": "Image", - "extraInformation": [], "name": "ImageOffsetY" + }, + { + "value": "0", + "type": "Number", + "unit": "Pixel", + "label": "", + "hidden": true, + "name": "InitialImageOffsetY" } ], "variants": [] @@ -7002,11 +7734,10 @@ "value": "", "type": "Behavior", "label": "3D capability", - "description": "", - "group": "", "extraInformation": [ "Scene3D::Base3DBehavior" ], + "choices": [], "name": "Object3D" }, { @@ -7014,9 +7745,7 @@ "type": "Number", "unit": "Second", "label": "Halfway time for rotation", - "description": "", "group": "Catch-up speed", - "extraInformation": [], "quickCustomizationVisibility": "hidden", "name": "RotationHalfwayDuration" }, @@ -7025,9 +7754,7 @@ "type": "Number", "unit": "Second", "label": "Halfway time for elevation rotation", - "description": "", "group": "Catch-up speed", - "extraInformation": [], "quickCustomizationVisibility": "hidden", "name": "ElevationHalfwayDuration" }, @@ -7036,9 +7763,7 @@ "type": "Number", "unit": "Second", "label": "Halfway time on Z axis", - "description": "", "group": "Catch-up speed", - "extraInformation": [], "quickCustomizationVisibility": "hidden", "name": "TranslationZHalfwayDuration" }, @@ -7047,9 +7772,7 @@ "type": "Number", "unit": "Pixel", "label": "Camera distance", - "description": "", "group": "Position", - "extraInformation": [], "name": "Distance" }, { @@ -7057,9 +7780,7 @@ "type": "Number", "unit": "Pixel", "label": "Lateral distance offset", - "description": "", "group": "Position", - "extraInformation": [], "name": "OffsetX" }, { @@ -7067,9 +7788,7 @@ "type": "Number", "unit": "Pixel", "label": "Ahead distance offset", - "description": "", "group": "Position", - "extraInformation": [], "name": "OffsetY" }, { @@ -7077,9 +7796,7 @@ "type": "Number", "unit": "Pixel", "label": "Z offset", - "description": "", "group": "Position", - "extraInformation": [], "name": "OffsetZ" }, { @@ -7087,9 +7804,7 @@ "type": "Number", "unit": "DegreeAngle", "label": "Rotation angle offset", - "description": "", "group": "Position", - "extraInformation": [], "name": "RotationAngleOffset" }, { @@ -7097,9 +7812,7 @@ "type": "Number", "unit": "DegreeAngle", "label": "Elevation angle offset", - "description": "", "group": "Position", - "extraInformation": [], "name": "ElevationAngleOffset" }, { @@ -7107,9 +7820,7 @@ "type": "Number", "unit": "Pixel", "label": "Follow free area top border on Z axis", - "description": "", "group": "Position", - "extraInformation": [], "advanced": true, "quickCustomizationVisibility": "hidden", "name": "FollowFreeAreaZMax" @@ -7119,9 +7830,7 @@ "type": "Number", "unit": "Pixel", "label": "Follow free area bottom border on Z axis", - "description": "", "group": "Position", - "extraInformation": [], "advanced": true, "quickCustomizationVisibility": "hidden", "name": "FollowFreeAreaZMin" @@ -7130,9 +7839,6 @@ "value": "", "type": "Number", "label": "", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "RotationLogSpeed" }, @@ -7140,9 +7846,6 @@ "value": "", "type": "Number", "label": "", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "ElevationLogSpeed" }, @@ -7150,9 +7853,6 @@ "value": "", "type": "Number", "label": "", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "TranslationZLogSpeed" }, @@ -7160,9 +7860,6 @@ "value": "", "type": "Boolean", "label": "", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "IsCalledManually" }, @@ -7171,9 +7868,6 @@ "type": "Number", "unit": "Pixel", "label": "", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "CameraZ" }, @@ -7181,9 +7875,6 @@ "value": "true", "type": "Boolean", "label": "", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "HasJustBeenCreated" }, @@ -7191,9 +7882,6 @@ "value": "true", "type": "Boolean", "label": "Automatically rotate the camera with the object", - "description": "", - "group": "", - "extraInformation": [], "quickCustomizationVisibility": "hidden", "name": "IsRotatingWithObject" }, @@ -7201,9 +7889,6 @@ "value": "false", "type": "Boolean", "label": "Automatically rotate the camera with the object (elevation)", - "description": "", - "group": "", - "extraInformation": [], "quickCustomizationVisibility": "hidden", "name": "IsElevatingWithObject" }, @@ -7213,8 +7898,6 @@ "unit": "DegreeAngle", "label": "Targeted camera rotation angle", "description": "When this angle is set, the camera follow this value instead of the object angle.", - "group": "", - "extraInformation": [], "hidden": true, "name": "TargetedRotationAngle" }, @@ -7224,8 +7907,6 @@ "unit": "DegreeAngle", "label": "Targeted camera rotation angle", "description": "When this angle is set, the camera follow this value instead of the object angle.", - "group": "", - "extraInformation": [], "hidden": true, "name": "TargetedElevationAngle" } @@ -9081,11 +9762,10 @@ "value": "", "type": "Behavior", "label": "3D capability", - "description": "", - "group": "", "extraInformation": [ "Scene3D::Base3DBehavior" ], + "choices": [], "name": "Object3D" }, { @@ -9093,9 +9773,6 @@ "type": "Number", "unit": "Dimensionless", "label": "Horizontal rotation speed factor", - "description": "", - "group": "", - "extraInformation": [], "name": "HorizontalSpeed" }, { @@ -9103,9 +9780,6 @@ "type": "Number", "unit": "Dimensionless", "label": "Vertical rotation speed factor", - "description": "", - "group": "", - "extraInformation": [], "name": "VerticalSpeed" }, { @@ -9113,9 +9787,6 @@ "type": "Number", "unit": "DegreeAngle", "label": "Minimum vertical camera angle", - "description": "", - "group": "", - "extraInformation": [], "name": "VerticalAngleMin" }, { @@ -9123,9 +9794,6 @@ "type": "Number", "unit": "DegreeAngle", "label": "Maximum vertical camera angle", - "description": "", - "group": "", - "extraInformation": [], "name": "VerticalAngleMax" }, { @@ -9133,18 +9801,12 @@ "type": "Number", "unit": "Pixel", "label": "Z position offset", - "description": "", - "group": "", - "extraInformation": [], "name": "OffsetZ" }, { "value": "true", "type": "Boolean", "label": "Lock the pointer on click", - "description": "", - "group": "", - "extraInformation": [], "name": "ShouldLock" } ], @@ -9341,56 +10003,40 @@ "value": "", "type": "Behavior", "label": "3D physics car", - "description": "", - "group": "", "extraInformation": [ "Physics3D::PhysicsCar3D" ], + "choices": [], "name": "PhysicsCar3D" }, { "value": "Space", "type": "KeyboardKey", "label": "Hand brake key", - "description": "", - "group": "", - "extraInformation": [], "name": "HandBrake" }, { "value": "Up", "type": "KeyboardKey", "label": "Up key", - "description": "", - "group": "", - "extraInformation": [], "name": "Up" }, { "value": "Left", "type": "KeyboardKey", "label": "Left key", - "description": "", - "group": "", - "extraInformation": [], "name": "Left" }, { "value": "Down", "type": "KeyboardKey", "label": "Down key", - "description": "", - "group": "", - "extraInformation": [], "name": "Down" }, { "value": "Right", "type": "KeyboardKey", "label": "Right key", - "description": "", - "group": "", - "extraInformation": [], "name": "Right" } ], @@ -9410,17 +10056,17 @@ "name": "Gamepads", "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/gamepad-variant-outline.svg", "shortDescription": "Add support for gamepads (or other controllers) to your game, giving access to information such as button presses, axis positions, trigger pressure, etc...", - "version": "0.8.1", + "version": "0.9.0", "description": [ - "Add support for gamepads (or other controllers).", + "Add support for gamepads (or other physical controllers).", "", "It gives access to:", - "- button presses", - "- axis positions and force", - "- trigger pressure", - "- configurable deadzone", - "- vibration", - "- automatic mappers for platformer characters and top-down movement", + "- button presses,", + "- axis positions and force,", + "- trigger pressure,", + "- configurable deadzone,", + "- vibration,", + "- automatic \"gamepad mapper\" behaviors for 2D and 3D movement behaviors (platformer characters, top-down movement, 3D character etc...). Add one of these to the object with the movement behavior (i.e: the player most of the time) and the behavior will then be controlled automatically by the gamepad (it works by reading the gamepad state and simulating controls). No need for additional events to make it work once the behaviors are set up.", "", "The Bomberman-like example handles 4 players with gamepads ([open the project online](https://editor.gdevelop.io/?project=example://goose-bomberman))." ], @@ -9442,7 +10088,8 @@ "authorIds": [ "2OwwM8ToR9dx9RJ2sAKTcrLmCB92", "taRwmWxwAFYFL9yyBwB3cwBw0BO2", - "mnImQKdn8nQxwzkS5D6a1JB27V23" + "mnImQKdn8nQxwzkS5D6a1JB27V23", + "IWykYNRvhCZBN3vEgKEbBPOR3Oc2" ], "dependencies": [], "globalVariables": [], @@ -9501,83 +10148,323 @@ "name": "onFirstSceneLoaded", "sentence": "", "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [] - }, { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "//Define an new private object javascript for the gamepad extension\r", - "gdjs._extensionController = {\r", - " players: {\r", - " 0: { mapping: 'DEFAULT', lastButtonUsed: -1, deadzone: 0.2, previousFrameStateButtons: {}, rumble: {} },\r", - " 1: { mapping: 'DEFAULT', lastButtonUsed: -1, deadzone: 0.2, previousFrameStateButtons: {}, rumble: {} },\r", - " 2: { mapping: 'DEFAULT', lastButtonUsed: -1, deadzone: 0.2, previousFrameStateButtons: {}, rumble: {} },\r", - " 3: { mapping: 'DEFAULT', lastButtonUsed: -1, deadzone: 0.2, previousFrameStateButtons: {}, rumble: {} },\r", + "if (gdjs._extensionController) {\r", + " return;\r", + "}\r", + "\r", + "/**\r", + " * Associate controller button ids to button names\r", + " */\r", + "const controllerButtonNames = {\r", + " \"XBOX\": {\r", + " 0: \"A\",\r", + " 1: \"B\",\r", + " 2: \"X\",\r", + " 3: \"Y\",\r", + " 4: \"LB\",\r", + " 5: \"RB\",\r", + " 6: \"LT\",\r", + " 7: \"RT\",\r", + " 8: \"BACK\",\r", + " 9: \"START\",\r", + " 10: \"CLICK_STICK_LEFT\",\r", + " 11: \"CLICK_STICK_RIGHT\",\r", + " 12: \"UP\",\r", + " 13: \"DOWN\",\r", + " 14: \"LEFT\",\r", + " 15: \"RIGHT\",\r", + " 16: \"NONE\",\r", + " 17: \"NONE\"\r", " },\r", - " lastActiveController: -1, // Last active controller\r", - " controllerButtonNames: { //Map associating controller button ids to button names\r", - " \"XBOX\": {\r", - " 0: \"A\",\r", - " 1: \"B\",\r", - " 2: \"X\",\r", - " 3: \"Y\",\r", - " 4: \"LB\",\r", - " 5: \"RB\",\r", - " 6: \"LT\",\r", - " 7: \"RT\",\r", - " 8: \"BACK\",\r", - " 9: \"START\",\r", - " 10: \"CLICK_STICK_LEFT\",\r", - " 11: \"CLICK_STICK_RIGHT\",\r", - " 12: \"UP\",\r", - " 13: \"DOWN\",\r", - " 14: \"LEFT\",\r", - " 15: \"RIGHT\",\r", - " 16: \"NONE\",\r", - " 17: \"NONE\"\r", - " },\r", - " \"PS4\": {\r", - " 0: \"CROSS\",\r", - " 1: \"CIRCLE\",\r", - " 2: \"SQUARE\",\r", - " 3: \"TRIANGLE\",\r", - " 4: \"L1\",\r", - " 5: \"R1\",\r", - " 6: \"L2\",\r", - " 7: \"R2\",\r", - " 8: \"SHARE\",\r", - " 9: \"OPTIONS\",\r", - " 10: \"CLICK_STICK_LEFT\",\r", - " 11: \"CLICK_STICK_RIGHT\",\r", - " 12: \"UP\",\r", - " 13: \"DOWN\",\r", - " 14: \"LEFT\",\r", - " 15: \"RIGHT\",\r", - " 16: \"PS_BUTTON\",\r", - " 17: \"CLICK_TOUCHPAD\"\r", - " }\r", + " \"PS4\": {\r", + " 0: \"CROSS\",\r", + " 1: \"CIRCLE\",\r", + " 2: \"SQUARE\",\r", + " 3: \"TRIANGLE\",\r", + " 4: \"L1\",\r", + " 5: \"R1\",\r", + " 6: \"L2\",\r", + " 7: \"R2\",\r", + " 8: \"SHARE\",\r", + " 9: \"OPTIONS\",\r", + " 10: \"CLICK_STICK_LEFT\",\r", + " 11: \"CLICK_STICK_RIGHT\",\r", + " 12: \"UP\",\r", + " 13: \"DOWN\",\r", + " 14: \"LEFT\",\r", + " 15: \"RIGHT\",\r", + " 16: \"PS_BUTTON\",\r", + " 17: \"CLICK_TOUCHPAD\"\r", " }\r", "};\r", "\r", - "gdjs._extensionController.getInputString = function (type, buttonId) {\r", - " const controllerButtonNames = gdjs._extensionController.controllerButtonNames;\r", - " if (controllerButtonNames[type] !== undefined) {\r", - " return controllerButtonNames[type][buttonId];\r", + "/**\r", + " * @param {number} playerId\r", + " */\r", + "function getGamepad(playerId) {\r", + " /** @type {Gamepad[]} */\r", + " const gamepads = navigator.getGamepads ? navigator.getGamepads() : [];\r", + " return gamepads[playerId];\r", + "}\r", + "\r", + "/** @type {{[playerId: number]: Player}} */\r", + "const players = {};\r", + "\r", + "/**\r", + " * @param {number} playerId\r", + " */\r", + "function getPlayer(playerId) {\r", + " let player = players[playerId];\r", + " if (!player) {\r", + " player = new Player(playerId);\r", + " players[playerId] = player;\r", + " }\r", + " return player;\r", + "}\r", + "\r", + "class Player {\r", + " /** @type {number} */\r", + " playerId;\r", + " mapping = 'DEFAULT';\r", + " lastButtonUsed = -1;\r", + " deadzone = 0.2;\r", + " /** @type {{[buttonId: number]: ButtonState}} */\r", + " buttonStates = {};\r", + " rumble = { elapsedTime: 0, duration: 0, weakMagnitude: 0, strongMagnitude: 0 };\r", + "\r", + " /**\r", + " * @param {number} playerId\r", + " */\r", + " constructor(playerId) {\r", + " this.playerId = playerId;\r", + " }\r", + "\r", + " /**\r", + " * @param {number} buttonId\r", + " */\r", + " getButtonState(buttonId) {\r", + " let buttonState = this.buttonStates[buttonId];\r", + " if (!buttonState) {\r", + " buttonState = new ButtonState();\r", + " this.buttonStates[buttonId] = buttonState;\r", + " }\r", + " return buttonState;\r", + " }\r", + "\r", + " /**\r", + " * @param {number} buttonId\r", + " */\r", + " isButtonPressed(buttonId) {\r", + " return this.getButtonState(buttonId).isPressed;\r", + " }\r", + "\r", + " /**\r", + " * @param {number} buttonId\r", + " */\r", + " isButtonJustPressed(buttonId) {\r", + " return this.getButtonState(buttonId).isJustPressed();\r", + " }\r", + "\r", + " /**\r", + " * @param {number} buttonId\r", + " */\r", + " isButtonReleased(buttonId) {\r", + " return this.getButtonState(buttonId).isReleased();\r", + " }\r", + "\r", + " isAnyButtonReleased() {\r", + " for (const buttonId in this.buttonStates) {\r", + " const buttonState = this.buttonStates[buttonId];\r", + " if (buttonState.isReleased()) {\r", + " return true;\r", + " }\r", + " }\r", + " return false;\r", + " }\r", + "\r", + " isAnyButtonPressed() {\r", + " for (const buttonId in this.buttonStates) {\r", + " const buttonState = this.buttonStates[buttonId];\r", + " if (buttonState.isPressed) {\r", + " return true;\r", + " }\r", + " }\r", + " return false;\r", + " }\r", + "}\r", + "\r", + "class ButtonState {\r", + " wasPressed = false;\r", + " isPressed = false;\r", + "\r", + " isReleased() {\r", + " return this.wasPressed && !this.isPressed;\r", + " }\r", + "\r", + " isJustPressed() {\r", + " return !this.wasPressed && this.isPressed;\r", + " }\r", + "}\r", + "\r", + "// Async tasks are run before everything.\r", + "// This is a hack to make sure that button states are updated\r", + "// before mapping behavior events.\r", + "const frameBeginningTask = new class extends gdjs.AsyncTask {\r", + " update() {\r", + " /** @type {Gamepad[]} */\r", + " const gamepads = navigator.getGamepads ? navigator.getGamepads() : [];\r", + " for (let playerId = 0; playerId < gamepads.length; playerId++) {\r", + " const gamepad = gamepads[playerId];\r", + " if (gamepad == null) {\r", + " // The gamepad is not connected.\r", + " continue;\r", + " }\r", + " const player = getPlayer(playerId);\r", + "\r", + " for (let buttonId = 0; buttonId < Object.keys(gamepad.buttons).length; buttonId++) {\r", + " const buttonState = player.getButtonState(buttonId);\r", + " buttonState.wasPressed = buttonState.isPressed;\r", + " buttonState.isPressed = gamepad.buttons[buttonId].pressed;\r", + " if (buttonState.isJustPressed()) {\r", + " player.lastButtonUsed = buttonId;\r", + " }\r", + " }\r", + " }\r", + " return false;\r", + " }\r", + "}();\r", + "\r", + "function onScenePostEvents() {\r", + " /** @type {Gamepad[]} */\r", + " const gamepads = navigator.getGamepads ? navigator.getGamepads() : [];\r", + " for (let playerId = 0; playerId < gamepads.length; playerId++) {\r", + " let gamepad = gamepads[playerId];\r", + " if (gamepad == null) {\r", + " // The gamepad is not connected.\r", + " continue;\r", + " }\r", + " const player = getPlayer(playerId);\r", + " const rumble = player.rumble;\r", + " rumble.elapsedTime += runtimeScene.getElapsedTime(runtimeScene) / 1000;\r", + " if (rumble.duration - rumble.elapsedTime <= 0 &&\r", + " (rumble.weakMagnitude || rumble.strongMagnitude)\r", + " ) {\r", + " rumble.weakMagnitude = 0;\r", + " rumble.strongMagnitude = 0;\r", + " }\r", + " }\r", + "}\r", + "\r", + "/**\r", + " * @param {string} type\r", + " * @param {number} buttonId\r", + " */\r", + "function getInputString(type, buttonId) {\r", + " if (!controllerButtonNames[type]) {\r", + " return \"UNKNOWN_BUTTON\";\r", + " }\r", + " return controllerButtonNames[type][buttonId];\r", + "}\r", + "\r", + "function getButtonId(buttonName) {\r", + " switch (buttonName) {\r", + " case 'A':\r", + " case 'CROSS':\r", + " return 0;\r", + " case 'B':\r", + " case 'CIRCLE':\r", + " return 1;\r", + " case 'X':\r", + " case 'SQUARE':\r", + " return 2;\r", + " case 'Y':\r", + " case 'TRIANGLE':\r", + " return 3;\r", + " case 'LB':\r", + " case 'L1':\r", + " return 4;\r", + " case 'RB':\r", + " case 'R1':\r", + " return 5;\r", + " case 'LT':\r", + " case 'L2':\r", + " return 6;\r", + " case 'RT':\r", + " case 'R2':\r", + " return 7;\r", + " case 'UP':\r", + " return 12;\r", + " case 'DOWN':\r", + " return 13;\r", + " case 'LEFT':\r", + " return 14;\r", + " case 'RIGHT':\r", + " return 15;\r", + " case 'BACK':\r", + " case 'SHARE':\r", + " return 8;\r", + " case 'START':\r", + " case 'OPTIONS':\r", + " return 9;\r", + " case 'CLICK_STICK_LEFT':\r", + " return 10;\r", + " case 'CLICK_STICK_RIGHT':\r", + " return 11;\r", + " //PS4\r", + " case 'PS_BUTTON':\r", + " return 16;\r", + " case 'CLICK_TOUCHPAD':\r", + " return 17;\r", + " default:\r", + " console.error('The gamepad button: ' + buttonName + ' is not valid.');\r", + " return null;\r", " }\r", + "}\r", "\r", - " return \"UNKNOWN_BUTTON\";\r", + "/**\r", + " * @param {number} playerId\r", + " * @param {string} directionName\r", + " * @param {number} axisValueX\r", + " * @param {number} axisValueY\r", + " */\r", + "function isAxisPushed(playerId, directionName, axisValueX, axisValueY) {\r", + " switch (directionName) {\r", + " case 'LEFT':\r", + " return getNormalizedAxisValue(axisValueX, playerId) < 0;\r", + " case 'RIGHT':\r", + " return getNormalizedAxisValue(axisValueX, playerId) > 0;\r", + " case 'UP':\r", + " return getNormalizedAxisValue(axisValueY, playerId) < 0;\r", + " case 'DOWN':\r", + " return getNormalizedAxisValue(axisValueY, playerId) > 0;\r", + " case 'ANY':\r", + " return getNormalizedAxisValue(axisValueX, playerId) < 0\r", + " || getNormalizedAxisValue(axisValueX, playerId) > 0\r", + " || getNormalizedAxisValue(axisValueY, playerId) < 0\r", + " || getNormalizedAxisValue(axisValueY, playerId) > 0\r", + " default:\r", + " console.error('The value stick direction is not valid.');\r", + " return false;\r", + " }\r", "}\r", "\r", - "gdjs._extensionController.axisToAngle = function (deltaX, deltaY) {\r", + "/**\r", + " * @param {number} deltaX\r", + " * @param {number} deltaY\r", + " */\r", + "function axisToAngle(deltaX, deltaY) {\r", " const rad = Math.atan2(deltaY, deltaX);\r", " const deg = rad * (180 / Math.PI);\r", " return deg;\r", "}\r", "\r", - "gdjs._extensionController.isXbox = function (gamepad) {\r", + "/**\r", + " * @param {{id: string}} gamepad\r", + " */\r", + "function isXbox(gamepad) {\r", " return (gamepad ? (\r", " gamepad.id.toUpperCase().indexOf(\"XBOX\") !== -1\r", " // \"XINPUT\" cannot be used to check if it is a xbox controller is just a generic\r", @@ -9586,44 +10473,52 @@ " ) : false);\r", "}\r", "\r", - "//Returns the new value taking into account the dead zone for the player_ID given\r", - "gdjs._extensionController.getNormalizedAxisValue = function (v, player_ID) {\r", + "/**\r", + " * Returns the new value taking into account the dead zone for the player_ID given\r", + " * @param {number} value\r", + " * @param {number} playerID\r", + " */\r", + "function getNormalizedAxisValue(value, playerID) {\r", " // gdjs._extensionController = gdjs._extensionController || { deadzone: 0.2 };\r", "\r", " // Anything smaller than this is assumed to be 0,0\r", - " const DEADZONE = gdjs._extensionController.players[player_ID].deadzone;\r", - "\r", - " if (Math.abs(v) < DEADZONE) {\r", - " // In the dead zone, set to 0\r", - " v = 0;\r", - "\r", - " if (v == null) {\r", - " return 0;\r", - " } else {\r", - " return v;\r", - " }\r", + " const deadzone = getPlayer(playerID).deadzone;\r", "\r", + " if (Math.abs(value) < deadzone) {\r", + " return 0;\r", " } else {\r", " // We're outside the dead zone, but we'd like to smooth\r", " // this value out so it still runs nicely between 0..1.\r", " // That is, we don't want it to jump suddenly from 0 to\r", - " // DEADZONE.\r", + " // deadzone.\r", "\r", - " // Remap v from\r", - " // DEADZONE..1 to 0..(1-DEADZONE)\r", + " // Remap value from\r", + " // deadzone..1 to 0..(1-deadzone)\r", " // or from\r", - " // -1..-DEADZONE to -(1-DEADZONE)..0\r", + " // -1..-deadzone to -(1-deadzone)..0\r", + " value = value - Math.sign(value) * deadzone;\r", "\r", - " v = v - Math.sign(v) * DEADZONE;\r", - "\r", - " // Remap v from\r", - " // 0..(1-DEADZONE) to 0..1\r", + " // Remap value from\r", + " // 0..(1-deadzone) to 0..1\r", " // or from\r", - " // -(1-DEADZONE)..0 to -1..0\r", - "\r", - " return v / (1 - DEADZONE);\r", + " // -(1-deadzone)..0 to -1..0\r", + " return value / (1 - deadzone);\r", " }\r", - "};" + "}\r", + "\r", + "gdjs._extensionController = {\r", + " getPlayer,\r", + " controllerButtonNames,\r", + " getInputString,\r", + " getButtonId,\r", + " axisToAngle,\r", + " isXbox,\r", + " getNormalizedAxisValue,\r", + " isAxisPushed,\r", + " getGamepad,\r", + " onScenePostEvents,\r", + " frameBeginningTask,\r", + "}" ], "parameterObjects": "", "useStrict": true, @@ -9636,59 +10531,35 @@ { "fullName": "", "functionType": "Action", - "name": "onScenePostEvents", + "name": "onSceneLoaded", "sentence": "", "events": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [] - }, + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "// Async tasks are run before everything.\r", + "// This is a hack to make sure that button states are updated\r", + "// before mapping behavior events.\r", + "runtimeScene.getAsyncTasksManager().addTask(gdjs._extensionController.frameBeginningTask);" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "Action", + "name": "onScenePostEvents", + "sentence": "", + "events": [ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "//Each time a player press a button i save the last button pressed for the next frame", - "/** @type {Gamepad[]} */", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);", - "", - "//Get function parameter", - "let countPlayers = Object.keys(gdjs._extensionController.players).length;", - "", - "//Repeat for each players", - "for (let i = 0; i < countPlayers; i++) {", - " let gamepad = gamepads[i]; // Get the gamepad of the player", - "", - " //We have to keep this condition because if the user hasn't plugged in his controller yet, we can't get the controller in the gamepad variable.", - " if (gamepad == null) {", - " continue;", - " }", - "", - " for (let b = 0; b < Object.keys(gamepad.buttons).length; b++) { //For each buttons", - " if (gamepad.buttons[b].pressed) { //One of them is pressed", - " gdjs._extensionController.players[i].lastButtonUsed = b; //Save the button pressed", - "", - " //Save the state of the button for the next frame.", - " gdjs._extensionController.players[i].previousFrameStateButtons[b] = { pressed: true };", - "", - " // Update Last Active Controller", - " gdjs._extensionController.lastActiveController = i;", - " } else {", - " gdjs._extensionController.players[i].previousFrameStateButtons[b] = { pressed: false };", - " }", - " }", - "", - "", - " gdjs._extensionController.players[i].rumble.elapsedTime += runtimeScene.getElapsedTime(runtimeScene) / 1000;", - " if (", - " gdjs._extensionController.players[i].rumble.duration - gdjs._extensionController.players[i].rumble.elapsedTime <= 0 &&", - " (gdjs._extensionController.players[i].rumble.weakMagnitude || gdjs._extensionController.players[i].rumble.strongMagnitude)", - " ) {", - " gdjs._extensionController.players[i].rumble.weakMagnitude = 0;", - " gdjs._extensionController.players[i].rumble.strongMagnitude = 0;", - " }", - "", - "", - "}", + "gdjs._extensionController.onScenePostEvents();", "" ], "parameterObjects": "", @@ -10126,27 +10997,20 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", "\r", - "//Get function parameters\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", - "const trigger = eventsFunctionContext.getArgument(\"trigger\").toUpperCase();\r", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "const trigger = eventsFunctionContext.getArgument(\"Trigger\").toUpperCase();\r", "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier in expression: \"Pressure on a gamepad trigger\", is not valid number, must be between 0 and 4.');\r", - " return;\r", - "}\r", "if (trigger != \"LT\" && trigger != \"RT\" && trigger != \"L2\" && trigger != \"R2\") {\r", " console.error('Parameter trigger is not valid in expression: \"Pressure on a gamepad trigger\"');\r", " return;\r", "}\r", - "\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", - "if (gamepad == null) return;\r", - "\r", + "/** @type {Gamepad} */\r", + "const gamepad = gdjs._extensionController.getGamepad(playerId);\r", + "if (!gamepad) {\r", + " // The gamepad is not connected.\r", + " return;\r", + "}\r", "switch (trigger) {\r", " case 'LT':\r", " case 'L2':\r", @@ -10174,12 +11038,12 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" }, { "description": "Trigger button", - "name": "trigger", + "name": "Trigger", "supplementaryInformation": "[\"LT\",\"RT\",\"L2\",\"R2\"]", "type": "stringWithSelector" } @@ -10196,43 +11060,28 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", + "const { getNormalizedAxisValue } = gdjs._extensionController;\r", "\r", - "//Get function parameters\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", - "const stick = eventsFunctionContext.getArgument(\"stick\").toUpperCase();\r", - "\r", - "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier is not valid in expression: \"Value of a stick force\"');\r", - " return;\r", - "}\r", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "const stick = eventsFunctionContext.getArgument(\"Stick\").toUpperCase();\r", "\r", "if (stick !== \"LEFT\" && stick !== \"RIGHT\") {\r", " console.error('Parameter stick is not valid in expression: \"Value of a stick force\"');\r", " return;\r", "}\r", + "/** @type {Gamepad} */\r", + "const gamepad = gdjs._extensionController.getGamepad(playerId);\r", + "if (!gamepad) {\r", + " // The gamepad is not connected.\r", + " return;\r", + "}\r", + "const axisValueX = stick === 'RIGHT' ? gamepad.axes[2] : gamepad.axes[0];\r", + "const axisValueY = stick === 'RIGHT' ? gamepad.axes[3] : gamepad.axes[1];\r", "\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", - "if (gamepad == null) return;\r", - "\r", - "\r", - "switch (stick) {\r", - " case 'LEFT':\r", - " eventsFunctionContext.returnValue = gdjs.evtTools.common.clamp(Math.abs(gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[0], playerId)) + Math.abs(gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[1], playerId)), 0, 1);\r", - " break;\r", - "\r", - " case 'RIGHT':\r", - " eventsFunctionContext.returnValue = gdjs.evtTools.common.clamp(Math.abs(gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[2], playerId)) + Math.abs(gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[3], playerId)), 0, 1);\r", - " break;\r", - "\r", - " default:\r", - " eventsFunctionContext.returnValue = -1;\r", - " break;\r", - "}" + "eventsFunctionContext.returnValue = gdjs.evtTools.common.clamp(\r", + " Math.abs(getNormalizedAxisValue(axisValueX, playerId)) +\r", + " Math.abs(getNormalizedAxisValue(axisValueY, playerId)), 0, 1);\r", + "" ], "parameterObjects": "", "useStrict": true, @@ -10245,12 +11094,12 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" }, { "description": "Stick: \"Left\" or \"Right\"", - "name": "stick", + "name": "Stick", "supplementaryInformation": "[\"Left\",\"Right\"]", "type": "stringWithSelector" } @@ -10274,7 +11123,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "Gamepads::StickAngle(player_ID, stick)" + "Gamepads::StickAngle(PlayerId, Stick)" ] } ] @@ -10286,12 +11135,12 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" }, { "description": "Stick: \"Left\" or \"Right\"", - "name": "stick", + "name": "Stick", "supplementaryInformation": "[\"Left\",\"Right\"]", "type": "stringWithSelector" } @@ -10308,40 +11157,27 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", - "\r", - "//Get function parameters\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", - "const stick = eventsFunctionContext.getArgument(\"stick\").toUpperCase();\r", + "const { getNormalizedAxisValue } = gdjs._extensionController;\r", "\r", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "const stick = eventsFunctionContext.getArgument(\"Stick\").toUpperCase();\r", "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier is not valid in expression: \"Value of a stick rotation\"');\r", - " return;\r", - "}\r", "if (stick !== \"LEFT\" && stick !== \"RIGHT\") {\r", " console.error('Parameter stick is not valid in expression: \"Value of a stick rotation\"');\r", " return;\r", "}\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", - "if (gamepad == null) return;\r", - "\r", - "switch (stick) {\r", - " case 'LEFT':\r", - " eventsFunctionContext.returnValue = gdjs._extensionController.axisToAngle(gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[0], playerId), gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[1], playerId));\r", - " break;\r", - "\r", - " case 'RIGHT':\r", - " eventsFunctionContext.returnValue = gdjs._extensionController.axisToAngle(gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[2], playerId), gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[3], playerId));\r", - " break;\r", - "\r", - " default:\r", - " eventsFunctionContext.returnValue = -1;\r", - " break;\r", - "}" + "/** @type {Gamepad} */\r", + "const gamepad = gdjs._extensionController.getGamepad(playerId);\r", + "if (!gamepad) {\r", + " // The gamepad is not connected.\r", + " return;\r", + "}\r", + "const axisValueX = stick === 'RIGHT' ? gamepad.axes[2] : gamepad.axes[0];\r", + "const axisValueY = stick === 'RIGHT' ? gamepad.axes[3] : gamepad.axes[1];\r", + "\r", + "eventsFunctionContext.returnValue = gdjs._extensionController.axisToAngle(\r", + " getNormalizedAxisValue(axisValueX, playerId),\r", + " getNormalizedAxisValue(axisValueY, playerId));" ], "parameterObjects": "", "useStrict": true, @@ -10354,12 +11190,12 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" }, { "description": "Stick: \"Left\" or \"Right\"", - "name": "stick", + "name": "Stick", "supplementaryInformation": "[\"Left\",\"Right\"]", "type": "stringWithSelector" } @@ -10377,18 +11213,11 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", "\r", - "//Get function parameters\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", "const stick = eventsFunctionContext.getArgument(\"stick\").toUpperCase();\r", "const direction = eventsFunctionContext.getArgument(\"direction\").toUpperCase();\r", "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier is not valid in expression: \"Value of a gamepad axis\"');\r", - " return;\r", - "}\r", "if (stick != \"LEFT\" && stick != \"RIGHT\") {\r", " console.error('Parameter stick is not valid in expression: \"Value of a gamepad axis\"');\r", " return;\r", @@ -10397,11 +11226,12 @@ " console.error('Parameter direction is not valid in expression: \"Value of a gamepad axis\"');\r", " return;\r", "}\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", - "if (gamepad == null) return;\r", - "\r", + "/** @type {Gamepad} */\r", + "const gamepad = gdjs._extensionController.getGamepad(playerId);\r", + "if (!gamepad) {\r", + " // The gamepad is not connected.\r", + " return;\r", + "}\r", "let parameterError = false;\r", "switch (stick) {\r", " case 'LEFT':\r", @@ -10498,7 +11328,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" }, { @@ -10526,26 +11356,20 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", "\r", - "//Get function parameters\r", "const playerId = eventsFunctionContext.getArgument(\"Gamepad\") - 1;\r", "const stick = eventsFunctionContext.getArgument(\"Stick\").toLowerCase();\r", "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier is not valid in expression: \"Value of a gamepad axis\"');\r", - " return;\r", - "}\r", "if (stick != \"left\" && stick != \"right\") {\r", " console.error('Parameter stick is not valid in expression: \"Value of a gamepad axis\"');\r", " return;\r", "}\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", - "if (gamepad == null) return;\r", - "\r", + "/** @type {Gamepad} */\r", + "const gamepad = gdjs._extensionController.getGamepad(playerId);\r", + "if (!gamepad) {\r", + " // The gamepad is not connected.\r", + " return;\r", + "}\r", "const axisIndex = stick === 'right' ? 2 : 0;\r", "eventsFunctionContext.returnValue = gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[axisIndex], playerId);\r", "" @@ -10583,26 +11407,20 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", "\r", - "//Get function parameters\r", "const playerId = eventsFunctionContext.getArgument(\"Gamepad\") - 1;\r", "const stick = eventsFunctionContext.getArgument(\"Stick\").toLowerCase();\r", "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier is not valid in expression: \"Value of a gamepad axis\"');\r", - " return;\r", - "}\r", "if (stick != \"left\" && stick != \"right\") {\r", " console.error('Parameter stick is not valid in expression: \"Value of a gamepad axis\"');\r", " return;\r", "}\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", - "if (gamepad == null) return;\r", - "\r", + "/** @type {Gamepad} */\r", + "const gamepad = gdjs._extensionController.getGamepad(playerId);\r", + "if (!gamepad) {\r", + " // The gamepad is not connected.\r", + " return;\r", + "}\r", "const axisIndex = stick === 'right' ? 3 : 1;\r", "eventsFunctionContext.returnValue = gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[axisIndex], playerId);\r", "" @@ -10640,136 +11458,57 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", "\r", - "//Get function parameters\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", - "const button = eventsFunctionContext.getArgument(\"button\").toUpperCase();\r", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "const button = eventsFunctionContext.getArgument(\"Button\").toUpperCase();\r", "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier in condition: \"Gamepad button released\", is not valid number, must be between 0 and 4.');\r", - " return;\r", - "}\r", - "if (button === \"\") {\r", - " console.error('Parameter button is not valid in condition: \"Gamepad button released\"');\r", + "let buttonId = gdjs._extensionController.getButtonId(button);\r", + "if (buttonId === null) {\r", " return;\r", "}\r", + "const player = gdjs._extensionController.getPlayer(playerId)\r", + "eventsFunctionContext.returnValue = player.isButtonReleased(buttonId);" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "parameters": [ + { + "description": "The gamepad identifier: 1, 2, 3 or 4", + "name": "PlayerId", + "type": "expression" + }, + { + "description": "Name of the button", + "name": "Button", + "supplementaryInformation": "[\"A\",\"Cross\",\"B\",\"Circle\",\"X\",\"Square\",\"Y\",\"Triangle\",\"LB\",\"L1\",\"RB\",\"R1\",\"LT\",\"L2\",\"RT\",\"R2\",\"Up\",\"Down\",\"Left\",\"Right\",\"Back\",\"Share\",\"Start\",\"Options\",\"Click_Stick_Left\",\"Click_Stick_Right\",\"PS_Button\",\"Click_Touchpad\"]", + "type": "stringWithSelector" + } + ], + "objectGroups": [] + }, + { + "description": "Check if a button was just pressed on a gamepad. Buttons can be:\n* Xbox: \"A\", \"B\", \"X\", \"Y\", \"LB\", \"RB\", \"LT\", \"RT\", \"BACK\", \"START\",\n* PS4: \"CROSS\", \"SQUARE\", \"CIRCLE\", \"TRIANGLE\", \"L1\", \"L2\", \"R1\", \"R2\", \"SHARE\", \"OPTIONS\", \"PS_BUTTON\", \"CLICK_TOUCHPAD\",\n* Other: \"UP\", \"DOWN\", \"LEFT\", \"RIGHT\", \"CLICK_STICK_LEFT\", \"CLICK_STICK_RIGHT\".", + "fullName": "Gamepad button just pressed", + "functionType": "Condition", + "name": "IsButtonJustPressed", + "sentence": "Button _PARAM2_ of gamepad _PARAM1_ was just pressed", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ "\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", - "if (gamepad == null) return;\r", - "\r", - "let buttonId;\r", - "\r", - "switch (button) {\r", - " case 'A':\r", - " case 'CROSS':\r", - " buttonId = 0;\r", - " break;\r", - " case 'B':\r", - " case 'CIRCLE':\r", - " buttonId = 1;\r", - " break;\r", - " case 'X':\r", - " case 'SQUARE':\r", - " buttonId = 2;\r", - " break;\r", - " case 'Y':\r", - " case 'TRIANGLE':\r", - " buttonId = 3;\r", - " break;\r", - " case 'LB':\r", - " case 'L1':\r", - " buttonId = 4;\r", - " break;\r", - " case 'RB':\r", - " case 'R1':\r", - " buttonId = 5;\r", - " break;\r", - " case 'LT':\r", - " case 'L2':\r", - " buttonId = 6;\r", - " break;\r", - " case 'RT':\r", - " case 'R2':\r", - " buttonId = 7;\r", - " break;\r", - "\r", - " case 'UP':\r", - " buttonId = 12;\r", - " break;\r", - " case 'DOWN':\r", - " buttonId = 13;\r", - " break;\r", - " case 'LEFT':\r", - " buttonId = 14;\r", - " break;\r", - " case 'RIGHT':\r", - " buttonId = 15;\r", - " break;\r", - "\r", - " case 'BACK':\r", - " case 'SHARE':\r", - " buttonId = 8;\r", - " break;\r", - " case 'START':\r", - " case 'OPTIONS':\r", - " buttonId = 9;\r", - " break;\r", - "\r", - " case 'CLICK_STICK_LEFT':\r", - " buttonId = 10;\r", - " break;\r", - " case 'CLICK_STICK_RIGHT':\r", - " buttonId = 11;\r", - " break;\r", - "\r", - " //PS4\r", - " case 'PS_BUTTON':\r", - " buttonId = 16;\r", - " break;\r", - " case 'CLICK_TOUCHPAD':\r", - " buttonId = 17;\r", - " break;\r", - "\r", - " default:\r", - " console.error('The button: ' + button + ' in condition: \"Gamepad button released\" is not valid.');\r", - " break;\r", - "}\r", - "\r", - "if (buttonId === undefined) {\r", - " console.error('There is no buttons valid in condition: \"Gamepad button released\"');\r", - " eventsFunctionContext.returnValue = false;\r", - " return;\r", - "}\r", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "const button = eventsFunctionContext.getArgument(\"Button\").toUpperCase();\r", "\r", - "if (gamepad.buttons == null || gamepad.buttons[buttonId] == null) {\r", - " console.error('Buttons on the gamepad are not accessible in condition: \"Gamepad button released\"');\r", - " eventsFunctionContext.returnValue = false;\r", + "let buttonId = gdjs._extensionController.getButtonId(button);\r", + "if (buttonId === null) {\r", " return;\r", "}\r", - "\r", - "//Define default value on pressed button or use previous value\r", - "gdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId] = gdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId] || { pressed: false };\r", - "\r", - "//Get state of button at previous frame\r", - "const previousStateButton = gdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId].pressed;\r", - "\r", - "//When previousStateButton is true and actual button state is not pressed\r", - "//Player have release the button\r", - "if (previousStateButton === true && gamepad.buttons[buttonId].pressed === false) {\r", - " // Save the last button used for the player \r", - " gdjs._extensionController.players[playerId].lastButtonUsed = buttonId;\r", - " gdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId].pressed = true;\r", - " eventsFunctionContext.returnValue = true;\r", - "\r", - "} else {\r", - " gdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId].pressed = false;\r", - " eventsFunctionContext.returnValue = false;\r", - "}\r", - "" + "const player = gdjs._extensionController.getPlayer(playerId)\r", + "eventsFunctionContext.returnValue = player.isButtonJustPressed(buttonId);" ], "parameterObjects": "", "useStrict": true, @@ -10779,12 +11518,12 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" }, { "description": "Name of the button", - "name": "button", + "name": "Button", "supplementaryInformation": "[\"A\",\"Cross\",\"B\",\"Circle\",\"X\",\"Square\",\"Y\",\"Triangle\",\"LB\",\"L1\",\"RB\",\"R1\",\"LT\",\"L2\",\"RT\",\"R2\",\"Up\",\"Down\",\"Left\",\"Right\",\"Back\",\"Share\",\"Start\",\"Options\",\"Click_Stick_Left\",\"Click_Stick_Right\",\"PS_Button\",\"Click_Touchpad\"]", "type": "stringWithSelector" } @@ -10801,17 +11540,9 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "//Get function parameter\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", - "\r", - "//Player id is not valid\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier in expression: \"Last pressed button (id)\", is not valid number, must be between 0 and 4.');\r", - " return;\r", - "}\r", "\r", - "//Return the last button used by the player\r", - "eventsFunctionContext.returnValue = gdjs._extensionController.players[playerId].lastButtonUsed;" + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "eventsFunctionContext.returnValue = gdjs._extensionController.getPlayer(playerId).lastButtonUsed;" ], "parameterObjects": "", "useStrict": true, @@ -10824,7 +11555,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" } ], @@ -10840,46 +11571,10 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", - "\r", - "//Get function parameter\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", - "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier in condition: \"Any gamepad button pressed\", is not valid number, must be between 0 and 4.');\r", - " return;\r", - "}\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", - "if (gamepad == null) return;\r", - "\r", - "let buttonId;\r", - "for (let i = 0; i < gamepad.buttons.length; i++) { //For each buttons\r", - " if (gamepad.buttons[i].pressed) { //One of them is pressed\r", - " buttonId = i; //Save the button pressed\r", - " break;\r", - " }\r", - "}\r", - "\r", - "if (buttonId === undefined) {\r", - " // No buttons are pressed.\r", - " eventsFunctionContext.returnValue = false;\r", - " return;\r", - "}\r", - "\r", - "if (gamepad.buttons == null || gamepad.buttons[buttonId] == null) {\r", - " console.error('Buttons on the gamepad are not accessible in condition: \"Any gamepad button pressed\"');\r", - " eventsFunctionContext.returnValue = false;\r", - " return;\r", - "}\r", - "\r", - "//When a button is pressed, save the button in lastButtonUsed for each players\r", - "if (gamepad.buttons[buttonId].pressed) gdjs._extensionController.players[playerId].lastButtonUsed = buttonId;\r", - "eventsFunctionContext.returnValue = gamepad.buttons[buttonId].pressed;\r", - "\r", "\r", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "const player = gdjs._extensionController.getPlayer(playerId)\r", + "eventsFunctionContext.returnValue = player.isAnyButtonPressed();\r", "" ], "parameterObjects": "", @@ -10890,7 +11585,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" } ], @@ -10906,35 +11601,18 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", "\r", - "//Get function parameters\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", "const controllerType = eventsFunctionContext.getArgument(\"controller_type\").toUpperCase();\r", - "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier in string expression: \"Last pressed button (LastButtonString)\", is not valid number, must be between 0 and 4.');\r", - " return;\r", - "}\r", - "if (controllerType === \"\") {\r", - " console.error('Parameter controller type is not valid in string expression: \"Last pressed button (LastButtonString)\"');\r", + "/** @type {Gamepad} */\r", + "const gamepad = gdjs._extensionController.getGamepad(playerId);\r", + "if (!gamepad) {\r", + " // The gamepad is not connected.\r", " return;\r", "}\r", - "\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "if (gamepad !== null) { //Gamepad exist\r", - " //Get last btn id\r", - " const lastButtonUsedID = gdjs._extensionController.players[playerId].lastButtonUsed;\r", - "\r", - " //Return last button as string \r", - " eventsFunctionContext.returnValue = gdjs._extensionController.getInputString(controllerType, lastButtonUsedID);\r", - "\r", - "} else { //Gamepad dosen't exist\r", - " console.error('Your controller is not supported or the gamepad wasn\\'t detected in string expression: \"Last pressed button (LastButtonString)\"');\r", - " eventsFunctionContext.returnValue = \"Gamepad not connected\";\r", - "}" + "const lastButtonUsedID = gdjs._extensionController.getPlayer(playerId).lastButtonUsed;\r", + "eventsFunctionContext.returnValue = gdjs._extensionController.getInputString(controllerType, lastButtonUsedID);\r", + "" ], "parameterObjects": "", "useStrict": true, @@ -10947,7 +11625,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" }, { @@ -10969,20 +11647,16 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", "\r", - "//Get the last activated controller\r", - "const controllerId = gdjs._extensionController.lastActiveController;\r", - "\r", - "// Check if controller is active\r", - "const gamepad = gamepads[controllerId];\r", - "if (gamepad == null) {\r", - " eventsFunctionContext.returnValue = 0;\r", - "} else {\r", - " // Return active controller id\r", - " eventsFunctionContext.returnValue = controllerId + 1;\r", + "const gamepads = navigator.getGamepads ? navigator.getGamepads() : [];\r", + "let lastGamepadIndex = -1;\r", + "for (let playerId = 0; playerId < gamepads.length; playerId++) {\r", + " // Gamepads can be disconnected and become null\r", + " if (gamepads[playerId]) {\r", + " lastGamepadIndex = playerId\r", + " }\r", "}\r", - "" + "eventsFunctionContext.returnValue = lastGamepadIndex + 1;" ], "parameterObjects": "", "useStrict": true, @@ -11005,127 +11679,16 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", "\r", - "//Get function parameters\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", "const button = eventsFunctionContext.getArgument(\"button\").toUpperCase();\r", "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier in condition: \"Gamepad button pressed\", is not valid number, must be between 0 and 4.');\r", - " return;\r", - "}\r", - "if (button === \"\") {\r", - " console.error('Parameter button is not valid in condition: \"Gamepad button pressed\"');\r", - " eventsFunctionContext.returnValue = false;\r", - " return;\r", - "}\r", - "\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", - "if (gamepad == null) return;\r", - "\r", - "let buttonId;\r", - "\r", - "switch (button) {\r", - " case 'A':\r", - " case 'CROSS':\r", - " buttonId = 0;\r", - " break;\r", - " case 'B':\r", - " case 'CIRCLE':\r", - " buttonId = 1;\r", - " break;\r", - " case 'X':\r", - " case 'SQUARE':\r", - " buttonId = 2;\r", - " break;\r", - " case 'Y':\r", - " case 'TRIANGLE':\r", - " buttonId = 3;\r", - " break;\r", - " case 'LB':\r", - " case 'L1':\r", - " buttonId = 4;\r", - " break;\r", - " case 'RB':\r", - " case 'R1':\r", - " buttonId = 5;\r", - " break;\r", - " case 'LT':\r", - " case 'L2':\r", - " buttonId = 6;\r", - " break;\r", - " case 'RT':\r", - " case 'R2':\r", - " buttonId = 7;\r", - " break;\r", - "\r", - " case 'UP':\r", - " buttonId = 12;\r", - " break;\r", - " case 'DOWN':\r", - " buttonId = 13;\r", - " break;\r", - " case 'LEFT':\r", - " buttonId = 14;\r", - " break;\r", - " case 'RIGHT':\r", - " buttonId = 15;\r", - " break;\r", - "\r", - " case 'BACK':\r", - " case 'SHARE':\r", - " buttonId = 8;\r", - " break;\r", - " case 'START':\r", - " case 'OPTIONS':\r", - " buttonId = 9;\r", - " break;\r", - "\r", - " case 'CLICK_STICK_LEFT':\r", - " buttonId = 10;\r", - " break;\r", - " case 'CLICK_STICK_RIGHT':\r", - " buttonId = 11;\r", - " break;\r", - "\r", - " //PS4\r", - " case 'PS_BUTTON':\r", - " buttonId = 16;\r", - " break;\r", - " case 'CLICK_TOUCHPAD':\r", - " buttonId = 17;\r", - " break;\r", - "\r", - " default:\r", - " console.error('The button: ' + button + ' in condition: \"Gamepad button pressed\" is not valid.');\r", - " eventsFunctionContext.returnValue = false;\r", - " break;\r", - "}\r", - "\r", - "\r", - "\r", - "if (buttonId === undefined) {\r", - " console.error('There is no buttons valid in condition: \"Gamepad button pressed\"');\r", - " eventsFunctionContext.returnValue = false;\r", + "const buttonId = gdjs._extensionController.getButtonId(button);\r", + "if (buttonId === null) {\r", " return;\r", "}\r", - "\r", - "if (gamepad.buttons == null || gamepad.buttons[buttonId] == null) {\r", - " console.error('Buttons on the gamepad are not accessible in condition: \"Gamepad button pressed\"');\r", - " eventsFunctionContext.returnValue = false;\r", - " return;\r", - "}\r", - "\r", - "//When a button is pressed, save the button in lastButtonUsed for each players\r", - "if (gamepad.buttons[buttonId].pressed) gdjs._extensionController.players[playerId].lastButtonUsed = buttonId;\r", - "eventsFunctionContext.returnValue = gamepad.buttons[buttonId].pressed;\r", - "\r", - "\r", - "\r", + "const player = gdjs._extensionController.getPlayer(playerId)\r", + "eventsFunctionContext.returnValue = player.isButtonPressed(buttonId);\r", "" ], "parameterObjects": "", @@ -11136,7 +11699,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" }, { @@ -11163,15 +11726,9 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "//Get function parameter\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier in expression: \"Gamepad deadzone for sticks\", is not valid number, must be between 0 and 4.');\r", - " return;\r", - "}\r", - "///Return the deadzone value for a given player\r", - "eventsFunctionContext.returnValue = gdjs._extensionController.players[playerId].deadzone;" + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "eventsFunctionContext.returnValue = gdjs._extensionController.getPlayer(playerId).deadzone;" ], "parameterObjects": "", "useStrict": true, @@ -11184,7 +11741,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" } ], @@ -11200,18 +11757,12 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "//Get function parameter\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", - "const newDeadzone = eventsFunctionContext.getArgument(\"deadzone\");\r", "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier in action: \"Set gamepad deadzone for sticks\", is not valid, must be between 0 and 4.');\r", - " return;\r", - "}\r", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "const newDeadzone = eventsFunctionContext.getArgument(\"deadzone\");\r", "\r", - "// clamp the newDeadzone in range [0, 1].\r", "// https://github.com/4ian/GDevelop-extensions/pull/33#issuecomment-618224857\r", - "gdjs._extensionController.players[playerId].deadzone = gdjs.evtTools.common.clamp(newDeadzone, 0, 1);\r", + "gdjs._extensionController.getPlayer(playerId).deadzone = gdjs.evtTools.common.clamp(newDeadzone, 0, 1);\r", "" ], "parameterObjects": "", @@ -11222,7 +11773,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" }, { @@ -11243,141 +11794,28 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", "\r", - "//Get function parameters\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", "const stick = eventsFunctionContext.getArgument(\"stick\").toUpperCase();\r", "const direction = eventsFunctionContext.getArgument(\"direction\").toUpperCase();\r", "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier in condition: \"Gamepad stick pushed (axis)\", is not valid number, must be between 0 and 4.');\r", - " return;\r", - "}\r", "if (stick != \"LEFT\" && stick != \"RIGHT\") {\r", " console.error('Parameter stick in condition: \"Gamepad stick pushed (axis)\", is not valid, must be LEFT or RIGHT');\r", " return;\r", "}\r", "if (direction != \"UP\" && direction != \"DOWN\" && direction != \"LEFT\" && direction != \"RIGHT\" && direction != \"ANY\") {\r", - " console.error('Parameter deadzone in condition: \"Gamepad stick pushed (axis)\", is not valid, must be UP, DOWN, LEFT or RIGHT');\r", + " console.error('Parameter direction in condition: \"Gamepad stick pushed (axis)\", is not valid, must be UP, DOWN, LEFT or RIGHT');\r", " return;\r", "}\r", - "\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", - "if (gamepad == null) {\r", - " eventsFunctionContext.returnValue = false;\r", + "/** @type {Gamepad} */\r", + "const gamepad = gdjs._extensionController.getGamepad(playerId);\r", + "if (!gamepad) {\r", + " // The gamepad is not connected.\r", " return;\r", "}\r", - "\r", - "\r", - "//Define in onFirstSceneLoaded function\r", - "const getNormalizedAxisValue = gdjs._extensionController.getNormalizedAxisValue;\r", - "\r", - "switch (stick) {\r", - " case 'LEFT':\r", - " switch (direction) {\r", - " case 'LEFT':\r", - " if (getNormalizedAxisValue(gamepad.axes[0], playerId) < 0) {\r", - " eventsFunctionContext.returnValue = true;\r", - " return;\r", - " }\r", - " break;\r", - "\r", - " case 'RIGHT':\r", - " if (getNormalizedAxisValue(gamepad.axes[0], playerId) > 0) {\r", - " eventsFunctionContext.returnValue = true;\r", - " return;\r", - " }\r", - " break;\r", - "\r", - " case 'UP':\r", - " if (getNormalizedAxisValue(gamepad.axes[1], playerId) < 0) {\r", - " eventsFunctionContext.returnValue = true;\r", - " return;\r", - " }\r", - " break;\r", - "\r", - " case 'DOWN':\r", - " if (getNormalizedAxisValue(gamepad.axes[1], playerId) > 0) {\r", - " eventsFunctionContext.returnValue = true;\r", - " return;\r", - " }\r", - " break;\r", - "\r", - " case 'ANY':\r", - " if ( getNormalizedAxisValue(gamepad.axes[0], playerId) < 0\r", - " || getNormalizedAxisValue(gamepad.axes[0], playerId) > 0\r", - " || getNormalizedAxisValue(gamepad.axes[1], playerId) < 0 \r", - " || getNormalizedAxisValue(gamepad.axes[1], playerId) > 0) {\r", - " eventsFunctionContext.returnValue = true;\r", - " return;\r", - " }\r", - " break;\r", - "\r", - " default:\r", - " console.error('The value Direction on stick Left on the condition: \"Gamepad stick pushed (axis)\" is not valid.');\r", - " eventsFunctionContext.returnValue = false;\r", - " break;\r", - " }\r", - " break;\r", - "\r", - " case 'RIGHT':\r", - " switch (direction) {\r", - " case 'LEFT':\r", - " if (getNormalizedAxisValue(gamepad.axes[2], playerId) < 0) {\r", - " eventsFunctionContext.returnValue = true;\r", - " return;\r", - " }\r", - " break;\r", - "\r", - " case 'RIGHT':\r", - " if (getNormalizedAxisValue(gamepad.axes[2], playerId) > 0) {\r", - " eventsFunctionContext.returnValue = true;\r", - " return;\r", - " }\r", - " break;\r", - "\r", - " case 'UP':\r", - " if (getNormalizedAxisValue(gamepad.axes[3], playerId) < 0) {\r", - " eventsFunctionContext.returnValue = true;\r", - " return;\r", - " }\r", - " break;\r", - "\r", - " case 'DOWN':\r", - " if (getNormalizedAxisValue(gamepad.axes[3], playerId) > 0) {\r", - " eventsFunctionContext.returnValue = true;\r", - " return;\r", - " }\r", - " break;\r", - "\r", - " case 'ANY':\r", - " if ( getNormalizedAxisValue(gamepad.axes[2], playerId) < 0\r", - " || getNormalizedAxisValue(gamepad.axes[2], playerId) > 0\r", - " || getNormalizedAxisValue(gamepad.axes[3], playerId) < 0 \r", - " || getNormalizedAxisValue(gamepad.axes[3], playerId) > 0) {\r", - " eventsFunctionContext.returnValue = true;\r", - " return;\r", - " }\r", - " break;\r", - "\r", - " default:\r", - " console.error('The value Direction on stick Right on the condition: \"Gamepad stick pushed (axis)\" is not valid.');\r", - " eventsFunctionContext.returnValue = false;\r", - " break;\r", - " }\r", - " break;\r", - "\r", - " default:\r", - " console.error('The value Stick on the condition: \"Gamepad stick pushed (axis)\" is not valid.');\r", - " eventsFunctionContext.returnValue = false;\r", - " break;\r", - "}\r", - "\r", - "eventsFunctionContext.returnValue = false;\r", + "const axisValueX = stick === 'RIGHT' ? gamepad.axes[2] : gamepad.axes[0];\r", + "const axisValueY = stick === 'RIGHT' ? gamepad.axes[3] : gamepad.axes[1];\r", + "eventsFunctionContext.returnValue = gdjs._extensionController.isAxisPushed(playerId, direction, axisValueX, axisValueY);\r", "" ], "parameterObjects": "", @@ -11388,7 +11826,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" }, { @@ -11408,24 +11846,24 @@ }, { "description": "Return the number of connected gamepads.", - "fullName": "Connected gamepads number", + "fullName": "Connected gamepads count", "functionType": "Expression", "name": "ConnectedGamepadsCount", "sentence": "", "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [] - }, { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", "\r", - "// Gamepads can be disconnected and become null, so we have to filter them.\r", - "eventsFunctionContext.returnValue = Object.keys(gamepads).filter(key => !!gamepads[key]).length;\r", + "const gamepads = navigator.getGamepads ? navigator.getGamepads() : [];\r", + "let connectedGamepadCount = 0;\r", + "for (let playerId = 0; playerId < gamepads.length; playerId++) {\r", + " // Gamepads can be disconnected and become null\r", + " if (gamepads[playerId]) {\r", + " connectedGamepadCount++;\r", + " }\r", + "}\r", + "eventsFunctionContext.returnValue = connectedGamepadCount;\r", "" ], "parameterObjects": "", @@ -11449,22 +11887,13 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);", - "", - "//Get function parameter", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;", - "", - "if (playerId < 0 || playerId > 4) {", - " console.error('Parameter gamepad identifier in string expression: \"Gamepad type\", is not valid number, must be between 0 and 4');", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;", + "/** @type {Gamepad} */", + "const gamepad = gdjs._extensionController.getGamepad(playerId);", + "if (!gamepad) {", + " // The gamepad is not connected.", " return;", "}", - "", - "const gamepad = gamepads[playerId];", - "", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.", - "if (gamepad == null) return;", - "", "eventsFunctionContext.returnValue = (gamepad && gamepad.id) ? gamepad.id : \"No information for player \" + (playerId + 1)", "" ], @@ -11479,7 +11908,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" } ], @@ -11495,28 +11924,14 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);", - "", - "//Get function parameters", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;", "const controllerType = eventsFunctionContext.getArgument(\"controller_type\").toUpperCase();", - "", - "if (playerId < 0 || playerId > 4) {", - " console.error('Parameter gamepad identifier in condition: \"Gamepad type\", is not valid number, must be between 0 and 4.');", - " return;", - "}", - "if (controllerType === \"\") {", - " console.error('Parameter type in condition: \"Gamepad type\", is not a string.');", + "/** @type {Gamepad} */", + "const gamepad = gdjs._extensionController.getGamepad(playerId);", + "if (!gamepad) {", + " // The gamepad is not connected.", " return;", "}", - "", - "const gamepad = gamepads[playerId];", - "", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.", - "if (gamepad == null) return;", - "", - "", "if (controllerType == \"XBOX\") {", " eventsFunctionContext.returnValue = gdjs._extensionController.isXbox(gamepad);", "} else {", @@ -11531,7 +11946,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" }, { @@ -11552,17 +11967,9 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;", "/** @type {Gamepad[]} */", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);", - "", - "//Get function parameter", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;", - "", - "if (playerId < 0 || playerId > 4) {", - " console.error('Parameter gamepad identifier in condition: \"Gamepad connected\", is not valid number, must be between 0 and 4.');", - " return;", - "}", - "", + "const gamepads = navigator.getGamepads ? navigator.getGamepads() : [];", "// If gamepad was disconnected it will be null (so this will return false)", "// If gamepad was never connected it will be undefined (so this will return false)", "eventsFunctionContext.returnValue = !!gamepads[playerId];" @@ -11575,7 +11982,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" } ], @@ -11591,25 +11998,16 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */", - "//Vibration work only on game in browser.", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);", - "", - "//Get function parameters", - "const playerId = eventsFunctionContext.getArgument(\"Player_ID\") - 1;", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;", "const duration = eventsFunctionContext.getArgument(\"Duration\") || 1;", - "", - "if (playerId < 0 || playerId > 4) {", - " console.error('Parameter gamepad identifier in action: \"Gamepad connected\", is not valid number, must be between 0 and 4.');", - " return;", + "/** @type {Gamepad} */", + "const gamepad = gdjs._extensionController.getGamepad(playerId);", + "if (!gamepad) {", + " // The gamepad is not connected.", + " return;", "}", - "", - "const gamepad = gamepads[playerId];", - "", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.", - "if (gamepad == null) return;", - "", - "if (gamepad && gamepad.vibrationActuator) {", + "//Vibration work only on game in browser.", + "if (gamepad.vibrationActuator) {", " gamepad.vibrationActuator.playEffect(\"dual-rumble\", {", " startDelay: 0,", " duration: duration * 1000,", @@ -11626,7 +12024,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "Player_ID", + "name": "PlayerId", "type": "expression" }, { @@ -11647,35 +12045,19 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */", - "//Vibration work only on game in browser.", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);", - "", - "//Get function parameters", - "const playerId = eventsFunctionContext.getArgument(\"Player_ID\") - 1;", + "const { clamp } = gdjs.evtTools.common;", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;", "const duration = eventsFunctionContext.getArgument(\"Duration\") || 1;", - "const strongRumbleMagnitude = eventsFunctionContext.getArgument(\"StrongMagnitude\");", - "const weakRumbleMagnitude = eventsFunctionContext.getArgument(\"WeakMagnitude\");", - "", - "if (playerId < 0 || playerId > 4) {", - " console.error('Parameter gamepad identifier in action: \"Advanced gamepad vibration\", is not valid number, must be between 0 and 4.');", - " return;", - "}", - "if (weakRumbleMagnitude < 0 || weakRumbleMagnitude > 1) {", - " console.error('Parameter weakRumble identifier in action: \"Advanced gamepad vibration\", is not valid number, must be between 0 and 1.');", - " return;", - "}", - "if (strongRumbleMagnitude < 0 || strongRumbleMagnitude > 1) {", - " console.error('Parameter strongRumble identifier in action: \"Advanced gamepad vibration\", is not valid number, must be between 0 and 1.');", - " return;", + "const strongRumbleMagnitude = clamp(eventsFunctionContext.getArgument(\"StrongMagnitude\"), 0, 1);", + "const weakRumbleMagnitude = clamp(eventsFunctionContext.getArgument(\"WeakMagnitude\"), 0, 1);", + "/** @type {Gamepad} */", + "const gamepad = gdjs._extensionController.getGamepad(playerId);", + "if (!gamepad) {", + " // The gamepad is not connected.", + " return;", "}", - "", - "const gamepad = gamepads[playerId];", - "", - "//we need keep this condition because when use have not yet plug the controller we can't get the controller in the gamepad variable.", - "if (gamepad == null) return;", - "", - "if (gamepad && gamepad.vibrationActuator) {", + "//Vibration work only on game in browser.", + "if (gamepad.vibrationActuator) {", " gamepad.vibrationActuator.playEffect(\"dual-rumble\", {", " startDelay: 0,", " duration: duration * 1000,", @@ -11683,11 +12065,11 @@ " strongMagnitude: strongRumbleMagnitude", " });", "}", - "", - "gdjs._extensionController.players[playerId].rumble.duration = duration;", - "gdjs._extensionController.players[playerId].rumble.elapsedTime = 0;", - "gdjs._extensionController.players[playerId].rumble.weakMagnitude = weakRumbleMagnitude;", - "gdjs._extensionController.players[playerId].rumble.strongMagnitude = strongRumbleMagnitude;" + "const player = gdjs._extensionController.getPlayer(playerId)", + "player.rumble.duration = duration;", + "player.rumble.elapsedTime = 0;", + "player.rumble.weakMagnitude = weakRumbleMagnitude;", + "player.rumble.strongMagnitude = strongRumbleMagnitude;" ], "parameterObjects": "", "useStrict": true, @@ -11697,7 +12079,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "Player_ID", + "name": "PlayerId", "type": "expression" }, { @@ -11728,39 +12110,22 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */", - "//Vibration work only on game in browser.", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);", - "", - "//Get function parameters", - "const playerId = eventsFunctionContext.getArgument(\"Player_ID\") - 1;", - "const elapsedTime = gdjs._extensionController.players[playerId].rumble.elapsedTime || 0;", - "const originalDuration = gdjs._extensionController.players[playerId].rumble.duration || 1;", - "const strongRumbleMagnitude = eventsFunctionContext.getArgument(\"StrongMagnitude\");", - "const weakRumbleMagnitude = eventsFunctionContext.getArgument(\"WeakMagnitude\");", - "", - "", - "if (playerId < 0 || playerId > 4) {", - " console.error('Parameter gamepad identifier in action: \"Change gamepad active vibration\", is not valid number, must be between 0 and 4.');", - " return;", - "}", - "if (weakRumbleMagnitude < 0 || weakRumbleMagnitude > 1) {", - " console.error('Parameter weakRumble identifier in action: \"Change gamepad active vibration\", is not valid number, must be between 0 and 1.');", - " return;", - "}", - "if (strongRumbleMagnitude < 0 || strongRumbleMagnitude > 1) {", - " console.error('Parameter strongRumble identifier in action: \"Change gamepad active vibration\", is not valid number, must be between 0 and 1.');", - " return;", + "const { clamp } = gdjs.evtTools.common;", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;", + "const player = gdjs._extensionController.getPlayer(playerId);", + "const elapsedTime = player.rumble.elapsedTime || 0;", + "const originalDuration = player.rumble.duration || 1;", + "const strongRumbleMagnitude = clamp(eventsFunctionContext.getArgument(\"StrongMagnitude\"), 0, 1);", + "const weakRumbleMagnitude = clamp(eventsFunctionContext.getArgument(\"WeakMagnitude\"), 0, 1);", + "/** @type {Gamepad} */", + "const gamepad = gdjs._extensionController.getGamepad(playerId);", + "if (!gamepad) {", + " // The gamepad is not connected.", + " return;", "}", - "", - "const gamepad = gamepads[playerId];", - "", - "//we need keep this condition because when use have not yet plug the controller we can't get the controller in the gamepad variable.", - "if (gamepad == null) return;", - "", "if (originalDuration - elapsedTime <= 0) return;", - "", - "if (gamepad && gamepad.vibrationActuator) {", + "//Vibration work only on game in browser.", + "if (gamepad.vibrationActuator) {", " gamepad.vibrationActuator.playEffect(\"dual-rumble\", {", " startDelay: 0,", " duration: 1000 * (originalDuration - elapsedTime),", @@ -11769,8 +12134,8 @@ " });", "}", "", - "gdjs._extensionController.players[playerId].rumble.weakMagnitude = weakRumbleMagnitude;", - "gdjs._extensionController.players[playerId].rumble.strongMagnitude = strongRumbleMagnitude;" + "player.rumble.weakMagnitude = weakRumbleMagnitude;", + "player.rumble.strongMagnitude = strongRumbleMagnitude;" ], "parameterObjects": "", "useStrict": true, @@ -11780,7 +12145,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "Player_ID", + "name": "PlayerId", "type": "expression" }, { @@ -11811,54 +12176,10 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", - "\r", - "//Get function parameters\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", - "\r", - "if (playerId < 0 || playerId > 4) {\r", - "\tconsole.error('Parameter gamepad identifier in condition: \"Any gamepad button released\", is not valid number, must be between 0 and 4.');\r", - "\treturn;\r", - "}\r", - "\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", - "if (gamepad == null) return;\r", - "\r", - "for (let buttonId = 0; buttonId < gamepad.buttons.length; buttonId++) { //For each buttons on current frame.\r", - "\r", - "\tif (buttonId === undefined) {\r", - "\t\teventsFunctionContext.returnValue = false;\r", - "\t\treturn;\r", - "\t}\r", - "\r", - "\t//Get previous value or define value by default for the current button\r", - "\tgdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId] = gdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId] || { pressed: false };\r", - "\r", - "\t//Get state of the button at previous frame\r", - "\tconst previousStateButtonIsPressed = gdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId].pressed;\r", - "\r", - "\t//Get the state of the button on the current frame.\r", - "\tconst currentFrameStateButtonIsPressed = gamepad.buttons[buttonId].pressed;\r", "\r", - "\t//When previousStateButtonIsPressed is true and actual button state is not pressed\r", - "\t//Player have release the button\r", - "\tif (previousStateButtonIsPressed === true && currentFrameStateButtonIsPressed === false) {\r", - "\t\tgdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId].pressed = true;\r", - "\t\teventsFunctionContext.returnValue = true;\r", - "\t\t//break;\r", - "\t\treturn;\r", - "\t} else {\r", - "\t\t//The player didn't released the button yet, the previous frame state is still true\r", - "\t\tgdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId].pressed = false;\r", - "\t\teventsFunctionContext.returnValue = false;\r", - "\t}\r", - "\r", - "\tif (currentFrameStateButtonIsPressed) gdjs._extensionController.players[playerId].lastButtonUsed = buttonId;\r", - "}\r", - "" + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "const player = gdjs._extensionController.getPlayer(playerId)\r", + "eventsFunctionContext.returnValue = player.isAnyButtonReleased();" ], "parameterObjects": "", "useStrict": true, @@ -11868,7 +12189,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" } ], @@ -11884,8 +12205,8 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "const playerId = eventsFunctionContext.getArgument(\"Player_ID\") - 1;\r", - "eventsFunctionContext.returnValue = gdjs._extensionController.players[playerId].rumble.weakMagnitude;" + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "eventsFunctionContext.returnValue = gdjs._extensionController.getPlayer(playerId).rumble.weakMagnitude;" ], "parameterObjects": "", "useStrict": true, @@ -11898,7 +12219,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "Player_ID", + "name": "PlayerId", "type": "expression" } ], @@ -11914,8 +12235,8 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "const playerId = eventsFunctionContext.getArgument(\"Player_ID\") - 1;\r", - "eventsFunctionContext.returnValue = gdjs._extensionController.players[playerId].rumble.strongMagnitude;" + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "eventsFunctionContext.returnValue = gdjs._extensionController.getPlayer(playerId).rumble.strongMagnitude;" ], "parameterObjects": "", "useStrict": true, @@ -11928,7 +12249,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "Player_ID", + "name": "PlayerId", "type": "expression" } ], @@ -12429,64 +12750,77 @@ "value": "", "type": "Behavior", "label": "Platformer character behavior", - "description": "", - "group": "", "extraInformation": [ "PlatformBehavior::PlatformerObjectBehavior" ], + "choices": [], "name": "PlatformerCharacter" }, { "value": "1", "type": "Number", "label": "Gamepad identifier (1, 2, 3 or 4)", - "description": "", - "group": "", - "extraInformation": [], "name": "GamepadIdentifier" }, { "value": "true", "type": "Boolean", "label": "Use directional pad", - "description": "", "group": "Controls", - "extraInformation": [], "name": "UseArrows" }, { "value": "true", "type": "Boolean", "label": "Use left stick", - "description": "", "group": "Controls", - "extraInformation": [], "name": "UseLeftStick" }, { "value": "", "type": "Boolean", "label": "Use right stick", - "description": "", "group": "Controls", - "extraInformation": [], "name": "UseRightStick" }, { "value": "A or Cross", "type": "Choice", "label": "Jump button", - "description": "", "group": "Controls", - "extraInformation": [ - "A or Cross", - "B or Circle", - "X or Square", - "Y or Triangle", - "LB or L1", - "RB or R1", - "LT or L2", - "RT or R2" + "choices": [ + { + "label": "A or Cross", + "value": "A or Cross" + }, + { + "label": "B or Circle", + "value": "B or Circle" + }, + { + "label": "X or Square", + "value": "X or Square" + }, + { + "label": "Y or Triangle", + "value": "Y or Triangle" + }, + { + "label": "LB or L1", + "value": "LB or L1" + }, + { + "label": "RB or R1", + "value": "RB or R1" + }, + { + "label": "LT or L2", + "value": "LT or L2" + }, + { + "label": "RT or R2", + "value": "RT or R2" + } ], "name": "JumpButton" } @@ -12615,31 +12949,32 @@ "value": "", "type": "Behavior", "label": "3D physics character", - "description": "", - "group": "", "extraInformation": [ "Physics3D::PhysicsCharacter3D" ], + "choices": [], "name": "PhysicsCharacter3D" }, { "value": "1", "type": "Number", "label": "Gamepad identifier (1, 2, 3 or 4)", - "description": "", - "group": "", - "extraInformation": [], "name": "GamepadIdentifier" }, { "value": "Left", "type": "Choice", "label": "Walk joystick", - "description": "", "group": "Controls", - "extraInformation": [ - "Left", - "Right" + "choices": [ + { + "label": "Left", + "value": "Left" + }, + { + "label": "Right", + "value": "Right" + } ], "name": "JoystickIdentifier" }, @@ -12647,17 +12982,40 @@ "value": "A or Cross", "type": "Choice", "label": "Jump button", - "description": "", "group": "Controls", - "extraInformation": [ - "A or Cross", - "B or Circle", - "X or Square", - "Y or Triangle", - "LB or L1", - "RB or R1", - "LT or L2", - "RT or R2" + "choices": [ + { + "label": "A or Cross", + "value": "A or Cross" + }, + { + "label": "B or Circle", + "value": "B or Circle" + }, + { + "label": "X or Square", + "value": "X or Square" + }, + { + "label": "Y or Triangle", + "value": "Y or Triangle" + }, + { + "label": "LB or L1", + "value": "LB or L1" + }, + { + "label": "RB or R1", + "value": "RB or R1" + }, + { + "label": "LT or L2", + "value": "LT or L2" + }, + { + "label": "RT or R2", + "value": "RT or R2" + } ], "name": "JumpButton" } @@ -12775,31 +13133,32 @@ "value": "", "type": "Behavior", "label": "3D physics character", - "description": "", - "group": "", "extraInformation": [ "Physics3D::PhysicsCharacter3D" ], + "choices": [], "name": "PhysicsCharacter3D" }, { "value": "1", "type": "Number", "label": "Gamepad identifier (1, 2, 3 or 4)", - "description": "", - "group": "", - "extraInformation": [], "name": "GamepadIdentifier" }, { "value": "Left", "type": "Choice", "label": "Walk joystick", - "description": "", "group": "Controls", - "extraInformation": [ - "Left", - "Right" + "choices": [ + { + "label": "Left", + "value": "Left" + }, + { + "label": "Right", + "value": "Right" + } ], "name": "WalkStick" }, @@ -12807,11 +13166,16 @@ "value": "Right", "type": "Choice", "label": "Camera joystick", - "description": "", "group": "Controls", - "extraInformation": [ - "Left", - "Right" + "choices": [ + { + "label": "Left", + "value": "Left" + }, + { + "label": "Right", + "value": "Right" + } ], "name": "CameraStick" }, @@ -12819,17 +13183,40 @@ "value": "A or Cross", "type": "Choice", "label": "Jump button", - "description": "", "group": "Controls", - "extraInformation": [ - "A or Cross", - "B or Circle", - "X or Square", - "Y or Triangle", - "LB or L1", - "RB or R1", - "LT or L2", - "RT or R2" + "choices": [ + { + "label": "A or Cross", + "value": "A or Cross" + }, + { + "label": "B or Circle", + "value": "B or Circle" + }, + { + "label": "X or Square", + "value": "X or Square" + }, + { + "label": "Y or Triangle", + "value": "Y or Triangle" + }, + { + "label": "LB or L1", + "value": "LB or L1" + }, + { + "label": "RB or R1", + "value": "RB or R1" + }, + { + "label": "LT or L2", + "value": "LT or L2" + }, + { + "label": "RT or R2", + "value": "RT or R2" + } ], "name": "JumpButton" } @@ -13762,31 +14149,31 @@ "value": "", "type": "Behavior", "label": "3D capability", - "description": "", - "group": "", "extraInformation": [ "Scene3D::Base3DBehavior" ], + "choices": [], "name": "Object3D" }, { "value": "1", "type": "Number", "label": "Gamepad identifier (1, 2, 3 or 4)", - "description": "", - "group": "", - "extraInformation": [], "name": "GamepadIdentifier" }, { "value": "Right", "type": "Choice", "label": "Camera joystick", - "description": "", - "group": "", - "extraInformation": [ - "Left", - "Right" + "choices": [ + { + "label": "Left", + "value": "Left" + }, + { + "label": "Right", + "value": "Right" + } ], "name": "CameraStick" }, @@ -13795,27 +14182,21 @@ "type": "Number", "unit": "AngularSpeed", "label": "Maximum rotation speed", - "description": "", "group": "Horizontal rotation", - "extraInformation": [], "name": "HorizontalRotationSpeedMax" }, { "value": "360", "type": "Number", "label": "Rotation acceleration", - "description": "", "group": "Horizontal rotation", - "extraInformation": [], "name": "HorizontalRotationAcceleration" }, { "value": "720", "type": "Number", "label": "Rotation deceleration", - "description": "", "group": "Horizontal rotation", - "extraInformation": [], "name": "HorizontalRotationDeceleration" }, { @@ -13823,27 +14204,21 @@ "type": "Number", "unit": "AngularSpeed", "label": "Maximum rotation speed", - "description": "", "group": "Vertical rotation", - "extraInformation": [], "name": "VerticalRotationSpeedMax" }, { "value": "240", "type": "Number", "label": "Rotation acceleration", - "description": "", "group": "Vertical rotation", - "extraInformation": [], "name": "VerticalRotationAcceleration" }, { "value": "480", "type": "Number", "label": "Rotation deceleration", - "description": "", "group": "Vertical rotation", - "extraInformation": [], "name": "VerticalRotationDeceleration" }, { @@ -13851,9 +14226,7 @@ "type": "Number", "unit": "DegreeAngle", "label": "Minimum angle", - "description": "", "group": "Vertical rotation", - "extraInformation": [], "name": "VerticalAngleMin" }, { @@ -13861,9 +14234,7 @@ "type": "Number", "unit": "DegreeAngle", "label": "Maximum angle", - "description": "", "group": "Vertical rotation", - "extraInformation": [], "name": "VerticalAngleMax" }, { @@ -13871,9 +14242,7 @@ "type": "Number", "unit": "Pixel", "label": "Z position offset", - "description": "", "group": "Position", - "extraInformation": [], "name": "OffsetZ" }, { @@ -13881,9 +14250,6 @@ "type": "Number", "unit": "AngularSpeed", "label": "Current rotation speed Z", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "CurrentRotationSpeedZ" }, @@ -13892,9 +14258,6 @@ "type": "Number", "unit": "AngularSpeed", "label": "Current rotation speed Y", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "CurrentRotationSpeedY" } @@ -14194,64 +14557,77 @@ "value": "", "type": "Behavior", "label": "3D physics car", - "description": "", - "group": "", "extraInformation": [ "Physics3D::PhysicsCar3D" ], + "choices": [], "name": "PhysicsCar3D" }, { "value": "1", "type": "Number", "label": "Gamepad identifier (1, 2, 3 or 4)", - "description": "", - "group": "", - "extraInformation": [], "name": "GamepadIdentifier" }, { "value": "true", "type": "Boolean", "label": "Use directional pad", - "description": "", "group": "Controls", - "extraInformation": [], "name": "UseArrows" }, { "value": "true", "type": "Boolean", "label": "Use left stick", - "description": "", "group": "Controls", - "extraInformation": [], "name": "UseLeftStick" }, { "value": "", "type": "Boolean", "label": "Use right stick", - "description": "", "group": "Controls", - "extraInformation": [], "name": "UseRightStick" }, { "value": "B or Circle", "type": "Choice", "label": "Hand brake button", - "description": "", "group": "Controls", - "extraInformation": [ - "A or Cross", - "B or Circle", - "X or Square", - "Y or Triangle", - "LB or L1", - "RB or R1", - "LT or L2", - "RT or R2" + "choices": [ + { + "label": "A or Cross", + "value": "A or Cross" + }, + { + "label": "B or Circle", + "value": "B or Circle" + }, + { + "label": "X or Square", + "value": "X or Square" + }, + { + "label": "Y or Triangle", + "value": "Y or Triangle" + }, + { + "label": "LB or L1", + "value": "LB or L1" + }, + { + "label": "RB or R1", + "value": "RB or R1" + }, + { + "label": "LT or L2", + "value": "LT or L2" + }, + { + "label": "RT or R2", + "value": "RT or R2" + } ], "name": "HandBrakeButton" } @@ -14845,59 +15221,57 @@ "value": "", "type": "Behavior", "label": "Top-down movement behavior", - "description": "", - "group": "", "extraInformation": [ "TopDownMovementBehavior::TopDownMovementBehavior" ], + "choices": [], "name": "TopDownMovement" }, { "value": "1", "type": "Number", "label": "Gamepad identifier (1, 2, 3 or 4)", - "description": "", - "group": "", - "extraInformation": [], "name": "GamepadIdentifier" }, { "value": "true", "type": "Boolean", "label": "Use directional pad", - "description": "", "group": "Controls", - "extraInformation": [], "name": "UseArrows" }, { "value": "true", "type": "Boolean", "label": "Use left stick", - "description": "", "group": "Controls", - "extraInformation": [], "name": "UseLeftStick" }, { "value": "", "type": "Boolean", "label": "Use right stick", - "description": "", "group": "Controls", - "extraInformation": [], "name": "UseRightStick" }, { "value": "Analog", "type": "Choice", "label": "Stick mode", - "description": "", "group": "Controls", - "extraInformation": [ - "Analog", - "360°", - "8 Directions" + "choices": [ + { + "label": "Analog", + "value": "Analog" + }, + { + "label": "360°", + "value": "360°" + }, + { + "label": "8 Directions", + "value": "8 Directions" + } ], "name": "StickMode" } @@ -14918,13 +15292,13 @@ "name": "SpriteMultitouchJoystick", "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/Line Hero Pack/Master/SVG/Videogames/Videogames_controller_joystick_arrows_direction.svg", "shortDescription": "Joysticks or buttons for touchscreens.", - "version": "1.8.2", + "version": "1.9.0", "description": [ - "Multitouch joysticks can be used the same way as physical gamepads:", + "Multitouch joysticks are objects showing a joystick on the screen, useful for mobile. They work like a physical gamepad:", "- 4 or 8 directions", "- Analogus pads", "- Player selection", - "- Controls mapping for top-down movement and platformer characters", + "- Automatic \"mapper\" behaviors for 2D and 3D movement behaviors (platformer characters, top-down movement, 3D character etc...). Add one of these to the object with the movement behavior (i.e: the player most of the time) and the behavior will then be controlled automatically by the virtual joystick (it works by reading the multitouch joystick state and simulating controls). No need for additional events to make it work once the behaviors are set up.", "", "There are ready-to-use joysticks in the asset-store [multitouch joysticks pack](https://editor.gdevelop.io/?initial-dialog=asset-store&asset-pack=multitouch-joysticks-multitouch-joysticks)." ], @@ -14988,6 +15362,28 @@ } ], "eventsFunctions": [ + { + "description": "Check if the events are running for the editor.", + "fullName": "Editor is running", + "functionType": "Condition", + "name": "IsInGameEdition", + "private": true, + "sentence": "Events are running for the editor", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const game = runtimeScene.getGame();\r", + "eventsFunctionContext.returnValue = game.isInGameEdition && game.isInGameEdition();" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [], + "objectGroups": [] + }, { "fullName": "Accelerated speed", "functionType": "Expression", @@ -15393,20 +15789,68 @@ "type": "expression" }, { - "description": "Acceleration", - "name": "Acceleration", + "description": "Acceleration", + "name": "Acceleration", + "type": "expression" + }, + { + "description": "Deceleration", + "name": "Deceleration", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Check if a button was just pressed on a multitouch controller.", + "fullName": "Multitouch controller button just pressed", + "functionType": "Condition", + "name": "IsButtonJustPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ was just pressed", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"JustPressed\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier", "type": "expression" }, { - "description": "Deceleration", - "name": "Deceleration", - "type": "expression" + "description": "Button name", + "name": "Button", + "supplementaryInformation": "[\"A\",\"CROSS\",\"B\",\"CIRCLE\",\"X\",\"SQUARE\",\"Y\",\"TRIANGLE\",\"LB\",\"L1\",\"RB\",\"R1\",\"LT\",\"L2\",\"RT\",\"R2\",\"UP\",\"DOWN\",\"LEFT\",\"RIGHT\",\"BACK\",\"SHARE\",\"START\",\"OPTIONS\",\"CLICK_STICK_LEFT\",\"CLICK_STICK_RIGHT\",\"PS_BUTTON\",\"CLICK_TOUCHPAD\"]", + "type": "string" } ], "objectGroups": [] }, { - "description": "Check if a button is pressed on a gamepad.", + "description": "Check if a button is pressed on a multitouch controller.", "fullName": "Multitouch controller button pressed", "functionType": "Condition", "name": "IsButtonPressed", @@ -15417,12 +15861,30 @@ "conditions": [ { "type": { - "value": "StringVariable" + "value": "BuiltinCommonInstructions::Or" }, - "parameters": [ - "Controllers[ControllerIdentifier].Buttons[Button].State", - "=", - "\"Pressed\"" + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"Pressed\"" + ] + }, + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"JustPressed\"" + ] + } ] } ], @@ -15454,7 +15916,7 @@ "objectGroups": [] }, { - "description": "Check if a button is released on a gamepad.", + "description": "Check if a button is released on a multitouch controller.", "fullName": "Multitouch controller button released", "functionType": "Condition", "name": "IsButtonReleased", @@ -15540,7 +16002,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"JustPressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -16913,41 +17375,23 @@ "conditions": [ { "type": { - "value": "HasGameJustResumed" + "inverted": true, + "value": "SpriteMultitouchJoystick::IsInGameEdition" }, "parameters": [ + "", "" ] } ], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - } - ] - }, - { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Manage touches", - "source": "", - "type": "BuiltinCommonInstructions::Group", + "actions": [], "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "value": "HasAnyTouchOrMouseStarted" + "value": "HasGameJustResumed" }, "parameters": [ "" @@ -16957,171 +17401,207 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" }, "parameters": [ - "TouchIndex", - "=", - "0" + "Object", + "Behavior", + "" ] } - ], + ] + }, + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Manage touches", + "source": "", + "type": "BuiltinCommonInstructions::Group", "events": [ { - "type": "BuiltinCommonInstructions::Repeat", - "repeatExpression": "StartedTouchOrMouseCount()", - "conditions": [], - "actions": [], + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "HasAnyTouchOrMouseStarted" + }, + "parameters": [ + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchIndex", + "=", + "0" + ] + } + ], "events": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "StartedTouchOrMouseCount()", + "conditions": [], + "actions": [], + "events": [ { - "type": { - "value": "NumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "0" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "0" + ] + }, + { + "type": { + "value": "CollisionPoint" + }, + "parameters": [ + "Object", + "TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)", + "TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "StartedTouchOrMouseId(TouchIndex)" + ] + } ] }, { - "type": { - "value": "CollisionPoint" - }, - "parameters": [ - "Object", - "TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)", - "TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "StartedTouchOrMouseId(TouchIndex)" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchIndex", - "+", - "1" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchIndex", + "+", + "1" + ] + } ] } ] } ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 - }, - "comment": "Move thumb back to center when not being pressed (acts like a spring on a real controller)" - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "HasTouchEnded" - }, - "parameters": [ - "", - "TouchId" - ] - } - ], - "actions": [ + }, { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 }, - "parameters": [ - "Object", - "Behavior", - "" - ] - } - ] - } - ], - "parameters": [] - }, - { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Update joystick position", - "source": "", - "type": "BuiltinCommonInstructions::Group", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "comment": "Move thumb back to center when not being pressed (acts like a spring on a real controller)" + }, { - "type": { - "value": "NumberVariable" - }, - "parameters": [ - "TouchId", - "!=", - "0" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "HasTouchEnded" + }, + "parameters": [ + "", + "TouchId" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } ] } ], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickAngle" - }, - "parameters": [ - "Object", - "Behavior", - "AngleBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0))", - "AngleBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0))" - ] - }, + "parameters": [] + }, + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Update joystick position", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "clamp(2 * DistanceBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0)) / Object.Width(), 0, 1)", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "!=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickAngle" + }, + "parameters": [ + "Object", + "Behavior", + "AngleBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0))", + "AngleBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0))" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "clamp(2 * DistanceBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0)) / Object.Width(), 0, 1)", + "" + ] + } ] } - ] + ], + "parameters": [] } - ], - "parameters": [] + ] } ], "parameters": [ @@ -17949,18 +18429,12 @@ "value": "1", "type": "Number", "label": "Multitouch controller identifier (1, 2, 3, 4...)", - "description": "", - "group": "", - "extraInformation": [], "name": "ControllerIdentifier" }, { "value": "Primary", "type": "String", "label": "Joystick name", - "description": "", - "group": "", - "extraInformation": [], "name": "JoystickIdentifier" }, { @@ -17968,17 +18442,12 @@ "type": "Number", "label": "Dead zone radius (range: 0 to 1)", "description": "The deadzone is an area for which movement on sticks won't be taken into account (instead, the stick will be considered as not moved)", - "group": "", - "extraInformation": [], "name": "DeadZoneRadius" }, { "value": "0", "type": "Number", "label": "Joystick angle (range: -180 to 180)", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "JoystickAngle" }, @@ -17986,9 +18455,6 @@ "value": "0", "type": "Number", "label": "Joystick force (range: 0 to 1)", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "JoystickForce" }, @@ -17996,9 +18462,6 @@ "value": "0", "type": "Number", "label": "", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "TouchId" }, @@ -18006,9 +18469,6 @@ "value": "", "type": "Number", "label": "", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "TouchIndex" } @@ -18016,7 +18476,7 @@ "sharedPropertyDescriptors": [] }, { - "description": "Detect button presses made on a touchscreen.", + "description": "Detect presses made on a touchscreen on the object so it acts like a button and automatically trigger the button having the same identifier for the mapper behaviors.", "fullName": "Multitouch button", "name": "MultitouchButton", "objectType": "", @@ -18032,11 +18492,11 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::IsReleased" + "value": "BooleanVariable" }, "parameters": [ - "Object", - "Behavior", + "IsReleased", + "True", "" ] } @@ -18065,6 +18525,44 @@ } ] }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "False", + "" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + }, + "parameters": [ + "Object", + "Behavior", + "\"Pressed\"", + "" + ] + } + ] + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ @@ -18128,11 +18626,10 @@ }, { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::PropertyRadius" + "value": "NumberVariable" }, "parameters": [ - "Object", - "Behavior", + "Radius", ">", "DistanceBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer()), TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer()))" ] @@ -18158,7 +18655,17 @@ "parameters": [ "Object", "Behavior", - "\"Pressed\"", + "\"JustPressed\"", + "" + ] + }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "True", "" ] } @@ -18229,6 +18736,16 @@ "" ] }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "False", + "" + ] + }, { "type": { "value": "SetNumberVariable" @@ -18258,11 +18775,11 @@ "objectGroups": [] }, { - "description": "Check if button is released.", - "fullName": "Button released", + "description": "Check if the button was just pressed.", + "fullName": "Button just pressed", "functionType": "Condition", - "name": "IsReleased", - "sentence": "Button _PARAM0_ is released", + "name": "IsJustPressed", + "sentence": "Button _PARAM0_ was just pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -18272,7 +18789,7 @@ "value": "BooleanVariable" }, "parameters": [ - "IsReleased", + "IsJustPressed", "True", "" ] @@ -18306,7 +18823,7 @@ "objectGroups": [] }, { - "description": "Check if button is pressed.", + "description": "Check if the button is pressed.", "fullName": "Button pressed", "functionType": "Condition", "name": "IsPressed", @@ -18353,6 +18870,54 @@ ], "objectGroups": [] }, + { + "description": "Check if the button is released.", + "fullName": "Button released", + "functionType": "Condition", + "name": "IsReleased", + "sentence": "Button _PARAM0_ is released", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsReleased", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "type": "behavior" + } + ], + "objectGroups": [] + }, { "fullName": "Button state", "functionType": "Action", @@ -18394,7 +18959,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"JustPressed\",\"Pressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -18406,27 +18971,18 @@ "value": "1", "type": "Number", "label": "Multitouch controller identifier (1, 2, 3, 4...)", - "description": "", - "group": "", - "extraInformation": [], "name": "ControllerIdentifier" }, { "value": "A", "type": "String", "label": "Button identifier", - "description": "", - "group": "", - "extraInformation": [], "name": "ButtonIdentifier" }, { "value": "0", "type": "Number", "label": "TouchID", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "TouchId" }, @@ -18434,9 +18990,6 @@ "value": "", "type": "Number", "label": "", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "TouchIndex" }, @@ -18444,20 +18997,22 @@ "value": "", "type": "Boolean", "label": "Button released", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "IsReleased" }, + { + "value": "", + "type": "Boolean", + "label": "Button just pressed", + "hidden": true, + "name": "IsJustPressed" + }, { "value": "0", "type": "Number", "unit": "Pixel", "label": "Triggering circle radius", "description": "This circle adds up to the object collision mask.", - "group": "", - "extraInformation": [], "name": "Radius" } ], @@ -18646,31 +19201,32 @@ "value": "", "type": "Behavior", "label": "Platform character behavior", - "description": "", - "group": "", "extraInformation": [ "PlatformBehavior::PlatformerObjectBehavior" ], + "choices": [], "name": "Property" }, { "value": "1", "type": "Number", "label": "Controller identifier (1, 2, 3, 4...)", - "description": "", - "group": "", - "extraInformation": [], "name": "ControllerIdentifier" }, { "value": "Primary", "type": "Choice", "label": "Joystick name", - "description": "", "group": "Controls", - "extraInformation": [ - "Primary", - "Secondary" + "choices": [ + { + "label": "Primary", + "value": "Primary" + }, + { + "label": "Secondary", + "value": "Secondary" + } ], "name": "JoystickIdentifier" }, @@ -18678,9 +19234,7 @@ "value": "A", "type": "String", "label": "Jump button name", - "description": "", "group": "Controls", - "extraInformation": [], "name": "JumpButton" } ], @@ -18790,31 +19344,32 @@ "value": "", "type": "Behavior", "label": "3D physics character", - "description": "", - "group": "", "extraInformation": [ "Physics3D::PhysicsCharacter3D" ], + "choices": [], "name": "PhysicsCharacter3D" }, { "value": "1", "type": "Number", "label": "Controller identifier (1, 2, 3, 4...)", - "description": "", - "group": "", - "extraInformation": [], "name": "ControllerIdentifier" }, { "value": "Primary", "type": "Choice", "label": "Walk joystick", - "description": "", "group": "Controls", - "extraInformation": [ - "Primary", - "Secondary" + "choices": [ + { + "label": "Primary", + "value": "Primary" + }, + { + "label": "Secondary", + "value": "Secondary" + } ], "name": "JoystickIdentifier" }, @@ -18822,9 +19377,7 @@ "value": "A", "type": "String", "label": "Jump button name", - "description": "", "group": "Controls", - "extraInformation": [], "name": "JumpButton" } ], @@ -18923,31 +19476,32 @@ "value": "", "type": "Behavior", "label": "3D physics character", - "description": "", - "group": "", "extraInformation": [ "Physics3D::PhysicsCharacter3D" ], + "choices": [], "name": "PhysicsCharacter3D" }, { "value": "1", "type": "Number", "label": "Controller identifier (1, 2, 3, 4...)", - "description": "", - "group": "", - "extraInformation": [], "name": "ControllerIdentifier" }, { "value": "Primary", "type": "Choice", "label": "Walk joystick", - "description": "", "group": "Controls", - "extraInformation": [ - "Primary", - "Secondary" + "choices": [ + { + "label": "Primary", + "value": "Primary" + }, + { + "label": "Secondary", + "value": "Secondary" + } ], "name": "JoystickIdentifier" }, @@ -18955,9 +19509,7 @@ "value": "A", "type": "String", "label": "Jump button name", - "description": "", "group": "Controls", - "extraInformation": [], "name": "JumpButton" } ], @@ -19889,31 +20441,32 @@ "value": "", "type": "Behavior", "label": "3D capability", - "description": "", - "group": "", "extraInformation": [ "Scene3D::Base3DBehavior" ], + "choices": [], "name": "Object3D" }, { "value": "1", "type": "Number", "label": "Controller identifier (1, 2, 3, 4...)", - "description": "", - "group": "", - "extraInformation": [], "name": "ControllerIdentifier" }, { "value": "Secondary", "type": "Choice", "label": "Camera joystick", - "description": "", "group": "Controls", - "extraInformation": [ - "Primary", - "Secondary" + "choices": [ + { + "label": "Primary", + "value": "Primary" + }, + { + "label": "Secondary", + "value": "Secondary" + } ], "name": "CameraStick" }, @@ -19922,27 +20475,21 @@ "type": "Number", "unit": "AngularSpeed", "label": "Maximum rotation speed", - "description": "", "group": "Horizontal rotation", - "extraInformation": [], "name": "HorizontalRotationSpeedMax" }, { "value": "360", "type": "Number", "label": "Rotation acceleration", - "description": "", "group": "Horizontal rotation", - "extraInformation": [], "name": "HorizontalRotationAcceleration" }, { "value": "720", "type": "Number", "label": "Rotation deceleration", - "description": "", "group": "Horizontal rotation", - "extraInformation": [], "name": "HorizontalRotationDeceleration" }, { @@ -19950,27 +20497,21 @@ "type": "Number", "unit": "AngularSpeed", "label": "Maximum rotation speed", - "description": "", "group": "Vertical rotation", - "extraInformation": [], "name": "VerticalRotationSpeedMax" }, { "value": "240", "type": "Number", "label": "Rotation acceleration", - "description": "", "group": "Vertical rotation", - "extraInformation": [], "name": "VerticalRotationAcceleration" }, { "value": "480", "type": "Number", "label": "Rotation deceleration", - "description": "", "group": "Vertical rotation", - "extraInformation": [], "name": "VerticalRotationDeceleration" }, { @@ -19978,9 +20519,7 @@ "type": "Number", "unit": "DegreeAngle", "label": "Minimum angle", - "description": "", "group": "Vertical rotation", - "extraInformation": [], "name": "VerticalAngleMin" }, { @@ -19988,9 +20527,7 @@ "type": "Number", "unit": "DegreeAngle", "label": "Maximum angle", - "description": "", "group": "Vertical rotation", - "extraInformation": [], "name": "VerticalAngleMax" }, { @@ -19998,9 +20535,7 @@ "type": "Number", "unit": "Pixel", "label": "Z position offset", - "description": "", "group": "Position", - "extraInformation": [], "name": "OffsetZ" }, { @@ -20008,9 +20543,6 @@ "type": "Number", "unit": "AngularSpeed", "label": "Current rotation speed Z", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "CurrentRotationSpeedZ" }, @@ -20019,9 +20551,6 @@ "type": "Number", "unit": "AngularSpeed", "label": "Current rotation speed Y", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "CurrentRotationSpeedY" } @@ -20150,31 +20679,32 @@ "value": "", "type": "Behavior", "label": "3D physics car", - "description": "", - "group": "", "extraInformation": [ "Physics3D::PhysicsCar3D" ], + "choices": [], "name": "PhysicsCar3D" }, { "value": "1", "type": "Number", "label": "Controller identifier (1, 2, 3, 4...)", - "description": "", - "group": "", - "extraInformation": [], "name": "ControllerIdentifier" }, { "value": "Primary", "type": "Choice", "label": "Steer joystick", - "description": "", "group": "Controls", - "extraInformation": [ - "Primary", - "Secondary" + "choices": [ + { + "label": "Primary", + "value": "Primary" + }, + { + "label": "Secondary", + "value": "Secondary" + } ], "name": "SteerJoystickIdentifier" }, @@ -20182,11 +20712,16 @@ "value": "Secondary", "type": "Choice", "label": "Speed joystick", - "description": "", "group": "Controls", - "extraInformation": [ - "Primary", - "Secondary" + "choices": [ + { + "label": "Primary", + "value": "Primary" + }, + { + "label": "Secondary", + "value": "Secondary" + } ], "name": "SpeedJoystickIdentifier" }, @@ -20194,9 +20729,7 @@ "value": "B", "type": "String", "label": "Hand brake button name", - "description": "", "group": "Controls", - "extraInformation": [], "name": "HandBrakeButton" } ], @@ -20718,31 +21251,31 @@ "value": "", "type": "Behavior", "label": "Top-down movement behavior", - "description": "", - "group": "", "extraInformation": [ "TopDownMovementBehavior::TopDownMovementBehavior" ], + "choices": [], "name": "TopDownMovement" }, { "value": "1", "type": "Number", "label": "Controller identifier (1, 2, 3, 4...)", - "description": "", - "group": "", - "extraInformation": [], "name": "ControllerIdentifier" }, { "value": "Primary", "type": "Choice", "label": "Joystick name", - "description": "", - "group": "", - "extraInformation": [ - "Primary", - "Secondary" + "choices": [ + { + "label": "Primary", + "value": "Primary" + }, + { + "label": "Secondary", + "value": "Secondary" + } ], "name": "JoystickIdentifier" }, @@ -20750,12 +21283,20 @@ "value": "Analog", "type": "Choice", "label": "Stick mode", - "description": "", "group": "Controls", - "extraInformation": [ - "Analog", - "360°", - "8 Directions" + "choices": [ + { + "label": "Analog", + "value": "Analog" + }, + { + "label": "360°", + "value": "360°" + }, + { + "label": "8 Directions", + "value": "8 Directions" + } ], "name": "StickMode" } @@ -20996,74 +21537,92 @@ "name": "doStepPostEvents", "sentence": "", "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "MettreAutour" - }, - "parameters": [ - "Thumb", - "Border", - "Border.MultitouchJoystick::JoystickForce() * Border.Width() / 2", - "Border.MultitouchJoystick::JoystickAngle()" - ] - } - ] - }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "ShouldBeHiddenWhenReleased", - "True", - "" - ] - }, - { - "type": { - "inverted": true, - "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::IsPressed" - }, - "parameters": [ - "Object", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "Cache" - }, - "parameters": [ - "Object" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::ActivateControl" + "inverted": true, + "value": "SpriteMultitouchJoystick::IsInGameEdition" }, "parameters": [ - "Object", - "no", + "", "" ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "MettreAutour" + }, + "parameters": [ + "Thumb", + "Border", + "Border.MultitouchJoystick::JoystickForce() * Border.Width() / 2", + "Border.MultitouchJoystick::JoystickAngle()" + ] + } + ] }, { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "ShouldBeHiddenWhenReleased", - "False", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "ShouldBeHiddenWhenReleased", + "True", + "" + ] + }, + { + "type": { + "inverted": true, + "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::IsPressed" + }, + "parameters": [ + "Object", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "Cache" + }, + "parameters": [ + "Object" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::ActivateControl" + }, + "parameters": [ + "Object", + "no", + "" + ] + }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "ShouldBeHiddenWhenReleased", + "False", + "" + ] + } ] } ] @@ -21998,20 +22557,21 @@ "value": "1", "type": "Number", "label": "Multitouch controller identifier (1, 2, 3, 4...)", - "description": "", - "group": "", - "extraInformation": [], "name": "ControllerIdentifier" }, { "value": "Primary", "type": "Choice", "label": "Joystick name", - "description": "", - "group": "", - "extraInformation": [ - "Primary", - "Secondary" + "choices": [ + { + "label": "Primary", + "value": "Primary" + }, + { + "label": "Secondary", + "value": "Secondary" + } ], "name": "JoystickIdentifier" }, @@ -22020,8 +22580,6 @@ "type": "Number", "label": "Dead zone radius (range: 0 to 1)", "description": "The deadzone is an area for which movement on sticks won't be taken into account (instead, the stick will be considered as not moved)", - "group": "", - "extraInformation": [], "name": "DeadZoneRadius" }, { @@ -22029,10 +22587,10 @@ "type": "String", "label": "", "description": "Only used by the scene editor.", - "group": "", "extraInformation": [ "Thumb" ], + "choices": [], "hidden": true, "name": "ThumbAnchorOrigin" }, @@ -22041,8 +22599,6 @@ "type": "Number", "label": "", "description": "Only used by the scene editor.", - "group": "", - "extraInformation": [], "hidden": true, "name": "ThumbAnchorTarget" }, @@ -22051,10 +22607,10 @@ "type": "Boolean", "label": "", "description": "Only used by the scene editor.", - "group": "", "extraInformation": [ "Thumb" ], + "choices": [], "hidden": true, "name": "ThumbIsScaledProportionally" }, @@ -22063,8 +22619,6 @@ "type": "String", "label": "", "description": "Only used by the scene editor.", - "group": "", - "extraInformation": [], "hidden": true, "name": "ParentOrigin" }, @@ -22072,9 +22626,6 @@ "value": "", "type": "Boolean", "label": "", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "ShouldBeHiddenWhenReleased" } @@ -22094,7 +22645,7 @@ "name": "ScreenOrientationChecker", "previewIconUrl": "https://asset-resources.gdevelop.io/public-resources/Icons/0126888931a4a4f82bb2824df9f096347ace1c47f510c44df42aa8dc9e49e24a_screen-rotation.svg", "shortDescription": "Display a customizable screen asking the user to rotate their phone/tablet if not in the right orientation.", - "version": "0.1.0", + "version": "0.2.0", "description": "Display a customizable screen asking the user to rotate their phone/tablet if not in the right orientation.", "origin": { "identifier": "ScreenOrientationChecker", @@ -22117,6 +22668,28 @@ ], "sceneVariables": [], "eventsFunctions": [ + { + "description": "Check if the events are running for the editor.", + "fullName": "Editor is running", + "functionType": "Condition", + "name": "IsInGameEdition", + "private": true, + "sentence": "Events are running for the editor", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const game = runtimeScene.getGame();\r", + "eventsFunctionContext.returnValue = game.isInGameEdition && game.isInGameEdition();" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [], + "objectGroups": [] + }, { "fullName": "Get game target orientation", "functionType": "StringExpression", @@ -22235,6 +22808,7 @@ "textAlignment": "center", "verticalTextAlignment": "top", "characterSize": 30, + "lineHeight": 0, "color": "255;255;255" } }, @@ -22435,6 +23009,38 @@ } ], "eventsFunctions": [ + { + "fullName": "", + "functionType": "Action", + "name": "onCreated", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "PrimitiveDrawing::ClearBetweenFrames" + }, + "parameters": [ + "BackgroundPainter", + "" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "ScreenOrientationChecker::ScreenOrientationChecker", + "type": "object" + } + ], + "objectGroups": [] + }, { "fullName": "", "functionType": "Action", @@ -22442,41 +23048,66 @@ "sentence": "", "events": [ { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 - }, - "comment": "Check if the screen must be shown" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "ScreenOrientationChecker::IsInGameEdition" + }, + "parameters": [ + "", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "ScreenOrientationChecker::ScreenOrientationChecker::DrawBackground" + }, + "parameters": [ + "Object", + "" + ] + } + ] }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "value": "SystemInfo::IsMobile" + "inverted": true, + "value": "ScreenOrientationChecker::IsInGameEdition" }, - "parameters": [] + "parameters": [ + "", + "" + ] } ], "actions": [], "events": [ + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Check if the screen must be shown" + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "value": "BuiltinCommonInstructions::CompareNumbers" + "value": "SystemInfo::IsMobile" }, - "parameters": [ - "SceneWindowWidth()", - ">", - "SceneWindowHeight()" - ] + "parameters": [] } ], "actions": [], @@ -22486,24 +23117,69 @@ "conditions": [ { "type": { - "value": "StringVariable" + "value": "BuiltinCommonInstructions::CompareNumbers" }, "parameters": [ - "TargetOrientation", - "=", - "\"portrait\"" + "SceneWindowWidth()", + ">", + "SceneWindowHeight()" ] } ], - "actions": [ + "actions": [], + "events": [ { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsShown", - "False", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "TargetOrientation", + "=", + "\"portrait\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsShown", + "False", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "TargetOrientation", + "!=", + "\"portrait\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsShown", + "False", + "" + ] + } ] } ] @@ -22513,364 +23189,366 @@ "conditions": [ { "type": { - "value": "StringVariable" + "value": "BuiltinCommonInstructions::CompareNumbers" }, "parameters": [ - "TargetOrientation", - "!=", - "\"portrait\"" + "SceneWindowWidth()", + "<=", + "SceneWindowHeight()" ] } ], - "actions": [ + "actions": [], + "events": [ { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsShown", - "False", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "TargetOrientation", + "=", + "\"landscape\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsShown", + "False", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "TargetOrientation", + "=", + "\"portrait\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsShown", + "False", + "" + ] + } ] } ] } ] }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Show/hide the screen as needed" + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "value": "BuiltinCommonInstructions::CompareNumbers" + "value": "BuiltinCommonInstructions::Or" }, - "parameters": [ - "SceneWindowWidth()", - "<=", - "SceneWindowHeight()" - ] - } - ], - "actions": [], - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "parameters": [], + "subInstructions": [ { "type": { - "value": "StringVariable" + "value": "BooleanVariable" }, "parameters": [ - "TargetOrientation", - "=", - "\"landscape\"" + "IsShown", + "True", + "" ] - } - ], - "actions": [ + }, { "type": { - "value": "SetBooleanVariable" + "value": "BooleanVariable" }, "parameters": [ - "IsShown", - "False", + "IsForceShown", + "True", "" ] } ] + } + ], + "actions": [ + { + "type": { + "value": "ScreenOrientationChecker::ScreenOrientationChecker::DrawBackground" + }, + "parameters": [ + "Object", + "" + ] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "TargetOrientation", - "=", - "\"portrait\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsShown", - "False", - "" - ] - } + "type": { + "value": "Montre" + }, + "parameters": [ + "Object", + "" ] } ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 - }, - "comment": "Show/hide the screen as needed" - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + }, { - "type": { - "value": "BuiltinCommonInstructions::Or" - }, - "parameters": [], - "subInstructions": [ + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { "type": { - "value": "ScreenOrientationChecker::ScreenOrientationChecker::PropertyIsShown" + "inverted": true, + "value": "BooleanVariable" }, "parameters": [ - "Object" + "IsShown", + "True", + "" ] }, { "type": { - "value": "ScreenOrientationChecker::ScreenOrientationChecker::PropertyIsForceShown" + "inverted": true, + "value": "BooleanVariable" + }, + "parameters": [ + "IsForceShown", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "Cache" }, "parameters": [ "Object" ] } ] - } - ], - "actions": [ - { - "type": { - "value": "PrimitiveDrawing::FillColor" - }, - "parameters": [ - "BackgroundPainter", - "BackgroundColor" - ] - }, - { - "type": { - "value": "PrimitiveDrawing::RoundedRectangle" - }, - "parameters": [ - "BackgroundPainter", - "Padding", - "Padding", - "Object.Width()-Padding", - "Object.Height()-Padding", - "CornerRadius" - ] - }, - { - "type": { - "value": "Montre" - }, - "parameters": [ - "Object", - "" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "inverted": true, - "value": "BooleanVariable" - }, - "parameters": [ - "IsShown", - "True", - "" - ] - }, - { - "type": { - "inverted": true, - "value": "BooleanVariable" - }, - "parameters": [ - "IsForceShown", - "True", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "Cache" - }, - "parameters": [ - "Object" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "MettreY" - }, - "parameters": [ - "Icon", - "=", - "Text.Y() - 100" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 - }, - "comment": "Animate the icon" - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "inverted": true, - "value": "Tween::Exists" - }, - "parameters": [ - "Icon", - "Tween", - "\"Rotate\"" - ] }, { - "type": { - "inverted": true, - "value": "Tween::Exists" - }, - "parameters": [ - "Icon", - "Tween", - "\"RotateBack\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "Tween::TweenBehavior::AddObjectAngleTween2" - }, - "parameters": [ - "Icon", - "Tween", - "\"Rotate\"", - "8", - "\"easeInOutQuad\"", - "2", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "MettreY" + }, + "parameters": [ + "Icon", + "=", + "Text.Y() - 100" + ] + } ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + }, { - "type": { - "value": "Tween::HasFinished" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 }, - "parameters": [ - "Icon", - "Tween", - "\"RotateBack\"" + "comment": "Animate the icon" + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "Tween::Exists" + }, + "parameters": [ + "Icon", + "Tween", + "\"Rotate\"" + ] + }, + { + "type": { + "inverted": true, + "value": "Tween::Exists" + }, + "parameters": [ + "Icon", + "Tween", + "\"RotateBack\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "Tween::TweenBehavior::AddObjectAngleTween2" + }, + "parameters": [ + "Icon", + "Tween", + "\"Rotate\"", + "8", + "\"easeInOutQuad\"", + "2", + "" + ] + } ] - } - ], - "actions": [ + }, { - "type": { - "value": "Tween::TweenBehavior::AddObjectAngleTween2" - }, - "parameters": [ - "Icon", - "Tween", - "\"Rotate\"", - "8", - "\"easeInOutQuad\"", - "2", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Tween::HasFinished" + }, + "parameters": [ + "Icon", + "Tween", + "\"RotateBack\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "Tween::TweenBehavior::AddObjectAngleTween2" + }, + "parameters": [ + "Icon", + "Tween", + "\"Rotate\"", + "8", + "\"easeInOutQuad\"", + "2", + "" + ] + }, + { + "type": { + "value": "Tween::RemoveTween" + }, + "parameters": [ + "Icon", + "Tween", + "\"RotateBack\"" + ] + } ] }, { - "type": { - "value": "Tween::RemoveTween" - }, - "parameters": [ - "Icon", - "Tween", - "\"RotateBack\"" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Tween::HasFinished" + }, + "parameters": [ + "Icon", + "Tween", + "\"Rotate\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "Tween::TweenBehavior::AddObjectAngleTween2" + }, + "parameters": [ + "Icon", + "Tween", + "\"RotateBack\"", + "-8", + "\"easeInOutQuad\"", + "2", + "" + ] + }, + { + "type": { + "value": "Tween::RemoveTween" + }, + "parameters": [ + "Icon", + "Tween", + "\"Rotate\"" + ] + } ] } ] - }, + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "ScreenOrientationChecker::ScreenOrientationChecker", + "type": "object" + } + ], + "objectGroups": [] + }, + { + "description": "Draw the background.", + "fullName": "Draw the background", + "functionType": "Action", + "name": "DrawBackground", + "private": true, + "sentence": "Draw the background of _PARAM0_", + "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "Tween::HasFinished" - }, - "parameters": [ - "Icon", - "Tween", - "\"Rotate\"" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "Tween::TweenBehavior::AddObjectAngleTween2" - }, - "parameters": [ - "Icon", - "Tween", - "\"RotateBack\"", - "-8", - "\"easeInOutQuad\"", - "2", - "" - ] - }, - { - "type": { - "value": "Tween::RemoveTween" + "value": "PrimitiveDrawing::RoundedRectangle" }, "parameters": [ - "Icon", - "Tween", - "\"Rotate\"" + "BackgroundPainter", + "Padding", + "Padding", + "Object.Width()-Padding", + "Object.Height()-Padding", + "CornerRadius" ] } ] @@ -22890,7 +23568,6 @@ "description": "Check if the screen should be forced to be shown. Use this to test the screen in your game.", "fullName": "Force show the screen", "functionType": "Condition", - "group": "Screen Orientation Checker configuration", "name": "IsForceShown", "sentence": "_PARAM0_ is forced to be shown", "events": [ @@ -22934,7 +23611,6 @@ "description": "Change if the screen should be forced to be shown. Use this to test the screen in your game.", "fullName": "Force show the screen", "functionType": "Action", - "group": "Screen Orientation Checker configuration", "name": "SetIsForceShown", "sentence": "Force _PARAM0_ to be shown: _PARAM1_", "events": [ @@ -23010,6 +23686,76 @@ } ], "objectGroups": [] + }, + { + "description": "the message of the object.", + "fullName": "Message", + "functionType": "ExpressionAndCondition", + "name": "Message", + "sentence": "the message", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnString" + }, + "parameters": [ + "Text.Text::Value()" + ] + } + ] + } + ], + "expressionType": { + "type": "string" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "ScreenOrientationChecker::ScreenOrientationChecker", + "type": "object" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "Message", + "name": "SetMessage", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "TextContainerCapability::TextContainerBehavior::SetValue" + }, + "parameters": [ + "Text", + "Text", + "=", + "Value" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "ScreenOrientationChecker::ScreenOrientationChecker", + "type": "object" + } + ], + "objectGroups": [] } ], "propertyDescriptors": [ @@ -23017,9 +23763,6 @@ "value": "", "type": "Boolean", "label": "", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "IsShown" }, @@ -23028,8 +23771,6 @@ "type": "Boolean", "label": "Force show the screen", "description": "Use this to test the screen in your game", - "group": "", - "extraInformation": [], "name": "IsForceShown" }, { @@ -23037,9 +23778,7 @@ "type": "Number", "unit": "Pixel", "label": "Padding", - "description": "", "group": "Appearance", - "extraInformation": [], "name": "Padding" }, { @@ -23049,20 +23788,277 @@ "label": "Corner radius", "description": "Corner radius for the background", "group": "Appearance", - "extraInformation": [], "name": "CornerRadius" - }, - { - "value": "0;0;0", - "type": "Color", - "label": "Background color", - "description": "", - "group": "Appearance", - "extraInformation": [], - "name": "BackgroundColor" } ], - "variants": [] + "variants": [ + { + "areaMaxX": 400, + "areaMaxY": 200, + "areaMaxZ": 0, + "areaMinX": 0, + "areaMinY": 0, + "areaMinZ": 0, + "assetStoreAssetId": "2743bcd6cf431c6c00cda3a59684eb152b3a09d598b799b15383e4f77daf8b37", + "assetStoreOriginalName": "Black screen orientation checker", + "name": "Black screen orientation checker", + "objects": [ + { + "assetStoreId": "", + "bold": true, + "italic": false, + "name": "Text", + "smoothed": true, + "type": "TextObject::Text", + "underlined": false, + "variables": [], + "effects": [], + "behaviors": [ + { + "name": "Anchor", + "type": "AnchorBehavior::AnchorBehavior", + "bottomEdgeAnchor": 0, + "leftEdgeAnchor": 4, + "relativeToOriginalWindowSize": true, + "rightEdgeAnchor": 0, + "topEdgeAnchor": 4, + "useLegacyBottomAndRightAnchors": false + }, + { + "name": "Tween", + "type": "Tween::TweenBehavior" + } + ], + "string": "Rotate screen to play", + "font": "", + "textAlignment": "center", + "characterSize": 30, + "color": { + "b": 255, + "g": 255, + "r": 255 + }, + "content": { + "bold": true, + "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": "Rotate screen to play", + "font": "", + "textAlignment": "center", + "verticalTextAlignment": "top", + "characterSize": 30, + "lineHeight": 0, + "color": "255;255;255" + } + }, + { + "assetStoreId": "", + "name": "BackgroundPainter", + "type": "PrimitiveDrawing::Drawer", + "variables": [], + "effects": [], + "behaviors": [], + "fillOpacity": 255, + "outlineSize": 0, + "outlineOpacity": 255, + "absoluteCoordinates": true, + "clearBetweenFrames": true, + "antialiasing": "none", + "fillColor": { + "r": 0, + "g": 0, + "b": 0 + }, + "outlineColor": { + "r": 0, + "g": 0, + "b": 0 + } + }, + { + "adaptCollisionMaskAutomatically": true, + "assetStoreId": "", + "name": "Icon", + "type": "Sprite", + "updateIfNotVisible": false, + "variables": [], + "effects": [], + "behaviors": [ + { + "name": "Anchor", + "type": "AnchorBehavior::AnchorBehavior", + "bottomEdgeAnchor": 0, + "leftEdgeAnchor": 4, + "topEdgeAnchor": 4, + "relativeToOriginalWindowSize": true, + "rightEdgeAnchor": 0, + "useLegacyBottomAndRightAnchors": false + }, + { + "name": "Tween", + "type": "Tween::TweenBehavior" + } + ], + "animations": [ + { + "name": "", + "useMultipleDirections": false, + "directions": [ + { + "looping": false, + "timeBetweenFrames": 0.08, + "sprites": [ + { + "hasCustomCollisionMask": true, + "image": "rotate-screen-icon.png", + "points": [], + "originPoint": { + "name": "origine", + "x": 52.5, + "y": 56.5 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [ + [ + { + "x": 0, + "y": 1 + }, + { + "x": 105, + "y": 1 + }, + { + "x": 105, + "y": 113 + }, + { + "x": 0, + "y": 113 + } + ] + ] + } + ] + } + ] + } + ] + } + ], + "objectsFolderStructure": { + "folderName": "__ROOT", + "children": [ + { + "objectName": "Text" + }, + { + "objectName": "BackgroundPainter" + }, + { + "objectName": "Icon" + } + ] + }, + "objectsGroups": [], + "layers": [ + { + "ambientLightColorB": 200, + "ambientLightColorG": 200, + "ambientLightColorR": 200, + "camera3DFarPlaneDistance": 10000, + "camera3DFieldOfView": 45, + "camera3DNearPlaneDistance": 3, + "cameraType": "", + "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": [] + } + ], + "instances": [ + { + "angle": 0, + "customSize": true, + "depth": 1, + "height": 35, + "keepRatio": true, + "layer": "", + "name": "Text", + "persistentUuid": "65c003ea-19c0-4f18-a189-a02a24378f35", + "width": 207, + "x": 104, + "y": 120, + "zOrder": 15, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "keepRatio": true, + "layer": "", + "name": "BackgroundPainter", + "persistentUuid": "49ff4576-6406-41de-a43b-1355529d61fe", + "width": 0, + "x": 38, + "y": 17, + "zOrder": 14, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "keepRatio": true, + "layer": "", + "name": "Icon", + "persistentUuid": "39cbfc66-13f4-43dc-b6ef-2bda83153277", + "width": 0, + "x": 204, + "y": 64, + "zOrder": 16, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + } + ] + } + ] } ] } diff --git a/examples/3d-endless-terrain/assets/rotate-screen-icon.png b/examples/3d-endless-terrain/assets/rotate-screen-icon.png index ba619fae3995e5576c1e1de0a994b5b3da7c39dc..a7726dee34eba34b401b26b73b5bf128ff7c26d7 100644 GIT binary patch delta 1155 zcmV-}1bqAP28{`j8Gi-<007npjm!W5010qNS#tmY3ljhU3ljkVnw%H_00citL_t(| z+U?!pwW2T(1>jc#B~St-Sb`f&sWc6&`9(FdUz!2ufn{)iP zFJiu(WD*ki`Z89$_tpJVezDjscc9w;Dee8UV~f~C+WUWt3x9BoE<;GAA1{n9Lr|{@ zqssu2^Y0f%*G5QJKfU}!SHTucgVg$YrDGSkF3j%!Io&_~OrSGcalK6LxB$k7zpdGt z>qJfWqT$~ihuFO(#CgD+!@nus0J<6ZiS%%a zkf}|^8PsuMdVjrc^u)TVX37}y=+c;8r;DCh5fD}nm|iOaRgvga*5YUmcf7|0vi#q!c*I(ogbVKXj!WbtPaQpC|t;`*$0UbAGITFauxcL)7eRfch zWg0}F+i+Pabb;3_pdyo0RG?zy-(H}hB0n}OAb6=+_+O}R$dcG1qkMjHi6KeFYy6Dy|o2u0uhKn1R@ZD2t*(P z5r{wpA`pR~fxZc3{|6Ds_>YpO0tuvZ9gW&Tt$+AYI|8Y;sne)z_~hZ9Kx)_Xw`h+? zJ%J1&g$m7X_6G$j)%Wj-%@-Yk7GIbCUdYHJ1zG|vy0+mdmtUF{Hz-in=Rx9>OQT)6 zc_@U5>MDEpP@q77iX^98EJC3y^@z=?x3#~_3>4B@oOqJuA;lMN4h06Z-Zo{cP-v^! zqJOLFQh#}JD8$`_k2-!rH1NXcxkeJ4Gh0@-dvY`XKK3?f$MHuG zs2Zfl{nW^dyusRsEy4v`R|hB-0p*)GT?B{GqujlnMkdMC44gj9;TS!Nv;W(ZrF^D3 z0(u;InLTk5rN`0nB&=|BPu2{HlVJA$Y|+*eXZzXz)Y7eTMu_FV^m-1=fl-q_y?(cF z2`6C`U1lOxY{B#?cRjJ&lb3|baOvu2spC}}%ON=ea-z)Z?* zMqugDC_atNmBAsU1(z{AT5-3YssWQGU52g&%X!B2s%Mq_v$$(=XiTc za}skxbf@G~0#nJw!Z{>~f8@5gv!W~3SS=M$839QocMjN)O*LdV9? zCxOu7>e+n%6@fxID5@S*;$Z0FH}9klXisOV_8tv}_R~*oyQATd>iB@{h2UF@UMScf z^n-rT|AlB4WM)D6e-tnrGSO7O2kh{OROJk_T_cC_UAK)$ZJ5INF{(-24+01>)f1p+ z95vCbs~;*Ya@)d8?~6laGW${nb&ANwFb!{XN5?_)8Eql8iwCYn^VL zlW!>ix;j1cC}j1fn;F`qpl#yz4yQpu5aSx+l7b+^xt6-1f3O{PW!7>1_eTdJOURK2$=wV@}4LZLO*%q^QFz=P%!X=ku;#hqe3bKyY{tK Date: Tue, 7 Oct 2025 17:52:02 +0200 Subject: [PATCH 04/12] [3D first person] Update the extensions --- examples/3d-first-person/3d-first-person.json | 9776 +++++++++-------- .../assets/rotate-screen-icon.png | Bin 881 -> 1165 bytes 2 files changed, 5061 insertions(+), 4715 deletions(-) diff --git a/examples/3d-first-person/3d-first-person.json b/examples/3d-first-person/3d-first-person.json index 8c05444c1..d726b3fa8 100644 --- a/examples/3d-first-person/3d-first-person.json +++ b/examples/3d-first-person/3d-first-person.json @@ -1,7 +1,7 @@ { "firstLayout": "", "gdVersion": { - "build": 226, + "build": 242, "major": 5, "minor": 5, "revision": 0 @@ -419,7 +419,7 @@ "smoothed": true, "userAdded": false, "origin": { - "identifier": "https://asset-resources.gdevelop.io/public-resources/Mobile Layouts/assets/6a8102ce3340bf9f62300ee1a81ef0b2327b2c6e8d62d7dda68d547f5e2b5969_rotate-screen-icon.png", + "identifier": "https://asset-resources.gdevelop.io/public-resources/Mobile Layouts/6a8102ce3340bf9f62300ee1a81ef0b2327b2c6e8d62d7dda68d547f5e2b5969_rotate-screen-icon.png", "name": "rotate-screen-icon.png" } } @@ -1125,7 +1125,14 @@ "angularDamping": 0.1, "gravityScale": 1, "layers": 17, - "masks": 17 + "masks": 17, + "shapeOffsetX": 0, + "shapeOffsetY": 0, + "shapeOffsetZ": 0, + "massCenterOffsetX": 0, + "massCenterOffsetY": 0, + "massCenterOffsetZ": 0, + "massOverride": 0 } ], "content": { @@ -1182,7 +1189,14 @@ "angularDamping": 0.1, "gravityScale": 1, "layers": 17, - "masks": 17 + "masks": 17, + "shapeOffsetX": 0, + "shapeOffsetY": 0, + "shapeOffsetZ": 0, + "massCenterOffsetX": 0, + "massCenterOffsetY": 0, + "massCenterOffsetZ": 0, + "massOverride": 0 } ], "content": { @@ -1239,7 +1253,14 @@ "angularDamping": 0.1, "gravityScale": 1, "layers": 17, - "masks": 17 + "masks": 17, + "shapeOffsetX": 0, + "shapeOffsetY": 0, + "shapeOffsetZ": 0, + "massCenterOffsetX": 0, + "massCenterOffsetY": 0, + "massCenterOffsetZ": 0, + "massOverride": 0 } ], "content": { @@ -1337,7 +1358,14 @@ "angularDamping": 0.1, "gravityScale": 1, "layers": 17, - "masks": 17 + "masks": 17, + "shapeOffsetX": 0, + "shapeOffsetY": 0, + "shapeOffsetZ": 0, + "massCenterOffsetX": 0, + "massCenterOffsetY": 0, + "massCenterOffsetZ": 0, + "massOverride": 0 }, { "name": "PhysicsCharacter3D", @@ -1416,6 +1444,7 @@ "assetStoreId": "9be1b0d0d5a1afad4537db989ea5e3a4a4564dfd123630a9bf61330a73803c63", "name": "WalkJoystick", "type": "SpriteMultitouchJoystick::SpriteMultitouchJoystick", + "variant": "", "variables": [], "effects": [], "behaviors": [], @@ -1505,6 +1534,8 @@ "crossfadeDuration": 0, "depth": 20, "height": 20, + "isCastingShadow": false, + "isReceivingShadow": false, "keepAspectRatio": true, "materialType": "StandardWithoutMetalness", "modelResourceName": "Soda Can.glb", @@ -1561,6 +1592,7 @@ "assetStoreId": "", "name": "SelectionParticleEmitter", "type": "ParticleEmitter3D::ParticleEmitter3D", + "variant": "", "variables": [], "effects": [], "behaviors": [], @@ -1721,6 +1753,7 @@ "assetStoreId": "e5919fb86a559b00001678c710efe55f4e9f2e032a9ff9610087370f998d57de", "name": "ScreenOrientationChecker", "type": "ScreenOrientationChecker::ScreenOrientationChecker", + "variant": "Black screen orientation checker", "variables": [], "effects": [], "behaviors": [ @@ -1740,116 +1773,6 @@ "BackgroundColor": "24;24;24", "CornerRadius": 8, "Padding": 5 - }, - "childrenContent": { - "BackgroundPainter": { - "fillOpacity": 255, - "outlineSize": 0, - "outlineOpacity": 255, - "absoluteCoordinates": true, - "clearBetweenFrames": true, - "antialiasing": "none", - "fillColor": { - "r": 0, - "g": 0, - "b": 0 - }, - "outlineColor": { - "r": 0, - "g": 0, - "b": 0 - } - }, - "Icon": { - "adaptCollisionMaskAutomatically": true, - "updateIfNotVisible": false, - "animations": [ - { - "name": "", - "useMultipleDirections": false, - "directions": [ - { - "looping": false, - "timeBetweenFrames": 0.08, - "sprites": [ - { - "hasCustomCollisionMask": true, - "image": "rotate-screen-icon.png", - "points": [], - "originPoint": { - "name": "origine", - "x": 52.5, - "y": 56.5 - }, - "centerPoint": { - "automatic": true, - "name": "centre", - "x": 0, - "y": 0 - }, - "customCollisionMask": [ - [ - { - "x": 0, - "y": 1 - }, - { - "x": 105, - "y": 1 - }, - { - "x": 105, - "y": 113 - }, - { - "x": 0, - "y": 113 - } - ] - ] - } - ] - } - ] - } - ] - }, - "Text": { - "bold": true, - "italic": false, - "smoothed": true, - "underlined": false, - "string": "Rotate screen to play", - "font": "", - "textAlignment": "center", - "characterSize": 30, - "color": { - "b": 255, - "g": 255, - "r": 255 - }, - "content": { - "bold": true, - "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": "Rotate screen to play", - "font": "", - "textAlignment": "center", - "verticalTextAlignment": "top", - "characterSize": 30, - "color": "255;255;255" - } - } } } ], @@ -2127,6 +2050,27 @@ "SodaCan.Object3D::CenterZ()" ] } + ], + "events": [ + { + "disabled": true, + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "MettreXY" + }, + "parameters": [ + "SelectionParticleEmitter", + "=", + "SodaCan.CenterX()", + "=", + "SodaCan.CenterY()" + ] + } + ] + } ] } ] @@ -3089,56 +3033,40 @@ "value": "", "type": "Behavior", "label": "3D physics character", - "description": "", - "group": "", "extraInformation": [ "Physics3D::PhysicsCharacter3D" ], + "choices": [], "name": "PhysicsCharacter3D" }, { "value": "Space", "type": "KeyboardKey", "label": "Jump key", - "description": "", - "group": "", - "extraInformation": [], "name": "Jump" }, { "value": "w", "type": "KeyboardKey", "label": "Up key", - "description": "", - "group": "", - "extraInformation": [], "name": "Up" }, { "value": "a", "type": "KeyboardKey", "label": "Left key", - "description": "", - "group": "", - "extraInformation": [], "name": "Left" }, { "value": "s", "type": "KeyboardKey", "label": "Down key", - "description": "", - "group": "", - "extraInformation": [], "name": "Down" }, { "value": "d", "type": "KeyboardKey", "label": "Right key", - "description": "", - "group": "", - "extraInformation": [], "name": "Right" }, { @@ -3146,9 +3074,6 @@ "type": "Number", "unit": "DegreeAngle", "label": "", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "CameraAngle" }, @@ -3156,9 +3081,6 @@ "value": "", "type": "Boolean", "label": "Camera is locked for the frame", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "LockedCameraAngle" } @@ -3324,56 +3246,40 @@ "value": "", "type": "Behavior", "label": "3D physics character", - "description": "", - "group": "", "extraInformation": [ "Physics3D::PhysicsCharacter3D" ], + "choices": [], "name": "PhysicsCharacter3D" }, { "value": "Space", "type": "KeyboardKey", "label": "Jump key", - "description": "", - "group": "", - "extraInformation": [], "name": "Jump" }, { "value": "w", "type": "KeyboardKey", "label": "Up key", - "description": "", - "group": "", - "extraInformation": [], "name": "Up" }, { "value": "a", "type": "KeyboardKey", "label": "Left key", - "description": "", - "group": "", - "extraInformation": [], "name": "Left" }, { "value": "s", "type": "KeyboardKey", "label": "Down key", - "description": "", - "group": "", - "extraInformation": [], "name": "Down" }, { "value": "d", "type": "KeyboardKey", "label": "Right key", - "description": "", - "group": "", - "extraInformation": [], "name": "Right" } ], @@ -4803,11 +4709,10 @@ "value": "", "type": "Behavior", "label": "3D capability", - "description": "", - "group": "", "extraInformation": [ "Scene3D::Base3DBehavior" ], + "choices": [], "name": "Object3D" }, { @@ -4815,9 +4720,6 @@ "type": "Number", "unit": "Dimensionless", "label": "Horizontal rotation speed factor", - "description": "", - "group": "", - "extraInformation": [], "name": "HorizontalSpeed" }, { @@ -4825,9 +4727,6 @@ "type": "Number", "unit": "Dimensionless", "label": "Vertical rotation speed factor", - "description": "", - "group": "", - "extraInformation": [], "name": "VerticalSpeed" }, { @@ -4835,9 +4734,6 @@ "type": "Number", "unit": "DegreeAngle", "label": "Minimum vertical camera angle", - "description": "", - "group": "", - "extraInformation": [], "name": "VerticalAngleMin" }, { @@ -4845,9 +4741,6 @@ "type": "Number", "unit": "DegreeAngle", "label": "Maximum vertical camera angle", - "description": "", - "group": "", - "extraInformation": [], "name": "VerticalAngleMax" }, { @@ -4855,18 +4748,12 @@ "type": "Number", "unit": "Pixel", "label": "Z position offset", - "description": "", - "group": "", - "extraInformation": [], "name": "OffsetZ" }, { "value": "true", "type": "Boolean", "label": "Lock the pointer on click", - "description": "", - "group": "", - "extraInformation": [], "name": "ShouldLock" } ], @@ -4886,17 +4773,17 @@ "name": "Gamepads", "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/gamepad-variant-outline.svg", "shortDescription": "Add support for gamepads (or other controllers) to your game, giving access to information such as button presses, axis positions, trigger pressure, etc...", - "version": "0.7.0", + "version": "0.9.0", "description": [ - "Add support for gamepads (or other controllers).", + "Add support for gamepads (or other physical controllers).", "", "It gives access to:", - "- button presses", - "- axis positions and force", - "- trigger pressure", - "- configurable deadzone", - "- vibration", - "- automatic mappers for platformer characters and top-down movement", + "- button presses,", + "- axis positions and force,", + "- trigger pressure,", + "- configurable deadzone,", + "- vibration,", + "- automatic \"gamepad mapper\" behaviors for 2D and 3D movement behaviors (platformer characters, top-down movement, 3D character etc...). Add one of these to the object with the movement behavior (i.e: the player most of the time) and the behavior will then be controlled automatically by the gamepad (it works by reading the gamepad state and simulating controls). No need for additional events to make it work once the behaviors are set up.", "", "The Bomberman-like example handles 4 players with gamepads ([open the project online](https://editor.gdevelop.io/?project=example://goose-bomberman))." ], @@ -4918,11 +4805,59 @@ "authorIds": [ "2OwwM8ToR9dx9RJ2sAKTcrLmCB92", "taRwmWxwAFYFL9yyBwB3cwBw0BO2", - "mnImQKdn8nQxwzkS5D6a1JB27V23" + "mnImQKdn8nQxwzkS5D6a1JB27V23", + "IWykYNRvhCZBN3vEgKEbBPOR3Oc2" ], "dependencies": [], "globalVariables": [], - "sceneVariables": [], + "sceneVariables": [ + { + "name": "Buttons", + "type": "structure", + "children": [ + { + "name": "A or Cross", + "type": "string", + "value": "A" + }, + { + "name": "B or Circle", + "type": "string", + "value": "B" + }, + { + "name": "LB or L1", + "type": "string", + "value": "LB" + }, + { + "name": "LT or L2", + "type": "string", + "value": "LT" + }, + { + "name": "RB or R1", + "type": "string", + "value": "RB" + }, + { + "name": "RT or R2", + "type": "string", + "value": "RT" + }, + { + "name": "X or Square", + "type": "string", + "value": "X" + }, + { + "name": "Y or Triangle", + "type": "string", + "value": "Y" + } + ] + } + ], "eventsFunctions": [ { "fullName": "", @@ -4930,83 +4865,323 @@ "name": "onFirstSceneLoaded", "sentence": "", "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [] - }, { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "//Define an new private object javascript for the gamepad extension\r", - "gdjs._extensionController = {\r", - " players: {\r", - " 0: { mapping: 'DEFAULT', lastButtonUsed: -1, deadzone: 0.2, previousFrameStateButtons: {}, rumble: {} },\r", - " 1: { mapping: 'DEFAULT', lastButtonUsed: -1, deadzone: 0.2, previousFrameStateButtons: {}, rumble: {} },\r", - " 2: { mapping: 'DEFAULT', lastButtonUsed: -1, deadzone: 0.2, previousFrameStateButtons: {}, rumble: {} },\r", - " 3: { mapping: 'DEFAULT', lastButtonUsed: -1, deadzone: 0.2, previousFrameStateButtons: {}, rumble: {} },\r", + "if (gdjs._extensionController) {\r", + " return;\r", + "}\r", + "\r", + "/**\r", + " * Associate controller button ids to button names\r", + " */\r", + "const controllerButtonNames = {\r", + " \"XBOX\": {\r", + " 0: \"A\",\r", + " 1: \"B\",\r", + " 2: \"X\",\r", + " 3: \"Y\",\r", + " 4: \"LB\",\r", + " 5: \"RB\",\r", + " 6: \"LT\",\r", + " 7: \"RT\",\r", + " 8: \"BACK\",\r", + " 9: \"START\",\r", + " 10: \"CLICK_STICK_LEFT\",\r", + " 11: \"CLICK_STICK_RIGHT\",\r", + " 12: \"UP\",\r", + " 13: \"DOWN\",\r", + " 14: \"LEFT\",\r", + " 15: \"RIGHT\",\r", + " 16: \"NONE\",\r", + " 17: \"NONE\"\r", " },\r", - " lastActiveController: -1, // Last active controller\r", - " controllerButtonNames: { //Map associating controller button ids to button names\r", - " \"XBOX\": {\r", - " 0: \"A\",\r", - " 1: \"B\",\r", - " 2: \"X\",\r", - " 3: \"Y\",\r", - " 4: \"LB\",\r", - " 5: \"RB\",\r", - " 6: \"LT\",\r", - " 7: \"RT\",\r", - " 8: \"BACK\",\r", - " 9: \"START\",\r", - " 10: \"CLICK_STICK_LEFT\",\r", - " 11: \"CLICK_STICK_RIGHT\",\r", - " 12: \"UP\",\r", - " 13: \"DOWN\",\r", - " 14: \"LEFT\",\r", - " 15: \"RIGHT\",\r", - " 16: \"NONE\",\r", - " 17: \"NONE\"\r", - " },\r", - " \"PS4\": {\r", - " 0: \"CROSS\",\r", - " 1: \"CIRCLE\",\r", - " 2: \"SQUARE\",\r", - " 3: \"TRIANGLE\",\r", - " 4: \"L1\",\r", - " 5: \"R1\",\r", - " 6: \"L2\",\r", - " 7: \"R2\",\r", - " 8: \"SHARE\",\r", - " 9: \"OPTIONS\",\r", - " 10: \"CLICK_STICK_LEFT\",\r", - " 11: \"CLICK_STICK_RIGHT\",\r", - " 12: \"UP\",\r", - " 13: \"DOWN\",\r", - " 14: \"LEFT\",\r", - " 15: \"RIGHT\",\r", - " 16: \"PS_BUTTON\",\r", - " 17: \"CLICK_TOUCHPAD\"\r", - " }\r", + " \"PS4\": {\r", + " 0: \"CROSS\",\r", + " 1: \"CIRCLE\",\r", + " 2: \"SQUARE\",\r", + " 3: \"TRIANGLE\",\r", + " 4: \"L1\",\r", + " 5: \"R1\",\r", + " 6: \"L2\",\r", + " 7: \"R2\",\r", + " 8: \"SHARE\",\r", + " 9: \"OPTIONS\",\r", + " 10: \"CLICK_STICK_LEFT\",\r", + " 11: \"CLICK_STICK_RIGHT\",\r", + " 12: \"UP\",\r", + " 13: \"DOWN\",\r", + " 14: \"LEFT\",\r", + " 15: \"RIGHT\",\r", + " 16: \"PS_BUTTON\",\r", + " 17: \"CLICK_TOUCHPAD\"\r", " }\r", "};\r", "\r", - "gdjs._extensionController.getInputString = function (type, buttonId) {\r", - " const controllerButtonNames = gdjs._extensionController.controllerButtonNames;\r", - " if (controllerButtonNames[type] !== undefined) {\r", - " return controllerButtonNames[type][buttonId];\r", + "/**\r", + " * @param {number} playerId\r", + " */\r", + "function getGamepad(playerId) {\r", + " /** @type {Gamepad[]} */\r", + " const gamepads = navigator.getGamepads ? navigator.getGamepads() : [];\r", + " return gamepads[playerId];\r", + "}\r", + "\r", + "/** @type {{[playerId: number]: Player}} */\r", + "const players = {};\r", + "\r", + "/**\r", + " * @param {number} playerId\r", + " */\r", + "function getPlayer(playerId) {\r", + " let player = players[playerId];\r", + " if (!player) {\r", + " player = new Player(playerId);\r", + " players[playerId] = player;\r", + " }\r", + " return player;\r", + "}\r", + "\r", + "class Player {\r", + " /** @type {number} */\r", + " playerId;\r", + " mapping = 'DEFAULT';\r", + " lastButtonUsed = -1;\r", + " deadzone = 0.2;\r", + " /** @type {{[buttonId: number]: ButtonState}} */\r", + " buttonStates = {};\r", + " rumble = { elapsedTime: 0, duration: 0, weakMagnitude: 0, strongMagnitude: 0 };\r", + "\r", + " /**\r", + " * @param {number} playerId\r", + " */\r", + " constructor(playerId) {\r", + " this.playerId = playerId;\r", + " }\r", + "\r", + " /**\r", + " * @param {number} buttonId\r", + " */\r", + " getButtonState(buttonId) {\r", + " let buttonState = this.buttonStates[buttonId];\r", + " if (!buttonState) {\r", + " buttonState = new ButtonState();\r", + " this.buttonStates[buttonId] = buttonState;\r", + " }\r", + " return buttonState;\r", + " }\r", + "\r", + " /**\r", + " * @param {number} buttonId\r", + " */\r", + " isButtonPressed(buttonId) {\r", + " return this.getButtonState(buttonId).isPressed;\r", " }\r", "\r", - " return \"UNKNOWN_BUTTON\";\r", + " /**\r", + " * @param {number} buttonId\r", + " */\r", + " isButtonJustPressed(buttonId) {\r", + " return this.getButtonState(buttonId).isJustPressed();\r", + " }\r", + "\r", + " /**\r", + " * @param {number} buttonId\r", + " */\r", + " isButtonReleased(buttonId) {\r", + " return this.getButtonState(buttonId).isReleased();\r", + " }\r", + "\r", + " isAnyButtonReleased() {\r", + " for (const buttonId in this.buttonStates) {\r", + " const buttonState = this.buttonStates[buttonId];\r", + " if (buttonState.isReleased()) {\r", + " return true;\r", + " }\r", + " }\r", + " return false;\r", + " }\r", + "\r", + " isAnyButtonPressed() {\r", + " for (const buttonId in this.buttonStates) {\r", + " const buttonState = this.buttonStates[buttonId];\r", + " if (buttonState.isPressed) {\r", + " return true;\r", + " }\r", + " }\r", + " return false;\r", + " }\r", + "}\r", + "\r", + "class ButtonState {\r", + " wasPressed = false;\r", + " isPressed = false;\r", + "\r", + " isReleased() {\r", + " return this.wasPressed && !this.isPressed;\r", + " }\r", + "\r", + " isJustPressed() {\r", + " return !this.wasPressed && this.isPressed;\r", + " }\r", + "}\r", + "\r", + "// Async tasks are run before everything.\r", + "// This is a hack to make sure that button states are updated\r", + "// before mapping behavior events.\r", + "const frameBeginningTask = new class extends gdjs.AsyncTask {\r", + " update() {\r", + " /** @type {Gamepad[]} */\r", + " const gamepads = navigator.getGamepads ? navigator.getGamepads() : [];\r", + " for (let playerId = 0; playerId < gamepads.length; playerId++) {\r", + " const gamepad = gamepads[playerId];\r", + " if (gamepad == null) {\r", + " // The gamepad is not connected.\r", + " continue;\r", + " }\r", + " const player = getPlayer(playerId);\r", + "\r", + " for (let buttonId = 0; buttonId < Object.keys(gamepad.buttons).length; buttonId++) {\r", + " const buttonState = player.getButtonState(buttonId);\r", + " buttonState.wasPressed = buttonState.isPressed;\r", + " buttonState.isPressed = gamepad.buttons[buttonId].pressed;\r", + " if (buttonState.isJustPressed()) {\r", + " player.lastButtonUsed = buttonId;\r", + " }\r", + " }\r", + " }\r", + " return false;\r", + " }\r", + "}();\r", + "\r", + "function onScenePostEvents() {\r", + " /** @type {Gamepad[]} */\r", + " const gamepads = navigator.getGamepads ? navigator.getGamepads() : [];\r", + " for (let playerId = 0; playerId < gamepads.length; playerId++) {\r", + " let gamepad = gamepads[playerId];\r", + " if (gamepad == null) {\r", + " // The gamepad is not connected.\r", + " continue;\r", + " }\r", + " const player = getPlayer(playerId);\r", + " const rumble = player.rumble;\r", + " rumble.elapsedTime += runtimeScene.getElapsedTime(runtimeScene) / 1000;\r", + " if (rumble.duration - rumble.elapsedTime <= 0 &&\r", + " (rumble.weakMagnitude || rumble.strongMagnitude)\r", + " ) {\r", + " rumble.weakMagnitude = 0;\r", + " rumble.strongMagnitude = 0;\r", + " }\r", + " }\r", + "}\r", + "\r", + "/**\r", + " * @param {string} type\r", + " * @param {number} buttonId\r", + " */\r", + "function getInputString(type, buttonId) {\r", + " if (!controllerButtonNames[type]) {\r", + " return \"UNKNOWN_BUTTON\";\r", + " }\r", + " return controllerButtonNames[type][buttonId];\r", + "}\r", + "\r", + "function getButtonId(buttonName) {\r", + " switch (buttonName) {\r", + " case 'A':\r", + " case 'CROSS':\r", + " return 0;\r", + " case 'B':\r", + " case 'CIRCLE':\r", + " return 1;\r", + " case 'X':\r", + " case 'SQUARE':\r", + " return 2;\r", + " case 'Y':\r", + " case 'TRIANGLE':\r", + " return 3;\r", + " case 'LB':\r", + " case 'L1':\r", + " return 4;\r", + " case 'RB':\r", + " case 'R1':\r", + " return 5;\r", + " case 'LT':\r", + " case 'L2':\r", + " return 6;\r", + " case 'RT':\r", + " case 'R2':\r", + " return 7;\r", + " case 'UP':\r", + " return 12;\r", + " case 'DOWN':\r", + " return 13;\r", + " case 'LEFT':\r", + " return 14;\r", + " case 'RIGHT':\r", + " return 15;\r", + " case 'BACK':\r", + " case 'SHARE':\r", + " return 8;\r", + " case 'START':\r", + " case 'OPTIONS':\r", + " return 9;\r", + " case 'CLICK_STICK_LEFT':\r", + " return 10;\r", + " case 'CLICK_STICK_RIGHT':\r", + " return 11;\r", + " //PS4\r", + " case 'PS_BUTTON':\r", + " return 16;\r", + " case 'CLICK_TOUCHPAD':\r", + " return 17;\r", + " default:\r", + " console.error('The gamepad button: ' + buttonName + ' is not valid.');\r", + " return null;\r", + " }\r", "}\r", "\r", - "gdjs._extensionController.axisToAngle = function (deltaX, deltaY) {\r", + "/**\r", + " * @param {number} playerId\r", + " * @param {string} directionName\r", + " * @param {number} axisValueX\r", + " * @param {number} axisValueY\r", + " */\r", + "function isAxisPushed(playerId, directionName, axisValueX, axisValueY) {\r", + " switch (directionName) {\r", + " case 'LEFT':\r", + " return getNormalizedAxisValue(axisValueX, playerId) < 0;\r", + " case 'RIGHT':\r", + " return getNormalizedAxisValue(axisValueX, playerId) > 0;\r", + " case 'UP':\r", + " return getNormalizedAxisValue(axisValueY, playerId) < 0;\r", + " case 'DOWN':\r", + " return getNormalizedAxisValue(axisValueY, playerId) > 0;\r", + " case 'ANY':\r", + " return getNormalizedAxisValue(axisValueX, playerId) < 0\r", + " || getNormalizedAxisValue(axisValueX, playerId) > 0\r", + " || getNormalizedAxisValue(axisValueY, playerId) < 0\r", + " || getNormalizedAxisValue(axisValueY, playerId) > 0\r", + " default:\r", + " console.error('The value stick direction is not valid.');\r", + " return false;\r", + " }\r", + "}\r", + "\r", + "/**\r", + " * @param {number} deltaX\r", + " * @param {number} deltaY\r", + " */\r", + "function axisToAngle(deltaX, deltaY) {\r", " const rad = Math.atan2(deltaY, deltaX);\r", " const deg = rad * (180 / Math.PI);\r", " return deg;\r", "}\r", "\r", - "gdjs._extensionController.isXbox = function (gamepad) {\r", + "/**\r", + " * @param {{id: string}} gamepad\r", + " */\r", + "function isXbox(gamepad) {\r", " return (gamepad ? (\r", " gamepad.id.toUpperCase().indexOf(\"XBOX\") !== -1\r", " // \"XINPUT\" cannot be used to check if it is a xbox controller is just a generic\r", @@ -5015,44 +5190,52 @@ " ) : false);\r", "}\r", "\r", - "//Returns the new value taking into account the dead zone for the player_ID given\r", - "gdjs._extensionController.getNormalizedAxisValue = function (v, player_ID) {\r", + "/**\r", + " * Returns the new value taking into account the dead zone for the player_ID given\r", + " * @param {number} value\r", + " * @param {number} playerID\r", + " */\r", + "function getNormalizedAxisValue(value, playerID) {\r", " // gdjs._extensionController = gdjs._extensionController || { deadzone: 0.2 };\r", "\r", " // Anything smaller than this is assumed to be 0,0\r", - " const DEADZONE = gdjs._extensionController.players[player_ID].deadzone;\r", - "\r", - " if (Math.abs(v) < DEADZONE) {\r", - " // In the dead zone, set to 0\r", - " v = 0;\r", - "\r", - " if (v == null) {\r", - " return 0;\r", - " } else {\r", - " return v;\r", - " }\r", + " const deadzone = getPlayer(playerID).deadzone;\r", "\r", + " if (Math.abs(value) < deadzone) {\r", + " return 0;\r", " } else {\r", " // We're outside the dead zone, but we'd like to smooth\r", " // this value out so it still runs nicely between 0..1.\r", " // That is, we don't want it to jump suddenly from 0 to\r", - " // DEADZONE.\r", + " // deadzone.\r", "\r", - " // Remap v from\r", - " // DEADZONE..1 to 0..(1-DEADZONE)\r", + " // Remap value from\r", + " // deadzone..1 to 0..(1-deadzone)\r", " // or from\r", - " // -1..-DEADZONE to -(1-DEADZONE)..0\r", - "\r", - " v = v - Math.sign(v) * DEADZONE;\r", + " // -1..-deadzone to -(1-deadzone)..0\r", + " value = value - Math.sign(value) * deadzone;\r", "\r", - " // Remap v from\r", - " // 0..(1-DEADZONE) to 0..1\r", + " // Remap value from\r", + " // 0..(1-deadzone) to 0..1\r", " // or from\r", - " // -(1-DEADZONE)..0 to -1..0\r", - "\r", - " return v / (1 - DEADZONE);\r", + " // -(1-deadzone)..0 to -1..0\r", + " return value / (1 - deadzone);\r", " }\r", - "};" + "}\r", + "\r", + "gdjs._extensionController = {\r", + " getPlayer,\r", + " controllerButtonNames,\r", + " getInputString,\r", + " getButtonId,\r", + " axisToAngle,\r", + " isXbox,\r", + " getNormalizedAxisValue,\r", + " isAxisPushed,\r", + " getGamepad,\r", + " onScenePostEvents,\r", + " frameBeginningTask,\r", + "}" ], "parameterObjects": "", "useStrict": true, @@ -5065,59 +5248,35 @@ { "fullName": "", "functionType": "Action", - "name": "onScenePostEvents", + "name": "onSceneLoaded", "sentence": "", "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [] - }, { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "//Each time a player press a button i save the last button pressed for the next frame", - "/** @type {Gamepad[]} */", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);", - "", - "//Get function parameter", - "let countPlayers = Object.keys(gdjs._extensionController.players).length;", - "", - "//Repeat for each players", - "for (let i = 0; i < countPlayers; i++) {", - " let gamepad = gamepads[i]; // Get the gamepad of the player", - "", - " //We have to keep this condition because if the user hasn't plugged in his controller yet, we can't get the controller in the gamepad variable.", - " if (gamepad == null) {", - " continue;", - " }", - "", - " for (let b = 0; b < Object.keys(gamepad.buttons).length; b++) { //For each buttons", - " if (gamepad.buttons[b].pressed) { //One of them is pressed", - " gdjs._extensionController.players[i].lastButtonUsed = b; //Save the button pressed", - "", - " //Save the state of the button for the next frame.", - " gdjs._extensionController.players[i].previousFrameStateButtons[b] = { pressed: true };", - "", - " // Update Last Active Controller", - " gdjs._extensionController.lastActiveController = i;", - " } else {", - " gdjs._extensionController.players[i].previousFrameStateButtons[b] = { pressed: false };", - " }", - " }", - "", - "", - " gdjs._extensionController.players[i].rumble.elapsedTime += runtimeScene.getElapsedTime(runtimeScene) / 1000;", - " if (", - " gdjs._extensionController.players[i].rumble.duration - gdjs._extensionController.players[i].rumble.elapsedTime <= 0 &&", - " (gdjs._extensionController.players[i].rumble.weakMagnitude || gdjs._extensionController.players[i].rumble.strongMagnitude)", - " ) {", - " gdjs._extensionController.players[i].rumble.weakMagnitude = 0;", - " gdjs._extensionController.players[i].rumble.strongMagnitude = 0;", - " }", - "", - "", - "}", + "// Async tasks are run before everything.\r", + "// This is a hack to make sure that button states are updated\r", + "// before mapping behavior events.\r", + "runtimeScene.getAsyncTasksManager().addTask(gdjs._extensionController.frameBeginningTask);" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "Action", + "name": "onScenePostEvents", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "gdjs._extensionController.onScenePostEvents();", "" ], "parameterObjects": "", @@ -5555,27 +5714,20 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", "\r", - "//Get function parameters\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", - "const trigger = eventsFunctionContext.getArgument(\"trigger\").toUpperCase();\r", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "const trigger = eventsFunctionContext.getArgument(\"Trigger\").toUpperCase();\r", "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier in expression: \"Pressure on a gamepad trigger\", is not valid number, must be between 0 and 4.');\r", - " return;\r", - "}\r", "if (trigger != \"LT\" && trigger != \"RT\" && trigger != \"L2\" && trigger != \"R2\") {\r", " console.error('Parameter trigger is not valid in expression: \"Pressure on a gamepad trigger\"');\r", " return;\r", "}\r", - "\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", - "if (gamepad == null) return;\r", - "\r", + "/** @type {Gamepad} */\r", + "const gamepad = gdjs._extensionController.getGamepad(playerId);\r", + "if (!gamepad) {\r", + " // The gamepad is not connected.\r", + " return;\r", + "}\r", "switch (trigger) {\r", " case 'LT':\r", " case 'L2':\r", @@ -5603,12 +5755,12 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" }, { "description": "Trigger button", - "name": "trigger", + "name": "Trigger", "supplementaryInformation": "[\"LT\",\"RT\",\"L2\",\"R2\"]", "type": "stringWithSelector" } @@ -5625,43 +5777,28 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", - "\r", - "//Get function parameters\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", - "const stick = eventsFunctionContext.getArgument(\"stick\").toUpperCase();\r", + "const { getNormalizedAxisValue } = gdjs._extensionController;\r", "\r", - "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier is not valid in expression: \"Value of a stick force\"');\r", - " return;\r", - "}\r", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "const stick = eventsFunctionContext.getArgument(\"Stick\").toUpperCase();\r", "\r", "if (stick !== \"LEFT\" && stick !== \"RIGHT\") {\r", " console.error('Parameter stick is not valid in expression: \"Value of a stick force\"');\r", " return;\r", "}\r", + "/** @type {Gamepad} */\r", + "const gamepad = gdjs._extensionController.getGamepad(playerId);\r", + "if (!gamepad) {\r", + " // The gamepad is not connected.\r", + " return;\r", + "}\r", + "const axisValueX = stick === 'RIGHT' ? gamepad.axes[2] : gamepad.axes[0];\r", + "const axisValueY = stick === 'RIGHT' ? gamepad.axes[3] : gamepad.axes[1];\r", "\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", - "if (gamepad == null) return;\r", - "\r", - "\r", - "switch (stick) {\r", - " case 'LEFT':\r", - " eventsFunctionContext.returnValue = gdjs.evtTools.common.clamp(Math.abs(gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[0], playerId)) + Math.abs(gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[1], playerId)), 0, 1);\r", - " break;\r", - "\r", - " case 'RIGHT':\r", - " eventsFunctionContext.returnValue = gdjs.evtTools.common.clamp(Math.abs(gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[2], playerId)) + Math.abs(gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[3], playerId)), 0, 1);\r", - " break;\r", - "\r", - " default:\r", - " eventsFunctionContext.returnValue = -1;\r", - " break;\r", - "}" + "eventsFunctionContext.returnValue = gdjs.evtTools.common.clamp(\r", + " Math.abs(getNormalizedAxisValue(axisValueX, playerId)) +\r", + " Math.abs(getNormalizedAxisValue(axisValueY, playerId)), 0, 1);\r", + "" ], "parameterObjects": "", "useStrict": true, @@ -5674,12 +5811,12 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" }, { "description": "Stick: \"Left\" or \"Right\"", - "name": "stick", + "name": "Stick", "supplementaryInformation": "[\"Left\",\"Right\"]", "type": "stringWithSelector" } @@ -5703,7 +5840,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "Gamepads::StickAngle(player_ID, stick)" + "Gamepads::StickAngle(PlayerId, Stick)" ] } ] @@ -5715,12 +5852,12 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" }, { "description": "Stick: \"Left\" or \"Right\"", - "name": "stick", + "name": "Stick", "supplementaryInformation": "[\"Left\",\"Right\"]", "type": "stringWithSelector" } @@ -5737,40 +5874,27 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", - "\r", - "//Get function parameters\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", - "const stick = eventsFunctionContext.getArgument(\"stick\").toUpperCase();\r", + "const { getNormalizedAxisValue } = gdjs._extensionController;\r", "\r", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "const stick = eventsFunctionContext.getArgument(\"Stick\").toUpperCase();\r", "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier is not valid in expression: \"Value of a stick rotation\"');\r", - " return;\r", - "}\r", "if (stick !== \"LEFT\" && stick !== \"RIGHT\") {\r", " console.error('Parameter stick is not valid in expression: \"Value of a stick rotation\"');\r", " return;\r", "}\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", - "if (gamepad == null) return;\r", - "\r", - "switch (stick) {\r", - " case 'LEFT':\r", - " eventsFunctionContext.returnValue = gdjs._extensionController.axisToAngle(gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[0], playerId), gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[1], playerId));\r", - " break;\r", - "\r", - " case 'RIGHT':\r", - " eventsFunctionContext.returnValue = gdjs._extensionController.axisToAngle(gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[2], playerId), gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[3], playerId));\r", - " break;\r", + "/** @type {Gamepad} */\r", + "const gamepad = gdjs._extensionController.getGamepad(playerId);\r", + "if (!gamepad) {\r", + " // The gamepad is not connected.\r", + " return;\r", + "}\r", + "const axisValueX = stick === 'RIGHT' ? gamepad.axes[2] : gamepad.axes[0];\r", + "const axisValueY = stick === 'RIGHT' ? gamepad.axes[3] : gamepad.axes[1];\r", "\r", - " default:\r", - " eventsFunctionContext.returnValue = -1;\r", - " break;\r", - "}" + "eventsFunctionContext.returnValue = gdjs._extensionController.axisToAngle(\r", + " getNormalizedAxisValue(axisValueX, playerId),\r", + " getNormalizedAxisValue(axisValueY, playerId));" ], "parameterObjects": "", "useStrict": true, @@ -5783,12 +5907,12 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" }, { "description": "Stick: \"Left\" or \"Right\"", - "name": "stick", + "name": "Stick", "supplementaryInformation": "[\"Left\",\"Right\"]", "type": "stringWithSelector" } @@ -5806,18 +5930,11 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", "\r", - "//Get function parameters\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", "const stick = eventsFunctionContext.getArgument(\"stick\").toUpperCase();\r", "const direction = eventsFunctionContext.getArgument(\"direction\").toUpperCase();\r", "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier is not valid in expression: \"Value of a gamepad axis\"');\r", - " return;\r", - "}\r", "if (stick != \"LEFT\" && stick != \"RIGHT\") {\r", " console.error('Parameter stick is not valid in expression: \"Value of a gamepad axis\"');\r", " return;\r", @@ -5826,11 +5943,12 @@ " console.error('Parameter direction is not valid in expression: \"Value of a gamepad axis\"');\r", " return;\r", "}\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", - "if (gamepad == null) return;\r", - "\r", + "/** @type {Gamepad} */\r", + "const gamepad = gdjs._extensionController.getGamepad(playerId);\r", + "if (!gamepad) {\r", + " // The gamepad is not connected.\r", + " return;\r", + "}\r", "let parameterError = false;\r", "switch (stick) {\r", " case 'LEFT':\r", @@ -5927,7 +6045,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" }, { @@ -5955,26 +6073,20 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", "\r", - "//Get function parameters\r", "const playerId = eventsFunctionContext.getArgument(\"Gamepad\") - 1;\r", "const stick = eventsFunctionContext.getArgument(\"Stick\").toLowerCase();\r", "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier is not valid in expression: \"Value of a gamepad axis\"');\r", - " return;\r", - "}\r", "if (stick != \"left\" && stick != \"right\") {\r", " console.error('Parameter stick is not valid in expression: \"Value of a gamepad axis\"');\r", " return;\r", "}\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", - "if (gamepad == null) return;\r", - "\r", + "/** @type {Gamepad} */\r", + "const gamepad = gdjs._extensionController.getGamepad(playerId);\r", + "if (!gamepad) {\r", + " // The gamepad is not connected.\r", + " return;\r", + "}\r", "const axisIndex = stick === 'right' ? 2 : 0;\r", "eventsFunctionContext.returnValue = gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[axisIndex], playerId);\r", "" @@ -6012,26 +6124,20 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", "\r", - "//Get function parameters\r", "const playerId = eventsFunctionContext.getArgument(\"Gamepad\") - 1;\r", "const stick = eventsFunctionContext.getArgument(\"Stick\").toLowerCase();\r", "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier is not valid in expression: \"Value of a gamepad axis\"');\r", - " return;\r", - "}\r", "if (stick != \"left\" && stick != \"right\") {\r", " console.error('Parameter stick is not valid in expression: \"Value of a gamepad axis\"');\r", " return;\r", "}\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", - "if (gamepad == null) return;\r", - "\r", + "/** @type {Gamepad} */\r", + "const gamepad = gdjs._extensionController.getGamepad(playerId);\r", + "if (!gamepad) {\r", + " // The gamepad is not connected.\r", + " return;\r", + "}\r", "const axisIndex = stick === 'right' ? 3 : 1;\r", "eventsFunctionContext.returnValue = gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[axisIndex], playerId);\r", "" @@ -6069,136 +6175,57 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", "\r", - "//Get function parameters\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", - "const button = eventsFunctionContext.getArgument(\"button\").toUpperCase();\r", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "const button = eventsFunctionContext.getArgument(\"Button\").toUpperCase();\r", "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier in condition: \"Gamepad button released\", is not valid number, must be between 0 and 4.');\r", - " return;\r", - "}\r", - "if (button === \"\") {\r", - " console.error('Parameter button is not valid in condition: \"Gamepad button released\"');\r", + "let buttonId = gdjs._extensionController.getButtonId(button);\r", + "if (buttonId === null) {\r", " return;\r", "}\r", + "const player = gdjs._extensionController.getPlayer(playerId)\r", + "eventsFunctionContext.returnValue = player.isButtonReleased(buttonId);" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "parameters": [ + { + "description": "The gamepad identifier: 1, 2, 3 or 4", + "name": "PlayerId", + "type": "expression" + }, + { + "description": "Name of the button", + "name": "Button", + "supplementaryInformation": "[\"A\",\"Cross\",\"B\",\"Circle\",\"X\",\"Square\",\"Y\",\"Triangle\",\"LB\",\"L1\",\"RB\",\"R1\",\"LT\",\"L2\",\"RT\",\"R2\",\"Up\",\"Down\",\"Left\",\"Right\",\"Back\",\"Share\",\"Start\",\"Options\",\"Click_Stick_Left\",\"Click_Stick_Right\",\"PS_Button\",\"Click_Touchpad\"]", + "type": "stringWithSelector" + } + ], + "objectGroups": [] + }, + { + "description": "Check if a button was just pressed on a gamepad. Buttons can be:\n* Xbox: \"A\", \"B\", \"X\", \"Y\", \"LB\", \"RB\", \"LT\", \"RT\", \"BACK\", \"START\",\n* PS4: \"CROSS\", \"SQUARE\", \"CIRCLE\", \"TRIANGLE\", \"L1\", \"L2\", \"R1\", \"R2\", \"SHARE\", \"OPTIONS\", \"PS_BUTTON\", \"CLICK_TOUCHPAD\",\n* Other: \"UP\", \"DOWN\", \"LEFT\", \"RIGHT\", \"CLICK_STICK_LEFT\", \"CLICK_STICK_RIGHT\".", + "fullName": "Gamepad button just pressed", + "functionType": "Condition", + "name": "IsButtonJustPressed", + "sentence": "Button _PARAM2_ of gamepad _PARAM1_ was just pressed", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ "\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", - "if (gamepad == null) return;\r", - "\r", - "let buttonId;\r", - "\r", - "switch (button) {\r", - " case 'A':\r", - " case 'CROSS':\r", - " buttonId = 0;\r", - " break;\r", - " case 'B':\r", - " case 'CIRCLE':\r", - " buttonId = 1;\r", - " break;\r", - " case 'X':\r", - " case 'SQUARE':\r", - " buttonId = 2;\r", - " break;\r", - " case 'Y':\r", - " case 'TRIANGLE':\r", - " buttonId = 3;\r", - " break;\r", - " case 'LB':\r", - " case 'L1':\r", - " buttonId = 4;\r", - " break;\r", - " case 'RB':\r", - " case 'R1':\r", - " buttonId = 5;\r", - " break;\r", - " case 'LT':\r", - " case 'L2':\r", - " buttonId = 6;\r", - " break;\r", - " case 'RT':\r", - " case 'R2':\r", - " buttonId = 7;\r", - " break;\r", - "\r", - " case 'UP':\r", - " buttonId = 12;\r", - " break;\r", - " case 'DOWN':\r", - " buttonId = 13;\r", - " break;\r", - " case 'LEFT':\r", - " buttonId = 14;\r", - " break;\r", - " case 'RIGHT':\r", - " buttonId = 15;\r", - " break;\r", - "\r", - " case 'BACK':\r", - " case 'SHARE':\r", - " buttonId = 8;\r", - " break;\r", - " case 'START':\r", - " case 'OPTIONS':\r", - " buttonId = 9;\r", - " break;\r", - "\r", - " case 'CLICK_STICK_LEFT':\r", - " buttonId = 10;\r", - " break;\r", - " case 'CLICK_STICK_RIGHT':\r", - " buttonId = 11;\r", - " break;\r", - "\r", - " //PS4\r", - " case 'PS_BUTTON':\r", - " buttonId = 16;\r", - " break;\r", - " case 'CLICK_TOUCHPAD':\r", - " buttonId = 17;\r", - " break;\r", - "\r", - " default:\r", - " console.error('The button: ' + button + ' in condition: \"Gamepad button released\" is not valid.');\r", - " break;\r", - "}\r", - "\r", - "if (buttonId === undefined) {\r", - " console.error('There is no buttons valid in condition: \"Gamepad button released\"');\r", - " eventsFunctionContext.returnValue = false;\r", - " return;\r", - "}\r", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "const button = eventsFunctionContext.getArgument(\"Button\").toUpperCase();\r", "\r", - "if (gamepad.buttons == null || gamepad.buttons[buttonId] == null) {\r", - " console.error('Buttons on the gamepad are not accessible in condition: \"Gamepad button released\"');\r", - " eventsFunctionContext.returnValue = false;\r", + "let buttonId = gdjs._extensionController.getButtonId(button);\r", + "if (buttonId === null) {\r", " return;\r", "}\r", - "\r", - "//Define default value on pressed button or use previous value\r", - "gdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId] = gdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId] || { pressed: false };\r", - "\r", - "//Get state of button at previous frame\r", - "const previousStateButton = gdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId].pressed;\r", - "\r", - "//When previousStateButton is true and actual button state is not pressed\r", - "//Player have release the button\r", - "if (previousStateButton === true && gamepad.buttons[buttonId].pressed === false) {\r", - " // Save the last button used for the player \r", - " gdjs._extensionController.players[playerId].lastButtonUsed = buttonId;\r", - " gdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId].pressed = true;\r", - " eventsFunctionContext.returnValue = true;\r", - "\r", - "} else {\r", - " gdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId].pressed = false;\r", - " eventsFunctionContext.returnValue = false;\r", - "}\r", - "" + "const player = gdjs._extensionController.getPlayer(playerId)\r", + "eventsFunctionContext.returnValue = player.isButtonJustPressed(buttonId);" ], "parameterObjects": "", "useStrict": true, @@ -6208,12 +6235,12 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" }, { "description": "Name of the button", - "name": "button", + "name": "Button", "supplementaryInformation": "[\"A\",\"Cross\",\"B\",\"Circle\",\"X\",\"Square\",\"Y\",\"Triangle\",\"LB\",\"L1\",\"RB\",\"R1\",\"LT\",\"L2\",\"RT\",\"R2\",\"Up\",\"Down\",\"Left\",\"Right\",\"Back\",\"Share\",\"Start\",\"Options\",\"Click_Stick_Left\",\"Click_Stick_Right\",\"PS_Button\",\"Click_Touchpad\"]", "type": "stringWithSelector" } @@ -6230,17 +6257,9 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "//Get function parameter\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", - "\r", - "//Player id is not valid\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier in expression: \"Last pressed button (id)\", is not valid number, must be between 0 and 4.');\r", - " return;\r", - "}\r", "\r", - "//Return the last button used by the player\r", - "eventsFunctionContext.returnValue = gdjs._extensionController.players[playerId].lastButtonUsed;" + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "eventsFunctionContext.returnValue = gdjs._extensionController.getPlayer(playerId).lastButtonUsed;" ], "parameterObjects": "", "useStrict": true, @@ -6253,7 +6272,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" } ], @@ -6269,46 +6288,10 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", - "\r", - "//Get function parameter\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", - "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier in condition: \"Any gamepad button pressed\", is not valid number, must be between 0 and 4.');\r", - " return;\r", - "}\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", - "if (gamepad == null) return;\r", - "\r", - "let buttonId;\r", - "for (let i = 0; i < gamepad.buttons.length; i++) { //For each buttons\r", - " if (gamepad.buttons[i].pressed) { //One of them is pressed\r", - " buttonId = i; //Save the button pressed\r", - " break;\r", - " }\r", - "}\r", - "\r", - "if (buttonId === undefined) {\r", - " // No buttons are pressed.\r", - " eventsFunctionContext.returnValue = false;\r", - " return;\r", - "}\r", - "\r", - "if (gamepad.buttons == null || gamepad.buttons[buttonId] == null) {\r", - " console.error('Buttons on the gamepad are not accessible in condition: \"Any gamepad button pressed\"');\r", - " eventsFunctionContext.returnValue = false;\r", - " return;\r", - "}\r", - "\r", - "//When a button is pressed, save the button in lastButtonUsed for each players\r", - "if (gamepad.buttons[buttonId].pressed) gdjs._extensionController.players[playerId].lastButtonUsed = buttonId;\r", - "eventsFunctionContext.returnValue = gamepad.buttons[buttonId].pressed;\r", - "\r", "\r", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "const player = gdjs._extensionController.getPlayer(playerId)\r", + "eventsFunctionContext.returnValue = player.isAnyButtonPressed();\r", "" ], "parameterObjects": "", @@ -6319,7 +6302,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" } ], @@ -6335,35 +6318,18 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", "\r", - "//Get function parameters\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", "const controllerType = eventsFunctionContext.getArgument(\"controller_type\").toUpperCase();\r", - "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier in string expression: \"Last pressed button (LastButtonString)\", is not valid number, must be between 0 and 4.');\r", - " return;\r", - "}\r", - "if (controllerType === \"\") {\r", - " console.error('Parameter controller type is not valid in string expression: \"Last pressed button (LastButtonString)\"');\r", + "/** @type {Gamepad} */\r", + "const gamepad = gdjs._extensionController.getGamepad(playerId);\r", + "if (!gamepad) {\r", + " // The gamepad is not connected.\r", " return;\r", "}\r", - "\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "if (gamepad !== null) { //Gamepad exist\r", - " //Get last btn id\r", - " const lastButtonUsedID = gdjs._extensionController.players[playerId].lastButtonUsed;\r", - "\r", - " //Return last button as string \r", - " eventsFunctionContext.returnValue = gdjs._extensionController.getInputString(controllerType, lastButtonUsedID);\r", - "\r", - "} else { //Gamepad dosen't exist\r", - " console.error('Your controller is not supported or the gamepad wasn\\'t detected in string expression: \"Last pressed button (LastButtonString)\"');\r", - " eventsFunctionContext.returnValue = \"Gamepad not connected\";\r", - "}" + "const lastButtonUsedID = gdjs._extensionController.getPlayer(playerId).lastButtonUsed;\r", + "eventsFunctionContext.returnValue = gdjs._extensionController.getInputString(controllerType, lastButtonUsedID);\r", + "" ], "parameterObjects": "", "useStrict": true, @@ -6376,7 +6342,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" }, { @@ -6398,20 +6364,16 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", "\r", - "//Get the last activated controller\r", - "const controllerId = gdjs._extensionController.lastActiveController;\r", - "\r", - "// Check if controller is active\r", - "const gamepad = gamepads[controllerId];\r", - "if (gamepad == null) {\r", - " eventsFunctionContext.returnValue = 0;\r", - "} else {\r", - " // Return active controller id\r", - " eventsFunctionContext.returnValue = controllerId + 1;\r", + "const gamepads = navigator.getGamepads ? navigator.getGamepads() : [];\r", + "let lastGamepadIndex = -1;\r", + "for (let playerId = 0; playerId < gamepads.length; playerId++) {\r", + " // Gamepads can be disconnected and become null\r", + " if (gamepads[playerId]) {\r", + " lastGamepadIndex = playerId\r", + " }\r", "}\r", - "" + "eventsFunctionContext.returnValue = lastGamepadIndex + 1;" ], "parameterObjects": "", "useStrict": true, @@ -6434,127 +6396,16 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", "\r", - "//Get function parameters\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", "const button = eventsFunctionContext.getArgument(\"button\").toUpperCase();\r", "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier in condition: \"Gamepad button pressed\", is not valid number, must be between 0 and 4.');\r", - " return;\r", - "}\r", - "if (button === \"\") {\r", - " console.error('Parameter button is not valid in condition: \"Gamepad button pressed\"');\r", - " eventsFunctionContext.returnValue = false;\r", - " return;\r", - "}\r", - "\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", - "if (gamepad == null) return;\r", - "\r", - "let buttonId;\r", - "\r", - "switch (button) {\r", - " case 'A':\r", - " case 'CROSS':\r", - " buttonId = 0;\r", - " break;\r", - " case 'B':\r", - " case 'CIRCLE':\r", - " buttonId = 1;\r", - " break;\r", - " case 'X':\r", - " case 'SQUARE':\r", - " buttonId = 2;\r", - " break;\r", - " case 'Y':\r", - " case 'TRIANGLE':\r", - " buttonId = 3;\r", - " break;\r", - " case 'LB':\r", - " case 'L1':\r", - " buttonId = 4;\r", - " break;\r", - " case 'RB':\r", - " case 'R1':\r", - " buttonId = 5;\r", - " break;\r", - " case 'LT':\r", - " case 'L2':\r", - " buttonId = 6;\r", - " break;\r", - " case 'RT':\r", - " case 'R2':\r", - " buttonId = 7;\r", - " break;\r", - "\r", - " case 'UP':\r", - " buttonId = 12;\r", - " break;\r", - " case 'DOWN':\r", - " buttonId = 13;\r", - " break;\r", - " case 'LEFT':\r", - " buttonId = 14;\r", - " break;\r", - " case 'RIGHT':\r", - " buttonId = 15;\r", - " break;\r", - "\r", - " case 'BACK':\r", - " case 'SHARE':\r", - " buttonId = 8;\r", - " break;\r", - " case 'START':\r", - " case 'OPTIONS':\r", - " buttonId = 9;\r", - " break;\r", - "\r", - " case 'CLICK_STICK_LEFT':\r", - " buttonId = 10;\r", - " break;\r", - " case 'CLICK_STICK_RIGHT':\r", - " buttonId = 11;\r", - " break;\r", - "\r", - " //PS4\r", - " case 'PS_BUTTON':\r", - " buttonId = 16;\r", - " break;\r", - " case 'CLICK_TOUCHPAD':\r", - " buttonId = 17;\r", - " break;\r", - "\r", - " default:\r", - " console.error('The button: ' + button + ' in condition: \"Gamepad button pressed\" is not valid.');\r", - " eventsFunctionContext.returnValue = false;\r", - " break;\r", - "}\r", - "\r", - "\r", - "\r", - "if (buttonId === undefined) {\r", - " console.error('There is no buttons valid in condition: \"Gamepad button pressed\"');\r", - " eventsFunctionContext.returnValue = false;\r", + "const buttonId = gdjs._extensionController.getButtonId(button);\r", + "if (buttonId === null) {\r", " return;\r", "}\r", - "\r", - "if (gamepad.buttons == null || gamepad.buttons[buttonId] == null) {\r", - " console.error('Buttons on the gamepad are not accessible in condition: \"Gamepad button pressed\"');\r", - " eventsFunctionContext.returnValue = false;\r", - " return;\r", - "}\r", - "\r", - "//When a button is pressed, save the button in lastButtonUsed for each players\r", - "if (gamepad.buttons[buttonId].pressed) gdjs._extensionController.players[playerId].lastButtonUsed = buttonId;\r", - "eventsFunctionContext.returnValue = gamepad.buttons[buttonId].pressed;\r", - "\r", - "\r", - "\r", + "const player = gdjs._extensionController.getPlayer(playerId)\r", + "eventsFunctionContext.returnValue = player.isButtonPressed(buttonId);\r", "" ], "parameterObjects": "", @@ -6565,7 +6416,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" }, { @@ -6592,15 +6443,9 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "//Get function parameter\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier in expression: \"Gamepad deadzone for sticks\", is not valid number, must be between 0 and 4.');\r", - " return;\r", - "}\r", - "///Return the deadzone value for a given player\r", - "eventsFunctionContext.returnValue = gdjs._extensionController.players[playerId].deadzone;" + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "eventsFunctionContext.returnValue = gdjs._extensionController.getPlayer(playerId).deadzone;" ], "parameterObjects": "", "useStrict": true, @@ -6613,7 +6458,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" } ], @@ -6629,18 +6474,12 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "//Get function parameter\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", + "\r", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", "const newDeadzone = eventsFunctionContext.getArgument(\"deadzone\");\r", "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier in action: \"Set gamepad deadzone for sticks\", is not valid, must be between 0 and 4.');\r", - " return;\r", - "}\r", - "\r", - "// clamp the newDeadzone in range [0, 1].\r", "// https://github.com/4ian/GDevelop-extensions/pull/33#issuecomment-618224857\r", - "gdjs._extensionController.players[playerId].deadzone = gdjs.evtTools.common.clamp(newDeadzone, 0, 1);\r", + "gdjs._extensionController.getPlayer(playerId).deadzone = gdjs.evtTools.common.clamp(newDeadzone, 0, 1);\r", "" ], "parameterObjects": "", @@ -6651,7 +6490,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" }, { @@ -6672,141 +6511,28 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", "\r", - "//Get function parameters\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", "const stick = eventsFunctionContext.getArgument(\"stick\").toUpperCase();\r", "const direction = eventsFunctionContext.getArgument(\"direction\").toUpperCase();\r", "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier in condition: \"Gamepad stick pushed (axis)\", is not valid number, must be between 0 and 4.');\r", - " return;\r", - "}\r", "if (stick != \"LEFT\" && stick != \"RIGHT\") {\r", " console.error('Parameter stick in condition: \"Gamepad stick pushed (axis)\", is not valid, must be LEFT or RIGHT');\r", " return;\r", "}\r", "if (direction != \"UP\" && direction != \"DOWN\" && direction != \"LEFT\" && direction != \"RIGHT\" && direction != \"ANY\") {\r", - " console.error('Parameter deadzone in condition: \"Gamepad stick pushed (axis)\", is not valid, must be UP, DOWN, LEFT or RIGHT');\r", + " console.error('Parameter direction in condition: \"Gamepad stick pushed (axis)\", is not valid, must be UP, DOWN, LEFT or RIGHT');\r", " return;\r", "}\r", - "\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", - "if (gamepad == null) {\r", - " eventsFunctionContext.returnValue = false;\r", + "/** @type {Gamepad} */\r", + "const gamepad = gdjs._extensionController.getGamepad(playerId);\r", + "if (!gamepad) {\r", + " // The gamepad is not connected.\r", " return;\r", "}\r", - "\r", - "\r", - "//Define in onFirstSceneLoaded function\r", - "const getNormalizedAxisValue = gdjs._extensionController.getNormalizedAxisValue;\r", - "\r", - "switch (stick) {\r", - " case 'LEFT':\r", - " switch (direction) {\r", - " case 'LEFT':\r", - " if (getNormalizedAxisValue(gamepad.axes[0], playerId) < 0) {\r", - " eventsFunctionContext.returnValue = true;\r", - " return;\r", - " }\r", - " break;\r", - "\r", - " case 'RIGHT':\r", - " if (getNormalizedAxisValue(gamepad.axes[0], playerId) > 0) {\r", - " eventsFunctionContext.returnValue = true;\r", - " return;\r", - " }\r", - " break;\r", - "\r", - " case 'UP':\r", - " if (getNormalizedAxisValue(gamepad.axes[1], playerId) < 0) {\r", - " eventsFunctionContext.returnValue = true;\r", - " return;\r", - " }\r", - " break;\r", - "\r", - " case 'DOWN':\r", - " if (getNormalizedAxisValue(gamepad.axes[1], playerId) > 0) {\r", - " eventsFunctionContext.returnValue = true;\r", - " return;\r", - " }\r", - " break;\r", - "\r", - " case 'ANY':\r", - " if ( getNormalizedAxisValue(gamepad.axes[0], playerId) < 0\r", - " || getNormalizedAxisValue(gamepad.axes[0], playerId) > 0\r", - " || getNormalizedAxisValue(gamepad.axes[1], playerId) < 0 \r", - " || getNormalizedAxisValue(gamepad.axes[1], playerId) > 0) {\r", - " eventsFunctionContext.returnValue = true;\r", - " return;\r", - " }\r", - " break;\r", - "\r", - " default:\r", - " console.error('The value Direction on stick Left on the condition: \"Gamepad stick pushed (axis)\" is not valid.');\r", - " eventsFunctionContext.returnValue = false;\r", - " break;\r", - " }\r", - " break;\r", - "\r", - " case 'RIGHT':\r", - " switch (direction) {\r", - " case 'LEFT':\r", - " if (getNormalizedAxisValue(gamepad.axes[2], playerId) < 0) {\r", - " eventsFunctionContext.returnValue = true;\r", - " return;\r", - " }\r", - " break;\r", - "\r", - " case 'RIGHT':\r", - " if (getNormalizedAxisValue(gamepad.axes[2], playerId) > 0) {\r", - " eventsFunctionContext.returnValue = true;\r", - " return;\r", - " }\r", - " break;\r", - "\r", - " case 'UP':\r", - " if (getNormalizedAxisValue(gamepad.axes[3], playerId) < 0) {\r", - " eventsFunctionContext.returnValue = true;\r", - " return;\r", - " }\r", - " break;\r", - "\r", - " case 'DOWN':\r", - " if (getNormalizedAxisValue(gamepad.axes[3], playerId) > 0) {\r", - " eventsFunctionContext.returnValue = true;\r", - " return;\r", - " }\r", - " break;\r", - "\r", - " case 'ANY':\r", - " if ( getNormalizedAxisValue(gamepad.axes[2], playerId) < 0\r", - " || getNormalizedAxisValue(gamepad.axes[2], playerId) > 0\r", - " || getNormalizedAxisValue(gamepad.axes[3], playerId) < 0 \r", - " || getNormalizedAxisValue(gamepad.axes[3], playerId) > 0) {\r", - " eventsFunctionContext.returnValue = true;\r", - " return;\r", - " }\r", - " break;\r", - "\r", - " default:\r", - " console.error('The value Direction on stick Right on the condition: \"Gamepad stick pushed (axis)\" is not valid.');\r", - " eventsFunctionContext.returnValue = false;\r", - " break;\r", - " }\r", - " break;\r", - "\r", - " default:\r", - " console.error('The value Stick on the condition: \"Gamepad stick pushed (axis)\" is not valid.');\r", - " eventsFunctionContext.returnValue = false;\r", - " break;\r", - "}\r", - "\r", - "eventsFunctionContext.returnValue = false;\r", + "const axisValueX = stick === 'RIGHT' ? gamepad.axes[2] : gamepad.axes[0];\r", + "const axisValueY = stick === 'RIGHT' ? gamepad.axes[3] : gamepad.axes[1];\r", + "eventsFunctionContext.returnValue = gdjs._extensionController.isAxisPushed(playerId, direction, axisValueX, axisValueY);\r", "" ], "parameterObjects": "", @@ -6817,7 +6543,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" }, { @@ -6837,24 +6563,24 @@ }, { "description": "Return the number of connected gamepads.", - "fullName": "Connected gamepads number", + "fullName": "Connected gamepads count", "functionType": "Expression", "name": "ConnectedGamepadsCount", "sentence": "", "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [] - }, { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", "\r", - "// Gamepads can be disconnected and become null, so we have to filter them.\r", - "eventsFunctionContext.returnValue = Object.keys(gamepads).filter(key => !!gamepads[key]).length;\r", + "const gamepads = navigator.getGamepads ? navigator.getGamepads() : [];\r", + "let connectedGamepadCount = 0;\r", + "for (let playerId = 0; playerId < gamepads.length; playerId++) {\r", + " // Gamepads can be disconnected and become null\r", + " if (gamepads[playerId]) {\r", + " connectedGamepadCount++;\r", + " }\r", + "}\r", + "eventsFunctionContext.returnValue = connectedGamepadCount;\r", "" ], "parameterObjects": "", @@ -6878,22 +6604,13 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);", - "", - "//Get function parameter", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;", - "", - "if (playerId < 0 || playerId > 4) {", - " console.error('Parameter gamepad identifier in string expression: \"Gamepad type\", is not valid number, must be between 0 and 4');", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;", + "/** @type {Gamepad} */", + "const gamepad = gdjs._extensionController.getGamepad(playerId);", + "if (!gamepad) {", + " // The gamepad is not connected.", " return;", "}", - "", - "const gamepad = gamepads[playerId];", - "", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.", - "if (gamepad == null) return;", - "", "eventsFunctionContext.returnValue = (gamepad && gamepad.id) ? gamepad.id : \"No information for player \" + (playerId + 1)", "" ], @@ -6908,7 +6625,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" } ], @@ -6924,28 +6641,14 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);", - "", - "//Get function parameters", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;", "const controllerType = eventsFunctionContext.getArgument(\"controller_type\").toUpperCase();", - "", - "if (playerId < 0 || playerId > 4) {", - " console.error('Parameter gamepad identifier in condition: \"Gamepad type\", is not valid number, must be between 0 and 4.');", - " return;", - "}", - "if (controllerType === \"\") {", - " console.error('Parameter type in condition: \"Gamepad type\", is not a string.');", + "/** @type {Gamepad} */", + "const gamepad = gdjs._extensionController.getGamepad(playerId);", + "if (!gamepad) {", + " // The gamepad is not connected.", " return;", "}", - "", - "const gamepad = gamepads[playerId];", - "", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.", - "if (gamepad == null) return;", - "", - "", "if (controllerType == \"XBOX\") {", " eventsFunctionContext.returnValue = gdjs._extensionController.isXbox(gamepad);", "} else {", @@ -6960,7 +6663,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" }, { @@ -6981,17 +6684,9 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;", "/** @type {Gamepad[]} */", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);", - "", - "//Get function parameter", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;", - "", - "if (playerId < 0 || playerId > 4) {", - " console.error('Parameter gamepad identifier in condition: \"Gamepad connected\", is not valid number, must be between 0 and 4.');", - " return;", - "}", - "", + "const gamepads = navigator.getGamepads ? navigator.getGamepads() : [];", "// If gamepad was disconnected it will be null (so this will return false)", "// If gamepad was never connected it will be undefined (so this will return false)", "eventsFunctionContext.returnValue = !!gamepads[playerId];" @@ -7004,7 +6699,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" } ], @@ -7020,25 +6715,16 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */", - "//Vibration work only on game in browser.", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);", - "", - "//Get function parameters", - "const playerId = eventsFunctionContext.getArgument(\"Player_ID\") - 1;", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;", "const duration = eventsFunctionContext.getArgument(\"Duration\") || 1;", - "", - "if (playerId < 0 || playerId > 4) {", - " console.error('Parameter gamepad identifier in action: \"Gamepad connected\", is not valid number, must be between 0 and 4.');", - " return;", + "/** @type {Gamepad} */", + "const gamepad = gdjs._extensionController.getGamepad(playerId);", + "if (!gamepad) {", + " // The gamepad is not connected.", + " return;", "}", - "", - "const gamepad = gamepads[playerId];", - "", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.", - "if (gamepad == null) return;", - "", - "if (gamepad && gamepad.vibrationActuator) {", + "//Vibration work only on game in browser.", + "if (gamepad.vibrationActuator) {", " gamepad.vibrationActuator.playEffect(\"dual-rumble\", {", " startDelay: 0,", " duration: duration * 1000,", @@ -7055,7 +6741,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "Player_ID", + "name": "PlayerId", "type": "expression" }, { @@ -7076,35 +6762,19 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */", - "//Vibration work only on game in browser.", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);", - "", - "//Get function parameters", - "const playerId = eventsFunctionContext.getArgument(\"Player_ID\") - 1;", + "const { clamp } = gdjs.evtTools.common;", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;", "const duration = eventsFunctionContext.getArgument(\"Duration\") || 1;", - "const strongRumbleMagnitude = eventsFunctionContext.getArgument(\"StrongMagnitude\");", - "const weakRumbleMagnitude = eventsFunctionContext.getArgument(\"WeakMagnitude\");", - "", - "if (playerId < 0 || playerId > 4) {", - " console.error('Parameter gamepad identifier in action: \"Advanced gamepad vibration\", is not valid number, must be between 0 and 4.');", - " return;", - "}", - "if (weakRumbleMagnitude < 0 || weakRumbleMagnitude > 1) {", - " console.error('Parameter weakRumble identifier in action: \"Advanced gamepad vibration\", is not valid number, must be between 0 and 1.');", - " return;", - "}", - "if (strongRumbleMagnitude < 0 || strongRumbleMagnitude > 1) {", - " console.error('Parameter strongRumble identifier in action: \"Advanced gamepad vibration\", is not valid number, must be between 0 and 1.');", - " return;", + "const strongRumbleMagnitude = clamp(eventsFunctionContext.getArgument(\"StrongMagnitude\"), 0, 1);", + "const weakRumbleMagnitude = clamp(eventsFunctionContext.getArgument(\"WeakMagnitude\"), 0, 1);", + "/** @type {Gamepad} */", + "const gamepad = gdjs._extensionController.getGamepad(playerId);", + "if (!gamepad) {", + " // The gamepad is not connected.", + " return;", "}", - "", - "const gamepad = gamepads[playerId];", - "", - "//we need keep this condition because when use have not yet plug the controller we can't get the controller in the gamepad variable.", - "if (gamepad == null) return;", - "", - "if (gamepad && gamepad.vibrationActuator) {", + "//Vibration work only on game in browser.", + "if (gamepad.vibrationActuator) {", " gamepad.vibrationActuator.playEffect(\"dual-rumble\", {", " startDelay: 0,", " duration: duration * 1000,", @@ -7112,11 +6782,11 @@ " strongMagnitude: strongRumbleMagnitude", " });", "}", - "", - "gdjs._extensionController.players[playerId].rumble.duration = duration;", - "gdjs._extensionController.players[playerId].rumble.elapsedTime = 0;", - "gdjs._extensionController.players[playerId].rumble.weakMagnitude = weakRumbleMagnitude;", - "gdjs._extensionController.players[playerId].rumble.strongMagnitude = strongRumbleMagnitude;" + "const player = gdjs._extensionController.getPlayer(playerId)", + "player.rumble.duration = duration;", + "player.rumble.elapsedTime = 0;", + "player.rumble.weakMagnitude = weakRumbleMagnitude;", + "player.rumble.strongMagnitude = strongRumbleMagnitude;" ], "parameterObjects": "", "useStrict": true, @@ -7126,7 +6796,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "Player_ID", + "name": "PlayerId", "type": "expression" }, { @@ -7157,39 +6827,22 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */", - "//Vibration work only on game in browser.", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);", - "", - "//Get function parameters", - "const playerId = eventsFunctionContext.getArgument(\"Player_ID\") - 1;", - "const elapsedTime = gdjs._extensionController.players[playerId].rumble.elapsedTime || 0;", - "const originalDuration = gdjs._extensionController.players[playerId].rumble.duration || 1;", - "const strongRumbleMagnitude = eventsFunctionContext.getArgument(\"StrongMagnitude\");", - "const weakRumbleMagnitude = eventsFunctionContext.getArgument(\"WeakMagnitude\");", - "", - "", - "if (playerId < 0 || playerId > 4) {", - " console.error('Parameter gamepad identifier in action: \"Change gamepad active vibration\", is not valid number, must be between 0 and 4.');", - " return;", - "}", - "if (weakRumbleMagnitude < 0 || weakRumbleMagnitude > 1) {", - " console.error('Parameter weakRumble identifier in action: \"Change gamepad active vibration\", is not valid number, must be between 0 and 1.');", - " return;", - "}", - "if (strongRumbleMagnitude < 0 || strongRumbleMagnitude > 1) {", - " console.error('Parameter strongRumble identifier in action: \"Change gamepad active vibration\", is not valid number, must be between 0 and 1.');", - " return;", + "const { clamp } = gdjs.evtTools.common;", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;", + "const player = gdjs._extensionController.getPlayer(playerId);", + "const elapsedTime = player.rumble.elapsedTime || 0;", + "const originalDuration = player.rumble.duration || 1;", + "const strongRumbleMagnitude = clamp(eventsFunctionContext.getArgument(\"StrongMagnitude\"), 0, 1);", + "const weakRumbleMagnitude = clamp(eventsFunctionContext.getArgument(\"WeakMagnitude\"), 0, 1);", + "/** @type {Gamepad} */", + "const gamepad = gdjs._extensionController.getGamepad(playerId);", + "if (!gamepad) {", + " // The gamepad is not connected.", + " return;", "}", - "", - "const gamepad = gamepads[playerId];", - "", - "//we need keep this condition because when use have not yet plug the controller we can't get the controller in the gamepad variable.", - "if (gamepad == null) return;", - "", "if (originalDuration - elapsedTime <= 0) return;", - "", - "if (gamepad && gamepad.vibrationActuator) {", + "//Vibration work only on game in browser.", + "if (gamepad.vibrationActuator) {", " gamepad.vibrationActuator.playEffect(\"dual-rumble\", {", " startDelay: 0,", " duration: 1000 * (originalDuration - elapsedTime),", @@ -7198,8 +6851,8 @@ " });", "}", "", - "gdjs._extensionController.players[playerId].rumble.weakMagnitude = weakRumbleMagnitude;", - "gdjs._extensionController.players[playerId].rumble.strongMagnitude = strongRumbleMagnitude;" + "player.rumble.weakMagnitude = weakRumbleMagnitude;", + "player.rumble.strongMagnitude = strongRumbleMagnitude;" ], "parameterObjects": "", "useStrict": true, @@ -7209,7 +6862,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "Player_ID", + "name": "PlayerId", "type": "expression" }, { @@ -7240,54 +6893,10 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", - "\r", - "//Get function parameters\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", - "\r", - "if (playerId < 0 || playerId > 4) {\r", - "\tconsole.error('Parameter gamepad identifier in condition: \"Any gamepad button released\", is not valid number, must be between 0 and 4.');\r", - "\treturn;\r", - "}\r", - "\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", - "if (gamepad == null) return;\r", - "\r", - "for (let buttonId = 0; buttonId < gamepad.buttons.length; buttonId++) { //For each buttons on current frame.\r", - "\r", - "\tif (buttonId === undefined) {\r", - "\t\teventsFunctionContext.returnValue = false;\r", - "\t\treturn;\r", - "\t}\r", - "\r", - "\t//Get previous value or define value by default for the current button\r", - "\tgdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId] = gdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId] || { pressed: false };\r", - "\r", - "\t//Get state of the button at previous frame\r", - "\tconst previousStateButtonIsPressed = gdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId].pressed;\r", - "\r", - "\t//Get the state of the button on the current frame.\r", - "\tconst currentFrameStateButtonIsPressed = gamepad.buttons[buttonId].pressed;\r", "\r", - "\t//When previousStateButtonIsPressed is true and actual button state is not pressed\r", - "\t//Player have release the button\r", - "\tif (previousStateButtonIsPressed === true && currentFrameStateButtonIsPressed === false) {\r", - "\t\tgdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId].pressed = true;\r", - "\t\teventsFunctionContext.returnValue = true;\r", - "\t\t//break;\r", - "\t\treturn;\r", - "\t} else {\r", - "\t\t//The player didn't released the button yet, the previous frame state is still true\r", - "\t\tgdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId].pressed = false;\r", - "\t\teventsFunctionContext.returnValue = false;\r", - "\t}\r", - "\r", - "\tif (currentFrameStateButtonIsPressed) gdjs._extensionController.players[playerId].lastButtonUsed = buttonId;\r", - "}\r", - "" + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "const player = gdjs._extensionController.getPlayer(playerId)\r", + "eventsFunctionContext.returnValue = player.isAnyButtonReleased();" ], "parameterObjects": "", "useStrict": true, @@ -7297,7 +6906,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" } ], @@ -7313,8 +6922,8 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "const playerId = eventsFunctionContext.getArgument(\"Player_ID\") - 1;\r", - "eventsFunctionContext.returnValue = gdjs._extensionController.players[playerId].rumble.weakMagnitude;" + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "eventsFunctionContext.returnValue = gdjs._extensionController.getPlayer(playerId).rumble.weakMagnitude;" ], "parameterObjects": "", "useStrict": true, @@ -7327,7 +6936,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "Player_ID", + "name": "PlayerId", "type": "expression" } ], @@ -7343,8 +6952,8 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "const playerId = eventsFunctionContext.getArgument(\"Player_ID\") - 1;\r", - "eventsFunctionContext.returnValue = gdjs._extensionController.players[playerId].rumble.strongMagnitude;" + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "eventsFunctionContext.returnValue = gdjs._extensionController.getPlayer(playerId).rumble.strongMagnitude;" ], "parameterObjects": "", "useStrict": true, @@ -7357,7 +6966,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "Player_ID", + "name": "PlayerId", "type": "expression" } ], @@ -7370,6 +6979,7 @@ "fullName": "Platformer gamepad mapper", "name": "PlatformerGamepadMapper", "objectType": "", + "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -7809,16 +7419,6 @@ { "type": "BuiltinCommonInstructions::Standard", "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "JumpButton", - "=", - "\"A or Cross\"" - ] - }, { "type": { "value": "Gamepads::C_Button_pressed" @@ -7826,7 +7426,7 @@ "parameters": [ "", "GamepadIdentifier", - "\"A\"", + "Buttons[JumpButton]", "\"Left\"" ] } @@ -7842,225 +7442,175 @@ ] } ] - }, + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "Gamepads::PlatformerGamepadMapper", + "type": "behavior" + } + ], + "objectGroups": [] + } + ], + "propertyDescriptors": [ + { + "value": "", + "type": "Behavior", + "label": "Platformer character behavior", + "extraInformation": [ + "PlatformBehavior::PlatformerObjectBehavior" + ], + "choices": [], + "name": "PlatformerCharacter" + }, + { + "value": "1", + "type": "Number", + "label": "Gamepad identifier (1, 2, 3 or 4)", + "name": "GamepadIdentifier" + }, + { + "value": "true", + "type": "Boolean", + "label": "Use directional pad", + "group": "Controls", + "name": "UseArrows" + }, + { + "value": "true", + "type": "Boolean", + "label": "Use left stick", + "group": "Controls", + "name": "UseLeftStick" + }, + { + "value": "", + "type": "Boolean", + "label": "Use right stick", + "group": "Controls", + "name": "UseRightStick" + }, + { + "value": "A or Cross", + "type": "Choice", + "label": "Jump button", + "group": "Controls", + "choices": [ + { + "label": "A or Cross", + "value": "A or Cross" + }, + { + "label": "B or Circle", + "value": "B or Circle" + }, + { + "label": "X or Square", + "value": "X or Square" + }, + { + "label": "Y or Triangle", + "value": "Y or Triangle" + }, + { + "label": "LB or L1", + "value": "LB or L1" + }, + { + "label": "RB or R1", + "value": "RB or R1" + }, + { + "label": "LT or L2", + "value": "LT or L2" + }, + { + "label": "RT or R2", + "value": "RT or R2" + } + ], + "name": "JumpButton" + } + ], + "sharedPropertyDescriptors": [] + }, + { + "description": "Control a 3D physics character with a gamepad.", + "fullName": "3D platformer gamepad mapper", + "name": "Platformer3DGamepadMapper", + "objectType": "", + "quickCustomizationVisibility": "hidden", + "eventsFunctions": [ + { + "fullName": "", + "functionType": "Action", + "name": "doStepPreEvents", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "JumpButton", - "=", - "\"B or Circle\"" - ] - }, - { - "type": { - "value": "Gamepads::C_Button_pressed" - }, - "parameters": [ - "", - "GamepadIdentifier", - "\"B\"", - "\"Left\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateJumpKey" - }, - "parameters": [ - "Object", - "PlatformerCharacter" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "JumpButton", - "=", - "\"X or Square\"" - ] - }, - { - "type": { - "value": "Gamepads::C_Button_pressed" - }, - "parameters": [ - "", - "GamepadIdentifier", - "\"X\"", - "\"Left\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateJumpKey" - }, - "parameters": [ - "Object", - "PlatformerCharacter" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "JumpButton", - "=", - "\"Y or Triangle\"" - ] - }, - { - "type": { - "value": "Gamepads::C_Button_pressed" - }, - "parameters": [ - "", - "GamepadIdentifier", - "\"Y\"", - "\"Left\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateJumpKey" - }, - "parameters": [ - "Object", - "PlatformerCharacter" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "JumpButton", - "=", - "\"LB or L1\"" - ] - }, - { - "type": { - "value": "Gamepads::C_Button_pressed" - }, - "parameters": [ - "", - "GamepadIdentifier", - "\"LB\"", - "\"Left\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateJumpKey" - }, - "parameters": [ - "Object", - "PlatformerCharacter" - ] - } + "type": { + "value": "Gamepads::C_Controller_X_is_connected" + }, + "parameters": [ + "", + "GamepadIdentifier", + "" ] - }, + } + ], + "actions": [], + "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "value": "StringVariable" - }, - "parameters": [ - "JumpButton", - "=", - "\"RB or R1\"" - ] - }, - { - "type": { - "value": "Gamepads::C_Button_pressed" + "value": "Gamepads::StickForce" }, "parameters": [ "", + ">", + "0", "GamepadIdentifier", - "\"RB\"", - "\"Left\"" + "JoystickIdentifier", + "" ] } ], "actions": [ { "type": { - "value": "PlatformBehavior::SimulateJumpKey" + "value": "Physics3D::PhysicsCharacter3D::SetForwardAngle" }, "parameters": [ "Object", - "PlatformerCharacter" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "JumpButton", + "PhysicsCharacter3D", "=", - "\"LT or L2\"" + "Gamepads::StickAngle(GamepadIdentifier, JoystickIdentifier) + CameraAngle(Object.Layer())" ] }, { "type": { - "value": "Gamepads::C_Button_pressed" - }, - "parameters": [ - "", - "GamepadIdentifier", - "\"LT\"", - "\"Left\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateJumpKey" + "value": "Physics3D::PhysicsCharacter3D::SimulateStick" }, "parameters": [ "Object", - "PlatformerCharacter" + "PhysicsCharacter3D", + "-90", + "Gamepads::StickForce(GamepadIdentifier, JoystickIdentifier)" ] } ] @@ -8068,16 +7618,6 @@ { "type": "BuiltinCommonInstructions::Standard", "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "JumpButton", - "=", - "\"RT or R2\"" - ] - }, { "type": { "value": "Gamepads::C_Button_pressed" @@ -8085,7 +7625,7 @@ "parameters": [ "", "GamepadIdentifier", - "\"RT\"", + "Buttons[JumpButton]", "\"Left\"" ] } @@ -8093,11 +7633,11 @@ "actions": [ { "type": { - "value": "PlatformBehavior::SimulateJumpKey" + "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" }, "parameters": [ "Object", - "PlatformerCharacter" + "PhysicsCharacter3D" ] } ] @@ -8114,7 +7654,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "Gamepads::PlatformerGamepadMapper", + "supplementaryInformation": "Gamepads::Platformer3DGamepadMapper", "type": "behavior" } ], @@ -8125,65 +7665,74 @@ { "value": "", "type": "Behavior", - "label": "Platformer character behavior", - "description": "", - "group": "", + "label": "3D physics character", "extraInformation": [ - "PlatformBehavior::PlatformerObjectBehavior" + "Physics3D::PhysicsCharacter3D" ], - "name": "PlatformerCharacter" + "choices": [], + "name": "PhysicsCharacter3D" }, { "value": "1", "type": "Number", "label": "Gamepad identifier (1, 2, 3 or 4)", - "description": "", - "group": "", - "extraInformation": [], "name": "GamepadIdentifier" }, { - "value": "true", - "type": "Boolean", - "label": "Use directional pad", - "description": "", - "group": "Controls", - "extraInformation": [], - "name": "UseArrows" - }, - { - "value": "true", - "type": "Boolean", - "label": "Use left stick", - "description": "", - "group": "Controls", - "extraInformation": [], - "name": "UseLeftStick" - }, - { - "value": "", - "type": "Boolean", - "label": "Use right stick", - "description": "", + "value": "Left", + "type": "Choice", + "label": "Walk joystick", "group": "Controls", - "extraInformation": [], - "name": "UseRightStick" + "choices": [ + { + "label": "Left", + "value": "Left" + }, + { + "label": "Right", + "value": "Right" + } + ], + "name": "JoystickIdentifier" }, { "value": "A or Cross", "type": "Choice", "label": "Jump button", - "description": "", "group": "Controls", - "extraInformation": [ - "A or Cross", - "B or Circle", - "X or Square", - "Y or Triangle", - "LB or L1", - "RB or R1", - "LT or L2", - "RT or R2" + "choices": [ + { + "label": "A or Cross", + "value": "A or Cross" + }, + { + "label": "B or Circle", + "value": "B or Circle" + }, + { + "label": "X or Square", + "value": "X or Square" + }, + { + "label": "Y or Triangle", + "value": "Y or Triangle" + }, + { + "label": "LB or L1", + "value": "LB or L1" + }, + { + "label": "RB or R1", + "value": "RB or R1" + }, + { + "label": "LT or L2", + "value": "LT or L2" + }, + { + "label": "RT or R2", + "value": "RT or R2" + } ], "name": "JumpButton" } @@ -8192,9 +7741,10 @@ }, { "description": "Control a 3D physics character with a gamepad.", - "fullName": "3D platformer gamepad mapper", - "name": "Platformer3DGamepadMapper", + "fullName": "3D shooter gamepad mapper", + "name": "Shooter3DGamepadMapper", "objectType": "", + "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -8230,7 +7780,7 @@ ">", "0", "GamepadIdentifier", - "JoystickIdentifier", + "WalkStick", "" ] } @@ -8238,283 +7788,13 @@ "actions": [ { "type": { - "value": "Physics3D::PhysicsCharacter3D::SetForwardAngle" + "value": "Physics3D::PhysicsCharacter3D::SimulateStick" }, "parameters": [ "Object", "PhysicsCharacter3D", - "=", - "Gamepads::StickAngle(GamepadIdentifier, JoystickIdentifier) + CameraAngle(Object.Layer())" - ] - }, - { - "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateStick" - }, - "parameters": [ - "Object", - "PhysicsCharacter3D", - "-90", - "Gamepads::StickForce(GamepadIdentifier, JoystickIdentifier)" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "JumpButton", - "=", - "\"A or Cross\"" - ] - }, - { - "type": { - "value": "Gamepads::C_Button_pressed" - }, - "parameters": [ - "", - "GamepadIdentifier", - "\"A\"", - "\"Left\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" - }, - "parameters": [ - "Object", - "PhysicsCharacter3D" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "JumpButton", - "=", - "\"B or Circle\"" - ] - }, - { - "type": { - "value": "Gamepads::C_Button_pressed" - }, - "parameters": [ - "", - "GamepadIdentifier", - "\"B\"", - "\"Left\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" - }, - "parameters": [ - "Object", - "PhysicsCharacter3D" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "JumpButton", - "=", - "\"X or Square\"" - ] - }, - { - "type": { - "value": "Gamepads::C_Button_pressed" - }, - "parameters": [ - "", - "GamepadIdentifier", - "\"X\"", - "\"Left\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" - }, - "parameters": [ - "Object", - "PhysicsCharacter3D" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "JumpButton", - "=", - "\"Y or Triangle\"" - ] - }, - { - "type": { - "value": "Gamepads::C_Button_pressed" - }, - "parameters": [ - "", - "GamepadIdentifier", - "\"Y\"", - "\"Left\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" - }, - "parameters": [ - "Object", - "PhysicsCharacter3D" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "JumpButton", - "=", - "\"LB or L1\"" - ] - }, - { - "type": { - "value": "Gamepads::C_Button_pressed" - }, - "parameters": [ - "", - "GamepadIdentifier", - "\"LB\"", - "\"Left\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" - }, - "parameters": [ - "Object", - "PhysicsCharacter3D" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "JumpButton", - "=", - "\"RB or R1\"" - ] - }, - { - "type": { - "value": "Gamepads::C_Button_pressed" - }, - "parameters": [ - "", - "GamepadIdentifier", - "\"RB\"", - "\"Left\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" - }, - "parameters": [ - "Object", - "PhysicsCharacter3D" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "JumpButton", - "=", - "\"LT or L2\"" - ] - }, - { - "type": { - "value": "Gamepads::C_Button_pressed" - }, - "parameters": [ - "", - "GamepadIdentifier", - "\"LT\"", - "\"Left\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" - }, - "parameters": [ - "Object", - "PhysicsCharacter3D" + "Gamepads::StickAngle(GamepadIdentifier, WalkStick)", + "Gamepads::StickForce(GamepadIdentifier, WalkStick)" ] } ] @@ -8522,16 +7802,6 @@ { "type": "BuiltinCommonInstructions::Standard", "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "JumpButton", - "=", - "\"RT or R2\"" - ] - }, { "type": { "value": "Gamepads::C_Button_pressed" @@ -8539,7 +7809,7 @@ "parameters": [ "", "GamepadIdentifier", - "\"RT\"", + "Buttons[JumpButton]", "\"Left\"" ] } @@ -8568,7 +7838,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "Gamepads::Platformer3DGamepadMapper", + "supplementaryInformation": "Gamepads::Shooter3DGamepadMapper", "type": "behavior" } ], @@ -8580,49 +7850,90 @@ "value": "", "type": "Behavior", "label": "3D physics character", - "description": "", - "group": "", "extraInformation": [ "Physics3D::PhysicsCharacter3D" ], + "choices": [], "name": "PhysicsCharacter3D" }, { "value": "1", "type": "Number", "label": "Gamepad identifier (1, 2, 3 or 4)", - "description": "", - "group": "", - "extraInformation": [], "name": "GamepadIdentifier" }, { "value": "Left", "type": "Choice", "label": "Walk joystick", - "description": "", "group": "Controls", - "extraInformation": [ - "Left", - "Right" + "choices": [ + { + "label": "Left", + "value": "Left" + }, + { + "label": "Right", + "value": "Right" + } ], - "name": "JoystickIdentifier" + "name": "WalkStick" + }, + { + "value": "Right", + "type": "Choice", + "label": "Camera joystick", + "group": "Controls", + "choices": [ + { + "label": "Left", + "value": "Left" + }, + { + "label": "Right", + "value": "Right" + } + ], + "name": "CameraStick" }, { "value": "A or Cross", "type": "Choice", "label": "Jump button", - "description": "", "group": "Controls", - "extraInformation": [ - "A or Cross", - "B or Circle", - "X or Square", - "Y or Triangle", - "LB or L1", - "RB or R1", - "LT or L2", - "RT or R2" + "choices": [ + { + "label": "A or Cross", + "value": "A or Cross" + }, + { + "label": "B or Circle", + "value": "B or Circle" + }, + { + "label": "X or Square", + "value": "X or Square" + }, + { + "label": "Y or Triangle", + "value": "Y or Triangle" + }, + { + "label": "LB or L1", + "value": "LB or L1" + }, + { + "label": "RB or R1", + "value": "RB or R1" + }, + { + "label": "LT or L2", + "value": "LT or L2" + }, + { + "label": "RT or R2", + "value": "RT or R2" + } ], "name": "JumpButton" } @@ -8630,10 +7941,11 @@ "sharedPropertyDescriptors": [] }, { - "description": "Control a 3D physics character with a gamepad.", - "fullName": "3D shooter gamepad mapper", - "name": "Shooter3DGamepadMapper", + "description": "Control camera rotations with a gamepad.", + "fullName": "First person camera gamepad mapper", + "name": "FirstPersonGamepadMapper", "objectType": "", + "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -8641,347 +7953,82 @@ "name": "doStepPreEvents", "sentence": "", "events": [ + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "TODO It's probably a bad idea to rotate the object around Y." + }, { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "conditions": [], + "actions": [ { "type": { - "value": "Gamepads::C_Controller_X_is_connected" + "value": "SetNumberVariable" }, "parameters": [ - "", - "GamepadIdentifier", - "" - ] - } - ], - "actions": [], - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "Gamepads::StickForce" - }, - "parameters": [ - "", - ">", - "0", - "GamepadIdentifier", - "WalkStick", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateStick" - }, - "parameters": [ - "Object", - "PhysicsCharacter3D", - "Gamepads::StickAngle(GamepadIdentifier, WalkStick)", - "Gamepads::StickForce(GamepadIdentifier, WalkStick)" - ] - } + "CurrentRotationSpeedZ", + "=", + "Gamepads::AcceleratedSpeed(CurrentRotationSpeedZ, Gamepads::StickForceX(GamepadIdentifier, CameraStick) * HorizontalRotationSpeedMax, HorizontalRotationSpeedMax, HorizontalRotationAcceleration, HorizontalRotationDeceleration)" ] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "JumpButton", - "=", - "\"A or Cross\"" - ] - }, - { - "type": { - "value": "Gamepads::C_Button_pressed" - }, - "parameters": [ - "", - "GamepadIdentifier", - "\"A\"", - "\"Left\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" - }, - "parameters": [ - "Object", - "PhysicsCharacter3D" - ] - } + "type": { + "value": "SetAngle" + }, + "parameters": [ + "Object", + "+", + "CurrentRotationSpeedZ * TimeDelta()" ] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "JumpButton", - "=", - "\"B or Circle\"" - ] - }, - { - "type": { - "value": "Gamepads::C_Button_pressed" - }, - "parameters": [ - "", - "GamepadIdentifier", - "\"B\"", - "\"Left\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" - }, - "parameters": [ - "Object", - "PhysicsCharacter3D" - ] - } + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "CurrentRotationSpeedY", + "=", + "Gamepads::AcceleratedSpeed(CurrentRotationSpeedY, Gamepads::StickForceY(GamepadIdentifier, CameraStick) * VerticalRotationSpeedMax, VerticalRotationSpeedMax, VerticalRotationAcceleration, VerticalRotationDeceleration)" ] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "JumpButton", - "=", - "\"X or Square\"" - ] - }, - { - "type": { - "value": "Gamepads::C_Button_pressed" - }, - "parameters": [ - "", - "GamepadIdentifier", - "\"X\"", - "\"Left\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" - }, - "parameters": [ - "Object", - "PhysicsCharacter3D" - ] - } + "type": { + "value": "Scene3D::Base3DBehavior::SetRotationY" + }, + "parameters": [ + "Object", + "Object3D", + "+", + "CurrentRotationSpeedY * TimeDelta()" ] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "JumpButton", - "=", - "\"Y or Triangle\"" - ] - }, - { - "type": { - "value": "Gamepads::C_Button_pressed" - }, - "parameters": [ - "", - "GamepadIdentifier", - "\"Y\"", - "\"Left\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" - }, - "parameters": [ - "Object", - "PhysicsCharacter3D" - ] - } + "type": { + "value": "Scene3D::Base3DBehavior::SetRotationY" + }, + "parameters": [ + "Object", + "Object3D", + "=", + "clamp(Object.Object3D::RotationY(), VerticalAngleMin, VerticalAngleMax)" ] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "JumpButton", - "=", - "\"LB or L1\"" - ] - }, - { - "type": { - "value": "Gamepads::C_Button_pressed" - }, - "parameters": [ - "", - "GamepadIdentifier", - "\"LB\"", - "\"Left\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" - }, - "parameters": [ - "Object", - "PhysicsCharacter3D" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "JumpButton", - "=", - "\"RB or R1\"" - ] - }, - { - "type": { - "value": "Gamepads::C_Button_pressed" - }, - "parameters": [ - "", - "GamepadIdentifier", - "\"RB\"", - "\"Left\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" - }, - "parameters": [ - "Object", - "PhysicsCharacter3D" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "JumpButton", - "=", - "\"LT or L2\"" - ] - }, - { - "type": { - "value": "Gamepads::C_Button_pressed" - }, - "parameters": [ - "", - "GamepadIdentifier", - "\"LT\"", - "\"Left\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" - }, - "parameters": [ - "Object", - "PhysicsCharacter3D" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "JumpButton", - "=", - "\"RT or R2\"" - ] - }, - { - "type": { - "value": "Gamepads::C_Button_pressed" - }, - "parameters": [ - "", - "GamepadIdentifier", - "\"RT\"", - "\"Left\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" - }, - "parameters": [ - "Object", - "PhysicsCharacter3D" - ] - } + "type": { + "value": "Gamepads::FirstPersonGamepadMapper::LookFromObjectEyes" + }, + "parameters": [ + "Object", + "Behavior", + "" ] } ] @@ -8996,251 +8043,76 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "Gamepads::Shooter3DGamepadMapper", + "supplementaryInformation": "Gamepads::FirstPersonGamepadMapper", "type": "behavior" } ], "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "", - "type": "Behavior", - "label": "3D physics character", - "description": "", - "group": "", - "extraInformation": [ - "Physics3D::PhysicsCharacter3D" - ], - "name": "PhysicsCharacter3D" - }, - { - "value": "1", - "type": "Number", - "label": "Gamepad identifier (1, 2, 3 or 4)", - "description": "", - "group": "", - "extraInformation": [], - "name": "GamepadIdentifier" - }, - { - "value": "Left", - "type": "Choice", - "label": "Walk joystick", - "description": "", - "group": "Controls", - "extraInformation": [ - "Left", - "Right" - ], - "name": "WalkStick" - }, - { - "value": "Right", - "type": "Choice", - "label": "Camera joystick", - "description": "", - "group": "Controls", - "extraInformation": [ - "Left", - "Right" - ], - "name": "CameraStick" }, { - "value": "A or Cross", - "type": "Choice", - "label": "Jump button", - "description": "", - "group": "Controls", - "extraInformation": [ - "A or Cross", - "B or Circle", - "X or Square", - "Y or Triangle", - "LB or L1", - "RB or R1", - "LT or L2", - "RT or R2" - ], - "name": "JumpButton" - } - ], - "sharedPropertyDescriptors": [] - }, - { - "description": "Control camera rotations with a gamepad.", - "fullName": "First person camera gamepad mapper", - "name": "FirstPersonGamepadMapper", - "objectType": "", - "eventsFunctions": [ - { - "fullName": "", + "description": "Move the camera to look though _PARAM1_ eyes. The object must look to the right when all its angles are 0 and the top of its head be toward Z+.", + "fullName": "Look through object eyes", "functionType": "Action", - "name": "doStepPreEvents", - "sentence": "", + "group": "Layers and cameras", + "name": "LookFromObjectEyes", + "private": true, + "sentence": "Move the camera to look though _PARAM0_ eyes", "events": [ - { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 - }, - "comment": "TODO It's probably a bad idea to rotate the object around Y." - }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [], "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "CentreCamera" }, "parameters": [ - "CurrentRotationSpeedZ", - "=", - "Gamepads::AcceleratedSpeed(CurrentRotationSpeedZ, Gamepads::StickForceX(GamepadIdentifier, CameraStick) * HorizontalRotationSpeedMax, HorizontalRotationSpeedMax, HorizontalRotationAcceleration, HorizontalRotationDeceleration)" + "", + "Object", + "", + "Object.Layer()", + "" ] }, { "type": { - "value": "SetAngle" + "value": "Scene3D::SetCameraZ" }, "parameters": [ - "Object", - "+", - "CurrentRotationSpeedZ * TimeDelta()" + "", + "=", + "Object.Object3D::Z() + Object.Object3D::Depth() + OffsetZ", + "", + "" ] }, { "type": { - "value": "SetNumberVariable" + "value": "Scene3D::SetCameraRotationX" }, "parameters": [ - "CurrentRotationSpeedY", + "", "=", - "Gamepads::AcceleratedSpeed(CurrentRotationSpeedY, Gamepads::StickForceY(GamepadIdentifier, CameraStick) * VerticalRotationSpeedMax, VerticalRotationSpeedMax, VerticalRotationAcceleration, VerticalRotationDeceleration)" + "- Object.Object3D::RotationY() + 90", + "GetArgumentAsString(\"Layer\")", + "" ] }, { "type": { - "value": "Scene3D::Base3DBehavior::SetRotationY" + "value": "Scene3D::SetCameraRotationY" }, "parameters": [ - "Object", - "Object3D", - "+", - "CurrentRotationSpeedY * TimeDelta()" + "", + "=", + "Object.Object3D::RotationX()", + "GetArgumentAsString(\"Layer\")", + "" ] }, { "type": { - "value": "Scene3D::Base3DBehavior::SetRotationY" - }, - "parameters": [ - "Object", - "Object3D", - "=", - "clamp(Object.Object3D::RotationY(), VerticalAngleMin, VerticalAngleMax)" - ] - }, - { - "type": { - "value": "Gamepads::FirstPersonGamepadMapper::LookFromObjectEyes" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "Gamepads::FirstPersonGamepadMapper", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "Move the camera to look though _PARAM1_ eyes. The object must look to the right when all its angles are 0 and the top of its head be toward Z+.", - "fullName": "Look through object eyes", - "functionType": "Action", - "group": "Layers and cameras", - "name": "LookFromObjectEyes", - "private": true, - "sentence": "Move the camera to look though _PARAM0_ eyes", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "CentreCamera" - }, - "parameters": [ - "", - "Object", - "", - "Object.Layer()", - "" - ] - }, - { - "type": { - "value": "Scene3D::SetCameraZ" - }, - "parameters": [ - "", - "=", - "Object.Object3D::Z() + Object.Object3D::Depth() + OffsetZ", - "", - "" - ] - }, - { - "type": { - "value": "Scene3D::SetCameraRotationX" - }, - "parameters": [ - "", - "=", - "- Object.Object3D::RotationY() + 90", - "GetArgumentAsString(\"Layer\")", - "" - ] - }, - { - "type": { - "value": "Scene3D::SetCameraRotationY" - }, - "parameters": [ - "", - "=", - "Object.Object3D::RotationX()", - "GetArgumentAsString(\"Layer\")", - "" - ] - }, - { - "type": { - "value": "SetCameraAngle" + "value": "SetCameraAngle" }, "parameters": [ "", @@ -9994,31 +8866,31 @@ "value": "", "type": "Behavior", "label": "3D capability", - "description": "", - "group": "", "extraInformation": [ "Scene3D::Base3DBehavior" ], + "choices": [], "name": "Object3D" }, { "value": "1", "type": "Number", "label": "Gamepad identifier (1, 2, 3 or 4)", - "description": "", - "group": "", - "extraInformation": [], "name": "GamepadIdentifier" }, { "value": "Right", "type": "Choice", "label": "Camera joystick", - "description": "", - "group": "", - "extraInformation": [ - "Left", - "Right" + "choices": [ + { + "label": "Left", + "value": "Left" + }, + { + "label": "Right", + "value": "Right" + } ], "name": "CameraStick" }, @@ -10027,27 +8899,21 @@ "type": "Number", "unit": "AngularSpeed", "label": "Maximum rotation speed", - "description": "", "group": "Horizontal rotation", - "extraInformation": [], "name": "HorizontalRotationSpeedMax" }, { "value": "360", "type": "Number", "label": "Rotation acceleration", - "description": "", "group": "Horizontal rotation", - "extraInformation": [], "name": "HorizontalRotationAcceleration" }, { "value": "720", "type": "Number", "label": "Rotation deceleration", - "description": "", "group": "Horizontal rotation", - "extraInformation": [], "name": "HorizontalRotationDeceleration" }, { @@ -10055,27 +8921,21 @@ "type": "Number", "unit": "AngularSpeed", "label": "Maximum rotation speed", - "description": "", "group": "Vertical rotation", - "extraInformation": [], "name": "VerticalRotationSpeedMax" }, { "value": "240", "type": "Number", "label": "Rotation acceleration", - "description": "", "group": "Vertical rotation", - "extraInformation": [], "name": "VerticalRotationAcceleration" }, { "value": "480", "type": "Number", "label": "Rotation deceleration", - "description": "", "group": "Vertical rotation", - "extraInformation": [], "name": "VerticalRotationDeceleration" }, { @@ -10083,9 +8943,7 @@ "type": "Number", "unit": "DegreeAngle", "label": "Minimum angle", - "description": "", "group": "Vertical rotation", - "extraInformation": [], "name": "VerticalAngleMin" }, { @@ -10093,9 +8951,7 @@ "type": "Number", "unit": "DegreeAngle", "label": "Maximum angle", - "description": "", "group": "Vertical rotation", - "extraInformation": [], "name": "VerticalAngleMax" }, { @@ -10103,9 +8959,7 @@ "type": "Number", "unit": "Pixel", "label": "Z position offset", - "description": "", "group": "Position", - "extraInformation": [], "name": "OffsetZ" }, { @@ -10113,9 +8967,6 @@ "type": "Number", "unit": "AngularSpeed", "label": "Current rotation speed Z", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "CurrentRotationSpeedZ" }, @@ -10124,9 +8975,6 @@ "type": "Number", "unit": "AngularSpeed", "label": "Current rotation speed Y", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "CurrentRotationSpeedY" } @@ -10134,10 +8982,11 @@ "sharedPropertyDescriptors": [] }, { - "description": "Control a top-down character with a gamepad.", - "fullName": "Top-down gamepad mapper", - "name": "TopDownGamepadMapper", + "description": "Control a 3D physics car with a gamepad.", + "fullName": "3D car gamepad mapper", + "name": "PhysicsCar3DGamepadMapper", "objectType": "", + "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -10195,11 +9044,11 @@ "actions": [ { "type": { - "value": "TopDownMovementBehavior::SimulateLeftKey" + "value": "Physics3D::PhysicsCar3D::SimulateLeftKey" }, "parameters": [ "Object", - "TopDownMovement" + "PhysicsCar3D" ] } ] @@ -10222,65 +9071,58 @@ "actions": [ { "type": { - "value": "TopDownMovementBehavior::SimulateRightKey" + "value": "Physics3D::PhysicsCar3D::SimulateRightKey" }, "parameters": [ "Object", - "TopDownMovement" + "PhysicsCar3D" ] } ] - }, + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "Gamepads::C_Button_pressed" - }, - "parameters": [ - "", - "GamepadIdentifier", - "\"Up\"", - "\"Left\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "TopDownMovementBehavior::SimulateUpKey" - }, - "parameters": [ - "Object", - "TopDownMovement" - ] - } + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "UseLeftStick", + "True", + "" ] - }, + } + ], + "actions": [], + "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "value": "Gamepads::C_Button_pressed" + "value": "Gamepads::C_Axis_pushed" }, "parameters": [ "", - "GamepadIdentifier", - "\"Down\"", - "\"Left\"" + "1", + "\"Left\"", + "\"Any\"", + "" ] } ], "actions": [ { "type": { - "value": "TopDownMovementBehavior::SimulateDownKey" + "value": "Physics3D::PhysicsCar3D::SimulateSteeringStick" }, "parameters": [ "Object", - "TopDownMovement" + "PhysicsCar3D", + "Gamepads::StickForceX(GamepadIdentifier, \"Left\")" ] } ] @@ -10295,7 +9137,7 @@ "value": "BooleanVariable" }, "parameters": [ - "UseLeftStick", + "UseRightStick", "True", "" ] @@ -10308,189 +9150,236 @@ "conditions": [ { "type": { - "value": "StringVariable" + "value": "Gamepads::C_Axis_pushed" }, "parameters": [ - "StickMode", - "=", - "\"Analog\"" + "", + "1", + "\"Right\"", + "\"Any\"", + "" ] } ], "actions": [ { "type": { - "value": "TopDownMovementBehavior::SimulateStick" + "value": "Physics3D::PhysicsCar3D::SimulateSteeringStick" }, "parameters": [ "Object", - "TopDownMovement", - "Gamepads::StickRotationValue(GamepadIdentifier, \"Left\")", - "Gamepads::StickForce(GamepadIdentifier, \"Left\")" + "PhysicsCar3D", + "Gamepads::StickForceX(GamepadIdentifier, \"Right\")" ] } ] - }, + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "type": { + "value": "BuiltinCommonInstructions::Or" + }, + "parameters": [], + "subInstructions": [ { "type": { - "value": "StringVariable" + "value": "Gamepads::C_Button_pressed" }, "parameters": [ - "StickMode", - "=", - "\"360°\"" + "", + "1", + "\"LT\"", + "\"Up\"" ] - } - ], - "actions": [ + }, { "type": { - "value": "TopDownMovementBehavior::SimulateStick" + "value": "Gamepads::C_Button_pressed" }, "parameters": [ - "Object", - "TopDownMovement", - "Gamepads::StickRotationValue(GamepadIdentifier, \"Left\")", - "sign(Gamepads::StickForce(GamepadIdentifier, \"Left\"))" + "", + "1", + "\"RT\"", + "\"Up\"" ] } ] - }, + } + ], + "actions": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "StickMode", - "=", - "\"8 Directions\"" - ] - } - ], - "actions": [], - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "Gamepads::C_Axis_pushed" - }, - "parameters": [ - "", - "GamepadIdentifier", - "\"Left\"", - "\"Left\"", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "TopDownMovementBehavior::SimulateLeftKey" - }, - "parameters": [ - "Object", - "TopDownMovement" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "Gamepads::C_Axis_pushed" - }, - "parameters": [ - "", - "GamepadIdentifier", - "\"Left\"", - "\"Right\"", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "TopDownMovementBehavior::SimulateRightKey" - }, - "parameters": [ - "Object", - "TopDownMovement" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "Gamepads::C_Axis_pushed" - }, - "parameters": [ - "", - "GamepadIdentifier", - "\"Left\"", - "\"Up\"", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "TopDownMovementBehavior::SimulateUpKey" - }, - "parameters": [ - "Object", - "TopDownMovement" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "Gamepads::C_Axis_pushed" - }, - "parameters": [ - "", - "GamepadIdentifier", - "\"Left\"", - "\"Down\"", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "TopDownMovementBehavior::SimulateDownKey" - }, - "parameters": [ - "Object", - "TopDownMovement" - ] - } - ] - } + "type": { + "value": "Physics3D::PhysicsCar3D::SimulateAcceleratorStick" + }, + "parameters": [ + "Object", + "PhysicsCar3D", + "Gamepads::TriggerPressure(GamepadIdentifier, \"RT\") - Gamepads::TriggerPressure(GamepadIdentifier, \"LT\")" ] } ] }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::C_Button_pressed" + }, + "parameters": [ + "", + "GamepadIdentifier", + "Buttons[HandBrakeButton]", + "\"Left\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "Physics3D::PhysicsCar3D::SimulateHandBrakeKey" + }, + "parameters": [ + "Object", + "PhysicsCar3D" + ] + } + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "Gamepads::PhysicsCar3DGamepadMapper", + "type": "behavior" + } + ], + "objectGroups": [] + } + ], + "propertyDescriptors": [ + { + "value": "", + "type": "Behavior", + "label": "3D physics car", + "extraInformation": [ + "Physics3D::PhysicsCar3D" + ], + "choices": [], + "name": "PhysicsCar3D" + }, + { + "value": "1", + "type": "Number", + "label": "Gamepad identifier (1, 2, 3 or 4)", + "name": "GamepadIdentifier" + }, + { + "value": "true", + "type": "Boolean", + "label": "Use directional pad", + "group": "Controls", + "name": "UseArrows" + }, + { + "value": "true", + "type": "Boolean", + "label": "Use left stick", + "group": "Controls", + "name": "UseLeftStick" + }, + { + "value": "", + "type": "Boolean", + "label": "Use right stick", + "group": "Controls", + "name": "UseRightStick" + }, + { + "value": "B or Circle", + "type": "Choice", + "label": "Hand brake button", + "group": "Controls", + "choices": [ + { + "label": "A or Cross", + "value": "A or Cross" + }, + { + "label": "B or Circle", + "value": "B or Circle" + }, + { + "label": "X or Square", + "value": "X or Square" + }, + { + "label": "Y or Triangle", + "value": "Y or Triangle" + }, + { + "label": "LB or L1", + "value": "LB or L1" + }, + { + "label": "RB or R1", + "value": "RB or R1" + }, + { + "label": "LT or L2", + "value": "LT or L2" + }, + { + "label": "RT or R2", + "value": "RT or R2" + } + ], + "name": "HandBrakeButton" + } + ], + "sharedPropertyDescriptors": [] + }, + { + "description": "Control a top-down character with a gamepad.", + "fullName": "Top-down gamepad mapper", + "name": "TopDownGamepadMapper", + "objectType": "", + "quickCustomizationVisibility": "hidden", + "eventsFunctions": [ + { + "fullName": "", + "functionType": "Action", + "name": "doStepPreEvents", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::C_Controller_X_is_connected" + }, + "parameters": [ + "", + "GamepadIdentifier", + "" + ] + } + ], + "actions": [], + "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [ @@ -10499,7 +9388,7 @@ "value": "BooleanVariable" }, "parameters": [ - "UseRightStick", + "UseArrows", "True", "" ] @@ -10512,25 +9401,24 @@ "conditions": [ { "type": { - "value": "StringVariable" + "value": "Gamepads::C_Button_pressed" }, "parameters": [ - "StickMode", - "=", - "\"Analog\"" + "", + "GamepadIdentifier", + "\"Left\"", + "\"Left\"" ] } ], "actions": [ { "type": { - "value": "TopDownMovementBehavior::SimulateStick" + "value": "TopDownMovementBehavior::SimulateLeftKey" }, "parameters": [ "Object", - "TopDownMovement", - "Gamepads::StickRotationValue(GamepadIdentifier, \"Right\")", - "Gamepads::StickForce(GamepadIdentifier, \"Right\")" + "TopDownMovement" ] } ] @@ -10540,25 +9428,152 @@ "conditions": [ { "type": { - "value": "StringVariable" + "value": "Gamepads::C_Button_pressed" }, "parameters": [ - "StickMode", - "=", - "\"360°\"" + "", + "GamepadIdentifier", + "\"Right\"", + "\"Left\"" ] } ], "actions": [ { "type": { - "value": "TopDownMovementBehavior::SimulateStick" + "value": "TopDownMovementBehavior::SimulateRightKey" }, "parameters": [ "Object", - "TopDownMovement", - "sign(Gamepads::StickForce(GamepadIdentifier, \"Right\"))", - "1" + "TopDownMovement" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::C_Button_pressed" + }, + "parameters": [ + "", + "GamepadIdentifier", + "\"Up\"", + "\"Left\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "TopDownMovementBehavior::SimulateUpKey" + }, + "parameters": [ + "Object", + "TopDownMovement" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::C_Button_pressed" + }, + "parameters": [ + "", + "GamepadIdentifier", + "\"Down\"", + "\"Left\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "TopDownMovementBehavior::SimulateDownKey" + }, + "parameters": [ + "Object", + "TopDownMovement" + ] + } + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "UseLeftStick", + "True", + "" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "StickMode", + "=", + "\"Analog\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "TopDownMovementBehavior::SimulateStick" + }, + "parameters": [ + "Object", + "TopDownMovement", + "Gamepads::StickRotationValue(GamepadIdentifier, \"Left\")", + "Gamepads::StickForce(GamepadIdentifier, \"Left\")" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "StickMode", + "=", + "\"360°\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "TopDownMovementBehavior::SimulateStick" + }, + "parameters": [ + "Object", + "TopDownMovement", + "Gamepads::StickRotationValue(GamepadIdentifier, \"Left\")", + "sign(Gamepads::StickForce(GamepadIdentifier, \"Left\"))" ] } ] @@ -10589,7 +9604,7 @@ "parameters": [ "", "GamepadIdentifier", - "\"Right\"", + "\"Left\"", "\"Left\"", "" ] @@ -10617,7 +9632,7 @@ "parameters": [ "", "GamepadIdentifier", - "\"Right\"", + "\"Left\"", "\"Right\"", "" ] @@ -10645,7 +9660,7 @@ "parameters": [ "", "GamepadIdentifier", - "\"Right\"", + "\"Left\"", "\"Up\"", "" ] @@ -10673,7 +9688,7 @@ "parameters": [ "", "GamepadIdentifier", - "\"Right\"", + "\"Left\"", "\"Down\"", "" ] @@ -10694,137 +9709,339 @@ ] } ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "Gamepads::TopDownGamepadMapper", - "type": "behavior" - } - ], - "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "", - "type": "Behavior", - "label": "Top-down movement behavior", - "description": "", - "group": "", - "extraInformation": [ - "TopDownMovementBehavior::TopDownMovementBehavior" - ], - "name": "TopDownMovement" - }, - { - "value": "1", - "type": "Number", - "label": "Gamepad identifier (1, 2, 3 or 4)", - "description": "", - "group": "", - "extraInformation": [], - "name": "GamepadIdentifier" - }, - { - "value": "true", - "type": "Boolean", - "label": "Use directional pad", - "description": "", - "group": "Controls", - "extraInformation": [], - "name": "UseArrows" - }, - { - "value": "true", - "type": "Boolean", - "label": "Use left stick", - "description": "", - "group": "Controls", - "extraInformation": [], - "name": "UseLeftStick" - }, - { - "value": "", - "type": "Boolean", - "label": "Use right stick", - "description": "", - "group": "Controls", - "extraInformation": [], - "name": "UseRightStick" - }, - { - "value": "Analog", - "type": "Choice", - "label": "Stick mode", - "description": "", - "group": "Controls", - "extraInformation": [ - "Analog", - "360°", - "8 Directions" - ], - "name": "StickMode" - } - ], - "sharedPropertyDescriptors": [] - } - ], - "eventsBasedObjects": [] - }, - { - "author": "", - "category": "Input", - "extensionNamespace": "", - "fullName": "Multitouch joystick and buttons (sprite)", - "gdevelopVersion": ">=5.5.222", - "helpPath": "/objects/multitouch-joystick", - "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyMy4wLjMsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iSWNvbnMiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB2aWV3Qm94PSIwIDAgMzIgMzIiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDMyIDMyOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8c3R5bGUgdHlwZT0idGV4dC9jc3MiPg0KCS5zdDB7ZmlsbDpub25lO3N0cm9rZTojMDAwMDAwO3N0cm9rZS13aWR0aDoyO3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1saW5lam9pbjpyb3VuZDtzdHJva2UtbWl0ZXJsaW1pdDoxMDt9DQo8L3N0eWxlPg0KPGNpcmNsZSBjbGFzcz0ic3QwIiBjeD0iMTYiIGN5PSIxNiIgcj0iMTMiLz4NCjxwb2x5bGluZSBjbGFzcz0ic3QwIiBwb2ludHM9IjI4LjQsMTIgMjAsMTIgMjAsMy42ICIvPg0KPHBvbHlsaW5lIGNsYXNzPSJzdDAiIHBvaW50cz0iMjAsMjguNCAyMCwyMCAyOC40LDIwICIvPg0KPHBvbHlsaW5lIGNsYXNzPSJzdDAiIHBvaW50cz0iMy42LDIwIDEyLDIwIDEyLDI4LjQgIi8+DQo8cG9seWxpbmUgY2xhc3M9InN0MCIgcG9pbnRzPSIxMiwzLjYgMTIsMTIgMy42LDEyICIvPg0KPHBvbHlnb24gY2xhc3M9InN0MCIgcG9pbnRzPSIxNiw2IDE2LjcsNyAxNS4zLDcgIi8+DQo8cG9seWdvbiBjbGFzcz0ic3QwIiBwb2ludHM9IjE2LDI2IDE1LjMsMjUgMTYuNywyNSAiLz4NCjxwb2x5Z29uIGNsYXNzPSJzdDAiIHBvaW50cz0iNiwxNiA3LDE1LjMgNywxNi43ICIvPg0KPHBvbHlnb24gY2xhc3M9InN0MCIgcG9pbnRzPSIyNiwxNiAyNSwxNi43IDI1LDE1LjMgIi8+DQo8L3N2Zz4NCg==", - "name": "SpriteMultitouchJoystick", - "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/Line Hero Pack/Master/SVG/Videogames/Videogames_controller_joystick_arrows_direction.svg", - "shortDescription": "Joysticks or buttons for touchscreens.", - "version": "1.7.0", - "description": [ - "Multitouch joysticks can be used the same way as physical gamepads:", - "- 4 or 8 directions", - "- Analogus pads", - "- Player selection", - "- Controls mapping for top-down movement and platformer characters", - "", - "There are ready-to-use joysticks in the asset-store [multitouch joysticks pack](https://editor.gdevelop.io/?initial-dialog=asset-store&asset-pack=multitouch-joysticks-multitouch-joysticks)." - ], - "origin": { - "identifier": "SpriteMultitouchJoystick", - "name": "gdevelop-extension-store" - }, - "tags": [ - "multitouch", - "joystick", - "thumbstick", - "controller", - "touchscreen", - "twin stick", - "shooter", - "virtual", - "platformer", - "platform", - "top-down" - ], - "authorIds": [ - "gqDaZjCfevOOxBYkK6zlhtZnXCg1", - "1OgYzWp5UeVPbiWGJwI6vqfgZLC3", - "v0YRpdAnIucZFgiRCCecqVnGKno2", - "IWykYNRvhCZBN3vEgKEbBPOR3Oc2" - ], + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "UseRightStick", + "True", + "" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "StickMode", + "=", + "\"Analog\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "TopDownMovementBehavior::SimulateStick" + }, + "parameters": [ + "Object", + "TopDownMovement", + "Gamepads::StickRotationValue(GamepadIdentifier, \"Right\")", + "Gamepads::StickForce(GamepadIdentifier, \"Right\")" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "StickMode", + "=", + "\"360°\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "TopDownMovementBehavior::SimulateStick" + }, + "parameters": [ + "Object", + "TopDownMovement", + "sign(Gamepads::StickForce(GamepadIdentifier, \"Right\"))", + "1" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "StickMode", + "=", + "\"8 Directions\"" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::C_Axis_pushed" + }, + "parameters": [ + "", + "GamepadIdentifier", + "\"Right\"", + "\"Left\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "TopDownMovementBehavior::SimulateLeftKey" + }, + "parameters": [ + "Object", + "TopDownMovement" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::C_Axis_pushed" + }, + "parameters": [ + "", + "GamepadIdentifier", + "\"Right\"", + "\"Right\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "TopDownMovementBehavior::SimulateRightKey" + }, + "parameters": [ + "Object", + "TopDownMovement" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::C_Axis_pushed" + }, + "parameters": [ + "", + "GamepadIdentifier", + "\"Right\"", + "\"Up\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "TopDownMovementBehavior::SimulateUpKey" + }, + "parameters": [ + "Object", + "TopDownMovement" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::C_Axis_pushed" + }, + "parameters": [ + "", + "GamepadIdentifier", + "\"Right\"", + "\"Down\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "TopDownMovementBehavior::SimulateDownKey" + }, + "parameters": [ + "Object", + "TopDownMovement" + ] + } + ] + } + ] + } + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "Gamepads::TopDownGamepadMapper", + "type": "behavior" + } + ], + "objectGroups": [] + } + ], + "propertyDescriptors": [ + { + "value": "", + "type": "Behavior", + "label": "Top-down movement behavior", + "extraInformation": [ + "TopDownMovementBehavior::TopDownMovementBehavior" + ], + "choices": [], + "name": "TopDownMovement" + }, + { + "value": "1", + "type": "Number", + "label": "Gamepad identifier (1, 2, 3 or 4)", + "name": "GamepadIdentifier" + }, + { + "value": "true", + "type": "Boolean", + "label": "Use directional pad", + "group": "Controls", + "name": "UseArrows" + }, + { + "value": "true", + "type": "Boolean", + "label": "Use left stick", + "group": "Controls", + "name": "UseLeftStick" + }, + { + "value": "", + "type": "Boolean", + "label": "Use right stick", + "group": "Controls", + "name": "UseRightStick" + }, + { + "value": "Analog", + "type": "Choice", + "label": "Stick mode", + "group": "Controls", + "choices": [ + { + "label": "Analog", + "value": "Analog" + }, + { + "label": "360°", + "value": "360°" + }, + { + "label": "8 Directions", + "value": "8 Directions" + } + ], + "name": "StickMode" + } + ], + "sharedPropertyDescriptors": [] + } + ], + "eventsBasedObjects": [] + }, + { + "author": "", + "category": "Input", + "extensionNamespace": "", + "fullName": "Multitouch joystick and buttons (sprite)", + "gdevelopVersion": ">=5.5.222", + "helpPath": "/objects/multitouch-joystick", + "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyMy4wLjMsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iSWNvbnMiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB2aWV3Qm94PSIwIDAgMzIgMzIiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDMyIDMyOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8c3R5bGUgdHlwZT0idGV4dC9jc3MiPg0KCS5zdDB7ZmlsbDpub25lO3N0cm9rZTojMDAwMDAwO3N0cm9rZS13aWR0aDoyO3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1saW5lam9pbjpyb3VuZDtzdHJva2UtbWl0ZXJsaW1pdDoxMDt9DQo8L3N0eWxlPg0KPGNpcmNsZSBjbGFzcz0ic3QwIiBjeD0iMTYiIGN5PSIxNiIgcj0iMTMiLz4NCjxwb2x5bGluZSBjbGFzcz0ic3QwIiBwb2ludHM9IjI4LjQsMTIgMjAsMTIgMjAsMy42ICIvPg0KPHBvbHlsaW5lIGNsYXNzPSJzdDAiIHBvaW50cz0iMjAsMjguNCAyMCwyMCAyOC40LDIwICIvPg0KPHBvbHlsaW5lIGNsYXNzPSJzdDAiIHBvaW50cz0iMy42LDIwIDEyLDIwIDEyLDI4LjQgIi8+DQo8cG9seWxpbmUgY2xhc3M9InN0MCIgcG9pbnRzPSIxMiwzLjYgMTIsMTIgMy42LDEyICIvPg0KPHBvbHlnb24gY2xhc3M9InN0MCIgcG9pbnRzPSIxNiw2IDE2LjcsNyAxNS4zLDcgIi8+DQo8cG9seWdvbiBjbGFzcz0ic3QwIiBwb2ludHM9IjE2LDI2IDE1LjMsMjUgMTYuNywyNSAiLz4NCjxwb2x5Z29uIGNsYXNzPSJzdDAiIHBvaW50cz0iNiwxNiA3LDE1LjMgNywxNi43ICIvPg0KPHBvbHlnb24gY2xhc3M9InN0MCIgcG9pbnRzPSIyNiwxNiAyNSwxNi43IDI1LDE1LjMgIi8+DQo8L3N2Zz4NCg==", + "name": "SpriteMultitouchJoystick", + "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/Line Hero Pack/Master/SVG/Videogames/Videogames_controller_joystick_arrows_direction.svg", + "shortDescription": "Joysticks or buttons for touchscreens.", + "version": "1.9.0", + "description": [ + "Multitouch joysticks are objects showing a joystick on the screen, useful for mobile. They work like a physical gamepad:", + "- 4 or 8 directions", + "- Analogus pads", + "- Player selection", + "- Automatic \"mapper\" behaviors for 2D and 3D movement behaviors (platformer characters, top-down movement, 3D character etc...). Add one of these to the object with the movement behavior (i.e: the player most of the time) and the behavior will then be controlled automatically by the virtual joystick (it works by reading the multitouch joystick state and simulating controls). No need for additional events to make it work once the behaviors are set up.", + "", + "There are ready-to-use joysticks in the asset-store [multitouch joysticks pack](https://editor.gdevelop.io/?initial-dialog=asset-store&asset-pack=multitouch-joysticks-multitouch-joysticks)." + ], + "origin": { + "identifier": "SpriteMultitouchJoystick", + "name": "gdevelop-extension-store" + }, + "tags": [ + "multitouch", + "joystick", + "thumbstick", + "controller", + "touchscreen", + "twin stick", + "shooter", + "virtual", + "platformer", + "platform", + "top-down" + ], + "authorIds": [ + "gqDaZjCfevOOxBYkK6zlhtZnXCg1", + "1OgYzWp5UeVPbiWGJwI6vqfgZLC3", + "v0YRpdAnIucZFgiRCCecqVnGKno2", + "IWykYNRvhCZBN3vEgKEbBPOR3Oc2" + ], "dependencies": [], "globalVariables": [], "sceneVariables": [ @@ -10862,6 +10079,28 @@ } ], "eventsFunctions": [ + { + "description": "Check if the events are running for the editor.", + "fullName": "Editor is running", + "functionType": "Condition", + "name": "IsInGameEdition", + "private": true, + "sentence": "Events are running for the editor", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const game = runtimeScene.getGame();\r", + "eventsFunctionContext.returnValue = game.isInGameEdition && game.isInGameEdition();" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [], + "objectGroups": [] + }, { "fullName": "Accelerated speed", "functionType": "Expression", @@ -11280,11 +10519,11 @@ "objectGroups": [] }, { - "description": "Check if a button is pressed on a gamepad.", - "fullName": "Multitouch controller button pressed", + "description": "Check if a button was just pressed on a multitouch controller.", + "fullName": "Multitouch controller button just pressed", "functionType": "Condition", - "name": "IsButtonPressed", - "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", + "name": "IsButtonJustPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ was just pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -11296,7 +10535,7 @@ "parameters": [ "Controllers[ControllerIdentifier].Buttons[Button].State", "=", - "\"Pressed\"" + "\"JustPressed\"" ] } ], @@ -11328,7 +10567,73 @@ "objectGroups": [] }, { - "description": "Check if a button is released on a gamepad.", + "description": "Check if a button is pressed on a multitouch controller.", + "fullName": "Multitouch controller button pressed", + "functionType": "Condition", + "name": "IsButtonPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::Or" + }, + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"Pressed\"" + ] + }, + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"JustPressed\"" + ] + } + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier", + "type": "expression" + }, + { + "description": "Button name", + "name": "Button", + "supplementaryInformation": "[\"A\",\"CROSS\",\"B\",\"CIRCLE\",\"X\",\"SQUARE\",\"Y\",\"TRIANGLE\",\"LB\",\"L1\",\"RB\",\"R1\",\"LT\",\"L2\",\"RT\",\"R2\",\"UP\",\"DOWN\",\"LEFT\",\"RIGHT\",\"BACK\",\"SHARE\",\"START\",\"OPTIONS\",\"CLICK_STICK_LEFT\",\"CLICK_STICK_RIGHT\",\"PS_BUTTON\",\"CLICK_TOUCHPAD\"]", + "type": "string" + } + ], + "objectGroups": [] + }, + { + "description": "Check if a button is released on a multitouch controller.", "fullName": "Multitouch controller button released", "functionType": "Condition", "name": "IsButtonReleased", @@ -11414,7 +10719,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"JustPressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -12787,145 +12092,26 @@ "conditions": [ { "type": { - "value": "HasGameJustResumed" + "inverted": true, + "value": "SpriteMultitouchJoystick::IsInGameEdition" }, "parameters": [ + "", "" ] } ], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - } - ] - }, - { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Manage touches", - "source": "", - "type": "BuiltinCommonInstructions::Group", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "HasAnyTouchOrMouseStarted" - }, - "parameters": [ - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchIndex", - "=", - "0" - ] - } - ], - "events": [ - { - "type": "BuiltinCommonInstructions::Repeat", - "repeatExpression": "StartedTouchOrMouseCount()", - "conditions": [], - "actions": [], - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "NumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "0" - ] - }, - { - "type": { - "value": "CollisionPoint" - }, - "parameters": [ - "Object", - "TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)", - "TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "StartedTouchOrMouseId(TouchIndex)" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchIndex", - "+", - "1" - ] - } - ] - } - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 - }, - "comment": "Move thumb back to center when not being pressed (acts like a spring on a real controller)" - }, + "actions": [], + "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "value": "HasTouchEnded" + "value": "HasGameJustResumed" }, "parameters": [ - "", - "TouchId" + "" ] } ], @@ -12941,61 +12127,198 @@ ] } ] - } - ], - "parameters": [] - }, - { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Update joystick position", - "source": "", - "type": "BuiltinCommonInstructions::Group", - "events": [ + }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Manage touches", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ { - "type": { - "value": "NumberVariable" - }, - "parameters": [ - "TouchId", - "!=", - "0" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "HasAnyTouchOrMouseStarted" + }, + "parameters": [ + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchIndex", + "=", + "0" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "StartedTouchOrMouseCount()", + "conditions": [], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "0" + ] + }, + { + "type": { + "value": "CollisionPoint" + }, + "parameters": [ + "Object", + "TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)", + "TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "StartedTouchOrMouseId(TouchIndex)" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchIndex", + "+", + "1" + ] + } + ] + } + ] + } ] - } - ], - "actions": [ + }, { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickAngle" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 }, - "parameters": [ - "Object", - "Behavior", - "AngleBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0))", - "AngleBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0))" - ] + "comment": "Move thumb back to center when not being pressed (acts like a spring on a real controller)" }, { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "clamp(2 * DistanceBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0)) / Object.Width(), 0, 1)", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "HasTouchEnded" + }, + "parameters": [ + "", + "TouchId" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } ] } - ] + ], + "parameters": [] + }, + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Update joystick position", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "!=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickAngle" + }, + "parameters": [ + "Object", + "Behavior", + "AngleBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0))", + "AngleBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0))" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "clamp(2 * DistanceBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0)) / Object.Width(), 0, 1)", + "" + ] + } + ] + } + ], + "parameters": [] } - ], - "parameters": [] + ] } ], "parameters": [ @@ -13823,18 +13146,12 @@ "value": "1", "type": "Number", "label": "Multitouch controller identifier (1, 2, 3, 4...)", - "description": "", - "group": "", - "extraInformation": [], "name": "ControllerIdentifier" }, { "value": "Primary", "type": "String", "label": "Joystick name", - "description": "", - "group": "", - "extraInformation": [], "name": "JoystickIdentifier" }, { @@ -13842,17 +13159,12 @@ "type": "Number", "label": "Dead zone radius (range: 0 to 1)", "description": "The deadzone is an area for which movement on sticks won't be taken into account (instead, the stick will be considered as not moved)", - "group": "", - "extraInformation": [], "name": "DeadZoneRadius" }, { "value": "0", "type": "Number", "label": "Joystick angle (range: -180 to 180)", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "JoystickAngle" }, @@ -13860,9 +13172,6 @@ "value": "0", "type": "Number", "label": "Joystick force (range: 0 to 1)", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "JoystickForce" }, @@ -13870,9 +13179,6 @@ "value": "0", "type": "Number", "label": "", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "TouchId" }, @@ -13880,9 +13186,6 @@ "value": "", "type": "Number", "label": "", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "TouchIndex" } @@ -13890,7 +13193,7 @@ "sharedPropertyDescriptors": [] }, { - "description": "Detect button presses made on a touchscreen.", + "description": "Detect presses made on a touchscreen on the object so it acts like a button and automatically trigger the button having the same identifier for the mapper behaviors.", "fullName": "Multitouch button", "name": "MultitouchButton", "objectType": "", @@ -13906,11 +13209,11 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::IsReleased" + "value": "BooleanVariable" }, "parameters": [ - "Object", - "Behavior", + "IsReleased", + "True", "" ] } @@ -13939,6 +13242,44 @@ } ] }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "False", + "" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + }, + "parameters": [ + "Object", + "Behavior", + "\"Pressed\"", + "" + ] + } + ] + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ @@ -14002,11 +13343,10 @@ }, { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::PropertyRadius" + "value": "NumberVariable" }, "parameters": [ - "Object", - "Behavior", + "Radius", ">", "DistanceBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer()), TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer()))" ] @@ -14032,7 +13372,17 @@ "parameters": [ "Object", "Behavior", - "\"Pressed\"", + "\"JustPressed\"", + "" + ] + }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "True", "" ] } @@ -14103,6 +13453,16 @@ "" ] }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "False", + "" + ] + }, { "type": { "value": "SetNumberVariable" @@ -14132,11 +13492,11 @@ "objectGroups": [] }, { - "description": "Check if button is released.", - "fullName": "Button released", + "description": "Check if the button was just pressed.", + "fullName": "Button just pressed", "functionType": "Condition", - "name": "IsReleased", - "sentence": "Button _PARAM0_ is released", + "name": "IsJustPressed", + "sentence": "Button _PARAM0_ was just pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -14146,7 +13506,7 @@ "value": "BooleanVariable" }, "parameters": [ - "IsReleased", + "IsJustPressed", "True", "" ] @@ -14180,23 +13540,71 @@ "objectGroups": [] }, { - "description": "Check if button is pressed.", - "fullName": "Button pressed", + "description": "Check if the button is pressed.", + "fullName": "Button pressed", + "functionType": "Condition", + "name": "IsPressed", + "sentence": "Button _PARAM0_ is pressed", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "!=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Check if the button is released.", + "fullName": "Button released", "functionType": "Condition", - "name": "IsPressed", - "sentence": "Button _PARAM0_ is pressed", + "name": "IsReleased", + "sentence": "Button _PARAM0_ is released", "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "value": "NumberVariable" + "value": "BooleanVariable" }, "parameters": [ - "TouchId", - "!=", - "0" + "IsReleased", + "True", + "" ] } ], @@ -14268,7 +13676,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"JustPressed\",\"Pressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -14280,27 +13688,18 @@ "value": "1", "type": "Number", "label": "Multitouch controller identifier (1, 2, 3, 4...)", - "description": "", - "group": "", - "extraInformation": [], "name": "ControllerIdentifier" }, { "value": "A", "type": "String", "label": "Button identifier", - "description": "", - "group": "", - "extraInformation": [], "name": "ButtonIdentifier" }, { "value": "0", "type": "Number", "label": "TouchID", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "TouchId" }, @@ -14308,9 +13707,6 @@ "value": "", "type": "Number", "label": "", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "TouchIndex" }, @@ -14318,20 +13714,22 @@ "value": "", "type": "Boolean", "label": "Button released", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "IsReleased" }, + { + "value": "", + "type": "Boolean", + "label": "Button just pressed", + "hidden": true, + "name": "IsJustPressed" + }, { "value": "0", "type": "Number", "unit": "Pixel", "label": "Triggering circle radius", "description": "This circle adds up to the object collision mask.", - "group": "", - "extraInformation": [], "name": "Radius" } ], @@ -14342,6 +13740,7 @@ "fullName": "Platformer multitouch controller mapper", "name": "PlatformerMultitouchMapper", "objectType": "", + "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -14519,31 +13918,32 @@ "value": "", "type": "Behavior", "label": "Platform character behavior", - "description": "", - "group": "", "extraInformation": [ "PlatformBehavior::PlatformerObjectBehavior" ], + "choices": [], "name": "Property" }, { "value": "1", "type": "Number", "label": "Controller identifier (1, 2, 3, 4...)", - "description": "", - "group": "", - "extraInformation": [], "name": "ControllerIdentifier" }, { "value": "Primary", "type": "Choice", "label": "Joystick name", - "description": "", "group": "Controls", - "extraInformation": [ - "Primary", - "Secondary" + "choices": [ + { + "label": "Primary", + "value": "Primary" + }, + { + "label": "Secondary", + "value": "Secondary" + } ], "name": "JoystickIdentifier" }, @@ -14551,9 +13951,7 @@ "value": "A", "type": "String", "label": "Jump button name", - "description": "", "group": "Controls", - "extraInformation": [], "name": "JumpButton" } ], @@ -14564,6 +13962,7 @@ "fullName": "3D platformer multitouch controller mapper", "name": "Platformer3DMultitouchMapper", "objectType": "", + "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -14662,31 +14061,32 @@ "value": "", "type": "Behavior", "label": "3D physics character", - "description": "", - "group": "", "extraInformation": [ "Physics3D::PhysicsCharacter3D" ], + "choices": [], "name": "PhysicsCharacter3D" }, { "value": "1", "type": "Number", "label": "Controller identifier (1, 2, 3, 4...)", - "description": "", - "group": "", - "extraInformation": [], "name": "ControllerIdentifier" }, { "value": "Primary", "type": "Choice", "label": "Walk joystick", - "description": "", "group": "Controls", - "extraInformation": [ - "Primary", - "Secondary" + "choices": [ + { + "label": "Primary", + "value": "Primary" + }, + { + "label": "Secondary", + "value": "Secondary" + } ], "name": "JoystickIdentifier" }, @@ -14694,9 +14094,7 @@ "value": "A", "type": "String", "label": "Jump button name", - "description": "", "group": "Controls", - "extraInformation": [], "name": "JumpButton" } ], @@ -14707,6 +14105,7 @@ "fullName": "3D shooter multitouch controller mapper", "name": "Shooter3DMultitouchMapper", "objectType": "", + "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -14794,31 +14193,32 @@ "value": "", "type": "Behavior", "label": "3D physics character", - "description": "", - "group": "", "extraInformation": [ "Physics3D::PhysicsCharacter3D" ], + "choices": [], "name": "PhysicsCharacter3D" }, { "value": "1", "type": "Number", "label": "Controller identifier (1, 2, 3, 4...)", - "description": "", - "group": "", - "extraInformation": [], "name": "ControllerIdentifier" }, { "value": "Primary", "type": "Choice", "label": "Walk joystick", - "description": "", "group": "Controls", - "extraInformation": [ - "Primary", - "Secondary" + "choices": [ + { + "label": "Primary", + "value": "Primary" + }, + { + "label": "Secondary", + "value": "Secondary" + } ], "name": "JoystickIdentifier" }, @@ -14826,9 +14226,7 @@ "value": "A", "type": "String", "label": "Jump button name", - "description": "", "group": "Controls", - "extraInformation": [], "name": "JumpButton" } ], @@ -14839,6 +14237,7 @@ "fullName": "First person camera multitouch controller mapper", "name": "FirstPersonMultitouchMapper", "objectType": "", + "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -15723,16 +15122,254 @@ "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "OffsetZ", + "=", + "Value" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "type": "behavior" + } + ], + "objectGroups": [] + } + ], + "propertyDescriptors": [ + { + "value": "", + "type": "Behavior", + "label": "3D capability", + "extraInformation": [ + "Scene3D::Base3DBehavior" + ], + "choices": [], + "name": "Object3D" + }, + { + "value": "1", + "type": "Number", + "label": "Controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier" + }, + { + "value": "Secondary", + "type": "Choice", + "label": "Camera joystick", + "group": "Controls", + "choices": [ + { + "label": "Primary", + "value": "Primary" + }, + { + "label": "Secondary", + "value": "Secondary" + } + ], + "name": "CameraStick" + }, + { + "value": "180", + "type": "Number", + "unit": "AngularSpeed", + "label": "Maximum rotation speed", + "group": "Horizontal rotation", + "name": "HorizontalRotationSpeedMax" + }, + { + "value": "360", + "type": "Number", + "label": "Rotation acceleration", + "group": "Horizontal rotation", + "name": "HorizontalRotationAcceleration" + }, + { + "value": "720", + "type": "Number", + "label": "Rotation deceleration", + "group": "Horizontal rotation", + "name": "HorizontalRotationDeceleration" + }, + { + "value": "120", + "type": "Number", + "unit": "AngularSpeed", + "label": "Maximum rotation speed", + "group": "Vertical rotation", + "name": "VerticalRotationSpeedMax" + }, + { + "value": "240", + "type": "Number", + "label": "Rotation acceleration", + "group": "Vertical rotation", + "name": "VerticalRotationAcceleration" + }, + { + "value": "480", + "type": "Number", + "label": "Rotation deceleration", + "group": "Vertical rotation", + "name": "VerticalRotationDeceleration" + }, + { + "value": "-90", + "type": "Number", + "unit": "DegreeAngle", + "label": "Minimum angle", + "group": "Vertical rotation", + "name": "VerticalAngleMin" + }, + { + "value": "90", + "type": "Number", + "unit": "DegreeAngle", + "label": "Maximum angle", + "group": "Vertical rotation", + "name": "VerticalAngleMax" + }, + { + "value": "0", + "type": "Number", + "unit": "Pixel", + "label": "Z position offset", + "group": "Position", + "name": "OffsetZ" + }, + { + "value": "0", + "type": "Number", + "unit": "AngularSpeed", + "label": "Current rotation speed Z", + "hidden": true, + "name": "CurrentRotationSpeedZ" + }, + { + "value": "0", + "type": "Number", + "unit": "AngularSpeed", + "label": "Current rotation speed Y", + "hidden": true, + "name": "CurrentRotationSpeedY" + } + ], + "sharedPropertyDescriptors": [] + }, + { + "description": "Control a 3D physics car with a multitouch controller.", + "fullName": "3D car multitouch controller mapper", + "name": "PhysicsCar3DMultitouchMapper", + "objectType": "", + "quickCustomizationVisibility": "hidden", + "eventsFunctions": [ + { + "fullName": "", + "functionType": "Action", + "name": "doStepPreEvents", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::StickForce" + }, + "parameters": [ + "", + ">", + "0", + "ControllerIdentifier", + "SteerJoystickIdentifier", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "Physics3D::PhysicsCar3D::SimulateSteeringStick" + }, + "parameters": [ + "Object", + "PhysicsCar3D", + "SpriteMultitouchJoystick::StickForceX(ControllerIdentifier, \"Primary\")" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::StickForce" + }, + "parameters": [ + "", + ">", + "0", + "ControllerIdentifier", + "SpeedJoystickIdentifier", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "Physics3D::PhysicsCar3D::SimulateAcceleratorStick" + }, + "parameters": [ + "Object", + "PhysicsCar3D", + "-SpriteMultitouchJoystick::StickForceY(ControllerIdentifier, \"Secondary\")" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::IsButtonPressed" + }, + "parameters": [ + "", + "ControllerIdentifier", + "HandBrakeButton", + "\"Down\"" + ] + } + ], "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "Physics3D::PhysicsCar3D::SimulateHandBrakeKey" }, "parameters": [ - "OffsetZ", - "=", - "Value" + "Object", + "PhysicsCar3D" ] } ] @@ -15747,7 +15384,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::PhysicsCar3DMultitouchMapper", "type": "behavior" } ], @@ -15758,142 +15395,59 @@ { "value": "", "type": "Behavior", - "label": "3D capability", - "description": "", - "group": "", + "label": "3D physics car", "extraInformation": [ - "Scene3D::Base3DBehavior" + "Physics3D::PhysicsCar3D" ], - "name": "Object3D" + "choices": [], + "name": "PhysicsCar3D" }, { "value": "1", "type": "Number", "label": "Controller identifier (1, 2, 3, 4...)", - "description": "", - "group": "", - "extraInformation": [], "name": "ControllerIdentifier" }, { - "value": "Secondary", + "value": "Primary", "type": "Choice", - "label": "Camera joystick", - "description": "", + "label": "Steer joystick", "group": "Controls", - "extraInformation": [ - "Primary", - "Secondary" + "choices": [ + { + "label": "Primary", + "value": "Primary" + }, + { + "label": "Secondary", + "value": "Secondary" + } ], - "name": "CameraStick" - }, - { - "value": "180", - "type": "Number", - "unit": "AngularSpeed", - "label": "Maximum rotation speed", - "description": "", - "group": "Horizontal rotation", - "extraInformation": [], - "name": "HorizontalRotationSpeedMax" - }, - { - "value": "360", - "type": "Number", - "label": "Rotation acceleration", - "description": "", - "group": "Horizontal rotation", - "extraInformation": [], - "name": "HorizontalRotationAcceleration" - }, - { - "value": "720", - "type": "Number", - "label": "Rotation deceleration", - "description": "", - "group": "Horizontal rotation", - "extraInformation": [], - "name": "HorizontalRotationDeceleration" - }, - { - "value": "120", - "type": "Number", - "unit": "AngularSpeed", - "label": "Maximum rotation speed", - "description": "", - "group": "Vertical rotation", - "extraInformation": [], - "name": "VerticalRotationSpeedMax" - }, - { - "value": "240", - "type": "Number", - "label": "Rotation acceleration", - "description": "", - "group": "Vertical rotation", - "extraInformation": [], - "name": "VerticalRotationAcceleration" - }, - { - "value": "480", - "type": "Number", - "label": "Rotation deceleration", - "description": "", - "group": "Vertical rotation", - "extraInformation": [], - "name": "VerticalRotationDeceleration" - }, - { - "value": "-90", - "type": "Number", - "unit": "DegreeAngle", - "label": "Minimum angle", - "description": "", - "group": "Vertical rotation", - "extraInformation": [], - "name": "VerticalAngleMin" - }, - { - "value": "90", - "type": "Number", - "unit": "DegreeAngle", - "label": "Maximum angle", - "description": "", - "group": "Vertical rotation", - "extraInformation": [], - "name": "VerticalAngleMax" - }, - { - "value": "0", - "type": "Number", - "unit": "Pixel", - "label": "Z position offset", - "description": "", - "group": "Position", - "extraInformation": [], - "name": "OffsetZ" + "name": "SteerJoystickIdentifier" }, { - "value": "0", - "type": "Number", - "unit": "AngularSpeed", - "label": "Current rotation speed Z", - "description": "", - "group": "", - "extraInformation": [], - "hidden": true, - "name": "CurrentRotationSpeedZ" + "value": "Secondary", + "type": "Choice", + "label": "Speed joystick", + "group": "Controls", + "choices": [ + { + "label": "Primary", + "value": "Primary" + }, + { + "label": "Secondary", + "value": "Secondary" + } + ], + "name": "SpeedJoystickIdentifier" }, { - "value": "0", - "type": "Number", - "unit": "AngularSpeed", - "label": "Current rotation speed Y", - "description": "", - "group": "", - "extraInformation": [], - "hidden": true, - "name": "CurrentRotationSpeedY" + "value": "B", + "type": "String", + "label": "Hand brake button name", + "group": "Controls", + "name": "HandBrakeButton" } ], "sharedPropertyDescriptors": [] @@ -15903,6 +15457,7 @@ "fullName": "Top-down multitouch controller mapper", "name": "TopDownMultitouchMapper", "objectType": "", + "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -16413,31 +15968,31 @@ "value": "", "type": "Behavior", "label": "Top-down movement behavior", - "description": "", - "group": "", "extraInformation": [ "TopDownMovementBehavior::TopDownMovementBehavior" ], + "choices": [], "name": "TopDownMovement" }, { "value": "1", "type": "Number", "label": "Controller identifier (1, 2, 3, 4...)", - "description": "", - "group": "", - "extraInformation": [], "name": "ControllerIdentifier" }, { "value": "Primary", "type": "Choice", "label": "Joystick name", - "description": "", - "group": "", - "extraInformation": [ - "Primary", - "Secondary" + "choices": [ + { + "label": "Primary", + "value": "Primary" + }, + { + "label": "Secondary", + "value": "Secondary" + } ], "name": "JoystickIdentifier" }, @@ -16445,12 +16000,20 @@ "value": "Analog", "type": "Choice", "label": "Stick mode", - "description": "", "group": "Controls", - "extraInformation": [ - "Analog", - "360°", - "8 Directions" + "choices": [ + { + "label": "Analog", + "value": "Analog" + }, + { + "label": "360°", + "value": "360°" + }, + { + "label": "8 Directions", + "value": "8 Directions" + } ], "name": "StickMode" } @@ -16471,6 +16034,110 @@ "fullName": "Multitouch Joystick", "isUsingLegacyInstancesRenderer": true, "name": "SpriteMultitouchJoystick", + "objects": [ + { + "adaptCollisionMaskAutomatically": false, + "assetStoreId": "", + "name": "Thumb", + "type": "Sprite", + "updateIfNotVisible": false, + "variables": [], + "effects": [], + "behaviors": [], + "animations": [ + { + "name": "Idle", + "useMultipleDirections": false, + "directions": [ + { + "looping": false, + "timeBetweenFrames": 0.08, + "sprites": [] + } + ] + } + ] + }, + { + "adaptCollisionMaskAutomatically": false, + "assetStoreId": "", + "name": "Border", + "type": "Sprite", + "updateIfNotVisible": false, + "variables": [], + "effects": [], + "behaviors": [ + { + "name": "MultitouchJoystick", + "type": "SpriteMultitouchJoystick::MultitouchJoystick", + "ControllerIdentifier": 1, + "JoystickIdentifier": "Primary", + "FloatingEnabled": false, + "DeadZoneRadius": 0.4, + "JoystickAngle": 0, + "JoystickForce": 0, + "TouchId": 0, + "TouchIndex": 0 + } + ], + "animations": [ + { + "name": "Idle", + "useMultipleDirections": false, + "directions": [ + { + "looping": false, + "timeBetweenFrames": 0.08, + "sprites": [] + } + ] + } + ] + } + ], + "objectsFolderStructure": { + "folderName": "__ROOT", + "children": [ + { + "objectName": "Thumb" + }, + { + "objectName": "Border" + } + ] + }, + "objectsGroups": [], + "layers": [ + { + "ambientLightColorB": 200, + "ambientLightColorG": 200, + "ambientLightColorR": 200, + "camera3DFarPlaneDistance": 10000, + "camera3DFieldOfView": 45, + "camera3DNearPlaneDistance": 3, + "cameraType": "", + "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": [] + } + ], + "instances": [], "eventsFunctions": [ { "fullName": "", @@ -16587,64 +16254,92 @@ "name": "doStepPostEvents", "sentence": "", "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "MettreAutour" - }, - "parameters": [ - "Thumb", - "Border", - "Border.MultitouchJoystick::JoystickForce() * Border.Width() / 2", - "Border.MultitouchJoystick::JoystickAngle()" - ] - } - ] - }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ - { - "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "ShouldBeHiddenWhenReleased", - "True", - "" - ] - }, { "type": { "inverted": true, - "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::IsPressed" + "value": "SpriteMultitouchJoystick::IsInGameEdition" }, "parameters": [ - "Object", + "", "" ] } ], - "actions": [ + "actions": [], + "events": [ { - "type": { - "value": "Cache" - }, - "parameters": [ - "Object" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "MettreAutour" + }, + "parameters": [ + "Thumb", + "Border", + "Border.MultitouchJoystick::JoystickForce() * Border.Width() / 2", + "Border.MultitouchJoystick::JoystickAngle()" + ] + } ] }, { - "type": { - "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::ActivateControl" - }, - "parameters": [ - "Object", - "no", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "ShouldBeHiddenWhenReleased", + "True", + "" + ] + }, + { + "type": { + "inverted": true, + "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::IsPressed" + }, + "parameters": [ + "Object", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "Cache" + }, + "parameters": [ + "Object" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::ActivateControl" + }, + "parameters": [ + "Object", + "no", + "" + ] + }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "ShouldBeHiddenWhenReleased", + "False", + "" + ] + } ] } ] @@ -16810,7 +16505,7 @@ }, "parameters": [ "ShouldBeHiddenWhenReleased", - "False", + "True", "" ] }, @@ -17564,206 +17259,95 @@ } ], "parameters": [ - { - "description": "Object", - "name": "Object", - "supplementaryInformation": "SpriteMultitouchJoystick::SpriteMultitouchJoystick", - "type": "object" - } - ], - "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "1", - "type": "Number", - "label": "Multitouch controller identifier (1, 2, 3, 4...)", - "description": "", - "group": "", - "extraInformation": [], - "name": "ControllerIdentifier" - }, - { - "value": "Primary", - "type": "Choice", - "label": "Joystick name", - "description": "", - "group": "", - "extraInformation": [ - "Primary", - "Secondary" - ], - "name": "JoystickIdentifier" - }, - { - "value": "0.4", - "type": "Number", - "label": "Dead zone radius (range: 0 to 1)", - "description": "The deadzone is an area for which movement on sticks won't be taken into account (instead, the stick will be considered as not moved)", - "group": "", - "extraInformation": [], - "name": "DeadZoneRadius" - }, - { - "value": "Center-center", - "type": "String", - "label": "", - "description": "Only used by the scene editor.", - "group": "", - "extraInformation": [ - "Thumb" - ], - "hidden": true, - "name": "ThumbAnchorOrigin" - }, - { - "value": "Center-center", - "type": "Number", - "label": "", - "description": "Only used by the scene editor.", - "group": "", - "extraInformation": [], - "hidden": true, - "name": "ThumbAnchorTarget" - }, - { - "value": "true", - "type": "Boolean", - "label": "", - "description": "Only used by the scene editor.", - "group": "", - "extraInformation": [ - "Thumb" - ], - "hidden": true, - "name": "ThumbIsScaledProportionally" - }, - { - "value": "Center-center", - "type": "String", - "label": "", - "description": "Only used by the scene editor.", - "group": "", - "extraInformation": [], - "hidden": true, - "name": "ParentOrigin" - }, - { - "value": "", - "type": "Boolean", - "label": "", - "description": "", - "group": "", - "extraInformation": [], - "hidden": true, - "name": "ShouldBeHiddenWhenReleased" - } - ], - "objects": [ - { - "adaptCollisionMaskAutomatically": false, - "assetStoreId": "", - "name": "Thumb", - "type": "Sprite", - "updateIfNotVisible": false, - "variables": [], - "effects": [], - "behaviors": [], - "animations": [ - { - "name": "Idle", - "useMultipleDirections": false, - "directions": [ - { - "looping": false, - "timeBetweenFrames": 0.08, - "sprites": [] - } - ] - } - ] - }, - { - "adaptCollisionMaskAutomatically": false, - "assetStoreId": "", - "name": "Border", - "type": "Sprite", - "updateIfNotVisible": false, - "variables": [], - "effects": [], - "behaviors": [ - { - "name": "MultitouchJoystick", - "type": "SpriteMultitouchJoystick::MultitouchJoystick", - "ControllerIdentifier": 1, - "JoystickIdentifier": "Primary", - "FloatingEnabled": false, - "DeadZoneRadius": 0.4, - "JoystickAngle": 0, - "JoystickForce": 0, - "TouchId": 0, - "TouchIndex": 0 - } - ], - "animations": [ - { - "name": "Idle", - "useMultipleDirections": false, - "directions": [ - { - "looping": false, - "timeBetweenFrames": 0.08, - "sprites": [] - } - ] - } - ] - } - ], - "objectsFolderStructure": { - "folderName": "__ROOT", - "children": [ - { - "objectName": "Thumb" - }, - { - "objectName": "Border" - } - ] - }, - "objectsGroups": [], - "layers": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "SpriteMultitouchJoystick::SpriteMultitouchJoystick", + "type": "object" + } + ], + "objectGroups": [] + } + ], + "propertyDescriptors": [ { - "ambientLightColorB": 200, - "ambientLightColorG": 200, - "ambientLightColorR": 200, - "camera3DFarPlaneDistance": 10000, - "camera3DFieldOfView": 45, - "camera3DNearPlaneDistance": 3, - "cameraType": "", - "followBaseLayerCamera": false, - "isLightingLayer": false, - "isLocked": false, - "name": "", - "renderingType": "", - "visibility": true, - "cameras": [ + "value": "1", + "type": "Number", + "label": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier" + }, + { + "value": "Primary", + "type": "Choice", + "label": "Joystick name", + "choices": [ { - "defaultSize": true, - "defaultViewport": true, - "height": 0, - "viewportBottom": 1, - "viewportLeft": 0, - "viewportRight": 1, - "viewportTop": 0, - "width": 0 + "label": "Primary", + "value": "Primary" + }, + { + "label": "Secondary", + "value": "Secondary" } ], - "effects": [] + "name": "JoystickIdentifier" + }, + { + "value": "0.4", + "type": "Number", + "label": "Dead zone radius (range: 0 to 1)", + "description": "The deadzone is an area for which movement on sticks won't be taken into account (instead, the stick will be considered as not moved)", + "name": "DeadZoneRadius" + }, + { + "value": "Center-center", + "type": "String", + "label": "", + "description": "Only used by the scene editor.", + "extraInformation": [ + "Thumb" + ], + "choices": [], + "hidden": true, + "name": "ThumbAnchorOrigin" + }, + { + "value": "Center-center", + "type": "Number", + "label": "", + "description": "Only used by the scene editor.", + "hidden": true, + "name": "ThumbAnchorTarget" + }, + { + "value": "true", + "type": "Boolean", + "label": "", + "description": "Only used by the scene editor.", + "extraInformation": [ + "Thumb" + ], + "choices": [], + "hidden": true, + "name": "ThumbIsScaledProportionally" + }, + { + "value": "Center-center", + "type": "String", + "label": "", + "description": "Only used by the scene editor.", + "hidden": true, + "name": "ParentOrigin" + }, + { + "value": "", + "type": "Boolean", + "label": "", + "hidden": true, + "name": "ShouldBeHiddenWhenReleased" } ], - "instances": [] + "variants": [] } ] }, @@ -21060,20 +20644,14 @@ "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0ibWRpLWZpcmUiIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNMTcuNjYgMTEuMkMxNy40MyAxMC45IDE3LjE1IDEwLjY0IDE2Ljg5IDEwLjM4QzE2LjIyIDkuNzggMTUuNDYgOS4zNSAxNC44MiA4LjcyQzEzLjMzIDcuMjYgMTMgNC44NSAxMy45NSAzQzEzIDMuMjMgMTIuMTcgMy43NSAxMS40NiA0LjMyQzguODcgNi40IDcuODUgMTAuMDcgOS4wNyAxMy4yMkM5LjExIDEzLjMyIDkuMTUgMTMuNDIgOS4xNSAxMy41NUM5LjE1IDEzLjc3IDkgMTMuOTcgOC44IDE0LjA1QzguNTcgMTQuMTUgOC4zMyAxNC4wOSA4LjE0IDEzLjkzQzguMDggMTMuODggOC4wNCAxMy44MyA4IDEzLjc2QzYuODcgMTIuMzMgNi42OSAxMC4yOCA3LjQ1IDguNjRDNS43OCAxMCA0Ljg3IDEyLjMgNSAxNC40N0M1LjA2IDE0Ljk3IDUuMTIgMTUuNDcgNS4yOSAxNS45N0M1LjQzIDE2LjU3IDUuNyAxNy4xNyA2IDE3LjdDNy4wOCAxOS40MyA4Ljk1IDIwLjY3IDEwLjk2IDIwLjkyQzEzLjEgMjEuMTkgMTUuMzkgMjAuOCAxNy4wMyAxOS4zMkMxOC44NiAxNy42NiAxOS41IDE1IDE4LjU2IDEyLjcyTDE4LjQzIDEyLjQ2QzE4LjIyIDEyIDE3LjY2IDExLjIgMTcuNjYgMTEuMk0xNC41IDE3LjVDMTQuMjIgMTcuNzQgMTMuNzYgMTggMTMuNCAxOC4xQzEyLjI4IDE4LjUgMTEuMTYgMTcuOTQgMTAuNSAxNy4yOEMxMS42OSAxNyAxMi40IDE2LjEyIDEyLjYxIDE1LjIzQzEyLjc4IDE0LjQzIDEyLjQ2IDEzLjc3IDEyLjMzIDEzQzEyLjIxIDEyLjI2IDEyLjIzIDExLjYzIDEyLjUgMTAuOTRDMTIuNjkgMTEuMzIgMTIuODkgMTEuNyAxMy4xMyAxMkMxMy45IDEzIDE1LjExIDEzLjQ0IDE1LjM3IDE0LjhDMTUuNDEgMTQuOTQgMTUuNDMgMTUuMDggMTUuNDMgMTUuMjNDMTUuNDYgMTYuMDUgMTUuMSAxNi45NSAxNC41IDE3LjVIMTQuNVoiIC8+PC9zdmc+", "name": "ParticleEmitter3D", "previewIconUrl": "https://asset-resources.gdevelop.io/public-resources/Icons/f2e5a34bf465f781866677762d385d6c8e9e8d203383f2df9a3b7e0fad6a2cb5_fire.svg", - "shortDescription": "Display a large number of particles to create visual effects.", - "version": "2.1.0", + "shortDescription": "Display a large number of particles in 3D to create visual effects in a 3D game.", + "version": "3.0.1", "description": [ - "Particle emitters can be used to display:", - "- Fire", - "- Smoke", - "- Splashes", - "- Lights", + "3D particle emitters let you create and display many small particles to simulate visual effects in your game — like fire, explosions, smoke, or dust.", "", - "Breaking change", - "- 2.0.0", - " - Object properties for position and rotation have been removed. They must be set with the instance editor or the action.", - "- 1.0.0", - " - Particles were 3 times too small" + "The parameters of the object can be configured in multiple different ways to create a specific desired effect. GDevelop will give a set of a pre-configured 3D particle emitters that you should try first.", + "", + "Use these 3D particle emitters in 3D games. For 2D games or particles that appear on a game's 2D user interface, use the 2D particle emitter object instead." ], "origin": { "identifier": "ParticleEmitter3D", @@ -21091,6 +20669,20 @@ "authorIds": [ "IWykYNRvhCZBN3vEgKEbBPOR3Oc2" ], + "changelog": [ + { + "version": "3.0.0", + "breaking": "- the object rotates the other way around X axis." + }, + { + "version": "2.0.0", + "breaking": "- Object properties for position and rotation have been removed. They must be set with the instance editor or the action." + }, + { + "version": "1.0.0", + "breaking": "- Particles were 3 times too small." + } + ], "dependencies": [], "globalVariables": [], "sceneVariables": [], @@ -21110,6 +20702,8 @@ " return;", "}", "", + "const game = runtimeScene.getGame();", + "", "class ParticleEmitter3DRenderer extends gdjs.CustomRuntimeObject3DRenderer {", " constructor(", " object,", @@ -21125,15 +20719,16 @@ " threeObject3D.rotation.set(", " gdjs.toRad(this._object.getRotationX()),", " gdjs.toRad(this._object.getRotationY()),", - " -gdjs.toRad(this._object.angle)", + " gdjs.toRad(this._object.angle)", " );", "", " threeObject3D.position.set(", " this._object.getX(),", - " -this._object.getY(),", + " this._object.getY(),", " this._object.getZ()", " );", "", + " // Force the scale to 1 because the particle emitter doesn't really has a size.", " threeObject3D.scale.set(", " this._object.isFlippedX() ? -1 : 1,", " this._object.isFlippedY() ? -1 : 1,", @@ -21146,6 +20741,89 @@ " }", "}", "", + "const coneLength = 64;", + "", + "class ParticleEmitterHelper extends THREE.Object3D {", + " /** @type {gdjs.CustomRuntimeObject3D} */", + " object;", + " /** @type {THREE.LineSegments} */", + " cone;", + " /** @type {THREE.LineSegments} */", + " centerLine;", + " /** @type {THREE.Mesh} */", + " originBox;", + "", + "\t/**", + " * @param gdjs.CustomRuntimeObject3D object", + "\t */", + " constructor(object) {", + " super();", + " this.object = object;", + " this.type = 'ParticleEmitterHelper';", + "", + " const coneGeometry = new THREE.BufferGeometry();", + " const conePositions = [", + " 0, 0, 0, 0, 0, 1,", + " 0, 0, 0, 1, 0, 1,", + " 0, 0, 0, - 1, 0, 1,", + " 0, 0, 0, 0, 1, 1,", + " 0, 0, 0, 0, - 1, 1", + " ];", + " for (let i = 0, j = 1, l = 32; i < l; i++ , j++) {", + " const p1 = (i / l) * Math.PI * 2;", + " const p2 = (j / l) * Math.PI * 2;", + " conePositions.push(", + " Math.cos(p1), Math.sin(p1), 1,", + " Math.cos(p2), Math.sin(p2), 1", + " );", + " }", + " coneGeometry.setAttribute('position', new THREE.Float32BufferAttribute(conePositions, 3));", + " this.cone = new THREE.LineSegments(", + " coneGeometry,", + " new THREE.LineBasicMaterial({ fog: false, toneMapped: false })", + " );", + " this.add(this.cone);", + " const centerLineGeometry = new THREE.BufferGeometry();", + " centerLineGeometry.setAttribute('position', new THREE.Float32BufferAttribute([", + " 0, 0, 0, 0, 0, coneLength", + " ], 3));", + " this.centerLine = new THREE.LineSegments(", + " centerLineGeometry,", + " new THREE.LineBasicMaterial({ fog: false, toneMapped: false })", + " );", + " this.add(this.centerLine);", + "", + " this.originBox = new THREE.Mesh(", + " new THREE.BoxGeometry(16, 16, 16),", + " new THREE.MeshBasicMaterial({ fog: false, toneMapped: false })", + " );", + " this.add(this.originBox);", + " this.update();", + "", + " this.originBox.gdjsRuntimeObject = object;", + " }", + "", + " dispose() {", + " this.cone.geometry.dispose();", + " this.cone.material.dispose();", + " this.centerLine.geometry.dispose();", + " this.centerLine.material.dispose();", + " this.originBox.geometry.dispose();", + " this.originBox.material.dispose();", + " }", + "", + " update() {", + " const coneWidth = coneLength * Math.sin(gdjs.toRad(this.object._getSpayConeAngle()));", + " const coneHeight = coneLength * Math.cos(gdjs.toRad(this.object._getSpayConeAngle()));", + " this.cone.scale.set(coneWidth, coneWidth, coneHeight);", + " const startColor = gdjs.rgbOrHexStringToNumber(this.object._getStartColor())", + " const endColor = gdjs.rgbOrHexStringToNumber(this.object._getEndColor());", + " this.cone.material.color.set(endColor);", + " this.centerLine.material.color.set(startColor);", + " this.originBox.material.color.set(startColor);", + " }", + "}", + "", "/**", " * @param {string} colorString", " * @param {THREE.Vector4} threeColor", @@ -21336,6 +21014,11 @@ " break;", " }", " }", + "", + " setImage(resourceName) {", + " const texture = game.getImageManager().getThreeTexture(resourceName);", + " this.particleSystem.texture = texture;", + " }", "}", "", "", @@ -27712,6 +27395,7 @@ "gdjs.__particleEmmiter3DExtension = {", " ParticleEmitter3DRenderer,", " ParticleEmitterAdapter,", + " ParticleEmitterHelper,", "", " ApplyCollision,", " ApplyForce,", @@ -27835,6 +27519,71 @@ "is3D": true, "isUsingLegacyInstancesRenderer": true, "name": "ParticleEmitter3D", + "objects": [ + { + "adaptCollisionMaskAutomatically": true, + "assetStoreId": "", + "name": "Particle", + "type": "Sprite", + "updateIfNotVisible": false, + "variables": [], + "effects": [], + "behaviors": [], + "animations": [ + { + "name": "Image", + "useMultipleDirections": false, + "directions": [ + { + "looping": false, + "timeBetweenFrames": 0.08, + "sprites": [] + } + ] + } + ] + } + ], + "objectsFolderStructure": { + "folderName": "__ROOT", + "children": [ + { + "objectName": "Particle" + } + ] + }, + "objectsGroups": [], + "layers": [ + { + "ambientLightColorB": 200, + "ambientLightColorG": 200, + "ambientLightColorR": 200, + "camera3DFarPlaneDistance": 10000, + "camera3DFieldOfView": 45, + "camera3DNearPlaneDistance": 3, + "cameraType": "", + "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": [] + } + ], + "instances": [], "eventsFunctions": [ { "fullName": "", @@ -27860,37 +27609,47 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "const BatchedRenderer = gdjs.__particleEmmiter3DExtension.BatchedRenderer;", - "const ParticleSystem = gdjs.__particleEmmiter3DExtension.ParticleSystem;", - "const TextureLoader = gdjs.__particleEmmiter3DExtension.TextureLoader;", - "const IntervalValue = gdjs.__particleEmmiter3DExtension.IntervalValue;", - "const ConstantValue = gdjs.__particleEmmiter3DExtension.ConstantValue;", - "const ConstantColor = gdjs.__particleEmmiter3DExtension.ConstantColor;", - "const ColorOverLife = gdjs.__particleEmmiter3DExtension.ColorOverLife;", - "const SizeOverLife = gdjs.__particleEmmiter3DExtension.SizeOverLife;", - "const ApplyForce = gdjs.__particleEmmiter3DExtension.ApplyForce;", - "const Gradient = gdjs.__particleEmmiter3DExtension.Gradient;", - "const PiecewiseBezier = gdjs.__particleEmmiter3DExtension.PiecewiseBezier;", - "const Bezier = gdjs.__particleEmmiter3DExtension.Bezier;", - "const PointEmitter = gdjs.__particleEmmiter3DExtension.PointEmitter;", - "const ConeEmitter = gdjs.__particleEmmiter3DExtension.ConeEmitter;", - "const RenderMode = gdjs.__particleEmmiter3DExtension.RenderMode;", + "const {", + " ParticleEmitterAdapter,", + " ParticleEmitter3DRenderer,", + " ParticleEmitterHelper,", "", - "const { ParticleEmitterAdapter, ParticleEmitter3DRenderer } = gdjs.__particleEmmiter3DExtension;", + " ParticleSystem,", + " IntervalValue,", + " ConstantValue,", + " ConstantColor,", + " ColorOverLife,", + " SizeOverLife,", + " ApplyForce,", + " Gradient,", + " PiecewiseBezier,", + " Bezier,", + " PointEmitter,", + " ConeEmitter,", + " RenderMode", + "} = gdjs.__particleEmmiter3DExtension;", "", "/** @type {gdjs.CustomRuntimeObject} */", "const object = objects[0];", + "// Force the size of the object because it doesn't contain any instance.", + "object._innerArea = {", + " min: [-16, -16, -16],", + " max: [16, 16, 16],", + " };", + "const hitbox = new gdjs.Polygon();", + "hitbox.vertices = [[-16, -16], [16, -16], [16, 16], [-16, 16]];", + "object._untransformedHitBoxes = [hitbox];", + "object._unrotatedAABB.min[0] = -16;", + "object._unrotatedAABB.min[1] = -16;", + "object._unrotatedAABB.max[0] = 16;", + "object._unrotatedAABB.max[1] = 16;", + "object._updateUntransformedHitBoxes = () => {};", "", "// Here runtimeScene is the gdjs.CustomRuntimeObjectInstanceContainer inside the custom object.", "const gameScene = object.getRuntimeScene();", + "const game = runtimeScene.getGame();", "", - "/** @type {SpriteObjectDataType} */", - "const particleSpriteData = object._instanceContainer._objects.get(\"Particle\");", - "const resourceName = particleSpriteData.animations[0].directions[0].sprites[0].image;", - "const texture = object", - " .getInstanceContainer()", - " .getGame()", - " .getImageManager().getThreeTexture(resourceName);", + "const texture = game.getImageManager().getThreeTexture('');", "", "// Set the blending here because changes are not applied after the emitter creation.", "const blendingString = object._getBlending();", @@ -27963,7 +27722,7 @@ "", "// This is a hack that may break in future releases.", "// Replace the group that would hold children objects by the emmiter.", - "const layer = gameScene.getLayer(object.getLayer());", + "const layer = object.getInstanceContainer().getLayer(object.getLayer());", "const group = object.getRenderer()._threeGroup;", "layer.getRenderer().remove3DRendererObject(group);", "particleSystem.emitter.position.copy(group.position);", @@ -27972,8 +27731,15 @@ "", "const particleEmitter3DRenderer = new ParticleEmitter3DRenderer(object, object._instanceContainer, object.getInstanceContainer());", "object._renderer = particleEmitter3DRenderer;", - "particleEmitter3DRenderer._threeGroup = particleSystem.emitter;", - "layer.getRenderer().add3DRendererObject(particleSystem.emitter);", + "if (game.isInGameEdition && game.isInGameEdition()) {", + " const particleEmitterHelper = new ParticleEmitterHelper(object);", + " particleEmitter3DRenderer._threeGroup = particleEmitterHelper;", + " layer.getRenderer().add3DRendererObject(particleEmitterHelper);", + "}", + "else {", + " particleEmitter3DRenderer._threeGroup = particleSystem.emitter;", + " layer.getRenderer().add3DRendererObject(particleSystem.emitter);", + "}", "", "particleSystem.emitter.updateMatrixWorld(true);", "", @@ -28053,7 +27819,7 @@ " for (const layerName of layerNames) {", " const layer = gameScene.getLayer(layerName);", " if (layer.__particleEmmiter3DExtension) {", - " layer.__particleEmmiter3DExtension.batchSystem.update(object.getElapsedTime() / 1000);", + " layer.__particleEmmiter3DExtension.batchSystem.update(layer.getElapsedTime() / 1000);", " }", " }", "}" @@ -28325,6 +28091,15 @@ "Object.GravityTop()", "" ] + }, + { + "type": { + "value": "ParticleEmitter3D::ParticleEmitter3D::UpdateImage" + }, + "parameters": [ + "Object", + "" + ] } ], "events": [ @@ -28414,6 +28189,87 @@ ] } ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "ParticleEmitter3D::ParticleEmitter3D::UpdateHelper" + }, + "parameters": [ + "Object", + "" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "ParticleEmitter3D::ParticleEmitter3D", + "type": "object" + } + ], + "objectGroups": [] + }, + { + "fullName": "Update helper", + "functionType": "Action", + "name": "UpdateHelper", + "private": true, + "sentence": "Update graphical helper of _PARAM0_", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const game = runtimeScene.getGame();", + "if (game.isInGameEdition && game.isInGameEdition()) {", + " const particleEmitterHelper = objects[0].get3DRendererObject();", + " particleEmitterHelper.update();", + "}" + ], + "parameterObjects": "Object", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "ParticleEmitter3D::ParticleEmitter3D", + "type": "object" + } + ], + "objectGroups": [] + }, + { + "fullName": "Update particle image", + "functionType": "Action", + "name": "UpdateImage", + "private": true, + "sentence": "Update particle image of _PARAM0_", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "/** @type {gdjs.CustomRuntimeObject3D} */\r", + "const object = objects[0];\r", + "/** @type {SpriteObjectDataType} */\r", + "const particleSpriteData = object._instanceContainer._objects.get(\"Particle\");\r", + "/** @type {gdjs.SpriteAnimationData} */\r", + "const animation = particleSpriteData.animations[0];\r", + "const animationFrame = animation ? animation.directions[0].sprites[0] : null;\r", + "const resourceName = animationFrame ? animationFrame.image : '';\r", + "object.__particleEmitterAdapter.setImage(resourceName);" + ], + "parameterObjects": "Object", + "useStrict": true, + "eventsSheetExpanded": true } ], "parameters": [ @@ -28501,7 +28357,7 @@ " for (const layerName of layerNames) {", " const layer = gameScene.getLayer(layerName);", " if (layer.__particleEmmiter3DExtension) {", - " layer.__particleEmmiter3DExtension.batchSystem.update(object.getElapsedTime() / 1000);", + " layer.__particleEmmiter3DExtension.batchSystem.update(layer.getElapsedTime() / 1000);", " }", " }", "}" @@ -28541,10 +28397,16 @@ " // Here runtimeScene is the gdjs.CustomRuntimeObjectInstanceContainer inside the custom object.", " const gameScene = object.getRuntimeScene();", "", - " const layer = gameScene.getLayer(object.getLayer());", + " let rootObject = object;", + " while (rootObject.getInstanceContainer().getOwner) {", + " rootObject = rootObject.getInstanceContainer().getOwner();", + " }", + "", + " const layer = gameScene.getLayer(rootObject.getLayer());", " layer.__particleEmmiter3DExtension = layer.__particleEmmiter3DExtension || {};", " if (!layer.__particleEmmiter3DExtension.batchSystem) {", " const batchSystem = new gdjs.__particleEmmiter3DExtension.BatchedRenderer();", + " batchSystem.scale.y *= -1;", " const threeScene = layer.getRenderer().getThreeScene();", " if (threeScene) {", " threeScene.add(batchSystem);", @@ -28588,7 +28450,7 @@ ], "parameterObjects": "Object", "useStrict": true, - "eventsSheetExpanded": false + "eventsSheetExpanded": true } ], "parameters": [ @@ -30579,18 +30441,14 @@ "value": "255;0;0", "type": "Color", "label": "Start color", - "description": "", "group": "Color", - "extraInformation": [], "name": "StartColor" }, { "value": "255;255;0", "type": "Color", "label": "End color", - "description": "", "group": "Color", - "extraInformation": [], "name": "EndColor" }, { @@ -30598,9 +30456,7 @@ "type": "Number", "unit": "Dimensionless", "label": "Start opacity", - "description": "", "group": "Color", - "extraInformation": [], "name": "StartOpacity" }, { @@ -30608,18 +30464,13 @@ "type": "Number", "unit": "Dimensionless", "label": "End opacity", - "description": "", "group": "Color", - "extraInformation": [], "name": "EndOpacity" }, { "value": "50", "type": "Number", "label": "Flow of particles (particles per second)", - "description": "", - "group": "", - "extraInformation": [], "name": "Flow" }, { @@ -30627,9 +30478,7 @@ "type": "Number", "unit": "Pixel", "label": "Start min size", - "description": "", "group": "Size", - "extraInformation": [], "name": "StartSizeMin" }, { @@ -30637,9 +30486,7 @@ "type": "Number", "unit": "Pixel", "label": "Start max size", - "description": "", "group": "Size", - "extraInformation": [], "name": "StartSizeMax" }, { @@ -30647,9 +30494,7 @@ "type": "Number", "unit": "Dimensionless", "label": "End scale", - "description": "", "group": "Size", - "extraInformation": [], "name": "EndScale" }, { @@ -30657,9 +30502,7 @@ "type": "Number", "unit": "PixelSpeed", "label": "Start min speed", - "description": "", "group": "Speed", - "extraInformation": [], "name": "StartSpeedMin" }, { @@ -30667,9 +30510,7 @@ "type": "Number", "unit": "PixelSpeed", "label": "Start max speed", - "description": "", "group": "Speed", - "extraInformation": [], "name": "StartSpeedMax" }, { @@ -30677,9 +30518,6 @@ "type": "Number", "unit": "Second", "label": "Min lifespan", - "description": "", - "group": "", - "extraInformation": [], "name": "LifespanMin" }, { @@ -30687,9 +30525,6 @@ "type": "Number", "unit": "Second", "label": "Max lifespan", - "description": "", - "group": "", - "extraInformation": [], "name": "LifespanMax" }, { @@ -30697,18 +30532,13 @@ "type": "Number", "unit": "Second", "label": "Emission duration", - "description": "", - "group": "", - "extraInformation": [], "name": "Duration" }, { "value": "", "type": "Boolean", "label": "Particles move with the emitter", - "description": "", "group": "Speed", - "extraInformation": [], "name": "AreParticlesRelative" }, { @@ -30716,23 +30546,35 @@ "type": "Number", "unit": "DegreeAngle", "label": "Spay cone angle", - "description": "", "group": "Position", - "extraInformation": [], "name": "SpayConeAngle" }, { "value": "Additive", "type": "Choice", "label": "Blending", - "description": "", "group": "Color", - "extraInformation": [ - "Normal", - "Additive", - "Subtractive", - "Multiply", - "None" + "choices": [ + { + "label": "Normal", + "value": "Normal" + }, + { + "label": "Additive", + "value": "Additive" + }, + { + "label": "Subtractive", + "value": "Subtractive" + }, + { + "label": "Multiply", + "value": "Multiply" + }, + { + "label": "None", + "value": "None" + } ], "name": "Blending" }, @@ -30740,11 +30582,16 @@ "value": "Y-", "type": "Choice", "label": "Gravity top", - "description": "", "group": "Speed", - "extraInformation": [ - "Y-", - "Z+" + "choices": [ + { + "label": "Y-", + "value": "Y-" + }, + { + "label": "Z+", + "value": "Z+" + } ], "name": "GravityTop" }, @@ -30753,18 +30600,13 @@ "type": "Number", "unit": "PixelAcceleration", "label": "Gravity", - "description": "", "group": "Speed", - "extraInformation": [], "name": "Gravity" }, { "value": "true", "type": "Boolean", "label": "Delete when emission ends", - "description": "", - "group": "", - "extraInformation": [], "name": "ShouldAutodestruct" }, { @@ -30772,8 +30614,6 @@ "type": "String", "label": "", "description": "Only used by the scene editor.", - "group": "", - "extraInformation": [], "hidden": true, "name": "ParentOrigin" }, @@ -30784,7 +30624,6 @@ "label": "Z (elevation)", "description": "Deprecated", "group": "Position", - "extraInformation": [], "hidden": true, "name": "Z" }, @@ -30793,9 +30632,7 @@ "type": "Number", "unit": "DegreeAngle", "label": "Rotation on X axis", - "description": "", "group": "Position", - "extraInformation": [], "hidden": true, "name": "RotationX" }, @@ -30804,78 +30641,12 @@ "type": "Number", "unit": "DegreeAngle", "label": "Rotation on Y axis", - "description": "", "group": "Position", - "extraInformation": [], "hidden": true, "name": "RotationY" } ], - "objects": [ - { - "adaptCollisionMaskAutomatically": true, - "assetStoreId": "", - "name": "Particle", - "type": "Sprite", - "updateIfNotVisible": false, - "variables": [], - "effects": [], - "behaviors": [], - "animations": [ - { - "name": "Image", - "useMultipleDirections": false, - "directions": [ - { - "looping": false, - "timeBetweenFrames": 0.08, - "sprites": [] - } - ] - } - ] - } - ], - "objectsFolderStructure": { - "folderName": "__ROOT", - "children": [ - { - "objectName": "Particle" - } - ] - }, - "objectsGroups": [], - "layers": [ - { - "ambientLightColorB": 200, - "ambientLightColorG": 200, - "ambientLightColorR": 200, - "camera3DFarPlaneDistance": 10000, - "camera3DFieldOfView": 45, - "camera3DNearPlaneDistance": 3, - "cameraType": "", - "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": [] - } - ], - "instances": [] + "variants": [] } ] }, @@ -30890,11 +30661,13 @@ "name": "FirstPersonCamera", "previewIconUrl": "https://asset-resources.gdevelop.io/public-resources/Icons/Line Hero Pack/Master/SVG/Security and Protection/e8248ffd504c314e6a9d9d560c3a0fdad3398a5f125ae6a4c0654d4e68c86376_Security and Protection_security_protection_eye_scan_lock.svg", "shortDescription": "Move the camera to look though objects eyes.", - "version": "1.0.2", + "version": "1.0.4", "description": [ "Move the camera to look though objects eyes.", "", - "This extension can be used with the \"Mouse pointer lock\" or \"Gamepad\" extension to build a first person camera." + "This extension can be used with the \"Mouse pointer lock\" or \"Gamepad\" extension to build a first person camera.", + "", + "The first person example uses this extension ([open the project online](https://editor.gdevelop.io/?project=example://3d-first-person))." ], "origin": { "identifier": "FirstPersonCamera", @@ -30906,18 +30679,20 @@ "fps" ], "authorIds": [ - "IWykYNRvhCZBN3vEgKEbBPOR3Oc2" + "IWykYNRvhCZBN3vEgKEbBPOR3Oc2", + "m8kleQHonagHWsvILDhyJhgVhuF2" ], "dependencies": [], "globalVariables": [], "sceneVariables": [], "eventsFunctions": [ { - "description": "Move the camera to look though _PARAM1_ eyes. The object must look to the right when all its angles are 0 and the top of its head be toward Z+.", + "description": "Move the camera to look though the object eyes. The object must look to the right when all its angles are 0 and the top of its head be toward Z+.", "fullName": "Look through object eyes", "functionType": "Action", "group": "Layers and cameras", "name": "LookFromObjectEyes", + "private": true, "sentence": "Move the camera of _PARAM2_ to look though _PARAM1_ eyes", "events": [ { @@ -30948,6 +30723,84 @@ "" ] }, + { + "type": { + "value": "Scene3D::SetCameraRotationX" + }, + "parameters": [ + "", + "=", + "- Object.RotationY() + 90", + "Layer", + "" + ] + }, + { + "type": { + "value": "Scene3D::SetCameraRotationY" + }, + "parameters": [ + "", + "=", + "Object.RotationX()", + "Layer", + "" + ] + }, + { + "type": { + "value": "SetCameraAngle" + }, + "parameters": [ + "", + "=", + "Object.Angle() + 90", + "Layer", + "" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "Scene3D::Cube3DObject", + "type": "objectList" + }, + { + "description": "Layer", + "name": "Layer", + "type": "layer" + } + ], + "objectGroups": [] + }, + { + "description": "Move the camera to look though the object eyes. The object must look to the right when all its angles are 0 and the top of its head be toward Z+.", + "fullName": "Look through object eyes", + "functionType": "Action", + "group": "Layers and cameras", + "name": "LookFrom3DObjectEyes", + "sentence": "Move the camera of _PARAM3_ to look though _PARAM1_ eyes", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "CentreCamera" + }, + "parameters": [ + "", + "Object", + "", + "Layer", + "" + ] + }, { "type": { "value": "Scene3D::SetCameraZ" @@ -30955,7 +30808,7 @@ "parameters": [ "", "=", - "Object.Z()", + "Object.Object3D::Z()", "Layer", "" ] @@ -30967,7 +30820,7 @@ "parameters": [ "", "=", - "- Object.RotationY() + 90", + "- Object.Object3D::RotationY() + 90", "Layer", "" ] @@ -30979,7 +30832,7 @@ "parameters": [ "", "=", - "Object.RotationX()", + "Object.Object3D::RotationX()", "Layer", "" ] @@ -31001,11 +30854,16 @@ ], "parameters": [ { - "description": "Object", + "description": "3D Object", "name": "Object", - "supplementaryInformation": "Scene3D::Cube3DObject", "type": "objectList" }, + { + "description": "3D capability", + "name": "Object3D", + "supplementaryInformation": "Scene3D::Base3DBehavior", + "type": "behavior" + }, { "description": "Layer", "name": "Layer", @@ -31029,7 +30887,7 @@ "name": "Raycaster3D", "previewIconUrl": "https://asset-resources.gdevelop.io/public-resources/Icons/8419f46b76bce482c14b4c03b4141a64d457e4cdc92686f3470381f5d2694abd_ray-start-arrow.svg", "shortDescription": "Find 3D objects that cross a line.", - "version": "0.1.4", + "version": "0.1.7", "description": [ "It can be useful to:", "- Find 3D objects under the pointer", @@ -31069,222 +30927,7 @@ "parameters": [ "", "" - ] - } - ] - } - ], - "parameters": [], - "objectGroups": [] - }, - { - "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::Standard", - "conditions": [ - { - "type": { - "value": "GlobalVariableAsBoolean" - }, - "parameters": [ - "_Raycaster3DExtension_ClassesDefined", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetGlobalVariableAsBoolean" - }, - "parameters": [ - "_Raycaster3DExtension_ClassesDefined", - "True" - ] - } - ], - "events": [ - { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "gdjs.__raycaster3DExtension = gdjs.__raycaster3DExtension || {};", - "", - "class Raycaster {", - " raycaster = new THREE.Raycaster();", - " pointer = new THREE.Vector2();", - " raycastResults = [];", - " lastDistance = 0;", - " lastPositionX = 0;", - " lastPositionY = 0;", - " lastPositionZ = 0;", - " lastNormalX = 0;", - " lastNormalY = 0;", - " lastNormalZ = 0;", - "", - " /**", - " * @param objectsLists {Hashtable}", - " * @param objects {gdjs.RuntimeObject[]}", - " * @param pointerX {number}", - " * @param pointerY {number}", - " * @param distanceMax {number}", - " */", - " recastFromCamera(objectsLists, objects, pointerX, pointerY, distanceMax) {", - " if (objects.length === 0) {", - " return false;", - " }", - " const object = objects[0];", - " const layer = object.getInstanceContainer().getLayer(object.getLayer());", - " const camera = layer.getRenderer().getThreeCamera();", - "", - " const raycaster = this.raycaster;", - " const pointer = this.pointer;", - " pointer.x = -1 + 2 * pointerX;", - " pointer.y = 1 - 2 * pointerY;", - " raycaster.setFromCamera(pointer, camera);", - " raycaster.far = distanceMax;", - "", - " return this._doRecast(objectsLists, objects);", - " }", - "", - " /**", - " * @param objectsLists {Hashtable}", - " * @param objects {gdjs.RuntimeObject[]}", - " * @param originX {number}", - " * @param originY {number}", - " * @param originZ {number}", - " * @param rotationAngle {number}", - " * @param elevationAngle {number}", - " * @param distanceMax {number}", - " */", - " recastWithAngle(", - " objectsLists,", - " objects,", - " originX,", - " originY,", - " originZ,", - " rotationAngle,", - " elevationAngle,", - " distanceMax", - " ) {", - " if (objects.length === 0) {", - " return false;", - " }", - " const raycaster = this.raycaster;", - " raycaster.ray.origin.set(", - " originX,", - " -originY,", - " originZ,", - " );", - " const rotation = rotationAngle * Math.PI / 180;", - " const elevation = elevationAngle * Math.PI / 180;", - " const cosElevation = Math.cos(elevation);", - " raycaster.ray.direction.set(", - " Math.cos(rotation) * cosElevation,", - " -Math.sin(rotation) * cosElevation,", - " Math.sin(elevation),", - " );", - " raycaster.far = distanceMax;", - "", - " return this._doRecast(objectsLists, objects);", - " }", - "", - " /**", - " * @param objectsLists {Hashtable}", - " * @param objects {gdjs.RuntimeObject[]}", - " * @param originX {number}", - " * @param originY {number}", - " * @param originZ {number}", - " * @param targetX {number}", - " * @param targetY {number}", - " * @param targetZ {number}", - " * @param distanceMax {number}", - " */", - " recastBetweenPosition(", - " objectsLists,", - " objects,", - " originX,", - " originY,", - " originZ,", - " targetX,", - " targetY,", - " targetZ", - " ) {", - " if (objects.length === 0) {", - " return false;", - " }", - " const raycaster = this.raycaster;", - " raycaster.ray.origin.set(", - " originX,", - " -originY,", - " originZ,", - " );", - " const deltaX = targetX - originX;", - " const deltaY = targetY - originY;", - " const deltaZ = targetZ - originZ;", - " const deltaLength = Math.hypot(deltaX, deltaY, deltaZ);", - " raycaster.ray.direction.set(", - " deltaX / deltaLength,", - " -deltaY / deltaLength,", - " deltaZ / deltaLength,", - " );", - " raycaster.far = deltaLength;", - "", - " return this._doRecast(objectsLists, objects);", - " }", - "", - " /**", - " * @param objectsLists {Hashtable}", - " * @param objects {gdjs.RuntimeObject[]}", - " */", - " _doRecast(objectsLists, objects) {", - " const raycastResults = this.raycastResults;", - " let distanceMin = Number.MAX_VALUE;", - " let nearestObject = null;", - " for (const object of objects) {", - " raycastResults.length = 0;", - " const threeObject = object.get3DRendererObject();", - " if (!threeObject) {", - " continue;", - " }", - " this.raycaster.intersectObject(threeObject, true, raycastResults);", - " if (raycastResults.length > 0 && raycastResults[0].distance < distanceMin) {", - " const raycastResult = raycastResults[0];", - " distanceMin = raycastResult.distance;", - " nearestObject = object;", - " this.lastDistance = raycastResult.distance;", - " this.lastPositionX = raycastResult.point.x;", - " this.lastPositionY = -raycastResult.point.y;", - " this.lastPositionZ = raycastResult.point.z;", - " this.lastNormalX = raycastResult.normal.x;", - " this.lastNormalY = raycastResult.normal.y;", - " this.lastNormalZ = raycastResult.normal.z;", - " }", - " }", - " if (!nearestObject) {", - " return false;", - " }", - " raycastResults.length = 0;", - " gdjs.evtTools.object.pickOnly(", - " objectsLists,", - " nearestObject", - " );", - " return true;", - " }", - "}", - "", - "gdjs.__raycaster3DExtension.Raycaster = Raycaster;", - "gdjs.__raycaster3DExtension.raycaster = new Raycaster();", - "" - ], - "parameterObjects": "", - "useStrict": true, - "eventsSheetExpanded": true + ] } ] } @@ -31292,6 +30935,201 @@ "parameters": [], "objectGroups": [] }, + { + "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.__raycaster3DExtension) {", + " return;", + "}", + "", + "class Raycaster {", + " raycaster = new THREE.Raycaster();", + " pointer = new THREE.Vector2();", + " /** @type {Array} */", + " raycastResults = [];", + " lastDistance = 0;", + " lastPositionX = 0;", + " lastPositionY = 0;", + " lastPositionZ = 0;", + " lastNormal = new THREE.Vector3();", + "", + " /**", + " * @param objectsLists {Hashtable}", + " * @param objects {gdjs.RuntimeObject[]}", + " * @param pointerX {number}", + " * @param pointerY {number}", + " * @param distanceMax {number}", + " */", + " recastFromCamera(objectsLists, objects, pointerX, pointerY, distanceMax) {", + " if (objects.length === 0) {", + " return false;", + " }", + " const object = objects[0];", + " const layer = object.getInstanceContainer().getLayer(object.getLayer());", + " const camera = layer.getRenderer().getThreeCamera();", + "", + " const raycaster = this.raycaster;", + " const pointer = this.pointer;", + " pointer.x = -1 + 2 * pointerX;", + " pointer.y = 1 - 2 * pointerY;", + " raycaster.setFromCamera(pointer, camera);", + " raycaster.far = distanceMax;", + "", + " return this._doRecast(objectsLists, objects);", + " }", + "", + " /**", + " * @param objectsLists {Hashtable}", + " * @param objects {gdjs.RuntimeObject[]}", + " * @param originX {number}", + " * @param originY {number}", + " * @param originZ {number}", + " * @param rotationAngle {number}", + " * @param elevationAngle {number}", + " * @param distanceMax {number}", + " */", + " recastWithAngle(", + " objectsLists,", + " objects,", + " originX,", + " originY,", + " originZ,", + " rotationAngle,", + " elevationAngle,", + " distanceMax", + " ) {", + " if (objects.length === 0) {", + " return false;", + " }", + " const raycaster = this.raycaster;", + " raycaster.ray.origin.set(", + " originX,", + " -originY,", + " originZ,", + " );", + " const rotation = rotationAngle * Math.PI / 180;", + " const elevation = elevationAngle * Math.PI / 180;", + " const cosElevation = Math.cos(elevation);", + " raycaster.ray.direction.set(", + " Math.cos(rotation) * cosElevation,", + " -Math.sin(rotation) * cosElevation,", + " Math.sin(elevation),", + " );", + " raycaster.far = distanceMax;", + "", + " return this._doRecast(objectsLists, objects);", + " }", + "", + " /**", + " * @param objectsLists {Hashtable}", + " * @param objects {gdjs.RuntimeObject[]}", + " * @param originX {number}", + " * @param originY {number}", + " * @param originZ {number}", + " * @param targetX {number}", + " * @param targetY {number}", + " * @param targetZ {number}", + " * @param distanceMax {number}", + " */", + " recastBetweenPosition(", + " objectsLists,", + " objects,", + " originX,", + " originY,", + " originZ,", + " targetX,", + " targetY,", + " targetZ", + " ) {", + " if (objects.length === 0) {", + " return false;", + " }", + " const raycaster = this.raycaster;", + " raycaster.ray.origin.set(", + " originX,", + " -originY,", + " originZ,", + " );", + " const deltaX = targetX - originX;", + " const deltaY = targetY - originY;", + " const deltaZ = targetZ - originZ;", + " const deltaLength = Math.hypot(deltaX, deltaY, deltaZ);", + " raycaster.ray.direction.set(", + " deltaX / deltaLength,", + " -deltaY / deltaLength,", + " deltaZ / deltaLength,", + " );", + " raycaster.far = deltaLength;", + "", + " return this._doRecast(objectsLists, objects);", + " }", + "", + " /**", + " * @param objectsLists {Hashtable}", + " * @param objects {gdjs.RuntimeObject[]}", + " */", + " _doRecast(objectsLists, objects) {", + " const raycastResults = this.raycastResults;", + " let distanceMin = Number.MAX_VALUE;", + " /** @type {gdjs.RuntimeObject | null} */", + " let nearestObject = null;", + " /** @type {THREE.Object3D | null} */", + " let nearestThreeObject = null;", + " for (const object of objects) {", + " raycastResults.length = 0;", + " const threeObject = object.get3DRendererObject();", + " if (!threeObject) {", + " continue;", + " }", + " this.raycaster.intersectObject(threeObject, true, raycastResults);", + " if (raycastResults.length > 0 && raycastResults[0].distance < distanceMin) {", + " const raycastResult = raycastResults[0];", + " distanceMin = raycastResult.distance;", + " nearestObject = object;", + " this.lastDistance = raycastResult.distance;", + " this.lastPositionX = raycastResult.point.x;", + " this.lastPositionY = -raycastResult.point.y;", + " this.lastPositionZ = raycastResult.point.z;", + " this.lastNormal.copy(raycastResult.normal);", + " nearestThreeObject = raycastResult.object;", + " }", + " }", + " if (!nearestObject) {", + " return false;", + " }", + " this.lastNormal.transformDirection(nearestThreeObject.matrixWorld);", + " this.lastNormal.y = -this.lastNormal.y;", + " raycastResults.length = 0;", + " gdjs.evtTools.object.pickOnly(", + " objectsLists,", + " nearestObject", + " );", + " return true;", + " }", + "}", + "", + "gdjs.__raycaster3DExtension = {", + " Raycaster,", + " raycaster: new Raycaster(),", + "}", + "" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "parameters": [], + "objectGroups": [] + }, { "description": "Sends a ray from the given source position and angle, intersecting the closest object. The intersected object will become the only one taken into account.", "fullName": "Raycast", @@ -31429,240 +31267,609 @@ "objectGroups": [] }, { - "description": "Sends a ray from the center of the camera, intersecting the closest object. The intersected object will become the only one taken into account.", - "fullName": "Raycast from camera center", - "functionType": "Condition", - "group": "Collision", - "name": "RaycastFromCameraCenter", - "sentence": "Cast a ray from the camera center to a maximum distance of _PARAM2_ against _PARAM1_", + "description": "Sends a ray from the center of the camera, intersecting the closest object. The intersected object will become the only one taken into account.", + "fullName": "Raycast from camera center", + "functionType": "Condition", + "group": "Collision", + "name": "RaycastFromCameraCenter", + "sentence": "Cast a ray from the camera center to a maximum distance of _PARAM2_ against _PARAM1_", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "eventsFunctionContext.returnValue =", + " gdjs.__raycaster3DExtension.raycaster.recastFromCamera(", + " eventsFunctionContext.getObjectsLists(\"Object\"),", + " objects,", + " 0.5,", + " 0.5,", + " eventsFunctionContext.getArgument(\"DistanceMax\")", + " );", + "" + ], + "parameterObjects": "Object", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "parameters": [ + { + "description": "Objects to test against the ray", + "name": "Object", + "type": "objectList" + }, + { + "description": "Ray maximum distance (in pixels)", + "name": "DistanceMax", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Sends a ray from the given source point on the camera screen, intersecting the closest object. The intersected object will become the only one taken into account.", + "fullName": "Raycast from a camera point", + "functionType": "Condition", + "group": "Collision", + "name": "RaycastFromCameraPoint", + "sentence": "Cast a ray from the camera point _PARAM2_; _PARAM3_ to a maximum distance of _PARAM4_ against _PARAM1_", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "eventsFunctionContext.returnValue =", + " gdjs.__raycaster3DExtension.raycaster.recastFromCamera(", + " eventsFunctionContext.getObjectsLists(\"Object\"),", + " objects,", + " eventsFunctionContext.getArgument(\"PointerX\"),", + " eventsFunctionContext.getArgument(\"PointerY\"),", + " eventsFunctionContext.getArgument(\"DistanceMax\")", + " );", + "" + ], + "parameterObjects": "Object", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "parameters": [ + { + "description": "Objects to test against the ray", + "name": "Object", + "type": "objectList" + }, + { + "description": "X position on the screen (from 0 to 1)", + "name": "PointerX", + "type": "expression" + }, + { + "description": "Y position on the screen (from 0 to 1)", + "name": "PointerY", + "type": "expression" + }, + { + "description": "Ray maximum distance (in pixels)", + "name": "DistanceMax", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Sends a ray from the cursor on the camera screen, intersecting the closest object. The intersected object will become the only one taken into account.", + "fullName": "Raycast from cursor", + "functionType": "Condition", + "group": "Collision", + "name": "RaycastFromCameraCursor", + "sentence": "Cast a ray from the cursor on 2D layer: _PARAM2_ to a maximum distance of _PARAM3_ against _PARAM1_", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const { camera, input } = gdjs.evtTools;", + "", + "const layer2D = eventsFunctionContext.getArgument(\"Layer2D\");", + "", + "const cameraMinX = camera.getCameraBorderLeft(runtimeScene, layer2D, 0);", + "const cameraMaxX = camera.getCameraBorderRight(runtimeScene, layer2D, 0);", + "const cameraMinY = camera.getCameraBorderTop(runtimeScene, layer2D, 0);", + "const cameraMaxY = camera.getCameraBorderBottom(runtimeScene, layer2D, 0);", + "", + "const cursorX = input.getCursorX(runtimeScene, layer2D, 0);", + "const cursorY = input.getCursorY(runtimeScene, layer2D, 0);", + "", + "eventsFunctionContext.returnValue =", + " gdjs.__raycaster3DExtension.raycaster.recastFromCamera(", + " eventsFunctionContext.getObjectsLists(\"Object\"),", + " objects,", + " (cursorX - cameraMinX) / (cameraMaxX - cameraMinX),", + " (cursorY - cameraMinY) / (cameraMaxY - cameraMinY),", + " eventsFunctionContext.getArgument(\"DistanceMax\")", + " );", + "" + ], + "parameterObjects": "Object", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "parameters": [ + { + "description": "Objects to test against the ray", + "name": "Object", + "type": "objectList" + }, + { + "description": "2D layer", + "name": "Layer2D", + "type": "layer" + }, + { + "description": "Ray maximum distance (in pixels)", + "name": "DistanceMax", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "the last recast intersection distance.", + "fullName": "Last recast distance", + "functionType": "ExpressionAndCondition", + "name": "Distance", + "sentence": "the last recast intersection distance", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": "eventsFunctionContext.returnValue = gdjs.__raycaster3DExtension.raycaster.lastDistance;", + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [], + "objectGroups": [] + }, + { + "description": "Return the last recast intersection position on X axis.", + "fullName": "Last recast X intersection", + "functionType": "Expression", + "name": "IntersectionX", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": "eventsFunctionContext.returnValue = gdjs.__raycaster3DExtension.raycaster.lastPositionX;", + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [], + "objectGroups": [] + }, + { + "description": "Return the last recast intersection position on Y axis.", + "fullName": "Last recast Y intersection", + "functionType": "Expression", + "name": "IntersectionY", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": "eventsFunctionContext.returnValue = gdjs.__raycaster3DExtension.raycaster.lastPositionY;", + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [], + "objectGroups": [] + }, + { + "description": "Return the last recast intersection position on Z axis.", + "fullName": "Last recast Z intersection", + "functionType": "Expression", + "name": "IntersectionZ", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "eventsFunctionContext.returnValue =", - " gdjs.__raycaster3DExtension.raycaster.recastFromCamera(", - " eventsFunctionContext.getObjectsLists(\"Object\"),", - " objects,", - " 0.5,", - " 0.5,", - " eventsFunctionContext.getArgument(\"DistanceMax\")", - " );", - "" - ], - "parameterObjects": "Object", + "inlineCode": "eventsFunctionContext.returnValue = gdjs.__raycaster3DExtension.raycaster.lastPositionZ;", + "parameterObjects": "", "useStrict": true, - "eventsSheetExpanded": true + "eventsSheetExpanded": false } ], - "parameters": [ + "expressionType": { + "type": "expression" + }, + "parameters": [], + "objectGroups": [] + }, + { + "description": "Return the last recast intersection normal on X axis.", + "fullName": "Last recast X normal", + "functionType": "Expression", + "name": "NormalX", + "sentence": "", + "events": [ { - "description": "Objects to test against the ray", - "name": "Object", - "type": "objectList" - }, + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": "eventsFunctionContext.returnValue = gdjs.__raycaster3DExtension.raycaster.lastNormal.x;", + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [], + "objectGroups": [] + }, + { + "description": "Return the last recast intersection normal on X axis.", + "fullName": "Last recast X normal", + "functionType": "Expression", + "name": "NormalY", + "sentence": "", + "events": [ { - "description": "Ray maximum distance (in pixels)", - "name": "DistanceMax", - "type": "expression" + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": "eventsFunctionContext.returnValue = gdjs.__raycaster3DExtension.raycaster.lastNormal.y;", + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false } ], + "expressionType": { + "type": "expression" + }, + "parameters": [], "objectGroups": [] }, { - "description": "Sends a ray from the given source point on the camera screen, intersecting the closest object. The intersected object will become the only one taken into account.", - "fullName": "Raycast from a camera point", - "functionType": "Condition", - "group": "Collision", - "name": "RaycastFromCameraPoint", - "sentence": "Cast a ray from the camera point _PARAM2_; _PARAM3_ to a maximum distance of _PARAM4_ against _PARAM1_", + "description": "Return the last recast intersection normal on Z axis.", + "fullName": "Last recast Z normal", + "functionType": "Expression", + "name": "NormalZ", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": "eventsFunctionContext.returnValue = gdjs.__raycaster3DExtension.raycaster.lastNormal.z;", + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [], + "objectGroups": [] + } + ], + "eventsBasedBehaviors": [], + "eventsBasedObjects": [] + }, + { + "author": "Silver-Streak", + "category": "Input", + "extensionNamespace": "", + "fullName": "Double-click and tap", + "gdevelopVersion": ">=5.5.222", + "helpPath": "", + "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyMy4wLjMsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iSWNvbnMiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB2aWV3Qm94PSIwIDAgMzIgMzIiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDMyIDMyOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8c3R5bGUgdHlwZT0idGV4dC9jc3MiPg0KCS5zdDB7ZmlsbDpub25lO3N0cm9rZTojMDAwMDAwO3N0cm9rZS13aWR0aDoyO3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1saW5lam9pbjpyb3VuZDtzdHJva2UtbWl0ZXJsaW1pdDoxMDt9DQoJLnN0MXtmaWxsOm5vbmU7c3Ryb2tlOiMwMDAwMDA7c3Ryb2tlLXdpZHRoOjI7c3Ryb2tlLWxpbmVqb2luOnJvdW5kO3N0cm9rZS1taXRlcmxpbWl0OjEwO30NCjwvc3R5bGU+DQo8bGluZSBjbGFzcz0ic3QwIiB4MT0iMTYiIHkxPSIzIiB4Mj0iMTYiIHkyPSI2Ii8+DQo8bGluZSBjbGFzcz0ic3QwIiB4MT0iMTYiIHkxPSIxMCIgeDI9IjE2IiB5Mj0iMTMiLz4NCjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik0xNiwxMEwxNiwxMGMtMS4xLDAtMi0wLjktMi0ydjBjMC0xLjEsMC45LTIsMi0yaDBjMS4xLDAsMiwwLjksMiwydjBDMTgsOS4xLDE3LjEsMTAsMTYsMTB6Ii8+DQo8cGF0aCBjbGFzcz0ic3QwIiBkPSJNNywxNC4xYzIuMy0wLjcsNS41LTEuMSw5LTEuMWMzLjUsMCw2LjcsMC40LDksMS4xIi8+DQo8cGF0aCBjbGFzcz0ic3QwIiBkPSJNMTYsMjlMMTYsMjljLTUsMC05LTQtOS05di01LjlWOWMwLTMuMywyLjctNiw2LTZoNmMzLjMsMCw2LDIuNyw2LDZ2MTFDMjUsMjUsMjEsMjksMTYsMjl6Ii8+DQo8L3N2Zz4NCg==", + "name": "DoubleClick", + "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/Line Hero Pack/Master/SVG/Computers and Hardware/Computers and Hardware_mouse_wireless_pc.svg", + "shortDescription": "Check for a double-click or a tap.", + "version": "2.0.1", + "description": [ + "Check for a double-click with a mouse, or a tap and double-click on a touchscreen.", + "", + "Please note: Touch devices do not have alternatives for middle/right clicks. Taps on a touch device will get counted for _any_ use of these conditions, so you should either design your controls accordingly, or build out separate events if the device has a touch screen." + ], + "origin": { + "identifier": "DoubleClick", + "name": "gdevelop-extension-store" + }, + "tags": [ + "mouse", + "cursor", + "pointer", + "click", + "tap" + ], + "authorIds": [ + "8Ih1aa8f5gWUp4UB2BdhQ2iXWxJ3", + "IWykYNRvhCZBN3vEgKEbBPOR3Oc2" + ], + "changelog": [ + { + "version": "2.0.0", + "breaking": [ + "- Mouse button value now needs quotes", + "- The double-click sensitivity now relies on the device settings" + ] + } + ], + "dependencies": [], + "globalVariables": [ + { + "name": "MaxDelay", + "type": "number", + "value": 0.5 + } + ], + "sceneVariables": [], + "eventsFunctions": [ + { + "fullName": "", + "functionType": "Action", + "name": "onFirstSceneLoaded", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "eventsFunctionContext.returnValue =", - " gdjs.__raycaster3DExtension.raycaster.recastFromCamera(", - " eventsFunctionContext.getObjectsLists(\"Object\"),", - " objects,", - " eventsFunctionContext.getArgument(\"PointerX\"),", - " eventsFunctionContext.getArgument(\"PointerY\"),", - " eventsFunctionContext.getArgument(\"DistanceMax\")", - " );", + "class ClickCounter {", + " // Multiple clicks", + " multipleClickButton = -1;", + " count = 0;", + "", + " // Simple click", + " lastButton = -1;", + " lastPointerId = 0;", + " lastTime = 0;", + " hasMoved = false;", + " simpleClickButton = -1;", + "", + " constructor() {", + " window.addEventListener(", + " 'click',", + " event => {", + " if (event.detail > 1) {", + " this.multipleClickButton = convertHtmlMouseButtonToInputManagerMouseButton(event.button);", + " this.count = event.detail;", + " }", + " }", + " );", + "", + " // The 'click' event doesn't do any constraint on the 1st click.", + " // It doesn't allow to differenciate a dragging from a click.", + " // So, we check it manually.", + "", + " window.addEventListener(", + " 'pointerdown',", + " event => {", + " this.lastButton = event.button;", + " this.lastPointerId = event.pointerId;", + " this.lastTime = Date.now();", + " this.hasMoved = false;", + " }", + " );", + "", + " window.addEventListener(", + " 'pointermove',", + " event => {", + " if (event.pointerId === this.lastPointerId) {", + " this.hasMoved = true;", + " }", + " }", + " );", + "", + " window.addEventListener(", + " 'pointerup',", + " (event) => {", + " if (event.button === this.lastButton &&", + " event.pointerId === this.lastPointerId &&", + " (!this.hasMoved || Date.now() - this.lastTime < 500)) {", + " this.simpleClickButton = convertHtmlMouseButtonToInputManagerMouseButton(event.button);", + " this.lastButton = -1;", + " }", + " }", + " );", + "", + " }", + "", + " reset() {", + " this.multipleClickButton = -1;", + " this.simpleClickButton = -1;", + " }", + "", + " hasClicked(buttonName, clickCount) {", + " const button = gdjs.evtTools.input.mouseButtonsNameToCode[buttonName];", + " if (clickCount === 1) {", + " return button === this.simpleClickButton;", + " }", + " else {", + " return button === this.multipleClickButton && clickCount === this.count", + " }", + " }", + "}", + "", + "// Converts HTML mouse button to InputManager mouse button.", + "// This function is used to align HTML button values with GDevelop 3 C++ SFML Mouse button enum values,", + "// notably the middle and right buttons.", + "function convertHtmlMouseButtonToInputManagerMouseButton(button) {", + " switch (button) {", + " case 1: // Middle button", + " return gdjs.InputManager.MOUSE_MIDDLE_BUTTON;", + " case 2: // Right button", + " return gdjs.InputManager.MOUSE_RIGHT_BUTTON;", + " }", + " return button;", + "}", + "", + "gdjs._DoubleClickExtension = { clickCounter: new ClickCounter() };", "" ], - "parameterObjects": "Object", + "parameterObjects": "", "useStrict": true, "eventsSheetExpanded": true } ], - "parameters": [ - { - "description": "Objects to test against the ray", - "name": "Object", - "type": "objectList" - }, - { - "description": "X position on the screen (from 0 to 1)", - "name": "PointerX", - "type": "expression" - }, - { - "description": "Y position on the screen (from 0 to 1)", - "name": "PointerY", - "type": "expression" - }, - { - "description": "Ray maximum distance (in pixels)", - "name": "DistanceMax", - "type": "expression" - } - ], + "parameters": [], "objectGroups": [] }, { - "description": "the last recast intersection distance.", - "fullName": "Last recast distance", - "functionType": "ExpressionAndCondition", - "name": "Distance", - "sentence": "the last recast intersection distance", + "fullName": "", + "functionType": "Action", + "name": "onScenePostEvents", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": "eventsFunctionContext.returnValue = gdjs.__raycaster3DExtension.raycaster.lastDistance;", + "inlineCode": [ + "const { clickCounter } = gdjs._DoubleClickExtension;\r", + "\r", + "clickCounter.reset();\r", + "" + ], "parameterObjects": "", "useStrict": true, "eventsSheetExpanded": false } ], - "expressionType": { - "type": "expression" - }, "parameters": [], "objectGroups": [] }, { - "description": "Return the last recast intersection position on X axis.", - "fullName": "Last recast X intersection", - "functionType": "Expression", - "name": "IntersectionX", - "sentence": "", + "description": "Check if the specified mouse button is clicked twice in a short amount of time.", + "fullName": "Double-clicked (or double-tapped)", + "functionType": "Condition", + "name": "HasDoubleClicked", + "sentence": "_PARAM1_ mouse button is double-clicked", "events": [ { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": "eventsFunctionContext.returnValue = gdjs.__raycaster3DExtension.raycaster.lastPositionX;", - "parameterObjects": "", - "useStrict": true, - "eventsSheetExpanded": false + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "DoubleClick::HasClicked" + }, + "parameters": [ + "", + "MouseButton", + "2", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] } ], - "expressionType": { - "type": "expression" - }, - "parameters": [], - "objectGroups": [] - }, - { - "description": "Return the last recast intersection position on Y axis.", - "fullName": "Last recast Y intersection", - "functionType": "Expression", - "name": "IntersectionY", - "sentence": "", - "events": [ + "parameters": [ { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": "eventsFunctionContext.returnValue = gdjs.__raycaster3DExtension.raycaster.lastPositionY;", - "parameterObjects": "", - "useStrict": true, - "eventsSheetExpanded": false + "description": "Mouse button to track", + "longDescription": "As touch devices do not have middle/right tap equivalents, you will need to account for this within your events if you're not using the left mouse button and building for touch devices.", + "name": "MouseButton", + "type": "mouseButton" } ], - "expressionType": { - "type": "expression" - }, - "parameters": [], "objectGroups": [] }, { - "description": "Return the last recast intersection position on Z axis.", - "fullName": "Last recast Z intersection", - "functionType": "Expression", - "name": "IntersectionZ", - "sentence": "", + "description": "Check if the specified mouse button is clicked.", + "fullName": "Clicked (or tapped)", + "functionType": "Condition", + "name": "HasSimpleClicked", + "sentence": "_PARAM1_ mouse button is clicked", "events": [ { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": "eventsFunctionContext.returnValue = gdjs.__raycaster3DExtension.raycaster.lastPositionZ;", - "parameterObjects": "", - "useStrict": true, - "eventsSheetExpanded": false + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "DoubleClick::HasClicked" + }, + "parameters": [ + "", + "MouseButton", + "1", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] } ], - "expressionType": { - "type": "expression" - }, - "parameters": [], - "objectGroups": [] - }, - { - "description": "Return the last recast intersection normal on X axis.", - "fullName": "Last recast X normal", - "functionType": "Expression", - "name": "NormalX", - "sentence": "", - "events": [ + "parameters": [ { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": "eventsFunctionContext.returnValue = gdjs.__raycaster3DExtension.raycaster.lastNormalX;", - "parameterObjects": "", - "useStrict": true, - "eventsSheetExpanded": false + "description": "Mouse button to track", + "longDescription": "As touch devices do not have middle/right tap equivalents, you will need to account for this within your events if you're not using the left mouse button and building for touch devices.", + "name": "MouseButton", + "type": "mouseButton" } ], - "expressionType": { - "type": "expression" - }, - "parameters": [], "objectGroups": [] }, { - "description": "Return the last recast intersection normal on X axis.", - "fullName": "Last recast X normal", - "functionType": "Expression", - "name": "NormalY", - "sentence": "", + "description": "Check if the specified mouse button is clicked.", + "fullName": "Clicked (or tapped)", + "functionType": "Condition", + "name": "HasClicked", + "private": true, + "sentence": "_PARAM1_ mouse button is clicked _PARAM2_ times", "events": [ { "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": "eventsFunctionContext.returnValue = gdjs.__raycaster3DExtension.raycaster.lastNormalY;", + "inlineCode": [ + "const { clickCounter } = gdjs._DoubleClickExtension;", + "", + "const buttonName = eventsFunctionContext.getArgument(\"MouseButton\");", + "const clickCount = eventsFunctionContext.getArgument(\"ClickCount\");", + "", + "eventsFunctionContext.returnValue = clickCounter.hasClicked(buttonName, clickCount);" + ], "parameterObjects": "", "useStrict": true, - "eventsSheetExpanded": false + "eventsSheetExpanded": true } ], - "expressionType": { - "type": "expression" - }, - "parameters": [], - "objectGroups": [] - }, - { - "description": "Return the last recast intersection normal on Z axis.", - "fullName": "Last recast Z normal", - "functionType": "Expression", - "name": "NormalZ", - "sentence": "", - "events": [ + "parameters": [ { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": "eventsFunctionContext.returnValue = gdjs.__raycaster3DExtension.raycaster.lastNormalZ;", - "parameterObjects": "", - "useStrict": true, - "eventsSheetExpanded": false + "description": "Mouse button to track", + "longDescription": "As touch devices do not have middle/right tap equivalents, you will need to account for this within your events if you're not using the left mouse button and building for touch devices.", + "name": "MouseButton", + "type": "mouseButton" + }, + { + "description": "Click count", + "name": "ClickCount", + "type": "expression" } ], - "expressionType": { - "type": "expression" - }, - "parameters": [], "objectGroups": [] } ], @@ -31670,410 +31877,412 @@ "eventsBasedObjects": [] }, { - "author": "Silver-Streak", + "author": "", "category": "Input", "extensionNamespace": "", - "fullName": "Double-click and tap", + "fullName": "Screen Orientation Checker", "gdevelopVersion": ">=5.5.222", "helpPath": "", - "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyMy4wLjMsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iSWNvbnMiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB2aWV3Qm94PSIwIDAgMzIgMzIiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDMyIDMyOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8c3R5bGUgdHlwZT0idGV4dC9jc3MiPg0KCS5zdDB7ZmlsbDpub25lO3N0cm9rZTojMDAwMDAwO3N0cm9rZS13aWR0aDoyO3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1saW5lam9pbjpyb3VuZDtzdHJva2UtbWl0ZXJsaW1pdDoxMDt9DQoJLnN0MXtmaWxsOm5vbmU7c3Ryb2tlOiMwMDAwMDA7c3Ryb2tlLXdpZHRoOjI7c3Ryb2tlLWxpbmVqb2luOnJvdW5kO3N0cm9rZS1taXRlcmxpbWl0OjEwO30NCjwvc3R5bGU+DQo8bGluZSBjbGFzcz0ic3QwIiB4MT0iMTYiIHkxPSIzIiB4Mj0iMTYiIHkyPSI2Ii8+DQo8bGluZSBjbGFzcz0ic3QwIiB4MT0iMTYiIHkxPSIxMCIgeDI9IjE2IiB5Mj0iMTMiLz4NCjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik0xNiwxMEwxNiwxMGMtMS4xLDAtMi0wLjktMi0ydjBjMC0xLjEsMC45LTIsMi0yaDBjMS4xLDAsMiwwLjksMiwydjBDMTgsOS4xLDE3LjEsMTAsMTYsMTB6Ii8+DQo8cGF0aCBjbGFzcz0ic3QwIiBkPSJNNywxNC4xYzIuMy0wLjcsNS41LTEuMSw5LTEuMWMzLjUsMCw2LjcsMC40LDksMS4xIi8+DQo8cGF0aCBjbGFzcz0ic3QwIiBkPSJNMTYsMjlMMTYsMjljLTUsMC05LTQtOS05di01LjlWOWMwLTMuMywyLjctNiw2LTZoNmMzLjMsMCw2LDIuNyw2LDZ2MTFDMjUsMjUsMjEsMjksMTYsMjl6Ii8+DQo8L3N2Zz4NCg==", - "name": "DoubleClick", - "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/Line Hero Pack/Master/SVG/Computers and Hardware/Computers and Hardware_mouse_wireless_pc.svg", - "shortDescription": "Check for a double-click or a tap.", - "version": "2.0.0", - "description": [ - "Check for a double-click with a mouse, or a tap and double-click on a touchscreen.", - "", - "Please note: Touch devices do not have alternatives for middle/right clicks. Taps on a touch device will get counted for _any_ use of these conditions, so you should either design your controls accordingly, or build out separate events if the device has a touch screen.", - "", - "Breaking changes from 2.0.0:", - "- Mouse button value now needs quotes", - "- The double-click sensitivity now relies on the device settings" - ], + "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0ibWRpLXNjcmVlbi1yb3RhdGlvbiIgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0IiB2aWV3Qm94PSIwIDAgMjQgMjQiPjxwYXRoIGQ9Ik03LjUsMjEuNUM0LjI1LDE5Ljk0IDEuOTEsMTYuNzYgMS41NSwxM0gwLjA1QzAuNTYsMTkuMTYgNS43MSwyNCAxMiwyNEwxMi42NiwyMy45N0w4Ljg1LDIwLjE2TTE0LjgzLDIxLjE5TDIuODEsOS4xN0w5LjE3LDIuODFMMjEuMTksMTQuODNNMTAuMjMsMS43NUM5LjY0LDEuMTYgOC42OSwxLjE2IDguMTEsMS43NUwxLjc1LDguMTFDMS4xNiw4LjcgMS4xNiw5LjY1IDEuNzUsMTAuMjNMMTMuNzcsMjIuMjVDMTQuMzYsMjIuODQgMTUuMzEsMjIuODQgMTUuODksMjIuMjVMMjIuMjUsMTUuODlDMjIuODQsMTUuMyAyMi44NCwxNC4zNSAyMi4yNSwxMy43N0wxMC4yMywxLjc1TTE2LjUsMi41QzE5Ljc1LDQuMDcgMjIuMDksNy4yNCAyMi40NSwxMUgyMy45NUMyMy40NCw0Ljg0IDE4LjI5LDAgMTIsMEwxMS4zNCwwLjAzTDE1LjE1LDMuODRMMTYuNSwyLjVaIiAvPjwvc3ZnPg==", + "name": "ScreenOrientationChecker", + "previewIconUrl": "https://asset-resources.gdevelop.io/public-resources/Icons/0126888931a4a4f82bb2824df9f096347ace1c47f510c44df42aa8dc9e49e24a_screen-rotation.svg", + "shortDescription": "Display a customizable screen asking the user to rotate their phone/tablet if not in the right orientation.", + "version": "0.2.0", + "description": "Display a customizable screen asking the user to rotate their phone/tablet if not in the right orientation.", "origin": { - "identifier": "DoubleClick", - "name": "gdevelop-extension-store" - }, - "tags": [ - "mouse", - "cursor", - "pointer", - "click", - "tap" + "identifier": "ScreenOrientationChecker", + "name": "gdevelop-extension-store" + }, + "tags": [ + "screen", + "orientation" ], "authorIds": [ - "8Ih1aa8f5gWUp4UB2BdhQ2iXWxJ3", - "IWykYNRvhCZBN3vEgKEbBPOR3Oc2" + "wWP8BSlAW0UP4NeaHa2LcmmDzmH2" ], "dependencies": [], "globalVariables": [ { - "name": "MaxDelay", - "type": "number", - "value": 0.5 + "name": "TargetOrientation", + "type": "string", + "value": "" } ], "sceneVariables": [], "eventsFunctions": [ { - "fullName": "", - "functionType": "Action", - "name": "onFirstSceneLoaded", - "sentence": "", + "description": "Check if the events are running for the editor.", + "fullName": "Editor is running", + "functionType": "Condition", + "name": "IsInGameEdition", + "private": true, + "sentence": "Events are running for the editor", "events": [ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "class ClickCounter {", - " // Multiple clicks", - " multipleClickButton = -1;", - " count = 0;", - "", - " // Simple click", - " lastButton = -1;", - " lastPointerId = 0;", - " lastTime = 0;", - " hasMoved = false;", - " simpleClickButton = -1;", - "", - " constructor() {", - " window.addEventListener(", - " 'click',", - " event => {", - " if (event.detail > 1) {", - " this.multipleClickButton = convertHtmlMouseButtonToInputManagerMouseButton(event.button);", - " this.count = event.detail;", - " }", - " }", - " );", - "", - " // The 'click' event doesn't do any constraint on the 1st click.", - " // It doesn't allow to differenciate a dragging from a click.", - " // So, we check it manually.", - "", - " window.addEventListener(", - " 'pointerdown',", - " event => {", - " this.lastButton = event.button;", - " this.lastPointerId = event.pointerId;", - " this.lastTime = Date.now();", - " this.hasMoved = false;", - " }", - " );", - "", - " window.addEventListener(", - " 'pointermove',", - " event => {", - " if (event.pointerId === this.lastPointerId) {", - " this.hasMoved = true;", - " }", - " }", - " );", - "", - " window.addEventListener(", - " 'pointerup',", - " (event) => {", - " if (event.button === this.lastButton &&", - " event.pointerId === this.lastPointerId &&", - " (!this.hasMoved || Date.now() - this.lastTime < 500)) {", - " this.simpleClickButton = convertHtmlMouseButtonToInputManagerMouseButton(event.button);", - " this.lastButton = -1;", - " }", - " }", - " );", - "", - " }", - "", - " reset() {", - " this.multipleClickButton = -1;", - " this.simpleClickButton = -1;", - " }", - "", - " hasClicked(buttonName, count) {", - " const button = gdjs.evtTools.input.mouseButtonsNameToCode[buttonName];", - " if (count === 1) {", - " return button === this.simpleClickButton;", - " }", - " else {", - " return button === this.multipleClickButton && clickCount === this.count", - " }", - " }", - "}", - "", - "// Converts HTML mouse button to InputManager mouse button.", - "// This function is used to align HTML button values with GDevelop 3 C++ SFML Mouse button enum values,", - "// notably the middle and right buttons.", - "function convertHtmlMouseButtonToInputManagerMouseButton(button) {", - " switch (button) {", - " case 1: // Middle button", - " return gdjs.InputManager.MOUSE_MIDDLE_BUTTON;", - " case 2: // Right button", - " return gdjs.InputManager.MOUSE_RIGHT_BUTTON;", - " }", - " return button;", - "}", - "", - "gdjs._DoubleClickExtension = { clickCounter: new ClickCounter() };", - "" + "const game = runtimeScene.getGame();\r", + "eventsFunctionContext.returnValue = game.isInGameEdition && game.isInGameEdition();" ], "parameterObjects": "", "useStrict": true, - "eventsSheetExpanded": true + "eventsSheetExpanded": false } ], "parameters": [], "objectGroups": [] }, { - "fullName": "", - "functionType": "Action", - "name": "onScenePostEvents", + "fullName": "Get game target orientation", + "functionType": "StringExpression", + "name": "ProjectOrientation", + "private": true, "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "const { clickCounter } = gdjs._DoubleClickExtension;\r", - "\r", - "clickCounter.reset();\r", - "" - ], + "inlineCode": "eventsFunctionContext.returnValue = runtimeScene.getGame().getGameData().properties.orientation;", "parameterObjects": "", "useStrict": true, "eventsSheetExpanded": false } ], + "expressionType": { + "type": "string" + }, "parameters": [], "objectGroups": [] }, { - "description": "Check if the specified mouse button is clicked twice in a short amount of time.", - "fullName": "Double-clicked (or double-tapped)", - "functionType": "Condition", - "name": "HasDoubleClicked", - "sentence": "_PARAM1_ mouse button is double-clicked", + "fullName": "", + "functionType": "Action", + "name": "onFirstSceneLoaded", + "sentence": "", "events": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "TargetOrientation", + "=", + "ScreenOrientationChecker::ProjectOrientation()" + ] + } + ] + } + ], + "parameters": [], + "objectGroups": [] + } + ], + "eventsBasedBehaviors": [], + "eventsBasedObjects": [ + { + "areaMaxX": 400, + "areaMaxY": 200, + "areaMaxZ": 0, + "areaMinX": 0, + "areaMinY": 0, + "areaMinZ": 0, + "defaultName": "", + "description": "Automatically display a screen asking the player to rotate their screen if needed - on mobile phones and tablets only. Set up Anchor behavior on this object so that top/bottom/left/right edges are anchored to the screen top/bottom/left/right.", + "fullName": "Screen Orientation Checker", + "isInnerAreaFollowingParentSize": true, + "isUsingLegacyInstancesRenderer": false, + "name": "ScreenOrientationChecker", + "objects": [ + { + "assetStoreId": "", + "bold": true, + "italic": false, + "name": "Text", + "smoothed": true, + "type": "TextObject::Text", + "underlined": false, + "variables": [], + "effects": [], + "behaviors": [ + { + "name": "Anchor", + "type": "AnchorBehavior::AnchorBehavior", + "bottomEdgeAnchor": 0, + "leftEdgeAnchor": 4, + "relativeToOriginalWindowSize": true, + "rightEdgeAnchor": 0, + "topEdgeAnchor": 4, + "useLegacyBottomAndRightAnchors": false + }, + { + "name": "Tween", + "type": "Tween::TweenBehavior" + } + ], + "string": "Rotate screen to play", + "font": "", + "textAlignment": "center", + "characterSize": 30, + "color": { + "b": 255, + "g": 255, + "r": 255 + }, + "content": { + "bold": true, + "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": "Rotate screen to play", + "font": "", + "textAlignment": "center", + "verticalTextAlignment": "top", + "characterSize": 30, + "lineHeight": 0, + "color": "255;255;255" + } + }, + { + "assetStoreId": "", + "name": "BackgroundPainter", + "type": "PrimitiveDrawing::Drawer", + "variables": [], + "effects": [], + "behaviors": [], + "fillOpacity": 255, + "outlineSize": 0, + "outlineOpacity": 255, + "absoluteCoordinates": true, + "clearBetweenFrames": true, + "antialiasing": "none", + "fillColor": { + "r": 0, + "g": 0, + "b": 0 + }, + "outlineColor": { + "r": 0, + "g": 0, + "b": 0 + } + }, + { + "adaptCollisionMaskAutomatically": true, + "assetStoreId": "", + "name": "Icon", + "type": "Sprite", + "updateIfNotVisible": false, + "variables": [], + "effects": [], + "behaviors": [ { - "type": { - "value": "DoubleClick::HasClicked" - }, - "parameters": [ - "", - "MouseButton", - "2", - "" - ] + "name": "Anchor", + "type": "AnchorBehavior::AnchorBehavior", + "bottomEdgeAnchor": 0, + "leftEdgeAnchor": 4, + "topEdgeAnchor": 4, + "relativeToOriginalWindowSize": true, + "rightEdgeAnchor": 0, + "useLegacyBottomAndRightAnchors": false + }, + { + "name": "Tween", + "type": "Tween::TweenBehavior" } ], - "actions": [ + "animations": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" + "name": "", + "useMultipleDirections": false, + "directions": [ + { + "looping": false, + "timeBetweenFrames": 0.08, + "sprites": [ + { + "hasCustomCollisionMask": true, + "image": "rotate-screen-icon.png", + "points": [], + "originPoint": { + "name": "origine", + "x": 52.5, + "y": 56.5 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [ + [ + { + "x": 0, + "y": 1 + }, + { + "x": 105, + "y": 1 + }, + { + "x": 105, + "y": 113 + }, + { + "x": 0, + "y": 113 + } + ] + ] + } + ] + } ] } ] } ], - "parameters": [ - { - "description": "Mouse button to track", - "longDescription": "As touch devices do not have middle/right tap equivalents, you will need to account for this within your events if you're not using the left mouse button and building for touch devices.", - "name": "MouseButton", - "type": "mouseButton" - } - ], - "objectGroups": [] - }, - { - "description": "Check if the specified mouse button is clicked.", - "fullName": "Clicked (or tapped)", - "functionType": "Condition", - "name": "HasSimpleClicked", - "sentence": "_PARAM1_ mouse button is clicked", - "events": [ + "objectsFolderStructure": { + "folderName": "__ROOT", + "children": [ + { + "objectName": "Text" + }, + { + "objectName": "BackgroundPainter" + }, + { + "objectName": "Icon" + } + ] + }, + "objectsGroups": [], + "layers": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "DoubleClick::HasClicked" - }, - "parameters": [ - "", - "MouseButton", - "1", - "" - ] - } - ], - "actions": [ + "ambientLightColorB": 200, + "ambientLightColorG": 200, + "ambientLightColorR": 200, + "camera3DFarPlaneDistance": 10000, + "camera3DFieldOfView": 45, + "camera3DNearPlaneDistance": 3, + "cameraType": "", + "followBaseLayerCamera": false, + "isLightingLayer": false, + "isLocked": false, + "name": "", + "renderingType": "", + "visibility": true, + "cameras": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "defaultSize": true, + "defaultViewport": true, + "height": 0, + "viewportBottom": 1, + "viewportLeft": 0, + "viewportRight": 1, + "viewportTop": 0, + "width": 0 } - ] - } - ], - "parameters": [ - { - "description": "Mouse button to track", - "longDescription": "As touch devices do not have middle/right tap equivalents, you will need to account for this within your events if you're not using the left mouse button and building for touch devices.", - "name": "MouseButton", - "type": "mouseButton" - } - ], - "objectGroups": [] - }, - { - "description": "Check if the specified mouse button is clicked.", - "fullName": "Clicked (or tapped)", - "functionType": "Condition", - "name": "HasClicked", - "private": true, - "sentence": "_PARAM1_ mouse button is clicked _PARAM2_ times", - "events": [ - { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "const { clickCounter } = gdjs._DoubleClickExtension;", - "", - "const buttonName = eventsFunctionContext.getArgument(\"MouseButton\");", - "const clickCount = eventsFunctionContext.getArgument(\"ClickCount\");", - "", - "eventsFunctionContext.returnValue = clickCounter.hasClicked(buttonName, clickCount);" ], - "parameterObjects": "", - "useStrict": true, - "eventsSheetExpanded": true + "effects": [] } ], - "parameters": [ - { - "description": "Mouse button to track", - "longDescription": "As touch devices do not have middle/right tap equivalents, you will need to account for this within your events if you're not using the left mouse button and building for touch devices.", - "name": "MouseButton", - "type": "mouseButton" - }, + "instances": [ { - "description": "Click count", - "name": "ClickCount", - "type": "expression" - } - ], - "objectGroups": [] - } - ], - "eventsBasedBehaviors": [], - "eventsBasedObjects": [] - }, - { - "author": "", - "category": "Input", - "extensionNamespace": "", - "fullName": "Screen Orientation Checker", - "gdevelopVersion": ">=5.5.222", - "helpPath": "", - "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0ibWRpLXNjcmVlbi1yb3RhdGlvbiIgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0IiB2aWV3Qm94PSIwIDAgMjQgMjQiPjxwYXRoIGQ9Ik03LjUsMjEuNUM0LjI1LDE5Ljk0IDEuOTEsMTYuNzYgMS41NSwxM0gwLjA1QzAuNTYsMTkuMTYgNS43MSwyNCAxMiwyNEwxMi42NiwyMy45N0w4Ljg1LDIwLjE2TTE0LjgzLDIxLjE5TDIuODEsOS4xN0w5LjE3LDIuODFMMjEuMTksMTQuODNNMTAuMjMsMS43NUM5LjY0LDEuMTYgOC42OSwxLjE2IDguMTEsMS43NUwxLjc1LDguMTFDMS4xNiw4LjcgMS4xNiw5LjY1IDEuNzUsMTAuMjNMMTMuNzcsMjIuMjVDMTQuMzYsMjIuODQgMTUuMzEsMjIuODQgMTUuODksMjIuMjVMMjIuMjUsMTUuODlDMjIuODQsMTUuMyAyMi44NCwxNC4zNSAyMi4yNSwxMy43N0wxMC4yMywxLjc1TTE2LjUsMi41QzE5Ljc1LDQuMDcgMjIuMDksNy4yNCAyMi40NSwxMUgyMy45NUMyMy40NCw0Ljg0IDE4LjI5LDAgMTIsMEwxMS4zNCwwLjAzTDE1LjE1LDMuODRMMTYuNSwyLjVaIiAvPjwvc3ZnPg==", - "name": "ScreenOrientationChecker", - "previewIconUrl": "https://asset-resources.gdevelop.io/public-resources/Icons/0126888931a4a4f82bb2824df9f096347ace1c47f510c44df42aa8dc9e49e24a_screen-rotation.svg", - "shortDescription": "Display a customizable screen asking the user to rotate their phone/tablet if not in the right orientation.", - "version": "0.1.0", - "description": "Display a customizable screen asking the user to rotate their phone/tablet if not in the right orientation.", - "origin": { - "identifier": "ScreenOrientationChecker", - "name": "gdevelop-extension-store" - }, - "tags": [ - "screen", - "orientation" - ], - "authorIds": [ - "wWP8BSlAW0UP4NeaHa2LcmmDzmH2" - ], - "dependencies": [], - "globalVariables": [ - { - "name": "TargetOrientation", - "type": "string", - "value": "" - } - ], - "sceneVariables": [], - "eventsFunctions": [ - { - "fullName": "Get game target orientation", - "functionType": "StringExpression", - "name": "ProjectOrientation", - "private": true, - "sentence": "", - "events": [ + "angle": 0, + "customSize": true, + "depth": 1, + "height": 35, + "keepRatio": true, + "layer": "", + "name": "Text", + "persistentUuid": "65c003ea-19c0-4f18-a189-a02a24378f35", + "width": 207, + "x": 104, + "y": 120, + "zOrder": 15, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": "eventsFunctionContext.returnValue = runtimeScene.getGame().getGameData().properties.orientation;", - "parameterObjects": "", - "useStrict": true, - "eventsSheetExpanded": false + "angle": 0, + "customSize": false, + "height": 0, + "keepRatio": true, + "layer": "", + "name": "BackgroundPainter", + "persistentUuid": "49ff4576-6406-41de-a43b-1355529d61fe", + "width": 0, + "x": 38, + "y": 17, + "zOrder": 14, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "keepRatio": true, + "layer": "", + "name": "Icon", + "persistentUuid": "39cbfc66-13f4-43dc-b6ef-2bda83153277", + "width": 0, + "x": 204, + "y": 64, + "zOrder": 16, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] } ], - "expressionType": { - "type": "string" - }, - "parameters": [], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "Action", - "name": "onFirstSceneLoaded", - "sentence": "", - "events": [ + "eventsFunctions": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ + "fullName": "", + "functionType": "Action", + "name": "onCreated", + "sentence": "", + "events": [ { - "type": { - "value": "SetStringVariable" - }, - "parameters": [ - "TargetOrientation", - "=", - "ScreenOrientationChecker::ProjectOrientation()" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "PrimitiveDrawing::ClearBetweenFrames" + }, + "parameters": [ + "BackgroundPainter", + "" + ] + } ] } - ] - } - ], - "parameters": [], - "objectGroups": [] - } - ], - "eventsBasedBehaviors": [], - "eventsBasedObjects": [ - { - "areaMaxX": 400, - "areaMaxY": 200, - "areaMaxZ": 0, - "areaMinX": 0, - "areaMinY": 0, - "areaMinZ": 0, - "defaultName": "", - "description": "Automatically display a screen asking the player to rotate their screen if needed - on mobile phones and tablets only. Set up Anchor behavior on this object so that top/bottom/left/right edges are anchored to the screen top/bottom/left/right.", - "fullName": "Screen Orientation Checker", - "isInnerAreaFollowingParentSize": true, - "isUsingLegacyInstancesRenderer": false, - "name": "ScreenOrientationChecker", - "eventsFunctions": [ + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "ScreenOrientationChecker::ScreenOrientationChecker", + "type": "object" + } + ], + "objectGroups": [] + }, { "fullName": "", "functionType": "Action", @@ -32081,41 +32290,66 @@ "sentence": "", "events": [ { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 - }, - "comment": "Check if the screen must be shown" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "ScreenOrientationChecker::IsInGameEdition" + }, + "parameters": [ + "", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "ScreenOrientationChecker::ScreenOrientationChecker::DrawBackground" + }, + "parameters": [ + "Object", + "" + ] + } + ] }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "value": "SystemInfo::IsMobile" + "inverted": true, + "value": "ScreenOrientationChecker::IsInGameEdition" }, - "parameters": [] + "parameters": [ + "", + "" + ] } ], "actions": [], "events": [ + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Check if the screen must be shown" + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "value": "BuiltinCommonInstructions::CompareNumbers" + "value": "SystemInfo::IsMobile" }, - "parameters": [ - "SceneWindowWidth()", - ">", - "SceneWindowHeight()" - ] + "parameters": [] } ], "actions": [], @@ -32125,24 +32359,69 @@ "conditions": [ { "type": { - "value": "StringVariable" + "value": "BuiltinCommonInstructions::CompareNumbers" }, "parameters": [ - "TargetOrientation", - "=", - "\"portrait\"" + "SceneWindowWidth()", + ">", + "SceneWindowHeight()" ] } ], - "actions": [ + "actions": [], + "events": [ { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsShown", - "False", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "TargetOrientation", + "=", + "\"portrait\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsShown", + "False", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "TargetOrientation", + "!=", + "\"portrait\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsShown", + "False", + "" + ] + } ] } ] @@ -32152,364 +32431,366 @@ "conditions": [ { "type": { - "value": "StringVariable" + "value": "BuiltinCommonInstructions::CompareNumbers" }, "parameters": [ - "TargetOrientation", - "!=", - "\"portrait\"" + "SceneWindowWidth()", + "<=", + "SceneWindowHeight()" ] } ], - "actions": [ + "actions": [], + "events": [ { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsShown", - "False", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "TargetOrientation", + "=", + "\"landscape\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsShown", + "False", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "TargetOrientation", + "=", + "\"portrait\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsShown", + "False", + "" + ] + } ] } ] } ] }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Show/hide the screen as needed" + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "value": "BuiltinCommonInstructions::CompareNumbers" + "value": "BuiltinCommonInstructions::Or" }, - "parameters": [ - "SceneWindowWidth()", - "<=", - "SceneWindowHeight()" - ] - } - ], - "actions": [], - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "parameters": [], + "subInstructions": [ { "type": { - "value": "StringVariable" + "value": "BooleanVariable" }, "parameters": [ - "TargetOrientation", - "=", - "\"landscape\"" + "IsShown", + "True", + "" ] - } - ], - "actions": [ + }, { "type": { - "value": "SetBooleanVariable" + "value": "BooleanVariable" }, "parameters": [ - "IsShown", - "False", + "IsForceShown", + "True", "" ] } ] + } + ], + "actions": [ + { + "type": { + "value": "ScreenOrientationChecker::ScreenOrientationChecker::DrawBackground" + }, + "parameters": [ + "Object", + "" + ] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "TargetOrientation", - "=", - "\"portrait\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsShown", - "False", - "" - ] - } + "type": { + "value": "Montre" + }, + "parameters": [ + "Object", + "" ] } ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 - }, - "comment": "Show/hide the screen as needed" - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + }, { - "type": { - "value": "BuiltinCommonInstructions::Or" - }, - "parameters": [], - "subInstructions": [ + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { "type": { - "value": "ScreenOrientationChecker::ScreenOrientationChecker::PropertyIsShown" + "inverted": true, + "value": "BooleanVariable" }, "parameters": [ - "Object" + "IsShown", + "True", + "" ] }, { "type": { - "value": "ScreenOrientationChecker::ScreenOrientationChecker::PropertyIsForceShown" + "inverted": true, + "value": "BooleanVariable" + }, + "parameters": [ + "IsForceShown", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "Cache" }, "parameters": [ "Object" ] } ] - } - ], - "actions": [ - { - "type": { - "value": "PrimitiveDrawing::FillColor" - }, - "parameters": [ - "BackgroundPainter", - "BackgroundColor" - ] - }, - { - "type": { - "value": "PrimitiveDrawing::RoundedRectangle" - }, - "parameters": [ - "BackgroundPainter", - "Padding", - "Padding", - "Object.Width()-Padding", - "Object.Height()-Padding", - "CornerRadius" - ] - }, - { - "type": { - "value": "Montre" - }, - "parameters": [ - "Object", - "" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "inverted": true, - "value": "BooleanVariable" - }, - "parameters": [ - "IsShown", - "True", - "" - ] }, { - "type": { - "inverted": true, - "value": "BooleanVariable" - }, - "parameters": [ - "IsForceShown", - "True", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "Cache" - }, - "parameters": [ - "Object" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "MettreY" - }, - "parameters": [ - "Icon", - "=", - "Text.Y() - 100" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 - }, - "comment": "Animate the icon" - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "inverted": true, - "value": "Tween::Exists" - }, - "parameters": [ - "Icon", - "Tween", - "\"Rotate\"" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "MettreY" + }, + "parameters": [ + "Icon", + "=", + "Text.Y() - 100" + ] + } ] }, { - "type": { - "inverted": true, - "value": "Tween::Exists" - }, - "parameters": [ - "Icon", - "Tween", - "\"RotateBack\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "Tween::TweenBehavior::AddObjectAngleTween2" - }, - "parameters": [ - "Icon", - "Tween", - "\"Rotate\"", - "8", - "\"easeInOutQuad\"", - "2", - "" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "Tween::HasFinished" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 }, - "parameters": [ - "Icon", - "Tween", - "\"RotateBack\"" + "comment": "Animate the icon" + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "Tween::Exists" + }, + "parameters": [ + "Icon", + "Tween", + "\"Rotate\"" + ] + }, + { + "type": { + "inverted": true, + "value": "Tween::Exists" + }, + "parameters": [ + "Icon", + "Tween", + "\"RotateBack\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "Tween::TweenBehavior::AddObjectAngleTween2" + }, + "parameters": [ + "Icon", + "Tween", + "\"Rotate\"", + "8", + "\"easeInOutQuad\"", + "2", + "" + ] + } ] - } - ], - "actions": [ + }, { - "type": { - "value": "Tween::TweenBehavior::AddObjectAngleTween2" - }, - "parameters": [ - "Icon", - "Tween", - "\"Rotate\"", - "8", - "\"easeInOutQuad\"", - "2", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Tween::HasFinished" + }, + "parameters": [ + "Icon", + "Tween", + "\"RotateBack\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "Tween::TweenBehavior::AddObjectAngleTween2" + }, + "parameters": [ + "Icon", + "Tween", + "\"Rotate\"", + "8", + "\"easeInOutQuad\"", + "2", + "" + ] + }, + { + "type": { + "value": "Tween::RemoveTween" + }, + "parameters": [ + "Icon", + "Tween", + "\"RotateBack\"" + ] + } ] }, { - "type": { - "value": "Tween::RemoveTween" - }, - "parameters": [ - "Icon", - "Tween", - "\"RotateBack\"" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Tween::HasFinished" + }, + "parameters": [ + "Icon", + "Tween", + "\"Rotate\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "Tween::TweenBehavior::AddObjectAngleTween2" + }, + "parameters": [ + "Icon", + "Tween", + "\"RotateBack\"", + "-8", + "\"easeInOutQuad\"", + "2", + "" + ] + }, + { + "type": { + "value": "Tween::RemoveTween" + }, + "parameters": [ + "Icon", + "Tween", + "\"Rotate\"" + ] + } ] } ] - }, + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "ScreenOrientationChecker::ScreenOrientationChecker", + "type": "object" + } + ], + "objectGroups": [] + }, + { + "description": "Draw the background.", + "fullName": "Draw the background", + "functionType": "Action", + "name": "DrawBackground", + "private": true, + "sentence": "Draw the background of _PARAM0_", + "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "Tween::HasFinished" - }, - "parameters": [ - "Icon", - "Tween", - "\"Rotate\"" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "Tween::TweenBehavior::AddObjectAngleTween2" - }, - "parameters": [ - "Icon", - "Tween", - "\"RotateBack\"", - "-8", - "\"easeInOutQuad\"", - "2", - "" - ] - }, - { - "type": { - "value": "Tween::RemoveTween" + "value": "PrimitiveDrawing::RoundedRectangle" }, "parameters": [ - "Icon", - "Tween", - "\"Rotate\"" + "BackgroundPainter", + "Padding", + "Padding", + "Object.Width()-Padding", + "Object.Height()-Padding", + "CornerRadius" ] } ] @@ -32529,7 +32810,6 @@ "description": "Check if the screen should be forced to be shown. Use this to test the screen in your game.", "fullName": "Force show the screen", "functionType": "Condition", - "group": "Screen Orientation Checker configuration", "name": "IsForceShown", "sentence": "_PARAM0_ is forced to be shown", "events": [ @@ -32573,7 +32853,6 @@ "description": "Change if the screen should be forced to be shown. Use this to test the screen in your game.", "fullName": "Force show the screen", "functionType": "Action", - "group": "Screen Orientation Checker configuration", "name": "SetIsForceShown", "sentence": "Force _PARAM0_ to be shown: _PARAM1_", "events": [ @@ -32649,310 +32928,377 @@ } ], "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "", - "type": "Boolean", - "label": "", - "description": "", - "group": "", - "extraInformation": [], - "hidden": true, - "name": "IsShown" - }, - { - "value": "", - "type": "Boolean", - "label": "Force show the screen", - "description": "Use this to test the screen in your game", - "group": "", - "extraInformation": [], - "name": "IsForceShown" - }, - { - "value": "5", - "type": "Number", - "unit": "Pixel", - "label": "Padding", - "description": "", - "group": "Appearance", - "extraInformation": [], - "name": "Padding" - }, - { - "value": "10", - "type": "Number", - "unit": "Pixel", - "label": "Corner radius", - "description": "Corner radius for the background", - "group": "Appearance", - "extraInformation": [], - "name": "CornerRadius" }, { - "value": "0;0;0", - "type": "Color", - "label": "Background color", - "description": "", - "group": "Appearance", - "extraInformation": [], - "name": "BackgroundColor" - } - ], - "objects": [ - { - "assetStoreId": "", - "bold": true, - "italic": false, - "name": "Text", - "smoothed": true, - "type": "TextObject::Text", - "underlined": false, - "variables": [], - "effects": [], - "behaviors": [ - { - "name": "Anchor", - "type": "AnchorBehavior::AnchorBehavior", - "bottomEdgeAnchor": 0, - "leftEdgeAnchor": 4, - "relativeToOriginalWindowSize": true, - "rightEdgeAnchor": 0, - "topEdgeAnchor": 4, - "useLegacyBottomAndRightAnchors": false - }, + "description": "the message of the object.", + "fullName": "Message", + "functionType": "ExpressionAndCondition", + "name": "Message", + "sentence": "the message", + "events": [ { - "name": "Tween", - "type": "Tween::TweenBehavior" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnString" + }, + "parameters": [ + "Text.Text::Value()" + ] + } + ] } ], - "string": "Rotate screen to play", - "font": "", - "textAlignment": "center", - "characterSize": 30, - "color": { - "b": 255, - "g": 255, - "r": 255 - }, - "content": { - "bold": true, - "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": "Rotate screen to play", - "font": "", - "textAlignment": "center", - "verticalTextAlignment": "top", - "characterSize": 30, - "color": "255;255;255" - } - }, - { - "assetStoreId": "", - "name": "BackgroundPainter", - "type": "PrimitiveDrawing::Drawer", - "variables": [], - "effects": [], - "behaviors": [], - "fillOpacity": 255, - "outlineSize": 0, - "outlineOpacity": 255, - "absoluteCoordinates": true, - "clearBetweenFrames": true, - "antialiasing": "none", - "fillColor": { - "r": 0, - "g": 0, - "b": 0 + "expressionType": { + "type": "string" }, - "outlineColor": { - "r": 0, - "g": 0, - "b": 0 - } + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "ScreenOrientationChecker::ScreenOrientationChecker", + "type": "object" + } + ], + "objectGroups": [] }, { - "adaptCollisionMaskAutomatically": true, - "assetStoreId": "", - "name": "Icon", - "type": "Sprite", - "updateIfNotVisible": false, - "variables": [], - "effects": [], - "behaviors": [ + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "Message", + "name": "SetMessage", + "sentence": "", + "events": [ { - "name": "Anchor", - "type": "AnchorBehavior::AnchorBehavior", - "bottomEdgeAnchor": 0, - "leftEdgeAnchor": 4, - "topEdgeAnchor": 4, - "relativeToOriginalWindowSize": true, - "rightEdgeAnchor": 0, - "useLegacyBottomAndRightAnchors": false - }, + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "TextContainerCapability::TextContainerBehavior::SetValue" + }, + "parameters": [ + "Text", + "Text", + "=", + "Value" + ] + } + ] + } + ], + "parameters": [ { - "name": "Tween", - "type": "Tween::TweenBehavior" + "description": "Object", + "name": "Object", + "supplementaryInformation": "ScreenOrientationChecker::ScreenOrientationChecker", + "type": "object" } ], - "animations": [ + "objectGroups": [] + } + ], + "propertyDescriptors": [ + { + "value": "", + "type": "Boolean", + "label": "", + "hidden": true, + "name": "IsShown" + }, + { + "value": "", + "type": "Boolean", + "label": "Force show the screen", + "description": "Use this to test the screen in your game", + "name": "IsForceShown" + }, + { + "value": "5", + "type": "Number", + "unit": "Pixel", + "label": "Padding", + "group": "Appearance", + "name": "Padding" + }, + { + "value": "10", + "type": "Number", + "unit": "Pixel", + "label": "Corner radius", + "description": "Corner radius for the background", + "group": "Appearance", + "name": "CornerRadius" + } + ], + "variants": [ + { + "areaMaxX": 400, + "areaMaxY": 200, + "areaMaxZ": 0, + "areaMinX": 0, + "areaMinY": 0, + "areaMinZ": 0, + "assetStoreAssetId": "2743bcd6cf431c6c00cda3a59684eb152b3a09d598b799b15383e4f77daf8b37", + "assetStoreOriginalName": "Black screen orientation checker", + "name": "Black screen orientation checker", + "objects": [ + { + "assetStoreId": "", + "bold": true, + "italic": false, + "name": "Text", + "smoothed": true, + "type": "TextObject::Text", + "underlined": false, + "variables": [], + "effects": [], + "behaviors": [ + { + "name": "Anchor", + "type": "AnchorBehavior::AnchorBehavior", + "bottomEdgeAnchor": 0, + "leftEdgeAnchor": 4, + "relativeToOriginalWindowSize": true, + "rightEdgeAnchor": 0, + "topEdgeAnchor": 4, + "useLegacyBottomAndRightAnchors": false + }, + { + "name": "Tween", + "type": "Tween::TweenBehavior" + } + ], + "string": "Rotate screen to play", + "font": "", + "textAlignment": "center", + "characterSize": 30, + "color": { + "b": 255, + "g": 255, + "r": 255 + }, + "content": { + "bold": true, + "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": "Rotate screen to play", + "font": "", + "textAlignment": "center", + "verticalTextAlignment": "top", + "characterSize": 30, + "lineHeight": 0, + "color": "255;255;255" + } + }, { - "name": "", - "useMultipleDirections": false, - "directions": [ + "assetStoreId": "", + "name": "BackgroundPainter", + "type": "PrimitiveDrawing::Drawer", + "variables": [], + "effects": [], + "behaviors": [], + "fillOpacity": 255, + "outlineSize": 0, + "outlineOpacity": 255, + "absoluteCoordinates": true, + "clearBetweenFrames": true, + "antialiasing": "none", + "fillColor": { + "r": 0, + "g": 0, + "b": 0 + }, + "outlineColor": { + "r": 0, + "g": 0, + "b": 0 + } + }, + { + "adaptCollisionMaskAutomatically": true, + "assetStoreId": "", + "name": "Icon", + "type": "Sprite", + "updateIfNotVisible": false, + "variables": [], + "effects": [], + "behaviors": [ + { + "name": "Anchor", + "type": "AnchorBehavior::AnchorBehavior", + "bottomEdgeAnchor": 0, + "leftEdgeAnchor": 4, + "topEdgeAnchor": 4, + "relativeToOriginalWindowSize": true, + "rightEdgeAnchor": 0, + "useLegacyBottomAndRightAnchors": false + }, { - "looping": false, - "timeBetweenFrames": 0.08, - "sprites": [ + "name": "Tween", + "type": "Tween::TweenBehavior" + } + ], + "animations": [ + { + "name": "", + "useMultipleDirections": false, + "directions": [ { - "hasCustomCollisionMask": true, - "image": "rotate-screen-icon.png", - "points": [], - "originPoint": { - "name": "origine", - "x": 52.5, - "y": 56.5 - }, - "centerPoint": { - "automatic": true, - "name": "centre", - "x": 0, - "y": 0 - }, - "customCollisionMask": [ - [ - { - "x": 0, - "y": 1 - }, - { - "x": 105, - "y": 1 - }, - { - "x": 105, - "y": 113 + "looping": false, + "timeBetweenFrames": 0.08, + "sprites": [ + { + "hasCustomCollisionMask": true, + "image": "rotate-screen-icon.png", + "points": [], + "originPoint": { + "name": "origine", + "x": 52.5, + "y": 56.5 }, - { + "centerPoint": { + "automatic": true, + "name": "centre", "x": 0, - "y": 113 - } - ] + "y": 0 + }, + "customCollisionMask": [ + [ + { + "x": 0, + "y": 1 + }, + { + "x": 105, + "y": 1 + }, + { + "x": 105, + "y": 113 + }, + { + "x": 0, + "y": 113 + } + ] + ] + } ] } ] } ] } - ] - } - ], - "objectsFolderStructure": { - "folderName": "__ROOT", - "children": [ - { - "objectName": "Text" - }, - { - "objectName": "BackgroundPainter" + ], + "objectsFolderStructure": { + "folderName": "__ROOT", + "children": [ + { + "objectName": "Text" + }, + { + "objectName": "BackgroundPainter" + }, + { + "objectName": "Icon" + } + ] }, - { - "objectName": "Icon" - } - ] - }, - "objectsGroups": [], - "layers": [ - { - "ambientLightColorB": 200, - "ambientLightColorG": 200, - "ambientLightColorR": 200, - "camera3DFarPlaneDistance": 10000, - "camera3DFieldOfView": 45, - "camera3DNearPlaneDistance": 3, - "cameraType": "", - "followBaseLayerCamera": false, - "isLightingLayer": false, - "isLocked": false, - "name": "", - "renderingType": "", - "visibility": true, - "cameras": [ + "objectsGroups": [], + "layers": [ + { + "ambientLightColorB": 200, + "ambientLightColorG": 200, + "ambientLightColorR": 200, + "camera3DFarPlaneDistance": 10000, + "camera3DFieldOfView": 45, + "camera3DNearPlaneDistance": 3, + "cameraType": "", + "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": [] + } + ], + "instances": [ + { + "angle": 0, + "customSize": true, + "depth": 1, + "height": 35, + "keepRatio": true, + "layer": "", + "name": "Text", + "persistentUuid": "65c003ea-19c0-4f18-a189-a02a24378f35", + "width": 207, + "x": 104, + "y": 120, + "zOrder": 15, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, { - "defaultSize": true, - "defaultViewport": true, + "angle": 0, + "customSize": false, "height": 0, - "viewportBottom": 1, - "viewportLeft": 0, - "viewportRight": 1, - "viewportTop": 0, - "width": 0 + "keepRatio": true, + "layer": "", + "name": "BackgroundPainter", + "persistentUuid": "49ff4576-6406-41de-a43b-1355529d61fe", + "width": 0, + "x": 38, + "y": 17, + "zOrder": 14, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "keepRatio": true, + "layer": "", + "name": "Icon", + "persistentUuid": "39cbfc66-13f4-43dc-b6ef-2bda83153277", + "width": 0, + "x": 204, + "y": 64, + "zOrder": 16, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] } - ], - "effects": [] - } - ], - "instances": [ - { - "angle": 0, - "customSize": true, - "depth": 1, - "height": 35, - "keepRatio": true, - "layer": "", - "name": "Text", - "persistentUuid": "65c003ea-19c0-4f18-a189-a02a24378f35", - "width": 207, - "x": 104, - "y": 120, - "zOrder": 15, - "numberProperties": [], - "stringProperties": [], - "initialVariables": [] - }, - { - "angle": 0, - "customSize": false, - "height": 0, - "keepRatio": true, - "layer": "", - "name": "BackgroundPainter", - "persistentUuid": "49ff4576-6406-41de-a43b-1355529d61fe", - "width": 0, - "x": 38, - "y": 17, - "zOrder": 14, - "numberProperties": [], - "stringProperties": [], - "initialVariables": [] - }, - { - "angle": 0, - "customSize": false, - "height": 0, - "keepRatio": true, - "layer": "", - "name": "Icon", - "persistentUuid": "39cbfc66-13f4-43dc-b6ef-2bda83153277", - "width": 0, - "x": 204, - "y": 64, - "zOrder": 16, - "numberProperties": [], - "stringProperties": [], - "initialVariables": [] + ] } ] } diff --git a/examples/3d-first-person/assets/rotate-screen-icon.png b/examples/3d-first-person/assets/rotate-screen-icon.png index ba619fae3995e5576c1e1de0a994b5b3da7c39dc..a7726dee34eba34b401b26b73b5bf128ff7c26d7 100644 GIT binary patch delta 1155 zcmV-}1bqAP28{`j8Gi-<007npjm!W5010qNS#tmY3ljhU3ljkVnw%H_00citL_t(| z+U?!pwW2T(1>jc#B~St-Sb`f&sWc6&`9(FdUz!2ufn{)iP zFJiu(WD*ki`Z89$_tpJVezDjscc9w;Dee8UV~f~C+WUWt3x9BoE<;GAA1{n9Lr|{@ zqssu2^Y0f%*G5QJKfU}!SHTucgVg$YrDGSkF3j%!Io&_~OrSGcalK6LxB$k7zpdGt z>qJfWqT$~ihuFO(#CgD+!@nus0J<6ZiS%%a zkf}|^8PsuMdVjrc^u)TVX37}y=+c;8r;DCh5fD}nm|iOaRgvga*5YUmcf7|0vi#q!c*I(ogbVKXj!WbtPaQpC|t;`*$0UbAGITFauxcL)7eRfch zWg0}F+i+Pabb;3_pdyo0RG?zy-(H}hB0n}OAb6=+_+O}R$dcG1qkMjHi6KeFYy6Dy|o2u0uhKn1R@ZD2t*(P z5r{wpA`pR~fxZc3{|6Ds_>YpO0tuvZ9gW&Tt$+AYI|8Y;sne)z_~hZ9Kx)_Xw`h+? zJ%J1&g$m7X_6G$j)%Wj-%@-Yk7GIbCUdYHJ1zG|vy0+mdmtUF{Hz-in=Rx9>OQT)6 zc_@U5>MDEpP@q77iX^98EJC3y^@z=?x3#~_3>4B@oOqJuA;lMN4h06Z-Zo{cP-v^! zqJOLFQh#}JD8$`_k2-!rH1NXcxkeJ4Gh0@-dvY`XKK3?f$MHuG zs2Zfl{nW^dyusRsEy4v`R|hB-0p*)GT?B{GqujlnMkdMC44gj9;TS!Nv;W(ZrF^D3 z0(u;InLTk5rN`0nB&=|BPu2{HlVJA$Y|+*eXZzXz)Y7eTMu_FV^m-1=fl-q_y?(cF z2`6C`U1lOxY{B#?cRjJ&lb3|baOvu2spC}}%ON=ea-z)Z?* zMqugDC_atNmBAsU1(z{AT5-3YssWQGU52g&%X!B2s%Mq_v$$(=XiTc za}skxbf@G~0#nJw!Z{>~f8@5gv!W~3SS=M$839QocMjN)O*LdV9? zCxOu7>e+n%6@fxID5@S*;$Z0FH}9klXisOV_8tv}_R~*oyQATd>iB@{h2UF@UMScf z^n-rT|AlB4WM)D6e-tnrGSO7O2kh{OROJk_T_cC_UAK)$ZJ5INF{(-24+01>)f1p+ z95vCbs~;*Ya@)d8?~6laGW${nb&ANwFb!{XN5?_)8Eql8iwCYn^VL zlW!>ix;j1cC}j1fn;F`qpl#yz4yQpu5aSx+l7b+^xt6-1f3O{PW!7>1_eTdJOURK2$=wV@}4LZLO*%q^QFz=P%!X=ku;#hqe3bKyY{tK Date: Wed, 8 Oct 2025 15:18:16 +0200 Subject: [PATCH 05/12] [3D lane runner] Update the extensions --- examples/3d-lane-runner/3d-lane-runner.json | 1030 ++++++++++--------- 1 file changed, 570 insertions(+), 460 deletions(-) diff --git a/examples/3d-lane-runner/3d-lane-runner.json b/examples/3d-lane-runner/3d-lane-runner.json index 2e47f25de..dd4d37392 100644 --- a/examples/3d-lane-runner/3d-lane-runner.json +++ b/examples/3d-lane-runner/3d-lane-runner.json @@ -1,7 +1,7 @@ { "firstLayout": "Menu", "gdVersion": { - "build": 241, + "build": 242, "major": 5, "minor": 5, "revision": 0 @@ -3921,7 +3921,7 @@ "name": "Sticker", "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/sticker-outline.svg", "shortDescription": "Make objects follow the position and rotation of the object they are stuck to.", - "version": "0.5.3", + "version": "0.5.4", "description": [ "This extension can be useful to:", "- Stick accessories to moving objects", @@ -3977,8 +3977,10 @@ " 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()) {", @@ -4321,7 +4323,9 @@ " allStickers: new Set(),", "};", "// Register this object as a sticker.", - "runtimeScene._stickerExtension.allStickers.add(behavior);", + "/** @type {Set} */", + "const allStickers = runtimeScene._stickerExtension.allStickers;", + "allStickers.add(behavior);", "" ], "parameterObjects": "Object", @@ -4509,7 +4513,9 @@ "const object = objects[0];", "const behavior = object.getBehavior(behaviorName);", "", - "runtimeScene._stickerExtension.allStickers.delete(behavior._sticker);", + "/** @type {Set} */", + "const allStickers = runtimeScene._stickerExtension.allStickers;", + "allStickers.delete(behavior);", "" ], "parameterObjects": "Object", @@ -4563,7 +4569,7 @@ "name": "ParticleEmitter3D", "previewIconUrl": "https://asset-resources.gdevelop.io/public-resources/Icons/f2e5a34bf465f781866677762d385d6c8e9e8d203383f2df9a3b7e0fad6a2cb5_fire.svg", "shortDescription": "Display a large number of particles in 3D to create visual effects in a 3D game.", - "version": "2.2.0", + "version": "3.0.1", "description": [ "3D particle emitters let you create and display many small particles to simulate visual effects in your game — like fire, explosions, smoke, or dust.", "", @@ -4588,6 +4594,10 @@ "IWykYNRvhCZBN3vEgKEbBPOR3Oc2" ], "changelog": [ + { + "version": "3.0.0", + "breaking": "- the object rotates the other way around X axis." + }, { "version": "2.0.0", "breaking": "- Object properties for position and rotation have been removed. They must be set with the instance editor or the action." @@ -4631,9 +4641,7 @@ " const threeObject3D = this.get3DRendererObject();", "", " threeObject3D.rotation.set(", - " // TODO The rotation on X goes the wrong way.", - " // Increment the major and remove this sign.", - " - gdjs.toRad(this._object.getRotationX()),", + " gdjs.toRad(this._object.getRotationX()),", " gdjs.toRad(this._object.getRotationY()),", " gdjs.toRad(this._object.angle)", " );", @@ -11547,6 +11555,19 @@ "", "/** @type {gdjs.CustomRuntimeObject} */", "const object = objects[0];", + "// Force the size of the object because it doesn't contain any instance.", + "object._innerArea = {", + " min: [-16, -16, -16],", + " max: [16, 16, 16],", + " };", + "const hitbox = new gdjs.Polygon();", + "hitbox.vertices = [[-16, -16], [16, -16], [16, 16], [-16, 16]];", + "object._untransformedHitBoxes = [hitbox];", + "object._unrotatedAABB.min[0] = -16;", + "object._unrotatedAABB.min[1] = -16;", + "object._unrotatedAABB.max[0] = 16;", + "object._unrotatedAABB.max[1] = 16;", + "object._updateUntransformedHitBoxes = () => {};", "", "// Here runtimeScene is the gdjs.CustomRuntimeObjectInstanceContainer inside the custom object.", "const gameScene = object.getRuntimeScene();", @@ -16997,9 +17018,9 @@ "name": "PanelSpriteButton", "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/Line Hero Pack/Master/SVG/Interface Elements/Interface Elements_interface_ui_button_ok_cta_clock_tap.svg", "shortDescription": "A button that can be customized.", - "version": "2.0.0", + "version": "2.1.1", "description": [ - "The button can be customized with a background for each state and a label. It handles user interactions and a simple condition can be used to check if it is clicked.", + "A button that can be used for menus and most labelled buttons of a game. The button can be customized with a background for each state and a label. It handles user interactions and a simple condition can be used to check if it is clicked.", "", "There are ready-to-use buttons in the asset-store [menu buttons pack](https://editor.gdevelop.io/?initial-dialog=asset-store&asset-pack=menu-buttons-menu-buttons)." ], @@ -17023,7 +17044,30 @@ "dependencies": [], "globalVariables": [], "sceneVariables": [], - "eventsFunctions": [], + "eventsFunctions": [ + { + "description": "Check if the events are running for the editor.", + "fullName": "Editor is running", + "functionType": "Condition", + "name": "IsInGameEdition", + "private": true, + "sentence": "Events are running for the editor", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const game = runtimeScene.getGame();\r", + "eventsFunctionContext.returnValue = game.isInGameEdition && game.isInGameEdition();" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [], + "objectGroups": [] + } + ], "eventsBasedBehaviors": [ { "description": "The finite state machine used internally by the button object.", @@ -17039,59 +17083,27 @@ "sentence": "", "events": [ { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Finite state machine", - "source": "", - "type": "BuiltinCommonInstructions::Group", - "events": [ + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 + "type": { + "inverted": true, + "value": "PanelSpriteButton::IsInGameEdition" }, - "comment": "The \"Validated\" state only last one frame." - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "State", - "=", - "\"Validated\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetStringVariable" - }, - "parameters": [ - "State", - "=", - "\"Idle\"" - ] - } + "parameters": [ + "", + "" ] - }, + } + ], + "actions": [], + "events": [ { "colorB": 228, "colorG": 176, "colorR": 74, "creationTime": 0, - "name": "Check position", + "name": "Finite state machine", "source": "", "type": "BuiltinCommonInstructions::Group", "events": [ @@ -17105,478 +17117,386 @@ "textG": 0, "textR": 0 }, - "comment": "Make sure the cursor position is only checked once per frame." - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "MouseIsInside", - "False", - "" - ] - } - ] + "comment": "The \"Validated\" state only last one frame." }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "ShouldCheckHovering", - "True", - "" - ] - }, - { - "type": { - "value": "CollisionPoint" + "value": "StringVariable" }, "parameters": [ - "Object", - "MouseOnlyCursorX(Object.Layer(), 0)", - "MouseOnlyCursorY(Object.Layer(), 0)" + "State", + "=", + "\"Validated\"" ] } ], "actions": [ { "type": { - "value": "SetBooleanVariable" + "value": "SetStringVariable" }, "parameters": [ - "MouseIsInside", - "True", - "" + "State", + "=", + "\"Idle\"" ] } ] }, { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 - }, - "comment": "Touches are always pressed, so ShouldCheckHovering doesn't matter." - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Check position", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ { - "type": { - "value": "SetBooleanVariable" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 }, - "parameters": [ - "TouchIsInside", - "False", - "" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "comment": "Make sure the cursor position is only checked once per frame." + }, { - "type": { - "value": "NumberVariable" - }, - "parameters": [ - "TouchId", - "!=", - "0" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "MouseIsInside", + "False", + "" + ] + } ] }, { - "type": { - "value": "CollisionPoint" - }, - "parameters": [ - "Object", - "TouchX(TouchId, Object.Layer(), 0)", - "TouchY(TouchId, Object.Layer(), 0)" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "ShouldCheckHovering", + "True", + "" + ] + }, + { + "type": { + "value": "CollisionPoint" + }, + "parameters": [ + "Object", + "MouseOnlyCursorX(Object.Layer(), 0)", + "MouseOnlyCursorY(Object.Layer(), 0)" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "MouseIsInside", + "True", + "" + ] + } ] - } - ], - "actions": [ + }, { - "type": { - "value": "SetBooleanVariable" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 }, - "parameters": [ - "TouchIsInside", - "True", - "" - ] - } - ] - } - ], - "parameters": [] - }, - { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Handle touch start", - "source": "", - "type": "BuiltinCommonInstructions::Group", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "comment": "Touches are always pressed, so ShouldCheckHovering doesn't matter." + }, { - "type": { - "value": "HasAnyTouchOrMouseStarted" - }, - "parameters": [ - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "TouchIsInside", + "False", + "" + ] + } ] - } - ], - "actions": [ + }, { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "Index", - "=", - "0" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "!=", + "0" + ] + }, + { + "type": { + "value": "CollisionPoint" + }, + "parameters": [ + "Object", + "TouchX(TouchId, Object.Layer(), 0)", + "TouchY(TouchId, Object.Layer(), 0)" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "TouchIsInside", + "True", + "" + ] + } ] } ], + "parameters": [] + }, + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Handle touch start", + "source": "", + "type": "BuiltinCommonInstructions::Group", "events": [ { - "type": "BuiltinCommonInstructions::Repeat", - "repeatExpression": "StartedTouchOrMouseCount()", - "conditions": [], - "actions": [], + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "HasAnyTouchOrMouseStarted" + }, + "parameters": [ + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "Index", + "=", + "0" + ] + } + ], "events": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "CollisionPoint" - }, - "parameters": [ - "Object", - "TouchX(StartedTouchOrMouseId(Index), Object.Layer(), 0)", - "TouchY(StartedTouchOrMouseId(Index), Object.Layer(), 0)" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "StartedTouchOrMouseId(Index)" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "TouchIsInside", - "True", - "" - ] - } - ], + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "StartedTouchOrMouseCount()", + "conditions": [], + "actions": [], "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "value": "BuiltinCommonInstructions::Or" + "value": "CollisionPoint" + }, + "parameters": [ + "Object", + "TouchX(StartedTouchOrMouseId(Index), Object.Layer(), 0)", + "TouchY(StartedTouchOrMouseId(Index), Object.Layer(), 0)" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" }, - "parameters": [], - "subInstructions": [ + "parameters": [ + "TouchId", + "=", + "StartedTouchOrMouseId(Index)" + ] + }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "TouchIsInside", + "True", + "" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { "type": { - "value": "PanelSpriteButton::ButtonFSM::PropertyState" + "value": "BuiltinCommonInstructions::Or" }, - "parameters": [ - "Object", - "Behavior", - "=", - "\"Hovered\"" + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "PanelSpriteButton::ButtonFSM::PropertyState" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "\"Hovered\"" + ] + }, + { + "type": { + "value": "PanelSpriteButton::ButtonFSM::PropertyState" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "\"Idle\"" + ] + } ] - }, + } + ], + "actions": [ { "type": { - "value": "PanelSpriteButton::ButtonFSM::PropertyState" + "value": "SetStringVariable" }, "parameters": [ - "Object", - "Behavior", + "State", "=", - "\"Idle\"" + "\"PressedInside\"" ] } ] } - ], + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], "actions": [ { "type": { - "value": "SetStringVariable" + "value": "SetNumberVariable" }, "parameters": [ - "State", - "=", - "\"PressedInside\"" + "Index", + "+", + "1" ] } ] } ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "Index", - "+", - "1" - ] - } - ] } ] } - ] - } - ], - "parameters": [] - }, - { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Apply position changes", - "source": "", - "type": "BuiltinCommonInstructions::Group", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "inverted": true, - "value": "BooleanVariable" - }, - "parameters": [ - "MouseIsInside", - "True", - "" - ] - }, - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "State", - "=", - "\"Hovered\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetStringVariable" - }, - "parameters": [ - "State", - "=", - "\"Idle\"" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "MouseIsInside", - "True", - "" - ] - }, - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "State", - "=", - "\"Idle\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetStringVariable" - }, - "parameters": [ - "State", - "=", - "\"Hovered\"" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "inverted": true, - "value": "BooleanVariable" - }, - "parameters": [ - "TouchIsInside", - "True", - "" - ] - }, - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "State", - "=", - "\"PressedInside\"" - ] - } ], - "actions": [ - { - "type": { - "value": "SetStringVariable" - }, - "parameters": [ - "State", - "=", - "\"PressedOutside\"" - ] - } - ] + "parameters": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Apply position changes", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ { - "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "TouchIsInside", - "True", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "BooleanVariable" + }, + "parameters": [ + "MouseIsInside", + "True", + "" + ] + }, + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "State", + "=", + "\"Hovered\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "State", + "=", + "\"Idle\"" + ] + } ] }, - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "State", - "=", - "\"PressedOutside\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetStringVariable" - }, - "parameters": [ - "State", - "=", - "\"PressedInside\"" - ] - } - ] - } - ], - "parameters": [] - }, - { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Handle touch end", - "source": "", - "type": "BuiltinCommonInstructions::Group", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "HasTouchEnded" - }, - "parameters": [ - "", - "TouchId" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "0" - ] - } - ], - "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "MouseIsInside", + "True", + "" + ] + }, { "type": { "value": "StringVariable" @@ -17584,7 +17504,7 @@ "parameters": [ "State", "=", - "\"PressedInside\"" + "\"Idle\"" ] } ], @@ -17596,7 +17516,7 @@ "parameters": [ "State", "=", - "\"Validated\"" + "\"Hovered\"" ] } ] @@ -17607,6 +17527,16 @@ { "type": { "inverted": true, + "value": "BooleanVariable" + }, + "parameters": [ + "TouchIsInside", + "True", + "" + ] + }, + { + "type": { "value": "StringVariable" }, "parameters": [ @@ -17614,16 +17544,42 @@ "=", "\"PressedInside\"" ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "State", + "=", + "\"PressedOutside\"" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "TouchIsInside", + "True", + "" + ] }, { "type": { - "inverted": true, "value": "StringVariable" }, "parameters": [ "State", "=", - "\"Validated\"" + "\"PressedOutside\"" ] } ], @@ -17635,18 +17591,124 @@ "parameters": [ "State", "=", - "\"Idle\"" + "\"PressedInside\"" ] } ] } - ] + ], + "parameters": [] + }, + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Handle touch end", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "HasTouchEnded" + }, + "parameters": [ + "", + "TouchId" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "0" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "State", + "=", + "\"PressedInside\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "State", + "=", + "\"Validated\"" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "StringVariable" + }, + "parameters": [ + "State", + "=", + "\"PressedInside\"" + ] + }, + { + "type": { + "inverted": true, + "value": "StringVariable" + }, + "parameters": [ + "State", + "=", + "\"Validated\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "State", + "=", + "\"Idle\"" + ] + } + ] + } + ] + } + ], + "parameters": [] } ], "parameters": [] } - ], - "parameters": [] + ] } ], "parameters": [ @@ -18341,6 +18403,36 @@ "useLegacyBottomAndRightAnchors": false } ] + }, + { + "assetStoreId": "", + "name": "BitmapLabel", + "type": "BitmapText::BitmapTextObject", + "variables": [], + "effects": [], + "behaviors": [ + { + "name": "Anchor", + "type": "AnchorBehavior::AnchorBehavior", + "bottomEdgeAnchor": 4, + "topEdgeAnchor": 4, + "leftEdgeAnchor": 1, + "relativeToOriginalWindowSize": true, + "rightEdgeAnchor": 2, + "useLegacyBottomAndRightAnchors": false + } + ], + "content": { + "text": "Text", + "opacity": 255, + "scale": 1, + "fontSize": 20, + "tint": "255;255;255", + "bitmapFontResourceName": "", + "textureAtlasResourceName": "", + "align": "center", + "verticalTextAlignment": "center" + } } ], "objectsFolderStructure": { @@ -18349,6 +18441,9 @@ { "objectName": "Label" }, + { + "objectName": "BitmapLabel" + }, { "objectName": "Idle" }, @@ -18374,6 +18469,17 @@ "name": "Pressed" } ] + }, + { + "name": "Labels", + "objects": [ + { + "name": "Label" + }, + { + "name": "BitmapLabel" + } + ] } ], "layers": [ @@ -18550,7 +18656,7 @@ "value": "TextContainerCapability::TextContainerBehavior::SetValue" }, "parameters": [ - "Label", + "Labels", "Text", "=", "LabelText" @@ -18626,7 +18732,7 @@ "value": "TextContainerCapability::TextContainerBehavior::SetValue" }, "parameters": [ - "Label", + "Labels", "Text", "=", "LabelText" @@ -19266,7 +19372,7 @@ "value": "TextContainerCapability::TextContainerBehavior::SetValue" }, "parameters": [ - "Label", + "Labels", "Text", "=", "Value" @@ -19306,7 +19412,7 @@ "value": "TextContainerCapability::TextContainerBehavior::SetValue" }, "parameters": [ - "Label", + "Labels", "Text", "=", "Value" @@ -19341,7 +19447,7 @@ "value": "SetReturnString" }, "parameters": [ - "Label.Text::Value()" + "Labels.Text::Value()" ] } ] @@ -19533,7 +19639,7 @@ "value": "SetCenterY" }, "parameters": [ - "Label", + "Labels", "+", "Value - LabelOffset" ] @@ -19601,6 +19707,10 @@ { "label": "Label.Text=LabelText", "value": "Label.Text=LabelText" + }, + { + "label": "BitmapLabel.Text=LabelText", + "value": "BitmapLabel.Text=LabelText" } ], "hidden": true, From 0f157d0e3c033cdad56426657be7fa2d326e7775 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Davy=20H=C3=A9lard?= Date: Wed, 8 Oct 2025 15:19:38 +0200 Subject: [PATCH 06/12] [3D racing game] Update the extensions --- examples/3d-racing-game/3d-racing-game.json | 4674 +++++++++---------- 1 file changed, 2106 insertions(+), 2568 deletions(-) diff --git a/examples/3d-racing-game/3d-racing-game.json b/examples/3d-racing-game/3d-racing-game.json index 18f5aa701..ba3641c48 100644 --- a/examples/3d-racing-game/3d-racing-game.json +++ b/examples/3d-racing-game/3d-racing-game.json @@ -1,7 +1,7 @@ { "firstLayout": "LevelSelection", "gdVersion": { - "build": 237, + "build": 242, "major": 5, "minor": 5, "revision": 0 @@ -91,7 +91,6 @@ "playableDevices": [ "keyboard", "gamepad", - "mobile", "mobile" ], "extensionProperties": [], @@ -2055,6 +2054,7 @@ "textAlignment": "center", "verticalTextAlignment": "top", "characterSize": 48, + "lineHeight": 0, "color": "255;255;255" } }, @@ -4711,6 +4711,7 @@ "textAlignment": "center", "verticalTextAlignment": "top", "characterSize": 60, + "lineHeight": 0, "color": "72;72;79" } }, @@ -4797,6 +4798,7 @@ "textAlignment": "center", "verticalTextAlignment": "top", "characterSize": 60, + "lineHeight": 0, "color": "72;72;79" } }, @@ -5404,6 +5406,7 @@ "textAlignment": "", "verticalTextAlignment": "top", "characterSize": 60, + "lineHeight": 0, "color": "72;72;79" } }, @@ -5501,6 +5504,7 @@ "textAlignment": "center", "verticalTextAlignment": "top", "characterSize": 60, + "lineHeight": 0, "color": "72;72;79" } }, @@ -5587,6 +5591,7 @@ "textAlignment": "center", "verticalTextAlignment": "top", "characterSize": 60, + "lineHeight": 0, "color": "72;72;79" } }, @@ -5673,6 +5678,7 @@ "textAlignment": "center", "verticalTextAlignment": "top", "characterSize": 60, + "lineHeight": 0, "color": "72;72;79" } }, @@ -6459,9 +6465,9 @@ "name": "PanelSpriteButton", "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/Line Hero Pack/Master/SVG/Interface Elements/Interface Elements_interface_ui_button_ok_cta_clock_tap.svg", "shortDescription": "A button that can be customized.", - "version": "2.0.0", + "version": "2.1.1", "description": [ - "The button can be customized with a background for each state and a label. It handles user interactions and a simple condition can be used to check if it is clicked.", + "A button that can be used for menus and most labelled buttons of a game. The button can be customized with a background for each state and a label. It handles user interactions and a simple condition can be used to check if it is clicked.", "", "There are ready-to-use buttons in the asset-store [menu buttons pack](https://editor.gdevelop.io/?initial-dialog=asset-store&asset-pack=menu-buttons-menu-buttons)." ], @@ -6485,7 +6491,30 @@ "dependencies": [], "globalVariables": [], "sceneVariables": [], - "eventsFunctions": [], + "eventsFunctions": [ + { + "description": "Check if the events are running for the editor.", + "fullName": "Editor is running", + "functionType": "Condition", + "name": "IsInGameEdition", + "private": true, + "sentence": "Events are running for the editor", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const game = runtimeScene.getGame();\r", + "eventsFunctionContext.returnValue = game.isInGameEdition && game.isInGameEdition();" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [], + "objectGroups": [] + } + ], "eventsBasedBehaviors": [ { "description": "The finite state machine used internally by the button object.", @@ -6501,59 +6530,27 @@ "sentence": "", "events": [ { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Finite state machine", - "source": "", - "type": "BuiltinCommonInstructions::Group", - "events": [ + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 + "type": { + "inverted": true, + "value": "PanelSpriteButton::IsInGameEdition" }, - "comment": "The \"Validated\" state only last one frame." - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "State", - "=", - "\"Validated\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetStringVariable" - }, - "parameters": [ - "State", - "=", - "\"Idle\"" - ] - } + "parameters": [ + "", + "" ] - }, + } + ], + "actions": [], + "events": [ { "colorB": 228, "colorG": 176, "colorR": 74, "creationTime": 0, - "name": "Check position", + "name": "Finite state machine", "source": "", "type": "BuiltinCommonInstructions::Group", "events": [ @@ -6567,478 +6564,424 @@ "textG": 0, "textR": 0 }, - "comment": "Make sure the cursor position is only checked once per frame." - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "MouseIsInside", - "False", - "" - ] - } - ] + "comment": "The \"Validated\" state only last one frame." }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "ShouldCheckHovering", - "True", - "" - ] - }, - { - "type": { - "value": "CollisionPoint" + "value": "StringVariable" }, "parameters": [ - "Object", - "MouseOnlyCursorX(Object.Layer(), 0)", - "MouseOnlyCursorY(Object.Layer(), 0)" + "State", + "=", + "\"Validated\"" ] } ], "actions": [ { "type": { - "value": "SetBooleanVariable" + "value": "SetStringVariable" }, "parameters": [ - "MouseIsInside", - "True", - "" + "State", + "=", + "\"Idle\"" ] } ] }, { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 - }, - "comment": "Touches are always pressed, so ShouldCheckHovering doesn't matter." - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Check position", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ { - "type": { - "value": "SetBooleanVariable" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 }, - "parameters": [ - "TouchIsInside", - "False", - "" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "comment": "Make sure the cursor position is only checked once per frame." + }, { - "type": { - "value": "NumberVariable" - }, - "parameters": [ - "TouchId", - "!=", - "0" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "MouseIsInside", + "False", + "" + ] + } ] }, { - "type": { - "value": "CollisionPoint" - }, - "parameters": [ - "Object", - "TouchX(TouchId, Object.Layer(), 0)", - "TouchY(TouchId, Object.Layer(), 0)" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "ShouldCheckHovering", + "True", + "" + ] + }, + { + "type": { + "value": "CollisionPoint" + }, + "parameters": [ + "Object", + "MouseOnlyCursorX(Object.Layer(), 0)", + "MouseOnlyCursorY(Object.Layer(), 0)" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "MouseIsInside", + "True", + "" + ] + } ] - } - ], - "actions": [ + }, { - "type": { - "value": "SetBooleanVariable" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 }, - "parameters": [ - "TouchIsInside", - "True", - "" + "comment": "Touches are always pressed, so ShouldCheckHovering doesn't matter." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "TouchIsInside", + "False", + "" + ] + } ] - } - ] - } - ], - "parameters": [] - }, - { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Handle touch start", - "source": "", - "type": "BuiltinCommonInstructions::Group", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + }, { - "type": { - "value": "HasAnyTouchOrMouseStarted" - }, - "parameters": [ - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "Index", - "=", - "0" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "!=", + "0" + ] + }, + { + "type": { + "value": "CollisionPoint" + }, + "parameters": [ + "Object", + "TouchX(TouchId, Object.Layer(), 0)", + "TouchY(TouchId, Object.Layer(), 0)" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "TouchIsInside", + "True", + "" + ] + } ] } ], + "parameters": [] + }, + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Handle touch start", + "source": "", + "type": "BuiltinCommonInstructions::Group", "events": [ { - "type": "BuiltinCommonInstructions::Repeat", - "repeatExpression": "StartedTouchOrMouseCount()", - "conditions": [], - "actions": [], + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "HasAnyTouchOrMouseStarted" + }, + "parameters": [ + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "Index", + "=", + "0" + ] + } + ], "events": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "CollisionPoint" - }, - "parameters": [ - "Object", - "TouchX(StartedTouchOrMouseId(Index), Object.Layer(), 0)", - "TouchY(StartedTouchOrMouseId(Index), Object.Layer(), 0)" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "StartedTouchOrMouseId(Index)" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "TouchIsInside", - "True", - "" - ] - } - ], + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "StartedTouchOrMouseCount()", + "conditions": [], + "actions": [], "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "value": "BuiltinCommonInstructions::Or" + "value": "CollisionPoint" + }, + "parameters": [ + "Object", + "TouchX(StartedTouchOrMouseId(Index), Object.Layer(), 0)", + "TouchY(StartedTouchOrMouseId(Index), Object.Layer(), 0)" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "StartedTouchOrMouseId(Index)" + ] + }, + { + "type": { + "value": "SetBooleanVariable" }, - "parameters": [], - "subInstructions": [ + "parameters": [ + "TouchIsInside", + "True", + "" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { "type": { - "value": "PanelSpriteButton::ButtonFSM::PropertyState" + "value": "BuiltinCommonInstructions::Or" }, - "parameters": [ - "Object", - "Behavior", - "=", - "\"Hovered\"" + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "PanelSpriteButton::ButtonFSM::PropertyState" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "\"Hovered\"" + ] + }, + { + "type": { + "value": "PanelSpriteButton::ButtonFSM::PropertyState" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "\"Idle\"" + ] + } ] - }, + } + ], + "actions": [ { "type": { - "value": "PanelSpriteButton::ButtonFSM::PropertyState" + "value": "SetStringVariable" }, "parameters": [ - "Object", - "Behavior", + "State", "=", - "\"Idle\"" + "\"PressedInside\"" ] } ] } - ], + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], "actions": [ { "type": { - "value": "SetStringVariable" + "value": "SetNumberVariable" }, "parameters": [ - "State", - "=", - "\"PressedInside\"" + "Index", + "+", + "1" ] } ] } ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "Index", - "+", - "1" - ] - } - ] } ] } - ] - } - ], - "parameters": [] - }, - { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Apply position changes", - "source": "", - "type": "BuiltinCommonInstructions::Group", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "inverted": true, - "value": "BooleanVariable" - }, - "parameters": [ - "MouseIsInside", - "True", - "" - ] - }, - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "State", - "=", - "\"Hovered\"" - ] - } ], - "actions": [ - { - "type": { - "value": "SetStringVariable" - }, - "parameters": [ - "State", - "=", - "\"Idle\"" - ] - } - ] + "parameters": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Apply position changes", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ { - "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "MouseIsInside", - "True", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "BooleanVariable" + }, + "parameters": [ + "MouseIsInside", + "True", + "" + ] + }, + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "State", + "=", + "\"Hovered\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "State", + "=", + "\"Idle\"" + ] + } ] }, { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "State", - "=", - "\"Idle\"" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "MouseIsInside", + "True", + "" + ] + }, + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "State", + "=", + "\"Idle\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "State", + "=", + "\"Hovered\"" + ] + } ] - } - ], - "actions": [ - { - "type": { - "value": "SetStringVariable" - }, - "parameters": [ - "State", - "=", - "\"Hovered\"" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "inverted": true, - "value": "BooleanVariable" - }, - "parameters": [ - "TouchIsInside", - "True", - "" - ] - }, - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "State", - "=", - "\"PressedInside\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetStringVariable" - }, - "parameters": [ - "State", - "=", - "\"PressedOutside\"" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "TouchIsInside", - "True", - "" - ] - }, - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "State", - "=", - "\"PressedOutside\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetStringVariable" - }, - "parameters": [ - "State", - "=", - "\"PressedInside\"" - ] - } - ] - } - ], - "parameters": [] - }, - { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Handle touch end", - "source": "", - "type": "BuiltinCommonInstructions::Group", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "HasTouchEnded" - }, - "parameters": [ - "", - "TouchId" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "0" - ] - } - ], - "events": [ + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ + { + "type": { + "inverted": true, + "value": "BooleanVariable" + }, + "parameters": [ + "TouchIsInside", + "True", + "" + ] + }, { "type": { "value": "StringVariable" @@ -7058,7 +7001,7 @@ "parameters": [ "State", "=", - "\"Validated\"" + "\"PressedOutside\"" ] } ] @@ -7068,24 +7011,22 @@ "conditions": [ { "type": { - "inverted": true, - "value": "StringVariable" + "value": "BooleanVariable" }, "parameters": [ - "State", - "=", - "\"PressedInside\"" + "TouchIsInside", + "True", + "" ] }, { "type": { - "inverted": true, "value": "StringVariable" }, "parameters": [ "State", "=", - "\"Validated\"" + "\"PressedOutside\"" ] } ], @@ -7097,18 +7038,124 @@ "parameters": [ "State", "=", - "\"Idle\"" + "\"PressedInside\"" ] } ] } - ] + ], + "parameters": [] + }, + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Handle touch end", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "HasTouchEnded" + }, + "parameters": [ + "", + "TouchId" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "0" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "State", + "=", + "\"PressedInside\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "State", + "=", + "\"Validated\"" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "StringVariable" + }, + "parameters": [ + "State", + "=", + "\"PressedInside\"" + ] + }, + { + "type": { + "inverted": true, + "value": "StringVariable" + }, + "parameters": [ + "State", + "=", + "\"Validated\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "State", + "=", + "\"Idle\"" + ] + } + ] + } + ] + } + ], + "parameters": [] } ], "parameters": [] } - ], - "parameters": [] + ] } ], "parameters": [ @@ -7581,12 +7628,27 @@ "value": "Idle", "type": "Choice", "label": "State", - "extraInformation": [ - "Idle", - "Hovered", - "PressedInside", - "PressedOutside", - "Validated" + "choices": [ + { + "label": "Idle", + "value": "Idle" + }, + { + "label": "Hovered", + "value": "Hovered" + }, + { + "label": "PressedInside", + "value": "PressedInside" + }, + { + "label": "PressedOutside", + "value": "PressedOutside" + }, + { + "label": "Validated", + "value": "Validated" + } ], "hidden": true, "name": "State" @@ -7688,6 +7750,7 @@ "textAlignment": "center", "verticalTextAlignment": "center", "characterSize": 20, + "lineHeight": 0, "color": "0;0;0" } }, @@ -7787,6 +7850,36 @@ "useLegacyBottomAndRightAnchors": false } ] + }, + { + "assetStoreId": "", + "name": "BitmapLabel", + "type": "BitmapText::BitmapTextObject", + "variables": [], + "effects": [], + "behaviors": [ + { + "name": "Anchor", + "type": "AnchorBehavior::AnchorBehavior", + "bottomEdgeAnchor": 4, + "topEdgeAnchor": 4, + "leftEdgeAnchor": 1, + "relativeToOriginalWindowSize": true, + "rightEdgeAnchor": 2, + "useLegacyBottomAndRightAnchors": false + } + ], + "content": { + "text": "Text", + "opacity": 255, + "scale": 1, + "fontSize": 20, + "tint": "255;255;255", + "bitmapFontResourceName": "", + "textureAtlasResourceName": "", + "align": "center", + "verticalTextAlignment": "center" + } } ], "objectsFolderStructure": { @@ -7795,6 +7888,9 @@ { "objectName": "Label" }, + { + "objectName": "BitmapLabel" + }, { "objectName": "Idle" }, @@ -7820,13 +7916,24 @@ "name": "Pressed" } ] - } - ], - "layers": [ + }, { - "ambientLightColorB": 200, - "ambientLightColorG": 200, - "ambientLightColorR": 200, + "name": "Labels", + "objects": [ + { + "name": "Label" + }, + { + "name": "BitmapLabel" + } + ] + } + ], + "layers": [ + { + "ambientLightColorB": 200, + "ambientLightColorG": 200, + "ambientLightColorR": 200, "camera3DFarPlaneDistance": 10000, "camera3DFieldOfView": 45, "camera3DNearPlaneDistance": 3, @@ -7996,7 +8103,7 @@ "value": "TextContainerCapability::TextContainerBehavior::SetValue" }, "parameters": [ - "Label", + "Labels", "Text", "=", "LabelText" @@ -8072,7 +8179,7 @@ "value": "TextContainerCapability::TextContainerBehavior::SetValue" }, "parameters": [ - "Label", + "Labels", "Text", "=", "LabelText" @@ -8712,7 +8819,7 @@ "value": "TextContainerCapability::TextContainerBehavior::SetValue" }, "parameters": [ - "Label", + "Labels", "Text", "=", "Value" @@ -8752,7 +8859,7 @@ "value": "TextContainerCapability::TextContainerBehavior::SetValue" }, "parameters": [ - "Label", + "Labels", "Text", "=", "Value" @@ -8787,7 +8894,7 @@ "value": "SetReturnString" }, "parameters": [ - "Label.Text::Value()" + "Labels.Text::Value()" ] } ] @@ -8979,7 +9086,7 @@ "value": "SetCenterY" }, "parameters": [ - "Label", + "Labels", "+", "Value - LabelOffset" ] @@ -9043,8 +9150,15 @@ "value": "", "type": "Choice", "label": "", - "extraInformation": [ - "Label.Text=LabelText" + "choices": [ + { + "label": "Label.Text=LabelText", + "value": "Label.Text=LabelText" + }, + { + "label": "BitmapLabel.Text=LabelText", + "value": "BitmapLabel.Text=LabelText" + } ], "hidden": true, "name": "_PropertyMapping" @@ -9112,6 +9226,7 @@ "textAlignment": "center", "verticalTextAlignment": "center", "characterSize": 60, + "lineHeight": 0, "color": "72;72;79" } }, @@ -9329,23 +9444,23 @@ "category": "Input", "extensionNamespace": "", "fullName": "Gamepads (controllers)", - "gdevelopVersion": "", + "gdevelopVersion": ">=5.5.222", "helpPath": "/all-features/gamepad", "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0ibWRpLWdhbWVwYWQtdmFyaWFudC1vdXRsaW5lIiB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCI+PHBhdGggZD0iTTYsOUg4VjExSDEwVjEzSDhWMTVINlYxM0g0VjExSDZWOU0xOC41LDlBMS41LDEuNSAwIDAsMSAyMCwxMC41QTEuNSwxLjUgMCAwLDEgMTguNSwxMkExLjUsMS41IDAgMCwxIDE3LDEwLjVBMS41LDEuNSAwIDAsMSAxOC41LDlNMTUuNSwxMkExLjUsMS41IDAgMCwxIDE3LDEzLjVBMS41LDEuNSAwIDAsMSAxNS41LDE1QTEuNSwxLjUgMCAwLDEgMTQsMTMuNUExLjUsMS41IDAgMCwxIDE1LjUsMTJNMTcsNUE3LDcgMCAwLDEgMjQsMTJBNyw3IDAgMCwxIDE3LDE5QzE1LjA0LDE5IDEzLjI3LDE4LjIgMTIsMTYuOUMxMC43MywxOC4yIDguOTYsMTkgNywxOUE3LDcgMCAwLDEgMCwxMkE3LDcgMCAwLDEgNyw1SDE3TTcsN0E1LDUgMCAwLDAgMiwxMkE1LDUgMCAwLDAgNywxN0M4LjY0LDE3IDEwLjA5LDE2LjIxIDExLDE1SDEzQzEzLjkxLDE2LjIxIDE1LjM2LDE3IDE3LDE3QTUsNSAwIDAsMCAyMiwxMkE1LDUgMCAwLDAgMTcsN0g3WiIgLz48L3N2Zz4=", "name": "Gamepads", "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/gamepad-variant-outline.svg", "shortDescription": "Add support for gamepads (or other controllers) to your game, giving access to information such as button presses, axis positions, trigger pressure, etc...", - "version": "0.7.0", + "version": "0.9.0", "description": [ - "Add support for gamepads (or other controllers).", + "Add support for gamepads (or other physical controllers).", "", "It gives access to:", - "- button presses", - "- axis positions and force", - "- trigger pressure", - "- configurable deadzone", - "- vibration", - "- automatic mappers for platformer characters and top-down movement", + "- button presses,", + "- axis positions and force,", + "- trigger pressure,", + "- configurable deadzone,", + "- vibration,", + "- automatic \"gamepad mapper\" behaviors for 2D and 3D movement behaviors (platformer characters, top-down movement, 3D character etc...). Add one of these to the object with the movement behavior (i.e: the player most of the time) and the behavior will then be controlled automatically by the gamepad (it works by reading the gamepad state and simulating controls). No need for additional events to make it work once the behaviors are set up.", "", "The Bomberman-like example handles 4 players with gamepads ([open the project online](https://editor.gdevelop.io/?project=example://goose-bomberman))." ], @@ -9367,11 +9482,59 @@ "authorIds": [ "2OwwM8ToR9dx9RJ2sAKTcrLmCB92", "taRwmWxwAFYFL9yyBwB3cwBw0BO2", - "mnImQKdn8nQxwzkS5D6a1JB27V23" + "mnImQKdn8nQxwzkS5D6a1JB27V23", + "IWykYNRvhCZBN3vEgKEbBPOR3Oc2" ], "dependencies": [], "globalVariables": [], - "sceneVariables": [], + "sceneVariables": [ + { + "name": "Buttons", + "type": "structure", + "children": [ + { + "name": "A or Cross", + "type": "string", + "value": "A" + }, + { + "name": "B or Circle", + "type": "string", + "value": "B" + }, + { + "name": "LB or L1", + "type": "string", + "value": "LB" + }, + { + "name": "LT or L2", + "type": "string", + "value": "LT" + }, + { + "name": "RB or R1", + "type": "string", + "value": "RB" + }, + { + "name": "RT or R2", + "type": "string", + "value": "RT" + }, + { + "name": "X or Square", + "type": "string", + "value": "X" + }, + { + "name": "Y or Triangle", + "type": "string", + "value": "Y" + } + ] + } + ], "eventsFunctions": [ { "fullName": "", @@ -9379,83 +9542,323 @@ "name": "onFirstSceneLoaded", "sentence": "", "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [] - }, { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "//Define an new private object javascript for the gamepad extension\r", - "gdjs._extensionController = {\r", - " players: {\r", - " 0: { mapping: 'DEFAULT', lastButtonUsed: -1, deadzone: 0.2, previousFrameStateButtons: {}, rumble: {} },\r", - " 1: { mapping: 'DEFAULT', lastButtonUsed: -1, deadzone: 0.2, previousFrameStateButtons: {}, rumble: {} },\r", - " 2: { mapping: 'DEFAULT', lastButtonUsed: -1, deadzone: 0.2, previousFrameStateButtons: {}, rumble: {} },\r", - " 3: { mapping: 'DEFAULT', lastButtonUsed: -1, deadzone: 0.2, previousFrameStateButtons: {}, rumble: {} },\r", + "if (gdjs._extensionController) {\r", + " return;\r", + "}\r", + "\r", + "/**\r", + " * Associate controller button ids to button names\r", + " */\r", + "const controllerButtonNames = {\r", + " \"XBOX\": {\r", + " 0: \"A\",\r", + " 1: \"B\",\r", + " 2: \"X\",\r", + " 3: \"Y\",\r", + " 4: \"LB\",\r", + " 5: \"RB\",\r", + " 6: \"LT\",\r", + " 7: \"RT\",\r", + " 8: \"BACK\",\r", + " 9: \"START\",\r", + " 10: \"CLICK_STICK_LEFT\",\r", + " 11: \"CLICK_STICK_RIGHT\",\r", + " 12: \"UP\",\r", + " 13: \"DOWN\",\r", + " 14: \"LEFT\",\r", + " 15: \"RIGHT\",\r", + " 16: \"NONE\",\r", + " 17: \"NONE\"\r", " },\r", - " lastActiveController: -1, // Last active controller\r", - " controllerButtonNames: { //Map associating controller button ids to button names\r", - " \"XBOX\": {\r", - " 0: \"A\",\r", - " 1: \"B\",\r", - " 2: \"X\",\r", - " 3: \"Y\",\r", - " 4: \"LB\",\r", - " 5: \"RB\",\r", - " 6: \"LT\",\r", - " 7: \"RT\",\r", - " 8: \"BACK\",\r", - " 9: \"START\",\r", - " 10: \"CLICK_STICK_LEFT\",\r", - " 11: \"CLICK_STICK_RIGHT\",\r", - " 12: \"UP\",\r", - " 13: \"DOWN\",\r", - " 14: \"LEFT\",\r", - " 15: \"RIGHT\",\r", - " 16: \"NONE\",\r", - " 17: \"NONE\"\r", - " },\r", - " \"PS4\": {\r", - " 0: \"CROSS\",\r", - " 1: \"CIRCLE\",\r", - " 2: \"SQUARE\",\r", - " 3: \"TRIANGLE\",\r", - " 4: \"L1\",\r", - " 5: \"R1\",\r", - " 6: \"L2\",\r", - " 7: \"R2\",\r", - " 8: \"SHARE\",\r", - " 9: \"OPTIONS\",\r", - " 10: \"CLICK_STICK_LEFT\",\r", - " 11: \"CLICK_STICK_RIGHT\",\r", - " 12: \"UP\",\r", - " 13: \"DOWN\",\r", - " 14: \"LEFT\",\r", - " 15: \"RIGHT\",\r", - " 16: \"PS_BUTTON\",\r", - " 17: \"CLICK_TOUCHPAD\"\r", - " }\r", + " \"PS4\": {\r", + " 0: \"CROSS\",\r", + " 1: \"CIRCLE\",\r", + " 2: \"SQUARE\",\r", + " 3: \"TRIANGLE\",\r", + " 4: \"L1\",\r", + " 5: \"R1\",\r", + " 6: \"L2\",\r", + " 7: \"R2\",\r", + " 8: \"SHARE\",\r", + " 9: \"OPTIONS\",\r", + " 10: \"CLICK_STICK_LEFT\",\r", + " 11: \"CLICK_STICK_RIGHT\",\r", + " 12: \"UP\",\r", + " 13: \"DOWN\",\r", + " 14: \"LEFT\",\r", + " 15: \"RIGHT\",\r", + " 16: \"PS_BUTTON\",\r", + " 17: \"CLICK_TOUCHPAD\"\r", " }\r", "};\r", "\r", - "gdjs._extensionController.getInputString = function (type, buttonId) {\r", - " const controllerButtonNames = gdjs._extensionController.controllerButtonNames;\r", - " if (controllerButtonNames[type] !== undefined) {\r", - " return controllerButtonNames[type][buttonId];\r", + "/**\r", + " * @param {number} playerId\r", + " */\r", + "function getGamepad(playerId) {\r", + " /** @type {Gamepad[]} */\r", + " const gamepads = navigator.getGamepads ? navigator.getGamepads() : [];\r", + " return gamepads[playerId];\r", + "}\r", + "\r", + "/** @type {{[playerId: number]: Player}} */\r", + "const players = {};\r", + "\r", + "/**\r", + " * @param {number} playerId\r", + " */\r", + "function getPlayer(playerId) {\r", + " let player = players[playerId];\r", + " if (!player) {\r", + " player = new Player(playerId);\r", + " players[playerId] = player;\r", + " }\r", + " return player;\r", + "}\r", + "\r", + "class Player {\r", + " /** @type {number} */\r", + " playerId;\r", + " mapping = 'DEFAULT';\r", + " lastButtonUsed = -1;\r", + " deadzone = 0.2;\r", + " /** @type {{[buttonId: number]: ButtonState}} */\r", + " buttonStates = {};\r", + " rumble = { elapsedTime: 0, duration: 0, weakMagnitude: 0, strongMagnitude: 0 };\r", + "\r", + " /**\r", + " * @param {number} playerId\r", + " */\r", + " constructor(playerId) {\r", + " this.playerId = playerId;\r", + " }\r", + "\r", + " /**\r", + " * @param {number} buttonId\r", + " */\r", + " getButtonState(buttonId) {\r", + " let buttonState = this.buttonStates[buttonId];\r", + " if (!buttonState) {\r", + " buttonState = new ButtonState();\r", + " this.buttonStates[buttonId] = buttonState;\r", + " }\r", + " return buttonState;\r", + " }\r", + "\r", + " /**\r", + " * @param {number} buttonId\r", + " */\r", + " isButtonPressed(buttonId) {\r", + " return this.getButtonState(buttonId).isPressed;\r", + " }\r", + "\r", + " /**\r", + " * @param {number} buttonId\r", + " */\r", + " isButtonJustPressed(buttonId) {\r", + " return this.getButtonState(buttonId).isJustPressed();\r", + " }\r", + "\r", + " /**\r", + " * @param {number} buttonId\r", + " */\r", + " isButtonReleased(buttonId) {\r", + " return this.getButtonState(buttonId).isReleased();\r", + " }\r", + "\r", + " isAnyButtonReleased() {\r", + " for (const buttonId in this.buttonStates) {\r", + " const buttonState = this.buttonStates[buttonId];\r", + " if (buttonState.isReleased()) {\r", + " return true;\r", + " }\r", + " }\r", + " return false;\r", + " }\r", + "\r", + " isAnyButtonPressed() {\r", + " for (const buttonId in this.buttonStates) {\r", + " const buttonState = this.buttonStates[buttonId];\r", + " if (buttonState.isPressed) {\r", + " return true;\r", + " }\r", + " }\r", + " return false;\r", + " }\r", + "}\r", + "\r", + "class ButtonState {\r", + " wasPressed = false;\r", + " isPressed = false;\r", + "\r", + " isReleased() {\r", + " return this.wasPressed && !this.isPressed;\r", + " }\r", + "\r", + " isJustPressed() {\r", + " return !this.wasPressed && this.isPressed;\r", + " }\r", + "}\r", + "\r", + "// Async tasks are run before everything.\r", + "// This is a hack to make sure that button states are updated\r", + "// before mapping behavior events.\r", + "const frameBeginningTask = new class extends gdjs.AsyncTask {\r", + " update() {\r", + " /** @type {Gamepad[]} */\r", + " const gamepads = navigator.getGamepads ? navigator.getGamepads() : [];\r", + " for (let playerId = 0; playerId < gamepads.length; playerId++) {\r", + " const gamepad = gamepads[playerId];\r", + " if (gamepad == null) {\r", + " // The gamepad is not connected.\r", + " continue;\r", + " }\r", + " const player = getPlayer(playerId);\r", + "\r", + " for (let buttonId = 0; buttonId < Object.keys(gamepad.buttons).length; buttonId++) {\r", + " const buttonState = player.getButtonState(buttonId);\r", + " buttonState.wasPressed = buttonState.isPressed;\r", + " buttonState.isPressed = gamepad.buttons[buttonId].pressed;\r", + " if (buttonState.isJustPressed()) {\r", + " player.lastButtonUsed = buttonId;\r", + " }\r", + " }\r", + " }\r", + " return false;\r", + " }\r", + "}();\r", + "\r", + "function onScenePostEvents() {\r", + " /** @type {Gamepad[]} */\r", + " const gamepads = navigator.getGamepads ? navigator.getGamepads() : [];\r", + " for (let playerId = 0; playerId < gamepads.length; playerId++) {\r", + " let gamepad = gamepads[playerId];\r", + " if (gamepad == null) {\r", + " // The gamepad is not connected.\r", + " continue;\r", + " }\r", + " const player = getPlayer(playerId);\r", + " const rumble = player.rumble;\r", + " rumble.elapsedTime += runtimeScene.getElapsedTime(runtimeScene) / 1000;\r", + " if (rumble.duration - rumble.elapsedTime <= 0 &&\r", + " (rumble.weakMagnitude || rumble.strongMagnitude)\r", + " ) {\r", + " rumble.weakMagnitude = 0;\r", + " rumble.strongMagnitude = 0;\r", + " }\r", + " }\r", + "}\r", + "\r", + "/**\r", + " * @param {string} type\r", + " * @param {number} buttonId\r", + " */\r", + "function getInputString(type, buttonId) {\r", + " if (!controllerButtonNames[type]) {\r", + " return \"UNKNOWN_BUTTON\";\r", + " }\r", + " return controllerButtonNames[type][buttonId];\r", + "}\r", + "\r", + "function getButtonId(buttonName) {\r", + " switch (buttonName) {\r", + " case 'A':\r", + " case 'CROSS':\r", + " return 0;\r", + " case 'B':\r", + " case 'CIRCLE':\r", + " return 1;\r", + " case 'X':\r", + " case 'SQUARE':\r", + " return 2;\r", + " case 'Y':\r", + " case 'TRIANGLE':\r", + " return 3;\r", + " case 'LB':\r", + " case 'L1':\r", + " return 4;\r", + " case 'RB':\r", + " case 'R1':\r", + " return 5;\r", + " case 'LT':\r", + " case 'L2':\r", + " return 6;\r", + " case 'RT':\r", + " case 'R2':\r", + " return 7;\r", + " case 'UP':\r", + " return 12;\r", + " case 'DOWN':\r", + " return 13;\r", + " case 'LEFT':\r", + " return 14;\r", + " case 'RIGHT':\r", + " return 15;\r", + " case 'BACK':\r", + " case 'SHARE':\r", + " return 8;\r", + " case 'START':\r", + " case 'OPTIONS':\r", + " return 9;\r", + " case 'CLICK_STICK_LEFT':\r", + " return 10;\r", + " case 'CLICK_STICK_RIGHT':\r", + " return 11;\r", + " //PS4\r", + " case 'PS_BUTTON':\r", + " return 16;\r", + " case 'CLICK_TOUCHPAD':\r", + " return 17;\r", + " default:\r", + " console.error('The gamepad button: ' + buttonName + ' is not valid.');\r", + " return null;\r", " }\r", + "}\r", "\r", - " return \"UNKNOWN_BUTTON\";\r", + "/**\r", + " * @param {number} playerId\r", + " * @param {string} directionName\r", + " * @param {number} axisValueX\r", + " * @param {number} axisValueY\r", + " */\r", + "function isAxisPushed(playerId, directionName, axisValueX, axisValueY) {\r", + " switch (directionName) {\r", + " case 'LEFT':\r", + " return getNormalizedAxisValue(axisValueX, playerId) < 0;\r", + " case 'RIGHT':\r", + " return getNormalizedAxisValue(axisValueX, playerId) > 0;\r", + " case 'UP':\r", + " return getNormalizedAxisValue(axisValueY, playerId) < 0;\r", + " case 'DOWN':\r", + " return getNormalizedAxisValue(axisValueY, playerId) > 0;\r", + " case 'ANY':\r", + " return getNormalizedAxisValue(axisValueX, playerId) < 0\r", + " || getNormalizedAxisValue(axisValueX, playerId) > 0\r", + " || getNormalizedAxisValue(axisValueY, playerId) < 0\r", + " || getNormalizedAxisValue(axisValueY, playerId) > 0\r", + " default:\r", + " console.error('The value stick direction is not valid.');\r", + " return false;\r", + " }\r", "}\r", "\r", - "gdjs._extensionController.axisToAngle = function (deltaX, deltaY) {\r", + "/**\r", + " * @param {number} deltaX\r", + " * @param {number} deltaY\r", + " */\r", + "function axisToAngle(deltaX, deltaY) {\r", " const rad = Math.atan2(deltaY, deltaX);\r", " const deg = rad * (180 / Math.PI);\r", " return deg;\r", "}\r", "\r", - "gdjs._extensionController.isXbox = function (gamepad) {\r", + "/**\r", + " * @param {{id: string}} gamepad\r", + " */\r", + "function isXbox(gamepad) {\r", " return (gamepad ? (\r", " gamepad.id.toUpperCase().indexOf(\"XBOX\") !== -1\r", " // \"XINPUT\" cannot be used to check if it is a xbox controller is just a generic\r", @@ -9464,44 +9867,52 @@ " ) : false);\r", "}\r", "\r", - "//Returns the new value taking into account the dead zone for the player_ID given\r", - "gdjs._extensionController.getNormalizedAxisValue = function (v, player_ID) {\r", + "/**\r", + " * Returns the new value taking into account the dead zone for the player_ID given\r", + " * @param {number} value\r", + " * @param {number} playerID\r", + " */\r", + "function getNormalizedAxisValue(value, playerID) {\r", " // gdjs._extensionController = gdjs._extensionController || { deadzone: 0.2 };\r", "\r", " // Anything smaller than this is assumed to be 0,0\r", - " const DEADZONE = gdjs._extensionController.players[player_ID].deadzone;\r", - "\r", - " if (Math.abs(v) < DEADZONE) {\r", - " // In the dead zone, set to 0\r", - " v = 0;\r", - "\r", - " if (v == null) {\r", - " return 0;\r", - " } else {\r", - " return v;\r", - " }\r", + " const deadzone = getPlayer(playerID).deadzone;\r", "\r", + " if (Math.abs(value) < deadzone) {\r", + " return 0;\r", " } else {\r", " // We're outside the dead zone, but we'd like to smooth\r", " // this value out so it still runs nicely between 0..1.\r", " // That is, we don't want it to jump suddenly from 0 to\r", - " // DEADZONE.\r", + " // deadzone.\r", "\r", - " // Remap v from\r", - " // DEADZONE..1 to 0..(1-DEADZONE)\r", + " // Remap value from\r", + " // deadzone..1 to 0..(1-deadzone)\r", " // or from\r", - " // -1..-DEADZONE to -(1-DEADZONE)..0\r", + " // -1..-deadzone to -(1-deadzone)..0\r", + " value = value - Math.sign(value) * deadzone;\r", "\r", - " v = v - Math.sign(v) * DEADZONE;\r", - "\r", - " // Remap v from\r", - " // 0..(1-DEADZONE) to 0..1\r", + " // Remap value from\r", + " // 0..(1-deadzone) to 0..1\r", " // or from\r", - " // -(1-DEADZONE)..0 to -1..0\r", - "\r", - " return v / (1 - DEADZONE);\r", + " // -(1-deadzone)..0 to -1..0\r", + " return value / (1 - deadzone);\r", " }\r", - "};" + "}\r", + "\r", + "gdjs._extensionController = {\r", + " getPlayer,\r", + " controllerButtonNames,\r", + " getInputString,\r", + " getButtonId,\r", + " axisToAngle,\r", + " isXbox,\r", + " getNormalizedAxisValue,\r", + " isAxisPushed,\r", + " getGamepad,\r", + " onScenePostEvents,\r", + " frameBeginningTask,\r", + "}" ], "parameterObjects": "", "useStrict": true, @@ -9514,59 +9925,35 @@ { "fullName": "", "functionType": "Action", - "name": "onScenePostEvents", + "name": "onSceneLoaded", "sentence": "", "events": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [] - }, + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "// Async tasks are run before everything.\r", + "// This is a hack to make sure that button states are updated\r", + "// before mapping behavior events.\r", + "runtimeScene.getAsyncTasksManager().addTask(gdjs._extensionController.frameBeginningTask);" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "Action", + "name": "onScenePostEvents", + "sentence": "", + "events": [ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "//Each time a player press a button i save the last button pressed for the next frame", - "/** @type {Gamepad[]} */", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);", - "", - "//Get function parameter", - "let countPlayers = Object.keys(gdjs._extensionController.players).length;", - "", - "//Repeat for each players", - "for (let i = 0; i < countPlayers; i++) {", - " let gamepad = gamepads[i]; // Get the gamepad of the player", - "", - " //We have to keep this condition because if the user hasn't plugged in his controller yet, we can't get the controller in the gamepad variable.", - " if (gamepad == null) {", - " continue;", - " }", - "", - " for (let b = 0; b < Object.keys(gamepad.buttons).length; b++) { //For each buttons", - " if (gamepad.buttons[b].pressed) { //One of them is pressed", - " gdjs._extensionController.players[i].lastButtonUsed = b; //Save the button pressed", - "", - " //Save the state of the button for the next frame.", - " gdjs._extensionController.players[i].previousFrameStateButtons[b] = { pressed: true };", - "", - " // Update Last Active Controller", - " gdjs._extensionController.lastActiveController = i;", - " } else {", - " gdjs._extensionController.players[i].previousFrameStateButtons[b] = { pressed: false };", - " }", - " }", - "", - "", - " gdjs._extensionController.players[i].rumble.elapsedTime += runtimeScene.getElapsedTime(runtimeScene) / 1000;", - " if (", - " gdjs._extensionController.players[i].rumble.duration - gdjs._extensionController.players[i].rumble.elapsedTime <= 0 &&", - " (gdjs._extensionController.players[i].rumble.weakMagnitude || gdjs._extensionController.players[i].rumble.strongMagnitude)", - " ) {", - " gdjs._extensionController.players[i].rumble.weakMagnitude = 0;", - " gdjs._extensionController.players[i].rumble.strongMagnitude = 0;", - " }", - "", - "", - "}", + "gdjs._extensionController.onScenePostEvents();", "" ], "parameterObjects": "", @@ -10004,27 +10391,20 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", "\r", - "//Get function parameters\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", - "const trigger = eventsFunctionContext.getArgument(\"trigger\").toUpperCase();\r", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "const trigger = eventsFunctionContext.getArgument(\"Trigger\").toUpperCase();\r", "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier in expression: \"Pressure on a gamepad trigger\", is not valid number, must be between 0 and 4.');\r", - " return;\r", - "}\r", "if (trigger != \"LT\" && trigger != \"RT\" && trigger != \"L2\" && trigger != \"R2\") {\r", " console.error('Parameter trigger is not valid in expression: \"Pressure on a gamepad trigger\"');\r", " return;\r", "}\r", - "\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", - "if (gamepad == null) return;\r", - "\r", + "/** @type {Gamepad} */\r", + "const gamepad = gdjs._extensionController.getGamepad(playerId);\r", + "if (!gamepad) {\r", + " // The gamepad is not connected.\r", + " return;\r", + "}\r", "switch (trigger) {\r", " case 'LT':\r", " case 'L2':\r", @@ -10052,12 +10432,12 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" }, { "description": "Trigger button", - "name": "trigger", + "name": "Trigger", "supplementaryInformation": "[\"LT\",\"RT\",\"L2\",\"R2\"]", "type": "stringWithSelector" } @@ -10074,43 +10454,28 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", - "\r", - "//Get function parameters\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", - "const stick = eventsFunctionContext.getArgument(\"stick\").toUpperCase();\r", + "const { getNormalizedAxisValue } = gdjs._extensionController;\r", "\r", - "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier is not valid in expression: \"Value of a stick force\"');\r", - " return;\r", - "}\r", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "const stick = eventsFunctionContext.getArgument(\"Stick\").toUpperCase();\r", "\r", "if (stick !== \"LEFT\" && stick !== \"RIGHT\") {\r", " console.error('Parameter stick is not valid in expression: \"Value of a stick force\"');\r", " return;\r", "}\r", + "/** @type {Gamepad} */\r", + "const gamepad = gdjs._extensionController.getGamepad(playerId);\r", + "if (!gamepad) {\r", + " // The gamepad is not connected.\r", + " return;\r", + "}\r", + "const axisValueX = stick === 'RIGHT' ? gamepad.axes[2] : gamepad.axes[0];\r", + "const axisValueY = stick === 'RIGHT' ? gamepad.axes[3] : gamepad.axes[1];\r", "\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", - "if (gamepad == null) return;\r", - "\r", - "\r", - "switch (stick) {\r", - " case 'LEFT':\r", - " eventsFunctionContext.returnValue = gdjs.evtTools.common.clamp(Math.abs(gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[0], playerId)) + Math.abs(gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[1], playerId)), 0, 1);\r", - " break;\r", - "\r", - " case 'RIGHT':\r", - " eventsFunctionContext.returnValue = gdjs.evtTools.common.clamp(Math.abs(gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[2], playerId)) + Math.abs(gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[3], playerId)), 0, 1);\r", - " break;\r", - "\r", - " default:\r", - " eventsFunctionContext.returnValue = -1;\r", - " break;\r", - "}" + "eventsFunctionContext.returnValue = gdjs.evtTools.common.clamp(\r", + " Math.abs(getNormalizedAxisValue(axisValueX, playerId)) +\r", + " Math.abs(getNormalizedAxisValue(axisValueY, playerId)), 0, 1);\r", + "" ], "parameterObjects": "", "useStrict": true, @@ -10123,12 +10488,12 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" }, { "description": "Stick: \"Left\" or \"Right\"", - "name": "stick", + "name": "Stick", "supplementaryInformation": "[\"Left\",\"Right\"]", "type": "stringWithSelector" } @@ -10152,7 +10517,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "Gamepads::StickAngle(player_ID, stick)" + "Gamepads::StickAngle(PlayerId, Stick)" ] } ] @@ -10164,12 +10529,12 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" }, { "description": "Stick: \"Left\" or \"Right\"", - "name": "stick", + "name": "Stick", "supplementaryInformation": "[\"Left\",\"Right\"]", "type": "stringWithSelector" } @@ -10186,40 +10551,27 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", - "\r", - "//Get function parameters\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", - "const stick = eventsFunctionContext.getArgument(\"stick\").toUpperCase();\r", + "const { getNormalizedAxisValue } = gdjs._extensionController;\r", "\r", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "const stick = eventsFunctionContext.getArgument(\"Stick\").toUpperCase();\r", "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier is not valid in expression: \"Value of a stick rotation\"');\r", - " return;\r", - "}\r", "if (stick !== \"LEFT\" && stick !== \"RIGHT\") {\r", " console.error('Parameter stick is not valid in expression: \"Value of a stick rotation\"');\r", " return;\r", "}\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", - "if (gamepad == null) return;\r", - "\r", - "switch (stick) {\r", - " case 'LEFT':\r", - " eventsFunctionContext.returnValue = gdjs._extensionController.axisToAngle(gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[0], playerId), gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[1], playerId));\r", - " break;\r", - "\r", - " case 'RIGHT':\r", - " eventsFunctionContext.returnValue = gdjs._extensionController.axisToAngle(gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[2], playerId), gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[3], playerId));\r", - " break;\r", + "/** @type {Gamepad} */\r", + "const gamepad = gdjs._extensionController.getGamepad(playerId);\r", + "if (!gamepad) {\r", + " // The gamepad is not connected.\r", + " return;\r", + "}\r", + "const axisValueX = stick === 'RIGHT' ? gamepad.axes[2] : gamepad.axes[0];\r", + "const axisValueY = stick === 'RIGHT' ? gamepad.axes[3] : gamepad.axes[1];\r", "\r", - " default:\r", - " eventsFunctionContext.returnValue = -1;\r", - " break;\r", - "}" + "eventsFunctionContext.returnValue = gdjs._extensionController.axisToAngle(\r", + " getNormalizedAxisValue(axisValueX, playerId),\r", + " getNormalizedAxisValue(axisValueY, playerId));" ], "parameterObjects": "", "useStrict": true, @@ -10232,12 +10584,12 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" }, { "description": "Stick: \"Left\" or \"Right\"", - "name": "stick", + "name": "Stick", "supplementaryInformation": "[\"Left\",\"Right\"]", "type": "stringWithSelector" } @@ -10255,18 +10607,11 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", "\r", - "//Get function parameters\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", "const stick = eventsFunctionContext.getArgument(\"stick\").toUpperCase();\r", "const direction = eventsFunctionContext.getArgument(\"direction\").toUpperCase();\r", "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier is not valid in expression: \"Value of a gamepad axis\"');\r", - " return;\r", - "}\r", "if (stick != \"LEFT\" && stick != \"RIGHT\") {\r", " console.error('Parameter stick is not valid in expression: \"Value of a gamepad axis\"');\r", " return;\r", @@ -10275,11 +10620,12 @@ " console.error('Parameter direction is not valid in expression: \"Value of a gamepad axis\"');\r", " return;\r", "}\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", - "if (gamepad == null) return;\r", - "\r", + "/** @type {Gamepad} */\r", + "const gamepad = gdjs._extensionController.getGamepad(playerId);\r", + "if (!gamepad) {\r", + " // The gamepad is not connected.\r", + " return;\r", + "}\r", "let parameterError = false;\r", "switch (stick) {\r", " case 'LEFT':\r", @@ -10376,7 +10722,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" }, { @@ -10404,26 +10750,20 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", "\r", - "//Get function parameters\r", "const playerId = eventsFunctionContext.getArgument(\"Gamepad\") - 1;\r", "const stick = eventsFunctionContext.getArgument(\"Stick\").toLowerCase();\r", "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier is not valid in expression: \"Value of a gamepad axis\"');\r", - " return;\r", - "}\r", "if (stick != \"left\" && stick != \"right\") {\r", " console.error('Parameter stick is not valid in expression: \"Value of a gamepad axis\"');\r", " return;\r", "}\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", - "if (gamepad == null) return;\r", - "\r", + "/** @type {Gamepad} */\r", + "const gamepad = gdjs._extensionController.getGamepad(playerId);\r", + "if (!gamepad) {\r", + " // The gamepad is not connected.\r", + " return;\r", + "}\r", "const axisIndex = stick === 'right' ? 2 : 0;\r", "eventsFunctionContext.returnValue = gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[axisIndex], playerId);\r", "" @@ -10461,26 +10801,20 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", "\r", - "//Get function parameters\r", "const playerId = eventsFunctionContext.getArgument(\"Gamepad\") - 1;\r", "const stick = eventsFunctionContext.getArgument(\"Stick\").toLowerCase();\r", "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier is not valid in expression: \"Value of a gamepad axis\"');\r", - " return;\r", - "}\r", "if (stick != \"left\" && stick != \"right\") {\r", " console.error('Parameter stick is not valid in expression: \"Value of a gamepad axis\"');\r", " return;\r", "}\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", - "if (gamepad == null) return;\r", - "\r", + "/** @type {Gamepad} */\r", + "const gamepad = gdjs._extensionController.getGamepad(playerId);\r", + "if (!gamepad) {\r", + " // The gamepad is not connected.\r", + " return;\r", + "}\r", "const axisIndex = stick === 'right' ? 3 : 1;\r", "eventsFunctionContext.returnValue = gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[axisIndex], playerId);\r", "" @@ -10518,136 +10852,57 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", "\r", - "//Get function parameters\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", - "const button = eventsFunctionContext.getArgument(\"button\").toUpperCase();\r", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "const button = eventsFunctionContext.getArgument(\"Button\").toUpperCase();\r", "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier in condition: \"Gamepad button released\", is not valid number, must be between 0 and 4.');\r", - " return;\r", - "}\r", - "if (button === \"\") {\r", - " console.error('Parameter button is not valid in condition: \"Gamepad button released\"');\r", + "let buttonId = gdjs._extensionController.getButtonId(button);\r", + "if (buttonId === null) {\r", " return;\r", "}\r", + "const player = gdjs._extensionController.getPlayer(playerId)\r", + "eventsFunctionContext.returnValue = player.isButtonReleased(buttonId);" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "parameters": [ + { + "description": "The gamepad identifier: 1, 2, 3 or 4", + "name": "PlayerId", + "type": "expression" + }, + { + "description": "Name of the button", + "name": "Button", + "supplementaryInformation": "[\"A\",\"Cross\",\"B\",\"Circle\",\"X\",\"Square\",\"Y\",\"Triangle\",\"LB\",\"L1\",\"RB\",\"R1\",\"LT\",\"L2\",\"RT\",\"R2\",\"Up\",\"Down\",\"Left\",\"Right\",\"Back\",\"Share\",\"Start\",\"Options\",\"Click_Stick_Left\",\"Click_Stick_Right\",\"PS_Button\",\"Click_Touchpad\"]", + "type": "stringWithSelector" + } + ], + "objectGroups": [] + }, + { + "description": "Check if a button was just pressed on a gamepad. Buttons can be:\n* Xbox: \"A\", \"B\", \"X\", \"Y\", \"LB\", \"RB\", \"LT\", \"RT\", \"BACK\", \"START\",\n* PS4: \"CROSS\", \"SQUARE\", \"CIRCLE\", \"TRIANGLE\", \"L1\", \"L2\", \"R1\", \"R2\", \"SHARE\", \"OPTIONS\", \"PS_BUTTON\", \"CLICK_TOUCHPAD\",\n* Other: \"UP\", \"DOWN\", \"LEFT\", \"RIGHT\", \"CLICK_STICK_LEFT\", \"CLICK_STICK_RIGHT\".", + "fullName": "Gamepad button just pressed", + "functionType": "Condition", + "name": "IsButtonJustPressed", + "sentence": "Button _PARAM2_ of gamepad _PARAM1_ was just pressed", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ "\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", - "if (gamepad == null) return;\r", - "\r", - "let buttonId;\r", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "const button = eventsFunctionContext.getArgument(\"Button\").toUpperCase();\r", "\r", - "switch (button) {\r", - " case 'A':\r", - " case 'CROSS':\r", - " buttonId = 0;\r", - " break;\r", - " case 'B':\r", - " case 'CIRCLE':\r", - " buttonId = 1;\r", - " break;\r", - " case 'X':\r", - " case 'SQUARE':\r", - " buttonId = 2;\r", - " break;\r", - " case 'Y':\r", - " case 'TRIANGLE':\r", - " buttonId = 3;\r", - " break;\r", - " case 'LB':\r", - " case 'L1':\r", - " buttonId = 4;\r", - " break;\r", - " case 'RB':\r", - " case 'R1':\r", - " buttonId = 5;\r", - " break;\r", - " case 'LT':\r", - " case 'L2':\r", - " buttonId = 6;\r", - " break;\r", - " case 'RT':\r", - " case 'R2':\r", - " buttonId = 7;\r", - " break;\r", - "\r", - " case 'UP':\r", - " buttonId = 12;\r", - " break;\r", - " case 'DOWN':\r", - " buttonId = 13;\r", - " break;\r", - " case 'LEFT':\r", - " buttonId = 14;\r", - " break;\r", - " case 'RIGHT':\r", - " buttonId = 15;\r", - " break;\r", - "\r", - " case 'BACK':\r", - " case 'SHARE':\r", - " buttonId = 8;\r", - " break;\r", - " case 'START':\r", - " case 'OPTIONS':\r", - " buttonId = 9;\r", - " break;\r", - "\r", - " case 'CLICK_STICK_LEFT':\r", - " buttonId = 10;\r", - " break;\r", - " case 'CLICK_STICK_RIGHT':\r", - " buttonId = 11;\r", - " break;\r", - "\r", - " //PS4\r", - " case 'PS_BUTTON':\r", - " buttonId = 16;\r", - " break;\r", - " case 'CLICK_TOUCHPAD':\r", - " buttonId = 17;\r", - " break;\r", - "\r", - " default:\r", - " console.error('The button: ' + button + ' in condition: \"Gamepad button released\" is not valid.');\r", - " break;\r", - "}\r", - "\r", - "if (buttonId === undefined) {\r", - " console.error('There is no buttons valid in condition: \"Gamepad button released\"');\r", - " eventsFunctionContext.returnValue = false;\r", - " return;\r", - "}\r", - "\r", - "if (gamepad.buttons == null || gamepad.buttons[buttonId] == null) {\r", - " console.error('Buttons on the gamepad are not accessible in condition: \"Gamepad button released\"');\r", - " eventsFunctionContext.returnValue = false;\r", + "let buttonId = gdjs._extensionController.getButtonId(button);\r", + "if (buttonId === null) {\r", " return;\r", "}\r", - "\r", - "//Define default value on pressed button or use previous value\r", - "gdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId] = gdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId] || { pressed: false };\r", - "\r", - "//Get state of button at previous frame\r", - "const previousStateButton = gdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId].pressed;\r", - "\r", - "//When previousStateButton is true and actual button state is not pressed\r", - "//Player have release the button\r", - "if (previousStateButton === true && gamepad.buttons[buttonId].pressed === false) {\r", - " // Save the last button used for the player \r", - " gdjs._extensionController.players[playerId].lastButtonUsed = buttonId;\r", - " gdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId].pressed = true;\r", - " eventsFunctionContext.returnValue = true;\r", - "\r", - "} else {\r", - " gdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId].pressed = false;\r", - " eventsFunctionContext.returnValue = false;\r", - "}\r", - "" + "const player = gdjs._extensionController.getPlayer(playerId)\r", + "eventsFunctionContext.returnValue = player.isButtonJustPressed(buttonId);" ], "parameterObjects": "", "useStrict": true, @@ -10657,12 +10912,12 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" }, { "description": "Name of the button", - "name": "button", + "name": "Button", "supplementaryInformation": "[\"A\",\"Cross\",\"B\",\"Circle\",\"X\",\"Square\",\"Y\",\"Triangle\",\"LB\",\"L1\",\"RB\",\"R1\",\"LT\",\"L2\",\"RT\",\"R2\",\"Up\",\"Down\",\"Left\",\"Right\",\"Back\",\"Share\",\"Start\",\"Options\",\"Click_Stick_Left\",\"Click_Stick_Right\",\"PS_Button\",\"Click_Touchpad\"]", "type": "stringWithSelector" } @@ -10679,17 +10934,9 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "//Get function parameter\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", - "\r", - "//Player id is not valid\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier in expression: \"Last pressed button (id)\", is not valid number, must be between 0 and 4.');\r", - " return;\r", - "}\r", "\r", - "//Return the last button used by the player\r", - "eventsFunctionContext.returnValue = gdjs._extensionController.players[playerId].lastButtonUsed;" + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "eventsFunctionContext.returnValue = gdjs._extensionController.getPlayer(playerId).lastButtonUsed;" ], "parameterObjects": "", "useStrict": true, @@ -10702,7 +10949,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" } ], @@ -10718,46 +10965,10 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", - "\r", - "//Get function parameter\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", - "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier in condition: \"Any gamepad button pressed\", is not valid number, must be between 0 and 4.');\r", - " return;\r", - "}\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", - "if (gamepad == null) return;\r", - "\r", - "let buttonId;\r", - "for (let i = 0; i < gamepad.buttons.length; i++) { //For each buttons\r", - " if (gamepad.buttons[i].pressed) { //One of them is pressed\r", - " buttonId = i; //Save the button pressed\r", - " break;\r", - " }\r", - "}\r", - "\r", - "if (buttonId === undefined) {\r", - " // No buttons are pressed.\r", - " eventsFunctionContext.returnValue = false;\r", - " return;\r", - "}\r", - "\r", - "if (gamepad.buttons == null || gamepad.buttons[buttonId] == null) {\r", - " console.error('Buttons on the gamepad are not accessible in condition: \"Any gamepad button pressed\"');\r", - " eventsFunctionContext.returnValue = false;\r", - " return;\r", - "}\r", - "\r", - "//When a button is pressed, save the button in lastButtonUsed for each players\r", - "if (gamepad.buttons[buttonId].pressed) gdjs._extensionController.players[playerId].lastButtonUsed = buttonId;\r", - "eventsFunctionContext.returnValue = gamepad.buttons[buttonId].pressed;\r", - "\r", "\r", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "const player = gdjs._extensionController.getPlayer(playerId)\r", + "eventsFunctionContext.returnValue = player.isAnyButtonPressed();\r", "" ], "parameterObjects": "", @@ -10768,7 +10979,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" } ], @@ -10784,35 +10995,18 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", "\r", - "//Get function parameters\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", "const controllerType = eventsFunctionContext.getArgument(\"controller_type\").toUpperCase();\r", - "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier in string expression: \"Last pressed button (LastButtonString)\", is not valid number, must be between 0 and 4.');\r", + "/** @type {Gamepad} */\r", + "const gamepad = gdjs._extensionController.getGamepad(playerId);\r", + "if (!gamepad) {\r", + " // The gamepad is not connected.\r", " return;\r", "}\r", - "if (controllerType === \"\") {\r", - " console.error('Parameter controller type is not valid in string expression: \"Last pressed button (LastButtonString)\"');\r", - " return;\r", - "}\r", - "\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "if (gamepad !== null) { //Gamepad exist\r", - " //Get last btn id\r", - " const lastButtonUsedID = gdjs._extensionController.players[playerId].lastButtonUsed;\r", - "\r", - " //Return last button as string \r", - " eventsFunctionContext.returnValue = gdjs._extensionController.getInputString(controllerType, lastButtonUsedID);\r", - "\r", - "} else { //Gamepad dosen't exist\r", - " console.error('Your controller is not supported or the gamepad wasn\\'t detected in string expression: \"Last pressed button (LastButtonString)\"');\r", - " eventsFunctionContext.returnValue = \"Gamepad not connected\";\r", - "}" + "const lastButtonUsedID = gdjs._extensionController.getPlayer(playerId).lastButtonUsed;\r", + "eventsFunctionContext.returnValue = gdjs._extensionController.getInputString(controllerType, lastButtonUsedID);\r", + "" ], "parameterObjects": "", "useStrict": true, @@ -10825,7 +11019,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" }, { @@ -10847,20 +11041,16 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", "\r", - "//Get the last activated controller\r", - "const controllerId = gdjs._extensionController.lastActiveController;\r", - "\r", - "// Check if controller is active\r", - "const gamepad = gamepads[controllerId];\r", - "if (gamepad == null) {\r", - " eventsFunctionContext.returnValue = 0;\r", - "} else {\r", - " // Return active controller id\r", - " eventsFunctionContext.returnValue = controllerId + 1;\r", + "const gamepads = navigator.getGamepads ? navigator.getGamepads() : [];\r", + "let lastGamepadIndex = -1;\r", + "for (let playerId = 0; playerId < gamepads.length; playerId++) {\r", + " // Gamepads can be disconnected and become null\r", + " if (gamepads[playerId]) {\r", + " lastGamepadIndex = playerId\r", + " }\r", "}\r", - "" + "eventsFunctionContext.returnValue = lastGamepadIndex + 1;" ], "parameterObjects": "", "useStrict": true, @@ -10883,127 +11073,16 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", "\r", - "//Get function parameters\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", "const button = eventsFunctionContext.getArgument(\"button\").toUpperCase();\r", "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier in condition: \"Gamepad button pressed\", is not valid number, must be between 0 and 4.');\r", - " return;\r", - "}\r", - "if (button === \"\") {\r", - " console.error('Parameter button is not valid in condition: \"Gamepad button pressed\"');\r", - " eventsFunctionContext.returnValue = false;\r", - " return;\r", - "}\r", - "\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", - "if (gamepad == null) return;\r", - "\r", - "let buttonId;\r", - "\r", - "switch (button) {\r", - " case 'A':\r", - " case 'CROSS':\r", - " buttonId = 0;\r", - " break;\r", - " case 'B':\r", - " case 'CIRCLE':\r", - " buttonId = 1;\r", - " break;\r", - " case 'X':\r", - " case 'SQUARE':\r", - " buttonId = 2;\r", - " break;\r", - " case 'Y':\r", - " case 'TRIANGLE':\r", - " buttonId = 3;\r", - " break;\r", - " case 'LB':\r", - " case 'L1':\r", - " buttonId = 4;\r", - " break;\r", - " case 'RB':\r", - " case 'R1':\r", - " buttonId = 5;\r", - " break;\r", - " case 'LT':\r", - " case 'L2':\r", - " buttonId = 6;\r", - " break;\r", - " case 'RT':\r", - " case 'R2':\r", - " buttonId = 7;\r", - " break;\r", - "\r", - " case 'UP':\r", - " buttonId = 12;\r", - " break;\r", - " case 'DOWN':\r", - " buttonId = 13;\r", - " break;\r", - " case 'LEFT':\r", - " buttonId = 14;\r", - " break;\r", - " case 'RIGHT':\r", - " buttonId = 15;\r", - " break;\r", - "\r", - " case 'BACK':\r", - " case 'SHARE':\r", - " buttonId = 8;\r", - " break;\r", - " case 'START':\r", - " case 'OPTIONS':\r", - " buttonId = 9;\r", - " break;\r", - "\r", - " case 'CLICK_STICK_LEFT':\r", - " buttonId = 10;\r", - " break;\r", - " case 'CLICK_STICK_RIGHT':\r", - " buttonId = 11;\r", - " break;\r", - "\r", - " //PS4\r", - " case 'PS_BUTTON':\r", - " buttonId = 16;\r", - " break;\r", - " case 'CLICK_TOUCHPAD':\r", - " buttonId = 17;\r", - " break;\r", - "\r", - " default:\r", - " console.error('The button: ' + button + ' in condition: \"Gamepad button pressed\" is not valid.');\r", - " eventsFunctionContext.returnValue = false;\r", - " break;\r", - "}\r", - "\r", - "\r", - "\r", - "if (buttonId === undefined) {\r", - " console.error('There is no buttons valid in condition: \"Gamepad button pressed\"');\r", - " eventsFunctionContext.returnValue = false;\r", - " return;\r", - "}\r", - "\r", - "if (gamepad.buttons == null || gamepad.buttons[buttonId] == null) {\r", - " console.error('Buttons on the gamepad are not accessible in condition: \"Gamepad button pressed\"');\r", - " eventsFunctionContext.returnValue = false;\r", + "const buttonId = gdjs._extensionController.getButtonId(button);\r", + "if (buttonId === null) {\r", " return;\r", "}\r", - "\r", - "//When a button is pressed, save the button in lastButtonUsed for each players\r", - "if (gamepad.buttons[buttonId].pressed) gdjs._extensionController.players[playerId].lastButtonUsed = buttonId;\r", - "eventsFunctionContext.returnValue = gamepad.buttons[buttonId].pressed;\r", - "\r", - "\r", - "\r", + "const player = gdjs._extensionController.getPlayer(playerId)\r", + "eventsFunctionContext.returnValue = player.isButtonPressed(buttonId);\r", "" ], "parameterObjects": "", @@ -11014,7 +11093,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" }, { @@ -11041,15 +11120,9 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "//Get function parameter\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier in expression: \"Gamepad deadzone for sticks\", is not valid number, must be between 0 and 4.');\r", - " return;\r", - "}\r", - "///Return the deadzone value for a given player\r", - "eventsFunctionContext.returnValue = gdjs._extensionController.players[playerId].deadzone;" + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "eventsFunctionContext.returnValue = gdjs._extensionController.getPlayer(playerId).deadzone;" ], "parameterObjects": "", "useStrict": true, @@ -11062,7 +11135,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" } ], @@ -11078,18 +11151,12 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "//Get function parameter\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", - "const newDeadzone = eventsFunctionContext.getArgument(\"deadzone\");\r", "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier in action: \"Set gamepad deadzone for sticks\", is not valid, must be between 0 and 4.');\r", - " return;\r", - "}\r", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "const newDeadzone = eventsFunctionContext.getArgument(\"deadzone\");\r", "\r", - "// clamp the newDeadzone in range [0, 1].\r", "// https://github.com/4ian/GDevelop-extensions/pull/33#issuecomment-618224857\r", - "gdjs._extensionController.players[playerId].deadzone = gdjs.evtTools.common.clamp(newDeadzone, 0, 1);\r", + "gdjs._extensionController.getPlayer(playerId).deadzone = gdjs.evtTools.common.clamp(newDeadzone, 0, 1);\r", "" ], "parameterObjects": "", @@ -11100,7 +11167,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" }, { @@ -11121,141 +11188,28 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", "\r", - "//Get function parameters\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", "const stick = eventsFunctionContext.getArgument(\"stick\").toUpperCase();\r", "const direction = eventsFunctionContext.getArgument(\"direction\").toUpperCase();\r", "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier in condition: \"Gamepad stick pushed (axis)\", is not valid number, must be between 0 and 4.');\r", - " return;\r", - "}\r", "if (stick != \"LEFT\" && stick != \"RIGHT\") {\r", " console.error('Parameter stick in condition: \"Gamepad stick pushed (axis)\", is not valid, must be LEFT or RIGHT');\r", " return;\r", "}\r", "if (direction != \"UP\" && direction != \"DOWN\" && direction != \"LEFT\" && direction != \"RIGHT\" && direction != \"ANY\") {\r", - " console.error('Parameter deadzone in condition: \"Gamepad stick pushed (axis)\", is not valid, must be UP, DOWN, LEFT or RIGHT');\r", + " console.error('Parameter direction in condition: \"Gamepad stick pushed (axis)\", is not valid, must be UP, DOWN, LEFT or RIGHT');\r", " return;\r", "}\r", - "\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", - "if (gamepad == null) {\r", - " eventsFunctionContext.returnValue = false;\r", + "/** @type {Gamepad} */\r", + "const gamepad = gdjs._extensionController.getGamepad(playerId);\r", + "if (!gamepad) {\r", + " // The gamepad is not connected.\r", " return;\r", "}\r", - "\r", - "\r", - "//Define in onFirstSceneLoaded function\r", - "const getNormalizedAxisValue = gdjs._extensionController.getNormalizedAxisValue;\r", - "\r", - "switch (stick) {\r", - " case 'LEFT':\r", - " switch (direction) {\r", - " case 'LEFT':\r", - " if (getNormalizedAxisValue(gamepad.axes[0], playerId) < 0) {\r", - " eventsFunctionContext.returnValue = true;\r", - " return;\r", - " }\r", - " break;\r", - "\r", - " case 'RIGHT':\r", - " if (getNormalizedAxisValue(gamepad.axes[0], playerId) > 0) {\r", - " eventsFunctionContext.returnValue = true;\r", - " return;\r", - " }\r", - " break;\r", - "\r", - " case 'UP':\r", - " if (getNormalizedAxisValue(gamepad.axes[1], playerId) < 0) {\r", - " eventsFunctionContext.returnValue = true;\r", - " return;\r", - " }\r", - " break;\r", - "\r", - " case 'DOWN':\r", - " if (getNormalizedAxisValue(gamepad.axes[1], playerId) > 0) {\r", - " eventsFunctionContext.returnValue = true;\r", - " return;\r", - " }\r", - " break;\r", - "\r", - " case 'ANY':\r", - " if ( getNormalizedAxisValue(gamepad.axes[0], playerId) < 0\r", - " || getNormalizedAxisValue(gamepad.axes[0], playerId) > 0\r", - " || getNormalizedAxisValue(gamepad.axes[1], playerId) < 0 \r", - " || getNormalizedAxisValue(gamepad.axes[1], playerId) > 0) {\r", - " eventsFunctionContext.returnValue = true;\r", - " return;\r", - " }\r", - " break;\r", - "\r", - " default:\r", - " console.error('The value Direction on stick Left on the condition: \"Gamepad stick pushed (axis)\" is not valid.');\r", - " eventsFunctionContext.returnValue = false;\r", - " break;\r", - " }\r", - " break;\r", - "\r", - " case 'RIGHT':\r", - " switch (direction) {\r", - " case 'LEFT':\r", - " if (getNormalizedAxisValue(gamepad.axes[2], playerId) < 0) {\r", - " eventsFunctionContext.returnValue = true;\r", - " return;\r", - " }\r", - " break;\r", - "\r", - " case 'RIGHT':\r", - " if (getNormalizedAxisValue(gamepad.axes[2], playerId) > 0) {\r", - " eventsFunctionContext.returnValue = true;\r", - " return;\r", - " }\r", - " break;\r", - "\r", - " case 'UP':\r", - " if (getNormalizedAxisValue(gamepad.axes[3], playerId) < 0) {\r", - " eventsFunctionContext.returnValue = true;\r", - " return;\r", - " }\r", - " break;\r", - "\r", - " case 'DOWN':\r", - " if (getNormalizedAxisValue(gamepad.axes[3], playerId) > 0) {\r", - " eventsFunctionContext.returnValue = true;\r", - " return;\r", - " }\r", - " break;\r", - "\r", - " case 'ANY':\r", - " if ( getNormalizedAxisValue(gamepad.axes[2], playerId) < 0\r", - " || getNormalizedAxisValue(gamepad.axes[2], playerId) > 0\r", - " || getNormalizedAxisValue(gamepad.axes[3], playerId) < 0 \r", - " || getNormalizedAxisValue(gamepad.axes[3], playerId) > 0) {\r", - " eventsFunctionContext.returnValue = true;\r", - " return;\r", - " }\r", - " break;\r", - "\r", - " default:\r", - " console.error('The value Direction on stick Right on the condition: \"Gamepad stick pushed (axis)\" is not valid.');\r", - " eventsFunctionContext.returnValue = false;\r", - " break;\r", - " }\r", - " break;\r", - "\r", - " default:\r", - " console.error('The value Stick on the condition: \"Gamepad stick pushed (axis)\" is not valid.');\r", - " eventsFunctionContext.returnValue = false;\r", - " break;\r", - "}\r", - "\r", - "eventsFunctionContext.returnValue = false;\r", + "const axisValueX = stick === 'RIGHT' ? gamepad.axes[2] : gamepad.axes[0];\r", + "const axisValueY = stick === 'RIGHT' ? gamepad.axes[3] : gamepad.axes[1];\r", + "eventsFunctionContext.returnValue = gdjs._extensionController.isAxisPushed(playerId, direction, axisValueX, axisValueY);\r", "" ], "parameterObjects": "", @@ -11266,7 +11220,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" }, { @@ -11286,24 +11240,24 @@ }, { "description": "Return the number of connected gamepads.", - "fullName": "Connected gamepads number", + "fullName": "Connected gamepads count", "functionType": "Expression", "name": "ConnectedGamepadsCount", "sentence": "", "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [] - }, { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", "\r", - "// Gamepads can be disconnected and become null, so we have to filter them.\r", - "eventsFunctionContext.returnValue = Object.keys(gamepads).filter(key => !!gamepads[key]).length;\r", + "const gamepads = navigator.getGamepads ? navigator.getGamepads() : [];\r", + "let connectedGamepadCount = 0;\r", + "for (let playerId = 0; playerId < gamepads.length; playerId++) {\r", + " // Gamepads can be disconnected and become null\r", + " if (gamepads[playerId]) {\r", + " connectedGamepadCount++;\r", + " }\r", + "}\r", + "eventsFunctionContext.returnValue = connectedGamepadCount;\r", "" ], "parameterObjects": "", @@ -11327,22 +11281,13 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);", - "", - "//Get function parameter", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;", - "", - "if (playerId < 0 || playerId > 4) {", - " console.error('Parameter gamepad identifier in string expression: \"Gamepad type\", is not valid number, must be between 0 and 4');", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;", + "/** @type {Gamepad} */", + "const gamepad = gdjs._extensionController.getGamepad(playerId);", + "if (!gamepad) {", + " // The gamepad is not connected.", " return;", "}", - "", - "const gamepad = gamepads[playerId];", - "", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.", - "if (gamepad == null) return;", - "", "eventsFunctionContext.returnValue = (gamepad && gamepad.id) ? gamepad.id : \"No information for player \" + (playerId + 1)", "" ], @@ -11357,7 +11302,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" } ], @@ -11373,28 +11318,14 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);", - "", - "//Get function parameters", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;", "const controllerType = eventsFunctionContext.getArgument(\"controller_type\").toUpperCase();", - "", - "if (playerId < 0 || playerId > 4) {", - " console.error('Parameter gamepad identifier in condition: \"Gamepad type\", is not valid number, must be between 0 and 4.');", - " return;", - "}", - "if (controllerType === \"\") {", - " console.error('Parameter type in condition: \"Gamepad type\", is not a string.');", + "/** @type {Gamepad} */", + "const gamepad = gdjs._extensionController.getGamepad(playerId);", + "if (!gamepad) {", + " // The gamepad is not connected.", " return;", "}", - "", - "const gamepad = gamepads[playerId];", - "", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.", - "if (gamepad == null) return;", - "", - "", "if (controllerType == \"XBOX\") {", " eventsFunctionContext.returnValue = gdjs._extensionController.isXbox(gamepad);", "} else {", @@ -11409,7 +11340,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" }, { @@ -11430,17 +11361,9 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;", "/** @type {Gamepad[]} */", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);", - "", - "//Get function parameter", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;", - "", - "if (playerId < 0 || playerId > 4) {", - " console.error('Parameter gamepad identifier in condition: \"Gamepad connected\", is not valid number, must be between 0 and 4.');", - " return;", - "}", - "", + "const gamepads = navigator.getGamepads ? navigator.getGamepads() : [];", "// If gamepad was disconnected it will be null (so this will return false)", "// If gamepad was never connected it will be undefined (so this will return false)", "eventsFunctionContext.returnValue = !!gamepads[playerId];" @@ -11453,7 +11376,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" } ], @@ -11469,25 +11392,16 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */", - "//Vibration work only on game in browser.", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);", - "", - "//Get function parameters", - "const playerId = eventsFunctionContext.getArgument(\"Player_ID\") - 1;", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;", "const duration = eventsFunctionContext.getArgument(\"Duration\") || 1;", - "", - "if (playerId < 0 || playerId > 4) {", - " console.error('Parameter gamepad identifier in action: \"Gamepad connected\", is not valid number, must be between 0 and 4.');", - " return;", + "/** @type {Gamepad} */", + "const gamepad = gdjs._extensionController.getGamepad(playerId);", + "if (!gamepad) {", + " // The gamepad is not connected.", + " return;", "}", - "", - "const gamepad = gamepads[playerId];", - "", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.", - "if (gamepad == null) return;", - "", - "if (gamepad && gamepad.vibrationActuator) {", + "//Vibration work only on game in browser.", + "if (gamepad.vibrationActuator) {", " gamepad.vibrationActuator.playEffect(\"dual-rumble\", {", " startDelay: 0,", " duration: duration * 1000,", @@ -11504,7 +11418,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "Player_ID", + "name": "PlayerId", "type": "expression" }, { @@ -11525,35 +11439,19 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */", - "//Vibration work only on game in browser.", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);", - "", - "//Get function parameters", - "const playerId = eventsFunctionContext.getArgument(\"Player_ID\") - 1;", + "const { clamp } = gdjs.evtTools.common;", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;", "const duration = eventsFunctionContext.getArgument(\"Duration\") || 1;", - "const strongRumbleMagnitude = eventsFunctionContext.getArgument(\"StrongMagnitude\");", - "const weakRumbleMagnitude = eventsFunctionContext.getArgument(\"WeakMagnitude\");", - "", - "if (playerId < 0 || playerId > 4) {", - " console.error('Parameter gamepad identifier in action: \"Advanced gamepad vibration\", is not valid number, must be between 0 and 4.');", - " return;", - "}", - "if (weakRumbleMagnitude < 0 || weakRumbleMagnitude > 1) {", - " console.error('Parameter weakRumble identifier in action: \"Advanced gamepad vibration\", is not valid number, must be between 0 and 1.');", - " return;", - "}", - "if (strongRumbleMagnitude < 0 || strongRumbleMagnitude > 1) {", - " console.error('Parameter strongRumble identifier in action: \"Advanced gamepad vibration\", is not valid number, must be between 0 and 1.');", - " return;", + "const strongRumbleMagnitude = clamp(eventsFunctionContext.getArgument(\"StrongMagnitude\"), 0, 1);", + "const weakRumbleMagnitude = clamp(eventsFunctionContext.getArgument(\"WeakMagnitude\"), 0, 1);", + "/** @type {Gamepad} */", + "const gamepad = gdjs._extensionController.getGamepad(playerId);", + "if (!gamepad) {", + " // The gamepad is not connected.", + " return;", "}", - "", - "const gamepad = gamepads[playerId];", - "", - "//we need keep this condition because when use have not yet plug the controller we can't get the controller in the gamepad variable.", - "if (gamepad == null) return;", - "", - "if (gamepad && gamepad.vibrationActuator) {", + "//Vibration work only on game in browser.", + "if (gamepad.vibrationActuator) {", " gamepad.vibrationActuator.playEffect(\"dual-rumble\", {", " startDelay: 0,", " duration: duration * 1000,", @@ -11561,11 +11459,11 @@ " strongMagnitude: strongRumbleMagnitude", " });", "}", - "", - "gdjs._extensionController.players[playerId].rumble.duration = duration;", - "gdjs._extensionController.players[playerId].rumble.elapsedTime = 0;", - "gdjs._extensionController.players[playerId].rumble.weakMagnitude = weakRumbleMagnitude;", - "gdjs._extensionController.players[playerId].rumble.strongMagnitude = strongRumbleMagnitude;" + "const player = gdjs._extensionController.getPlayer(playerId)", + "player.rumble.duration = duration;", + "player.rumble.elapsedTime = 0;", + "player.rumble.weakMagnitude = weakRumbleMagnitude;", + "player.rumble.strongMagnitude = strongRumbleMagnitude;" ], "parameterObjects": "", "useStrict": true, @@ -11575,7 +11473,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "Player_ID", + "name": "PlayerId", "type": "expression" }, { @@ -11606,39 +11504,22 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */", - "//Vibration work only on game in browser.", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);", - "", - "//Get function parameters", - "const playerId = eventsFunctionContext.getArgument(\"Player_ID\") - 1;", - "const elapsedTime = gdjs._extensionController.players[playerId].rumble.elapsedTime || 0;", - "const originalDuration = gdjs._extensionController.players[playerId].rumble.duration || 1;", - "const strongRumbleMagnitude = eventsFunctionContext.getArgument(\"StrongMagnitude\");", - "const weakRumbleMagnitude = eventsFunctionContext.getArgument(\"WeakMagnitude\");", - "", - "", - "if (playerId < 0 || playerId > 4) {", - " console.error('Parameter gamepad identifier in action: \"Change gamepad active vibration\", is not valid number, must be between 0 and 4.');", - " return;", - "}", - "if (weakRumbleMagnitude < 0 || weakRumbleMagnitude > 1) {", - " console.error('Parameter weakRumble identifier in action: \"Change gamepad active vibration\", is not valid number, must be between 0 and 1.');", - " return;", - "}", - "if (strongRumbleMagnitude < 0 || strongRumbleMagnitude > 1) {", - " console.error('Parameter strongRumble identifier in action: \"Change gamepad active vibration\", is not valid number, must be between 0 and 1.');", - " return;", + "const { clamp } = gdjs.evtTools.common;", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;", + "const player = gdjs._extensionController.getPlayer(playerId);", + "const elapsedTime = player.rumble.elapsedTime || 0;", + "const originalDuration = player.rumble.duration || 1;", + "const strongRumbleMagnitude = clamp(eventsFunctionContext.getArgument(\"StrongMagnitude\"), 0, 1);", + "const weakRumbleMagnitude = clamp(eventsFunctionContext.getArgument(\"WeakMagnitude\"), 0, 1);", + "/** @type {Gamepad} */", + "const gamepad = gdjs._extensionController.getGamepad(playerId);", + "if (!gamepad) {", + " // The gamepad is not connected.", + " return;", "}", - "", - "const gamepad = gamepads[playerId];", - "", - "//we need keep this condition because when use have not yet plug the controller we can't get the controller in the gamepad variable.", - "if (gamepad == null) return;", - "", "if (originalDuration - elapsedTime <= 0) return;", - "", - "if (gamepad && gamepad.vibrationActuator) {", + "//Vibration work only on game in browser.", + "if (gamepad.vibrationActuator) {", " gamepad.vibrationActuator.playEffect(\"dual-rumble\", {", " startDelay: 0,", " duration: 1000 * (originalDuration - elapsedTime),", @@ -11647,8 +11528,8 @@ " });", "}", "", - "gdjs._extensionController.players[playerId].rumble.weakMagnitude = weakRumbleMagnitude;", - "gdjs._extensionController.players[playerId].rumble.strongMagnitude = strongRumbleMagnitude;" + "player.rumble.weakMagnitude = weakRumbleMagnitude;", + "player.rumble.strongMagnitude = strongRumbleMagnitude;" ], "parameterObjects": "", "useStrict": true, @@ -11658,7 +11539,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "Player_ID", + "name": "PlayerId", "type": "expression" }, { @@ -11689,54 +11570,10 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", - "\r", - "//Get function parameters\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", - "\r", - "if (playerId < 0 || playerId > 4) {\r", - "\tconsole.error('Parameter gamepad identifier in condition: \"Any gamepad button released\", is not valid number, must be between 0 and 4.');\r", - "\treturn;\r", - "}\r", - "\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", - "if (gamepad == null) return;\r", - "\r", - "for (let buttonId = 0; buttonId < gamepad.buttons.length; buttonId++) { //For each buttons on current frame.\r", - "\r", - "\tif (buttonId === undefined) {\r", - "\t\teventsFunctionContext.returnValue = false;\r", - "\t\treturn;\r", - "\t}\r", - "\r", - "\t//Get previous value or define value by default for the current button\r", - "\tgdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId] = gdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId] || { pressed: false };\r", "\r", - "\t//Get state of the button at previous frame\r", - "\tconst previousStateButtonIsPressed = gdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId].pressed;\r", - "\r", - "\t//Get the state of the button on the current frame.\r", - "\tconst currentFrameStateButtonIsPressed = gamepad.buttons[buttonId].pressed;\r", - "\r", - "\t//When previousStateButtonIsPressed is true and actual button state is not pressed\r", - "\t//Player have release the button\r", - "\tif (previousStateButtonIsPressed === true && currentFrameStateButtonIsPressed === false) {\r", - "\t\tgdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId].pressed = true;\r", - "\t\teventsFunctionContext.returnValue = true;\r", - "\t\t//break;\r", - "\t\treturn;\r", - "\t} else {\r", - "\t\t//The player didn't released the button yet, the previous frame state is still true\r", - "\t\tgdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId].pressed = false;\r", - "\t\teventsFunctionContext.returnValue = false;\r", - "\t}\r", - "\r", - "\tif (currentFrameStateButtonIsPressed) gdjs._extensionController.players[playerId].lastButtonUsed = buttonId;\r", - "}\r", - "" + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "const player = gdjs._extensionController.getPlayer(playerId)\r", + "eventsFunctionContext.returnValue = player.isAnyButtonReleased();" ], "parameterObjects": "", "useStrict": true, @@ -11746,7 +11583,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" } ], @@ -11762,8 +11599,8 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "const playerId = eventsFunctionContext.getArgument(\"Player_ID\") - 1;\r", - "eventsFunctionContext.returnValue = gdjs._extensionController.players[playerId].rumble.weakMagnitude;" + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "eventsFunctionContext.returnValue = gdjs._extensionController.getPlayer(playerId).rumble.weakMagnitude;" ], "parameterObjects": "", "useStrict": true, @@ -11776,7 +11613,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "Player_ID", + "name": "PlayerId", "type": "expression" } ], @@ -11792,8 +11629,8 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "const playerId = eventsFunctionContext.getArgument(\"Player_ID\") - 1;\r", - "eventsFunctionContext.returnValue = gdjs._extensionController.players[playerId].rumble.strongMagnitude;" + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "eventsFunctionContext.returnValue = gdjs._extensionController.getPlayer(playerId).rumble.strongMagnitude;" ], "parameterObjects": "", "useStrict": true, @@ -11806,7 +11643,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "Player_ID", + "name": "PlayerId", "type": "expression" } ], @@ -11819,6 +11656,7 @@ "fullName": "Platformer gamepad mapper", "name": "PlatformerGamepadMapper", "objectType": "", + "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -12258,275 +12096,6 @@ { "type": "BuiltinCommonInstructions::Standard", "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "JumpButton", - "=", - "\"A or Cross\"" - ] - }, - { - "type": { - "value": "Gamepads::C_Button_pressed" - }, - "parameters": [ - "", - "GamepadIdentifier", - "\"A\"", - "\"Left\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateJumpKey" - }, - "parameters": [ - "Object", - "PlatformerCharacter" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "JumpButton", - "=", - "\"B or Circle\"" - ] - }, - { - "type": { - "value": "Gamepads::C_Button_pressed" - }, - "parameters": [ - "", - "GamepadIdentifier", - "\"B\"", - "\"Left\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateJumpKey" - }, - "parameters": [ - "Object", - "PlatformerCharacter" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "JumpButton", - "=", - "\"X or Square\"" - ] - }, - { - "type": { - "value": "Gamepads::C_Button_pressed" - }, - "parameters": [ - "", - "GamepadIdentifier", - "\"X\"", - "\"Left\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateJumpKey" - }, - "parameters": [ - "Object", - "PlatformerCharacter" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "JumpButton", - "=", - "\"Y or Triangle\"" - ] - }, - { - "type": { - "value": "Gamepads::C_Button_pressed" - }, - "parameters": [ - "", - "GamepadIdentifier", - "\"Y\"", - "\"Left\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateJumpKey" - }, - "parameters": [ - "Object", - "PlatformerCharacter" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "JumpButton", - "=", - "\"LB or L1\"" - ] - }, - { - "type": { - "value": "Gamepads::C_Button_pressed" - }, - "parameters": [ - "", - "GamepadIdentifier", - "\"LB\"", - "\"Left\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateJumpKey" - }, - "parameters": [ - "Object", - "PlatformerCharacter" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "JumpButton", - "=", - "\"RB or R1\"" - ] - }, - { - "type": { - "value": "Gamepads::C_Button_pressed" - }, - "parameters": [ - "", - "GamepadIdentifier", - "\"RB\"", - "\"Left\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateJumpKey" - }, - "parameters": [ - "Object", - "PlatformerCharacter" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "JumpButton", - "=", - "\"LT or L2\"" - ] - }, - { - "type": { - "value": "Gamepads::C_Button_pressed" - }, - "parameters": [ - "", - "GamepadIdentifier", - "\"LT\"", - "\"Left\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateJumpKey" - }, - "parameters": [ - "Object", - "PlatformerCharacter" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "JumpButton", - "=", - "\"RT or R2\"" - ] - }, { "type": { "value": "Gamepads::C_Button_pressed" @@ -12534,7 +12103,7 @@ "parameters": [ "", "GamepadIdentifier", - "\"RT\"", + "Buttons[JumpButton]", "\"Left\"" ] } @@ -12578,6 +12147,7 @@ "extraInformation": [ "PlatformBehavior::PlatformerObjectBehavior" ], + "choices": [], "name": "PlatformerCharacter" }, { @@ -12612,18 +12182,42 @@ "type": "Choice", "label": "Jump button", "group": "Controls", - "extraInformation": [ - "A or Cross", - "B or Circle", - "X or Square", - "Y or Triangle", - "LB or L1", - "RB or R1", - "LT or L2", - "RT or R2" - ], - "name": "JumpButton" - } + "choices": [ + { + "label": "A or Cross", + "value": "A or Cross" + }, + { + "label": "B or Circle", + "value": "B or Circle" + }, + { + "label": "X or Square", + "value": "X or Square" + }, + { + "label": "Y or Triangle", + "value": "Y or Triangle" + }, + { + "label": "LB or L1", + "value": "LB or L1" + }, + { + "label": "RB or R1", + "value": "RB or R1" + }, + { + "label": "LT or L2", + "value": "LT or L2" + }, + { + "label": "RT or R2", + "value": "RT or R2" + } + ], + "name": "JumpButton" + } ], "sharedPropertyDescriptors": [] }, @@ -12632,6 +12226,7 @@ "fullName": "3D platformer gamepad mapper", "name": "Platformer3DGamepadMapper", "objectType": "", + "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -12700,53 +12295,6 @@ { "type": "BuiltinCommonInstructions::Standard", "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "JumpButton", - "=", - "\"A or Cross\"" - ] - }, - { - "type": { - "value": "Gamepads::C_Button_pressed" - }, - "parameters": [ - "", - "GamepadIdentifier", - "\"A\"", - "\"Left\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" - }, - "parameters": [ - "Object", - "PhysicsCharacter3D" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "JumpButton", - "=", - "\"B or Circle\"" - ] - }, { "type": { "value": "Gamepads::C_Button_pressed" @@ -12754,7 +12302,7 @@ "parameters": [ "", "GamepadIdentifier", - "\"B\"", + "Buttons[JumpButton]", "\"Left\"" ] } @@ -12770,77 +12318,160 @@ ] } ] - }, + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "Gamepads::Platformer3DGamepadMapper", + "type": "behavior" + } + ], + "objectGroups": [] + } + ], + "propertyDescriptors": [ + { + "value": "", + "type": "Behavior", + "label": "3D physics character", + "extraInformation": [ + "Physics3D::PhysicsCharacter3D" + ], + "choices": [], + "name": "PhysicsCharacter3D" + }, + { + "value": "1", + "type": "Number", + "label": "Gamepad identifier (1, 2, 3 or 4)", + "name": "GamepadIdentifier" + }, + { + "value": "Left", + "type": "Choice", + "label": "Walk joystick", + "group": "Controls", + "choices": [ + { + "label": "Left", + "value": "Left" + }, + { + "label": "Right", + "value": "Right" + } + ], + "name": "JoystickIdentifier" + }, + { + "value": "A or Cross", + "type": "Choice", + "label": "Jump button", + "group": "Controls", + "choices": [ + { + "label": "A or Cross", + "value": "A or Cross" + }, + { + "label": "B or Circle", + "value": "B or Circle" + }, + { + "label": "X or Square", + "value": "X or Square" + }, + { + "label": "Y or Triangle", + "value": "Y or Triangle" + }, + { + "label": "LB or L1", + "value": "LB or L1" + }, + { + "label": "RB or R1", + "value": "RB or R1" + }, + { + "label": "LT or L2", + "value": "LT or L2" + }, + { + "label": "RT or R2", + "value": "RT or R2" + } + ], + "name": "JumpButton" + } + ], + "sharedPropertyDescriptors": [] + }, + { + "description": "Control a 3D physics character with a gamepad.", + "fullName": "3D shooter gamepad mapper", + "name": "Shooter3DGamepadMapper", + "objectType": "", + "quickCustomizationVisibility": "hidden", + "eventsFunctions": [ + { + "fullName": "", + "functionType": "Action", + "name": "doStepPreEvents", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "JumpButton", - "=", - "\"X or Square\"" - ] - }, - { - "type": { - "value": "Gamepads::C_Button_pressed" - }, - "parameters": [ - "", - "GamepadIdentifier", - "\"X\"", - "\"Left\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" - }, - "parameters": [ - "Object", - "PhysicsCharacter3D" - ] - } + "type": { + "value": "Gamepads::C_Controller_X_is_connected" + }, + "parameters": [ + "", + "GamepadIdentifier", + "" ] - }, + } + ], + "actions": [], + "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "value": "StringVariable" - }, - "parameters": [ - "JumpButton", - "=", - "\"Y or Triangle\"" - ] - }, - { - "type": { - "value": "Gamepads::C_Button_pressed" + "value": "Gamepads::StickForce" }, "parameters": [ "", + ">", + "0", "GamepadIdentifier", - "\"Y\"", - "\"Left\"" + "WalkStick", + "" ] } ], "actions": [ { "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" + "value": "Physics3D::PhysicsCharacter3D::SimulateStick" }, "parameters": [ "Object", - "PhysicsCharacter3D" + "PhysicsCharacter3D", + "Gamepads::StickAngle(GamepadIdentifier, WalkStick)", + "Gamepads::StickForce(GamepadIdentifier, WalkStick)" ] } ] @@ -12848,16 +12479,6 @@ { "type": "BuiltinCommonInstructions::Standard", "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "JumpButton", - "=", - "\"LB or L1\"" - ] - }, { "type": { "value": "Gamepads::C_Button_pressed" @@ -12865,118 +12486,7 @@ "parameters": [ "", "GamepadIdentifier", - "\"LB\"", - "\"Left\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" - }, - "parameters": [ - "Object", - "PhysicsCharacter3D" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "JumpButton", - "=", - "\"RB or R1\"" - ] - }, - { - "type": { - "value": "Gamepads::C_Button_pressed" - }, - "parameters": [ - "", - "GamepadIdentifier", - "\"RB\"", - "\"Left\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" - }, - "parameters": [ - "Object", - "PhysicsCharacter3D" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "JumpButton", - "=", - "\"LT or L2\"" - ] - }, - { - "type": { - "value": "Gamepads::C_Button_pressed" - }, - "parameters": [ - "", - "GamepadIdentifier", - "\"LT\"", - "\"Left\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" - }, - "parameters": [ - "Object", - "PhysicsCharacter3D" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "JumpButton", - "=", - "\"RT or R2\"" - ] - }, - { - "type": { - "value": "Gamepads::C_Button_pressed" - }, - "parameters": [ - "", - "GamepadIdentifier", - "\"RT\"", + "Buttons[JumpButton]", "\"Left\"" ] } @@ -13005,7 +12515,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "Gamepads::Platformer3DGamepadMapper", + "supplementaryInformation": "Gamepads::Shooter3DGamepadMapper", "type": "behavior" } ], @@ -13020,6 +12530,7 @@ "extraInformation": [ "Physics3D::PhysicsCharacter3D" ], + "choices": [], "name": "PhysicsCharacter3D" }, { @@ -13033,26 +12544,73 @@ "type": "Choice", "label": "Walk joystick", "group": "Controls", - "extraInformation": [ - "Left", - "Right" + "choices": [ + { + "label": "Left", + "value": "Left" + }, + { + "label": "Right", + "value": "Right" + } ], - "name": "JoystickIdentifier" + "name": "WalkStick" + }, + { + "value": "Right", + "type": "Choice", + "label": "Camera joystick", + "group": "Controls", + "choices": [ + { + "label": "Left", + "value": "Left" + }, + { + "label": "Right", + "value": "Right" + } + ], + "name": "CameraStick" }, { "value": "A or Cross", "type": "Choice", "label": "Jump button", "group": "Controls", - "extraInformation": [ - "A or Cross", - "B or Circle", - "X or Square", - "Y or Triangle", - "LB or L1", - "RB or R1", - "LT or L2", - "RT or R2" + "choices": [ + { + "label": "A or Cross", + "value": "A or Cross" + }, + { + "label": "B or Circle", + "value": "B or Circle" + }, + { + "label": "X or Square", + "value": "X or Square" + }, + { + "label": "Y or Triangle", + "value": "Y or Triangle" + }, + { + "label": "LB or L1", + "value": "LB or L1" + }, + { + "label": "RB or R1", + "value": "RB or R1" + }, + { + "label": "LT or L2", + "value": "LT or L2" + }, + { + "label": "RT or R2", + "value": "RT or R2" + } ], "name": "JumpButton" } @@ -13060,10 +12618,11 @@ "sharedPropertyDescriptors": [] }, { - "description": "Control a 3D physics character with a gamepad.", - "fullName": "3D shooter gamepad mapper", - "name": "Shooter3DGamepadMapper", + "description": "Control camera rotations with a gamepad.", + "fullName": "First person camera gamepad mapper", + "name": "FirstPersonGamepadMapper", "objectType": "", + "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -13071,347 +12630,82 @@ "name": "doStepPreEvents", "sentence": "", "events": [ + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "TODO It's probably a bad idea to rotate the object around Y." + }, { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "conditions": [], + "actions": [ { "type": { - "value": "Gamepads::C_Controller_X_is_connected" + "value": "SetNumberVariable" }, "parameters": [ - "", - "GamepadIdentifier", - "" - ] - } - ], - "actions": [], - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "Gamepads::StickForce" - }, - "parameters": [ - "", - ">", - "0", - "GamepadIdentifier", - "WalkStick", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateStick" - }, - "parameters": [ - "Object", - "PhysicsCharacter3D", - "Gamepads::StickAngle(GamepadIdentifier, WalkStick)", - "Gamepads::StickForce(GamepadIdentifier, WalkStick)" - ] - } + "CurrentRotationSpeedZ", + "=", + "Gamepads::AcceleratedSpeed(CurrentRotationSpeedZ, Gamepads::StickForceX(GamepadIdentifier, CameraStick) * HorizontalRotationSpeedMax, HorizontalRotationSpeedMax, HorizontalRotationAcceleration, HorizontalRotationDeceleration)" ] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "JumpButton", - "=", - "\"A or Cross\"" - ] - }, - { - "type": { - "value": "Gamepads::C_Button_pressed" - }, - "parameters": [ - "", - "GamepadIdentifier", - "\"A\"", - "\"Left\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" - }, - "parameters": [ - "Object", - "PhysicsCharacter3D" - ] - } + "type": { + "value": "SetAngle" + }, + "parameters": [ + "Object", + "+", + "CurrentRotationSpeedZ * TimeDelta()" ] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "JumpButton", - "=", - "\"B or Circle\"" - ] - }, - { - "type": { - "value": "Gamepads::C_Button_pressed" - }, - "parameters": [ - "", - "GamepadIdentifier", - "\"B\"", - "\"Left\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" - }, - "parameters": [ - "Object", - "PhysicsCharacter3D" - ] - } + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "CurrentRotationSpeedY", + "=", + "Gamepads::AcceleratedSpeed(CurrentRotationSpeedY, Gamepads::StickForceY(GamepadIdentifier, CameraStick) * VerticalRotationSpeedMax, VerticalRotationSpeedMax, VerticalRotationAcceleration, VerticalRotationDeceleration)" ] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "JumpButton", - "=", - "\"X or Square\"" - ] - }, - { - "type": { - "value": "Gamepads::C_Button_pressed" - }, - "parameters": [ - "", - "GamepadIdentifier", - "\"X\"", - "\"Left\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" - }, - "parameters": [ - "Object", - "PhysicsCharacter3D" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "JumpButton", - "=", - "\"Y or Triangle\"" - ] - }, - { - "type": { - "value": "Gamepads::C_Button_pressed" - }, - "parameters": [ - "", - "GamepadIdentifier", - "\"Y\"", - "\"Left\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" - }, - "parameters": [ - "Object", - "PhysicsCharacter3D" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "JumpButton", - "=", - "\"LB or L1\"" - ] - }, - { - "type": { - "value": "Gamepads::C_Button_pressed" - }, - "parameters": [ - "", - "GamepadIdentifier", - "\"LB\"", - "\"Left\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" - }, - "parameters": [ - "Object", - "PhysicsCharacter3D" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "JumpButton", - "=", - "\"RB or R1\"" - ] - }, - { - "type": { - "value": "Gamepads::C_Button_pressed" - }, - "parameters": [ - "", - "GamepadIdentifier", - "\"RB\"", - "\"Left\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" - }, - "parameters": [ - "Object", - "PhysicsCharacter3D" - ] - } + "type": { + "value": "Scene3D::Base3DBehavior::SetRotationY" + }, + "parameters": [ + "Object", + "Object3D", + "+", + "CurrentRotationSpeedY * TimeDelta()" ] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "JumpButton", - "=", - "\"LT or L2\"" - ] - }, - { - "type": { - "value": "Gamepads::C_Button_pressed" - }, - "parameters": [ - "", - "GamepadIdentifier", - "\"LT\"", - "\"Left\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" - }, - "parameters": [ - "Object", - "PhysicsCharacter3D" - ] - } + "type": { + "value": "Scene3D::Base3DBehavior::SetRotationY" + }, + "parameters": [ + "Object", + "Object3D", + "=", + "clamp(Object.Object3D::RotationY(), VerticalAngleMin, VerticalAngleMax)" ] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "JumpButton", - "=", - "\"RT or R2\"" - ] - }, - { - "type": { - "value": "Gamepads::C_Button_pressed" - }, - "parameters": [ - "", - "GamepadIdentifier", - "\"RT\"", - "\"Left\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" - }, - "parameters": [ - "Object", - "PhysicsCharacter3D" - ] - } + "type": { + "value": "Gamepads::FirstPersonGamepadMapper::LookFromObjectEyes" + }, + "parameters": [ + "Object", + "Behavior", + "" ] } ] @@ -13426,174 +12720,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "Gamepads::Shooter3DGamepadMapper", - "type": "behavior" - } - ], - "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "", - "type": "Behavior", - "label": "3D physics character", - "extraInformation": [ - "Physics3D::PhysicsCharacter3D" - ], - "name": "PhysicsCharacter3D" - }, - { - "value": "1", - "type": "Number", - "label": "Gamepad identifier (1, 2, 3 or 4)", - "name": "GamepadIdentifier" - }, - { - "value": "Left", - "type": "Choice", - "label": "Walk joystick", - "group": "Controls", - "extraInformation": [ - "Left", - "Right" - ], - "name": "WalkStick" - }, - { - "value": "Right", - "type": "Choice", - "label": "Camera joystick", - "group": "Controls", - "extraInformation": [ - "Left", - "Right" - ], - "name": "CameraStick" - }, - { - "value": "A or Cross", - "type": "Choice", - "label": "Jump button", - "group": "Controls", - "extraInformation": [ - "A or Cross", - "B or Circle", - "X or Square", - "Y or Triangle", - "LB or L1", - "RB or R1", - "LT or L2", - "RT or R2" - ], - "name": "JumpButton" - } - ], - "sharedPropertyDescriptors": [] - }, - { - "description": "Control camera rotations with a gamepad.", - "fullName": "First person camera gamepad mapper", - "name": "FirstPersonGamepadMapper", - "objectType": "", - "eventsFunctions": [ - { - "fullName": "", - "functionType": "Action", - "name": "doStepPreEvents", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 - }, - "comment": "TODO It's probably a bad idea to rotate the object around Y." - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "CurrentRotationSpeedZ", - "=", - "Gamepads::AcceleratedSpeed(CurrentRotationSpeedZ, Gamepads::StickForceX(GamepadIdentifier, CameraStick) * HorizontalRotationSpeedMax, HorizontalRotationSpeedMax, HorizontalRotationAcceleration, HorizontalRotationDeceleration)" - ] - }, - { - "type": { - "value": "SetAngle" - }, - "parameters": [ - "Object", - "+", - "CurrentRotationSpeedZ * TimeDelta()" - ] - }, - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "CurrentRotationSpeedY", - "=", - "Gamepads::AcceleratedSpeed(CurrentRotationSpeedY, Gamepads::StickForceY(GamepadIdentifier, CameraStick) * VerticalRotationSpeedMax, VerticalRotationSpeedMax, VerticalRotationAcceleration, VerticalRotationDeceleration)" - ] - }, - { - "type": { - "value": "Scene3D::Base3DBehavior::SetRotationY" - }, - "parameters": [ - "Object", - "Object3D", - "+", - "CurrentRotationSpeedY * TimeDelta()" - ] - }, - { - "type": { - "value": "Scene3D::Base3DBehavior::SetRotationY" - }, - "parameters": [ - "Object", - "Object3D", - "=", - "clamp(Object.Object3D::RotationY(), VerticalAngleMin, VerticalAngleMax)" - ] - }, - { - "type": { - "value": "Gamepads::FirstPersonGamepadMapper::LookFromObjectEyes" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "Gamepads::FirstPersonGamepadMapper", + "supplementaryInformation": "Gamepads::FirstPersonGamepadMapper", "type": "behavior" } ], @@ -14383,13 +13510,421 @@ "conditions": [], "actions": [ { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "OffsetZ", - "=", - "Value" + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "OffsetZ", + "=", + "Value" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "Gamepads::FirstPersonGamepadMapper", + "type": "behavior" + } + ], + "objectGroups": [] + } + ], + "propertyDescriptors": [ + { + "value": "", + "type": "Behavior", + "label": "3D capability", + "extraInformation": [ + "Scene3D::Base3DBehavior" + ], + "choices": [], + "name": "Object3D" + }, + { + "value": "1", + "type": "Number", + "label": "Gamepad identifier (1, 2, 3 or 4)", + "name": "GamepadIdentifier" + }, + { + "value": "Right", + "type": "Choice", + "label": "Camera joystick", + "choices": [ + { + "label": "Left", + "value": "Left" + }, + { + "label": "Right", + "value": "Right" + } + ], + "name": "CameraStick" + }, + { + "value": "180", + "type": "Number", + "unit": "AngularSpeed", + "label": "Maximum rotation speed", + "group": "Horizontal rotation", + "name": "HorizontalRotationSpeedMax" + }, + { + "value": "360", + "type": "Number", + "label": "Rotation acceleration", + "group": "Horizontal rotation", + "name": "HorizontalRotationAcceleration" + }, + { + "value": "720", + "type": "Number", + "label": "Rotation deceleration", + "group": "Horizontal rotation", + "name": "HorizontalRotationDeceleration" + }, + { + "value": "120", + "type": "Number", + "unit": "AngularSpeed", + "label": "Maximum rotation speed", + "group": "Vertical rotation", + "name": "VerticalRotationSpeedMax" + }, + { + "value": "240", + "type": "Number", + "label": "Rotation acceleration", + "group": "Vertical rotation", + "name": "VerticalRotationAcceleration" + }, + { + "value": "480", + "type": "Number", + "label": "Rotation deceleration", + "group": "Vertical rotation", + "name": "VerticalRotationDeceleration" + }, + { + "value": "-90", + "type": "Number", + "unit": "DegreeAngle", + "label": "Minimum angle", + "group": "Vertical rotation", + "name": "VerticalAngleMin" + }, + { + "value": "90", + "type": "Number", + "unit": "DegreeAngle", + "label": "Maximum angle", + "group": "Vertical rotation", + "name": "VerticalAngleMax" + }, + { + "value": "0", + "type": "Number", + "unit": "Pixel", + "label": "Z position offset", + "group": "Position", + "name": "OffsetZ" + }, + { + "value": "0", + "type": "Number", + "unit": "AngularSpeed", + "label": "Current rotation speed Z", + "hidden": true, + "name": "CurrentRotationSpeedZ" + }, + { + "value": "0", + "type": "Number", + "unit": "AngularSpeed", + "label": "Current rotation speed Y", + "hidden": true, + "name": "CurrentRotationSpeedY" + } + ], + "sharedPropertyDescriptors": [] + }, + { + "description": "Control a 3D physics car with a gamepad.", + "fullName": "3D car gamepad mapper", + "name": "PhysicsCar3DGamepadMapper", + "objectType": "", + "quickCustomizationVisibility": "hidden", + "eventsFunctions": [ + { + "fullName": "", + "functionType": "Action", + "name": "doStepPreEvents", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::C_Controller_X_is_connected" + }, + "parameters": [ + "", + "GamepadIdentifier", + "" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "UseArrows", + "True", + "" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::C_Button_pressed" + }, + "parameters": [ + "", + "GamepadIdentifier", + "\"Left\"", + "\"Left\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "Physics3D::PhysicsCar3D::SimulateLeftKey" + }, + "parameters": [ + "Object", + "PhysicsCar3D" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::C_Button_pressed" + }, + "parameters": [ + "", + "GamepadIdentifier", + "\"Right\"", + "\"Left\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "Physics3D::PhysicsCar3D::SimulateRightKey" + }, + "parameters": [ + "Object", + "PhysicsCar3D" + ] + } + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "UseLeftStick", + "True", + "" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::C_Axis_pushed" + }, + "parameters": [ + "", + "1", + "\"Left\"", + "\"Any\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "Physics3D::PhysicsCar3D::SimulateSteeringStick" + }, + "parameters": [ + "Object", + "PhysicsCar3D", + "Gamepads::StickForceX(GamepadIdentifier, \"Left\")" + ] + } + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "UseRightStick", + "True", + "" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::C_Axis_pushed" + }, + "parameters": [ + "", + "1", + "\"Right\"", + "\"Any\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "Physics3D::PhysicsCar3D::SimulateSteeringStick" + }, + "parameters": [ + "Object", + "PhysicsCar3D", + "Gamepads::StickForceX(GamepadIdentifier, \"Right\")" + ] + } + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::Or" + }, + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "Gamepads::C_Button_pressed" + }, + "parameters": [ + "", + "1", + "\"LT\"", + "\"Up\"" + ] + }, + { + "type": { + "value": "Gamepads::C_Button_pressed" + }, + "parameters": [ + "", + "1", + "\"RT\"", + "\"Up\"" + ] + } + ] + } + ], + "actions": [ + { + "type": { + "value": "Physics3D::PhysicsCar3D::SimulateAcceleratorStick" + }, + "parameters": [ + "Object", + "PhysicsCar3D", + "Gamepads::TriggerPressure(GamepadIdentifier, \"RT\") - Gamepads::TriggerPressure(GamepadIdentifier, \"LT\")" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::C_Button_pressed" + }, + "parameters": [ + "", + "GamepadIdentifier", + "Buttons[HandBrakeButton]", + "\"Left\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "Physics3D::PhysicsCar3D::SimulateHandBrakeKey" + }, + "parameters": [ + "Object", + "PhysicsCar3D" + ] + } ] } ] @@ -14404,7 +13939,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "Gamepads::FirstPersonGamepadMapper", + "supplementaryInformation": "Gamepads::PhysicsCar3DGamepadMapper", "type": "behavior" } ], @@ -14415,11 +13950,12 @@ { "value": "", "type": "Behavior", - "label": "3D capability", + "label": "3D physics car", "extraInformation": [ - "Scene3D::Base3DBehavior" + "Physics3D::PhysicsCar3D" ], - "name": "Object3D" + "choices": [], + "name": "PhysicsCar3D" }, { "value": "1", @@ -14428,98 +13964,66 @@ "name": "GamepadIdentifier" }, { - "value": "Right", - "type": "Choice", - "label": "Camera joystick", - "extraInformation": [ - "Left", - "Right" - ], - "name": "CameraStick" - }, - { - "value": "180", - "type": "Number", - "unit": "AngularSpeed", - "label": "Maximum rotation speed", - "group": "Horizontal rotation", - "name": "HorizontalRotationSpeedMax" - }, - { - "value": "360", - "type": "Number", - "label": "Rotation acceleration", - "group": "Horizontal rotation", - "name": "HorizontalRotationAcceleration" - }, - { - "value": "720", - "type": "Number", - "label": "Rotation deceleration", - "group": "Horizontal rotation", - "name": "HorizontalRotationDeceleration" - }, - { - "value": "120", - "type": "Number", - "unit": "AngularSpeed", - "label": "Maximum rotation speed", - "group": "Vertical rotation", - "name": "VerticalRotationSpeedMax" - }, - { - "value": "240", - "type": "Number", - "label": "Rotation acceleration", - "group": "Vertical rotation", - "name": "VerticalRotationAcceleration" - }, - { - "value": "480", - "type": "Number", - "label": "Rotation deceleration", - "group": "Vertical rotation", - "name": "VerticalRotationDeceleration" - }, - { - "value": "-90", - "type": "Number", - "unit": "DegreeAngle", - "label": "Minimum angle", - "group": "Vertical rotation", - "name": "VerticalAngleMin" - }, - { - "value": "90", - "type": "Number", - "unit": "DegreeAngle", - "label": "Maximum angle", - "group": "Vertical rotation", - "name": "VerticalAngleMax" + "value": "true", + "type": "Boolean", + "label": "Use directional pad", + "group": "Controls", + "name": "UseArrows" }, { - "value": "0", - "type": "Number", - "unit": "Pixel", - "label": "Z position offset", - "group": "Position", - "name": "OffsetZ" + "value": "true", + "type": "Boolean", + "label": "Use left stick", + "group": "Controls", + "name": "UseLeftStick" }, { - "value": "0", - "type": "Number", - "unit": "AngularSpeed", - "label": "Current rotation speed Z", - "hidden": true, - "name": "CurrentRotationSpeedZ" + "value": "", + "type": "Boolean", + "label": "Use right stick", + "group": "Controls", + "name": "UseRightStick" }, { - "value": "0", - "type": "Number", - "unit": "AngularSpeed", - "label": "Current rotation speed Y", - "hidden": true, - "name": "CurrentRotationSpeedY" + "value": "B or Circle", + "type": "Choice", + "label": "Hand brake button", + "group": "Controls", + "choices": [ + { + "label": "A or Cross", + "value": "A or Cross" + }, + { + "label": "B or Circle", + "value": "B or Circle" + }, + { + "label": "X or Square", + "value": "X or Square" + }, + { + "label": "Y or Triangle", + "value": "Y or Triangle" + }, + { + "label": "LB or L1", + "value": "LB or L1" + }, + { + "label": "RB or R1", + "value": "RB or R1" + }, + { + "label": "LT or L2", + "value": "LT or L2" + }, + { + "label": "RT or R2", + "value": "RT or R2" + } + ], + "name": "HandBrakeButton" } ], "sharedPropertyDescriptors": [] @@ -14529,6 +14033,7 @@ "fullName": "Top-down gamepad mapper", "name": "TopDownGamepadMapper", "objectType": "", + "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -15113,6 +14618,7 @@ "extraInformation": [ "TopDownMovementBehavior::TopDownMovementBehavior" ], + "choices": [], "name": "TopDownMovement" }, { @@ -15147,10 +14653,19 @@ "type": "Choice", "label": "Stick mode", "group": "Controls", - "extraInformation": [ - "Analog", - "360°", - "8 Directions" + "choices": [ + { + "label": "Analog", + "value": "Analog" + }, + { + "label": "360°", + "value": "360°" + }, + { + "label": "8 Directions", + "value": "8 Directions" + } ], "name": "StickMode" } @@ -17905,6 +17420,7 @@ "extraInformation": [ "Scene3D::Base3DBehavior" ], + "choices": [], "name": "Object3D" }, { @@ -17932,13 +17448,13 @@ "category": "Movement", "extensionNamespace": "", "fullName": "Curved movement", - "gdevelopVersion": "", + "gdevelopVersion": ">=5.5.222", "helpPath": "/extensions/curved-movement/details/", "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyMy4wLjMsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iSWNvbnMiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB2aWV3Qm94PSIwIDAgMzIgMzIiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDMyIDMyOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8c3R5bGUgdHlwZT0idGV4dC9jc3MiPg0KCS5zdDB7ZmlsbDpub25lO3N0cm9rZTojMDAwMDAwO3N0cm9rZS13aWR0aDoyO3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1saW5lam9pbjpyb3VuZDtzdHJva2UtbWl0ZXJsaW1pdDoxMDt9DQoJLnN0MXtmaWxsOm5vbmU7c3Ryb2tlOiMwMDAwMDA7c3Ryb2tlLXdpZHRoOjI7c3Ryb2tlLWxpbmVjYXA6cm91bmQ7c3Ryb2tlLWxpbmVqb2luOnJvdW5kO30NCgkuc3Qye2ZpbGw6bm9uZTtzdHJva2U6IzAwMDAwMDtzdHJva2Utd2lkdGg6MjtzdHJva2UtbGluZWNhcDpyb3VuZDtzdHJva2UtbGluZWpvaW46cm91bmQ7c3Ryb2tlLWRhc2hhcnJheTo2LDY7fQ0KCS5zdDN7ZmlsbDpub25lO3N0cm9rZTojMDAwMDAwO3N0cm9rZS13aWR0aDoyO3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1saW5lam9pbjpyb3VuZDtzdHJva2UtZGFzaGFycmF5OjQsNDt9DQoJLnN0NHtmaWxsOm5vbmU7c3Ryb2tlOiMwMDAwMDA7c3Ryb2tlLXdpZHRoOjI7c3Ryb2tlLWxpbmVjYXA6cm91bmQ7fQ0KCS5zdDV7ZmlsbDpub25lO3N0cm9rZTojMDAwMDAwO3N0cm9rZS13aWR0aDoyO3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1kYXNoYXJyYXk6My4xMDgxLDMuMTA4MTt9DQoJDQoJCS5zdDZ7ZmlsbDpub25lO3N0cm9rZTojMDAwMDAwO3N0cm9rZS13aWR0aDoyO3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1saW5lam9pbjpyb3VuZDtzdHJva2UtbWl0ZXJsaW1pdDoxMDtzdHJva2UtZGFzaGFycmF5OjQsMzt9DQo8L3N0eWxlPg0KPHJlY3QgeD0iMyIgeT0iMjUiIGNsYXNzPSJzdDAiIHdpZHRoPSI0IiBoZWlnaHQ9IjQiLz4NCjxyZWN0IHg9IjI1IiB5PSIzIiBjbGFzcz0ic3QwIiB3aWR0aD0iNCIgaGVpZ2h0PSI0Ii8+DQo8cGF0aCBjbGFzcz0ic3QwIiBkPSJNMjUsNUwyNSw1QzE0LDUsNSwxNCw1LDI1djAiLz4NCjwvc3ZnPg0K", "name": "CurvedMovement", "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/Line Hero Pack/Master/SVG/Graphic Design/Graphic Design_bezier_curve.svg", "shortDescription": "Move objects on curved paths.", - "version": "1.2.0", + "version": "1.2.1", "description": [ "This extension allows to move objects on Bézier curve paths.", "- Paths can be built dynamically or from predetermined paths in SVG format.", @@ -20663,20 +20179,22 @@ { "type": { "inverted": true, - "value": "CurvedMovement::TweenPathMovement::PropertyIsGoingBack" + "value": "BooleanVariable" }, "parameters": [ - "Object", - "Behavior" + "IsGoingBack", + "True", + "" ] }, { "type": { - "value": "CurvedMovement::TweenPathMovement::PropertyShouldLoop" + "value": "BooleanVariable" }, "parameters": [ - "Object", - "Behavior" + "ShouldLoop", + "True", + "" ] } ] @@ -21843,11 +21361,12 @@ "subInstructions": [ { "type": { - "value": "CurvedMovement::TweenPathMovement::PropertyShouldLoop" + "value": "BooleanVariable" }, "parameters": [ - "Object", - "Behavior" + "ShouldLoop", + "True", + "" ] }, { @@ -21875,11 +21394,12 @@ { "type": { "inverted": true, - "value": "CurvedMovement::TweenPathMovement::PropertyShouldGoBack" + "value": "BooleanVariable" }, "parameters": [ - "Object", - "Behavior" + "ShouldGoBack", + "True", + "" ] }, { @@ -21890,21 +21410,23 @@ "subInstructions": [ { "type": { - "value": "CurvedMovement::TweenPathMovement::PropertyShouldGoBack" + "value": "BooleanVariable" }, "parameters": [ - "Object", - "Behavior" + "ShouldGoBack", + "True", + "" ] }, { "type": { "inverted": true, - "value": "CurvedMovement::TweenPathMovement::PropertyIsGoingBack" + "value": "BooleanVariable" }, "parameters": [ - "Object", - "Behavior" + "IsGoingBack", + "True", + "" ] } ] @@ -22742,6 +22264,7 @@ "extraInformation": [ "FlippableCapability::FlippableBehavior" ], + "choices": [], "name": "Flippable" }, { @@ -22927,9 +22450,15 @@ "value": "Top-Down", "type": "Choice", "label": "Viewpoint", - "extraInformation": [ - "Top-Down", - "Isometry 2:1 (26.565°)" + "choices": [ + { + "label": "Top-Down", + "value": "Top-Down" + }, + { + "label": "Isometry 2:1 (26.565°)", + "value": "Isometry 2:1 (26.565°)" + } ], "name": "Viewpoint" } @@ -24157,22 +23686,20 @@ "subInstructions": [ { "type": { - "value": "CurvedMovement::SpeedPathMovement::PropertySpeed" + "value": "NumberVariable" }, "parameters": [ - "Object", - "Behavior", + "Speed", "!=", "0" ] }, { "type": { - "value": "CurvedMovement::SpeedPathMovement::PropertyAcceleration" + "value": "NumberVariable" }, "parameters": [ - "Object", - "Behavior", + "Acceleration", "!=", "0" ] @@ -24187,11 +23714,12 @@ "subInstructions": [ { "type": { - "value": "CurvedMovement::SpeedPathMovement::PropertyShouldLoop" + "value": "BooleanVariable" }, "parameters": [ - "Object", - "Behavior" + "ShouldLoop", + "True", + "" ] }, { @@ -24219,22 +23747,20 @@ "subInstructions": [ { "type": { - "value": "CurvedMovement::SpeedPathMovement::PropertySpeed" + "value": "NumberVariable" }, "parameters": [ - "Object", - "Behavior", + "Speed", ">", "0" ] }, { "type": { - "value": "CurvedMovement::SpeedPathMovement::PropertyAcceleration" + "value": "NumberVariable" }, "parameters": [ - "Object", - "Behavior", + "Acceleration", ">", "0" ] @@ -24268,22 +23794,20 @@ "subInstructions": [ { "type": { - "value": "CurvedMovement::SpeedPathMovement::PropertySpeed" + "value": "NumberVariable" }, "parameters": [ - "Object", - "Behavior", + "Speed", "<", "0" ] }, { "type": { - "value": "CurvedMovement::SpeedPathMovement::PropertyAcceleration" + "value": "NumberVariable" }, "parameters": [ - "Object", - "Behavior", + "Acceleration", "<", "0" ] @@ -25396,22 +24920,22 @@ "subInstructions": [ { "type": { - "value": "CurvedMovement::SpeedPathMovement::PropertySpeed" + "value": "NumberVariable" }, "parameters": [ - "Object", - "Behavior", + "Speed", "<", "0" ] }, { "type": { - "value": "CurvedMovement::SpeedPathMovement::PropertyIsLookingBack" + "value": "BooleanVariable" }, "parameters": [ - "Object", - "Behavior" + "IsLookingBack", + "True", + "" ] } ] @@ -25683,9 +25207,15 @@ "value": "Top-Down", "type": "Choice", "label": "Viewpoint", - "extraInformation": [ - "Top-Down", - "Isometry 2:1 (26.565°)" + "choices": [ + { + "label": "Top-Down", + "value": "Top-Down" + }, + { + "label": "Isometry 2:1 (26.565°)", + "value": "Isometry 2:1 (26.565°)" + } ], "name": "Viewpoint" } @@ -25700,13 +25230,13 @@ "category": "Visual effect", "extensionNamespace": "", "fullName": "3D Billboard", - "gdevelopVersion": "", + "gdevelopVersion": ">=5.5.222", "helpPath": "", "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0ibWRpLXBpbmUtdHJlZSIgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0IiB2aWV3Qm94PSIwIDAgMjQgMjQiPjxwYXRoIGQ9Ik0xMCwyMVYxOEgzTDgsMTNINUwxMCw4SDdMMTIsM0wxNyw4SDE0TDE5LDEzSDE2TDIxLDE4SDE0VjIxSDEwWiIgLz48L3N2Zz4=", "name": "Billboard", "previewIconUrl": "https://asset-resources.gdevelop.io/public-resources/Icons/b46f9cf1fc6b0ef59a461c7831003d1fb091137cbedbae876774f40f8b7dea97_pine-tree.svg", "shortDescription": "Rotate 3D objects to appear like 2D sprites.", - "version": "1.0.1", + "version": "1.1.0", "description": [ "Rotate 3D objects to make them face the camera and appear like 2D sprite.", "", @@ -26428,6 +25958,7 @@ "extraInformation": [ "Scene3D::Base3DBehavior" ], + "choices": [], "name": "Object3D" }, { @@ -26455,9 +25986,15 @@ "value": "No change", "type": "Choice", "label": "Offset position", - "extraInformation": [ - "No change", - "Standing on Z axis" + "choices": [ + { + "label": "No change", + "value": "No change" + }, + { + "label": "Standing on Z axis", + "value": "Standing on Z axis" + } ], "name": "OffsetPositionMode" } @@ -27650,6 +27187,7 @@ "extraInformation": [ "CurvedMovement::SpeedPathMovement" ], + "choices": [], "name": "SpeedPathMovement" }, { From c3575377465d323c083e45090acd10b70b305b59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Davy=20H=C3=A9lard?= Date: Wed, 8 Oct 2025 15:23:58 +0200 Subject: [PATCH 07/12] [3D road crosser] Update the extensions --- examples/3d-road-crosser/3d-road-crosser.json | 4924 +++++++++++------ .../assets/rotate-screen-icon.png | Bin 881 -> 1165 bytes 2 files changed, 3085 insertions(+), 1839 deletions(-) diff --git a/examples/3d-road-crosser/3d-road-crosser.json b/examples/3d-road-crosser/3d-road-crosser.json index 99e270fc8..294798053 100644 --- a/examples/3d-road-crosser/3d-road-crosser.json +++ b/examples/3d-road-crosser/3d-road-crosser.json @@ -1,7 +1,7 @@ { "firstLayout": "", "gdVersion": { - "build": 237, + "build": 242, "major": 5, "minor": 5, "revision": 0 @@ -86,7 +86,6 @@ ], "categories": [], "playableDevices": [ - "mobile", "mobile" ], "extensionProperties": [], @@ -360,14 +359,6 @@ "smoothed": true, "userAdded": true }, - { - "file": "assets/rotate-screen-icon.png", - "kind": "image", - "metadata": "", - "name": "assets/rotate-screen-icon.png", - "smoothed": true, - "userAdded": false - }, { "file": "assets/Square Green Slider Border.png", "kind": "image", @@ -439,6 +430,18 @@ "identifier": "https://asset-resources.gdevelop.io/staging/public-resources/Menu buttons/11abe8b7d577c30b71789404003c50b3fe73d63492fd30669a5153bc67ac0a60_Yellow Jelly Button_Pressed.png", "name": "Yellow Jelly Button_Pressed.png" } + }, + { + "file": "assets/rotate-screen-icon.png", + "kind": "image", + "metadata": "", + "name": "rotate-screen-icon.png", + "smoothed": true, + "userAdded": false, + "origin": { + "identifier": "https://asset-resources.gdevelop.io/public-resources/Mobile Layouts/6a8102ce3340bf9f62300ee1a81ef0b2327b2c6e8d62d7dda68d547f5e2b5969_rotate-screen-icon.png", + "name": "rotate-screen-icon.png" + } } ], "resourceFolders": [] @@ -1915,6 +1918,7 @@ "textAlignment": "left", "verticalTextAlignment": "top", "characterSize": 60, + "lineHeight": 0, "color": "255;255;255" } }, @@ -2013,6 +2017,7 @@ "textAlignment": "left", "verticalTextAlignment": "top", "characterSize": 60, + "lineHeight": 0, "color": "250;241;126" } }, @@ -2159,6 +2164,7 @@ "textAlignment": "left", "verticalTextAlignment": "top", "characterSize": 100, + "lineHeight": 0, "color": "255;255;255" } }, @@ -2214,6 +2220,7 @@ "textAlignment": "center", "verticalTextAlignment": "top", "characterSize": 70, + "lineHeight": 0, "color": "255;255;255" } }, @@ -2299,6 +2306,7 @@ "textAlignment": "center", "verticalTextAlignment": "top", "characterSize": 50, + "lineHeight": 0, "color": "255;255;255" } }, @@ -2396,6 +2404,7 @@ "textAlignment": "center", "verticalTextAlignment": "top", "characterSize": 50, + "lineHeight": 0, "color": "255;255;255" } }, @@ -2500,6 +2509,7 @@ "textAlignment": "center", "verticalTextAlignment": "top", "characterSize": 50, + "lineHeight": 0, "color": "255;255;255" } }, @@ -2604,6 +2614,7 @@ "textAlignment": "center", "verticalTextAlignment": "top", "characterSize": 50, + "lineHeight": 0, "color": "255;255;255" } }, @@ -2708,6 +2719,7 @@ "textAlignment": "center", "verticalTextAlignment": "top", "characterSize": 50, + "lineHeight": 0, "color": "255;255;255" } }, @@ -3531,6 +3543,7 @@ "textAlignment": "left", "verticalTextAlignment": "top", "characterSize": 50, + "lineHeight": 0, "color": "250;241;126" } }, @@ -3619,6 +3632,7 @@ "textAlignment": "center", "verticalTextAlignment": "top", "characterSize": 50, + "lineHeight": 0, "color": "255;255;255" } }, @@ -3777,6 +3791,7 @@ "textAlignment": "center", "verticalTextAlignment": "top", "characterSize": 50, + "lineHeight": 0, "color": "255;255;255" } }, @@ -3881,6 +3896,7 @@ "textAlignment": "center", "verticalTextAlignment": "top", "characterSize": 50, + "lineHeight": 0, "color": "255;255;255" } }, @@ -3966,6 +3982,7 @@ "textAlignment": "", "verticalTextAlignment": "top", "characterSize": 30, + "lineHeight": 0, "color": "255;255;255" } }, @@ -4033,6 +4050,7 @@ "textAlignment": "center", "verticalTextAlignment": "top", "characterSize": 50, + "lineHeight": 0, "color": "255;255;255" } }, @@ -4075,6 +4093,7 @@ "textAlignment": "center", "verticalTextAlignment": "top", "characterSize": 100, + "lineHeight": 0, "color": "80;227;194" } }, @@ -4082,122 +4101,12 @@ "assetStoreId": "", "name": "NewScreenOrientationChecker", "type": "ScreenOrientationChecker::ScreenOrientationChecker", - "variant": "", + "variant": "Black screen orientation checker", "variables": [], "effects": [], "behaviors": [], "content": { "IsForceShown": false - }, - "childrenContent": { - "BackgroundPainter": { - "fillOpacity": 255, - "outlineSize": 0, - "outlineOpacity": 255, - "absoluteCoordinates": true, - "clearBetweenFrames": true, - "antialiasing": "none", - "fillColor": { - "r": 0, - "g": 0, - "b": 0 - }, - "outlineColor": { - "r": 0, - "g": 0, - "b": 0 - } - }, - "Icon": { - "adaptCollisionMaskAutomatically": true, - "updateIfNotVisible": false, - "animations": [ - { - "name": "", - "useMultipleDirections": false, - "directions": [ - { - "looping": false, - "timeBetweenFrames": 0.08, - "sprites": [ - { - "hasCustomCollisionMask": true, - "image": "assets/rotate-screen-icon.png", - "points": [], - "originPoint": { - "name": "origine", - "x": 52.5, - "y": 56.5 - }, - "centerPoint": { - "automatic": true, - "name": "centre", - "x": 0, - "y": 0 - }, - "customCollisionMask": [ - [ - { - "x": 0, - "y": 1 - }, - { - "x": 105, - "y": 1 - }, - { - "x": 105, - "y": 113 - }, - { - "x": 0, - "y": 113 - } - ] - ] - } - ] - } - ] - } - ] - }, - "Text": { - "bold": true, - "italic": false, - "smoothed": true, - "underlined": false, - "string": "Rotate screen to play", - "font": "", - "textAlignment": "center", - "characterSize": 30, - "color": { - "b": 255, - "g": 255, - "r": 255 - }, - "content": { - "bold": true, - "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": "Rotate screen to play", - "font": "", - "textAlignment": "center", - "verticalTextAlignment": "top", - "characterSize": 30, - "color": "255;255;255" - } - } } } ], @@ -8248,7 +8157,7 @@ "name": "ScreenOrientationChecker", "previewIconUrl": "https://asset-resources.gdevelop.io/public-resources/Icons/0126888931a4a4f82bb2824df9f096347ace1c47f510c44df42aa8dc9e49e24a_screen-rotation.svg", "shortDescription": "Display a customizable screen asking the user to rotate their phone/tablet if not in the right orientation.", - "version": "0.1.1", + "version": "0.2.0", "description": "Display a customizable screen asking the user to rotate their phone/tablet if not in the right orientation.", "origin": { "identifier": "ScreenOrientationChecker", @@ -8271,6 +8180,28 @@ ], "sceneVariables": [], "eventsFunctions": [ + { + "description": "Check if the events are running for the editor.", + "fullName": "Editor is running", + "functionType": "Condition", + "name": "IsInGameEdition", + "private": true, + "sentence": "Events are running for the editor", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const game = runtimeScene.getGame();\r", + "eventsFunctionContext.returnValue = game.isInGameEdition && game.isInGameEdition();" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [], + "objectGroups": [] + }, { "fullName": "Get game target orientation", "functionType": "StringExpression", @@ -8389,6 +8320,7 @@ "textAlignment": "center", "verticalTextAlignment": "top", "characterSize": 30, + "lineHeight": 0, "color": "255;255;255" } }, @@ -8589,6 +8521,38 @@ } ], "eventsFunctions": [ + { + "fullName": "", + "functionType": "Action", + "name": "onCreated", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "PrimitiveDrawing::ClearBetweenFrames" + }, + "parameters": [ + "BackgroundPainter", + "" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "ScreenOrientationChecker::ScreenOrientationChecker", + "type": "object" + } + ], + "objectGroups": [] + }, { "fullName": "", "functionType": "Action", @@ -8596,41 +8560,66 @@ "sentence": "", "events": [ { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 - }, - "comment": "Check if the screen must be shown" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "ScreenOrientationChecker::IsInGameEdition" + }, + "parameters": [ + "", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "ScreenOrientationChecker::ScreenOrientationChecker::DrawBackground" + }, + "parameters": [ + "Object", + "" + ] + } + ] }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "value": "SystemInfo::IsMobile" + "inverted": true, + "value": "ScreenOrientationChecker::IsInGameEdition" }, - "parameters": [] + "parameters": [ + "", + "" + ] } ], "actions": [], "events": [ + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Check if the screen must be shown" + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "value": "BuiltinCommonInstructions::CompareNumbers" + "value": "SystemInfo::IsMobile" }, - "parameters": [ - "SceneWindowWidth()", - ">", - "SceneWindowHeight()" - ] + "parameters": [] } ], "actions": [], @@ -8640,24 +8629,69 @@ "conditions": [ { "type": { - "value": "StringVariable" + "value": "BuiltinCommonInstructions::CompareNumbers" }, "parameters": [ - "TargetOrientation", - "=", - "\"portrait\"" + "SceneWindowWidth()", + ">", + "SceneWindowHeight()" ] } ], - "actions": [ + "actions": [], + "events": [ { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsShown", - "False", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "TargetOrientation", + "=", + "\"portrait\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsShown", + "False", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "TargetOrientation", + "!=", + "\"portrait\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsShown", + "False", + "" + ] + } ] } ] @@ -8667,127 +8701,146 @@ "conditions": [ { "type": { - "value": "StringVariable" + "value": "BuiltinCommonInstructions::CompareNumbers" }, "parameters": [ - "TargetOrientation", - "!=", - "\"portrait\"" + "SceneWindowWidth()", + "<=", + "SceneWindowHeight()" ] } ], - "actions": [ + "actions": [], + "events": [ { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsShown", - "False", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "TargetOrientation", + "=", + "\"landscape\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsShown", + "False", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "TargetOrientation", + "=", + "\"portrait\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsShown", + "False", + "" + ] + } ] } ] } ] }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Show/hide the screen as needed" + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "value": "BuiltinCommonInstructions::CompareNumbers" + "value": "BuiltinCommonInstructions::Or" }, - "parameters": [ - "SceneWindowWidth()", - "<=", - "SceneWindowHeight()" - ] - } - ], - "actions": [], - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "parameters": [], + "subInstructions": [ { "type": { - "value": "StringVariable" + "value": "BooleanVariable" }, "parameters": [ - "TargetOrientation", - "=", - "\"landscape\"" + "IsShown", + "True", + "" ] - } - ], - "actions": [ + }, { "type": { - "value": "SetBooleanVariable" + "value": "BooleanVariable" }, "parameters": [ - "IsShown", - "False", + "IsForceShown", + "True", "" ] } ] + } + ], + "actions": [ + { + "type": { + "value": "ScreenOrientationChecker::ScreenOrientationChecker::DrawBackground" + }, + "parameters": [ + "Object", + "" + ] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "TargetOrientation", - "=", - "\"portrait\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsShown", - "False", - "" - ] - } + "type": { + "value": "Montre" + }, + "parameters": [ + "Object", + "" ] } ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 - }, - "comment": "Show/hide the screen as needed" - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + }, { - "type": { - "value": "BuiltinCommonInstructions::Or" - }, - "parameters": [], - "subInstructions": [ + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { "type": { + "inverted": true, "value": "BooleanVariable" }, "parameters": [ @@ -8798,6 +8851,7 @@ }, { "type": { + "inverted": true, "value": "BooleanVariable" }, "parameters": [ @@ -8806,229 +8860,207 @@ "" ] } - ] - } - ], - "actions": [ - { - "type": { - "value": "PrimitiveDrawing::FillColor" - }, - "parameters": [ - "BackgroundPainter", - "BackgroundColor" + ], + "actions": [ + { + "type": { + "value": "Cache" + }, + "parameters": [ + "Object" + ] + } ] }, { - "type": { - "value": "PrimitiveDrawing::RoundedRectangle" - }, - "parameters": [ - "BackgroundPainter", - "Padding", - "Padding", - "Object.Width()-Padding", - "Object.Height()-Padding", - "CornerRadius" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "MettreY" + }, + "parameters": [ + "Icon", + "=", + "Text.Y() - 100" + ] + } ] }, { - "type": { - "value": "Montre" - }, - "parameters": [ - "Object", - "" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "inverted": true, - "value": "BooleanVariable" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 }, - "parameters": [ - "IsShown", - "True", - "" - ] + "comment": "Animate the icon" }, { - "type": { - "inverted": true, - "value": "BooleanVariable" - }, - "parameters": [ - "IsForceShown", - "True", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "Cache" - }, - "parameters": [ - "Object" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "MettreY" - }, - "parameters": [ - "Icon", - "=", - "Text.Y() - 100" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 - }, - "comment": "Animate the icon" - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "inverted": true, - "value": "Tween::Exists" - }, - "parameters": [ - "Icon", - "Tween", - "\"Rotate\"" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "Tween::Exists" + }, + "parameters": [ + "Icon", + "Tween", + "\"Rotate\"" + ] + }, + { + "type": { + "inverted": true, + "value": "Tween::Exists" + }, + "parameters": [ + "Icon", + "Tween", + "\"RotateBack\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "Tween::TweenBehavior::AddObjectAngleTween2" + }, + "parameters": [ + "Icon", + "Tween", + "\"Rotate\"", + "8", + "\"easeInOutQuad\"", + "2", + "" + ] + } ] }, { - "type": { - "inverted": true, - "value": "Tween::Exists" - }, - "parameters": [ - "Icon", - "Tween", - "\"RotateBack\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "Tween::TweenBehavior::AddObjectAngleTween2" - }, - "parameters": [ - "Icon", - "Tween", - "\"Rotate\"", - "8", - "\"easeInOutQuad\"", - "2", - "" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "Tween::HasFinished" - }, - "parameters": [ - "Icon", - "Tween", - "\"RotateBack\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "Tween::TweenBehavior::AddObjectAngleTween2" - }, - "parameters": [ - "Icon", - "Tween", - "\"Rotate\"", - "8", - "\"easeInOutQuad\"", - "2", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Tween::HasFinished" + }, + "parameters": [ + "Icon", + "Tween", + "\"RotateBack\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "Tween::TweenBehavior::AddObjectAngleTween2" + }, + "parameters": [ + "Icon", + "Tween", + "\"Rotate\"", + "8", + "\"easeInOutQuad\"", + "2", + "" + ] + }, + { + "type": { + "value": "Tween::RemoveTween" + }, + "parameters": [ + "Icon", + "Tween", + "\"RotateBack\"" + ] + } ] }, { - "type": { - "value": "Tween::RemoveTween" - }, - "parameters": [ - "Icon", - "Tween", - "\"RotateBack\"" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Tween::HasFinished" + }, + "parameters": [ + "Icon", + "Tween", + "\"Rotate\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "Tween::TweenBehavior::AddObjectAngleTween2" + }, + "parameters": [ + "Icon", + "Tween", + "\"RotateBack\"", + "-8", + "\"easeInOutQuad\"", + "2", + "" + ] + }, + { + "type": { + "value": "Tween::RemoveTween" + }, + "parameters": [ + "Icon", + "Tween", + "\"Rotate\"" + ] + } ] } ] - }, + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "ScreenOrientationChecker::ScreenOrientationChecker", + "type": "object" + } + ], + "objectGroups": [] + }, + { + "description": "Draw the background.", + "fullName": "Draw the background", + "functionType": "Action", + "name": "DrawBackground", + "private": true, + "sentence": "Draw the background of _PARAM0_", + "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "Tween::HasFinished" - }, - "parameters": [ - "Icon", - "Tween", - "\"Rotate\"" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "Tween::TweenBehavior::AddObjectAngleTween2" - }, - "parameters": [ - "Icon", - "Tween", - "\"RotateBack\"", - "-8", - "\"easeInOutQuad\"", - "2", - "" - ] - }, - { - "type": { - "value": "Tween::RemoveTween" + "value": "PrimitiveDrawing::RoundedRectangle" }, "parameters": [ - "Icon", - "Tween", - "\"Rotate\"" + "BackgroundPainter", + "Padding", + "Padding", + "Object.Width()-Padding", + "Object.Height()-Padding", + "CornerRadius" ] } ] @@ -9048,7 +9080,6 @@ "description": "Check if the screen should be forced to be shown. Use this to test the screen in your game.", "fullName": "Force show the screen", "functionType": "Condition", - "group": "Screen Orientation Checker configuration", "name": "IsForceShown", "sentence": "_PARAM0_ is forced to be shown", "events": [ @@ -9092,7 +9123,6 @@ "description": "Change if the screen should be forced to be shown. Use this to test the screen in your game.", "fullName": "Force show the screen", "functionType": "Action", - "group": "Screen Orientation Checker configuration", "name": "SetIsForceShown", "sentence": "Force _PARAM0_ to be shown: _PARAM1_", "events": [ @@ -9168,6 +9198,76 @@ } ], "objectGroups": [] + }, + { + "description": "the message of the object.", + "fullName": "Message", + "functionType": "ExpressionAndCondition", + "name": "Message", + "sentence": "the message", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnString" + }, + "parameters": [ + "Text.Text::Value()" + ] + } + ] + } + ], + "expressionType": { + "type": "string" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "ScreenOrientationChecker::ScreenOrientationChecker", + "type": "object" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "Message", + "name": "SetMessage", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "TextContainerCapability::TextContainerBehavior::SetValue" + }, + "parameters": [ + "Text", + "Text", + "=", + "Value" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "ScreenOrientationChecker::ScreenOrientationChecker", + "type": "object" + } + ], + "objectGroups": [] } ], "propertyDescriptors": [ @@ -9201,16 +9301,276 @@ "description": "Corner radius for the background", "group": "Appearance", "name": "CornerRadius" - }, - { - "value": "0;0;0", - "type": "Color", - "label": "Background color", - "group": "Appearance", - "name": "BackgroundColor" } ], - "variants": [] + "variants": [ + { + "areaMaxX": 400, + "areaMaxY": 200, + "areaMaxZ": 0, + "areaMinX": 0, + "areaMinY": 0, + "areaMinZ": 0, + "assetStoreAssetId": "2743bcd6cf431c6c00cda3a59684eb152b3a09d598b799b15383e4f77daf8b37", + "assetStoreOriginalName": "Black screen orientation checker", + "name": "Black screen orientation checker", + "objects": [ + { + "assetStoreId": "", + "bold": true, + "italic": false, + "name": "Text", + "smoothed": true, + "type": "TextObject::Text", + "underlined": false, + "variables": [], + "effects": [], + "behaviors": [ + { + "name": "Anchor", + "type": "AnchorBehavior::AnchorBehavior", + "bottomEdgeAnchor": 0, + "leftEdgeAnchor": 4, + "relativeToOriginalWindowSize": true, + "rightEdgeAnchor": 0, + "topEdgeAnchor": 4, + "useLegacyBottomAndRightAnchors": false + }, + { + "name": "Tween", + "type": "Tween::TweenBehavior" + } + ], + "string": "Rotate screen to play", + "font": "", + "textAlignment": "center", + "characterSize": 30, + "color": { + "b": 255, + "g": 255, + "r": 255 + }, + "content": { + "bold": true, + "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": "Rotate screen to play", + "font": "", + "textAlignment": "center", + "verticalTextAlignment": "top", + "characterSize": 30, + "lineHeight": 0, + "color": "255;255;255" + } + }, + { + "assetStoreId": "", + "name": "BackgroundPainter", + "type": "PrimitiveDrawing::Drawer", + "variables": [], + "effects": [], + "behaviors": [], + "fillOpacity": 255, + "outlineSize": 0, + "outlineOpacity": 255, + "absoluteCoordinates": true, + "clearBetweenFrames": true, + "antialiasing": "none", + "fillColor": { + "r": 0, + "g": 0, + "b": 0 + }, + "outlineColor": { + "r": 0, + "g": 0, + "b": 0 + } + }, + { + "adaptCollisionMaskAutomatically": true, + "assetStoreId": "", + "name": "Icon", + "type": "Sprite", + "updateIfNotVisible": false, + "variables": [], + "effects": [], + "behaviors": [ + { + "name": "Anchor", + "type": "AnchorBehavior::AnchorBehavior", + "bottomEdgeAnchor": 0, + "leftEdgeAnchor": 4, + "topEdgeAnchor": 4, + "relativeToOriginalWindowSize": true, + "rightEdgeAnchor": 0, + "useLegacyBottomAndRightAnchors": false + }, + { + "name": "Tween", + "type": "Tween::TweenBehavior" + } + ], + "animations": [ + { + "name": "", + "useMultipleDirections": false, + "directions": [ + { + "looping": false, + "timeBetweenFrames": 0.08, + "sprites": [ + { + "hasCustomCollisionMask": true, + "image": "rotate-screen-icon.png", + "points": [], + "originPoint": { + "name": "origine", + "x": 52.5, + "y": 56.5 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [ + [ + { + "x": 0, + "y": 1 + }, + { + "x": 105, + "y": 1 + }, + { + "x": 105, + "y": 113 + }, + { + "x": 0, + "y": 113 + } + ] + ] + } + ] + } + ] + } + ] + } + ], + "objectsFolderStructure": { + "folderName": "__ROOT", + "children": [ + { + "objectName": "Text" + }, + { + "objectName": "BackgroundPainter" + }, + { + "objectName": "Icon" + } + ] + }, + "objectsGroups": [], + "layers": [ + { + "ambientLightColorB": 200, + "ambientLightColorG": 200, + "ambientLightColorR": 200, + "camera3DFarPlaneDistance": 10000, + "camera3DFieldOfView": 45, + "camera3DNearPlaneDistance": 3, + "cameraType": "", + "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": [] + } + ], + "instances": [ + { + "angle": 0, + "customSize": true, + "depth": 1, + "height": 35, + "keepRatio": true, + "layer": "", + "name": "Text", + "persistentUuid": "65c003ea-19c0-4f18-a189-a02a24378f35", + "width": 207, + "x": 104, + "y": 120, + "zOrder": 15, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "keepRatio": true, + "layer": "", + "name": "BackgroundPainter", + "persistentUuid": "49ff4576-6406-41de-a43b-1355529d61fe", + "width": 0, + "x": 38, + "y": 17, + "zOrder": 14, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "keepRatio": true, + "layer": "", + "name": "Icon", + "persistentUuid": "39cbfc66-13f4-43dc-b6ef-2bda83153277", + "width": 0, + "x": 204, + "y": 64, + "zOrder": 16, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + } + ] + } + ] } ] }, @@ -10349,12 +10709,27 @@ "value": "Idle", "type": "Choice", "label": "State", - "extraInformation": [ - "Idle", - "Hovered", - "PressedInside", - "PressedOutside", - "Validated" + "choices": [ + { + "label": "Idle", + "value": "Idle" + }, + { + "label": "Hovered", + "value": "Hovered" + }, + { + "label": "PressedInside", + "value": "PressedInside" + }, + { + "label": "PressedOutside", + "value": "PressedOutside" + }, + { + "label": "Validated", + "value": "Validated" + } ], "hidden": true, "name": "State" @@ -10893,6 +11268,7 @@ "extraInformation": [ "ButtonStates::ButtonFSM" ], + "choices": [], "name": "ButtonFSM" }, { @@ -10902,6 +11278,7 @@ "extraInformation": [ "EffectCapability::EffectBehavior" ], + "choices": [], "name": "Effect" }, { @@ -11341,6 +11718,7 @@ "extraInformation": [ "AnimatableCapability::AnimatableBehavior" ], + "choices": [], "name": "Animation" }, { @@ -11350,6 +11728,7 @@ "extraInformation": [ "ButtonStates::ButtonFSM" ], + "choices": [], "name": "ButtonFSM" }, { @@ -12743,6 +13122,7 @@ "extraInformation": [ "ButtonStates::ButtonFSM" ], + "choices": [], "name": "ButtonFSM" }, { @@ -12752,6 +13132,7 @@ "extraInformation": [ "EffectCapability::EffectBehavior" ], + "choices": [], "name": "Effect" }, { @@ -12796,40 +13177,139 @@ "type": "Choice", "label": "Fade-in easing", "group": "Speed", - "extraInformation": [ - "linear", - "easeInQuad", - "easeOutQuad", - "easeInOutQuad", - "easeInCubic", - "easeOutCubic", - "easeInOutCubic", - "easeInQuart", - "easeOutQuart", - "easeInOutQuart", - "easeInQuint", - "easeOutQuint", - "easeInOutQuint", - "easeInOutSine", - "easeInExpo", - "easeOutExpo", - "easeInOutExpo", - "easeInCirc", - "easeOutCirc", - "easeInOutCirc", - "easeOutBounce", - "easeInBack", - "easeOutBack", - "easeInOutBack", - "elastic", - "swingFromTo", - "swingFrom", - "swingTo", - "bounce", - "bouncePast", - "easeFromTo", - "easeFrom", - "easeTo" + "choices": [ + { + "label": "linear", + "value": "linear" + }, + { + "label": "easeInQuad", + "value": "easeInQuad" + }, + { + "label": "easeOutQuad", + "value": "easeOutQuad" + }, + { + "label": "easeInOutQuad", + "value": "easeInOutQuad" + }, + { + "label": "easeInCubic", + "value": "easeInCubic" + }, + { + "label": "easeOutCubic", + "value": "easeOutCubic" + }, + { + "label": "easeInOutCubic", + "value": "easeInOutCubic" + }, + { + "label": "easeInQuart", + "value": "easeInQuart" + }, + { + "label": "easeOutQuart", + "value": "easeOutQuart" + }, + { + "label": "easeInOutQuart", + "value": "easeInOutQuart" + }, + { + "label": "easeInQuint", + "value": "easeInQuint" + }, + { + "label": "easeOutQuint", + "value": "easeOutQuint" + }, + { + "label": "easeInOutQuint", + "value": "easeInOutQuint" + }, + { + "label": "easeInOutSine", + "value": "easeInOutSine" + }, + { + "label": "easeInExpo", + "value": "easeInExpo" + }, + { + "label": "easeOutExpo", + "value": "easeOutExpo" + }, + { + "label": "easeInOutExpo", + "value": "easeInOutExpo" + }, + { + "label": "easeInCirc", + "value": "easeInCirc" + }, + { + "label": "easeOutCirc", + "value": "easeOutCirc" + }, + { + "label": "easeInOutCirc", + "value": "easeInOutCirc" + }, + { + "label": "easeOutBounce", + "value": "easeOutBounce" + }, + { + "label": "easeInBack", + "value": "easeInBack" + }, + { + "label": "easeOutBack", + "value": "easeOutBack" + }, + { + "label": "easeInOutBack", + "value": "easeInOutBack" + }, + { + "label": "elastic", + "value": "elastic" + }, + { + "label": "swingFromTo", + "value": "swingFromTo" + }, + { + "label": "swingFrom", + "value": "swingFrom" + }, + { + "label": "swingTo", + "value": "swingTo" + }, + { + "label": "bounce", + "value": "bounce" + }, + { + "label": "bouncePast", + "value": "bouncePast" + }, + { + "label": "easeFromTo", + "value": "easeFromTo" + }, + { + "label": "easeFrom", + "value": "easeFrom" + }, + { + "label": "easeTo", + "value": "easeTo" + } ], "name": "FadeInEasing" }, @@ -12838,40 +13318,139 @@ "type": "Choice", "label": "Fade-out easing", "group": "Speed", - "extraInformation": [ - "linear", - "easeInQuad", - "easeOutQuad", - "easeInOutQuad", - "easeInCubic", - "easeOutCubic", - "easeInOutCubic", - "easeInQuart", - "easeOutQuart", - "easeInOutQuart", - "easeInQuint", - "easeOutQuint", - "easeInOutQuint", - "easeInOutSine", - "easeInExpo", - "easeOutExpo", - "easeInOutExpo", - "easeInCirc", - "easeOutCirc", - "easeInOutCirc", - "easeOutBounce", - "easeInBack", - "easeOutBack", - "easeInOutBack", - "elastic", - "swingFromTo", - "swingFrom", - "swingTo", - "bounce", - "bouncePast", - "easeFromTo", - "easeFrom", - "easeTo" + "choices": [ + { + "label": "linear", + "value": "linear" + }, + { + "label": "easeInQuad", + "value": "easeInQuad" + }, + { + "label": "easeOutQuad", + "value": "easeOutQuad" + }, + { + "label": "easeInOutQuad", + "value": "easeInOutQuad" + }, + { + "label": "easeInCubic", + "value": "easeInCubic" + }, + { + "label": "easeOutCubic", + "value": "easeOutCubic" + }, + { + "label": "easeInOutCubic", + "value": "easeInOutCubic" + }, + { + "label": "easeInQuart", + "value": "easeInQuart" + }, + { + "label": "easeOutQuart", + "value": "easeOutQuart" + }, + { + "label": "easeInOutQuart", + "value": "easeInOutQuart" + }, + { + "label": "easeInQuint", + "value": "easeInQuint" + }, + { + "label": "easeOutQuint", + "value": "easeOutQuint" + }, + { + "label": "easeInOutQuint", + "value": "easeInOutQuint" + }, + { + "label": "easeInOutSine", + "value": "easeInOutSine" + }, + { + "label": "easeInExpo", + "value": "easeInExpo" + }, + { + "label": "easeOutExpo", + "value": "easeOutExpo" + }, + { + "label": "easeInOutExpo", + "value": "easeInOutExpo" + }, + { + "label": "easeInCirc", + "value": "easeInCirc" + }, + { + "label": "easeOutCirc", + "value": "easeOutCirc" + }, + { + "label": "easeInOutCirc", + "value": "easeInOutCirc" + }, + { + "label": "easeOutBounce", + "value": "easeOutBounce" + }, + { + "label": "easeInBack", + "value": "easeInBack" + }, + { + "label": "easeOutBack", + "value": "easeOutBack" + }, + { + "label": "easeInOutBack", + "value": "easeInOutBack" + }, + { + "label": "elastic", + "value": "elastic" + }, + { + "label": "swingFromTo", + "value": "swingFromTo" + }, + { + "label": "swingFrom", + "value": "swingFrom" + }, + { + "label": "swingTo", + "value": "swingTo" + }, + { + "label": "bounce", + "value": "bounce" + }, + { + "label": "bouncePast", + "value": "bouncePast" + }, + { + "label": "easeFromTo", + "value": "easeFromTo" + }, + { + "label": "easeFrom", + "value": "easeFrom" + }, + { + "label": "easeTo", + "value": "easeTo" + } ], "name": "FadeOutEasing" }, @@ -12895,10 +13474,19 @@ "value": "Idle", "type": "Choice", "label": "", - "extraInformation": [ - "Idle", - "Focused", - "Pressed" + "choices": [ + { + "label": "Idle", + "value": "Idle" + }, + { + "label": "Focused", + "value": "Focused" + }, + { + "label": "Pressed", + "value": "Pressed" + } ], "hidden": true, "name": "PreviousState" @@ -12928,10 +13516,19 @@ "value": "NoTween", "type": "Choice", "label": "", - "extraInformation": [ - "NoTween", - "FadeIn", - "FadeOut" + "choices": [ + { + "label": "NoTween", + "value": "NoTween" + }, + { + "label": "FadeIn", + "value": "FadeIn" + }, + { + "label": "FadeOut", + "value": "FadeOut" + } ], "hidden": true, "name": "TweenState" @@ -13886,6 +14483,7 @@ "extraInformation": [ "ScalableCapability::ScalableBehavior" ], + "choices": [], "name": "Scale" }, { @@ -13895,6 +14493,7 @@ "extraInformation": [ "ButtonStates::ButtonFSM" ], + "choices": [], "name": "ButtonFSM" }, { @@ -13904,6 +14503,7 @@ "extraInformation": [ "Tween::TweenBehavior" ], + "choices": [], "name": "Tween" }, { @@ -13952,40 +14552,139 @@ "type": "Choice", "label": "Fade-in easing", "group": "Speed", - "extraInformation": [ - "linear", - "easeInQuad", - "easeOutQuad", - "easeInOutQuad", - "easeInCubic", - "easeOutCubic", - "easeInOutCubic", - "easeInQuart", - "easeOutQuart", - "easeInOutQuart", - "easeInQuint", - "easeOutQuint", - "easeInOutQuint", - "easeInOutSine", - "easeInExpo", - "easeOutExpo", - "easeInOutExpo", - "easeInCirc", - "easeOutCirc", - "easeInOutCirc", - "easeOutBounce", - "easeInBack", - "easeOutBack", - "easeInOutBack", - "elastic", - "swingFromTo", - "swingFrom", - "swingTo", - "bounce", - "bouncePast", - "easeFromTo", - "easeFrom", - "easeTo" + "choices": [ + { + "label": "linear", + "value": "linear" + }, + { + "label": "easeInQuad", + "value": "easeInQuad" + }, + { + "label": "easeOutQuad", + "value": "easeOutQuad" + }, + { + "label": "easeInOutQuad", + "value": "easeInOutQuad" + }, + { + "label": "easeInCubic", + "value": "easeInCubic" + }, + { + "label": "easeOutCubic", + "value": "easeOutCubic" + }, + { + "label": "easeInOutCubic", + "value": "easeInOutCubic" + }, + { + "label": "easeInQuart", + "value": "easeInQuart" + }, + { + "label": "easeOutQuart", + "value": "easeOutQuart" + }, + { + "label": "easeInOutQuart", + "value": "easeInOutQuart" + }, + { + "label": "easeInQuint", + "value": "easeInQuint" + }, + { + "label": "easeOutQuint", + "value": "easeOutQuint" + }, + { + "label": "easeInOutQuint", + "value": "easeInOutQuint" + }, + { + "label": "easeInOutSine", + "value": "easeInOutSine" + }, + { + "label": "easeInExpo", + "value": "easeInExpo" + }, + { + "label": "easeOutExpo", + "value": "easeOutExpo" + }, + { + "label": "easeInOutExpo", + "value": "easeInOutExpo" + }, + { + "label": "easeInCirc", + "value": "easeInCirc" + }, + { + "label": "easeOutCirc", + "value": "easeOutCirc" + }, + { + "label": "easeInOutCirc", + "value": "easeInOutCirc" + }, + { + "label": "easeOutBounce", + "value": "easeOutBounce" + }, + { + "label": "easeInBack", + "value": "easeInBack" + }, + { + "label": "easeOutBack", + "value": "easeOutBack" + }, + { + "label": "easeInOutBack", + "value": "easeInOutBack" + }, + { + "label": "elastic", + "value": "elastic" + }, + { + "label": "swingFromTo", + "value": "swingFromTo" + }, + { + "label": "swingFrom", + "value": "swingFrom" + }, + { + "label": "swingTo", + "value": "swingTo" + }, + { + "label": "bounce", + "value": "bounce" + }, + { + "label": "bouncePast", + "value": "bouncePast" + }, + { + "label": "easeFromTo", + "value": "easeFromTo" + }, + { + "label": "easeFrom", + "value": "easeFrom" + }, + { + "label": "easeTo", + "value": "easeTo" + } ], "name": "FadeInEasing" }, @@ -13994,40 +14693,139 @@ "type": "Choice", "label": "Fade-out easing", "group": "Speed", - "extraInformation": [ - "linear", - "easeInQuad", - "easeOutQuad", - "easeInOutQuad", - "easeInCubic", - "easeOutCubic", - "easeInOutCubic", - "easeInQuart", - "easeOutQuart", - "easeInOutQuart", - "easeInQuint", - "easeOutQuint", - "easeInOutQuint", - "easeInOutSine", - "easeInExpo", - "easeOutExpo", - "easeInOutExpo", - "easeInCirc", - "easeOutCirc", - "easeInOutCirc", - "easeOutBounce", - "easeInBack", - "easeOutBack", - "easeInOutBack", - "elastic", - "swingFromTo", - "swingFrom", - "swingTo", - "bounce", - "bouncePast", - "easeFromTo", - "easeFrom", - "easeTo" + "choices": [ + { + "label": "linear", + "value": "linear" + }, + { + "label": "easeInQuad", + "value": "easeInQuad" + }, + { + "label": "easeOutQuad", + "value": "easeOutQuad" + }, + { + "label": "easeInOutQuad", + "value": "easeInOutQuad" + }, + { + "label": "easeInCubic", + "value": "easeInCubic" + }, + { + "label": "easeOutCubic", + "value": "easeOutCubic" + }, + { + "label": "easeInOutCubic", + "value": "easeInOutCubic" + }, + { + "label": "easeInQuart", + "value": "easeInQuart" + }, + { + "label": "easeOutQuart", + "value": "easeOutQuart" + }, + { + "label": "easeInOutQuart", + "value": "easeInOutQuart" + }, + { + "label": "easeInQuint", + "value": "easeInQuint" + }, + { + "label": "easeOutQuint", + "value": "easeOutQuint" + }, + { + "label": "easeInOutQuint", + "value": "easeInOutQuint" + }, + { + "label": "easeInOutSine", + "value": "easeInOutSine" + }, + { + "label": "easeInExpo", + "value": "easeInExpo" + }, + { + "label": "easeOutExpo", + "value": "easeOutExpo" + }, + { + "label": "easeInOutExpo", + "value": "easeInOutExpo" + }, + { + "label": "easeInCirc", + "value": "easeInCirc" + }, + { + "label": "easeOutCirc", + "value": "easeOutCirc" + }, + { + "label": "easeInOutCirc", + "value": "easeInOutCirc" + }, + { + "label": "easeOutBounce", + "value": "easeOutBounce" + }, + { + "label": "easeInBack", + "value": "easeInBack" + }, + { + "label": "easeOutBack", + "value": "easeOutBack" + }, + { + "label": "easeInOutBack", + "value": "easeInOutBack" + }, + { + "label": "elastic", + "value": "elastic" + }, + { + "label": "swingFromTo", + "value": "swingFromTo" + }, + { + "label": "swingFrom", + "value": "swingFrom" + }, + { + "label": "swingTo", + "value": "swingTo" + }, + { + "label": "bounce", + "value": "bounce" + }, + { + "label": "bouncePast", + "value": "bouncePast" + }, + { + "label": "easeFromTo", + "value": "easeFromTo" + }, + { + "label": "easeFrom", + "value": "easeFrom" + }, + { + "label": "easeTo", + "value": "easeTo" + } ], "name": "FadeOutEasing" }, @@ -14035,10 +14833,19 @@ "value": "Idle", "type": "Choice", "label": "", - "extraInformation": [ - "Idle", - "Focused", - "Pressed" + "choices": [ + { + "label": "Idle", + "value": "Idle" + }, + { + "label": "Focused", + "value": "Focused" + }, + { + "label": "Pressed", + "value": "Pressed" + } ], "hidden": true, "name": "PreviousState" @@ -15000,6 +15807,7 @@ "extraInformation": [ "ButtonStates::ButtonFSM" ], + "choices": [], "name": "ButtonFSM" }, { @@ -15009,6 +15817,7 @@ "extraInformation": [ "Tween::TweenBehavior" ], + "choices": [], "name": "Tween" }, { @@ -15054,40 +15863,139 @@ "type": "Choice", "label": "Fade-in easing", "group": "Speed", - "extraInformation": [ - "linear", - "easeInQuad", - "easeOutQuad", - "easeInOutQuad", - "easeInCubic", - "easeOutCubic", - "easeInOutCubic", - "easeInQuart", - "easeOutQuart", - "easeInOutQuart", - "easeInQuint", - "easeOutQuint", - "easeInOutQuint", - "easeInOutSine", - "easeInExpo", - "easeOutExpo", - "easeInOutExpo", - "easeInCirc", - "easeOutCirc", - "easeInOutCirc", - "easeOutBounce", - "easeInBack", - "easeOutBack", - "easeInOutBack", - "elastic", - "swingFromTo", - "swingFrom", - "swingTo", - "bounce", - "bouncePast", - "easeFromTo", - "easeFrom", - "easeTo" + "choices": [ + { + "label": "linear", + "value": "linear" + }, + { + "label": "easeInQuad", + "value": "easeInQuad" + }, + { + "label": "easeOutQuad", + "value": "easeOutQuad" + }, + { + "label": "easeInOutQuad", + "value": "easeInOutQuad" + }, + { + "label": "easeInCubic", + "value": "easeInCubic" + }, + { + "label": "easeOutCubic", + "value": "easeOutCubic" + }, + { + "label": "easeInOutCubic", + "value": "easeInOutCubic" + }, + { + "label": "easeInQuart", + "value": "easeInQuart" + }, + { + "label": "easeOutQuart", + "value": "easeOutQuart" + }, + { + "label": "easeInOutQuart", + "value": "easeInOutQuart" + }, + { + "label": "easeInQuint", + "value": "easeInQuint" + }, + { + "label": "easeOutQuint", + "value": "easeOutQuint" + }, + { + "label": "easeInOutQuint", + "value": "easeInOutQuint" + }, + { + "label": "easeInOutSine", + "value": "easeInOutSine" + }, + { + "label": "easeInExpo", + "value": "easeInExpo" + }, + { + "label": "easeOutExpo", + "value": "easeOutExpo" + }, + { + "label": "easeInOutExpo", + "value": "easeInOutExpo" + }, + { + "label": "easeInCirc", + "value": "easeInCirc" + }, + { + "label": "easeOutCirc", + "value": "easeOutCirc" + }, + { + "label": "easeInOutCirc", + "value": "easeInOutCirc" + }, + { + "label": "easeOutBounce", + "value": "easeOutBounce" + }, + { + "label": "easeInBack", + "value": "easeInBack" + }, + { + "label": "easeOutBack", + "value": "easeOutBack" + }, + { + "label": "easeInOutBack", + "value": "easeInOutBack" + }, + { + "label": "elastic", + "value": "elastic" + }, + { + "label": "swingFromTo", + "value": "swingFromTo" + }, + { + "label": "swingFrom", + "value": "swingFrom" + }, + { + "label": "swingTo", + "value": "swingTo" + }, + { + "label": "bounce", + "value": "bounce" + }, + { + "label": "bouncePast", + "value": "bouncePast" + }, + { + "label": "easeFromTo", + "value": "easeFromTo" + }, + { + "label": "easeFrom", + "value": "easeFrom" + }, + { + "label": "easeTo", + "value": "easeTo" + } ], "name": "FadeInEasing" }, @@ -15096,40 +16004,139 @@ "type": "Choice", "label": "Fade-out easing", "group": "Speed", - "extraInformation": [ - "linear", - "easeInQuad", - "easeOutQuad", - "easeInOutQuad", - "easeInCubic", - "easeOutCubic", - "easeInOutCubic", - "easeInQuart", - "easeOutQuart", - "easeInOutQuart", - "easeInQuint", - "easeOutQuint", - "easeInOutQuint", - "easeInOutSine", - "easeInExpo", - "easeOutExpo", - "easeInOutExpo", - "easeInCirc", - "easeOutCirc", - "easeInOutCirc", - "easeOutBounce", - "easeInBack", - "easeOutBack", - "easeInOutBack", - "elastic", - "swingFromTo", - "swingFrom", - "swingTo", - "bounce", - "bouncePast", - "easeFromTo", - "easeFrom", - "easeTo" + "choices": [ + { + "label": "linear", + "value": "linear" + }, + { + "label": "easeInQuad", + "value": "easeInQuad" + }, + { + "label": "easeOutQuad", + "value": "easeOutQuad" + }, + { + "label": "easeInOutQuad", + "value": "easeInOutQuad" + }, + { + "label": "easeInCubic", + "value": "easeInCubic" + }, + { + "label": "easeOutCubic", + "value": "easeOutCubic" + }, + { + "label": "easeInOutCubic", + "value": "easeInOutCubic" + }, + { + "label": "easeInQuart", + "value": "easeInQuart" + }, + { + "label": "easeOutQuart", + "value": "easeOutQuart" + }, + { + "label": "easeInOutQuart", + "value": "easeInOutQuart" + }, + { + "label": "easeInQuint", + "value": "easeInQuint" + }, + { + "label": "easeOutQuint", + "value": "easeOutQuint" + }, + { + "label": "easeInOutQuint", + "value": "easeInOutQuint" + }, + { + "label": "easeInOutSine", + "value": "easeInOutSine" + }, + { + "label": "easeInExpo", + "value": "easeInExpo" + }, + { + "label": "easeOutExpo", + "value": "easeOutExpo" + }, + { + "label": "easeInOutExpo", + "value": "easeInOutExpo" + }, + { + "label": "easeInCirc", + "value": "easeInCirc" + }, + { + "label": "easeOutCirc", + "value": "easeOutCirc" + }, + { + "label": "easeInOutCirc", + "value": "easeInOutCirc" + }, + { + "label": "easeOutBounce", + "value": "easeOutBounce" + }, + { + "label": "easeInBack", + "value": "easeInBack" + }, + { + "label": "easeOutBack", + "value": "easeOutBack" + }, + { + "label": "easeInOutBack", + "value": "easeInOutBack" + }, + { + "label": "elastic", + "value": "elastic" + }, + { + "label": "swingFromTo", + "value": "swingFromTo" + }, + { + "label": "swingFrom", + "value": "swingFrom" + }, + { + "label": "swingTo", + "value": "swingTo" + }, + { + "label": "bounce", + "value": "bounce" + }, + { + "label": "bouncePast", + "value": "bouncePast" + }, + { + "label": "easeFromTo", + "value": "easeFromTo" + }, + { + "label": "easeFrom", + "value": "easeFrom" + }, + { + "label": "easeTo", + "value": "easeTo" + } ], "name": "FadeOutEasing" }, @@ -15137,10 +16144,19 @@ "value": "Idle", "type": "Choice", "label": "", - "extraInformation": [ - "Idle", - "Focused", - "Pressed" + "choices": [ + { + "label": "Idle", + "value": "Idle" + }, + { + "label": "Focused", + "value": "Focused" + }, + { + "label": "Pressed", + "value": "Pressed" + } ], "hidden": true, "name": "PreviousState" @@ -15561,7 +16577,7 @@ "name": "PanelSpriteSlider", "previewIconUrl": "https://asset-resources.gdevelop.io/public-resources/Icons/Line Hero Pack/Master/SVG/UI Essentials/1678c39a3b2bd3df4f82a8a293770db4986a6bcfd3f78e738ddfc86e39176423_UI Essentials_sliders_options.svg", "shortDescription": "A draggable slider that users can move to select a numerical value.", - "version": "2.0.0", + "version": "2.0.1", "description": [ "A draggable slider that users can move to select a numerical value. The slider can be customized with sprites.", "", @@ -15590,7 +16606,30 @@ "dependencies": [], "globalVariables": [], "sceneVariables": [], - "eventsFunctions": [], + "eventsFunctions": [ + { + "description": "Check if the events are running for the editor.", + "fullName": "Editor is running", + "functionType": "Condition", + "name": "IsInGameEdition", + "private": true, + "sentence": "Events are running for the editor", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const game = runtimeScene.getGame();\r", + "eventsFunctionContext.returnValue = game.isInGameEdition && game.isInGameEdition();" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [], + "objectGroups": [] + } + ], "eventsBasedBehaviors": [ { "description": "Represent a value on a slider.", @@ -16075,59 +17114,27 @@ "sentence": "", "events": [ { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Finite state machine", - "source": "", - "type": "BuiltinCommonInstructions::Group", - "events": [ + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 + "type": { + "inverted": true, + "value": "PanelSpriteSlider::IsInGameEdition" }, - "comment": "The \"Validated\" state only last one frame." - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "State", - "=", - "\"Validated\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetStringVariable" - }, - "parameters": [ - "State", - "=", - "\"Idle\"" - ] - } + "parameters": [ + "", + "" ] - }, + } + ], + "actions": [], + "events": [ { "colorB": 228, "colorG": 176, "colorR": 74, "creationTime": 0, - "name": "Check position", + "name": "Finite state machine", "source": "", "type": "BuiltinCommonInstructions::Group", "events": [ @@ -16141,478 +17148,386 @@ "textG": 0, "textR": 0 }, - "comment": "Make sure the cursor position is only checked once per frame." - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "MouseIsInside", - "False", - "" - ] - } - ] + "comment": "The \"Validated\" state only last one frame." }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "ShouldCheckHovering", - "True", - "" - ] - }, - { - "type": { - "value": "CollisionPoint" + "value": "StringVariable" }, "parameters": [ - "Object", - "MouseOnlyCursorX(Object.Layer(), 0)", - "MouseOnlyCursorY(Object.Layer(), 0)" + "State", + "=", + "\"Validated\"" ] } ], "actions": [ { "type": { - "value": "SetBooleanVariable" + "value": "SetStringVariable" }, "parameters": [ - "MouseIsInside", - "True", - "" + "State", + "=", + "\"Idle\"" ] } ] }, { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 - }, - "comment": "Touches are always pressed, so ShouldCheckHovering doesn't matter." - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Check position", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ { - "type": { - "value": "SetBooleanVariable" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 }, - "parameters": [ - "TouchIsInside", - "False", - "" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "comment": "Make sure the cursor position is only checked once per frame." + }, { - "type": { - "value": "NumberVariable" - }, - "parameters": [ - "TouchId", - "!=", - "0" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "MouseIsInside", + "False", + "" + ] + } ] }, { - "type": { - "value": "CollisionPoint" - }, - "parameters": [ - "Object", - "TouchX(TouchId, Object.Layer(), 0)", - "TouchY(TouchId, Object.Layer(), 0)" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "ShouldCheckHovering", + "True", + "" + ] + }, + { + "type": { + "value": "CollisionPoint" + }, + "parameters": [ + "Object", + "MouseOnlyCursorX(Object.Layer(), 0)", + "MouseOnlyCursorY(Object.Layer(), 0)" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "MouseIsInside", + "True", + "" + ] + } ] - } - ], - "actions": [ + }, { - "type": { - "value": "SetBooleanVariable" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 }, - "parameters": [ - "TouchIsInside", - "True", - "" - ] - } - ] - } - ], - "parameters": [] - }, - { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Handle touch start", - "source": "", - "type": "BuiltinCommonInstructions::Group", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "comment": "Touches are always pressed, so ShouldCheckHovering doesn't matter." + }, { - "type": { - "value": "HasAnyTouchOrMouseStarted" - }, - "parameters": [ - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "TouchIsInside", + "False", + "" + ] + } ] - } - ], - "actions": [ + }, { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "Index", - "=", - "0" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "!=", + "0" + ] + }, + { + "type": { + "value": "CollisionPoint" + }, + "parameters": [ + "Object", + "TouchX(TouchId, Object.Layer(), 0)", + "TouchY(TouchId, Object.Layer(), 0)" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "TouchIsInside", + "True", + "" + ] + } ] } ], + "parameters": [] + }, + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Handle touch start", + "source": "", + "type": "BuiltinCommonInstructions::Group", "events": [ { - "type": "BuiltinCommonInstructions::Repeat", - "repeatExpression": "StartedTouchOrMouseCount()", - "conditions": [], - "actions": [], + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "HasAnyTouchOrMouseStarted" + }, + "parameters": [ + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "Index", + "=", + "0" + ] + } + ], "events": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "CollisionPoint" - }, - "parameters": [ - "Object", - "TouchX(StartedTouchOrMouseId(Index), Object.Layer(), 0)", - "TouchY(StartedTouchOrMouseId(Index), Object.Layer(), 0)" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "StartedTouchOrMouseId(Index)" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "TouchIsInside", - "True", - "" - ] - } - ], + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "StartedTouchOrMouseCount()", + "conditions": [], + "actions": [], "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "value": "BuiltinCommonInstructions::Or" + "value": "CollisionPoint" }, - "parameters": [], - "subInstructions": [ + "parameters": [ + "Object", + "TouchX(StartedTouchOrMouseId(Index), Object.Layer(), 0)", + "TouchY(StartedTouchOrMouseId(Index), Object.Layer(), 0)" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "StartedTouchOrMouseId(Index)" + ] + }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "TouchIsInside", + "True", + "" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { "type": { - "value": "PanelSpriteSlider::ButtonFSM::PropertyState" + "value": "BuiltinCommonInstructions::Or" }, - "parameters": [ - "Object", - "Behavior", - "=", - "\"Hovered\"" + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "PanelSpriteSlider::ButtonFSM::PropertyState" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "\"Hovered\"" + ] + }, + { + "type": { + "value": "PanelSpriteSlider::ButtonFSM::PropertyState" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "\"Idle\"" + ] + } ] - }, + } + ], + "actions": [ { "type": { - "value": "PanelSpriteSlider::ButtonFSM::PropertyState" + "value": "SetStringVariable" }, "parameters": [ - "Object", - "Behavior", + "State", "=", - "\"Idle\"" + "\"PressedInside\"" ] } ] } - ], + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], "actions": [ { "type": { - "value": "SetStringVariable" + "value": "SetNumberVariable" }, "parameters": [ - "State", - "=", - "\"PressedInside\"" + "Index", + "+", + "1" ] } ] } ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "Index", - "+", - "1" - ] - } - ] } ] } - ] - } - ], - "parameters": [] - }, - { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Apply position changes", - "source": "", - "type": "BuiltinCommonInstructions::Group", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "inverted": true, - "value": "BooleanVariable" - }, - "parameters": [ - "MouseIsInside", - "True", - "" - ] - }, - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "State", - "=", - "\"Hovered\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetStringVariable" - }, - "parameters": [ - "State", - "=", - "\"Idle\"" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "MouseIsInside", - "True", - "" - ] - }, - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "State", - "=", - "\"Idle\"" - ] - } ], - "actions": [ - { - "type": { - "value": "SetStringVariable" - }, - "parameters": [ - "State", - "=", - "\"Hovered\"" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "inverted": true, - "value": "BooleanVariable" - }, - "parameters": [ - "TouchIsInside", - "True", - "" - ] - }, - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "State", - "=", - "\"PressedInside\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetStringVariable" - }, - "parameters": [ - "State", - "=", - "\"PressedOutside\"" - ] - } - ] + "parameters": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Apply position changes", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ { - "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "TouchIsInside", - "True", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "BooleanVariable" + }, + "parameters": [ + "MouseIsInside", + "True", + "" + ] + }, + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "State", + "=", + "\"Hovered\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "State", + "=", + "\"Idle\"" + ] + } ] }, - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "State", - "=", - "\"PressedOutside\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetStringVariable" - }, - "parameters": [ - "State", - "=", - "\"PressedInside\"" - ] - } - ] - } - ], - "parameters": [] - }, - { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Handle touch end", - "source": "", - "type": "BuiltinCommonInstructions::Group", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "HasTouchEnded" - }, - "parameters": [ - "", - "TouchId" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "0" - ] - } - ], - "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "MouseIsInside", + "True", + "" + ] + }, { "type": { "value": "StringVariable" @@ -16620,7 +17535,7 @@ "parameters": [ "State", "=", - "\"PressedInside\"" + "\"Idle\"" ] } ], @@ -16632,7 +17547,7 @@ "parameters": [ "State", "=", - "\"Validated\"" + "\"Hovered\"" ] } ] @@ -16643,6 +17558,16 @@ { "type": { "inverted": true, + "value": "BooleanVariable" + }, + "parameters": [ + "TouchIsInside", + "True", + "" + ] + }, + { + "type": { "value": "StringVariable" }, "parameters": [ @@ -16650,16 +17575,42 @@ "=", "\"PressedInside\"" ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "State", + "=", + "\"PressedOutside\"" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "TouchIsInside", + "True", + "" + ] }, { "type": { - "inverted": true, "value": "StringVariable" }, "parameters": [ "State", "=", - "\"Validated\"" + "\"PressedOutside\"" ] } ], @@ -16671,18 +17622,124 @@ "parameters": [ "State", "=", - "\"Idle\"" + "\"PressedInside\"" ] } ] } - ] + ], + "parameters": [] + }, + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Handle touch end", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "HasTouchEnded" + }, + "parameters": [ + "", + "TouchId" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "0" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "State", + "=", + "\"PressedInside\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "State", + "=", + "\"Validated\"" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "StringVariable" + }, + "parameters": [ + "State", + "=", + "\"PressedInside\"" + ] + }, + { + "type": { + "inverted": true, + "value": "StringVariable" + }, + "parameters": [ + "State", + "=", + "\"Validated\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "State", + "=", + "\"Idle\"" + ] + } + ] + } + ] + } + ], + "parameters": [] } ], "parameters": [] } - ], - "parameters": [] + ] } ], "parameters": [ @@ -17115,12 +18172,27 @@ "value": "Idle", "type": "Choice", "label": "State", - "extraInformation": [ - "Idle", - "Hovered", - "PressedInside", - "PressedOutside", - "Validated" + "choices": [ + { + "label": "Idle", + "value": "Idle" + }, + { + "label": "Hovered", + "value": "Hovered" + }, + { + "label": "PressedInside", + "value": "PressedInside" + }, + { + "label": "PressedOutside", + "value": "PressedOutside" + }, + { + "label": "Validated", + "value": "Validated" + } ], "hidden": true, "name": "State" @@ -17211,6 +18283,7 @@ "textAlignment": "", "verticalTextAlignment": "top", "characterSize": 20, + "lineHeight": 0, "color": "0;0;0" } }, @@ -17424,6 +18497,32 @@ "name": "onCreated", "sentence": "", "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "PanelSpriteSlider::IsInGameEdition" + }, + "parameters": [ + "", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "ActivateBehavior" + }, + "parameters": [ + "Thumb", + "Draggable", + "" + ] + } + ] + }, { "type": "BuiltinCommonInstructions::Comment", "color": { @@ -17780,95 +18879,228 @@ ] }, { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Handle touches", - "source": "", - "type": "BuiltinCommonInstructions::Group", + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "PanelSpriteSlider::IsInGameEdition" + }, + "parameters": [ + "", + "" + ] + } + ], + "actions": [], "events": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BehaviorActivated" - }, - "parameters": [ - "Background", - "ButtonFSM" - ] - } - ], - "actions": [], + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Handle touches", + "source": "", + "type": "BuiltinCommonInstructions::Group", "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "inverted": true, - "value": "DraggableBehavior::Dragged" + "value": "BehaviorActivated" }, "parameters": [ - "Thumb", - "Draggable" + "Background", + "ButtonFSM" ] - }, + } + ], + "actions": [], + "events": [ { - "type": { - "inverted": true, - "value": "DraggableBehavior::Dropped" - }, - "parameters": [ - "Thumb", - "Draggable" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "DraggableBehavior::Dragged" + }, + "parameters": [ + "Thumb", + "Draggable" + ] + }, + { + "type": { + "inverted": true, + "value": "DraggableBehavior::Dropped" + }, + "parameters": [ + "Thumb", + "Draggable" + ] + }, + { + "type": { + "value": "BuiltinCommonInstructions::Or" + }, + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "PanelSpriteSlider::ButtonFSM::IsPressed" + }, + "parameters": [ + "Background", + "ButtonFSM", + "" + ] + }, + { + "type": { + "value": "PanelSpriteSlider::ButtonFSM::IsPressedOutside" + }, + "parameters": [ + "Background", + "ButtonFSM", + "" + ] + } + ] + } + ], + "actions": [ + { + "type": { + "value": "PanelSpriteSlider::PanelSpriteSlider::SetValue" + }, + "parameters": [ + "Object", + "=", + "FillBar.Slider::MinValue() + FillBar.Slider::Size() * (TouchX(Background.ButtonFSM::TouchId(), Object.Layer()) - FillBar.X()) / Object.FullBarWidth()", + "FillBar.Slider::MinValue() + FillBar.Slider::Size() * (MouseX() - Object.FullBarLeft()) / Object.FullBarWidth()" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "ShowLabelAtChanges", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "Montre" + }, + "parameters": [ + "Label", + "" + ] + }, + { + "type": { + "value": "ResetObjectTimer" + }, + "parameters": [ + "Label", + "\"HideBack\"" + ] + } + ] + } ] }, { - "type": { - "value": "BuiltinCommonInstructions::Or" - }, - "parameters": [], - "subInstructions": [ + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { "type": { - "value": "PanelSpriteSlider::ButtonFSM::IsPressed" + "value": "DraggableBehavior::Dragged" }, "parameters": [ - "Background", - "ButtonFSM", - "" + "Thumb", + "Draggable" ] - }, + } + ], + "actions": [ { "type": { - "value": "PanelSpriteSlider::ButtonFSM::IsPressedOutside" + "value": "PanelSpriteSlider::PanelSpriteSlider::SetValue" }, "parameters": [ - "Background", - "ButtonFSM", - "" + "Object", + "=", + "FillBar.Slider::MinValue() + FillBar.Slider::Size() * (Thumb.CenterX() - FillBar.X()) / Object.FullBarWidth()", + "FillBar.Slider::MinValue() + FillBar.Slider::Size() * (Thumb.CenterX() - Object.FullBarLeft()) / Object.FullBarWidth()" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "ShowLabelAtChanges", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "Montre" + }, + "parameters": [ + "Label", + "" + ] + } ] } ] - } - ], - "actions": [ + }, { - "type": { - "value": "PanelSpriteSlider::PanelSpriteSlider::SetValue" - }, - "parameters": [ - "Object", - "=", - "FillBar.Slider::MinValue() + FillBar.Slider::Size() * (TouchX(Background.ButtonFSM::TouchId(), Object.Layer()) - FillBar.X()) / Object.FullBarWidth()", - "FillBar.Slider::MinValue() + FillBar.Slider::Size() * (MouseX() - Object.FullBarLeft()) / Object.FullBarWidth()" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "DraggableBehavior::Dropped" + }, + "parameters": [ + "Thumb", + "Draggable" + ] + } + ], + "actions": [ + { + "type": { + "value": "ResetObjectTimer" + }, + "parameters": [ + "Label", + "\"HideBack\"" + ] + } ] - } - ], - "events": [ + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ @@ -17881,6 +19113,16 @@ "True", "" ] + }, + { + "type": { + "value": "CollisionPoint" + }, + "parameters": [ + "Thumb", + "MouseOnlyCursorX(Object.Layer(), 0)", + "MouseOnlyCursorY(Thumb.Layer(), 0)" + ] } ], "actions": [ @@ -17903,173 +19145,48 @@ ] } ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "DraggableBehavior::Dragged" - }, - "parameters": [ - "Thumb", - "Draggable" - ] - } - ], - "actions": [ - { - "type": { - "value": "PanelSpriteSlider::PanelSpriteSlider::SetValue" - }, - "parameters": [ - "Object", - "=", - "FillBar.Slider::MinValue() + FillBar.Slider::Size() * (Thumb.CenterX() - FillBar.X()) / Object.FullBarWidth()", - "FillBar.Slider::MinValue() + FillBar.Slider::Size() * (Thumb.CenterX() - Object.FullBarLeft()) / Object.FullBarWidth()" - ] - } - ], - "events": [ + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "value": "BooleanVariable" + "value": "CompareObjectTimer" }, "parameters": [ - "ShowLabelAtChanges", - "True", - "" + "Label", + "\"HideBack\"", + ">", + "0.5" ] } ], "actions": [ { "type": { - "value": "Montre" + "value": "Cache" + }, + "parameters": [ + "Label" + ] + }, + { + "type": { + "value": "RemoveObjectTimer" }, "parameters": [ "Label", - "" + "\"HideBack\"" ] } ] } ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "DraggableBehavior::Dropped" - }, - "parameters": [ - "Thumb", - "Draggable" - ] - } - ], - "actions": [ - { - "type": { - "value": "ResetObjectTimer" - }, - "parameters": [ - "Label", - "\"HideBack\"" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "ShowLabelAtChanges", - "True", - "" - ] - }, - { - "type": { - "value": "CollisionPoint" - }, - "parameters": [ - "Thumb", - "MouseOnlyCursorX(Object.Layer(), 0)", - "MouseOnlyCursorY(Thumb.Layer(), 0)" - ] - } - ], - "actions": [ - { - "type": { - "value": "Montre" - }, - "parameters": [ - "Label", - "" - ] - }, - { - "type": { - "value": "ResetObjectTimer" - }, - "parameters": [ - "Label", - "\"HideBack\"" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "CompareObjectTimer" - }, - "parameters": [ - "Label", - "\"HideBack\"", - ">", - "0.5" - ] - } - ], - "actions": [ - { - "type": { - "value": "Cache" - }, - "parameters": [ - "Label" - ] - }, - { - "type": { - "value": "RemoveObjectTimer" - }, - "parameters": [ - "Label", - "\"HideBack\"" - ] - } - ] } - ] + ], + "parameters": [] } - ], - "parameters": [] + ] } ], "parameters": [ @@ -19024,6 +20141,7 @@ "Label", "FillBar" ], + "choices": [], "hidden": true, "name": "BarLeftPadding" }, @@ -19036,6 +20154,7 @@ "Label", "FillBar" ], + "choices": [], "hidden": true, "name": "BarTopPadding" }, @@ -19048,6 +20167,7 @@ "Label", "FillBar" ], + "choices": [], "hidden": true, "name": "BarRightPadding" }, @@ -19060,6 +20180,7 @@ "Label", "FillBar" ], + "choices": [], "hidden": true, "name": "BarBottomPadding" }, @@ -19126,6 +20247,7 @@ "extraInformation": [ "Thumb" ], + "choices": [], "hidden": true, "name": "ThumbAnchorOrigin" }, @@ -19137,6 +20259,7 @@ "extraInformation": [ "FillBar" ], + "choices": [], "hidden": true, "name": "ThumbAnchorTarget" }, @@ -19148,6 +20271,7 @@ "extraInformation": [ "Label" ], + "choices": [], "hidden": true, "name": "ShowLabel" }, @@ -19222,6 +20346,7 @@ "textAlignment": "", "verticalTextAlignment": "top", "characterSize": 16, + "lineHeight": 0, "color": "221;221;221" } }, @@ -19479,6 +20604,7 @@ "textAlignment": "", "verticalTextAlignment": "top", "characterSize": 16, + "lineHeight": 0, "color": "221;221;221" } }, @@ -19701,7 +20827,7 @@ "name": "Sticker", "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/sticker-outline.svg", "shortDescription": "Make objects follow the position and rotation of the object they are stuck to.", - "version": "0.5.3", + "version": "0.5.4", "description": [ "This extension can be useful to:", "- Stick accessories to moving objects", @@ -19757,8 +20883,10 @@ " 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()) {", @@ -20101,7 +21229,9 @@ " allStickers: new Set(),", "};", "// Register this object as a sticker.", - "runtimeScene._stickerExtension.allStickers.add(behavior);", + "/** @type {Set} */", + "const allStickers = runtimeScene._stickerExtension.allStickers;", + "allStickers.add(behavior);", "" ], "parameterObjects": "Object", @@ -20289,7 +21419,9 @@ "const object = objects[0];", "const behavior = object.getBehavior(behaviorName);", "", - "runtimeScene._stickerExtension.allStickers.delete(behavior._sticker);", + "/** @type {Set} */", + "const allStickers = runtimeScene._stickerExtension.allStickers;", + "allStickers.delete(behavior);", "" ], "parameterObjects": "Object", @@ -20343,9 +21475,9 @@ "name": "PanelSpriteButton", "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/Line Hero Pack/Master/SVG/Interface Elements/Interface Elements_interface_ui_button_ok_cta_clock_tap.svg", "shortDescription": "A button that can be customized.", - "version": "2.0.0", + "version": "2.1.1", "description": [ - "The button can be customized with a background for each state and a label. It handles user interactions and a simple condition can be used to check if it is clicked.", + "A button that can be used for menus and most labelled buttons of a game. The button can be customized with a background for each state and a label. It handles user interactions and a simple condition can be used to check if it is clicked.", "", "There are ready-to-use buttons in the asset-store [menu buttons pack](https://editor.gdevelop.io/?initial-dialog=asset-store&asset-pack=menu-buttons-menu-buttons)." ], @@ -20369,7 +21501,30 @@ "dependencies": [], "globalVariables": [], "sceneVariables": [], - "eventsFunctions": [], + "eventsFunctions": [ + { + "description": "Check if the events are running for the editor.", + "fullName": "Editor is running", + "functionType": "Condition", + "name": "IsInGameEdition", + "private": true, + "sentence": "Events are running for the editor", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const game = runtimeScene.getGame();\r", + "eventsFunctionContext.returnValue = game.isInGameEdition && game.isInGameEdition();" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [], + "objectGroups": [] + } + ], "eventsBasedBehaviors": [ { "description": "The finite state machine used internally by the button object.", @@ -20385,442 +21540,45 @@ "sentence": "", "events": [ { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Finite state machine", - "source": "", - "type": "BuiltinCommonInstructions::Group", - "events": [ + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 + "type": { + "inverted": true, + "value": "PanelSpriteButton::IsInGameEdition" }, - "comment": "The \"Validated\" state only last one frame." - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "State", - "=", - "\"Validated\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetStringVariable" - }, - "parameters": [ - "State", - "=", - "\"Idle\"" - ] - } - ] - }, - { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Check position", - "source": "", - "type": "BuiltinCommonInstructions::Group", - "events": [ - { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 - }, - "comment": "Make sure the cursor position is only checked once per frame." - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "MouseIsInside", - "False", - "" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "ShouldCheckHovering", - "True", - "" - ] - }, - { - "type": { - "value": "CollisionPoint" - }, - "parameters": [ - "Object", - "MouseOnlyCursorX(Object.Layer(), 0)", - "MouseOnlyCursorY(Object.Layer(), 0)" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "MouseIsInside", - "True", - "" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 - }, - "comment": "Touches are always pressed, so ShouldCheckHovering doesn't matter." - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "TouchIsInside", - "False", - "" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "NumberVariable" - }, - "parameters": [ - "TouchId", - "!=", - "0" - ] - }, - { - "type": { - "value": "CollisionPoint" - }, - "parameters": [ - "Object", - "TouchX(TouchId, Object.Layer(), 0)", - "TouchY(TouchId, Object.Layer(), 0)" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "TouchIsInside", - "True", - "" - ] - } - ] - } - ], - "parameters": [] - }, - { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Handle touch start", - "source": "", - "type": "BuiltinCommonInstructions::Group", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "HasAnyTouchOrMouseStarted" - }, - "parameters": [ - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "Index", - "=", - "0" - ] - } - ], - "events": [ - { - "type": "BuiltinCommonInstructions::Repeat", - "repeatExpression": "StartedTouchOrMouseCount()", - "conditions": [], - "actions": [], - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "CollisionPoint" - }, - "parameters": [ - "Object", - "TouchX(StartedTouchOrMouseId(Index), Object.Layer(), 0)", - "TouchY(StartedTouchOrMouseId(Index), Object.Layer(), 0)" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "StartedTouchOrMouseId(Index)" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "TouchIsInside", - "True", - "" - ] - } - ], - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::Or" - }, - "parameters": [], - "subInstructions": [ - { - "type": { - "value": "PanelSpriteButton::ButtonFSM::PropertyState" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "\"Hovered\"" - ] - }, - { - "type": { - "value": "PanelSpriteButton::ButtonFSM::PropertyState" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "\"Idle\"" - ] - } - ] - } - ], - "actions": [ - { - "type": { - "value": "SetStringVariable" - }, - "parameters": [ - "State", - "=", - "\"PressedInside\"" - ] - } - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "Index", - "+", - "1" - ] - } - ] - } - ] - } - ] - } - ], - "parameters": [] - }, - { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Apply position changes", - "source": "", - "type": "BuiltinCommonInstructions::Group", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "inverted": true, - "value": "BooleanVariable" - }, - "parameters": [ - "MouseIsInside", - "True", - "" - ] - }, - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "State", - "=", - "\"Hovered\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetStringVariable" - }, - "parameters": [ - "State", - "=", - "\"Idle\"" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "MouseIsInside", - "True", - "" - ] - }, - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "State", - "=", - "\"Idle\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetStringVariable" - }, - "parameters": [ - "State", - "=", - "\"Hovered\"" - ] - } - ] + "parameters": [ + "", + "" + ] + } + ], + "actions": [], + "events": [ + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Finite state machine", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "The \"Validated\" state only last one frame." }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ - { - "type": { - "inverted": true, - "value": "BooleanVariable" - }, - "parameters": [ - "TouchIsInside", - "True", - "" - ] - }, { "type": { "value": "StringVariable" @@ -20828,7 +21586,7 @@ "parameters": [ "State", "=", - "\"PressedInside\"" + "\"Validated\"" ] } ], @@ -20840,89 +21598,325 @@ "parameters": [ "State", "=", - "\"PressedOutside\"" + "\"Idle\"" ] } ] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Check position", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ { - "type": { - "value": "BooleanVariable" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 }, - "parameters": [ - "TouchIsInside", - "True", - "" + "comment": "Make sure the cursor position is only checked once per frame." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "MouseIsInside", + "False", + "" + ] + } ] }, { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "State", - "=", - "\"PressedOutside\"" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "ShouldCheckHovering", + "True", + "" + ] + }, + { + "type": { + "value": "CollisionPoint" + }, + "parameters": [ + "Object", + "MouseOnlyCursorX(Object.Layer(), 0)", + "MouseOnlyCursorY(Object.Layer(), 0)" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "MouseIsInside", + "True", + "" + ] + } ] - } - ], - "actions": [ + }, { - "type": { - "value": "SetStringVariable" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 }, - "parameters": [ - "State", - "=", - "\"PressedInside\"" + "comment": "Touches are always pressed, so ShouldCheckHovering doesn't matter." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "TouchIsInside", + "False", + "" + ] + } ] - } - ] - } - ], - "parameters": [] - }, - { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Handle touch end", - "source": "", - "type": "BuiltinCommonInstructions::Group", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + }, { - "type": { - "value": "HasTouchEnded" - }, - "parameters": [ - "", - "TouchId" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "!=", + "0" + ] + }, + { + "type": { + "value": "CollisionPoint" + }, + "parameters": [ + "Object", + "TouchX(TouchId, Object.Layer(), 0)", + "TouchY(TouchId, Object.Layer(), 0)" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "TouchIsInside", + "True", + "" + ] + } ] } ], - "actions": [ + "parameters": [] + }, + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Handle touch start", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "0" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "HasAnyTouchOrMouseStarted" + }, + "parameters": [ + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "Index", + "=", + "0" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "StartedTouchOrMouseCount()", + "conditions": [], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "CollisionPoint" + }, + "parameters": [ + "Object", + "TouchX(StartedTouchOrMouseId(Index), Object.Layer(), 0)", + "TouchY(StartedTouchOrMouseId(Index), Object.Layer(), 0)" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "StartedTouchOrMouseId(Index)" + ] + }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "TouchIsInside", + "True", + "" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::Or" + }, + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "PanelSpriteButton::ButtonFSM::PropertyState" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "\"Hovered\"" + ] + }, + { + "type": { + "value": "PanelSpriteButton::ButtonFSM::PropertyState" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "\"Idle\"" + ] + } + ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "State", + "=", + "\"PressedInside\"" + ] + } + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "Index", + "+", + "1" + ] + } + ] + } + ] + } ] } ], + "parameters": [] + }, + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Apply position changes", + "source": "", + "type": "BuiltinCommonInstructions::Group", "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [ + { + "type": { + "inverted": true, + "value": "BooleanVariable" + }, + "parameters": [ + "MouseIsInside", + "True", + "" + ] + }, { "type": { "value": "StringVariable" @@ -20930,7 +21924,7 @@ "parameters": [ "State", "=", - "\"PressedInside\"" + "\"Hovered\"" ] } ], @@ -20942,7 +21936,44 @@ "parameters": [ "State", "=", - "\"Validated\"" + "\"Idle\"" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "MouseIsInside", + "True", + "" + ] + }, + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "State", + "=", + "\"Idle\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "State", + "=", + "\"Hovered\"" ] } ] @@ -20953,6 +21984,16 @@ { "type": { "inverted": true, + "value": "BooleanVariable" + }, + "parameters": [ + "TouchIsInside", + "True", + "" + ] + }, + { + "type": { "value": "StringVariable" }, "parameters": [ @@ -20960,16 +22001,42 @@ "=", "\"PressedInside\"" ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "State", + "=", + "\"PressedOutside\"" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "TouchIsInside", + "True", + "" + ] }, { "type": { - "inverted": true, "value": "StringVariable" }, "parameters": [ "State", "=", - "\"Validated\"" + "\"PressedOutside\"" ] } ], @@ -20981,18 +22048,124 @@ "parameters": [ "State", "=", - "\"Idle\"" + "\"PressedInside\"" ] } ] } - ] + ], + "parameters": [] + }, + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Handle touch end", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "HasTouchEnded" + }, + "parameters": [ + "", + "TouchId" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "0" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "State", + "=", + "\"PressedInside\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "State", + "=", + "\"Validated\"" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "StringVariable" + }, + "parameters": [ + "State", + "=", + "\"PressedInside\"" + ] + }, + { + "type": { + "inverted": true, + "value": "StringVariable" + }, + "parameters": [ + "State", + "=", + "\"Validated\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "State", + "=", + "\"Idle\"" + ] + } + ] + } + ] + } + ], + "parameters": [] } ], "parameters": [] } - ], - "parameters": [] + ] } ], "parameters": [ @@ -21465,12 +22638,27 @@ "value": "Idle", "type": "Choice", "label": "State", - "extraInformation": [ - "Idle", - "Hovered", - "PressedInside", - "PressedOutside", - "Validated" + "choices": [ + { + "label": "Idle", + "value": "Idle" + }, + { + "label": "Hovered", + "value": "Hovered" + }, + { + "label": "PressedInside", + "value": "PressedInside" + }, + { + "label": "PressedOutside", + "value": "PressedOutside" + }, + { + "label": "Validated", + "value": "Validated" + } ], "hidden": true, "name": "State" @@ -21572,6 +22760,7 @@ "textAlignment": "center", "verticalTextAlignment": "center", "characterSize": 20, + "lineHeight": 0, "color": "0;0;0" } }, @@ -21671,6 +22860,36 @@ "useLegacyBottomAndRightAnchors": false } ] + }, + { + "assetStoreId": "", + "name": "BitmapLabel", + "type": "BitmapText::BitmapTextObject", + "variables": [], + "effects": [], + "behaviors": [ + { + "name": "Anchor", + "type": "AnchorBehavior::AnchorBehavior", + "bottomEdgeAnchor": 4, + "topEdgeAnchor": 4, + "leftEdgeAnchor": 1, + "relativeToOriginalWindowSize": true, + "rightEdgeAnchor": 2, + "useLegacyBottomAndRightAnchors": false + } + ], + "content": { + "text": "Text", + "opacity": 255, + "scale": 1, + "fontSize": 20, + "tint": "255;255;255", + "bitmapFontResourceName": "", + "textureAtlasResourceName": "", + "align": "center", + "verticalTextAlignment": "center" + } } ], "objectsFolderStructure": { @@ -21679,6 +22898,9 @@ { "objectName": "Label" }, + { + "objectName": "BitmapLabel" + }, { "objectName": "Idle" }, @@ -21704,6 +22926,17 @@ "name": "Pressed" } ] + }, + { + "name": "Labels", + "objects": [ + { + "name": "Label" + }, + { + "name": "BitmapLabel" + } + ] } ], "layers": [ @@ -21880,7 +23113,7 @@ "value": "TextContainerCapability::TextContainerBehavior::SetValue" }, "parameters": [ - "Label", + "Labels", "Text", "=", "LabelText" @@ -21956,7 +23189,7 @@ "value": "TextContainerCapability::TextContainerBehavior::SetValue" }, "parameters": [ - "Label", + "Labels", "Text", "=", "LabelText" @@ -22596,7 +23829,7 @@ "value": "TextContainerCapability::TextContainerBehavior::SetValue" }, "parameters": [ - "Label", + "Labels", "Text", "=", "Value" @@ -22636,7 +23869,7 @@ "value": "TextContainerCapability::TextContainerBehavior::SetValue" }, "parameters": [ - "Label", + "Labels", "Text", "=", "Value" @@ -22671,7 +23904,7 @@ "value": "SetReturnString" }, "parameters": [ - "Label.Text::Value()" + "Labels.Text::Value()" ] } ] @@ -22863,7 +24096,7 @@ "value": "SetCenterY" }, "parameters": [ - "Label", + "Labels", "+", "Value - LabelOffset" ] @@ -22927,8 +24160,15 @@ "value": "", "type": "Choice", "label": "", - "extraInformation": [ - "Label.Text=LabelText" + "choices": [ + { + "label": "Label.Text=LabelText", + "value": "Label.Text=LabelText" + }, + { + "label": "BitmapLabel.Text=LabelText", + "value": "BitmapLabel.Text=LabelText" + } ], "hidden": true, "name": "_PropertyMapping" @@ -22994,6 +24234,7 @@ "textAlignment": "center", "verticalTextAlignment": "center", "characterSize": 50, + "lineHeight": 0, "color": "255;255;255" } }, @@ -31346,6 +32587,7 @@ "extraInformation": [ "PlatformBehavior::PlatformerObjectBehavior" ], + "choices": [], "name": "PlatformerCharacter" }, { @@ -31355,6 +32597,7 @@ "extraInformation": [ "SmoothCamera::SmoothCamera" ], + "choices": [], "name": "SmoothCamera" }, { @@ -33821,6 +35064,7 @@ "extraInformation": [ "Scene3D::Base3DBehavior" ], + "choices": [], "name": "Object3D" }, { @@ -34276,6 +35520,7 @@ "extraInformation": [ "Scene3D::Base3DBehavior" ], + "choices": [], "name": "Object3D" }, { @@ -34285,6 +35530,7 @@ "extraInformation": [ "Tween::TweenBehavior" ], + "choices": [], "name": "TweenBehavior" }, { diff --git a/examples/3d-road-crosser/assets/rotate-screen-icon.png b/examples/3d-road-crosser/assets/rotate-screen-icon.png index ba619fae3995e5576c1e1de0a994b5b3da7c39dc..a7726dee34eba34b401b26b73b5bf128ff7c26d7 100644 GIT binary patch delta 1155 zcmV-}1bqAP28{`j8Gi-<007npjm!W5010qNS#tmY3ljhU3ljkVnw%H_00citL_t(| z+U?!pwW2T(1>jc#B~St-Sb`f&sWc6&`9(FdUz!2ufn{)iP zFJiu(WD*ki`Z89$_tpJVezDjscc9w;Dee8UV~f~C+WUWt3x9BoE<;GAA1{n9Lr|{@ zqssu2^Y0f%*G5QJKfU}!SHTucgVg$YrDGSkF3j%!Io&_~OrSGcalK6LxB$k7zpdGt z>qJfWqT$~ihuFO(#CgD+!@nus0J<6ZiS%%a zkf}|^8PsuMdVjrc^u)TVX37}y=+c;8r;DCh5fD}nm|iOaRgvga*5YUmcf7|0vi#q!c*I(ogbVKXj!WbtPaQpC|t;`*$0UbAGITFauxcL)7eRfch zWg0}F+i+Pabb;3_pdyo0RG?zy-(H}hB0n}OAb6=+_+O}R$dcG1qkMjHi6KeFYy6Dy|o2u0uhKn1R@ZD2t*(P z5r{wpA`pR~fxZc3{|6Ds_>YpO0tuvZ9gW&Tt$+AYI|8Y;sne)z_~hZ9Kx)_Xw`h+? zJ%J1&g$m7X_6G$j)%Wj-%@-Yk7GIbCUdYHJ1zG|vy0+mdmtUF{Hz-in=Rx9>OQT)6 zc_@U5>MDEpP@q77iX^98EJC3y^@z=?x3#~_3>4B@oOqJuA;lMN4h06Z-Zo{cP-v^! zqJOLFQh#}JD8$`_k2-!rH1NXcxkeJ4Gh0@-dvY`XKK3?f$MHuG zs2Zfl{nW^dyusRsEy4v`R|hB-0p*)GT?B{GqujlnMkdMC44gj9;TS!Nv;W(ZrF^D3 z0(u;InLTk5rN`0nB&=|BPu2{HlVJA$Y|+*eXZzXz)Y7eTMu_FV^m-1=fl-q_y?(cF z2`6C`U1lOxY{B#?cRjJ&lb3|baOvu2spC}}%ON=ea-z)Z?* zMqugDC_atNmBAsU1(z{AT5-3YssWQGU52g&%X!B2s%Mq_v$$(=XiTc za}skxbf@G~0#nJw!Z{>~f8@5gv!W~3SS=M$839QocMjN)O*LdV9? zCxOu7>e+n%6@fxID5@S*;$Z0FH}9klXisOV_8tv}_R~*oyQATd>iB@{h2UF@UMScf z^n-rT|AlB4WM)D6e-tnrGSO7O2kh{OROJk_T_cC_UAK)$ZJ5INF{(-24+01>)f1p+ z95vCbs~;*Ya@)d8?~6laGW${nb&ANwFb!{XN5?_)8Eql8iwCYn^VL zlW!>ix;j1cC}j1fn;F`qpl#yz4yQpu5aSx+l7b+^xt6-1f3O{PW!7>1_eTdJOURK2$=wV@}4LZLO*%q^QFz=P%!X=ku;#hqe3bKyY{tK Date: Wed, 8 Oct 2025 15:28:35 +0200 Subject: [PATCH 08/12] [3D shark frenzy] Update the extensions --- examples/3d-shark-frenzy/3d-shark-frenzy.json | 4745 ++++++++++------- .../assets/rotate-screen-icon.png | Bin 881 -> 1165 bytes 2 files changed, 2918 insertions(+), 1827 deletions(-) diff --git a/examples/3d-shark-frenzy/3d-shark-frenzy.json b/examples/3d-shark-frenzy/3d-shark-frenzy.json index f952fa864..59e8a4ecd 100644 --- a/examples/3d-shark-frenzy/3d-shark-frenzy.json +++ b/examples/3d-shark-frenzy/3d-shark-frenzy.json @@ -1,7 +1,7 @@ { "firstLayout": "Menu", "gdVersion": { - "build": 237, + "build": 242, "major": 5, "minor": 5, "revision": 0 @@ -87,7 +87,6 @@ "categories": [], "playableDevices": [ "keyboard", - "mobile", "mobile" ], "extensionProperties": [], @@ -522,14 +521,6 @@ "smoothed": true, "userAdded": true }, - { - "file": "assets/rotate-screen-icon.png", - "kind": "image", - "metadata": "", - "name": "rotate-screen-icon.png", - "smoothed": true, - "userAdded": false - }, { "file": "assets/Blue Button With Shadow_Hovered.png", "kind": "image", @@ -576,6 +567,18 @@ "identifier": "https://asset-resources.gdevelop.io/staging/public-resources/Menu buttons/05b0c1364a92b436b86ca819e66b63480d1bc2fb399f6c0cf8bffbf8199ccc2a_CantoraOne-Regular.ttf", "name": "CantoraOne-Regular.ttf" } + }, + { + "file": "assets/rotate-screen-icon.png", + "kind": "image", + "metadata": "", + "name": "rotate-screen-icon.png", + "smoothed": true, + "userAdded": false, + "origin": { + "identifier": "https://asset-resources.gdevelop.io/public-resources/Mobile Layouts/6a8102ce3340bf9f62300ee1a81ef0b2327b2c6e8d62d7dda68d547f5e2b5969_rotate-screen-icon.png", + "name": "rotate-screen-icon.png" + } } ], "resourceFolders": [] @@ -888,6 +891,7 @@ "textAlignment": "center", "verticalTextAlignment": "top", "characterSize": 35, + "lineHeight": 0, "color": "255;255;255" } }, @@ -1037,6 +1041,7 @@ "textAlignment": "center", "verticalTextAlignment": "top", "characterSize": 35, + "lineHeight": 0, "color": "255;255;255" } }, @@ -1134,6 +1139,7 @@ "textAlignment": "center", "verticalTextAlignment": "top", "characterSize": 35, + "lineHeight": 0, "color": "255;255;255" } }, @@ -1302,6 +1308,7 @@ "textAlignment": "", "verticalTextAlignment": "top", "characterSize": 16, + "lineHeight": 0, "color": "255;255;255" } }, @@ -1399,6 +1406,7 @@ "textAlignment": "center", "verticalTextAlignment": "top", "characterSize": 35, + "lineHeight": 0, "color": "255;255;255" } }, @@ -1464,6 +1472,7 @@ "textAlignment": "left", "verticalTextAlignment": "top", "characterSize": 50, + "lineHeight": 0, "color": "255;255;255" } }, @@ -1517,6 +1526,7 @@ "textAlignment": "center", "verticalTextAlignment": "top", "characterSize": 120, + "lineHeight": 0, "color": "255;255;255" } }, @@ -1524,7 +1534,7 @@ "assetStoreId": "", "name": "ScreenOrientationChecker", "type": "ScreenOrientationChecker::ScreenOrientationChecker", - "variant": "", + "variant": "Black screen orientation checker", "variables": [], "effects": [], "behaviors": [], @@ -2055,7 +2065,7 @@ "gridColor": 10401023, "gridAlpha": 0.8, "snap": false, - "zoomFactor": 0.8578190964847674, + "zoomFactor": 0.5216147291572747, "windowMask": false }, "objectsGroups": [ @@ -3312,6 +3322,7 @@ "textAlignment": "center", "verticalTextAlignment": "top", "characterSize": 14, + "lineHeight": 0, "color": "255;255;255" } } @@ -3367,6 +3378,7 @@ "textAlignment": "left", "verticalTextAlignment": "top", "characterSize": 35, + "lineHeight": 0, "color": "255;255;255" } }, @@ -3414,6 +3426,7 @@ "textAlignment": "left", "verticalTextAlignment": "top", "characterSize": 20, + "lineHeight": 0, "color": "255;255;255" } }, @@ -3590,6 +3603,7 @@ "textAlignment": "center", "verticalTextAlignment": "top", "characterSize": 14, + "lineHeight": 0, "color": "255;255;255" } } @@ -3634,6 +3648,7 @@ "textAlignment": "left", "verticalTextAlignment": "top", "characterSize": 50, + "lineHeight": 0, "color": "248;231;28" } }, @@ -3941,6 +3956,7 @@ "textAlignment": "center", "verticalTextAlignment": "top", "characterSize": 50, + "lineHeight": 0, "color": "255;255;255" } }, @@ -4026,6 +4042,7 @@ "textAlignment": "center", "verticalTextAlignment": "top", "characterSize": 35, + "lineHeight": 0, "color": "255;255;255" } }, @@ -4123,6 +4140,7 @@ "textAlignment": "center", "verticalTextAlignment": "top", "characterSize": 35, + "lineHeight": 0, "color": "255;255;255" } }, @@ -4188,6 +4206,7 @@ "textAlignment": "center", "verticalTextAlignment": "top", "characterSize": 50, + "lineHeight": 0, "color": "255;255;255" } }, @@ -7734,7 +7753,7 @@ "name": "ScreenOrientationChecker", "previewIconUrl": "https://asset-resources.gdevelop.io/public-resources/Icons/0126888931a4a4f82bb2824df9f096347ace1c47f510c44df42aa8dc9e49e24a_screen-rotation.svg", "shortDescription": "Display a customizable screen asking the user to rotate their phone/tablet if not in the right orientation.", - "version": "0.1.1", + "version": "0.2.0", "description": "Display a customizable screen asking the user to rotate their phone/tablet if not in the right orientation.", "origin": { "identifier": "ScreenOrientationChecker", @@ -7757,6 +7776,28 @@ ], "sceneVariables": [], "eventsFunctions": [ + { + "description": "Check if the events are running for the editor.", + "fullName": "Editor is running", + "functionType": "Condition", + "name": "IsInGameEdition", + "private": true, + "sentence": "Events are running for the editor", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const game = runtimeScene.getGame();\r", + "eventsFunctionContext.returnValue = game.isInGameEdition && game.isInGameEdition();" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [], + "objectGroups": [] + }, { "fullName": "Get game target orientation", "functionType": "StringExpression", @@ -7875,6 +7916,7 @@ "textAlignment": "center", "verticalTextAlignment": "top", "characterSize": 30, + "lineHeight": 0, "color": "255;255;255" } }, @@ -8075,6 +8117,38 @@ } ], "eventsFunctions": [ + { + "fullName": "", + "functionType": "Action", + "name": "onCreated", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "PrimitiveDrawing::ClearBetweenFrames" + }, + "parameters": [ + "BackgroundPainter", + "" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "ScreenOrientationChecker::ScreenOrientationChecker", + "type": "object" + } + ], + "objectGroups": [] + }, { "fullName": "", "functionType": "Action", @@ -8082,41 +8156,66 @@ "sentence": "", "events": [ { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 - }, - "comment": "Check if the screen must be shown" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "ScreenOrientationChecker::IsInGameEdition" + }, + "parameters": [ + "", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "ScreenOrientationChecker::ScreenOrientationChecker::DrawBackground" + }, + "parameters": [ + "Object", + "" + ] + } + ] }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "value": "SystemInfo::IsMobile" + "inverted": true, + "value": "ScreenOrientationChecker::IsInGameEdition" }, - "parameters": [] + "parameters": [ + "", + "" + ] } ], "actions": [], "events": [ + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Check if the screen must be shown" + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "value": "BuiltinCommonInstructions::CompareNumbers" + "value": "SystemInfo::IsMobile" }, - "parameters": [ - "SceneWindowWidth()", - ">", - "SceneWindowHeight()" - ] + "parameters": [] } ], "actions": [], @@ -8126,24 +8225,69 @@ "conditions": [ { "type": { - "value": "StringVariable" + "value": "BuiltinCommonInstructions::CompareNumbers" }, "parameters": [ - "TargetOrientation", - "=", - "\"portrait\"" + "SceneWindowWidth()", + ">", + "SceneWindowHeight()" ] } ], - "actions": [ + "actions": [], + "events": [ { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsShown", - "False", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "TargetOrientation", + "=", + "\"portrait\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsShown", + "False", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "TargetOrientation", + "!=", + "\"portrait\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsShown", + "False", + "" + ] + } ] } ] @@ -8153,127 +8297,146 @@ "conditions": [ { "type": { - "value": "StringVariable" + "value": "BuiltinCommonInstructions::CompareNumbers" }, "parameters": [ - "TargetOrientation", - "!=", - "\"portrait\"" + "SceneWindowWidth()", + "<=", + "SceneWindowHeight()" ] } ], - "actions": [ + "actions": [], + "events": [ { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsShown", - "False", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "TargetOrientation", + "=", + "\"landscape\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsShown", + "False", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "TargetOrientation", + "=", + "\"portrait\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsShown", + "False", + "" + ] + } ] } ] } ] }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Show/hide the screen as needed" + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "value": "BuiltinCommonInstructions::CompareNumbers" + "value": "BuiltinCommonInstructions::Or" }, - "parameters": [ - "SceneWindowWidth()", - "<=", - "SceneWindowHeight()" - ] - } - ], - "actions": [], - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "parameters": [], + "subInstructions": [ { "type": { - "value": "StringVariable" + "value": "BooleanVariable" }, "parameters": [ - "TargetOrientation", - "=", - "\"landscape\"" + "IsShown", + "True", + "" ] - } - ], - "actions": [ + }, { "type": { - "value": "SetBooleanVariable" + "value": "BooleanVariable" }, "parameters": [ - "IsShown", - "False", + "IsForceShown", + "True", "" ] } ] + } + ], + "actions": [ + { + "type": { + "value": "ScreenOrientationChecker::ScreenOrientationChecker::DrawBackground" + }, + "parameters": [ + "Object", + "" + ] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "TargetOrientation", - "=", - "\"portrait\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsShown", - "False", - "" - ] - } + "type": { + "value": "Montre" + }, + "parameters": [ + "Object", + "" ] } ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 - }, - "comment": "Show/hide the screen as needed" - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + }, { - "type": { - "value": "BuiltinCommonInstructions::Or" - }, - "parameters": [], - "subInstructions": [ + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { "type": { + "inverted": true, "value": "BooleanVariable" }, "parameters": [ @@ -8284,6 +8447,7 @@ }, { "type": { + "inverted": true, "value": "BooleanVariable" }, "parameters": [ @@ -8292,19 +8456,196 @@ "" ] } + ], + "actions": [ + { + "type": { + "value": "Cache" + }, + "parameters": [ + "Object" + ] + } ] - } - ], - "actions": [ + }, { - "type": { - "value": "PrimitiveDrawing::FillColor" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "MettreY" + }, + "parameters": [ + "Icon", + "=", + "Text.Y() - 100" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 }, - "parameters": [ - "BackgroundPainter", - "BackgroundColor" + "comment": "Animate the icon" + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "Tween::Exists" + }, + "parameters": [ + "Icon", + "Tween", + "\"Rotate\"" + ] + }, + { + "type": { + "inverted": true, + "value": "Tween::Exists" + }, + "parameters": [ + "Icon", + "Tween", + "\"RotateBack\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "Tween::TweenBehavior::AddObjectAngleTween2" + }, + "parameters": [ + "Icon", + "Tween", + "\"Rotate\"", + "8", + "\"easeInOutQuad\"", + "2", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Tween::HasFinished" + }, + "parameters": [ + "Icon", + "Tween", + "\"RotateBack\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "Tween::TweenBehavior::AddObjectAngleTween2" + }, + "parameters": [ + "Icon", + "Tween", + "\"Rotate\"", + "8", + "\"easeInOutQuad\"", + "2", + "" + ] + }, + { + "type": { + "value": "Tween::RemoveTween" + }, + "parameters": [ + "Icon", + "Tween", + "\"RotateBack\"" + ] + } ] }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Tween::HasFinished" + }, + "parameters": [ + "Icon", + "Tween", + "\"Rotate\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "Tween::TweenBehavior::AddObjectAngleTween2" + }, + "parameters": [ + "Icon", + "Tween", + "\"RotateBack\"", + "-8", + "\"easeInOutQuad\"", + "2", + "" + ] + }, + { + "type": { + "value": "Tween::RemoveTween" + }, + "parameters": [ + "Icon", + "Tween", + "\"Rotate\"" + ] + } + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "ScreenOrientationChecker::ScreenOrientationChecker", + "type": "object" + } + ], + "objectGroups": [] + }, + { + "description": "Draw the background.", + "fullName": "Draw the background", + "functionType": "Action", + "name": "DrawBackground", + "private": true, + "sentence": "Draw the background of _PARAM0_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ { "type": { "value": "PrimitiveDrawing::RoundedRectangle" @@ -8317,210 +8658,11 @@ "Object.Height()-Padding", "CornerRadius" ] - }, - { - "type": { - "value": "Montre" - }, - "parameters": [ - "Object", - "" - ] } ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "inverted": true, - "value": "BooleanVariable" - }, - "parameters": [ - "IsShown", - "True", - "" - ] - }, - { - "type": { - "inverted": true, - "value": "BooleanVariable" - }, - "parameters": [ - "IsForceShown", - "True", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "Cache" - }, - "parameters": [ - "Object" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "MettreY" - }, - "parameters": [ - "Icon", - "=", - "Text.Y() - 100" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 - }, - "comment": "Animate the icon" - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "inverted": true, - "value": "Tween::Exists" - }, - "parameters": [ - "Icon", - "Tween", - "\"Rotate\"" - ] - }, - { - "type": { - "inverted": true, - "value": "Tween::Exists" - }, - "parameters": [ - "Icon", - "Tween", - "\"RotateBack\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "Tween::TweenBehavior::AddObjectAngleTween2" - }, - "parameters": [ - "Icon", - "Tween", - "\"Rotate\"", - "8", - "\"easeInOutQuad\"", - "2", - "" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "Tween::HasFinished" - }, - "parameters": [ - "Icon", - "Tween", - "\"RotateBack\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "Tween::TweenBehavior::AddObjectAngleTween2" - }, - "parameters": [ - "Icon", - "Tween", - "\"Rotate\"", - "8", - "\"easeInOutQuad\"", - "2", - "" - ] - }, - { - "type": { - "value": "Tween::RemoveTween" - }, - "parameters": [ - "Icon", - "Tween", - "\"RotateBack\"" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "Tween::HasFinished" - }, - "parameters": [ - "Icon", - "Tween", - "\"Rotate\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "Tween::TweenBehavior::AddObjectAngleTween2" - }, - "parameters": [ - "Icon", - "Tween", - "\"RotateBack\"", - "-8", - "\"easeInOutQuad\"", - "2", - "" - ] - }, - { - "type": { - "value": "Tween::RemoveTween" - }, - "parameters": [ - "Icon", - "Tween", - "\"Rotate\"" - ] - } - ] - } - ], - "parameters": [ + } + ], + "parameters": [ { "description": "Object", "name": "Object", @@ -8534,7 +8676,6 @@ "description": "Check if the screen should be forced to be shown. Use this to test the screen in your game.", "fullName": "Force show the screen", "functionType": "Condition", - "group": "Screen Orientation Checker configuration", "name": "IsForceShown", "sentence": "_PARAM0_ is forced to be shown", "events": [ @@ -8578,7 +8719,6 @@ "description": "Change if the screen should be forced to be shown. Use this to test the screen in your game.", "fullName": "Force show the screen", "functionType": "Action", - "group": "Screen Orientation Checker configuration", "name": "SetIsForceShown", "sentence": "Force _PARAM0_ to be shown: _PARAM1_", "events": [ @@ -8654,6 +8794,76 @@ } ], "objectGroups": [] + }, + { + "description": "the message of the object.", + "fullName": "Message", + "functionType": "ExpressionAndCondition", + "name": "Message", + "sentence": "the message", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnString" + }, + "parameters": [ + "Text.Text::Value()" + ] + } + ] + } + ], + "expressionType": { + "type": "string" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "ScreenOrientationChecker::ScreenOrientationChecker", + "type": "object" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "Message", + "name": "SetMessage", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "TextContainerCapability::TextContainerBehavior::SetValue" + }, + "parameters": [ + "Text", + "Text", + "=", + "Value" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "ScreenOrientationChecker::ScreenOrientationChecker", + "type": "object" + } + ], + "objectGroups": [] } ], "propertyDescriptors": [ @@ -8687,16 +8897,276 @@ "description": "Corner radius for the background", "group": "Appearance", "name": "CornerRadius" - }, - { - "value": "0;0;0", - "type": "Color", - "label": "Background color", - "group": "Appearance", - "name": "BackgroundColor" } ], - "variants": [] + "variants": [ + { + "areaMaxX": 400, + "areaMaxY": 200, + "areaMaxZ": 0, + "areaMinX": 0, + "areaMinY": 0, + "areaMinZ": 0, + "assetStoreAssetId": "2743bcd6cf431c6c00cda3a59684eb152b3a09d598b799b15383e4f77daf8b37", + "assetStoreOriginalName": "Black screen orientation checker", + "name": "Black screen orientation checker", + "objects": [ + { + "assetStoreId": "", + "bold": true, + "italic": false, + "name": "Text", + "smoothed": true, + "type": "TextObject::Text", + "underlined": false, + "variables": [], + "effects": [], + "behaviors": [ + { + "name": "Anchor", + "type": "AnchorBehavior::AnchorBehavior", + "bottomEdgeAnchor": 0, + "leftEdgeAnchor": 4, + "relativeToOriginalWindowSize": true, + "rightEdgeAnchor": 0, + "topEdgeAnchor": 4, + "useLegacyBottomAndRightAnchors": false + }, + { + "name": "Tween", + "type": "Tween::TweenBehavior" + } + ], + "string": "Rotate screen to play", + "font": "", + "textAlignment": "center", + "characterSize": 30, + "color": { + "b": 255, + "g": 255, + "r": 255 + }, + "content": { + "bold": true, + "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": "Rotate screen to play", + "font": "", + "textAlignment": "center", + "verticalTextAlignment": "top", + "characterSize": 30, + "lineHeight": 0, + "color": "255;255;255" + } + }, + { + "assetStoreId": "", + "name": "BackgroundPainter", + "type": "PrimitiveDrawing::Drawer", + "variables": [], + "effects": [], + "behaviors": [], + "fillOpacity": 255, + "outlineSize": 0, + "outlineOpacity": 255, + "absoluteCoordinates": true, + "clearBetweenFrames": true, + "antialiasing": "none", + "fillColor": { + "r": 0, + "g": 0, + "b": 0 + }, + "outlineColor": { + "r": 0, + "g": 0, + "b": 0 + } + }, + { + "adaptCollisionMaskAutomatically": true, + "assetStoreId": "", + "name": "Icon", + "type": "Sprite", + "updateIfNotVisible": false, + "variables": [], + "effects": [], + "behaviors": [ + { + "name": "Anchor", + "type": "AnchorBehavior::AnchorBehavior", + "bottomEdgeAnchor": 0, + "leftEdgeAnchor": 4, + "topEdgeAnchor": 4, + "relativeToOriginalWindowSize": true, + "rightEdgeAnchor": 0, + "useLegacyBottomAndRightAnchors": false + }, + { + "name": "Tween", + "type": "Tween::TweenBehavior" + } + ], + "animations": [ + { + "name": "", + "useMultipleDirections": false, + "directions": [ + { + "looping": false, + "timeBetweenFrames": 0.08, + "sprites": [ + { + "hasCustomCollisionMask": true, + "image": "rotate-screen-icon.png", + "points": [], + "originPoint": { + "name": "origine", + "x": 52.5, + "y": 56.5 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [ + [ + { + "x": 0, + "y": 1 + }, + { + "x": 105, + "y": 1 + }, + { + "x": 105, + "y": 113 + }, + { + "x": 0, + "y": 113 + } + ] + ] + } + ] + } + ] + } + ] + } + ], + "objectsFolderStructure": { + "folderName": "__ROOT", + "children": [ + { + "objectName": "Text" + }, + { + "objectName": "BackgroundPainter" + }, + { + "objectName": "Icon" + } + ] + }, + "objectsGroups": [], + "layers": [ + { + "ambientLightColorB": 200, + "ambientLightColorG": 200, + "ambientLightColorR": 200, + "camera3DFarPlaneDistance": 10000, + "camera3DFieldOfView": 45, + "camera3DNearPlaneDistance": 3, + "cameraType": "", + "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": [] + } + ], + "instances": [ + { + "angle": 0, + "customSize": true, + "depth": 1, + "height": 35, + "keepRatio": true, + "layer": "", + "name": "Text", + "persistentUuid": "65c003ea-19c0-4f18-a189-a02a24378f35", + "width": 207, + "x": 104, + "y": 120, + "zOrder": 15, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "keepRatio": true, + "layer": "", + "name": "BackgroundPainter", + "persistentUuid": "49ff4576-6406-41de-a43b-1355529d61fe", + "width": 0, + "x": 38, + "y": 17, + "zOrder": 14, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "keepRatio": true, + "layer": "", + "name": "Icon", + "persistentUuid": "39cbfc66-13f4-43dc-b6ef-2bda83153277", + "width": 0, + "x": 204, + "y": 64, + "zOrder": 16, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + } + ] + } + ] } ] }, @@ -12522,6 +12992,7 @@ "extraInformation": [ "Scene3D::Base3DBehavior" ], + "choices": [], "name": "Object3D" }, { @@ -12531,6 +13002,7 @@ "extraInformation": [ "ScalableCapability::ScalableBehavior" ], + "choices": [], "name": "Scale" }, { @@ -12540,6 +13012,7 @@ "extraInformation": [ "Tween::TweenBehavior" ], + "choices": [], "name": "Tween" } ], @@ -13879,9 +14352,15 @@ "value": "Z+", "type": "Choice", "label": "Top orientation", - "extraInformation": [ - "Z+", - "Y-" + "choices": [ + { + "label": "Z+", + "value": "Z+" + }, + { + "label": "Y-", + "value": "Y-" + } ], "name": "Top" }, @@ -13892,6 +14371,7 @@ "extraInformation": [ "Tween3D::Tween3D" ], + "choices": [], "name": "Tween3D" } ], @@ -13911,7 +14391,7 @@ "name": "Sticker", "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/sticker-outline.svg", "shortDescription": "Make objects follow the position and rotation of the object they are stuck to.", - "version": "0.5.3", + "version": "0.5.4", "description": [ "This extension can be useful to:", "- Stick accessories to moving objects", @@ -13967,8 +14447,10 @@ " 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()) {", @@ -14311,7 +14793,9 @@ " allStickers: new Set(),", "};", "// Register this object as a sticker.", - "runtimeScene._stickerExtension.allStickers.add(behavior);", + "/** @type {Set} */", + "const allStickers = runtimeScene._stickerExtension.allStickers;", + "allStickers.add(behavior);", "" ], "parameterObjects": "Object", @@ -14499,7 +14983,9 @@ "const object = objects[0];", "const behavior = object.getBehavior(behaviorName);", "", - "runtimeScene._stickerExtension.allStickers.delete(behavior._sticker);", + "/** @type {Set} */", + "const allStickers = runtimeScene._stickerExtension.allStickers;", + "allStickers.delete(behavior);", "" ], "parameterObjects": "Object", @@ -17287,6 +17773,7 @@ "extraInformation": [ "Scene3D::Base3DBehavior" ], + "choices": [], "name": "Object3D" }, { @@ -21034,7 +21521,7 @@ "name": "PanelSpriteSlider", "previewIconUrl": "https://asset-resources.gdevelop.io/public-resources/Icons/Line Hero Pack/Master/SVG/UI Essentials/1678c39a3b2bd3df4f82a8a293770db4986a6bcfd3f78e738ddfc86e39176423_UI Essentials_sliders_options.svg", "shortDescription": "A draggable slider that users can move to select a numerical value.", - "version": "2.0.0", + "version": "2.0.1", "description": [ "A draggable slider that users can move to select a numerical value. The slider can be customized with sprites.", "", @@ -21063,7 +21550,30 @@ "dependencies": [], "globalVariables": [], "sceneVariables": [], - "eventsFunctions": [], + "eventsFunctions": [ + { + "description": "Check if the events are running for the editor.", + "fullName": "Editor is running", + "functionType": "Condition", + "name": "IsInGameEdition", + "private": true, + "sentence": "Events are running for the editor", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const game = runtimeScene.getGame();\r", + "eventsFunctionContext.returnValue = game.isInGameEdition && game.isInGameEdition();" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [], + "objectGroups": [] + } + ], "eventsBasedBehaviors": [ { "description": "Represent a value on a slider.", @@ -21548,59 +22058,27 @@ "sentence": "", "events": [ { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Finite state machine", - "source": "", - "type": "BuiltinCommonInstructions::Group", - "events": [ + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 + "type": { + "inverted": true, + "value": "PanelSpriteSlider::IsInGameEdition" }, - "comment": "The \"Validated\" state only last one frame." - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "State", - "=", - "\"Validated\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetStringVariable" - }, - "parameters": [ - "State", - "=", - "\"Idle\"" - ] - } + "parameters": [ + "", + "" ] - }, + } + ], + "actions": [], + "events": [ { "colorB": 228, "colorG": 176, "colorR": 74, "creationTime": 0, - "name": "Check position", + "name": "Finite state machine", "source": "", "type": "BuiltinCommonInstructions::Group", "events": [ @@ -21614,301 +22092,11 @@ "textG": 0, "textR": 0 }, - "comment": "Make sure the cursor position is only checked once per frame." - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "MouseIsInside", - "False", - "" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "ShouldCheckHovering", - "True", - "" - ] - }, - { - "type": { - "value": "CollisionPoint" - }, - "parameters": [ - "Object", - "MouseOnlyCursorX(Object.Layer(), 0)", - "MouseOnlyCursorY(Object.Layer(), 0)" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "MouseIsInside", - "True", - "" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 - }, - "comment": "Touches are always pressed, so ShouldCheckHovering doesn't matter." - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "TouchIsInside", - "False", - "" - ] - } - ] + "comment": "The \"Validated\" state only last one frame." }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ - { - "type": { - "value": "NumberVariable" - }, - "parameters": [ - "TouchId", - "!=", - "0" - ] - }, - { - "type": { - "value": "CollisionPoint" - }, - "parameters": [ - "Object", - "TouchX(TouchId, Object.Layer(), 0)", - "TouchY(TouchId, Object.Layer(), 0)" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "TouchIsInside", - "True", - "" - ] - } - ] - } - ], - "parameters": [] - }, - { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Handle touch start", - "source": "", - "type": "BuiltinCommonInstructions::Group", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "HasAnyTouchOrMouseStarted" - }, - "parameters": [ - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "Index", - "=", - "0" - ] - } - ], - "events": [ - { - "type": "BuiltinCommonInstructions::Repeat", - "repeatExpression": "StartedTouchOrMouseCount()", - "conditions": [], - "actions": [], - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "CollisionPoint" - }, - "parameters": [ - "Object", - "TouchX(StartedTouchOrMouseId(Index), Object.Layer(), 0)", - "TouchY(StartedTouchOrMouseId(Index), Object.Layer(), 0)" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "StartedTouchOrMouseId(Index)" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "TouchIsInside", - "True", - "" - ] - } - ], - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::Or" - }, - "parameters": [], - "subInstructions": [ - { - "type": { - "value": "PanelSpriteSlider::ButtonFSM::PropertyState" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "\"Hovered\"" - ] - }, - { - "type": { - "value": "PanelSpriteSlider::ButtonFSM::PropertyState" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "\"Idle\"" - ] - } - ] - } - ], - "actions": [ - { - "type": { - "value": "SetStringVariable" - }, - "parameters": [ - "State", - "=", - "\"PressedInside\"" - ] - } - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "Index", - "+", - "1" - ] - } - ] - } - ] - } - ] - } - ], - "parameters": [] - }, - { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Apply position changes", - "source": "", - "type": "BuiltinCommonInstructions::Group", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "inverted": true, - "value": "BooleanVariable" - }, - "parameters": [ - "MouseIsInside", - "True", - "" - ] - }, { "type": { "value": "StringVariable" @@ -21916,7 +22104,7 @@ "parameters": [ "State", "=", - "\"Hovered\"" + "\"Validated\"" ] } ], @@ -21934,158 +22122,356 @@ ] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Check position", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ { - "type": { - "value": "BooleanVariable" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 }, - "parameters": [ - "MouseIsInside", - "True", - "" - ] + "comment": "Make sure the cursor position is only checked once per frame." }, { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "State", - "=", - "\"Idle\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetStringVariable" - }, - "parameters": [ - "State", - "=", - "\"Hovered\"" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "inverted": true, - "value": "BooleanVariable" - }, - "parameters": [ - "TouchIsInside", - "True", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "MouseIsInside", + "False", + "" + ] + } ] }, { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "State", - "=", - "\"PressedInside\"" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "ShouldCheckHovering", + "True", + "" + ] + }, + { + "type": { + "value": "CollisionPoint" + }, + "parameters": [ + "Object", + "MouseOnlyCursorX(Object.Layer(), 0)", + "MouseOnlyCursorY(Object.Layer(), 0)" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "MouseIsInside", + "True", + "" + ] + } ] - } - ], - "actions": [ + }, { - "type": { - "value": "SetStringVariable" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 }, - "parameters": [ - "State", - "=", - "\"PressedOutside\"" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "comment": "Touches are always pressed, so ShouldCheckHovering doesn't matter." + }, { - "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "TouchIsInside", - "True", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "TouchIsInside", + "False", + "" + ] + } ] }, { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "State", - "=", - "\"PressedOutside\"" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "!=", + "0" + ] + }, + { + "type": { + "value": "CollisionPoint" + }, + "parameters": [ + "Object", + "TouchX(TouchId, Object.Layer(), 0)", + "TouchY(TouchId, Object.Layer(), 0)" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "TouchIsInside", + "True", + "" + ] + } ] } ], - "actions": [ - { - "type": { - "value": "SetStringVariable" - }, - "parameters": [ - "State", - "=", - "\"PressedInside\"" - ] - } - ] - } - ], - "parameters": [] - }, - { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Handle touch end", - "source": "", - "type": "BuiltinCommonInstructions::Group", - "events": [ + "parameters": [] + }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Handle touch start", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ { - "type": { - "value": "HasTouchEnded" - }, - "parameters": [ - "", - "TouchId" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "HasAnyTouchOrMouseStarted" + }, + "parameters": [ + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "Index", + "=", + "0" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "StartedTouchOrMouseCount()", + "conditions": [], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "CollisionPoint" + }, + "parameters": [ + "Object", + "TouchX(StartedTouchOrMouseId(Index), Object.Layer(), 0)", + "TouchY(StartedTouchOrMouseId(Index), Object.Layer(), 0)" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "StartedTouchOrMouseId(Index)" + ] + }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "TouchIsInside", + "True", + "" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::Or" + }, + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "PanelSpriteSlider::ButtonFSM::PropertyState" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "\"Hovered\"" + ] + }, + { + "type": { + "value": "PanelSpriteSlider::ButtonFSM::PropertyState" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "\"Idle\"" + ] + } + ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "State", + "=", + "\"PressedInside\"" + ] + } + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "Index", + "+", + "1" + ] + } + ] + } + ] + } ] } ], - "actions": [ + "parameters": [] + }, + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Apply position changes", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "0" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "BooleanVariable" + }, + "parameters": [ + "MouseIsInside", + "True", + "" + ] + }, + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "State", + "=", + "\"Hovered\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "State", + "=", + "\"Idle\"" + ] + } ] - } - ], - "events": [ + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "MouseIsInside", + "True", + "" + ] + }, { "type": { "value": "StringVariable" @@ -22093,7 +22479,7 @@ "parameters": [ "State", "=", - "\"PressedInside\"" + "\"Idle\"" ] } ], @@ -22105,7 +22491,7 @@ "parameters": [ "State", "=", - "\"Validated\"" + "\"Hovered\"" ] } ] @@ -22116,6 +22502,16 @@ { "type": { "inverted": true, + "value": "BooleanVariable" + }, + "parameters": [ + "TouchIsInside", + "True", + "" + ] + }, + { + "type": { "value": "StringVariable" }, "parameters": [ @@ -22123,16 +22519,42 @@ "=", "\"PressedInside\"" ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "State", + "=", + "\"PressedOutside\"" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "TouchIsInside", + "True", + "" + ] }, { "type": { - "inverted": true, "value": "StringVariable" }, "parameters": [ "State", "=", - "\"Validated\"" + "\"PressedOutside\"" ] } ], @@ -22144,18 +22566,124 @@ "parameters": [ "State", "=", - "\"Idle\"" + "\"PressedInside\"" ] } ] } - ] + ], + "parameters": [] + }, + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Handle touch end", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "HasTouchEnded" + }, + "parameters": [ + "", + "TouchId" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "0" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "State", + "=", + "\"PressedInside\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "State", + "=", + "\"Validated\"" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "StringVariable" + }, + "parameters": [ + "State", + "=", + "\"PressedInside\"" + ] + }, + { + "type": { + "inverted": true, + "value": "StringVariable" + }, + "parameters": [ + "State", + "=", + "\"Validated\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "State", + "=", + "\"Idle\"" + ] + } + ] + } + ] + } + ], + "parameters": [] } ], "parameters": [] } - ], - "parameters": [] + ] } ], "parameters": [ @@ -22588,18 +23116,33 @@ "value": "Idle", "type": "Choice", "label": "State", - "extraInformation": [ - "Idle", - "Hovered", - "PressedInside", - "PressedOutside", - "Validated" - ], - "hidden": true, - "name": "State" - }, - { - "value": "0", + "choices": [ + { + "label": "Idle", + "value": "Idle" + }, + { + "label": "Hovered", + "value": "Hovered" + }, + { + "label": "PressedInside", + "value": "PressedInside" + }, + { + "label": "PressedOutside", + "value": "PressedOutside" + }, + { + "label": "Validated", + "value": "Validated" + } + ], + "hidden": true, + "name": "State" + }, + { + "value": "0", "type": "Number", "label": "Touch id", "hidden": true, @@ -22684,6 +23227,7 @@ "textAlignment": "", "verticalTextAlignment": "top", "characterSize": 20, + "lineHeight": 0, "color": "0;0;0" } }, @@ -22897,6 +23441,32 @@ "name": "onCreated", "sentence": "", "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "PanelSpriteSlider::IsInGameEdition" + }, + "parameters": [ + "", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "ActivateBehavior" + }, + "parameters": [ + "Thumb", + "Draggable", + "" + ] + } + ] + }, { "type": "BuiltinCommonInstructions::Comment", "color": { @@ -23253,95 +23823,228 @@ ] }, { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Handle touches", - "source": "", - "type": "BuiltinCommonInstructions::Group", + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "PanelSpriteSlider::IsInGameEdition" + }, + "parameters": [ + "", + "" + ] + } + ], + "actions": [], "events": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BehaviorActivated" - }, - "parameters": [ - "Background", - "ButtonFSM" - ] - } - ], - "actions": [], + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Handle touches", + "source": "", + "type": "BuiltinCommonInstructions::Group", "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "inverted": true, - "value": "DraggableBehavior::Dragged" + "value": "BehaviorActivated" }, "parameters": [ - "Thumb", - "Draggable" + "Background", + "ButtonFSM" ] - }, + } + ], + "actions": [], + "events": [ { - "type": { - "inverted": true, - "value": "DraggableBehavior::Dropped" - }, - "parameters": [ - "Thumb", - "Draggable" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "DraggableBehavior::Dragged" + }, + "parameters": [ + "Thumb", + "Draggable" + ] + }, + { + "type": { + "inverted": true, + "value": "DraggableBehavior::Dropped" + }, + "parameters": [ + "Thumb", + "Draggable" + ] + }, + { + "type": { + "value": "BuiltinCommonInstructions::Or" + }, + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "PanelSpriteSlider::ButtonFSM::IsPressed" + }, + "parameters": [ + "Background", + "ButtonFSM", + "" + ] + }, + { + "type": { + "value": "PanelSpriteSlider::ButtonFSM::IsPressedOutside" + }, + "parameters": [ + "Background", + "ButtonFSM", + "" + ] + } + ] + } + ], + "actions": [ + { + "type": { + "value": "PanelSpriteSlider::PanelSpriteSlider::SetValue" + }, + "parameters": [ + "Object", + "=", + "FillBar.Slider::MinValue() + FillBar.Slider::Size() * (TouchX(Background.ButtonFSM::TouchId(), Object.Layer()) - FillBar.X()) / Object.FullBarWidth()", + "FillBar.Slider::MinValue() + FillBar.Slider::Size() * (MouseX() - Object.FullBarLeft()) / Object.FullBarWidth()" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "ShowLabelAtChanges", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "Montre" + }, + "parameters": [ + "Label", + "" + ] + }, + { + "type": { + "value": "ResetObjectTimer" + }, + "parameters": [ + "Label", + "\"HideBack\"" + ] + } + ] + } ] }, { - "type": { - "value": "BuiltinCommonInstructions::Or" - }, - "parameters": [], - "subInstructions": [ + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { "type": { - "value": "PanelSpriteSlider::ButtonFSM::IsPressed" + "value": "DraggableBehavior::Dragged" }, "parameters": [ - "Background", - "ButtonFSM", - "" + "Thumb", + "Draggable" ] - }, + } + ], + "actions": [ { "type": { - "value": "PanelSpriteSlider::ButtonFSM::IsPressedOutside" + "value": "PanelSpriteSlider::PanelSpriteSlider::SetValue" }, "parameters": [ - "Background", - "ButtonFSM", - "" + "Object", + "=", + "FillBar.Slider::MinValue() + FillBar.Slider::Size() * (Thumb.CenterX() - FillBar.X()) / Object.FullBarWidth()", + "FillBar.Slider::MinValue() + FillBar.Slider::Size() * (Thumb.CenterX() - Object.FullBarLeft()) / Object.FullBarWidth()" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "ShowLabelAtChanges", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "Montre" + }, + "parameters": [ + "Label", + "" + ] + } ] } ] - } - ], - "actions": [ + }, { - "type": { - "value": "PanelSpriteSlider::PanelSpriteSlider::SetValue" - }, - "parameters": [ - "Object", - "=", - "FillBar.Slider::MinValue() + FillBar.Slider::Size() * (TouchX(Background.ButtonFSM::TouchId(), Object.Layer()) - FillBar.X()) / Object.FullBarWidth()", - "FillBar.Slider::MinValue() + FillBar.Slider::Size() * (MouseX() - Object.FullBarLeft()) / Object.FullBarWidth()" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "DraggableBehavior::Dropped" + }, + "parameters": [ + "Thumb", + "Draggable" + ] + } + ], + "actions": [ + { + "type": { + "value": "ResetObjectTimer" + }, + "parameters": [ + "Label", + "\"HideBack\"" + ] + } ] - } - ], - "events": [ + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ @@ -23354,6 +24057,16 @@ "True", "" ] + }, + { + "type": { + "value": "CollisionPoint" + }, + "parameters": [ + "Thumb", + "MouseOnlyCursorX(Object.Layer(), 0)", + "MouseOnlyCursorY(Thumb.Layer(), 0)" + ] } ], "actions": [ @@ -23376,173 +24089,48 @@ ] } ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "DraggableBehavior::Dragged" - }, - "parameters": [ - "Thumb", - "Draggable" - ] - } - ], - "actions": [ - { - "type": { - "value": "PanelSpriteSlider::PanelSpriteSlider::SetValue" - }, - "parameters": [ - "Object", - "=", - "FillBar.Slider::MinValue() + FillBar.Slider::Size() * (Thumb.CenterX() - FillBar.X()) / Object.FullBarWidth()", - "FillBar.Slider::MinValue() + FillBar.Slider::Size() * (Thumb.CenterX() - Object.FullBarLeft()) / Object.FullBarWidth()" - ] - } - ], - "events": [ + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "value": "BooleanVariable" + "value": "CompareObjectTimer" }, "parameters": [ - "ShowLabelAtChanges", - "True", - "" + "Label", + "\"HideBack\"", + ">", + "0.5" ] } ], "actions": [ { "type": { - "value": "Montre" + "value": "Cache" + }, + "parameters": [ + "Label" + ] + }, + { + "type": { + "value": "RemoveObjectTimer" }, "parameters": [ "Label", - "" + "\"HideBack\"" ] } ] } ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "DraggableBehavior::Dropped" - }, - "parameters": [ - "Thumb", - "Draggable" - ] - } - ], - "actions": [ - { - "type": { - "value": "ResetObjectTimer" - }, - "parameters": [ - "Label", - "\"HideBack\"" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "ShowLabelAtChanges", - "True", - "" - ] - }, - { - "type": { - "value": "CollisionPoint" - }, - "parameters": [ - "Thumb", - "MouseOnlyCursorX(Object.Layer(), 0)", - "MouseOnlyCursorY(Thumb.Layer(), 0)" - ] - } - ], - "actions": [ - { - "type": { - "value": "Montre" - }, - "parameters": [ - "Label", - "" - ] - }, - { - "type": { - "value": "ResetObjectTimer" - }, - "parameters": [ - "Label", - "\"HideBack\"" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "CompareObjectTimer" - }, - "parameters": [ - "Label", - "\"HideBack\"", - ">", - "0.5" - ] - } - ], - "actions": [ - { - "type": { - "value": "Cache" - }, - "parameters": [ - "Label" - ] - }, - { - "type": { - "value": "RemoveObjectTimer" - }, - "parameters": [ - "Label", - "\"HideBack\"" - ] - } - ] } - ] + ], + "parameters": [] } - ], - "parameters": [] + ] } ], "parameters": [ @@ -24497,6 +25085,7 @@ "Label", "FillBar" ], + "choices": [], "hidden": true, "name": "BarLeftPadding" }, @@ -24509,6 +25098,7 @@ "Label", "FillBar" ], + "choices": [], "hidden": true, "name": "BarTopPadding" }, @@ -24521,6 +25111,7 @@ "Label", "FillBar" ], + "choices": [], "hidden": true, "name": "BarRightPadding" }, @@ -24533,6 +25124,7 @@ "Label", "FillBar" ], + "choices": [], "hidden": true, "name": "BarBottomPadding" }, @@ -24599,6 +25191,7 @@ "extraInformation": [ "Thumb" ], + "choices": [], "hidden": true, "name": "ThumbAnchorOrigin" }, @@ -24610,6 +25203,7 @@ "extraInformation": [ "FillBar" ], + "choices": [], "hidden": true, "name": "ThumbAnchorTarget" }, @@ -24621,6 +25215,7 @@ "extraInformation": [ "Label" ], + "choices": [], "hidden": true, "name": "ShowLabel" }, @@ -24695,6 +25290,7 @@ "textAlignment": "", "verticalTextAlignment": "top", "characterSize": 16, + "lineHeight": 0, "color": "221;221;221" } }, @@ -24953,6 +25549,7 @@ "textAlignment": "", "verticalTextAlignment": "top", "characterSize": 16, + "lineHeight": 0, "color": "221;221;221" } }, @@ -25176,9 +25773,9 @@ "name": "PanelSpriteButton", "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/Line Hero Pack/Master/SVG/Interface Elements/Interface Elements_interface_ui_button_ok_cta_clock_tap.svg", "shortDescription": "A button that can be customized.", - "version": "2.0.0", + "version": "2.1.1", "description": [ - "The button can be customized with a background for each state and a label. It handles user interactions and a simple condition can be used to check if it is clicked.", + "A button that can be used for menus and most labelled buttons of a game. The button can be customized with a background for each state and a label. It handles user interactions and a simple condition can be used to check if it is clicked.", "", "There are ready-to-use buttons in the asset-store [menu buttons pack](https://editor.gdevelop.io/?initial-dialog=asset-store&asset-pack=menu-buttons-menu-buttons)." ], @@ -25202,7 +25799,30 @@ "dependencies": [], "globalVariables": [], "sceneVariables": [], - "eventsFunctions": [], + "eventsFunctions": [ + { + "description": "Check if the events are running for the editor.", + "fullName": "Editor is running", + "functionType": "Condition", + "name": "IsInGameEdition", + "private": true, + "sentence": "Events are running for the editor", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const game = runtimeScene.getGame();\r", + "eventsFunctionContext.returnValue = game.isInGameEdition && game.isInGameEdition();" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [], + "objectGroups": [] + } + ], "eventsBasedBehaviors": [ { "description": "The finite state machine used internally by the button object.", @@ -25218,59 +25838,27 @@ "sentence": "", "events": [ { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Finite state machine", - "source": "", - "type": "BuiltinCommonInstructions::Group", - "events": [ + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 + "type": { + "inverted": true, + "value": "PanelSpriteButton::IsInGameEdition" }, - "comment": "The \"Validated\" state only last one frame." - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "State", - "=", - "\"Validated\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetStringVariable" - }, - "parameters": [ - "State", - "=", - "\"Idle\"" - ] - } + "parameters": [ + "", + "" ] - }, + } + ], + "actions": [], + "events": [ { "colorB": 228, "colorG": 176, "colorR": 74, "creationTime": 0, - "name": "Check position", + "name": "Finite state machine", "source": "", "type": "BuiltinCommonInstructions::Group", "events": [ @@ -25284,478 +25872,386 @@ "textG": 0, "textR": 0 }, - "comment": "Make sure the cursor position is only checked once per frame." - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "MouseIsInside", - "False", - "" - ] - } - ] + "comment": "The \"Validated\" state only last one frame." }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "ShouldCheckHovering", - "True", - "" - ] - }, - { - "type": { - "value": "CollisionPoint" + "value": "StringVariable" }, "parameters": [ - "Object", - "MouseOnlyCursorX(Object.Layer(), 0)", - "MouseOnlyCursorY(Object.Layer(), 0)" + "State", + "=", + "\"Validated\"" ] } ], "actions": [ { "type": { - "value": "SetBooleanVariable" + "value": "SetStringVariable" }, "parameters": [ - "MouseIsInside", - "True", - "" + "State", + "=", + "\"Idle\"" ] } ] }, { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 - }, - "comment": "Touches are always pressed, so ShouldCheckHovering doesn't matter." - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Check position", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ { - "type": { - "value": "SetBooleanVariable" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 }, - "parameters": [ - "TouchIsInside", - "False", - "" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "comment": "Make sure the cursor position is only checked once per frame." + }, { - "type": { - "value": "NumberVariable" - }, - "parameters": [ - "TouchId", - "!=", - "0" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "MouseIsInside", + "False", + "" + ] + } ] }, { - "type": { - "value": "CollisionPoint" - }, - "parameters": [ - "Object", - "TouchX(TouchId, Object.Layer(), 0)", - "TouchY(TouchId, Object.Layer(), 0)" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "ShouldCheckHovering", + "True", + "" + ] + }, + { + "type": { + "value": "CollisionPoint" + }, + "parameters": [ + "Object", + "MouseOnlyCursorX(Object.Layer(), 0)", + "MouseOnlyCursorY(Object.Layer(), 0)" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "MouseIsInside", + "True", + "" + ] + } ] - } - ], - "actions": [ + }, { - "type": { - "value": "SetBooleanVariable" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 }, - "parameters": [ - "TouchIsInside", - "True", - "" - ] - } - ] - } - ], - "parameters": [] - }, - { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Handle touch start", - "source": "", - "type": "BuiltinCommonInstructions::Group", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "comment": "Touches are always pressed, so ShouldCheckHovering doesn't matter." + }, { - "type": { - "value": "HasAnyTouchOrMouseStarted" - }, - "parameters": [ - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "TouchIsInside", + "False", + "" + ] + } ] - } - ], - "actions": [ + }, { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "Index", - "=", - "0" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "!=", + "0" + ] + }, + { + "type": { + "value": "CollisionPoint" + }, + "parameters": [ + "Object", + "TouchX(TouchId, Object.Layer(), 0)", + "TouchY(TouchId, Object.Layer(), 0)" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "TouchIsInside", + "True", + "" + ] + } ] } ], + "parameters": [] + }, + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Handle touch start", + "source": "", + "type": "BuiltinCommonInstructions::Group", "events": [ { - "type": "BuiltinCommonInstructions::Repeat", - "repeatExpression": "StartedTouchOrMouseCount()", - "conditions": [], - "actions": [], + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "HasAnyTouchOrMouseStarted" + }, + "parameters": [ + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "Index", + "=", + "0" + ] + } + ], "events": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "CollisionPoint" - }, - "parameters": [ - "Object", - "TouchX(StartedTouchOrMouseId(Index), Object.Layer(), 0)", - "TouchY(StartedTouchOrMouseId(Index), Object.Layer(), 0)" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "StartedTouchOrMouseId(Index)" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "TouchIsInside", - "True", - "" - ] - } - ], + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "StartedTouchOrMouseCount()", + "conditions": [], + "actions": [], "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "value": "BuiltinCommonInstructions::Or" + "value": "CollisionPoint" }, - "parameters": [], - "subInstructions": [ + "parameters": [ + "Object", + "TouchX(StartedTouchOrMouseId(Index), Object.Layer(), 0)", + "TouchY(StartedTouchOrMouseId(Index), Object.Layer(), 0)" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "StartedTouchOrMouseId(Index)" + ] + }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "TouchIsInside", + "True", + "" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { "type": { - "value": "PanelSpriteButton::ButtonFSM::PropertyState" + "value": "BuiltinCommonInstructions::Or" }, - "parameters": [ - "Object", - "Behavior", - "=", - "\"Hovered\"" + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "PanelSpriteButton::ButtonFSM::PropertyState" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "\"Hovered\"" + ] + }, + { + "type": { + "value": "PanelSpriteButton::ButtonFSM::PropertyState" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "\"Idle\"" + ] + } ] - }, + } + ], + "actions": [ { "type": { - "value": "PanelSpriteButton::ButtonFSM::PropertyState" + "value": "SetStringVariable" }, "parameters": [ - "Object", - "Behavior", + "State", "=", - "\"Idle\"" + "\"PressedInside\"" ] } ] } - ], + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], "actions": [ { "type": { - "value": "SetStringVariable" + "value": "SetNumberVariable" }, "parameters": [ - "State", - "=", - "\"PressedInside\"" + "Index", + "+", + "1" ] } ] } ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "Index", - "+", - "1" - ] - } - ] } ] } - ] - } - ], - "parameters": [] - }, - { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Apply position changes", - "source": "", - "type": "BuiltinCommonInstructions::Group", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "inverted": true, - "value": "BooleanVariable" - }, - "parameters": [ - "MouseIsInside", - "True", - "" - ] - }, - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "State", - "=", - "\"Hovered\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetStringVariable" - }, - "parameters": [ - "State", - "=", - "\"Idle\"" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "MouseIsInside", - "True", - "" - ] - }, - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "State", - "=", - "\"Idle\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetStringVariable" - }, - "parameters": [ - "State", - "=", - "\"Hovered\"" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "inverted": true, - "value": "BooleanVariable" - }, - "parameters": [ - "TouchIsInside", - "True", - "" - ] - }, - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "State", - "=", - "\"PressedInside\"" - ] - } ], - "actions": [ - { - "type": { - "value": "SetStringVariable" - }, - "parameters": [ - "State", - "=", - "\"PressedOutside\"" - ] - } - ] + "parameters": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Apply position changes", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ { - "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "TouchIsInside", - "True", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "BooleanVariable" + }, + "parameters": [ + "MouseIsInside", + "True", + "" + ] + }, + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "State", + "=", + "\"Hovered\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "State", + "=", + "\"Idle\"" + ] + } ] }, - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "State", - "=", - "\"PressedOutside\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetStringVariable" - }, - "parameters": [ - "State", - "=", - "\"PressedInside\"" - ] - } - ] - } - ], - "parameters": [] - }, - { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Handle touch end", - "source": "", - "type": "BuiltinCommonInstructions::Group", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "HasTouchEnded" - }, - "parameters": [ - "", - "TouchId" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "0" - ] - } - ], - "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "MouseIsInside", + "True", + "" + ] + }, { "type": { "value": "StringVariable" @@ -25763,7 +26259,7 @@ "parameters": [ "State", "=", - "\"PressedInside\"" + "\"Idle\"" ] } ], @@ -25775,7 +26271,7 @@ "parameters": [ "State", "=", - "\"Validated\"" + "\"Hovered\"" ] } ] @@ -25786,6 +26282,16 @@ { "type": { "inverted": true, + "value": "BooleanVariable" + }, + "parameters": [ + "TouchIsInside", + "True", + "" + ] + }, + { + "type": { "value": "StringVariable" }, "parameters": [ @@ -25793,16 +26299,42 @@ "=", "\"PressedInside\"" ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "State", + "=", + "\"PressedOutside\"" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "TouchIsInside", + "True", + "" + ] }, { "type": { - "inverted": true, "value": "StringVariable" }, "parameters": [ "State", "=", - "\"Validated\"" + "\"PressedOutside\"" ] } ], @@ -25814,18 +26346,124 @@ "parameters": [ "State", "=", - "\"Idle\"" + "\"PressedInside\"" ] } ] } - ] + ], + "parameters": [] + }, + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Handle touch end", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "HasTouchEnded" + }, + "parameters": [ + "", + "TouchId" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "0" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "State", + "=", + "\"PressedInside\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "State", + "=", + "\"Validated\"" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "StringVariable" + }, + "parameters": [ + "State", + "=", + "\"PressedInside\"" + ] + }, + { + "type": { + "inverted": true, + "value": "StringVariable" + }, + "parameters": [ + "State", + "=", + "\"Validated\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "State", + "=", + "\"Idle\"" + ] + } + ] + } + ] + } + ], + "parameters": [] } ], "parameters": [] } - ], - "parameters": [] + ] } ], "parameters": [ @@ -26298,12 +26936,27 @@ "value": "Idle", "type": "Choice", "label": "State", - "extraInformation": [ - "Idle", - "Hovered", - "PressedInside", - "PressedOutside", - "Validated" + "choices": [ + { + "label": "Idle", + "value": "Idle" + }, + { + "label": "Hovered", + "value": "Hovered" + }, + { + "label": "PressedInside", + "value": "PressedInside" + }, + { + "label": "PressedOutside", + "value": "PressedOutside" + }, + { + "label": "Validated", + "value": "Validated" + } ], "hidden": true, "name": "State" @@ -26405,6 +27058,7 @@ "textAlignment": "center", "verticalTextAlignment": "center", "characterSize": 20, + "lineHeight": 0, "color": "0;0;0" } }, @@ -26504,6 +27158,36 @@ "useLegacyBottomAndRightAnchors": false } ] + }, + { + "assetStoreId": "", + "name": "BitmapLabel", + "type": "BitmapText::BitmapTextObject", + "variables": [], + "effects": [], + "behaviors": [ + { + "name": "Anchor", + "type": "AnchorBehavior::AnchorBehavior", + "bottomEdgeAnchor": 4, + "topEdgeAnchor": 4, + "leftEdgeAnchor": 1, + "relativeToOriginalWindowSize": true, + "rightEdgeAnchor": 2, + "useLegacyBottomAndRightAnchors": false + } + ], + "content": { + "text": "Text", + "opacity": 255, + "scale": 1, + "fontSize": 20, + "tint": "255;255;255", + "bitmapFontResourceName": "", + "textureAtlasResourceName": "", + "align": "center", + "verticalTextAlignment": "center" + } } ], "objectsFolderStructure": { @@ -26512,6 +27196,9 @@ { "objectName": "Label" }, + { + "objectName": "BitmapLabel" + }, { "objectName": "Idle" }, @@ -26537,6 +27224,17 @@ "name": "Pressed" } ] + }, + { + "name": "Labels", + "objects": [ + { + "name": "Label" + }, + { + "name": "BitmapLabel" + } + ] } ], "layers": [ @@ -26713,7 +27411,7 @@ "value": "TextContainerCapability::TextContainerBehavior::SetValue" }, "parameters": [ - "Label", + "Labels", "Text", "=", "LabelText" @@ -26789,7 +27487,7 @@ "value": "TextContainerCapability::TextContainerBehavior::SetValue" }, "parameters": [ - "Label", + "Labels", "Text", "=", "LabelText" @@ -27429,7 +28127,7 @@ "value": "TextContainerCapability::TextContainerBehavior::SetValue" }, "parameters": [ - "Label", + "Labels", "Text", "=", "Value" @@ -27469,7 +28167,7 @@ "value": "TextContainerCapability::TextContainerBehavior::SetValue" }, "parameters": [ - "Label", + "Labels", "Text", "=", "Value" @@ -27504,7 +28202,7 @@ "value": "SetReturnString" }, "parameters": [ - "Label.Text::Value()" + "Labels.Text::Value()" ] } ] @@ -27696,7 +28394,7 @@ "value": "SetCenterY" }, "parameters": [ - "Label", + "Labels", "+", "Value - LabelOffset" ] @@ -27760,8 +28458,15 @@ "value": "", "type": "Choice", "label": "", - "extraInformation": [ - "Label.Text=LabelText" + "choices": [ + { + "label": "Label.Text=LabelText", + "value": "Label.Text=LabelText" + }, + { + "label": "BitmapLabel.Text=LabelText", + "value": "BitmapLabel.Text=LabelText" + } ], "hidden": true, "name": "_PropertyMapping" @@ -27829,6 +28534,7 @@ "textAlignment": "center", "verticalTextAlignment": "center", "characterSize": 40, + "lineHeight": 0, "color": "255;255;255" } }, @@ -33602,6 +34308,7 @@ "textAlignment": "center", "verticalTextAlignment": "center", "characterSize": 20, + "lineHeight": 0, "color": "0;0;0" } }, @@ -35337,6 +36044,7 @@ "extraInformation": [ "Label" ], + "choices": [], "name": "ShowLabel" }, { @@ -35421,6 +36129,7 @@ "textAlignment": "center", "verticalTextAlignment": "center", "characterSize": 14, + "lineHeight": 0, "color": "255;255;255" } }, @@ -35679,6 +36388,7 @@ "textAlignment": "center", "verticalTextAlignment": "center", "characterSize": 14, + "lineHeight": 0, "color": "255;255;255" } }, @@ -36824,13 +37534,13 @@ "name": "SpriteMultitouchJoystick", "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/Line Hero Pack/Master/SVG/Videogames/Videogames_controller_joystick_arrows_direction.svg", "shortDescription": "Joysticks or buttons for touchscreens.", - "version": "1.8.3", + "version": "1.9.0", "description": [ - "Multitouch joysticks can be used the same way as physical gamepads:", + "Multitouch joysticks are objects showing a joystick on the screen, useful for mobile. They work like a physical gamepad:", "- 4 or 8 directions", "- Analogus pads", "- Player selection", - "- Controls mapping for top-down movement and platformer characters", + "- Automatic \"mapper\" behaviors for 2D and 3D movement behaviors (platformer characters, top-down movement, 3D character etc...). Add one of these to the object with the movement behavior (i.e: the player most of the time) and the behavior will then be controlled automatically by the virtual joystick (it works by reading the multitouch joystick state and simulating controls). No need for additional events to make it work once the behaviors are set up.", "", "There are ready-to-use joysticks in the asset-store [multitouch joysticks pack](https://editor.gdevelop.io/?initial-dialog=asset-store&asset-pack=multitouch-joysticks-multitouch-joysticks)." ], @@ -36894,6 +37604,28 @@ } ], "eventsFunctions": [ + { + "description": "Check if the events are running for the editor.", + "fullName": "Editor is running", + "functionType": "Condition", + "name": "IsInGameEdition", + "private": true, + "sentence": "Events are running for the editor", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const game = runtimeScene.getGame();\r", + "eventsFunctionContext.returnValue = game.isInGameEdition && game.isInGameEdition();" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [], + "objectGroups": [] + }, { "fullName": "Accelerated speed", "functionType": "Expression", @@ -37312,11 +38044,11 @@ "objectGroups": [] }, { - "description": "Check if a button is pressed on a gamepad.", - "fullName": "Multitouch controller button pressed", + "description": "Check if a button was just pressed on a multitouch controller.", + "fullName": "Multitouch controller button just pressed", "functionType": "Condition", - "name": "IsButtonPressed", - "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", + "name": "IsButtonJustPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ was just pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -37328,7 +38060,73 @@ "parameters": [ "Controllers[ControllerIdentifier].Buttons[Button].State", "=", - "\"Pressed\"" + "\"JustPressed\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier", + "type": "expression" + }, + { + "description": "Button name", + "name": "Button", + "supplementaryInformation": "[\"A\",\"CROSS\",\"B\",\"CIRCLE\",\"X\",\"SQUARE\",\"Y\",\"TRIANGLE\",\"LB\",\"L1\",\"RB\",\"R1\",\"LT\",\"L2\",\"RT\",\"R2\",\"UP\",\"DOWN\",\"LEFT\",\"RIGHT\",\"BACK\",\"SHARE\",\"START\",\"OPTIONS\",\"CLICK_STICK_LEFT\",\"CLICK_STICK_RIGHT\",\"PS_BUTTON\",\"CLICK_TOUCHPAD\"]", + "type": "string" + } + ], + "objectGroups": [] + }, + { + "description": "Check if a button is pressed on a multitouch controller.", + "fullName": "Multitouch controller button pressed", + "functionType": "Condition", + "name": "IsButtonPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::Or" + }, + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"Pressed\"" + ] + }, + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"JustPressed\"" + ] + } ] } ], @@ -37360,7 +38158,7 @@ "objectGroups": [] }, { - "description": "Check if a button is released on a gamepad.", + "description": "Check if a button is released on a multitouch controller.", "fullName": "Multitouch controller button released", "functionType": "Condition", "name": "IsButtonReleased", @@ -37446,7 +38244,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"JustPressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -38819,41 +39617,23 @@ "conditions": [ { "type": { - "value": "HasGameJustResumed" + "inverted": true, + "value": "SpriteMultitouchJoystick::IsInGameEdition" }, "parameters": [ + "", "" ] } ], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - } - ] - }, - { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Manage touches", - "source": "", - "type": "BuiltinCommonInstructions::Group", + "actions": [], "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "value": "HasAnyTouchOrMouseStarted" + "value": "HasGameJustResumed" }, "parameters": [ "" @@ -38863,171 +39643,207 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" }, "parameters": [ - "TouchIndex", - "=", - "0" + "Object", + "Behavior", + "" ] } - ], + ] + }, + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Manage touches", + "source": "", + "type": "BuiltinCommonInstructions::Group", "events": [ { - "type": "BuiltinCommonInstructions::Repeat", - "repeatExpression": "StartedTouchOrMouseCount()", - "conditions": [], - "actions": [], + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "HasAnyTouchOrMouseStarted" + }, + "parameters": [ + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchIndex", + "=", + "0" + ] + } + ], "events": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "StartedTouchOrMouseCount()", + "conditions": [], + "actions": [], + "events": [ { - "type": { - "value": "NumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "0" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "0" + ] + }, + { + "type": { + "value": "CollisionPoint" + }, + "parameters": [ + "Object", + "TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)", + "TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "StartedTouchOrMouseId(TouchIndex)" + ] + } ] }, { - "type": { - "value": "CollisionPoint" - }, - "parameters": [ - "Object", - "TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)", - "TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "StartedTouchOrMouseId(TouchIndex)" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchIndex", - "+", - "1" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchIndex", + "+", + "1" + ] + } ] } ] } ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 - }, - "comment": "Move thumb back to center when not being pressed (acts like a spring on a real controller)" - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + }, { - "type": { - "value": "HasTouchEnded" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 }, - "parameters": [ - "", - "TouchId" - ] - } - ], - "actions": [ + "comment": "Move thumb back to center when not being pressed (acts like a spring on a real controller)" + }, { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" - }, - "parameters": [ - "Object", - "Behavior", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "HasTouchEnded" + }, + "parameters": [ + "", + "TouchId" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } ] } - ] - } - ], - "parameters": [] - }, - { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Update joystick position", - "source": "", - "type": "BuiltinCommonInstructions::Group", - "events": [ + ], + "parameters": [] + }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Update joystick position", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ { - "type": { - "value": "NumberVariable" - }, - "parameters": [ - "TouchId", - "!=", - "0" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "!=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickAngle" + }, + "parameters": [ + "Object", + "Behavior", + "AngleBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0))", + "AngleBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0))" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "clamp(2 * DistanceBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0)) / Object.Width(), 0, 1)", + "" + ] + } ] } ], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickAngle" - }, - "parameters": [ - "Object", - "Behavior", - "AngleBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0))", - "AngleBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0))" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "clamp(2 * DistanceBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0)) / Object.Width(), 0, 1)", - "" - ] - } - ] + "parameters": [] } - ], - "parameters": [] + ] } ], "parameters": [ @@ -39902,7 +40718,7 @@ "sharedPropertyDescriptors": [] }, { - "description": "Detect button presses made on a touchscreen.", + "description": "Detect presses made on a touchscreen on the object so it acts like a button and automatically trigger the button having the same identifier for the mapper behaviors.", "fullName": "Multitouch button", "name": "MultitouchButton", "objectType": "", @@ -39918,11 +40734,11 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::IsReleased" + "value": "BooleanVariable" }, "parameters": [ - "Object", - "Behavior", + "IsReleased", + "True", "" ] } @@ -39951,6 +40767,44 @@ } ] }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "False", + "" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + }, + "parameters": [ + "Object", + "Behavior", + "\"Pressed\"", + "" + ] + } + ] + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ @@ -40043,7 +40897,17 @@ "parameters": [ "Object", "Behavior", - "\"Pressed\"", + "\"JustPressed\"", + "" + ] + }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "True", "" ] } @@ -40114,6 +40978,16 @@ "" ] }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "False", + "" + ] + }, { "type": { "value": "SetNumberVariable" @@ -40143,7 +41017,103 @@ "objectGroups": [] }, { - "description": "Check if button is released.", + "description": "Check if the button was just pressed.", + "fullName": "Button just pressed", + "functionType": "Condition", + "name": "IsJustPressed", + "sentence": "Button _PARAM0_ was just pressed", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Check if the button is pressed.", + "fullName": "Button pressed", + "functionType": "Condition", + "name": "IsPressed", + "sentence": "Button _PARAM0_ is pressed", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "!=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Check if the button is released.", "fullName": "Button released", "functionType": "Condition", "name": "IsReleased", @@ -40190,54 +41160,6 @@ ], "objectGroups": [] }, - { - "description": "Check if button is pressed.", - "fullName": "Button pressed", - "functionType": "Condition", - "name": "IsPressed", - "sentence": "Button _PARAM0_ is pressed", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "NumberVariable" - }, - "parameters": [ - "TouchId", - "!=", - "0" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", - "type": "behavior" - } - ], - "objectGroups": [] - }, { "fullName": "Button state", "functionType": "Action", @@ -40279,7 +41201,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"JustPressed\",\"Pressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -40320,6 +41242,13 @@ "hidden": true, "name": "IsReleased" }, + { + "value": "", + "type": "Boolean", + "label": "Button just pressed", + "hidden": true, + "name": "IsJustPressed" + }, { "value": "0", "type": "Number", @@ -40517,6 +41446,7 @@ "extraInformation": [ "PlatformBehavior::PlatformerObjectBehavior" ], + "choices": [], "name": "Property" }, { @@ -40530,9 +41460,15 @@ "type": "Choice", "label": "Joystick name", "group": "Controls", - "extraInformation": [ - "Primary", - "Secondary" + "choices": [ + { + "label": "Primary", + "value": "Primary" + }, + { + "label": "Secondary", + "value": "Secondary" + } ], "name": "JoystickIdentifier" }, @@ -40653,6 +41589,7 @@ "extraInformation": [ "Physics3D::PhysicsCharacter3D" ], + "choices": [], "name": "PhysicsCharacter3D" }, { @@ -40666,9 +41603,15 @@ "type": "Choice", "label": "Walk joystick", "group": "Controls", - "extraInformation": [ - "Primary", - "Secondary" + "choices": [ + { + "label": "Primary", + "value": "Primary" + }, + { + "label": "Secondary", + "value": "Secondary" + } ], "name": "JoystickIdentifier" }, @@ -40778,6 +41721,7 @@ "extraInformation": [ "Physics3D::PhysicsCharacter3D" ], + "choices": [], "name": "PhysicsCharacter3D" }, { @@ -40791,9 +41735,15 @@ "type": "Choice", "label": "Walk joystick", "group": "Controls", - "extraInformation": [ - "Primary", - "Secondary" + "choices": [ + { + "label": "Primary", + "value": "Primary" + }, + { + "label": "Secondary", + "value": "Secondary" + } ], "name": "JoystickIdentifier" }, @@ -41736,6 +42686,7 @@ "extraInformation": [ "Scene3D::Base3DBehavior" ], + "choices": [], "name": "Object3D" }, { @@ -41749,9 +42700,15 @@ "type": "Choice", "label": "Camera joystick", "group": "Controls", - "extraInformation": [ - "Primary", - "Secondary" + "choices": [ + { + "label": "Primary", + "value": "Primary" + }, + { + "label": "Secondary", + "value": "Secondary" + } ], "name": "CameraStick" }, @@ -41967,6 +42924,7 @@ "extraInformation": [ "Physics3D::PhysicsCar3D" ], + "choices": [], "name": "PhysicsCar3D" }, { @@ -41980,9 +42938,15 @@ "type": "Choice", "label": "Steer joystick", "group": "Controls", - "extraInformation": [ - "Primary", - "Secondary" + "choices": [ + { + "label": "Primary", + "value": "Primary" + }, + { + "label": "Secondary", + "value": "Secondary" + } ], "name": "SteerJoystickIdentifier" }, @@ -41991,9 +42955,15 @@ "type": "Choice", "label": "Speed joystick", "group": "Controls", - "extraInformation": [ - "Primary", - "Secondary" + "choices": [ + { + "label": "Primary", + "value": "Primary" + }, + { + "label": "Secondary", + "value": "Secondary" + } ], "name": "SpeedJoystickIdentifier" }, @@ -42526,6 +43496,7 @@ "extraInformation": [ "TopDownMovementBehavior::TopDownMovementBehavior" ], + "choices": [], "name": "TopDownMovement" }, { @@ -42538,9 +43509,15 @@ "value": "Primary", "type": "Choice", "label": "Joystick name", - "extraInformation": [ - "Primary", - "Secondary" + "choices": [ + { + "label": "Primary", + "value": "Primary" + }, + { + "label": "Secondary", + "value": "Secondary" + } ], "name": "JoystickIdentifier" }, @@ -42549,10 +43526,19 @@ "type": "Choice", "label": "Stick mode", "group": "Controls", - "extraInformation": [ - "Analog", - "360°", - "8 Directions" + "choices": [ + { + "label": "Analog", + "value": "Analog" + }, + { + "label": "360°", + "value": "360°" + }, + { + "label": "8 Directions", + "value": "8 Directions" + } ], "name": "StickMode" } @@ -42793,74 +43779,92 @@ "name": "doStepPostEvents", "sentence": "", "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "MettreAutour" - }, - "parameters": [ - "Thumb", - "Border", - "Border.MultitouchJoystick::JoystickForce() * Border.Width() / 2", - "Border.MultitouchJoystick::JoystickAngle()" - ] - } - ] - }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ - { - "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "ShouldBeHiddenWhenReleased", - "True", - "" - ] - }, { "type": { "inverted": true, - "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::IsPressed" + "value": "SpriteMultitouchJoystick::IsInGameEdition" }, "parameters": [ - "Object", + "", "" ] } ], - "actions": [ - { - "type": { - "value": "Cache" - }, - "parameters": [ - "Object" - ] - }, + "actions": [], + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::ActivateControl" - }, - "parameters": [ - "Object", - "no", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "MettreAutour" + }, + "parameters": [ + "Thumb", + "Border", + "Border.MultitouchJoystick::JoystickForce() * Border.Width() / 2", + "Border.MultitouchJoystick::JoystickAngle()" + ] + } ] }, { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "ShouldBeHiddenWhenReleased", - "False", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "ShouldBeHiddenWhenReleased", + "True", + "" + ] + }, + { + "type": { + "inverted": true, + "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::IsPressed" + }, + "parameters": [ + "Object", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "Cache" + }, + "parameters": [ + "Object" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::ActivateControl" + }, + "parameters": [ + "Object", + "no", + "" + ] + }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "ShouldBeHiddenWhenReleased", + "False", + "" + ] + } ] } ] @@ -43801,9 +44805,15 @@ "value": "Primary", "type": "Choice", "label": "Joystick name", - "extraInformation": [ - "Primary", - "Secondary" + "choices": [ + { + "label": "Primary", + "value": "Primary" + }, + { + "label": "Secondary", + "value": "Secondary" + } ], "name": "JoystickIdentifier" }, @@ -43822,6 +44832,7 @@ "extraInformation": [ "Thumb" ], + "choices": [], "hidden": true, "name": "ThumbAnchorOrigin" }, @@ -43841,6 +44852,7 @@ "extraInformation": [ "Thumb" ], + "choices": [], "hidden": true, "name": "ThumbIsScaledProportionally" }, @@ -43875,7 +44887,7 @@ "name": "ParticleEmitter3D", "previewIconUrl": "https://asset-resources.gdevelop.io/public-resources/Icons/f2e5a34bf465f781866677762d385d6c8e9e8d203383f2df9a3b7e0fad6a2cb5_fire.svg", "shortDescription": "Display a large number of particles in 3D to create visual effects in a 3D game.", - "version": "2.2.0", + "version": "3.0.1", "description": [ "3D particle emitters let you create and display many small particles to simulate visual effects in your game — like fire, explosions, smoke, or dust.", "", @@ -43900,6 +44912,10 @@ "IWykYNRvhCZBN3vEgKEbBPOR3Oc2" ], "changelog": [ + { + "version": "3.0.0", + "breaking": "- the object rotates the other way around X axis." + }, { "version": "2.0.0", "breaking": "- Object properties for position and rotation have been removed. They must be set with the instance editor or the action." @@ -43943,9 +44959,7 @@ " const threeObject3D = this.get3DRendererObject();", "", " threeObject3D.rotation.set(", - " // TODO The rotation on X goes the wrong way.", - " // Increment the major and remove this sign.", - " - gdjs.toRad(this._object.getRotationX()),", + " gdjs.toRad(this._object.getRotationX()),", " gdjs.toRad(this._object.getRotationY()),", " gdjs.toRad(this._object.angle)", " );", @@ -50859,6 +51873,19 @@ "", "/** @type {gdjs.CustomRuntimeObject} */", "const object = objects[0];", + "// Force the size of the object because it doesn't contain any instance.", + "object._innerArea = {", + " min: [-16, -16, -16],", + " max: [16, 16, 16],", + " };", + "const hitbox = new gdjs.Polygon();", + "hitbox.vertices = [[-16, -16], [16, -16], [16, 16], [-16, 16]];", + "object._untransformedHitBoxes = [hitbox];", + "object._unrotatedAABB.min[0] = -16;", + "object._unrotatedAABB.min[1] = -16;", + "object._unrotatedAABB.max[0] = 16;", + "object._unrotatedAABB.max[1] = 16;", + "object._updateUntransformedHitBoxes = () => {};", "", "// Here runtimeScene is the gdjs.CustomRuntimeObjectInstanceContainer inside the custom object.", "const gameScene = object.getRuntimeScene();", @@ -53769,12 +54796,27 @@ "type": "Choice", "label": "Blending", "group": "Color", - "extraInformation": [ - "Normal", - "Additive", - "Subtractive", - "Multiply", - "None" + "choices": [ + { + "label": "Normal", + "value": "Normal" + }, + { + "label": "Additive", + "value": "Additive" + }, + { + "label": "Subtractive", + "value": "Subtractive" + }, + { + "label": "Multiply", + "value": "Multiply" + }, + { + "label": "None", + "value": "None" + } ], "name": "Blending" }, @@ -53783,9 +54825,15 @@ "type": "Choice", "label": "Gravity top", "group": "Speed", - "extraInformation": [ - "Y-", - "Z+" + "choices": [ + { + "label": "Y-", + "value": "Y-" + }, + { + "label": "Z+", + "value": "Z+" + } ], "name": "GravityTop" }, @@ -58882,6 +59930,7 @@ "extraInformation": [ "PlatformBehavior::PlatformerObjectBehavior" ], + "choices": [], "name": "PlatformerCharacter" }, { @@ -58891,6 +59940,7 @@ "extraInformation": [ "SmoothCamera::SmoothCamera" ], + "choices": [], "name": "SmoothCamera" }, { @@ -61222,7 +62272,7 @@ "name": "RollingCounter", "previewIconUrl": "https://asset-resources.gdevelop.io/public-resources/Icons/e509cccd7fb426978c4a79b639670f624f773a886848d288a12be5c28dd7d380_sort-numeric-variant.svg", "shortDescription": "Smoothly change a counter value in a text object.", - "version": "1.1.1", + "version": "1.2.0", "description": "Smoothly change a counter value in a text object.", "origin": { "identifier": "RollingCounter", @@ -61239,7 +62289,30 @@ "dependencies": [], "globalVariables": [], "sceneVariables": [], - "eventsFunctions": [], + "eventsFunctions": [ + { + "description": "Check if the events are running for the editor.", + "fullName": "Editor is running", + "functionType": "Condition", + "name": "IsInGameEdition", + "private": true, + "sentence": "Events are running for the editor", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const game = runtimeScene.getGame();\r", + "eventsFunctionContext.returnValue = game.isInGameEdition && game.isInGameEdition();" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [], + "objectGroups": [] + } + ], "eventsBasedBehaviors": [ { "description": "Smoothly changes a counter value in a text object.", @@ -61386,9 +62459,9 @@ "value": "SetNumberVariable" }, "parameters": [ - "DisplayedValue", + "CounterValue", "=", - "CounterValue" + "Value" ] }, { @@ -61396,19 +62469,36 @@ "value": "SetNumberVariable" }, "parameters": [ - "CounterValue", + "Speed", "=", - "Value" + "(CounterValue - DisplayedValue) / Duration" ] - }, + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { "type": { - "value": "SetNumberVariable" + "value": "RollingCounter::IsInGameEdition" }, "parameters": [ - "Speed", + "", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "TextContainerCapability::TextContainerBehavior::SetValue" + }, + "parameters": [ + "Object", + "Text", "=", - "(CounterValue - DisplayedValue) / Duration" + "Prefix + ToString(Value) + Suffix" ] } ] @@ -61477,6 +62567,7 @@ "extraInformation": [ "TextContainerCapability::TextContainerBehavior" ], + "choices": [], "name": "Text" }, { diff --git a/examples/3d-shark-frenzy/assets/rotate-screen-icon.png b/examples/3d-shark-frenzy/assets/rotate-screen-icon.png index ba619fae3995e5576c1e1de0a994b5b3da7c39dc..a7726dee34eba34b401b26b73b5bf128ff7c26d7 100644 GIT binary patch delta 1155 zcmV-}1bqAP28{`j8Gi-<007npjm!W5010qNS#tmY3ljhU3ljkVnw%H_00citL_t(| z+U?!pwW2T(1>jc#B~St-Sb`f&sWc6&`9(FdUz!2ufn{)iP zFJiu(WD*ki`Z89$_tpJVezDjscc9w;Dee8UV~f~C+WUWt3x9BoE<;GAA1{n9Lr|{@ zqssu2^Y0f%*G5QJKfU}!SHTucgVg$YrDGSkF3j%!Io&_~OrSGcalK6LxB$k7zpdGt z>qJfWqT$~ihuFO(#CgD+!@nus0J<6ZiS%%a zkf}|^8PsuMdVjrc^u)TVX37}y=+c;8r;DCh5fD}nm|iOaRgvga*5YUmcf7|0vi#q!c*I(ogbVKXj!WbtPaQpC|t;`*$0UbAGITFauxcL)7eRfch zWg0}F+i+Pabb;3_pdyo0RG?zy-(H}hB0n}OAb6=+_+O}R$dcG1qkMjHi6KeFYy6Dy|o2u0uhKn1R@ZD2t*(P z5r{wpA`pR~fxZc3{|6Ds_>YpO0tuvZ9gW&Tt$+AYI|8Y;sne)z_~hZ9Kx)_Xw`h+? zJ%J1&g$m7X_6G$j)%Wj-%@-Yk7GIbCUdYHJ1zG|vy0+mdmtUF{Hz-in=Rx9>OQT)6 zc_@U5>MDEpP@q77iX^98EJC3y^@z=?x3#~_3>4B@oOqJuA;lMN4h06Z-Zo{cP-v^! zqJOLFQh#}JD8$`_k2-!rH1NXcxkeJ4Gh0@-dvY`XKK3?f$MHuG zs2Zfl{nW^dyusRsEy4v`R|hB-0p*)GT?B{GqujlnMkdMC44gj9;TS!Nv;W(ZrF^D3 z0(u;InLTk5rN`0nB&=|BPu2{HlVJA$Y|+*eXZzXz)Y7eTMu_FV^m-1=fl-q_y?(cF z2`6C`U1lOxY{B#?cRjJ&lb3|baOvu2spC}}%ON=ea-z)Z?* zMqugDC_atNmBAsU1(z{AT5-3YssWQGU52g&%X!B2s%Mq_v$$(=XiTc za}skxbf@G~0#nJw!Z{>~f8@5gv!W~3SS=M$839QocMjN)O*LdV9? zCxOu7>e+n%6@fxID5@S*;$Z0FH}9klXisOV_8tv}_R~*oyQATd>iB@{h2UF@UMScf z^n-rT|AlB4WM)D6e-tnrGSO7O2kh{OROJk_T_cC_UAK)$ZJ5INF{(-24+01>)f1p+ z95vCbs~;*Ya@)d8?~6laGW${nb&ANwFb!{XN5?_)8Eql8iwCYn^VL zlW!>ix;j1cC}j1fn;F`qpl#yz4yQpu5aSx+l7b+^xt6-1f3O{PW!7>1_eTdJOURK2$=wV@}4LZLO*%q^QFz=P%!X=ku;#hqe3bKyY{tK Date: Wed, 8 Oct 2025 15:35:25 +0200 Subject: [PATCH 09/12] [3D shooting gallery] Update the extensions --- .../3d-shooting-gallery.json | 8942 +++++++++-------- .../assets/rotate-screen-icon.png | Bin 881 -> 1165 bytes 2 files changed, 4513 insertions(+), 4429 deletions(-) diff --git a/examples/3d-shooting-gallery/3d-shooting-gallery.json b/examples/3d-shooting-gallery/3d-shooting-gallery.json index d9e4e4789..17e40f0f4 100644 --- a/examples/3d-shooting-gallery/3d-shooting-gallery.json +++ b/examples/3d-shooting-gallery/3d-shooting-gallery.json @@ -1,7 +1,7 @@ { "firstLayout": "", "gdVersion": { - "build": 221, + "build": 242, "major": 5, "minor": 5, "revision": 0 @@ -499,7 +499,7 @@ "smoothed": true, "userAdded": false, "origin": { - "identifier": "https://asset-resources.gdevelop.io/public-resources/Mobile Layouts/assets/6a8102ce3340bf9f62300ee1a81ef0b2327b2c6e8d62d7dda68d547f5e2b5969_rotate-screen-icon.png", + "identifier": "https://asset-resources.gdevelop.io/public-resources/Mobile Layouts/6a8102ce3340bf9f62300ee1a81ef0b2327b2c6e8d62d7dda68d547f5e2b5969_rotate-screen-icon.png", "name": "rotate-screen-icon.png" } } @@ -1759,7 +1759,8 @@ "bitmapFontResourceName": "8BitOperatorPlus8Regular_Edited.fnt", "textureAtlasResourceName": "8BitOperatorPlus8Regular_Edited3.png", "align": "left", - "wordWrap": true + "wordWrap": true, + "verticalTextAlignment": "top" } }, { @@ -1778,7 +1779,8 @@ "bitmapFontResourceName": "8BitOperatorPlus8Regular_Edited.fnt", "textureAtlasResourceName": "8BitOperatorPlus8Regular_Edited3.png", "align": "left", - "wordWrap": true + "wordWrap": true, + "verticalTextAlignment": "top" } }, { @@ -1797,7 +1799,8 @@ "bitmapFontResourceName": "8BitOperatorPlus8Regular_Edited.fnt", "textureAtlasResourceName": "8BitOperatorPlus8Regular_Edited3.png", "align": "left", - "wordWrap": true + "wordWrap": true, + "verticalTextAlignment": "top" } }, { @@ -1825,7 +1828,8 @@ "bitmapFontResourceName": "8BitOperatorPlus8Regular_Edited.fnt", "textureAtlasResourceName": "8BitOperatorPlus8Regular_Edited3.png", "align": "left", - "wordWrap": true + "wordWrap": true, + "verticalTextAlignment": "top" } }, { @@ -1853,13 +1857,15 @@ "bitmapFontResourceName": "8BitOperatorPlus8Regular_Edited.fnt", "textureAtlasResourceName": "8BitOperatorPlus8Regular_Edited3.png", "align": "left", - "wordWrap": true + "wordWrap": true, + "verticalTextAlignment": "top" } }, { "assetStoreId": "9be1b0d0d5a1afad4537db989ea5e3a4a4564dfd123630a9bf61330a73803c63", "name": "WalkJoystick", "type": "SpriteMultitouchJoystick::SpriteMultitouchJoystick", + "variant": "", "variables": [], "effects": [], "behaviors": [], @@ -1998,17 +2004,18 @@ "assetStoreId": "e5919fb86a559b00001678c710efe55f4e9f2e032a9ff9610087370f998d57de", "name": "ScreenOrientationChecker", "type": "ScreenOrientationChecker::ScreenOrientationChecker", + "variant": "Black screen orientation checker", "variables": [], "effects": [], "behaviors": [ { + "name": "Anchor", + "type": "AnchorBehavior::AnchorBehavior", "bottomEdgeAnchor": 2, "leftEdgeAnchor": 1, - "name": "Anchor", "relativeToOriginalWindowSize": true, "rightEdgeAnchor": 2, "topEdgeAnchor": 1, - "type": "AnchorBehavior::AnchorBehavior", "useLegacyBottomAndRightAnchors": false } ], @@ -2017,116 +2024,6 @@ "BackgroundColor": "24;24;24", "CornerRadius": 8, "Padding": 5 - }, - "childrenContent": { - "BackgroundPainter": { - "fillOpacity": 255, - "outlineSize": 0, - "outlineOpacity": 255, - "absoluteCoordinates": true, - "clearBetweenFrames": true, - "antialiasing": "none", - "fillColor": { - "r": 0, - "g": 0, - "b": 0 - }, - "outlineColor": { - "r": 0, - "g": 0, - "b": 0 - } - }, - "Icon": { - "adaptCollisionMaskAutomatically": true, - "updateIfNotVisible": false, - "animations": [ - { - "name": "", - "useMultipleDirections": false, - "directions": [ - { - "looping": false, - "timeBetweenFrames": 0.08, - "sprites": [ - { - "hasCustomCollisionMask": true, - "image": "rotate-screen-icon.png", - "points": [], - "originPoint": { - "name": "origine", - "x": 52.5, - "y": 56.5 - }, - "centerPoint": { - "automatic": true, - "name": "centre", - "x": 0, - "y": 0 - }, - "customCollisionMask": [ - [ - { - "x": 0, - "y": 1 - }, - { - "x": 105, - "y": 1 - }, - { - "x": 105, - "y": 113 - }, - { - "x": 0, - "y": 113 - } - ] - ] - } - ] - } - ] - } - ] - }, - "Text": { - "bold": true, - "italic": false, - "smoothed": true, - "underlined": false, - "string": "Rotate screen to play", - "font": "", - "textAlignment": "center", - "characterSize": 30, - "color": { - "b": 255, - "g": 255, - "r": 255 - }, - "content": { - "bold": true, - "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": "Rotate screen to play", - "font": "", - "textAlignment": "center", - "verticalTextAlignment": "top", - "characterSize": 30, - "color": "255;255;255" - } - } } } ], @@ -3537,16 +3434,19 @@ "category": "Camera", "extensionNamespace": "", "fullName": "First person 3D camera", + "gdevelopVersion": ">=5.5.222", "helpPath": "", "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyMy4wLjMsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iSWNvbnMiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB2aWV3Qm94PSIwIDAgMzIgMzIiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDMyIDMyOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8c3R5bGUgdHlwZT0idGV4dC9jc3MiPg0KCS5zdDB7ZmlsbDpub25lO3N0cm9rZTojMDAwMDAwO3N0cm9rZS13aWR0aDoyO3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1saW5lam9pbjpyb3VuZDtzdHJva2UtbWl0ZXJsaW1pdDoxMDt9DQoJLnN0MXtmaWxsOm5vbmU7c3Ryb2tlOiMwMDAwMDA7c3Ryb2tlLXdpZHRoOjI7c3Ryb2tlLWxpbmVqb2luOnJvdW5kO3N0cm9rZS1taXRlcmxpbWl0OjEwO30NCjwvc3R5bGU+DQo8cGF0aCBjbGFzcz0ic3QwIiBkPSJNMjcsMTZjMCwwLTQuOSw3LTExLDdTNSwxNiw1LDE2czQuOS03LDExLTdTMjcsMTYsMjcsMTZ6Ii8+DQo8Y2lyY2xlIGNsYXNzPSJzdDAiIGN4PSIxNiIgY3k9IjE2IiByPSIzIi8+DQo8cG9seWxpbmUgY2xhc3M9InN0MCIgcG9pbnRzPSIzLDkgMywzIDksMyAiLz4NCjxwb2x5bGluZSBjbGFzcz0ic3QwIiBwb2ludHM9IjksMjkgMywyOSAzLDIzICIvPg0KPHBvbHlsaW5lIGNsYXNzPSJzdDAiIHBvaW50cz0iMjksMjMgMjksMjkgMjMsMjkgIi8+DQo8cG9seWxpbmUgY2xhc3M9InN0MCIgcG9pbnRzPSIyMywzIDI5LDMgMjksOSAiLz4NCjwvc3ZnPg0K", "name": "FirstPersonCamera", "previewIconUrl": "https://asset-resources.gdevelop.io/public-resources/Icons/Line Hero Pack/Master/SVG/Security and Protection/e8248ffd504c314e6a9d9d560c3a0fdad3398a5f125ae6a4c0654d4e68c86376_Security and Protection_security_protection_eye_scan_lock.svg", "shortDescription": "Move the camera to look though objects eyes.", - "version": "1.0.2", + "version": "1.0.4", "description": [ "Move the camera to look though objects eyes.", "", - "This extension can be used with the \"Mouse pointer lock\" or \"Gamepad\" extension to build a first person camera." + "This extension can be used with the \"Mouse pointer lock\" or \"Gamepad\" extension to build a first person camera.", + "", + "The first person example uses this extension ([open the project online](https://editor.gdevelop.io/?project=example://3d-first-person))." ], "origin": { "identifier": "FirstPersonCamera", @@ -3558,18 +3458,20 @@ "fps" ], "authorIds": [ - "IWykYNRvhCZBN3vEgKEbBPOR3Oc2" + "IWykYNRvhCZBN3vEgKEbBPOR3Oc2", + "m8kleQHonagHWsvILDhyJhgVhuF2" ], "dependencies": [], "globalVariables": [], "sceneVariables": [], "eventsFunctions": [ { - "description": "Move the camera to look though _PARAM1_ eyes. The object must look to the right when all its angles are 0 and the top of its head be toward Z+.", + "description": "Move the camera to look though the object eyes. The object must look to the right when all its angles are 0 and the top of its head be toward Z+.", "fullName": "Look through object eyes", "functionType": "Action", "group": "Layers and cameras", "name": "LookFromObjectEyes", + "private": true, "sentence": "Move the camera of _PARAM2_ to look though _PARAM1_ eyes", "events": [ { @@ -3600,6 +3502,84 @@ "" ] }, + { + "type": { + "value": "Scene3D::SetCameraRotationX" + }, + "parameters": [ + "", + "=", + "- Object.RotationY() + 90", + "Layer", + "" + ] + }, + { + "type": { + "value": "Scene3D::SetCameraRotationY" + }, + "parameters": [ + "", + "=", + "Object.RotationX()", + "Layer", + "" + ] + }, + { + "type": { + "value": "SetCameraAngle" + }, + "parameters": [ + "", + "=", + "Object.Angle() + 90", + "Layer", + "" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "Scene3D::Cube3DObject", + "type": "objectList" + }, + { + "description": "Layer", + "name": "Layer", + "type": "layer" + } + ], + "objectGroups": [] + }, + { + "description": "Move the camera to look though the object eyes. The object must look to the right when all its angles are 0 and the top of its head be toward Z+.", + "fullName": "Look through object eyes", + "functionType": "Action", + "group": "Layers and cameras", + "name": "LookFrom3DObjectEyes", + "sentence": "Move the camera of _PARAM3_ to look though _PARAM1_ eyes", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "CentreCamera" + }, + "parameters": [ + "", + "Object", + "", + "Layer", + "" + ] + }, { "type": { "value": "Scene3D::SetCameraZ" @@ -3607,7 +3587,7 @@ "parameters": [ "", "=", - "Object.Z()", + "Object.Object3D::Z()", "Layer", "" ] @@ -3619,7 +3599,7 @@ "parameters": [ "", "=", - "- Object.RotationY() + 90", + "- Object.Object3D::RotationY() + 90", "Layer", "" ] @@ -3631,7 +3611,7 @@ "parameters": [ "", "=", - "Object.RotationX()", + "Object.Object3D::RotationX()", "Layer", "" ] @@ -3653,11 +3633,16 @@ ], "parameters": [ { - "description": "Object", + "description": "3D Object", "name": "Object", - "supplementaryInformation": "Scene3D::Cube3DObject", "type": "objectList" }, + { + "description": "3D capability", + "name": "Object3D", + "supplementaryInformation": "Scene3D::Base3DBehavior", + "type": "behavior" + }, { "description": "Layer", "name": "Layer", @@ -3675,12 +3660,13 @@ "category": "Visual effect", "extensionNamespace": "", "fullName": "Shake object", + "gdevelopVersion": ">=5.5.222", "helpPath": "", "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0ibWRpLWFycm93LWFsbCIgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0IiB2aWV3Qm94PSIwIDAgMjQgMjQiPjxwYXRoIGQ9Ik0xMywxMUgxOEwxNi41LDkuNUwxNy45Miw4LjA4TDIxLjg0LDEyTDE3LjkyLDE1LjkyTDE2LjUsMTQuNUwxOCwxM0gxM1YxOEwxNC41LDE2LjVMMTUuOTIsMTcuOTJMMTIsMjEuODRMOC4wOCwxNy45Mkw5LjUsMTYuNUwxMSwxOFYxM0g2TDcuNSwxNC41TDYuMDgsMTUuOTJMMi4xNiwxMkw2LjA4LDguMDhMNy41LDkuNUw2LDExSDExVjZMOS41LDcuNUw4LjA4LDYuMDhMMTIsMi4xNkwxNS45Miw2LjA4TDE0LjUsNy41TDEzLDZWMTFaIiAvPjwvc3ZnPg==", "name": "ShakeObject", "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/arrow-all.svg", "shortDescription": "Shake an object.", - "version": "1.5.7", + "version": "1.6.1", "description": [ "Shake an object (position, angle or scale).", "", @@ -3868,10 +3854,12 @@ "conditions": [ { "type": { - "value": "GetArgumentAsBoolean" + "value": "BooleanVariable" }, "parameters": [ - "\"ShakeForever\"" + "ShakeForever", + "True", + "" ] } ], @@ -5865,10 +5853,12 @@ "conditions": [ { "type": { - "value": "GetArgumentAsBoolean" + "value": "BooleanVariable" }, "parameters": [ - "\"ShakeForever\"" + "ShakeForever", + "True", + "" ] } ], @@ -8073,21 +8063,11 @@ "value": "", "type": "Behavior", "label": "Scalable capability", - "description": "", - "group": "", "extraInformation": [ "ScalableCapability::ScalableBehavior" ], + "choices": [], "name": "Scale" - }, - { - "value": "", - "type": "Number", - "label": "", - "description": "", - "group": "", - "extraInformation": [], - "name": "Property" } ], "sharedPropertyDescriptors": [] @@ -8100,12 +8080,13 @@ "category": "Camera", "extensionNamespace": "", "fullName": "Camera shake", + "gdevelopVersion": ">=5.5.222", "helpPath": "", "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0ibWRpLXZlY3Rvci1kaWZmZXJlbmNlLWFiIiB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCI+PHBhdGggZD0iTTMsMUMxLjg5LDEgMSwxLjg5IDEsM1Y1SDNWM0g1VjFIM003LDFWM0gxMFYxSDdNMTIsMVYzSDE0VjVIMTZWM0MxNiwxLjg5IDE1LjExLDEgMTQsMUgxMk0xLDdWMTBIM1Y3SDFNMTQsN0MxNCw3IDE0LDExLjY3IDE0LDE0QzExLjY3LDE0IDcsMTQgNywxNEM3LDE0IDcsMTggNywyMEM3LDIxLjExIDcuODksMjIgOSwyMkgyMEMyMS4xMSwyMiAyMiwyMS4xMSAyMiwyMFY5QzIyLDcuODkgMjEuMTEsNyAyMCw3QzE4LDcgMTQsNyAxNCw3TTE2LDlIMjBWMjBIOVYxNkgxNEMxNS4xMSwxNiAxNiwxNS4xMSAxNiwxNFY5TTEsMTJWMTRDMSwxNS4xMSAxLjg5LDE2IDMsMTZINVYxNEgzVjEySDFaIiAvPjwvc3ZnPg==", "name": "CameraShake", "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/vector-difference-ab.svg", "shortDescription": "Shake layer cameras.", - "version": "3.1.2", + "version": "3.2.0", "description": [ "Shake layer cameras with translation, rotation and zoom.", "", @@ -9364,7 +9345,7 @@ "parameters": [ "", "", - "Layer", + "NewLayer", "" ] } @@ -9391,7 +9372,7 @@ "parameters": [ "Layer", "=", - "Layer" + "NewLayer" ] }, { @@ -9401,7 +9382,7 @@ "parameters": [ "Duration", "=", - "Duration" + "NewDuration" ] }, { @@ -9421,7 +9402,7 @@ "parameters": [ "StopEaseDuration", "=", - "Duration" + "NewDuration" ] }, { @@ -9539,10 +9520,12 @@ "conditions": [ { "type": { - "value": "GetArgumentAsBoolean" + "value": "BooleanVariable" }, "parameters": [ - "\"ShakeForever\"" + "ShakeForever", + "True", + "" ] } ], @@ -9579,7 +9562,7 @@ "value": "NumberVariable" }, "parameters": [ - "Duration", + "NewDuration", "=", "0" ] @@ -9615,7 +9598,7 @@ }, { "description": "Layer (base layer if empty)", - "name": "Layer", + "name": "NewLayer", "type": "layer" }, { @@ -9625,7 +9608,7 @@ }, { "description": "Duration (in seconds) (Default: 0.5)", - "name": "Duration", + "name": "NewDuration", "type": "expression" }, { @@ -9815,10 +9798,12 @@ { "type": { "inverted": true, - "value": "GetArgumentAsBoolean" + "value": "BooleanVariable" }, "parameters": [ - "\"Shakable\"" + "Shakable", + "True", + "" ] } ], @@ -9840,10 +9825,12 @@ "conditions": [ { "type": { - "value": "GetArgumentAsBoolean" + "value": "BooleanVariable" }, "parameters": [ - "\"Shakable\"" + "Shakable", + "True", + "" ] } ], @@ -11674,12 +11661,13 @@ "category": "Input", "extensionNamespace": "", "fullName": "Mouse Pointer Lock", + "gdevelopVersion": ">=5.5.222", "helpPath": "", "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyMy4wLjMsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iSWNvbnMiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB2aWV3Qm94PSIwIDAgMzIgMzIiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDMyIDMyOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8c3R5bGUgdHlwZT0idGV4dC9jc3MiPg0KCS5zdDB7ZmlsbDpub25lO3N0cm9rZTojMDAwMDAwO3N0cm9rZS13aWR0aDoyO3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1saW5lam9pbjpyb3VuZDtzdHJva2UtbWl0ZXJsaW1pdDoxMDt9DQo8L3N0eWxlPg0KPHBvbHlsaW5lIGNsYXNzPSJzdDAiIHBvaW50cz0iMTksMTkgMjQsMTkgMjQsMjQgIi8+DQo8cG9seWxpbmUgY2xhc3M9InN0MCIgcG9pbnRzPSI2LDIzIDExLDIzIDExLDE4ICIvPg0KPHBhdGggY2xhc3M9InN0MCIgZD0iTTI0LDE5LjRjLTAuNywwLjgtMS40LDEuNi0yLjIsMi40Yy03LDctMTUuMywxMC4yLTE4LjUsN3MtMC4xLTExLjUsNy0xOC41czE1LjMtMTAuMiwxOC41LTcNCgljMS40LDEuNCwxLjYsMy42LDAuOCw2LjMiLz4NCjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik0xMSwyMi41Yy0wLjMtMC4yLTAuNS0wLjUtMC44LTAuOGMtNy03LTEwLjItMTUuMy03LTE4LjVzMTEuNS0wLjEsMTguNSw3czEwLjIsMTUuMyw3LDE4LjUNCgljLTEuNywxLjctNC44LDEuNi04LjQsMC4xIi8+DQo8L3N2Zz4NCg==", "name": "MousePointerLock", "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/Line Hero Pack/Master/SVG/Virtual Reality/Virtual Reality_360_rotate_vr_movement.svg", "shortDescription": "This behavior removes the limit on the distance the mouse can move and hides the cursor.", - "version": "0.2.0", + "version": "0.3.0", "description": [ "This behavior removes the limit on the distance the mouse can move and hides the cursor.", "", @@ -12233,7 +12221,6 @@ "fullName": "Pointer X movement", "functionType": "ExpressionAndCondition", "name": "MovementX", - "private": true, "sentence": "the movement of the locked pointer on the X axis", "events": [ { @@ -12284,7 +12271,6 @@ "fullName": "Pointer Y movement", "functionType": "ExpressionAndCondition", "name": "MovementY", - "private": true, "sentence": "the movement of the pointer on the Y axis", "events": [ { @@ -12547,11 +12533,12 @@ }, { "type": { - "value": "MousePointerLock::FirstPersonPointerMapper::PropertyShouldLock" + "value": "BooleanVariable" }, "parameters": [ - "Object", - "Behavior" + "ShouldLock", + "True", + "" ] }, { @@ -12738,11 +12725,10 @@ "actions": [ { "type": { - "value": "MousePointerLock::FirstPersonPointerMapper::SetPropertyHorizontalSpeed" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "HorizontalSpeed", "=", "Value" ] @@ -12819,11 +12805,10 @@ "actions": [ { "type": { - "value": "MousePointerLock::FirstPersonPointerMapper::SetPropertyVerticalSpeed" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "VerticalSpeed", "=", "Value" ] @@ -12900,11 +12885,10 @@ "actions": [ { "type": { - "value": "MousePointerLock::FirstPersonPointerMapper::SetPropertyVerticalAngleMin" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "VerticalAngleMin", "=", "Value" ] @@ -12981,11 +12965,10 @@ "actions": [ { "type": { - "value": "MousePointerLock::FirstPersonPointerMapper::SetPropertyVerticalAngleMax" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "VerticalAngleMax", "=", "Value" ] @@ -13062,11 +13045,10 @@ "actions": [ { "type": { - "value": "MousePointerLock::FirstPersonPointerMapper::SetPropertyOffsetZ" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "OffsetZ", "=", "Value" ] @@ -13095,11 +13077,10 @@ "value": "", "type": "Behavior", "label": "3D capability", - "description": "", - "group": "", "extraInformation": [ "Scene3D::Base3DBehavior" ], + "choices": [], "name": "Object3D" }, { @@ -13107,9 +13088,6 @@ "type": "Number", "unit": "Dimensionless", "label": "Horizontal rotation speed factor", - "description": "", - "group": "", - "extraInformation": [], "name": "HorizontalSpeed" }, { @@ -13117,9 +13095,6 @@ "type": "Number", "unit": "Dimensionless", "label": "Vertical rotation speed factor", - "description": "", - "group": "", - "extraInformation": [], "name": "VerticalSpeed" }, { @@ -13127,9 +13102,6 @@ "type": "Number", "unit": "DegreeAngle", "label": "Minimum vertical camera angle", - "description": "", - "group": "", - "extraInformation": [], "name": "VerticalAngleMin" }, { @@ -13137,9 +13109,6 @@ "type": "Number", "unit": "DegreeAngle", "label": "Maximum vertical camera angle", - "description": "", - "group": "", - "extraInformation": [], "name": "VerticalAngleMax" }, { @@ -13147,18 +13116,12 @@ "type": "Number", "unit": "Pixel", "label": "Z position offset", - "description": "", - "group": "", - "extraInformation": [], "name": "OffsetZ" }, { "value": "true", "type": "Boolean", "label": "Lock the pointer on click", - "description": "", - "group": "", - "extraInformation": [], "name": "ShouldLock" } ], @@ -13172,18 +13135,19 @@ "category": "Input", "extensionNamespace": "", "fullName": "Multitouch joystick and buttons (sprite)", + "gdevelopVersion": ">=5.5.222", "helpPath": "/objects/multitouch-joystick", "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyMy4wLjMsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iSWNvbnMiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB2aWV3Qm94PSIwIDAgMzIgMzIiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDMyIDMyOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8c3R5bGUgdHlwZT0idGV4dC9jc3MiPg0KCS5zdDB7ZmlsbDpub25lO3N0cm9rZTojMDAwMDAwO3N0cm9rZS13aWR0aDoyO3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1saW5lam9pbjpyb3VuZDtzdHJva2UtbWl0ZXJsaW1pdDoxMDt9DQo8L3N0eWxlPg0KPGNpcmNsZSBjbGFzcz0ic3QwIiBjeD0iMTYiIGN5PSIxNiIgcj0iMTMiLz4NCjxwb2x5bGluZSBjbGFzcz0ic3QwIiBwb2ludHM9IjI4LjQsMTIgMjAsMTIgMjAsMy42ICIvPg0KPHBvbHlsaW5lIGNsYXNzPSJzdDAiIHBvaW50cz0iMjAsMjguNCAyMCwyMCAyOC40LDIwICIvPg0KPHBvbHlsaW5lIGNsYXNzPSJzdDAiIHBvaW50cz0iMy42LDIwIDEyLDIwIDEyLDI4LjQgIi8+DQo8cG9seWxpbmUgY2xhc3M9InN0MCIgcG9pbnRzPSIxMiwzLjYgMTIsMTIgMy42LDEyICIvPg0KPHBvbHlnb24gY2xhc3M9InN0MCIgcG9pbnRzPSIxNiw2IDE2LjcsNyAxNS4zLDcgIi8+DQo8cG9seWdvbiBjbGFzcz0ic3QwIiBwb2ludHM9IjE2LDI2IDE1LjMsMjUgMTYuNywyNSAiLz4NCjxwb2x5Z29uIGNsYXNzPSJzdDAiIHBvaW50cz0iNiwxNiA3LDE1LjMgNywxNi43ICIvPg0KPHBvbHlnb24gY2xhc3M9InN0MCIgcG9pbnRzPSIyNiwxNiAyNSwxNi43IDI1LDE1LjMgIi8+DQo8L3N2Zz4NCg==", "name": "SpriteMultitouchJoystick", "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/Line Hero Pack/Master/SVG/Videogames/Videogames_controller_joystick_arrows_direction.svg", "shortDescription": "Joysticks or buttons for touchscreens.", - "version": "1.6.1", + "version": "1.9.0", "description": [ - "Multitouch joysticks can be used the same way as physical gamepads:", + "Multitouch joysticks are objects showing a joystick on the screen, useful for mobile. They work like a physical gamepad:", "- 4 or 8 directions", "- Analogus pads", "- Player selection", - "- Controls mapping for top-down movement and platformer characters", + "- Automatic \"mapper\" behaviors for 2D and 3D movement behaviors (platformer characters, top-down movement, 3D character etc...). Add one of these to the object with the movement behavior (i.e: the player most of the time) and the behavior will then be controlled automatically by the virtual joystick (it works by reading the multitouch joystick state and simulating controls). No need for additional events to make it work once the behaviors are set up.", "", "There are ready-to-use joysticks in the asset-store [multitouch joysticks pack](https://editor.gdevelop.io/?initial-dialog=asset-store&asset-pack=multitouch-joysticks-multitouch-joysticks)." ], @@ -13248,8 +13212,30 @@ ], "eventsFunctions": [ { - "fullName": "Accelerated speed", - "functionType": "Expression", + "description": "Check if the events are running for the editor.", + "fullName": "Editor is running", + "functionType": "Condition", + "name": "IsInGameEdition", + "private": true, + "sentence": "Events are running for the editor", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const game = runtimeScene.getGame();\r", + "eventsFunctionContext.returnValue = game.isInGameEdition && game.isInGameEdition();" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [], + "objectGroups": [] + }, + { + "fullName": "Accelerated speed", + "functionType": "Expression", "name": "AcceleratedSpeed", "private": true, "sentence": "", @@ -13275,10 +13261,10 @@ "conditions": [ { "type": { - "value": "CompareArgumentAsNumber" + "value": "NumberVariable" }, "parameters": [ - "\"TargetedSpeed\"", + "TargetedSpeed", "<", "0" ] @@ -13303,10 +13289,10 @@ "conditions": [ { "type": { - "value": "CompareArgumentAsNumber" + "value": "NumberVariable" }, "parameters": [ - "\"CurrentSpeed\"", + "CurrentSpeed", "<", "TargetedSpeed" ] @@ -13330,20 +13316,20 @@ "conditions": [ { "type": { - "value": "CompareArgumentAsNumber" + "value": "NumberVariable" }, "parameters": [ - "\"CurrentSpeed\"", + "CurrentSpeed", ">", "TargetedSpeed" ] }, { "type": { - "value": "CompareArgumentAsNumber" + "value": "NumberVariable" }, "parameters": [ - "\"CurrentSpeed\"", + "CurrentSpeed", "<", "0" ] @@ -13379,10 +13365,10 @@ "conditions": [ { "type": { - "value": "CompareArgumentAsNumber" + "value": "NumberVariable" }, "parameters": [ - "\"CurrentSpeed\"", + "CurrentSpeed", ">=", "0" ] @@ -13408,10 +13394,10 @@ "conditions": [ { "type": { - "value": "CompareArgumentAsNumber" + "value": "NumberVariable" }, "parameters": [ - "\"TargetedSpeed\"", + "TargetedSpeed", ">", "0" ] @@ -13436,10 +13422,10 @@ "conditions": [ { "type": { - "value": "CompareArgumentAsNumber" + "value": "NumberVariable" }, "parameters": [ - "\"CurrentSpeed\"", + "CurrentSpeed", ">", "TargetedSpeed" ] @@ -13463,20 +13449,20 @@ "conditions": [ { "type": { - "value": "CompareArgumentAsNumber" + "value": "NumberVariable" }, "parameters": [ - "\"CurrentSpeed\"", + "CurrentSpeed", "<", "TargetedSpeed" ] }, { "type": { - "value": "CompareArgumentAsNumber" + "value": "NumberVariable" }, "parameters": [ - "\"CurrentSpeed\"", + "CurrentSpeed", ">", "0" ] @@ -13512,10 +13498,10 @@ "conditions": [ { "type": { - "value": "CompareArgumentAsNumber" + "value": "NumberVariable" }, "parameters": [ - "\"CurrentSpeed\"", + "CurrentSpeed", "<=", "0" ] @@ -13541,10 +13527,10 @@ "conditions": [ { "type": { - "value": "CompareArgumentAsNumber" + "value": "NumberVariable" }, "parameters": [ - "\"TargetedSpeed\"", + "TargetedSpeed", "=", "0" ] @@ -13557,10 +13543,10 @@ "conditions": [ { "type": { - "value": "CompareArgumentAsNumber" + "value": "NumberVariable" }, "parameters": [ - "\"CurrentSpeed\"", + "CurrentSpeed", "<", "0" ] @@ -13584,10 +13570,10 @@ "conditions": [ { "type": { - "value": "CompareArgumentAsNumber" + "value": "NumberVariable" }, "parameters": [ - "\"CurrentSpeed\"", + "CurrentSpeed", ">", "0" ] @@ -13665,11 +13651,11 @@ "objectGroups": [] }, { - "description": "Check if a button is pressed on a gamepad.", - "fullName": "Multitouch controller button pressed", + "description": "Check if a button was just pressed on a multitouch controller.", + "fullName": "Multitouch controller button just pressed", "functionType": "Condition", - "name": "IsButtonPressed", - "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", + "name": "IsButtonJustPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ was just pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -13681,7 +13667,73 @@ "parameters": [ "Controllers[ControllerIdentifier].Buttons[Button].State", "=", - "\"Pressed\"" + "\"JustPressed\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier", + "type": "expression" + }, + { + "description": "Button name", + "name": "Button", + "supplementaryInformation": "[\"A\",\"CROSS\",\"B\",\"CIRCLE\",\"X\",\"SQUARE\",\"Y\",\"TRIANGLE\",\"LB\",\"L1\",\"RB\",\"R1\",\"LT\",\"L2\",\"RT\",\"R2\",\"UP\",\"DOWN\",\"LEFT\",\"RIGHT\",\"BACK\",\"SHARE\",\"START\",\"OPTIONS\",\"CLICK_STICK_LEFT\",\"CLICK_STICK_RIGHT\",\"PS_BUTTON\",\"CLICK_TOUCHPAD\"]", + "type": "string" + } + ], + "objectGroups": [] + }, + { + "description": "Check if a button is pressed on a multitouch controller.", + "fullName": "Multitouch controller button pressed", + "functionType": "Condition", + "name": "IsButtonPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::Or" + }, + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"Pressed\"" + ] + }, + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"JustPressed\"" + ] + } ] } ], @@ -13713,7 +13765,7 @@ "objectGroups": [] }, { - "description": "Check if a button is released on a gamepad.", + "description": "Check if a button is released on a multitouch controller.", "fullName": "Multitouch controller button released", "functionType": "Condition", "name": "IsButtonReleased", @@ -13799,7 +13851,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"JustPressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -14974,10 +15026,10 @@ "conditions": [ { "type": { - "value": "CompareArgumentAsString" + "value": "StringVariable" }, "parameters": [ - "\"Side\"", + "Side", "=", "\"Left\"" ] @@ -15012,10 +15064,10 @@ "conditions": [ { "type": { - "value": "CompareArgumentAsString" + "value": "StringVariable" }, "parameters": [ - "\"Side\"", + "Side", "=", "\"Right\"" ] @@ -15172,41 +15224,23 @@ "conditions": [ { "type": { - "value": "HasGameJustResumed" + "inverted": true, + "value": "SpriteMultitouchJoystick::IsInGameEdition" }, "parameters": [ + "", "" ] } ], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - } - ] - }, - { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Manage touches", - "source": "", - "type": "BuiltinCommonInstructions::Group", + "actions": [], "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "value": "HasAnyTouchOrMouseStarted" + "value": "HasGameJustResumed" }, "parameters": [ "" @@ -15216,176 +15250,207 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyTouchIndex" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" }, "parameters": [ "Object", "Behavior", - "=", - "0" + "" ] } - ], + ] + }, + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Manage touches", + "source": "", + "type": "BuiltinCommonInstructions::Group", "events": [ { - "type": "BuiltinCommonInstructions::Repeat", - "repeatExpression": "StartedTouchOrMouseCount()", - "conditions": [], - "actions": [], + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "HasAnyTouchOrMouseStarted" + }, + "parameters": [ + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchIndex", + "=", + "0" + ] + } + ], "events": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "StartedTouchOrMouseCount()", + "conditions": [], + "actions": [], + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::PropertyTouchId" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "0" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "0" + ] + }, + { + "type": { + "value": "CollisionPoint" + }, + "parameters": [ + "Object", + "TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)", + "TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "StartedTouchOrMouseId(TouchIndex)" + ] + } ] }, { - "type": { - "value": "CollisionPoint" - }, - "parameters": [ - "Object", - "TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)", - "TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)" - ] - } - ], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyTouchId" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "StartedTouchOrMouseId(TouchIndex)" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyTouchIndex" - }, - "parameters": [ - "Object", - "Behavior", - "+", - "1" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchIndex", + "+", + "1" + ] + } ] } ] } ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 - }, - "comment": "Move thumb back to center when not being pressed (acts like a spring on a real controller)" - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + }, { - "type": { - "value": "HasTouchEnded" - }, - "parameters": [ - "", - "TouchId" - ] - } - ], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 }, - "parameters": [ - "Object", - "Behavior", - "" - ] - } - ] - } - ], - "parameters": [] - }, - { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Update joystick position", - "source": "", - "type": "BuiltinCommonInstructions::Group", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "comment": "Move thumb back to center when not being pressed (acts like a spring on a real controller)" + }, { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::PropertyTouchId" - }, - "parameters": [ - "Object", - "Behavior", - "!=", - "0" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "HasTouchEnded" + }, + "parameters": [ + "", + "TouchId" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } ] } ], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickAngle" - }, - "parameters": [ - "Object", - "Behavior", - "AngleBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0))", - "AngleBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0))" - ] - }, + "parameters": [] + }, + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Update joystick position", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "clamp(2 * DistanceBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0)) / Object.Width(), 0, 1)", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "!=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickAngle" + }, + "parameters": [ + "Object", + "Behavior", + "AngleBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0))", + "AngleBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0))" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "clamp(2 * DistanceBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0)) / Object.Width(), 0, 1)", + "" + ] + } ] } - ] + ], + "parameters": [] } - ], - "parameters": [] + ] } ], "parameters": [ @@ -15457,11 +15522,10 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickForce" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "JoystickForce", "=", "Value" ] @@ -15555,11 +15619,10 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickAngle" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "JoystickAngle", "=", "Value" ] @@ -15825,11 +15888,10 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::PropertyTouchId" + "value": "NumberVariable" }, "parameters": [ - "Object", - "Behavior", + "TouchId", "!=", "0" ] @@ -15888,11 +15950,10 @@ }, { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyTouchId" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "TouchId", "=", "0" ] @@ -15969,11 +16030,10 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyControllerIdentifier" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "ControllerIdentifier", "=", "Value" ] @@ -16050,11 +16110,10 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickIdentifier" + "value": "SetStringVariable" }, "parameters": [ - "Object", - "Behavior", + "JoystickIdentifier", "=", "Value" ] @@ -16131,11 +16190,10 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyDeadZoneRadius" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "DeadZoneRadius", "=", "Value" ] @@ -16183,11 +16241,10 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyTouchId" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "TouchId", "=", "Value" ] @@ -16221,18 +16278,12 @@ "value": "1", "type": "Number", "label": "Multitouch controller identifier (1, 2, 3, 4...)", - "description": "", - "group": "", - "extraInformation": [], "name": "ControllerIdentifier" }, { "value": "Primary", "type": "String", "label": "Joystick name", - "description": "", - "group": "", - "extraInformation": [], "name": "JoystickIdentifier" }, { @@ -16240,17 +16291,12 @@ "type": "Number", "label": "Dead zone radius (range: 0 to 1)", "description": "The deadzone is an area for which movement on sticks won't be taken into account (instead, the stick will be considered as not moved)", - "group": "", - "extraInformation": [], "name": "DeadZoneRadius" }, { "value": "0", "type": "Number", "label": "Joystick angle (range: -180 to 180)", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "JoystickAngle" }, @@ -16258,9 +16304,6 @@ "value": "0", "type": "Number", "label": "Joystick force (range: 0 to 1)", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "JoystickForce" }, @@ -16268,9 +16311,6 @@ "value": "0", "type": "Number", "label": "", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "TouchId" }, @@ -16278,9 +16318,6 @@ "value": "", "type": "Number", "label": "", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "TouchIndex" } @@ -16288,7 +16325,7 @@ "sharedPropertyDescriptors": [] }, { - "description": "Detect button presses made on a touchscreen.", + "description": "Detect presses made on a touchscreen on the object so it acts like a button and automatically trigger the button having the same identifier for the mapper behaviors.", "fullName": "Multitouch button", "name": "MultitouchButton", "objectType": "", @@ -16304,11 +16341,11 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::IsReleased" + "value": "BooleanVariable" }, "parameters": [ - "Object", - "Behavior", + "IsReleased", + "True", "" ] } @@ -16316,12 +16353,50 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyIsReleased" + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsReleased", + "False", + "" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" }, "parameters": [ "Object", "Behavior", - "no" + "\"Idle\"", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "False", + "" ] }, { @@ -16331,7 +16406,7 @@ "parameters": [ "Object", "Behavior", - "\"Idle\"", + "\"Pressed\"", "" ] } @@ -16363,11 +16438,10 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchIndex" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "TouchIndex", "=", "0" ] @@ -16401,11 +16475,10 @@ }, { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::PropertyRadius" + "value": "NumberVariable" }, "parameters": [ - "Object", - "Behavior", + "Radius", ">", "DistanceBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer()), TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer()))" ] @@ -16416,11 +16489,10 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchId" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "TouchId", "=", "StartedTouchOrMouseId(TouchIndex)" ] @@ -16432,7 +16504,17 @@ "parameters": [ "Object", "Behavior", - "\"Pressed\"", + "\"JustPressed\"", + "" + ] + }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "True", "" ] } @@ -16444,11 +16526,10 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchIndex" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "TouchIndex", "+", "1" ] @@ -16496,21 +16577,30 @@ }, { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyIsReleased" + "value": "SetBooleanVariable" }, "parameters": [ - "Object", - "Behavior", - "yes" + "IsReleased", + "True", + "" ] }, { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchId" + "value": "SetBooleanVariable" }, "parameters": [ - "Object", - "Behavior", + "IsJustPressed", + "False", + "" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchId", "=", "0" ] @@ -16534,22 +16624,23 @@ "objectGroups": [] }, { - "description": "Check if button is released.", - "fullName": "Button released", + "description": "Check if the button was just pressed.", + "fullName": "Button just pressed", "functionType": "Condition", - "name": "IsReleased", - "sentence": "Button _PARAM0_ is released", + "name": "IsJustPressed", + "sentence": "Button _PARAM0_ was just pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::PropertyIsReleased" + "value": "BooleanVariable" }, "parameters": [ - "Object", - "Behavior" + "IsJustPressed", + "True", + "" ] } ], @@ -16581,7 +16672,7 @@ "objectGroups": [] }, { - "description": "Check if button is pressed.", + "description": "Check if the button is pressed.", "fullName": "Button pressed", "functionType": "Condition", "name": "IsPressed", @@ -16592,11 +16683,10 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::PropertyTouchId" + "value": "NumberVariable" }, "parameters": [ - "Object", - "Behavior", + "TouchId", "!=", "0" ] @@ -16630,29 +16720,77 @@ "objectGroups": [] }, { - "fullName": "Button state", - "functionType": "Action", - "name": "SetButtonState", - "private": true, - "sentence": "Mark the button _PARAM0_ as _PARAM2_", + "description": "Check if the button is released.", + "fullName": "Button released", + "functionType": "Condition", + "name": "IsReleased", + "sentence": "Button _PARAM0_ is released", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ + "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::SetButtonState" + "value": "BooleanVariable" }, "parameters": [ - "", - "ControllerIdentifier", - "ButtonIdentifier", - "ButtonState", + "IsReleased", + "True", "" ] } - ] + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "Button state", + "functionType": "Action", + "name": "SetButtonState", + "private": true, + "sentence": "Mark the button _PARAM0_ as _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::SetButtonState" + }, + "parameters": [ + "", + "ControllerIdentifier", + "ButtonIdentifier", + "ButtonState", + "" + ] + } + ] } ], "parameters": [ @@ -16670,7 +16808,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"JustPressed\",\"Pressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -16682,27 +16820,18 @@ "value": "1", "type": "Number", "label": "Multitouch controller identifier (1, 2, 3, 4...)", - "description": "", - "group": "", - "extraInformation": [], "name": "ControllerIdentifier" }, { "value": "A", "type": "String", "label": "Button identifier", - "description": "", - "group": "", - "extraInformation": [], "name": "ButtonIdentifier" }, { "value": "0", "type": "Number", "label": "TouchID", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "TouchId" }, @@ -16710,9 +16839,6 @@ "value": "", "type": "Number", "label": "", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "TouchIndex" }, @@ -16720,20 +16846,22 @@ "value": "", "type": "Boolean", "label": "Button released", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "IsReleased" }, + { + "value": "", + "type": "Boolean", + "label": "Button just pressed", + "hidden": true, + "name": "IsJustPressed" + }, { "value": "0", "type": "Number", "unit": "Pixel", "label": "Triggering circle radius", "description": "This circle adds up to the object collision mask.", - "group": "", - "extraInformation": [], "name": "Radius" } ], @@ -16744,6 +16872,7 @@ "fullName": "Platformer multitouch controller mapper", "name": "PlatformerMultitouchMapper", "objectType": "", + "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -16921,31 +17050,32 @@ "value": "", "type": "Behavior", "label": "Platform character behavior", - "description": "", - "group": "", "extraInformation": [ "PlatformBehavior::PlatformerObjectBehavior" ], + "choices": [], "name": "Property" }, { "value": "1", "type": "Number", "label": "Controller identifier (1, 2, 3, 4...)", - "description": "", - "group": "", - "extraInformation": [], "name": "ControllerIdentifier" }, { "value": "Primary", "type": "Choice", "label": "Joystick name", - "description": "", "group": "Controls", - "extraInformation": [ - "Primary", - "Secondary" + "choices": [ + { + "label": "Primary", + "value": "Primary" + }, + { + "label": "Secondary", + "value": "Secondary" + } ], "name": "JoystickIdentifier" }, @@ -16953,9 +17083,7 @@ "value": "A", "type": "String", "label": "Jump button name", - "description": "", "group": "Controls", - "extraInformation": [], "name": "JumpButton" } ], @@ -16966,6 +17094,7 @@ "fullName": "3D platformer multitouch controller mapper", "name": "Platformer3DMultitouchMapper", "objectType": "", + "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -17064,31 +17193,32 @@ "value": "", "type": "Behavior", "label": "3D physics character", - "description": "", - "group": "", "extraInformation": [ "Physics3D::PhysicsCharacter3D" ], + "choices": [], "name": "PhysicsCharacter3D" }, { "value": "1", "type": "Number", "label": "Controller identifier (1, 2, 3, 4...)", - "description": "", - "group": "", - "extraInformation": [], "name": "ControllerIdentifier" }, { "value": "Primary", "type": "Choice", "label": "Walk joystick", - "description": "", "group": "Controls", - "extraInformation": [ - "Primary", - "Secondary" + "choices": [ + { + "label": "Primary", + "value": "Primary" + }, + { + "label": "Secondary", + "value": "Secondary" + } ], "name": "JoystickIdentifier" }, @@ -17096,9 +17226,7 @@ "value": "A", "type": "String", "label": "Jump button name", - "description": "", "group": "Controls", - "extraInformation": [], "name": "JumpButton" } ], @@ -17109,6 +17237,7 @@ "fullName": "3D shooter multitouch controller mapper", "name": "Shooter3DMultitouchMapper", "objectType": "", + "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -17196,31 +17325,32 @@ "value": "", "type": "Behavior", "label": "3D physics character", - "description": "", - "group": "", "extraInformation": [ "Physics3D::PhysicsCharacter3D" ], + "choices": [], "name": "PhysicsCharacter3D" }, { "value": "1", "type": "Number", "label": "Controller identifier (1, 2, 3, 4...)", - "description": "", - "group": "", - "extraInformation": [], "name": "ControllerIdentifier" }, { "value": "Primary", "type": "Choice", "label": "Walk joystick", - "description": "", "group": "Controls", - "extraInformation": [ - "Primary", - "Secondary" + "choices": [ + { + "label": "Primary", + "value": "Primary" + }, + { + "label": "Secondary", + "value": "Secondary" + } ], "name": "JoystickIdentifier" }, @@ -17228,9 +17358,7 @@ "value": "A", "type": "String", "label": "Jump button name", - "description": "", "group": "Controls", - "extraInformation": [], "name": "JumpButton" } ], @@ -17241,6 +17369,7 @@ "fullName": "First person camera multitouch controller mapper", "name": "FirstPersonMultitouchMapper", "objectType": "", + "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -17266,11 +17395,10 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper::SetPropertyCurrentRotationSpeedZ" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "CurrentRotationSpeedZ", "=", "SpriteMultitouchJoystick::AcceleratedSpeed(CurrentRotationSpeedZ, SpriteMultitouchJoystick::StickForceX(ControllerIdentifier, CameraStick) * HorizontalRotationSpeedMax, HorizontalRotationSpeedMax, HorizontalRotationAcceleration, HorizontalRotationDeceleration)" ] @@ -17287,11 +17415,10 @@ }, { "type": { - "value": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper::SetPropertyCurrentRotationSpeedY" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "CurrentRotationSpeedY", "=", "SpriteMultitouchJoystick::AcceleratedSpeed(CurrentRotationSpeedY, SpriteMultitouchJoystick::StickForceY(ControllerIdentifier, CameraStick) * VerticalRotationSpeedMax, VerticalRotationSpeedMax, VerticalRotationAcceleration, VerticalRotationDeceleration)" ] @@ -17491,11 +17618,10 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper::SetPropertyHorizontalRotationSpeedMax" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "HorizontalRotationSpeedMax", "=", "Value" ] @@ -17572,11 +17698,10 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper::SetPropertyHorizontalRotationAcceleration" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "HorizontalRotationAcceleration", "=", "Value" ] @@ -17653,11 +17778,10 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper::SetPropertyHorizontalRotationDeceleration" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "HorizontalRotationDeceleration", "=", "Value" ] @@ -17734,11 +17858,10 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper::SetPropertyVerticalRotationSpeedMax" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "VerticalRotationSpeedMax", "=", "Value" ] @@ -17815,11 +17938,10 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper::SetPropertyVerticalRotationAcceleration" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "VerticalRotationAcceleration", "=", "Value" ] @@ -17896,11 +18018,10 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper::SetPropertyVerticalRotationDeceleration" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "VerticalRotationDeceleration", "=", "Value" ] @@ -17977,11 +18098,10 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper::SetPropertyVerticalAngleMin" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "VerticalAngleMin", "=", "Value" ] @@ -18058,11 +18178,10 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper::SetPropertyVerticalAngleMax" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "VerticalAngleMax", "=", "Value" ] @@ -18139,11 +18258,10 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper::SetPropertyOffsetZ" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "OffsetZ", "=", "Value" ] @@ -18172,31 +18290,32 @@ "value": "", "type": "Behavior", "label": "3D capability", - "description": "", - "group": "", "extraInformation": [ "Scene3D::Base3DBehavior" ], + "choices": [], "name": "Object3D" }, { "value": "1", "type": "Number", "label": "Controller identifier (1, 2, 3, 4...)", - "description": "", - "group": "", - "extraInformation": [], "name": "ControllerIdentifier" }, { "value": "Secondary", "type": "Choice", "label": "Camera joystick", - "description": "", "group": "Controls", - "extraInformation": [ - "Primary", - "Secondary" + "choices": [ + { + "label": "Primary", + "value": "Primary" + }, + { + "label": "Secondary", + "value": "Secondary" + } ], "name": "CameraStick" }, @@ -18205,27 +18324,21 @@ "type": "Number", "unit": "AngularSpeed", "label": "Maximum rotation speed", - "description": "", "group": "Horizontal rotation", - "extraInformation": [], "name": "HorizontalRotationSpeedMax" }, { "value": "360", "type": "Number", "label": "Rotation acceleration", - "description": "", "group": "Horizontal rotation", - "extraInformation": [], "name": "HorizontalRotationAcceleration" }, { "value": "720", "type": "Number", "label": "Rotation deceleration", - "description": "", "group": "Horizontal rotation", - "extraInformation": [], "name": "HorizontalRotationDeceleration" }, { @@ -18233,27 +18346,21 @@ "type": "Number", "unit": "AngularSpeed", "label": "Maximum rotation speed", - "description": "", "group": "Vertical rotation", - "extraInformation": [], "name": "VerticalRotationSpeedMax" }, { "value": "240", "type": "Number", "label": "Rotation acceleration", - "description": "", "group": "Vertical rotation", - "extraInformation": [], "name": "VerticalRotationAcceleration" }, { "value": "480", "type": "Number", "label": "Rotation deceleration", - "description": "", "group": "Vertical rotation", - "extraInformation": [], "name": "VerticalRotationDeceleration" }, { @@ -18261,9 +18368,7 @@ "type": "Number", "unit": "DegreeAngle", "label": "Minimum angle", - "description": "", "group": "Vertical rotation", - "extraInformation": [], "name": "VerticalAngleMin" }, { @@ -18271,9 +18376,7 @@ "type": "Number", "unit": "DegreeAngle", "label": "Maximum angle", - "description": "", "group": "Vertical rotation", - "extraInformation": [], "name": "VerticalAngleMax" }, { @@ -18281,9 +18384,7 @@ "type": "Number", "unit": "Pixel", "label": "Z position offset", - "description": "", "group": "Position", - "extraInformation": [], "name": "OffsetZ" }, { @@ -18291,9 +18392,6 @@ "type": "Number", "unit": "AngularSpeed", "label": "Current rotation speed Z", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "CurrentRotationSpeedZ" }, @@ -18302,9 +18400,6 @@ "type": "Number", "unit": "AngularSpeed", "label": "Current rotation speed Y", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "CurrentRotationSpeedY" } @@ -18312,10 +18407,11 @@ "sharedPropertyDescriptors": [] }, { - "description": "Control a top-down character with a multitouch controller.", - "fullName": "Top-down multitouch controller mapper", - "name": "TopDownMultitouchMapper", + "description": "Control a 3D physics car with a multitouch controller.", + "fullName": "3D car multitouch controller mapper", + "name": "PhysicsCar3DMultitouchMapper", "objectType": "", + "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -18328,26 +18424,27 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" + "value": "SpriteMultitouchJoystick::StickForce" }, "parameters": [ - "Object", - "Behavior", - "=", - "\"Analog\"" + "", + ">", + "0", + "ControllerIdentifier", + "SteerJoystickIdentifier", + "" ] } ], "actions": [ { "type": { - "value": "TopDownMovementBehavior::SimulateStick" + "value": "Physics3D::PhysicsCar3D::SimulateSteeringStick" }, "parameters": [ "Object", - "TopDownMovement", - "SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier)", - "SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier)" + "PhysicsCar3D", + "SpriteMultitouchJoystick::StickForceX(ControllerIdentifier, \"Primary\")" ] } ] @@ -18357,26 +18454,27 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" + "value": "SpriteMultitouchJoystick::StickForce" }, "parameters": [ - "Object", - "Behavior", - "=", - "\"360°\"" + "", + ">", + "0", + "ControllerIdentifier", + "SpeedJoystickIdentifier", + "" ] } ], "actions": [ { "type": { - "value": "TopDownMovementBehavior::SimulateStick" + "value": "Physics3D::PhysicsCar3D::SimulateAcceleratorStick" }, "parameters": [ "Object", - "TopDownMovement", - "SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier)", - "sign(SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier))" + "PhysicsCar3D", + "-SpriteMultitouchJoystick::StickForceY(ControllerIdentifier, \"Secondary\")" ] } ] @@ -18386,92 +18484,265 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" + "value": "SpriteMultitouchJoystick::IsButtonPressed" }, "parameters": [ - "Object", - "Behavior", - "=", - "\"8 Directions\"" + "", + "ControllerIdentifier", + "HandBrakeButton", + "\"Down\"" ] } ], - "actions": [], - "events": [ + "actions": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "inverted": true, - "value": "TopDownMovementBehavior::DiagonalsAllowed" - }, - "parameters": [ - "Object", - "TopDownMovement" - ] - } - ], - "actions": [], - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "\"Left\"", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "TopDownMovementBehavior::SimulateLeftKey" - }, - "parameters": [ - "Object", - "TopDownMovement" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "\"Right\"", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "TopDownMovementBehavior::SimulateRightKey" - }, - "parameters": [ - "Object", - "TopDownMovement" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", + "type": { + "value": "Physics3D::PhysicsCar3D::SimulateHandBrakeKey" + }, + "parameters": [ + "Object", + "PhysicsCar3D" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::PhysicsCar3DMultitouchMapper", + "type": "behavior" + } + ], + "objectGroups": [] + } + ], + "propertyDescriptors": [ + { + "value": "", + "type": "Behavior", + "label": "3D physics car", + "extraInformation": [ + "Physics3D::PhysicsCar3D" + ], + "choices": [], + "name": "PhysicsCar3D" + }, + { + "value": "1", + "type": "Number", + "label": "Controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier" + }, + { + "value": "Primary", + "type": "Choice", + "label": "Steer joystick", + "group": "Controls", + "choices": [ + { + "label": "Primary", + "value": "Primary" + }, + { + "label": "Secondary", + "value": "Secondary" + } + ], + "name": "SteerJoystickIdentifier" + }, + { + "value": "Secondary", + "type": "Choice", + "label": "Speed joystick", + "group": "Controls", + "choices": [ + { + "label": "Primary", + "value": "Primary" + }, + { + "label": "Secondary", + "value": "Secondary" + } + ], + "name": "SpeedJoystickIdentifier" + }, + { + "value": "B", + "type": "String", + "label": "Hand brake button name", + "group": "Controls", + "name": "HandBrakeButton" + } + ], + "sharedPropertyDescriptors": [] + }, + { + "description": "Control a top-down character with a multitouch controller.", + "fullName": "Top-down multitouch controller mapper", + "name": "TopDownMultitouchMapper", + "objectType": "", + "quickCustomizationVisibility": "hidden", + "eventsFunctions": [ + { + "fullName": "", + "functionType": "Action", + "name": "doStepPreEvents", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "StickMode", + "=", + "\"Analog\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "TopDownMovementBehavior::SimulateStick" + }, + "parameters": [ + "Object", + "TopDownMovement", + "SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier)", + "SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier)" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "StickMode", + "=", + "\"360°\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "TopDownMovementBehavior::SimulateStick" + }, + "parameters": [ + "Object", + "TopDownMovement", + "SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier)", + "sign(SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier))" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "StickMode", + "=", + "\"8 Directions\"" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "TopDownMovementBehavior::DiagonalsAllowed" + }, + "parameters": [ + "Object", + "TopDownMovement" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JoystickIdentifier", + "\"Left\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "TopDownMovementBehavior::SimulateLeftKey" + }, + "parameters": [ + "Object", + "TopDownMovement" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JoystickIdentifier", + "\"Right\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "TopDownMovementBehavior::SimulateRightKey" + }, + "parameters": [ + "Object", + "TopDownMovement" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { @@ -18829,31 +19100,31 @@ "value": "", "type": "Behavior", "label": "Top-down movement behavior", - "description": "", - "group": "", "extraInformation": [ "TopDownMovementBehavior::TopDownMovementBehavior" ], + "choices": [], "name": "TopDownMovement" }, { "value": "1", "type": "Number", "label": "Controller identifier (1, 2, 3, 4...)", - "description": "", - "group": "", - "extraInformation": [], "name": "ControllerIdentifier" }, { "value": "Primary", "type": "Choice", "label": "Joystick name", - "description": "", - "group": "", - "extraInformation": [ - "Primary", - "Secondary" + "choices": [ + { + "label": "Primary", + "value": "Primary" + }, + { + "label": "Secondary", + "value": "Secondary" + } ], "name": "JoystickIdentifier" }, @@ -18861,12 +19132,20 @@ "value": "Analog", "type": "Choice", "label": "Stick mode", - "description": "", "group": "Controls", - "extraInformation": [ - "Analog", - "360°", - "8 Directions" + "choices": [ + { + "label": "Analog", + "value": "Analog" + }, + { + "label": "360°", + "value": "360°" + }, + { + "label": "8 Directions", + "value": "8 Directions" + } ], "name": "StickMode" } @@ -18887,20 +19166,124 @@ "fullName": "Multitouch Joystick", "isUsingLegacyInstancesRenderer": true, "name": "SpriteMultitouchJoystick", - "eventsFunctions": [ + "objects": [ { - "fullName": "", - "functionType": "Action", - "name": "onCreated", - "sentence": "", - "events": [ + "adaptCollisionMaskAutomatically": false, + "assetStoreId": "", + "name": "Thumb", + "type": "Sprite", + "updateIfNotVisible": false, + "variables": [], + "effects": [], + "behaviors": [], + "animations": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ + "name": "Idle", + "useMultipleDirections": false, + "directions": [ { - "type": { - "value": "Create" + "looping": false, + "timeBetweenFrames": 0.08, + "sprites": [] + } + ] + } + ] + }, + { + "adaptCollisionMaskAutomatically": false, + "assetStoreId": "", + "name": "Border", + "type": "Sprite", + "updateIfNotVisible": false, + "variables": [], + "effects": [], + "behaviors": [ + { + "name": "MultitouchJoystick", + "type": "SpriteMultitouchJoystick::MultitouchJoystick", + "ControllerIdentifier": 1, + "JoystickIdentifier": "Primary", + "FloatingEnabled": false, + "DeadZoneRadius": 0.4, + "JoystickAngle": 0, + "JoystickForce": 0, + "TouchId": 0, + "TouchIndex": 0 + } + ], + "animations": [ + { + "name": "Idle", + "useMultipleDirections": false, + "directions": [ + { + "looping": false, + "timeBetweenFrames": 0.08, + "sprites": [] + } + ] + } + ] + } + ], + "objectsFolderStructure": { + "folderName": "__ROOT", + "children": [ + { + "objectName": "Thumb" + }, + { + "objectName": "Border" + } + ] + }, + "objectsGroups": [], + "layers": [ + { + "ambientLightColorB": 200, + "ambientLightColorG": 200, + "ambientLightColorR": 200, + "camera3DFarPlaneDistance": 10000, + "camera3DFieldOfView": 45, + "camera3DNearPlaneDistance": 3, + "cameraType": "", + "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": [] + } + ], + "instances": [], + "eventsFunctions": [ + { + "fullName": "", + "functionType": "Action", + "name": "onCreated", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "Create" }, "parameters": [ "", @@ -19003,62 +19386,92 @@ "name": "doStepPostEvents", "sentence": "", "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "MettreAutour" - }, - "parameters": [ - "Thumb", - "Border", - "Border.MultitouchJoystick::JoystickForce() * Border.Width() / 2", - "Border.MultitouchJoystick::JoystickAngle()" - ] - } - ] - }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::PropertyShouldBeHiddenWhenReleased" - }, - "parameters": [ - "Object" - ] - }, { "type": { "inverted": true, - "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::IsPressed" + "value": "SpriteMultitouchJoystick::IsInGameEdition" }, "parameters": [ - "Object", + "", "" ] } ], - "actions": [ + "actions": [], + "events": [ { - "type": { - "value": "Cache" - }, - "parameters": [ - "Object" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "MettreAutour" + }, + "parameters": [ + "Thumb", + "Border", + "Border.MultitouchJoystick::JoystickForce() * Border.Width() / 2", + "Border.MultitouchJoystick::JoystickAngle()" + ] + } ] }, { - "type": { - "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::ActivateControl" - }, - "parameters": [ - "Object", - "no", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "ShouldBeHiddenWhenReleased", + "True", + "" + ] + }, + { + "type": { + "inverted": true, + "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::IsPressed" + }, + "parameters": [ + "Object", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "Cache" + }, + "parameters": [ + "Object" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::ActivateControl" + }, + "parameters": [ + "Object", + "no", + "" + ] + }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "ShouldBeHiddenWhenReleased", + "False", + "" + ] + } ] } ] @@ -19220,11 +19633,12 @@ }, { "type": { - "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::SetPropertyShouldBeHiddenWhenReleased" + "value": "SetBooleanVariable" }, "parameters": [ - "Object", - "yes" + "ShouldBeHiddenWhenReleased", + "True", + "" ] }, { @@ -19350,10 +19764,12 @@ { "type": { "inverted": true, - "value": "GetArgumentAsBoolean" + "value": "BooleanVariable" }, "parameters": [ - "\"ShouldActivate\"" + "ShouldActivate", + "True", + "" ] } ], @@ -19375,10 +19791,12 @@ "conditions": [ { "type": { - "value": "GetArgumentAsBoolean" + "value": "BooleanVariable" }, "parameters": [ - "\"ShouldActivate\"" + "ShouldActivate", + "True", + "" ] } ], @@ -19988,20 +20406,21 @@ "value": "1", "type": "Number", "label": "Multitouch controller identifier (1, 2, 3, 4...)", - "description": "", - "group": "", - "extraInformation": [], "name": "ControllerIdentifier" }, { "value": "Primary", "type": "Choice", "label": "Joystick name", - "description": "", - "group": "", - "extraInformation": [ - "Primary", - "Secondary" + "choices": [ + { + "label": "Primary", + "value": "Primary" + }, + { + "label": "Secondary", + "value": "Secondary" + } ], "name": "JoystickIdentifier" }, @@ -20010,8 +20429,6 @@ "type": "Number", "label": "Dead zone radius (range: 0 to 1)", "description": "The deadzone is an area for which movement on sticks won't be taken into account (instead, the stick will be considered as not moved)", - "group": "", - "extraInformation": [], "name": "DeadZoneRadius" }, { @@ -20019,10 +20436,10 @@ "type": "String", "label": "", "description": "Only used by the scene editor.", - "group": "", "extraInformation": [ "Thumb" ], + "choices": [], "hidden": true, "name": "ThumbAnchorOrigin" }, @@ -20031,8 +20448,6 @@ "type": "Number", "label": "", "description": "Only used by the scene editor.", - "group": "", - "extraInformation": [], "hidden": true, "name": "ThumbAnchorTarget" }, @@ -20041,10 +20456,10 @@ "type": "Boolean", "label": "", "description": "Only used by the scene editor.", - "group": "", "extraInformation": [ "Thumb" ], + "choices": [], "hidden": true, "name": "ThumbIsScaledProportionally" }, @@ -20053,8 +20468,6 @@ "type": "String", "label": "", "description": "Only used by the scene editor.", - "group": "", - "extraInformation": [], "hidden": true, "name": "ParentOrigin" }, @@ -20062,167 +20475,110 @@ "value": "", "type": "Boolean", "label": "", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "ShouldBeHiddenWhenReleased" } ], - "objects": [ + "variants": [] + } + ] + }, + { + "author": "Bouh", + "category": "Input", + "extensionNamespace": "", + "fullName": "Gamepads (controllers)", + "gdevelopVersion": ">=5.5.222", + "helpPath": "/all-features/gamepad", + "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0ibWRpLWdhbWVwYWQtdmFyaWFudC1vdXRsaW5lIiB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCI+PHBhdGggZD0iTTYsOUg4VjExSDEwVjEzSDhWMTVINlYxM0g0VjExSDZWOU0xOC41LDlBMS41LDEuNSAwIDAsMSAyMCwxMC41QTEuNSwxLjUgMCAwLDEgMTguNSwxMkExLjUsMS41IDAgMCwxIDE3LDEwLjVBMS41LDEuNSAwIDAsMSAxOC41LDlNMTUuNSwxMkExLjUsMS41IDAgMCwxIDE3LDEzLjVBMS41LDEuNSAwIDAsMSAxNS41LDE1QTEuNSwxLjUgMCAwLDEgMTQsMTMuNUExLjUsMS41IDAgMCwxIDE1LjUsMTJNMTcsNUE3LDcgMCAwLDEgMjQsMTJBNyw3IDAgMCwxIDE3LDE5QzE1LjA0LDE5IDEzLjI3LDE4LjIgMTIsMTYuOUMxMC43MywxOC4yIDguOTYsMTkgNywxOUE3LDcgMCAwLDEgMCwxMkE3LDcgMCAwLDEgNyw1SDE3TTcsN0E1LDUgMCAwLDAgMiwxMkE1LDUgMCAwLDAgNywxN0M4LjY0LDE3IDEwLjA5LDE2LjIxIDExLDE1SDEzQzEzLjkxLDE2LjIxIDE1LjM2LDE3IDE3LDE3QTUsNSAwIDAsMCAyMiwxMkE1LDUgMCAwLDAgMTcsN0g3WiIgLz48L3N2Zz4=", + "name": "Gamepads", + "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/gamepad-variant-outline.svg", + "shortDescription": "Add support for gamepads (or other controllers) to your game, giving access to information such as button presses, axis positions, trigger pressure, etc...", + "version": "0.9.0", + "description": [ + "Add support for gamepads (or other physical controllers).", + "", + "It gives access to:", + "- button presses,", + "- axis positions and force,", + "- trigger pressure,", + "- configurable deadzone,", + "- vibration,", + "- automatic \"gamepad mapper\" behaviors for 2D and 3D movement behaviors (platformer characters, top-down movement, 3D character etc...). Add one of these to the object with the movement behavior (i.e: the player most of the time) and the behavior will then be controlled automatically by the gamepad (it works by reading the gamepad state and simulating controls). No need for additional events to make it work once the behaviors are set up.", + "", + "The Bomberman-like example handles 4 players with gamepads ([open the project online](https://editor.gdevelop.io/?project=example://goose-bomberman))." + ], + "origin": { + "identifier": "Gamepads", + "name": "gdevelop-extension-store" + }, + "tags": [ + "controllers", + "gamepads", + "joysticks", + "axis", + "xbox", + "ps4", + "platformer", + "platform", + "top-down" + ], + "authorIds": [ + "2OwwM8ToR9dx9RJ2sAKTcrLmCB92", + "taRwmWxwAFYFL9yyBwB3cwBw0BO2", + "mnImQKdn8nQxwzkS5D6a1JB27V23", + "IWykYNRvhCZBN3vEgKEbBPOR3Oc2" + ], + "dependencies": [], + "globalVariables": [], + "sceneVariables": [ + { + "name": "Buttons", + "type": "structure", + "children": [ { - "adaptCollisionMaskAutomatically": false, - "assetStoreId": "", - "name": "Thumb", - "type": "Sprite", - "updateIfNotVisible": false, - "variables": [], - "effects": [], - "behaviors": [], - "animations": [ - { - "name": "Idle", - "useMultipleDirections": false, - "directions": [ - { - "looping": false, - "timeBetweenFrames": 0.08, - "sprites": [] - } - ] - } - ] + "name": "A or Cross", + "type": "string", + "value": "A" }, { - "adaptCollisionMaskAutomatically": false, - "assetStoreId": "", - "name": "Border", - "type": "Sprite", - "updateIfNotVisible": false, - "variables": [], - "effects": [], - "behaviors": [ - { - "name": "MultitouchJoystick", - "type": "SpriteMultitouchJoystick::MultitouchJoystick", - "ControllerIdentifier": 1, - "JoystickIdentifier": "Primary", - "FloatingEnabled": false, - "DeadZoneRadius": 0.4, - "JoystickAngle": 0, - "JoystickForce": 0, - "TouchId": 0, - "TouchIndex": 0 - } - ], - "animations": [ - { - "name": "Idle", - "useMultipleDirections": false, - "directions": [ - { - "looping": false, - "timeBetweenFrames": 0.08, - "sprites": [] - } - ] - } - ] - } - ], - "objectsFolderStructure": { - "folderName": "__ROOT", - "children": [ - { - "objectName": "Thumb" - }, - { - "objectName": "Border" - } - ] - }, - "objectsGroups": [], - "layers": [ + "name": "B or Circle", + "type": "string", + "value": "B" + }, { - "ambientLightColorB": 200, - "ambientLightColorG": 200, - "ambientLightColorR": 200, - "camera3DFarPlaneDistance": 10000, - "camera3DFieldOfView": 45, - "camera3DNearPlaneDistance": 3, - "cameraType": "", - "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": [] + "name": "LB or L1", + "type": "string", + "value": "LB" + }, + { + "name": "LT or L2", + "type": "string", + "value": "LT" + }, + { + "name": "RB or R1", + "type": "string", + "value": "RB" + }, + { + "name": "RT or R2", + "type": "string", + "value": "RT" + }, + { + "name": "X or Square", + "type": "string", + "value": "X" + }, + { + "name": "Y or Triangle", + "type": "string", + "value": "Y" } - ], - "instances": [] + ] } - ] - }, - { - "author": "Bouh", - "category": "Input", - "extensionNamespace": "", - "fullName": "Gamepads (controllers)", - "helpPath": "/all-features/gamepad", - "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0ibWRpLWdhbWVwYWQtdmFyaWFudC1vdXRsaW5lIiB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCI+PHBhdGggZD0iTTYsOUg4VjExSDEwVjEzSDhWMTVINlYxM0g0VjExSDZWOU0xOC41LDlBMS41LDEuNSAwIDAsMSAyMCwxMC41QTEuNSwxLjUgMCAwLDEgMTguNSwxMkExLjUsMS41IDAgMCwxIDE3LDEwLjVBMS41LDEuNSAwIDAsMSAxOC41LDlNMTUuNSwxMkExLjUsMS41IDAgMCwxIDE3LDEzLjVBMS41LDEuNSAwIDAsMSAxNS41LDE1QTEuNSwxLjUgMCAwLDEgMTQsMTMuNUExLjUsMS41IDAgMCwxIDE1LjUsMTJNMTcsNUE3LDcgMCAwLDEgMjQsMTJBNyw3IDAgMCwxIDE3LDE5QzE1LjA0LDE5IDEzLjI3LDE4LjIgMTIsMTYuOUMxMC43MywxOC4yIDguOTYsMTkgNywxOUE3LDcgMCAwLDEgMCwxMkE3LDcgMCAwLDEgNyw1SDE3TTcsN0E1LDUgMCAwLDAgMiwxMkE1LDUgMCAwLDAgNywxN0M4LjY0LDE3IDEwLjA5LDE2LjIxIDExLDE1SDEzQzEzLjkxLDE2LjIxIDE1LjM2LDE3IDE3LDE3QTUsNSAwIDAsMCAyMiwxMkE1LDUgMCAwLDAgMTcsN0g3WiIgLz48L3N2Zz4=", - "name": "Gamepads", - "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/gamepad-variant-outline.svg", - "shortDescription": "Add support for gamepads (or other controllers) to your game, giving access to information such as button presses, axis positions, trigger pressure, etc...", - "version": "0.6.3", - "description": [ - "Add support for gamepads (or other controllers).", - "", - "It gives access to:", - "- button presses", - "- axis positions and force", - "- trigger pressure", - "- configurable deadzone", - "- vibration", - "- automatic mappers for platformer characters and top-down movement", - "", - "The Bomberman-like example handles 4 players with gamepads ([open the project online](https://editor.gdevelop.io/?project=example://goose-bomberman))." - ], - "origin": { - "identifier": "Gamepads", - "name": "gdevelop-extension-store" - }, - "tags": [ - "controllers", - "gamepads", - "joysticks", - "axis", - "xbox", - "ps4", - "platformer", - "platform", - "top-down" ], - "authorIds": [ - "2OwwM8ToR9dx9RJ2sAKTcrLmCB92", - "taRwmWxwAFYFL9yyBwB3cwBw0BO2", - "mnImQKdn8nQxwzkS5D6a1JB27V23" - ], - "dependencies": [], - "globalVariables": [], - "sceneVariables": [], "eventsFunctions": [ { "fullName": "", @@ -20230,83 +20586,323 @@ "name": "onFirstSceneLoaded", "sentence": "", "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [] - }, { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "//Define an new private object javascript for the gamepad extension\r", - "gdjs._extensionController = {\r", - " players: {\r", - " 0: { mapping: 'DEFAULT', lastButtonUsed: -1, deadzone: 0.2, previousFrameStateButtons: {}, rumble: {} },\r", - " 1: { mapping: 'DEFAULT', lastButtonUsed: -1, deadzone: 0.2, previousFrameStateButtons: {}, rumble: {} },\r", - " 2: { mapping: 'DEFAULT', lastButtonUsed: -1, deadzone: 0.2, previousFrameStateButtons: {}, rumble: {} },\r", - " 3: { mapping: 'DEFAULT', lastButtonUsed: -1, deadzone: 0.2, previousFrameStateButtons: {}, rumble: {} },\r", + "if (gdjs._extensionController) {\r", + " return;\r", + "}\r", + "\r", + "/**\r", + " * Associate controller button ids to button names\r", + " */\r", + "const controllerButtonNames = {\r", + " \"XBOX\": {\r", + " 0: \"A\",\r", + " 1: \"B\",\r", + " 2: \"X\",\r", + " 3: \"Y\",\r", + " 4: \"LB\",\r", + " 5: \"RB\",\r", + " 6: \"LT\",\r", + " 7: \"RT\",\r", + " 8: \"BACK\",\r", + " 9: \"START\",\r", + " 10: \"CLICK_STICK_LEFT\",\r", + " 11: \"CLICK_STICK_RIGHT\",\r", + " 12: \"UP\",\r", + " 13: \"DOWN\",\r", + " 14: \"LEFT\",\r", + " 15: \"RIGHT\",\r", + " 16: \"NONE\",\r", + " 17: \"NONE\"\r", " },\r", - " lastActiveController: -1, // Last active controller\r", - " controllerButtonNames: { //Map associating controller button ids to button names\r", - " \"XBOX\": {\r", - " 0: \"A\",\r", - " 1: \"B\",\r", - " 2: \"X\",\r", - " 3: \"Y\",\r", - " 4: \"LB\",\r", - " 5: \"RB\",\r", - " 6: \"LT\",\r", - " 7: \"RT\",\r", - " 8: \"BACK\",\r", - " 9: \"START\",\r", - " 10: \"CLICK_STICK_LEFT\",\r", - " 11: \"CLICK_STICK_RIGHT\",\r", - " 12: \"UP\",\r", - " 13: \"DOWN\",\r", - " 14: \"LEFT\",\r", - " 15: \"RIGHT\",\r", - " 16: \"NONE\",\r", - " 17: \"NONE\"\r", - " },\r", - " \"PS4\": {\r", - " 0: \"CROSS\",\r", - " 1: \"CIRCLE\",\r", - " 2: \"SQUARE\",\r", - " 3: \"TRIANGLE\",\r", - " 4: \"L1\",\r", - " 5: \"R1\",\r", - " 6: \"L2\",\r", - " 7: \"R2\",\r", - " 8: \"SHARE\",\r", - " 9: \"OPTIONS\",\r", - " 10: \"CLICK_STICK_LEFT\",\r", - " 11: \"CLICK_STICK_RIGHT\",\r", - " 12: \"UP\",\r", - " 13: \"DOWN\",\r", - " 14: \"LEFT\",\r", - " 15: \"RIGHT\",\r", - " 16: \"PS_BUTTON\",\r", - " 17: \"CLICK_TOUCHPAD\"\r", - " }\r", + " \"PS4\": {\r", + " 0: \"CROSS\",\r", + " 1: \"CIRCLE\",\r", + " 2: \"SQUARE\",\r", + " 3: \"TRIANGLE\",\r", + " 4: \"L1\",\r", + " 5: \"R1\",\r", + " 6: \"L2\",\r", + " 7: \"R2\",\r", + " 8: \"SHARE\",\r", + " 9: \"OPTIONS\",\r", + " 10: \"CLICK_STICK_LEFT\",\r", + " 11: \"CLICK_STICK_RIGHT\",\r", + " 12: \"UP\",\r", + " 13: \"DOWN\",\r", + " 14: \"LEFT\",\r", + " 15: \"RIGHT\",\r", + " 16: \"PS_BUTTON\",\r", + " 17: \"CLICK_TOUCHPAD\"\r", " }\r", "};\r", "\r", - "gdjs._extensionController.getInputString = function (type, buttonId) {\r", - " const controllerButtonNames = gdjs._extensionController.controllerButtonNames;\r", - " if (controllerButtonNames[type] !== undefined) {\r", - " return controllerButtonNames[type][buttonId];\r", + "/**\r", + " * @param {number} playerId\r", + " */\r", + "function getGamepad(playerId) {\r", + " /** @type {Gamepad[]} */\r", + " const gamepads = navigator.getGamepads ? navigator.getGamepads() : [];\r", + " return gamepads[playerId];\r", + "}\r", + "\r", + "/** @type {{[playerId: number]: Player}} */\r", + "const players = {};\r", + "\r", + "/**\r", + " * @param {number} playerId\r", + " */\r", + "function getPlayer(playerId) {\r", + " let player = players[playerId];\r", + " if (!player) {\r", + " player = new Player(playerId);\r", + " players[playerId] = player;\r", + " }\r", + " return player;\r", + "}\r", + "\r", + "class Player {\r", + " /** @type {number} */\r", + " playerId;\r", + " mapping = 'DEFAULT';\r", + " lastButtonUsed = -1;\r", + " deadzone = 0.2;\r", + " /** @type {{[buttonId: number]: ButtonState}} */\r", + " buttonStates = {};\r", + " rumble = { elapsedTime: 0, duration: 0, weakMagnitude: 0, strongMagnitude: 0 };\r", + "\r", + " /**\r", + " * @param {number} playerId\r", + " */\r", + " constructor(playerId) {\r", + " this.playerId = playerId;\r", + " }\r", + "\r", + " /**\r", + " * @param {number} buttonId\r", + " */\r", + " getButtonState(buttonId) {\r", + " let buttonState = this.buttonStates[buttonId];\r", + " if (!buttonState) {\r", + " buttonState = new ButtonState();\r", + " this.buttonStates[buttonId] = buttonState;\r", + " }\r", + " return buttonState;\r", + " }\r", + "\r", + " /**\r", + " * @param {number} buttonId\r", + " */\r", + " isButtonPressed(buttonId) {\r", + " return this.getButtonState(buttonId).isPressed;\r", + " }\r", + "\r", + " /**\r", + " * @param {number} buttonId\r", + " */\r", + " isButtonJustPressed(buttonId) {\r", + " return this.getButtonState(buttonId).isJustPressed();\r", + " }\r", + "\r", + " /**\r", + " * @param {number} buttonId\r", + " */\r", + " isButtonReleased(buttonId) {\r", + " return this.getButtonState(buttonId).isReleased();\r", + " }\r", + "\r", + " isAnyButtonReleased() {\r", + " for (const buttonId in this.buttonStates) {\r", + " const buttonState = this.buttonStates[buttonId];\r", + " if (buttonState.isReleased()) {\r", + " return true;\r", + " }\r", + " }\r", + " return false;\r", + " }\r", + "\r", + " isAnyButtonPressed() {\r", + " for (const buttonId in this.buttonStates) {\r", + " const buttonState = this.buttonStates[buttonId];\r", + " if (buttonState.isPressed) {\r", + " return true;\r", + " }\r", + " }\r", + " return false;\r", + " }\r", + "}\r", + "\r", + "class ButtonState {\r", + " wasPressed = false;\r", + " isPressed = false;\r", + "\r", + " isReleased() {\r", + " return this.wasPressed && !this.isPressed;\r", + " }\r", + "\r", + " isJustPressed() {\r", + " return !this.wasPressed && this.isPressed;\r", + " }\r", + "}\r", + "\r", + "// Async tasks are run before everything.\r", + "// This is a hack to make sure that button states are updated\r", + "// before mapping behavior events.\r", + "const frameBeginningTask = new class extends gdjs.AsyncTask {\r", + " update() {\r", + " /** @type {Gamepad[]} */\r", + " const gamepads = navigator.getGamepads ? navigator.getGamepads() : [];\r", + " for (let playerId = 0; playerId < gamepads.length; playerId++) {\r", + " const gamepad = gamepads[playerId];\r", + " if (gamepad == null) {\r", + " // The gamepad is not connected.\r", + " continue;\r", + " }\r", + " const player = getPlayer(playerId);\r", + "\r", + " for (let buttonId = 0; buttonId < Object.keys(gamepad.buttons).length; buttonId++) {\r", + " const buttonState = player.getButtonState(buttonId);\r", + " buttonState.wasPressed = buttonState.isPressed;\r", + " buttonState.isPressed = gamepad.buttons[buttonId].pressed;\r", + " if (buttonState.isJustPressed()) {\r", + " player.lastButtonUsed = buttonId;\r", + " }\r", + " }\r", + " }\r", + " return false;\r", + " }\r", + "}();\r", + "\r", + "function onScenePostEvents() {\r", + " /** @type {Gamepad[]} */\r", + " const gamepads = navigator.getGamepads ? navigator.getGamepads() : [];\r", + " for (let playerId = 0; playerId < gamepads.length; playerId++) {\r", + " let gamepad = gamepads[playerId];\r", + " if (gamepad == null) {\r", + " // The gamepad is not connected.\r", + " continue;\r", + " }\r", + " const player = getPlayer(playerId);\r", + " const rumble = player.rumble;\r", + " rumble.elapsedTime += runtimeScene.getElapsedTime(runtimeScene) / 1000;\r", + " if (rumble.duration - rumble.elapsedTime <= 0 &&\r", + " (rumble.weakMagnitude || rumble.strongMagnitude)\r", + " ) {\r", + " rumble.weakMagnitude = 0;\r", + " rumble.strongMagnitude = 0;\r", + " }\r", + " }\r", + "}\r", + "\r", + "/**\r", + " * @param {string} type\r", + " * @param {number} buttonId\r", + " */\r", + "function getInputString(type, buttonId) {\r", + " if (!controllerButtonNames[type]) {\r", + " return \"UNKNOWN_BUTTON\";\r", + " }\r", + " return controllerButtonNames[type][buttonId];\r", + "}\r", + "\r", + "function getButtonId(buttonName) {\r", + " switch (buttonName) {\r", + " case 'A':\r", + " case 'CROSS':\r", + " return 0;\r", + " case 'B':\r", + " case 'CIRCLE':\r", + " return 1;\r", + " case 'X':\r", + " case 'SQUARE':\r", + " return 2;\r", + " case 'Y':\r", + " case 'TRIANGLE':\r", + " return 3;\r", + " case 'LB':\r", + " case 'L1':\r", + " return 4;\r", + " case 'RB':\r", + " case 'R1':\r", + " return 5;\r", + " case 'LT':\r", + " case 'L2':\r", + " return 6;\r", + " case 'RT':\r", + " case 'R2':\r", + " return 7;\r", + " case 'UP':\r", + " return 12;\r", + " case 'DOWN':\r", + " return 13;\r", + " case 'LEFT':\r", + " return 14;\r", + " case 'RIGHT':\r", + " return 15;\r", + " case 'BACK':\r", + " case 'SHARE':\r", + " return 8;\r", + " case 'START':\r", + " case 'OPTIONS':\r", + " return 9;\r", + " case 'CLICK_STICK_LEFT':\r", + " return 10;\r", + " case 'CLICK_STICK_RIGHT':\r", + " return 11;\r", + " //PS4\r", + " case 'PS_BUTTON':\r", + " return 16;\r", + " case 'CLICK_TOUCHPAD':\r", + " return 17;\r", + " default:\r", + " console.error('The gamepad button: ' + buttonName + ' is not valid.');\r", + " return null;\r", " }\r", + "}\r", "\r", - " return \"UNKNOWN_BUTTON\";\r", + "/**\r", + " * @param {number} playerId\r", + " * @param {string} directionName\r", + " * @param {number} axisValueX\r", + " * @param {number} axisValueY\r", + " */\r", + "function isAxisPushed(playerId, directionName, axisValueX, axisValueY) {\r", + " switch (directionName) {\r", + " case 'LEFT':\r", + " return getNormalizedAxisValue(axisValueX, playerId) < 0;\r", + " case 'RIGHT':\r", + " return getNormalizedAxisValue(axisValueX, playerId) > 0;\r", + " case 'UP':\r", + " return getNormalizedAxisValue(axisValueY, playerId) < 0;\r", + " case 'DOWN':\r", + " return getNormalizedAxisValue(axisValueY, playerId) > 0;\r", + " case 'ANY':\r", + " return getNormalizedAxisValue(axisValueX, playerId) < 0\r", + " || getNormalizedAxisValue(axisValueX, playerId) > 0\r", + " || getNormalizedAxisValue(axisValueY, playerId) < 0\r", + " || getNormalizedAxisValue(axisValueY, playerId) > 0\r", + " default:\r", + " console.error('The value stick direction is not valid.');\r", + " return false;\r", + " }\r", "}\r", "\r", - "gdjs._extensionController.axisToAngle = function (deltaX, deltaY) {\r", + "/**\r", + " * @param {number} deltaX\r", + " * @param {number} deltaY\r", + " */\r", + "function axisToAngle(deltaX, deltaY) {\r", " const rad = Math.atan2(deltaY, deltaX);\r", " const deg = rad * (180 / Math.PI);\r", " return deg;\r", "}\r", "\r", - "gdjs._extensionController.isXbox = function (gamepad) {\r", + "/**\r", + " * @param {{id: string}} gamepad\r", + " */\r", + "function isXbox(gamepad) {\r", " return (gamepad ? (\r", " gamepad.id.toUpperCase().indexOf(\"XBOX\") !== -1\r", " // \"XINPUT\" cannot be used to check if it is a xbox controller is just a generic\r", @@ -20315,44 +20911,52 @@ " ) : false);\r", "}\r", "\r", - "//Returns the new value taking into account the dead zone for the player_ID given\r", - "gdjs._extensionController.getNormalizedAxisValue = function (v, player_ID) {\r", + "/**\r", + " * Returns the new value taking into account the dead zone for the player_ID given\r", + " * @param {number} value\r", + " * @param {number} playerID\r", + " */\r", + "function getNormalizedAxisValue(value, playerID) {\r", " // gdjs._extensionController = gdjs._extensionController || { deadzone: 0.2 };\r", "\r", " // Anything smaller than this is assumed to be 0,0\r", - " const DEADZONE = gdjs._extensionController.players[player_ID].deadzone;\r", - "\r", - " if (Math.abs(v) < DEADZONE) {\r", - " // In the dead zone, set to 0\r", - " v = 0;\r", - "\r", - " if (v == null) {\r", - " return 0;\r", - " } else {\r", - " return v;\r", - " }\r", + " const deadzone = getPlayer(playerID).deadzone;\r", "\r", + " if (Math.abs(value) < deadzone) {\r", + " return 0;\r", " } else {\r", " // We're outside the dead zone, but we'd like to smooth\r", " // this value out so it still runs nicely between 0..1.\r", " // That is, we don't want it to jump suddenly from 0 to\r", - " // DEADZONE.\r", + " // deadzone.\r", "\r", - " // Remap v from\r", - " // DEADZONE..1 to 0..(1-DEADZONE)\r", + " // Remap value from\r", + " // deadzone..1 to 0..(1-deadzone)\r", " // or from\r", - " // -1..-DEADZONE to -(1-DEADZONE)..0\r", + " // -1..-deadzone to -(1-deadzone)..0\r", + " value = value - Math.sign(value) * deadzone;\r", "\r", - " v = v - Math.sign(v) * DEADZONE;\r", - "\r", - " // Remap v from\r", - " // 0..(1-DEADZONE) to 0..1\r", + " // Remap value from\r", + " // 0..(1-deadzone) to 0..1\r", " // or from\r", - " // -(1-DEADZONE)..0 to -1..0\r", - "\r", - " return v / (1 - DEADZONE);\r", + " // -(1-deadzone)..0 to -1..0\r", + " return value / (1 - deadzone);\r", " }\r", - "};" + "}\r", + "\r", + "gdjs._extensionController = {\r", + " getPlayer,\r", + " controllerButtonNames,\r", + " getInputString,\r", + " getButtonId,\r", + " axisToAngle,\r", + " isXbox,\r", + " getNormalizedAxisValue,\r", + " isAxisPushed,\r", + " getGamepad,\r", + " onScenePostEvents,\r", + " frameBeginningTask,\r", + "}" ], "parameterObjects": "", "useStrict": true, @@ -20365,59 +20969,35 @@ { "fullName": "", "functionType": "Action", - "name": "onScenePostEvents", + "name": "onSceneLoaded", "sentence": "", "events": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [] - }, + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "// Async tasks are run before everything.\r", + "// This is a hack to make sure that button states are updated\r", + "// before mapping behavior events.\r", + "runtimeScene.getAsyncTasksManager().addTask(gdjs._extensionController.frameBeginningTask);" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "Action", + "name": "onScenePostEvents", + "sentence": "", + "events": [ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "//Each time a player press a button i save the last button pressed for the next frame", - "/** @type {Gamepad[]} */", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);", - "", - "//Get function parameter", - "let countPlayers = Object.keys(gdjs._extensionController.players).length;", - "", - "//Repeat for each players", - "for (let i = 0; i < countPlayers; i++) {", - " let gamepad = gamepads[i]; // Get the gamepad of the player", - "", - " //We have to keep this condition because if the user hasn't plugged in his controller yet, we can't get the controller in the gamepad variable.", - " if (gamepad == null) {", - " continue;", - " }", - "", - " for (let b = 0; b < Object.keys(gamepad.buttons).length; b++) { //For each buttons", - " if (gamepad.buttons[b].pressed) { //One of them is pressed", - " gdjs._extensionController.players[i].lastButtonUsed = b; //Save the button pressed", - "", - " //Save the state of the button for the next frame.", - " gdjs._extensionController.players[i].previousFrameStateButtons[b] = { pressed: true };", - "", - " // Update Last Active Controller", - " gdjs._extensionController.lastActiveController = i;", - " } else {", - " gdjs._extensionController.players[i].previousFrameStateButtons[b] = { pressed: false };", - " }", - " }", - "", - "", - " gdjs._extensionController.players[i].rumble.elapsedTime += runtimeScene.getElapsedTime(runtimeScene) / 1000;", - " if (", - " gdjs._extensionController.players[i].rumble.duration - gdjs._extensionController.players[i].rumble.elapsedTime <= 0 &&", - " (gdjs._extensionController.players[i].rumble.weakMagnitude || gdjs._extensionController.players[i].rumble.strongMagnitude)", - " ) {", - " gdjs._extensionController.players[i].rumble.weakMagnitude = 0;", - " gdjs._extensionController.players[i].rumble.strongMagnitude = 0;", - " }", - "", - "", - "}", + "gdjs._extensionController.onScenePostEvents();", "" ], "parameterObjects": "", @@ -20456,10 +21036,10 @@ "conditions": [ { "type": { - "value": "CompareArgumentAsNumber" + "value": "NumberVariable" }, "parameters": [ - "\"TargetedSpeed\"", + "TargetedSpeed", "<", "0" ] @@ -20484,10 +21064,10 @@ "conditions": [ { "type": { - "value": "CompareArgumentAsNumber" + "value": "NumberVariable" }, "parameters": [ - "\"CurrentSpeed\"", + "CurrentSpeed", "<", "TargetedSpeed" ] @@ -20511,20 +21091,20 @@ "conditions": [ { "type": { - "value": "CompareArgumentAsNumber" + "value": "NumberVariable" }, "parameters": [ - "\"CurrentSpeed\"", + "CurrentSpeed", ">", "TargetedSpeed" ] }, { "type": { - "value": "CompareArgumentAsNumber" + "value": "NumberVariable" }, "parameters": [ - "\"CurrentSpeed\"", + "CurrentSpeed", "<", "0" ] @@ -20560,10 +21140,10 @@ "conditions": [ { "type": { - "value": "CompareArgumentAsNumber" + "value": "NumberVariable" }, "parameters": [ - "\"CurrentSpeed\"", + "CurrentSpeed", ">=", "0" ] @@ -20589,10 +21169,10 @@ "conditions": [ { "type": { - "value": "CompareArgumentAsNumber" + "value": "NumberVariable" }, "parameters": [ - "\"TargetedSpeed\"", + "TargetedSpeed", ">", "0" ] @@ -20617,10 +21197,10 @@ "conditions": [ { "type": { - "value": "CompareArgumentAsNumber" + "value": "NumberVariable" }, "parameters": [ - "\"CurrentSpeed\"", + "CurrentSpeed", ">", "TargetedSpeed" ] @@ -20644,20 +21224,20 @@ "conditions": [ { "type": { - "value": "CompareArgumentAsNumber" + "value": "NumberVariable" }, "parameters": [ - "\"CurrentSpeed\"", + "CurrentSpeed", "<", "TargetedSpeed" ] }, { "type": { - "value": "CompareArgumentAsNumber" + "value": "NumberVariable" }, "parameters": [ - "\"CurrentSpeed\"", + "CurrentSpeed", ">", "0" ] @@ -20693,10 +21273,10 @@ "conditions": [ { "type": { - "value": "CompareArgumentAsNumber" + "value": "NumberVariable" }, "parameters": [ - "\"CurrentSpeed\"", + "CurrentSpeed", "<=", "0" ] @@ -20722,10 +21302,10 @@ "conditions": [ { "type": { - "value": "CompareArgumentAsNumber" + "value": "NumberVariable" }, "parameters": [ - "\"TargetedSpeed\"", + "TargetedSpeed", "=", "0" ] @@ -20738,10 +21318,10 @@ "conditions": [ { "type": { - "value": "CompareArgumentAsNumber" + "value": "NumberVariable" }, "parameters": [ - "\"CurrentSpeed\"", + "CurrentSpeed", "<", "0" ] @@ -20765,10 +21345,10 @@ "conditions": [ { "type": { - "value": "CompareArgumentAsNumber" + "value": "NumberVariable" }, "parameters": [ - "\"CurrentSpeed\"", + "CurrentSpeed", ">", "0" ] @@ -20855,27 +21435,20 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", "\r", - "//Get function parameters\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", - "const trigger = eventsFunctionContext.getArgument(\"trigger\").toUpperCase();\r", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "const trigger = eventsFunctionContext.getArgument(\"Trigger\").toUpperCase();\r", "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier in expression: \"Pressure on a gamepad trigger\", is not valid number, must be between 0 and 4.');\r", - " return;\r", - "}\r", "if (trigger != \"LT\" && trigger != \"RT\" && trigger != \"L2\" && trigger != \"R2\") {\r", " console.error('Parameter trigger is not valid in expression: \"Pressure on a gamepad trigger\"');\r", " return;\r", "}\r", - "\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", - "if (gamepad == null) return;\r", - "\r", + "/** @type {Gamepad} */\r", + "const gamepad = gdjs._extensionController.getGamepad(playerId);\r", + "if (!gamepad) {\r", + " // The gamepad is not connected.\r", + " return;\r", + "}\r", "switch (trigger) {\r", " case 'LT':\r", " case 'L2':\r", @@ -20903,12 +21476,12 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" }, { "description": "Trigger button", - "name": "trigger", + "name": "Trigger", "supplementaryInformation": "[\"LT\",\"RT\",\"L2\",\"R2\"]", "type": "stringWithSelector" } @@ -20925,43 +21498,28 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", - "\r", - "//Get function parameters\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", - "const stick = eventsFunctionContext.getArgument(\"stick\").toUpperCase();\r", + "const { getNormalizedAxisValue } = gdjs._extensionController;\r", "\r", - "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier is not valid in expression: \"Value of a stick force\"');\r", - " return;\r", - "}\r", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "const stick = eventsFunctionContext.getArgument(\"Stick\").toUpperCase();\r", "\r", "if (stick !== \"LEFT\" && stick !== \"RIGHT\") {\r", " console.error('Parameter stick is not valid in expression: \"Value of a stick force\"');\r", " return;\r", "}\r", + "/** @type {Gamepad} */\r", + "const gamepad = gdjs._extensionController.getGamepad(playerId);\r", + "if (!gamepad) {\r", + " // The gamepad is not connected.\r", + " return;\r", + "}\r", + "const axisValueX = stick === 'RIGHT' ? gamepad.axes[2] : gamepad.axes[0];\r", + "const axisValueY = stick === 'RIGHT' ? gamepad.axes[3] : gamepad.axes[1];\r", "\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", - "if (gamepad == null) return;\r", - "\r", - "\r", - "switch (stick) {\r", - " case 'LEFT':\r", - " eventsFunctionContext.returnValue = gdjs.evtTools.common.clamp(Math.abs(gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[0], playerId)) + Math.abs(gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[1], playerId)), 0, 1);\r", - " break;\r", - "\r", - " case 'RIGHT':\r", - " eventsFunctionContext.returnValue = gdjs.evtTools.common.clamp(Math.abs(gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[2], playerId)) + Math.abs(gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[3], playerId)), 0, 1);\r", - " break;\r", - "\r", - " default:\r", - " eventsFunctionContext.returnValue = -1;\r", - " break;\r", - "}" + "eventsFunctionContext.returnValue = gdjs.evtTools.common.clamp(\r", + " Math.abs(getNormalizedAxisValue(axisValueX, playerId)) +\r", + " Math.abs(getNormalizedAxisValue(axisValueY, playerId)), 0, 1);\r", + "" ], "parameterObjects": "", "useStrict": true, @@ -20974,12 +21532,12 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" }, { "description": "Stick: \"Left\" or \"Right\"", - "name": "stick", + "name": "Stick", "supplementaryInformation": "[\"Left\",\"Right\"]", "type": "stringWithSelector" } @@ -21003,7 +21561,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "Gamepads::StickAngle(player_ID, stick)" + "Gamepads::StickAngle(PlayerId, Stick)" ] } ] @@ -21015,12 +21573,12 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" }, { "description": "Stick: \"Left\" or \"Right\"", - "name": "stick", + "name": "Stick", "supplementaryInformation": "[\"Left\",\"Right\"]", "type": "stringWithSelector" } @@ -21037,40 +21595,27 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", - "\r", - "//Get function parameters\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", - "const stick = eventsFunctionContext.getArgument(\"stick\").toUpperCase();\r", + "const { getNormalizedAxisValue } = gdjs._extensionController;\r", "\r", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "const stick = eventsFunctionContext.getArgument(\"Stick\").toUpperCase();\r", "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier is not valid in expression: \"Value of a stick rotation\"');\r", - " return;\r", - "}\r", "if (stick !== \"LEFT\" && stick !== \"RIGHT\") {\r", " console.error('Parameter stick is not valid in expression: \"Value of a stick rotation\"');\r", " return;\r", "}\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", - "if (gamepad == null) return;\r", - "\r", - "switch (stick) {\r", - " case 'LEFT':\r", - " eventsFunctionContext.returnValue = gdjs._extensionController.axisToAngle(gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[0], playerId), gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[1], playerId));\r", - " break;\r", - "\r", - " case 'RIGHT':\r", - " eventsFunctionContext.returnValue = gdjs._extensionController.axisToAngle(gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[2], playerId), gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[3], playerId));\r", - " break;\r", + "/** @type {Gamepad} */\r", + "const gamepad = gdjs._extensionController.getGamepad(playerId);\r", + "if (!gamepad) {\r", + " // The gamepad is not connected.\r", + " return;\r", + "}\r", + "const axisValueX = stick === 'RIGHT' ? gamepad.axes[2] : gamepad.axes[0];\r", + "const axisValueY = stick === 'RIGHT' ? gamepad.axes[3] : gamepad.axes[1];\r", "\r", - " default:\r", - " eventsFunctionContext.returnValue = -1;\r", - " break;\r", - "}" + "eventsFunctionContext.returnValue = gdjs._extensionController.axisToAngle(\r", + " getNormalizedAxisValue(axisValueX, playerId),\r", + " getNormalizedAxisValue(axisValueY, playerId));" ], "parameterObjects": "", "useStrict": true, @@ -21083,12 +21628,12 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" }, { "description": "Stick: \"Left\" or \"Right\"", - "name": "stick", + "name": "Stick", "supplementaryInformation": "[\"Left\",\"Right\"]", "type": "stringWithSelector" } @@ -21106,18 +21651,11 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", "\r", - "//Get function parameters\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", "const stick = eventsFunctionContext.getArgument(\"stick\").toUpperCase();\r", "const direction = eventsFunctionContext.getArgument(\"direction\").toUpperCase();\r", "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier is not valid in expression: \"Value of a gamepad axis\"');\r", - " return;\r", - "}\r", "if (stick != \"LEFT\" && stick != \"RIGHT\") {\r", " console.error('Parameter stick is not valid in expression: \"Value of a gamepad axis\"');\r", " return;\r", @@ -21126,11 +21664,12 @@ " console.error('Parameter direction is not valid in expression: \"Value of a gamepad axis\"');\r", " return;\r", "}\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", - "if (gamepad == null) return;\r", - "\r", + "/** @type {Gamepad} */\r", + "const gamepad = gdjs._extensionController.getGamepad(playerId);\r", + "if (!gamepad) {\r", + " // The gamepad is not connected.\r", + " return;\r", + "}\r", "let parameterError = false;\r", "switch (stick) {\r", " case 'LEFT':\r", @@ -21227,7 +21766,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" }, { @@ -21255,26 +21794,20 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", "\r", - "//Get function parameters\r", "const playerId = eventsFunctionContext.getArgument(\"Gamepad\") - 1;\r", "const stick = eventsFunctionContext.getArgument(\"Stick\").toLowerCase();\r", "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier is not valid in expression: \"Value of a gamepad axis\"');\r", - " return;\r", - "}\r", "if (stick != \"left\" && stick != \"right\") {\r", " console.error('Parameter stick is not valid in expression: \"Value of a gamepad axis\"');\r", " return;\r", "}\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", - "if (gamepad == null) return;\r", - "\r", + "/** @type {Gamepad} */\r", + "const gamepad = gdjs._extensionController.getGamepad(playerId);\r", + "if (!gamepad) {\r", + " // The gamepad is not connected.\r", + " return;\r", + "}\r", "const axisIndex = stick === 'right' ? 2 : 0;\r", "eventsFunctionContext.returnValue = gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[axisIndex], playerId);\r", "" @@ -21312,26 +21845,20 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", "\r", - "//Get function parameters\r", "const playerId = eventsFunctionContext.getArgument(\"Gamepad\") - 1;\r", "const stick = eventsFunctionContext.getArgument(\"Stick\").toLowerCase();\r", "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier is not valid in expression: \"Value of a gamepad axis\"');\r", - " return;\r", - "}\r", "if (stick != \"left\" && stick != \"right\") {\r", " console.error('Parameter stick is not valid in expression: \"Value of a gamepad axis\"');\r", " return;\r", "}\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", - "if (gamepad == null) return;\r", - "\r", + "/** @type {Gamepad} */\r", + "const gamepad = gdjs._extensionController.getGamepad(playerId);\r", + "if (!gamepad) {\r", + " // The gamepad is not connected.\r", + " return;\r", + "}\r", "const axisIndex = stick === 'right' ? 3 : 1;\r", "eventsFunctionContext.returnValue = gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[axisIndex], playerId);\r", "" @@ -21369,136 +21896,57 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", "\r", - "//Get function parameters\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", - "const button = eventsFunctionContext.getArgument(\"button\").toUpperCase();\r", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "const button = eventsFunctionContext.getArgument(\"Button\").toUpperCase();\r", "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier in condition: \"Gamepad button released\", is not valid number, must be between 0 and 4.');\r", - " return;\r", - "}\r", - "if (button === \"\") {\r", - " console.error('Parameter button is not valid in condition: \"Gamepad button released\"');\r", + "let buttonId = gdjs._extensionController.getButtonId(button);\r", + "if (buttonId === null) {\r", " return;\r", "}\r", + "const player = gdjs._extensionController.getPlayer(playerId)\r", + "eventsFunctionContext.returnValue = player.isButtonReleased(buttonId);" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "parameters": [ + { + "description": "The gamepad identifier: 1, 2, 3 or 4", + "name": "PlayerId", + "type": "expression" + }, + { + "description": "Name of the button", + "name": "Button", + "supplementaryInformation": "[\"A\",\"Cross\",\"B\",\"Circle\",\"X\",\"Square\",\"Y\",\"Triangle\",\"LB\",\"L1\",\"RB\",\"R1\",\"LT\",\"L2\",\"RT\",\"R2\",\"Up\",\"Down\",\"Left\",\"Right\",\"Back\",\"Share\",\"Start\",\"Options\",\"Click_Stick_Left\",\"Click_Stick_Right\",\"PS_Button\",\"Click_Touchpad\"]", + "type": "stringWithSelector" + } + ], + "objectGroups": [] + }, + { + "description": "Check if a button was just pressed on a gamepad. Buttons can be:\n* Xbox: \"A\", \"B\", \"X\", \"Y\", \"LB\", \"RB\", \"LT\", \"RT\", \"BACK\", \"START\",\n* PS4: \"CROSS\", \"SQUARE\", \"CIRCLE\", \"TRIANGLE\", \"L1\", \"L2\", \"R1\", \"R2\", \"SHARE\", \"OPTIONS\", \"PS_BUTTON\", \"CLICK_TOUCHPAD\",\n* Other: \"UP\", \"DOWN\", \"LEFT\", \"RIGHT\", \"CLICK_STICK_LEFT\", \"CLICK_STICK_RIGHT\".", + "fullName": "Gamepad button just pressed", + "functionType": "Condition", + "name": "IsButtonJustPressed", + "sentence": "Button _PARAM2_ of gamepad _PARAM1_ was just pressed", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ "\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", - "if (gamepad == null) return;\r", - "\r", - "let buttonId;\r", - "\r", - "switch (button) {\r", - " case 'A':\r", - " case 'CROSS':\r", - " buttonId = 0;\r", - " break;\r", - " case 'B':\r", - " case 'CIRCLE':\r", - " buttonId = 1;\r", - " break;\r", - " case 'X':\r", - " case 'SQUARE':\r", - " buttonId = 2;\r", - " break;\r", - " case 'Y':\r", - " case 'TRIANGLE':\r", - " buttonId = 3;\r", - " break;\r", - " case 'LB':\r", - " case 'L1':\r", - " buttonId = 4;\r", - " break;\r", - " case 'RB':\r", - " case 'R1':\r", - " buttonId = 5;\r", - " break;\r", - " case 'LT':\r", - " case 'L2':\r", - " buttonId = 6;\r", - " break;\r", - " case 'RT':\r", - " case 'R2':\r", - " buttonId = 7;\r", - " break;\r", - "\r", - " case 'UP':\r", - " buttonId = 12;\r", - " break;\r", - " case 'DOWN':\r", - " buttonId = 13;\r", - " break;\r", - " case 'LEFT':\r", - " buttonId = 14;\r", - " break;\r", - " case 'RIGHT':\r", - " buttonId = 15;\r", - " break;\r", - "\r", - " case 'BACK':\r", - " case 'SHARE':\r", - " buttonId = 8;\r", - " break;\r", - " case 'START':\r", - " case 'OPTIONS':\r", - " buttonId = 9;\r", - " break;\r", - "\r", - " case 'CLICK_STICK_LEFT':\r", - " buttonId = 10;\r", - " break;\r", - " case 'CLICK_STICK_RIGHT':\r", - " buttonId = 11;\r", - " break;\r", - "\r", - " //PS4\r", - " case 'PS_BUTTON':\r", - " buttonId = 16;\r", - " break;\r", - " case 'CLICK_TOUCHPAD':\r", - " buttonId = 17;\r", - " break;\r", - "\r", - " default:\r", - " console.error('The button: ' + button + ' in condition: \"Gamepad button released\" is not valid.');\r", - " break;\r", - "}\r", - "\r", - "if (buttonId === undefined) {\r", - " console.error('There is no buttons valid in condition: \"Gamepad button released\"');\r", - " eventsFunctionContext.returnValue = false;\r", - " return;\r", - "}\r", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "const button = eventsFunctionContext.getArgument(\"Button\").toUpperCase();\r", "\r", - "if (gamepad.buttons == null || gamepad.buttons[buttonId] == null) {\r", - " console.error('Buttons on the gamepad are not accessible in condition: \"Gamepad button released\"');\r", - " eventsFunctionContext.returnValue = false;\r", + "let buttonId = gdjs._extensionController.getButtonId(button);\r", + "if (buttonId === null) {\r", " return;\r", "}\r", - "\r", - "//Define default value on pressed button or use previous value\r", - "gdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId] = gdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId] || { pressed: false };\r", - "\r", - "//Get state of button at previous frame\r", - "const previousStateButton = gdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId].pressed;\r", - "\r", - "//When previousStateButton is true and actual button state is not pressed\r", - "//Player have release the button\r", - "if (previousStateButton === true && gamepad.buttons[buttonId].pressed === false) {\r", - " // Save the last button used for the player \r", - " gdjs._extensionController.players[playerId].lastButtonUsed = buttonId;\r", - " gdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId].pressed = true;\r", - " eventsFunctionContext.returnValue = true;\r", - "\r", - "} else {\r", - " gdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId].pressed = false;\r", - " eventsFunctionContext.returnValue = false;\r", - "}\r", - "" + "const player = gdjs._extensionController.getPlayer(playerId)\r", + "eventsFunctionContext.returnValue = player.isButtonJustPressed(buttonId);" ], "parameterObjects": "", "useStrict": true, @@ -21508,12 +21956,12 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" }, { "description": "Name of the button", - "name": "button", + "name": "Button", "supplementaryInformation": "[\"A\",\"Cross\",\"B\",\"Circle\",\"X\",\"Square\",\"Y\",\"Triangle\",\"LB\",\"L1\",\"RB\",\"R1\",\"LT\",\"L2\",\"RT\",\"R2\",\"Up\",\"Down\",\"Left\",\"Right\",\"Back\",\"Share\",\"Start\",\"Options\",\"Click_Stick_Left\",\"Click_Stick_Right\",\"PS_Button\",\"Click_Touchpad\"]", "type": "stringWithSelector" } @@ -21530,17 +21978,9 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "//Get function parameter\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", - "\r", - "//Player id is not valid\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier in expression: \"Last pressed button (id)\", is not valid number, must be between 0 and 4.');\r", - " return;\r", - "}\r", "\r", - "//Return the last button used by the player\r", - "eventsFunctionContext.returnValue = gdjs._extensionController.players[playerId].lastButtonUsed;" + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "eventsFunctionContext.returnValue = gdjs._extensionController.getPlayer(playerId).lastButtonUsed;" ], "parameterObjects": "", "useStrict": true, @@ -21553,7 +21993,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" } ], @@ -21569,46 +22009,10 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", - "\r", - "//Get function parameter\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", - "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier in condition: \"Any gamepad button pressed\", is not valid number, must be between 0 and 4.');\r", - " return;\r", - "}\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", - "if (gamepad == null) return;\r", - "\r", - "let buttonId;\r", - "for (let i = 0; i < gamepad.buttons.length; i++) { //For each buttons\r", - " if (gamepad.buttons[i].pressed) { //One of them is pressed\r", - " buttonId = i; //Save the button pressed\r", - " break;\r", - " }\r", - "}\r", - "\r", - "if (buttonId === undefined) {\r", - " // No buttons are pressed.\r", - " eventsFunctionContext.returnValue = false;\r", - " return;\r", - "}\r", - "\r", - "if (gamepad.buttons == null || gamepad.buttons[buttonId] == null) {\r", - " console.error('Buttons on the gamepad are not accessible in condition: \"Any gamepad button pressed\"');\r", - " eventsFunctionContext.returnValue = false;\r", - " return;\r", - "}\r", - "\r", - "//When a button is pressed, save the button in lastButtonUsed for each players\r", - "if (gamepad.buttons[buttonId].pressed) gdjs._extensionController.players[playerId].lastButtonUsed = buttonId;\r", - "eventsFunctionContext.returnValue = gamepad.buttons[buttonId].pressed;\r", - "\r", "\r", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "const player = gdjs._extensionController.getPlayer(playerId)\r", + "eventsFunctionContext.returnValue = player.isAnyButtonPressed();\r", "" ], "parameterObjects": "", @@ -21619,7 +22023,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" } ], @@ -21635,35 +22039,18 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", "\r", - "//Get function parameters\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", "const controllerType = eventsFunctionContext.getArgument(\"controller_type\").toUpperCase();\r", - "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier in string expression: \"Last pressed button (LastButtonString)\", is not valid number, must be between 0 and 4.');\r", - " return;\r", - "}\r", - "if (controllerType === \"\") {\r", - " console.error('Parameter controller type is not valid in string expression: \"Last pressed button (LastButtonString)\"');\r", + "/** @type {Gamepad} */\r", + "const gamepad = gdjs._extensionController.getGamepad(playerId);\r", + "if (!gamepad) {\r", + " // The gamepad is not connected.\r", " return;\r", "}\r", - "\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "if (gamepad !== null) { //Gamepad exist\r", - " //Get last btn id\r", - " const lastButtonUsedID = gdjs._extensionController.players[playerId].lastButtonUsed;\r", - "\r", - " //Return last button as string \r", - " eventsFunctionContext.returnValue = gdjs._extensionController.getInputString(controllerType, lastButtonUsedID);\r", - "\r", - "} else { //Gamepad dosen't exist\r", - " console.error('Your controller is not supported or the gamepad wasn\\'t detected in string expression: \"Last pressed button (LastButtonString)\"');\r", - " eventsFunctionContext.returnValue = \"Gamepad not connected\";\r", - "}" + "const lastButtonUsedID = gdjs._extensionController.getPlayer(playerId).lastButtonUsed;\r", + "eventsFunctionContext.returnValue = gdjs._extensionController.getInputString(controllerType, lastButtonUsedID);\r", + "" ], "parameterObjects": "", "useStrict": true, @@ -21676,7 +22063,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" }, { @@ -21698,20 +22085,16 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", "\r", - "//Get the last activated controller\r", - "const controllerId = gdjs._extensionController.lastActiveController;\r", - "\r", - "// Check if controller is active\r", - "const gamepad = gamepads[controllerId];\r", - "if (gamepad == null) {\r", - " eventsFunctionContext.returnValue = 0;\r", - "} else {\r", - " // Return active controller id\r", - " eventsFunctionContext.returnValue = controllerId + 1;\r", + "const gamepads = navigator.getGamepads ? navigator.getGamepads() : [];\r", + "let lastGamepadIndex = -1;\r", + "for (let playerId = 0; playerId < gamepads.length; playerId++) {\r", + " // Gamepads can be disconnected and become null\r", + " if (gamepads[playerId]) {\r", + " lastGamepadIndex = playerId\r", + " }\r", "}\r", - "" + "eventsFunctionContext.returnValue = lastGamepadIndex + 1;" ], "parameterObjects": "", "useStrict": true, @@ -21734,127 +22117,16 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", "\r", - "//Get function parameters\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", "const button = eventsFunctionContext.getArgument(\"button\").toUpperCase();\r", "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier in condition: \"Gamepad button pressed\", is not valid number, must be between 0 and 4.');\r", - " return;\r", - "}\r", - "if (button === \"\") {\r", - " console.error('Parameter button is not valid in condition: \"Gamepad button pressed\"');\r", - " eventsFunctionContext.returnValue = false;\r", - " return;\r", - "}\r", - "\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", - "if (gamepad == null) return;\r", - "\r", - "let buttonId;\r", - "\r", - "switch (button) {\r", - " case 'A':\r", - " case 'CROSS':\r", - " buttonId = 0;\r", - " break;\r", - " case 'B':\r", - " case 'CIRCLE':\r", - " buttonId = 1;\r", - " break;\r", - " case 'X':\r", - " case 'SQUARE':\r", - " buttonId = 2;\r", - " break;\r", - " case 'Y':\r", - " case 'TRIANGLE':\r", - " buttonId = 3;\r", - " break;\r", - " case 'LB':\r", - " case 'L1':\r", - " buttonId = 4;\r", - " break;\r", - " case 'RB':\r", - " case 'R1':\r", - " buttonId = 5;\r", - " break;\r", - " case 'LT':\r", - " case 'L2':\r", - " buttonId = 6;\r", - " break;\r", - " case 'RT':\r", - " case 'R2':\r", - " buttonId = 7;\r", - " break;\r", - "\r", - " case 'UP':\r", - " buttonId = 12;\r", - " break;\r", - " case 'DOWN':\r", - " buttonId = 13;\r", - " break;\r", - " case 'LEFT':\r", - " buttonId = 14;\r", - " break;\r", - " case 'RIGHT':\r", - " buttonId = 15;\r", - " break;\r", - "\r", - " case 'BACK':\r", - " case 'SHARE':\r", - " buttonId = 8;\r", - " break;\r", - " case 'START':\r", - " case 'OPTIONS':\r", - " buttonId = 9;\r", - " break;\r", - "\r", - " case 'CLICK_STICK_LEFT':\r", - " buttonId = 10;\r", - " break;\r", - " case 'CLICK_STICK_RIGHT':\r", - " buttonId = 11;\r", - " break;\r", - "\r", - " //PS4\r", - " case 'PS_BUTTON':\r", - " buttonId = 16;\r", - " break;\r", - " case 'CLICK_TOUCHPAD':\r", - " buttonId = 17;\r", - " break;\r", - "\r", - " default:\r", - " console.error('The button: ' + button + ' in condition: \"Gamepad button pressed\" is not valid.');\r", - " eventsFunctionContext.returnValue = false;\r", - " break;\r", - "}\r", - "\r", - "\r", - "\r", - "if (buttonId === undefined) {\r", - " console.error('There is no buttons valid in condition: \"Gamepad button pressed\"');\r", - " eventsFunctionContext.returnValue = false;\r", + "const buttonId = gdjs._extensionController.getButtonId(button);\r", + "if (buttonId === null) {\r", " return;\r", "}\r", - "\r", - "if (gamepad.buttons == null || gamepad.buttons[buttonId] == null) {\r", - " console.error('Buttons on the gamepad are not accessible in condition: \"Gamepad button pressed\"');\r", - " eventsFunctionContext.returnValue = false;\r", - " return;\r", - "}\r", - "\r", - "//When a button is pressed, save the button in lastButtonUsed for each players\r", - "if (gamepad.buttons[buttonId].pressed) gdjs._extensionController.players[playerId].lastButtonUsed = buttonId;\r", - "eventsFunctionContext.returnValue = gamepad.buttons[buttonId].pressed;\r", - "\r", - "\r", - "\r", + "const player = gdjs._extensionController.getPlayer(playerId)\r", + "eventsFunctionContext.returnValue = player.isButtonPressed(buttonId);\r", "" ], "parameterObjects": "", @@ -21865,7 +22137,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" }, { @@ -21892,15 +22164,9 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "//Get function parameter\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier in expression: \"Gamepad deadzone for sticks\", is not valid number, must be between 0 and 4.');\r", - " return;\r", - "}\r", - "///Return the deadzone value for a given player\r", - "eventsFunctionContext.returnValue = gdjs._extensionController.players[playerId].deadzone;" + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "eventsFunctionContext.returnValue = gdjs._extensionController.getPlayer(playerId).deadzone;" ], "parameterObjects": "", "useStrict": true, @@ -21913,7 +22179,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" } ], @@ -21929,18 +22195,12 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "//Get function parameter\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", - "const newDeadzone = eventsFunctionContext.getArgument(\"deadzone\");\r", "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier in action: \"Set gamepad deadzone for sticks\", is not valid, must be between 0 and 4.');\r", - " return;\r", - "}\r", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "const newDeadzone = eventsFunctionContext.getArgument(\"deadzone\");\r", "\r", - "// clamp the newDeadzone in range [0, 1].\r", "// https://github.com/4ian/GDevelop-extensions/pull/33#issuecomment-618224857\r", - "gdjs._extensionController.players[playerId].deadzone = gdjs.evtTools.common.clamp(newDeadzone, 0, 1);\r", + "gdjs._extensionController.getPlayer(playerId).deadzone = gdjs.evtTools.common.clamp(newDeadzone, 0, 1);\r", "" ], "parameterObjects": "", @@ -21951,7 +22211,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" }, { @@ -21972,141 +22232,28 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", "\r", - "//Get function parameters\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", "const stick = eventsFunctionContext.getArgument(\"stick\").toUpperCase();\r", "const direction = eventsFunctionContext.getArgument(\"direction\").toUpperCase();\r", "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier in condition: \"Gamepad stick pushed (axis)\", is not valid number, must be between 0 and 4.');\r", - " return;\r", - "}\r", "if (stick != \"LEFT\" && stick != \"RIGHT\") {\r", " console.error('Parameter stick in condition: \"Gamepad stick pushed (axis)\", is not valid, must be LEFT or RIGHT');\r", " return;\r", "}\r", "if (direction != \"UP\" && direction != \"DOWN\" && direction != \"LEFT\" && direction != \"RIGHT\" && direction != \"ANY\") {\r", - " console.error('Parameter deadzone in condition: \"Gamepad stick pushed (axis)\", is not valid, must be UP, DOWN, LEFT or RIGHT');\r", + " console.error('Parameter direction in condition: \"Gamepad stick pushed (axis)\", is not valid, must be UP, DOWN, LEFT or RIGHT');\r", " return;\r", "}\r", - "\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", - "if (gamepad == null) {\r", - " eventsFunctionContext.returnValue = false;\r", + "/** @type {Gamepad} */\r", + "const gamepad = gdjs._extensionController.getGamepad(playerId);\r", + "if (!gamepad) {\r", + " // The gamepad is not connected.\r", " return;\r", "}\r", - "\r", - "\r", - "//Define in onFirstSceneLoaded function\r", - "const getNormalizedAxisValue = gdjs._extensionController.getNormalizedAxisValue;\r", - "\r", - "switch (stick) {\r", - " case 'LEFT':\r", - " switch (direction) {\r", - " case 'LEFT':\r", - " if (getNormalizedAxisValue(gamepad.axes[0], playerId) < 0) {\r", - " eventsFunctionContext.returnValue = true;\r", - " return;\r", - " }\r", - " break;\r", - "\r", - " case 'RIGHT':\r", - " if (getNormalizedAxisValue(gamepad.axes[0], playerId) > 0) {\r", - " eventsFunctionContext.returnValue = true;\r", - " return;\r", - " }\r", - " break;\r", - "\r", - " case 'UP':\r", - " if (getNormalizedAxisValue(gamepad.axes[1], playerId) < 0) {\r", - " eventsFunctionContext.returnValue = true;\r", - " return;\r", - " }\r", - " break;\r", - "\r", - " case 'DOWN':\r", - " if (getNormalizedAxisValue(gamepad.axes[1], playerId) > 0) {\r", - " eventsFunctionContext.returnValue = true;\r", - " return;\r", - " }\r", - " break;\r", - "\r", - " case 'ANY':\r", - " if ( getNormalizedAxisValue(gamepad.axes[0], playerId) < 0\r", - " || getNormalizedAxisValue(gamepad.axes[0], playerId) > 0\r", - " || getNormalizedAxisValue(gamepad.axes[1], playerId) < 0 \r", - " || getNormalizedAxisValue(gamepad.axes[1], playerId) > 0) {\r", - " eventsFunctionContext.returnValue = true;\r", - " return;\r", - " }\r", - " break;\r", - "\r", - " default:\r", - " console.error('The value Direction on stick Left on the condition: \"Gamepad stick pushed (axis)\" is not valid.');\r", - " eventsFunctionContext.returnValue = false;\r", - " break;\r", - " }\r", - " break;\r", - "\r", - " case 'RIGHT':\r", - " switch (direction) {\r", - " case 'LEFT':\r", - " if (getNormalizedAxisValue(gamepad.axes[2], playerId) < 0) {\r", - " eventsFunctionContext.returnValue = true;\r", - " return;\r", - " }\r", - " break;\r", - "\r", - " case 'RIGHT':\r", - " if (getNormalizedAxisValue(gamepad.axes[2], playerId) > 0) {\r", - " eventsFunctionContext.returnValue = true;\r", - " return;\r", - " }\r", - " break;\r", - "\r", - " case 'UP':\r", - " if (getNormalizedAxisValue(gamepad.axes[3], playerId) < 0) {\r", - " eventsFunctionContext.returnValue = true;\r", - " return;\r", - " }\r", - " break;\r", - "\r", - " case 'DOWN':\r", - " if (getNormalizedAxisValue(gamepad.axes[3], playerId) > 0) {\r", - " eventsFunctionContext.returnValue = true;\r", - " return;\r", - " }\r", - " break;\r", - "\r", - " case 'ANY':\r", - " if ( getNormalizedAxisValue(gamepad.axes[2], playerId) < 0\r", - " || getNormalizedAxisValue(gamepad.axes[2], playerId) > 0\r", - " || getNormalizedAxisValue(gamepad.axes[3], playerId) < 0 \r", - " || getNormalizedAxisValue(gamepad.axes[3], playerId) > 0) {\r", - " eventsFunctionContext.returnValue = true;\r", - " return;\r", - " }\r", - " break;\r", - "\r", - " default:\r", - " console.error('The value Direction on stick Right on the condition: \"Gamepad stick pushed (axis)\" is not valid.');\r", - " eventsFunctionContext.returnValue = false;\r", - " break;\r", - " }\r", - " break;\r", - "\r", - " default:\r", - " console.error('The value Stick on the condition: \"Gamepad stick pushed (axis)\" is not valid.');\r", - " eventsFunctionContext.returnValue = false;\r", - " break;\r", - "}\r", - "\r", - "eventsFunctionContext.returnValue = false;\r", + "const axisValueX = stick === 'RIGHT' ? gamepad.axes[2] : gamepad.axes[0];\r", + "const axisValueY = stick === 'RIGHT' ? gamepad.axes[3] : gamepad.axes[1];\r", + "eventsFunctionContext.returnValue = gdjs._extensionController.isAxisPushed(playerId, direction, axisValueX, axisValueY);\r", "" ], "parameterObjects": "", @@ -22117,7 +22264,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" }, { @@ -22137,24 +22284,24 @@ }, { "description": "Return the number of connected gamepads.", - "fullName": "Connected gamepads number", + "fullName": "Connected gamepads count", "functionType": "Expression", "name": "ConnectedGamepadsCount", "sentence": "", "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [] - }, { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", "\r", - "// Gamepads can be disconnected and become null, so we have to filter them.\r", - "eventsFunctionContext.returnValue = Object.keys(gamepads).filter(key => !!gamepads[key]).length;\r", + "const gamepads = navigator.getGamepads ? navigator.getGamepads() : [];\r", + "let connectedGamepadCount = 0;\r", + "for (let playerId = 0; playerId < gamepads.length; playerId++) {\r", + " // Gamepads can be disconnected and become null\r", + " if (gamepads[playerId]) {\r", + " connectedGamepadCount++;\r", + " }\r", + "}\r", + "eventsFunctionContext.returnValue = connectedGamepadCount;\r", "" ], "parameterObjects": "", @@ -22178,22 +22325,13 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);", - "", - "//Get function parameter", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;", - "", - "if (playerId < 0 || playerId > 4) {", - " console.error('Parameter gamepad identifier in string expression: \"Gamepad type\", is not valid number, must be between 0 and 4');", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;", + "/** @type {Gamepad} */", + "const gamepad = gdjs._extensionController.getGamepad(playerId);", + "if (!gamepad) {", + " // The gamepad is not connected.", " return;", "}", - "", - "const gamepad = gamepads[playerId];", - "", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.", - "if (gamepad == null) return;", - "", "eventsFunctionContext.returnValue = (gamepad && gamepad.id) ? gamepad.id : \"No information for player \" + (playerId + 1)", "" ], @@ -22208,7 +22346,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" } ], @@ -22224,28 +22362,14 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);", - "", - "//Get function parameters", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;", "const controllerType = eventsFunctionContext.getArgument(\"controller_type\").toUpperCase();", - "", - "if (playerId < 0 || playerId > 4) {", - " console.error('Parameter gamepad identifier in condition: \"Gamepad type\", is not valid number, must be between 0 and 4.');", - " return;", - "}", - "if (controllerType === \"\") {", - " console.error('Parameter type in condition: \"Gamepad type\", is not a string.');", + "/** @type {Gamepad} */", + "const gamepad = gdjs._extensionController.getGamepad(playerId);", + "if (!gamepad) {", + " // The gamepad is not connected.", " return;", "}", - "", - "const gamepad = gamepads[playerId];", - "", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.", - "if (gamepad == null) return;", - "", - "", "if (controllerType == \"XBOX\") {", " eventsFunctionContext.returnValue = gdjs._extensionController.isXbox(gamepad);", "} else {", @@ -22260,7 +22384,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" }, { @@ -22281,17 +22405,9 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;", "/** @type {Gamepad[]} */", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);", - "", - "//Get function parameter", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;", - "", - "if (playerId < 0 || playerId > 4) {", - " console.error('Parameter gamepad identifier in condition: \"Gamepad connected\", is not valid number, must be between 0 and 4.');", - " return;", - "}", - "", + "const gamepads = navigator.getGamepads ? navigator.getGamepads() : [];", "// If gamepad was disconnected it will be null (so this will return false)", "// If gamepad was never connected it will be undefined (so this will return false)", "eventsFunctionContext.returnValue = !!gamepads[playerId];" @@ -22304,7 +22420,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" } ], @@ -22320,25 +22436,16 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */", - "//Vibration work only on game in browser.", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);", - "", - "//Get function parameters", - "const playerId = eventsFunctionContext.getArgument(\"Player_ID\") - 1;", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;", "const duration = eventsFunctionContext.getArgument(\"Duration\") || 1;", - "", - "if (playerId < 0 || playerId > 4) {", - " console.error('Parameter gamepad identifier in action: \"Gamepad connected\", is not valid number, must be between 0 and 4.');", - " return;", + "/** @type {Gamepad} */", + "const gamepad = gdjs._extensionController.getGamepad(playerId);", + "if (!gamepad) {", + " // The gamepad is not connected.", + " return;", "}", - "", - "const gamepad = gamepads[playerId];", - "", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.", - "if (gamepad == null) return;", - "", - "if (gamepad && gamepad.vibrationActuator) {", + "//Vibration work only on game in browser.", + "if (gamepad.vibrationActuator) {", " gamepad.vibrationActuator.playEffect(\"dual-rumble\", {", " startDelay: 0,", " duration: duration * 1000,", @@ -22355,7 +22462,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "Player_ID", + "name": "PlayerId", "type": "expression" }, { @@ -22376,35 +22483,19 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */", - "//Vibration work only on game in browser.", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);", - "", - "//Get function parameters", - "const playerId = eventsFunctionContext.getArgument(\"Player_ID\") - 1;", + "const { clamp } = gdjs.evtTools.common;", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;", "const duration = eventsFunctionContext.getArgument(\"Duration\") || 1;", - "const strongRumbleMagnitude = eventsFunctionContext.getArgument(\"StrongMagnitude\");", - "const weakRumbleMagnitude = eventsFunctionContext.getArgument(\"WeakMagnitude\");", - "", - "if (playerId < 0 || playerId > 4) {", - " console.error('Parameter gamepad identifier in action: \"Advanced gamepad vibration\", is not valid number, must be between 0 and 4.');", - " return;", - "}", - "if (weakRumbleMagnitude < 0 || weakRumbleMagnitude > 1) {", - " console.error('Parameter weakRumble identifier in action: \"Advanced gamepad vibration\", is not valid number, must be between 0 and 1.');", - " return;", - "}", - "if (strongRumbleMagnitude < 0 || strongRumbleMagnitude > 1) {", - " console.error('Parameter strongRumble identifier in action: \"Advanced gamepad vibration\", is not valid number, must be between 0 and 1.');", - " return;", + "const strongRumbleMagnitude = clamp(eventsFunctionContext.getArgument(\"StrongMagnitude\"), 0, 1);", + "const weakRumbleMagnitude = clamp(eventsFunctionContext.getArgument(\"WeakMagnitude\"), 0, 1);", + "/** @type {Gamepad} */", + "const gamepad = gdjs._extensionController.getGamepad(playerId);", + "if (!gamepad) {", + " // The gamepad is not connected.", + " return;", "}", - "", - "const gamepad = gamepads[playerId];", - "", - "//we need keep this condition because when use have not yet plug the controller we can't get the controller in the gamepad variable.", - "if (gamepad == null) return;", - "", - "if (gamepad && gamepad.vibrationActuator) {", + "//Vibration work only on game in browser.", + "if (gamepad.vibrationActuator) {", " gamepad.vibrationActuator.playEffect(\"dual-rumble\", {", " startDelay: 0,", " duration: duration * 1000,", @@ -22412,11 +22503,11 @@ " strongMagnitude: strongRumbleMagnitude", " });", "}", - "", - "gdjs._extensionController.players[playerId].rumble.duration = duration;", - "gdjs._extensionController.players[playerId].rumble.elapsedTime = 0;", - "gdjs._extensionController.players[playerId].rumble.weakMagnitude = weakRumbleMagnitude;", - "gdjs._extensionController.players[playerId].rumble.strongMagnitude = strongRumbleMagnitude;" + "const player = gdjs._extensionController.getPlayer(playerId)", + "player.rumble.duration = duration;", + "player.rumble.elapsedTime = 0;", + "player.rumble.weakMagnitude = weakRumbleMagnitude;", + "player.rumble.strongMagnitude = strongRumbleMagnitude;" ], "parameterObjects": "", "useStrict": true, @@ -22426,7 +22517,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "Player_ID", + "name": "PlayerId", "type": "expression" }, { @@ -22457,39 +22548,22 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */", - "//Vibration work only on game in browser.", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);", - "", - "//Get function parameters", - "const playerId = eventsFunctionContext.getArgument(\"Player_ID\") - 1;", - "const elapsedTime = gdjs._extensionController.players[playerId].rumble.elapsedTime || 0;", - "const originalDuration = gdjs._extensionController.players[playerId].rumble.duration || 1;", - "const strongRumbleMagnitude = eventsFunctionContext.getArgument(\"StrongMagnitude\");", - "const weakRumbleMagnitude = eventsFunctionContext.getArgument(\"WeakMagnitude\");", - "", - "", - "if (playerId < 0 || playerId > 4) {", - " console.error('Parameter gamepad identifier in action: \"Change gamepad active vibration\", is not valid number, must be between 0 and 4.');", - " return;", - "}", - "if (weakRumbleMagnitude < 0 || weakRumbleMagnitude > 1) {", - " console.error('Parameter weakRumble identifier in action: \"Change gamepad active vibration\", is not valid number, must be between 0 and 1.');", - " return;", - "}", - "if (strongRumbleMagnitude < 0 || strongRumbleMagnitude > 1) {", - " console.error('Parameter strongRumble identifier in action: \"Change gamepad active vibration\", is not valid number, must be between 0 and 1.');", - " return;", + "const { clamp } = gdjs.evtTools.common;", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;", + "const player = gdjs._extensionController.getPlayer(playerId);", + "const elapsedTime = player.rumble.elapsedTime || 0;", + "const originalDuration = player.rumble.duration || 1;", + "const strongRumbleMagnitude = clamp(eventsFunctionContext.getArgument(\"StrongMagnitude\"), 0, 1);", + "const weakRumbleMagnitude = clamp(eventsFunctionContext.getArgument(\"WeakMagnitude\"), 0, 1);", + "/** @type {Gamepad} */", + "const gamepad = gdjs._extensionController.getGamepad(playerId);", + "if (!gamepad) {", + " // The gamepad is not connected.", + " return;", "}", - "", - "const gamepad = gamepads[playerId];", - "", - "//we need keep this condition because when use have not yet plug the controller we can't get the controller in the gamepad variable.", - "if (gamepad == null) return;", - "", "if (originalDuration - elapsedTime <= 0) return;", - "", - "if (gamepad && gamepad.vibrationActuator) {", + "//Vibration work only on game in browser.", + "if (gamepad.vibrationActuator) {", " gamepad.vibrationActuator.playEffect(\"dual-rumble\", {", " startDelay: 0,", " duration: 1000 * (originalDuration - elapsedTime),", @@ -22498,8 +22572,8 @@ " });", "}", "", - "gdjs._extensionController.players[playerId].rumble.weakMagnitude = weakRumbleMagnitude;", - "gdjs._extensionController.players[playerId].rumble.strongMagnitude = strongRumbleMagnitude;" + "player.rumble.weakMagnitude = weakRumbleMagnitude;", + "player.rumble.strongMagnitude = strongRumbleMagnitude;" ], "parameterObjects": "", "useStrict": true, @@ -22509,7 +22583,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "Player_ID", + "name": "PlayerId", "type": "expression" }, { @@ -22540,54 +22614,10 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", - "\r", - "//Get function parameters\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", - "\r", - "if (playerId < 0 || playerId > 4) {\r", - "\tconsole.error('Parameter gamepad identifier in condition: \"Any gamepad button released\", is not valid number, must be between 0 and 4.');\r", - "\treturn;\r", - "}\r", - "\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", - "if (gamepad == null) return;\r", - "\r", - "for (let buttonId = 0; buttonId < gamepad.buttons.length; buttonId++) { //For each buttons on current frame.\r", - "\r", - "\tif (buttonId === undefined) {\r", - "\t\teventsFunctionContext.returnValue = false;\r", - "\t\treturn;\r", - "\t}\r", - "\r", - "\t//Get previous value or define value by default for the current button\r", - "\tgdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId] = gdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId] || { pressed: false };\r", - "\r", - "\t//Get state of the button at previous frame\r", - "\tconst previousStateButtonIsPressed = gdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId].pressed;\r", - "\r", - "\t//Get the state of the button on the current frame.\r", - "\tconst currentFrameStateButtonIsPressed = gamepad.buttons[buttonId].pressed;\r", "\r", - "\t//When previousStateButtonIsPressed is true and actual button state is not pressed\r", - "\t//Player have release the button\r", - "\tif (previousStateButtonIsPressed === true && currentFrameStateButtonIsPressed === false) {\r", - "\t\tgdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId].pressed = true;\r", - "\t\teventsFunctionContext.returnValue = true;\r", - "\t\t//break;\r", - "\t\treturn;\r", - "\t} else {\r", - "\t\t//The player didn't released the button yet, the previous frame state is still true\r", - "\t\tgdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId].pressed = false;\r", - "\t\teventsFunctionContext.returnValue = false;\r", - "\t}\r", - "\r", - "\tif (currentFrameStateButtonIsPressed) gdjs._extensionController.players[playerId].lastButtonUsed = buttonId;\r", - "}\r", - "" + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "const player = gdjs._extensionController.getPlayer(playerId)\r", + "eventsFunctionContext.returnValue = player.isAnyButtonReleased();" ], "parameterObjects": "", "useStrict": true, @@ -22597,7 +22627,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" } ], @@ -22613,8 +22643,8 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "const playerId = eventsFunctionContext.getArgument(\"Player_ID\") - 1;\r", - "eventsFunctionContext.returnValue = gdjs._extensionController.players[playerId].rumble.weakMagnitude;" + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "eventsFunctionContext.returnValue = gdjs._extensionController.getPlayer(playerId).rumble.weakMagnitude;" ], "parameterObjects": "", "useStrict": true, @@ -22627,7 +22657,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "Player_ID", + "name": "PlayerId", "type": "expression" } ], @@ -22643,8 +22673,8 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "const playerId = eventsFunctionContext.getArgument(\"Player_ID\") - 1;\r", - "eventsFunctionContext.returnValue = gdjs._extensionController.players[playerId].rumble.strongMagnitude;" + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "eventsFunctionContext.returnValue = gdjs._extensionController.getPlayer(playerId).rumble.strongMagnitude;" ], "parameterObjects": "", "useStrict": true, @@ -22657,7 +22687,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "Player_ID", + "name": "PlayerId", "type": "expression" } ], @@ -22670,6 +22700,7 @@ "fullName": "Platformer gamepad mapper", "name": "PlatformerGamepadMapper", "objectType": "", + "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -22698,11 +22729,12 @@ "conditions": [ { "type": { - "value": "Gamepads::PlatformerGamepadMapper::PropertyUseArrows" + "value": "BooleanVariable" }, "parameters": [ - "Object", - "Behavior" + "UseArrows", + "True", + "" ] } ], @@ -22832,11 +22864,12 @@ "conditions": [ { "type": { - "value": "Gamepads::PlatformerGamepadMapper::PropertyUseLeftStick" + "value": "BooleanVariable" }, "parameters": [ - "Object", - "Behavior" + "UseLeftStick", + "True", + "" ] } ], @@ -22970,11 +23003,12 @@ "conditions": [ { "type": { - "value": "Gamepads::PlatformerGamepadMapper::PropertyUseRightStick" + "value": "BooleanVariable" }, "parameters": [ - "Object", - "Behavior" + "UseRightStick", + "True", + "" ] } ], @@ -23106,17 +23140,6 @@ { "type": "BuiltinCommonInstructions::Standard", "conditions": [ - { - "type": { - "value": "Gamepads::PlatformerGamepadMapper::PropertyJumpButton" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "\"A or Cross\"" - ] - }, { "type": { "value": "Gamepads::C_Button_pressed" @@ -23124,7 +23147,7 @@ "parameters": [ "", "GamepadIdentifier", - "\"A\"", + "Buttons[JumpButton]", "\"Left\"" ] } @@ -23140,117 +23163,175 @@ ] } ] - }, + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "Gamepads::PlatformerGamepadMapper", + "type": "behavior" + } + ], + "objectGroups": [] + } + ], + "propertyDescriptors": [ + { + "value": "", + "type": "Behavior", + "label": "Platformer character behavior", + "extraInformation": [ + "PlatformBehavior::PlatformerObjectBehavior" + ], + "choices": [], + "name": "PlatformerCharacter" + }, + { + "value": "1", + "type": "Number", + "label": "Gamepad identifier (1, 2, 3 or 4)", + "name": "GamepadIdentifier" + }, + { + "value": "true", + "type": "Boolean", + "label": "Use directional pad", + "group": "Controls", + "name": "UseArrows" + }, + { + "value": "true", + "type": "Boolean", + "label": "Use left stick", + "group": "Controls", + "name": "UseLeftStick" + }, + { + "value": "", + "type": "Boolean", + "label": "Use right stick", + "group": "Controls", + "name": "UseRightStick" + }, + { + "value": "A or Cross", + "type": "Choice", + "label": "Jump button", + "group": "Controls", + "choices": [ + { + "label": "A or Cross", + "value": "A or Cross" + }, + { + "label": "B or Circle", + "value": "B or Circle" + }, + { + "label": "X or Square", + "value": "X or Square" + }, + { + "label": "Y or Triangle", + "value": "Y or Triangle" + }, + { + "label": "LB or L1", + "value": "LB or L1" + }, + { + "label": "RB or R1", + "value": "RB or R1" + }, + { + "label": "LT or L2", + "value": "LT or L2" + }, + { + "label": "RT or R2", + "value": "RT or R2" + } + ], + "name": "JumpButton" + } + ], + "sharedPropertyDescriptors": [] + }, + { + "description": "Control a 3D physics character with a gamepad.", + "fullName": "3D platformer gamepad mapper", + "name": "Platformer3DGamepadMapper", + "objectType": "", + "quickCustomizationVisibility": "hidden", + "eventsFunctions": [ + { + "fullName": "", + "functionType": "Action", + "name": "doStepPreEvents", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "Gamepads::PlatformerGamepadMapper::PropertyJumpButton" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "\"B or Circle\"" - ] - }, - { - "type": { - "value": "Gamepads::C_Button_pressed" - }, - "parameters": [ - "", - "GamepadIdentifier", - "\"B\"", - "\"Left\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateJumpKey" - }, - "parameters": [ - "Object", - "PlatformerCharacter" - ] - } + "type": { + "value": "Gamepads::C_Controller_X_is_connected" + }, + "parameters": [ + "", + "GamepadIdentifier", + "" ] - }, + } + ], + "actions": [], + "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "value": "Gamepads::PlatformerGamepadMapper::PropertyJumpButton" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "\"X or Square\"" - ] - }, - { - "type": { - "value": "Gamepads::C_Button_pressed" + "value": "Gamepads::StickForce" }, "parameters": [ "", + ">", + "0", "GamepadIdentifier", - "\"X\"", - "\"Left\"" + "JoystickIdentifier", + "" ] } ], "actions": [ { "type": { - "value": "PlatformBehavior::SimulateJumpKey" - }, - "parameters": [ - "Object", - "PlatformerCharacter" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "Gamepads::PlatformerGamepadMapper::PropertyJumpButton" + "value": "Physics3D::PhysicsCharacter3D::SetForwardAngle" }, "parameters": [ "Object", - "Behavior", + "PhysicsCharacter3D", "=", - "\"Y or Triangle\"" + "Gamepads::StickAngle(GamepadIdentifier, JoystickIdentifier) + CameraAngle(Object.Layer())" ] }, { "type": { - "value": "Gamepads::C_Button_pressed" - }, - "parameters": [ - "", - "GamepadIdentifier", - "\"Y\"", - "\"Left\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateJumpKey" + "value": "Physics3D::PhysicsCharacter3D::SimulateStick" }, "parameters": [ "Object", - "PlatformerCharacter" + "PhysicsCharacter3D", + "-90", + "Gamepads::StickForce(GamepadIdentifier, JoystickIdentifier)" ] } ] @@ -23258,17 +23339,6 @@ { "type": "BuiltinCommonInstructions::Standard", "conditions": [ - { - "type": { - "value": "Gamepads::PlatformerGamepadMapper::PropertyJumpButton" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "\"LB or L1\"" - ] - }, { "type": { "value": "Gamepads::C_Button_pressed" @@ -23276,7 +23346,7 @@ "parameters": [ "", "GamepadIdentifier", - "\"LB\"", + "Buttons[JumpButton]", "\"Left\"" ] } @@ -23284,49 +23354,168 @@ "actions": [ { "type": { - "value": "PlatformBehavior::SimulateJumpKey" + "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" }, "parameters": [ "Object", - "PlatformerCharacter" + "PhysicsCharacter3D" ] } ] - }, + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "Gamepads::Platformer3DGamepadMapper", + "type": "behavior" + } + ], + "objectGroups": [] + } + ], + "propertyDescriptors": [ + { + "value": "", + "type": "Behavior", + "label": "3D physics character", + "extraInformation": [ + "Physics3D::PhysicsCharacter3D" + ], + "choices": [], + "name": "PhysicsCharacter3D" + }, + { + "value": "1", + "type": "Number", + "label": "Gamepad identifier (1, 2, 3 or 4)", + "name": "GamepadIdentifier" + }, + { + "value": "Left", + "type": "Choice", + "label": "Walk joystick", + "group": "Controls", + "choices": [ + { + "label": "Left", + "value": "Left" + }, + { + "label": "Right", + "value": "Right" + } + ], + "name": "JoystickIdentifier" + }, + { + "value": "A or Cross", + "type": "Choice", + "label": "Jump button", + "group": "Controls", + "choices": [ + { + "label": "A or Cross", + "value": "A or Cross" + }, + { + "label": "B or Circle", + "value": "B or Circle" + }, + { + "label": "X or Square", + "value": "X or Square" + }, + { + "label": "Y or Triangle", + "value": "Y or Triangle" + }, + { + "label": "LB or L1", + "value": "LB or L1" + }, + { + "label": "RB or R1", + "value": "RB or R1" + }, + { + "label": "LT or L2", + "value": "LT or L2" + }, + { + "label": "RT or R2", + "value": "RT or R2" + } + ], + "name": "JumpButton" + } + ], + "sharedPropertyDescriptors": [] + }, + { + "description": "Control a 3D physics character with a gamepad.", + "fullName": "3D shooter gamepad mapper", + "name": "Shooter3DGamepadMapper", + "objectType": "", + "quickCustomizationVisibility": "hidden", + "eventsFunctions": [ + { + "fullName": "", + "functionType": "Action", + "name": "doStepPreEvents", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::C_Controller_X_is_connected" + }, + "parameters": [ + "", + "GamepadIdentifier", + "" + ] + } + ], + "actions": [], + "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "value": "Gamepads::PlatformerGamepadMapper::PropertyJumpButton" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "\"RB or R1\"" - ] - }, - { - "type": { - "value": "Gamepads::C_Button_pressed" + "value": "Gamepads::StickForce" }, "parameters": [ "", + ">", + "0", "GamepadIdentifier", - "\"RB\"", - "\"Left\"" + "WalkStick", + "" ] } ], "actions": [ { "type": { - "value": "PlatformBehavior::SimulateJumpKey" + "value": "Physics3D::PhysicsCharacter3D::SimulateStick" }, "parameters": [ "Object", - "PlatformerCharacter" + "PhysicsCharacter3D", + "Gamepads::StickAngle(GamepadIdentifier, WalkStick)", + "Gamepads::StickForce(GamepadIdentifier, WalkStick)" ] } ] @@ -23334,17 +23523,6 @@ { "type": "BuiltinCommonInstructions::Standard", "conditions": [ - { - "type": { - "value": "Gamepads::PlatformerGamepadMapper::PropertyJumpButton" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "\"LT or L2\"" - ] - }, { "type": { "value": "Gamepads::C_Button_pressed" @@ -23352,7 +23530,7 @@ "parameters": [ "", "GamepadIdentifier", - "\"LT\"", + "Buttons[JumpButton]", "\"Left\"" ] } @@ -23360,49 +23538,11 @@ "actions": [ { "type": { - "value": "PlatformBehavior::SimulateJumpKey" + "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" }, "parameters": [ "Object", - "PlatformerCharacter" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "Gamepads::PlatformerGamepadMapper::PropertyJumpButton" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "\"RT or R2\"" - ] - }, - { - "type": { - "value": "Gamepads::C_Button_pressed" - }, - "parameters": [ - "", - "GamepadIdentifier", - "\"RT\"", - "\"Left\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateJumpKey" - }, - "parameters": [ - "Object", - "PlatformerCharacter" + "PhysicsCharacter3D" ] } ] @@ -23419,7 +23559,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "Gamepads::PlatformerGamepadMapper", + "supplementaryInformation": "Gamepads::Shooter3DGamepadMapper", "type": "behavior" } ], @@ -23430,65 +23570,91 @@ { "value": "", "type": "Behavior", - "label": "Platformer character behavior", - "description": "", - "group": "", + "label": "3D physics character", "extraInformation": [ - "PlatformBehavior::PlatformerObjectBehavior" + "Physics3D::PhysicsCharacter3D" ], - "name": "PlatformerCharacter" + "choices": [], + "name": "PhysicsCharacter3D" }, { "value": "1", "type": "Number", "label": "Gamepad identifier (1, 2, 3 or 4)", - "description": "", - "group": "", - "extraInformation": [], "name": "GamepadIdentifier" }, { - "value": "true", - "type": "Boolean", - "label": "Use directional pad", - "description": "", - "group": "Controls", - "extraInformation": [], - "name": "UseArrows" - }, - { - "value": "true", - "type": "Boolean", - "label": "Use left stick", - "description": "", + "value": "Left", + "type": "Choice", + "label": "Walk joystick", "group": "Controls", - "extraInformation": [], - "name": "UseLeftStick" + "choices": [ + { + "label": "Left", + "value": "Left" + }, + { + "label": "Right", + "value": "Right" + } + ], + "name": "WalkStick" }, { - "value": "", - "type": "Boolean", - "label": "Use right stick", - "description": "", + "value": "Right", + "type": "Choice", + "label": "Camera joystick", "group": "Controls", - "extraInformation": [], - "name": "UseRightStick" + "choices": [ + { + "label": "Left", + "value": "Left" + }, + { + "label": "Right", + "value": "Right" + } + ], + "name": "CameraStick" }, { "value": "A or Cross", "type": "Choice", "label": "Jump button", - "description": "", "group": "Controls", - "extraInformation": [ - "A or Cross", - "B or Circle", - "X or Square", - "Y or Triangle", - "LB or L1", - "RB or R1", - "LT or L2", - "RT or R2" + "choices": [ + { + "label": "A or Cross", + "value": "A or Cross" + }, + { + "label": "B or Circle", + "value": "B or Circle" + }, + { + "label": "X or Square", + "value": "X or Square" + }, + { + "label": "Y or Triangle", + "value": "Y or Triangle" + }, + { + "label": "LB or L1", + "value": "LB or L1" + }, + { + "label": "RB or R1", + "value": "RB or R1" + }, + { + "label": "LT or L2", + "value": "LT or L2" + }, + { + "label": "RT or R2", + "value": "RT or R2" + } ], "name": "JumpButton" } @@ -23496,10 +23662,11 @@ "sharedPropertyDescriptors": [] }, { - "description": "Control a 3D physics character with a gamepad.", - "fullName": "3D platformer gamepad mapper", - "name": "Platformer3DGamepadMapper", + "description": "Control camera rotations with a gamepad.", + "fullName": "First person camera gamepad mapper", + "name": "FirstPersonGamepadMapper", "objectType": "", + "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -23507,366 +23674,82 @@ "name": "doStepPreEvents", "sentence": "", "events": [ + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "TODO It's probably a bad idea to rotate the object around Y." + }, { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "conditions": [], + "actions": [ { "type": { - "value": "Gamepads::C_Controller_X_is_connected" + "value": "SetNumberVariable" }, "parameters": [ - "", - "GamepadIdentifier", - "" + "CurrentRotationSpeedZ", + "=", + "Gamepads::AcceleratedSpeed(CurrentRotationSpeedZ, Gamepads::StickForceX(GamepadIdentifier, CameraStick) * HorizontalRotationSpeedMax, HorizontalRotationSpeedMax, HorizontalRotationAcceleration, HorizontalRotationDeceleration)" ] - } - ], - "actions": [], - "events": [ + }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "Gamepads::StickForce" - }, - "parameters": [ - "", - ">", - "0", - "GamepadIdentifier", - "JoystickIdentifier", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "Physics3D::PhysicsCharacter3D::SetForwardAngle" - }, - "parameters": [ - "Object", - "PhysicsCharacter3D", - "=", - "Gamepads::StickAngle(GamepadIdentifier, JoystickIdentifier) + CameraAngle(Object.Layer())" - ] - }, - { - "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateStick" - }, - "parameters": [ - "Object", - "PhysicsCharacter3D", - "-90", - "Gamepads::StickForce(GamepadIdentifier, JoystickIdentifier)" - ] - } + "type": { + "value": "SetAngle" + }, + "parameters": [ + "Object", + "+", + "CurrentRotationSpeedZ * TimeDelta()" ] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "Gamepads::Platformer3DGamepadMapper::PropertyJumpButton" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "\"A or Cross\"" - ] - }, - { - "type": { - "value": "Gamepads::C_Button_pressed" - }, - "parameters": [ - "", - "GamepadIdentifier", - "\"A\"", - "\"Left\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" - }, - "parameters": [ - "Object", - "PhysicsCharacter3D" - ] - } + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "CurrentRotationSpeedY", + "=", + "Gamepads::AcceleratedSpeed(CurrentRotationSpeedY, Gamepads::StickForceY(GamepadIdentifier, CameraStick) * VerticalRotationSpeedMax, VerticalRotationSpeedMax, VerticalRotationAcceleration, VerticalRotationDeceleration)" ] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "Gamepads::Platformer3DGamepadMapper::PropertyJumpButton" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "\"B or Circle\"" - ] - }, - { - "type": { - "value": "Gamepads::C_Button_pressed" - }, - "parameters": [ - "", - "GamepadIdentifier", - "\"B\"", - "\"Left\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" - }, - "parameters": [ - "Object", - "PhysicsCharacter3D" - ] - } + "type": { + "value": "Scene3D::Base3DBehavior::SetRotationY" + }, + "parameters": [ + "Object", + "Object3D", + "+", + "CurrentRotationSpeedY * TimeDelta()" ] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "Gamepads::Platformer3DGamepadMapper::PropertyJumpButton" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "\"X or Square\"" - ] - }, - { - "type": { - "value": "Gamepads::C_Button_pressed" - }, - "parameters": [ - "", - "GamepadIdentifier", - "\"X\"", - "\"Left\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" - }, - "parameters": [ - "Object", - "PhysicsCharacter3D" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "Gamepads::Platformer3DGamepadMapper::PropertyJumpButton" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "\"Y or Triangle\"" - ] - }, - { - "type": { - "value": "Gamepads::C_Button_pressed" - }, - "parameters": [ - "", - "GamepadIdentifier", - "\"Y\"", - "\"Left\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" - }, - "parameters": [ - "Object", - "PhysicsCharacter3D" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "Gamepads::Platformer3DGamepadMapper::PropertyJumpButton" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "\"LB or L1\"" - ] - }, - { - "type": { - "value": "Gamepads::C_Button_pressed" - }, - "parameters": [ - "", - "GamepadIdentifier", - "\"LB\"", - "\"Left\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" - }, - "parameters": [ - "Object", - "PhysicsCharacter3D" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "Gamepads::Platformer3DGamepadMapper::PropertyJumpButton" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "\"RB or R1\"" - ] - }, - { - "type": { - "value": "Gamepads::C_Button_pressed" - }, - "parameters": [ - "", - "GamepadIdentifier", - "\"RB\"", - "\"Left\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" - }, - "parameters": [ - "Object", - "PhysicsCharacter3D" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "Gamepads::Platformer3DGamepadMapper::PropertyJumpButton" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "\"LT or L2\"" - ] - }, - { - "type": { - "value": "Gamepads::C_Button_pressed" - }, - "parameters": [ - "", - "GamepadIdentifier", - "\"LT\"", - "\"Left\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" - }, - "parameters": [ - "Object", - "PhysicsCharacter3D" - ] - } + "type": { + "value": "Scene3D::Base3DBehavior::SetRotationY" + }, + "parameters": [ + "Object", + "Object3D", + "=", + "clamp(Object.Object3D::RotationY(), VerticalAngleMin, VerticalAngleMax)" ] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "Gamepads::Platformer3DGamepadMapper::PropertyJumpButton" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "\"RT or R2\"" - ] - }, - { - "type": { - "value": "Gamepads::C_Button_pressed" - }, - "parameters": [ - "", - "GamepadIdentifier", - "\"RT\"", - "\"Left\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" - }, - "parameters": [ - "Object", - "PhysicsCharacter3D" - ] - } + "type": { + "value": "Gamepads::FirstPersonGamepadMapper::LookFromObjectEyes" + }, + "parameters": [ + "Object", + "Behavior", + "" ] } ] @@ -23881,433 +23764,129 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "Gamepads::Platformer3DGamepadMapper", + "supplementaryInformation": "Gamepads::FirstPersonGamepadMapper", "type": "behavior" } ], "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "", - "type": "Behavior", - "label": "3D physics character", - "description": "", - "group": "", - "extraInformation": [ - "Physics3D::PhysicsCharacter3D" - ], - "name": "PhysicsCharacter3D" - }, - { - "value": "1", - "type": "Number", - "label": "Gamepad identifier (1, 2, 3 or 4)", - "description": "", - "group": "", - "extraInformation": [], - "name": "GamepadIdentifier" - }, - { - "value": "Left", - "type": "Choice", - "label": "Walk joystick", - "description": "", - "group": "Controls", - "extraInformation": [ - "Left", - "Right" - ], - "name": "JoystickIdentifier" }, { - "value": "A or Cross", - "type": "Choice", - "label": "Jump button", - "description": "", - "group": "Controls", - "extraInformation": [ - "A or Cross", - "B or Circle", - "X or Square", - "Y or Triangle", - "LB or L1", - "RB or R1", - "LT or L2", - "RT or R2" - ], - "name": "JumpButton" - } - ], - "sharedPropertyDescriptors": [] - }, - { - "description": "Control a 3D physics character with a gamepad.", - "fullName": "3D shooter gamepad mapper", - "name": "Shooter3DGamepadMapper", - "objectType": "", - "eventsFunctions": [ - { - "fullName": "", + "description": "Move the camera to look though _PARAM1_ eyes. The object must look to the right when all its angles are 0 and the top of its head be toward Z+.", + "fullName": "Look through object eyes", "functionType": "Action", - "name": "doStepPreEvents", - "sentence": "", - "events": [ - { + "group": "Layers and cameras", + "name": "LookFromObjectEyes", + "private": true, + "sentence": "Move the camera to look though _PARAM0_ eyes", + "events": [ + { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "conditions": [], + "actions": [ { "type": { - "value": "Gamepads::C_Controller_X_is_connected" + "value": "CentreCamera" }, "parameters": [ "", - "GamepadIdentifier", + "Object", + "", + "Object.Layer()", "" ] - } - ], - "actions": [], - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "Gamepads::StickForce" - }, - "parameters": [ - "", - ">", - "0", - "GamepadIdentifier", - "WalkStick", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateStick" - }, - "parameters": [ - "Object", - "PhysicsCharacter3D", - "Gamepads::StickAngle(GamepadIdentifier, WalkStick)", - "Gamepads::StickForce(GamepadIdentifier, WalkStick)" - ] - } - ] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "Gamepads::Shooter3DGamepadMapper::PropertyJumpButton" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "\"A or Cross\"" - ] - }, - { - "type": { - "value": "Gamepads::C_Button_pressed" - }, - "parameters": [ - "", - "GamepadIdentifier", - "\"A\"", - "\"Left\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" - }, - "parameters": [ - "Object", - "PhysicsCharacter3D" - ] - } + "type": { + "value": "Scene3D::SetCameraZ" + }, + "parameters": [ + "", + "=", + "Object.Object3D::Z() + Object.Object3D::Depth() + OffsetZ", + "", + "" ] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "Gamepads::Shooter3DGamepadMapper::PropertyJumpButton" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "\"B or Circle\"" - ] - }, - { - "type": { - "value": "Gamepads::C_Button_pressed" - }, - "parameters": [ - "", - "GamepadIdentifier", - "\"B\"", - "\"Left\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" - }, - "parameters": [ - "Object", - "PhysicsCharacter3D" - ] - } + "type": { + "value": "Scene3D::SetCameraRotationX" + }, + "parameters": [ + "", + "=", + "- Object.Object3D::RotationY() + 90", + "GetArgumentAsString(\"Layer\")", + "" ] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "Gamepads::Shooter3DGamepadMapper::PropertyJumpButton" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "\"X or Square\"" - ] - }, - { - "type": { - "value": "Gamepads::C_Button_pressed" - }, - "parameters": [ - "", - "GamepadIdentifier", - "\"X\"", - "\"Left\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" - }, - "parameters": [ - "Object", - "PhysicsCharacter3D" - ] - } + "type": { + "value": "Scene3D::SetCameraRotationY" + }, + "parameters": [ + "", + "=", + "Object.Object3D::RotationX()", + "GetArgumentAsString(\"Layer\")", + "" ] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "Gamepads::Shooter3DGamepadMapper::PropertyJumpButton" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "\"Y or Triangle\"" - ] - }, - { - "type": { - "value": "Gamepads::C_Button_pressed" - }, - "parameters": [ - "", - "GamepadIdentifier", - "\"Y\"", - "\"Left\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" - }, - "parameters": [ - "Object", - "PhysicsCharacter3D" - ] - } + "type": { + "value": "SetCameraAngle" + }, + "parameters": [ + "", + "=", + "Object.Angle() + 90", + "Object.Layer()", + "" ] - }, + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "Gamepads::FirstPersonGamepadMapper", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "the maximum horizontal rotation speed of the object.", + "fullName": "Maximum horizontal rotation speed", + "functionType": "ExpressionAndCondition", + "group": "First person camera gamepad mapper horizontal rotation configuration", + "name": "HorizontalRotationSpeedMax", + "sentence": "the maximum horizontal rotation speed", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "Gamepads::Shooter3DGamepadMapper::PropertyJumpButton" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "\"LB or L1\"" - ] - }, - { - "type": { - "value": "Gamepads::C_Button_pressed" - }, - "parameters": [ - "", - "GamepadIdentifier", - "\"LB\"", - "\"Left\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" - }, - "parameters": [ - "Object", - "PhysicsCharacter3D" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "Gamepads::Shooter3DGamepadMapper::PropertyJumpButton" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "\"RB or R1\"" - ] - }, - { - "type": { - "value": "Gamepads::C_Button_pressed" - }, - "parameters": [ - "", - "GamepadIdentifier", - "\"RB\"", - "\"Left\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" - }, - "parameters": [ - "Object", - "PhysicsCharacter3D" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "Gamepads::Shooter3DGamepadMapper::PropertyJumpButton" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "\"LT or L2\"" - ] - }, - { - "type": { - "value": "Gamepads::C_Button_pressed" - }, - "parameters": [ - "", - "GamepadIdentifier", - "\"LT\"", - "\"Left\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" - }, - "parameters": [ - "Object", - "PhysicsCharacter3D" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "Gamepads::Shooter3DGamepadMapper::PropertyJumpButton" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "\"RT or R2\"" - ] - }, - { - "type": { - "value": "Gamepads::C_Button_pressed" - }, - "parameters": [ - "", - "GamepadIdentifier", - "\"RT\"", - "\"Left\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" - }, - "parameters": [ - "Object", - "PhysicsCharacter3D" - ] - } + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "HorizontalRotationSpeedMax" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -24317,174 +23896,77 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "Gamepads::Shooter3DGamepadMapper", + "supplementaryInformation": "Gamepads::FirstPersonGamepadMapper", "type": "behavior" } ], "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "", - "type": "Behavior", - "label": "3D physics character", - "description": "", - "group": "", - "extraInformation": [ - "Physics3D::PhysicsCharacter3D" - ], - "name": "PhysicsCharacter3D" - }, - { - "value": "1", - "type": "Number", - "label": "Gamepad identifier (1, 2, 3 or 4)", - "description": "", - "group": "", - "extraInformation": [], - "name": "GamepadIdentifier" - }, - { - "value": "Left", - "type": "Choice", - "label": "Walk joystick", - "description": "", - "group": "Controls", - "extraInformation": [ - "Left", - "Right" - ], - "name": "WalkStick" - }, - { - "value": "Right", - "type": "Choice", - "label": "Camera joystick", - "description": "", - "group": "Controls", - "extraInformation": [ - "Left", - "Right" - ], - "name": "CameraStick" }, - { - "value": "A or Cross", - "type": "Choice", - "label": "Jump button", - "description": "", - "group": "Controls", - "extraInformation": [ - "A or Cross", - "B or Circle", - "X or Square", - "Y or Triangle", - "LB or L1", - "RB or R1", - "LT or L2", - "RT or R2" - ], - "name": "JumpButton" - } - ], - "sharedPropertyDescriptors": [] - }, - { - "description": "Control camera rotations with a gamepad.", - "fullName": "First person camera gamepad mapper", - "name": "FirstPersonGamepadMapper", - "objectType": "", - "eventsFunctions": [ { "fullName": "", - "functionType": "Action", - "name": "doStepPreEvents", + "functionType": "ActionWithOperator", + "getterName": "HorizontalRotationSpeedMax", + "name": "SetHorizontalRotationSpeedMax", "sentence": "", "events": [ - { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 - }, - "comment": "TODO It's probably a bad idea to rotate the object around Y." - }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [], "actions": [ { "type": { - "value": "Gamepads::FirstPersonGamepadMapper::SetPropertyCurrentRotationSpeedZ" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "HorizontalRotationSpeedMax", "=", - "Gamepads::AcceleratedSpeed(CurrentRotationSpeedZ, Gamepads::StickForceX(GamepadIdentifier, CameraStick) * HorizontalRotationSpeedMax, HorizontalRotationSpeedMax, HorizontalRotationAcceleration, HorizontalRotationDeceleration)" + "Value" ] - }, + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "Gamepads::FirstPersonGamepadMapper", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "the horizontal rotation acceleration of the object.", + "fullName": "Horizontal rotation acceleration", + "functionType": "ExpressionAndCondition", + "group": "First person camera gamepad mapper horizontal rotation configuration", + "name": "HorizontalRotationAcceleration", + "sentence": "the horizontal rotation acceleration", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ { "type": { - "value": "SetAngle" + "value": "SetReturnNumber" }, "parameters": [ - "Object", - "+", - "CurrentRotationSpeedZ * TimeDelta()" - ] - }, - { - "type": { - "value": "Gamepads::FirstPersonGamepadMapper::SetPropertyCurrentRotationSpeedY" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "Gamepads::AcceleratedSpeed(CurrentRotationSpeedY, Gamepads::StickForceY(GamepadIdentifier, CameraStick) * VerticalRotationSpeedMax, VerticalRotationSpeedMax, VerticalRotationAcceleration, VerticalRotationDeceleration)" - ] - }, - { - "type": { - "value": "Scene3D::Base3DBehavior::SetRotationY" - }, - "parameters": [ - "Object", - "Object3D", - "+", - "CurrentRotationSpeedY * TimeDelta()" - ] - }, - { - "type": { - "value": "Scene3D::Base3DBehavior::SetRotationY" - }, - "parameters": [ - "Object", - "Object3D", - "=", - "clamp(Object.Object3D::RotationY(), VerticalAngleMin, VerticalAngleMax)" - ] - }, - { - "type": { - "value": "Gamepads::FirstPersonGamepadMapper::LookFromObjectEyes" - }, - "parameters": [ - "Object", - "Behavior", - "" + "HorizontalRotationAcceleration" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -24501,13 +23983,11 @@ "objectGroups": [] }, { - "description": "Move the camera to look though _PARAM1_ eyes. The object must look to the right when all its angles are 0 and the top of its head be toward Z+.", - "fullName": "Look through object eyes", - "functionType": "Action", - "group": "Layers and cameras", - "name": "LookFromObjectEyes", - "private": true, - "sentence": "Move the camera to look though _PARAM0_ eyes", + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "HorizontalRotationAcceleration", + "name": "SetHorizontalRotationAcceleration", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -24515,62 +23995,12 @@ "actions": [ { "type": { - "value": "CentreCamera" - }, - "parameters": [ - "", - "Object", - "", - "Object.Layer()", - "" - ] - }, - { - "type": { - "value": "Scene3D::SetCameraZ" - }, - "parameters": [ - "", - "=", - "Object.Object3D::Z() + Object.Object3D::Depth() + OffsetZ", - "", - "" - ] - }, - { - "type": { - "value": "Scene3D::SetCameraRotationX" - }, - "parameters": [ - "", - "=", - "- Object.Object3D::RotationY() + 90", - "GetArgumentAsString(\"Layer\")", - "" - ] - }, - { - "type": { - "value": "Scene3D::SetCameraRotationY" - }, - "parameters": [ - "", - "=", - "Object.Object3D::RotationX()", - "GetArgumentAsString(\"Layer\")", - "" - ] - }, - { - "type": { - "value": "SetCameraAngle" + "value": "SetNumberVariable" }, "parameters": [ - "", + "HorizontalRotationAcceleration", "=", - "Object.Angle() + 90", - "Object.Layer()", - "" + "Value" ] } ] @@ -24592,12 +24022,12 @@ "objectGroups": [] }, { - "description": "the maximum horizontal rotation speed of the object.", - "fullName": "Maximum horizontal rotation speed", + "description": "the horizontal rotation deceleration of the object.", + "fullName": "Horizontal rotation deceleration", "functionType": "ExpressionAndCondition", "group": "First person camera gamepad mapper horizontal rotation configuration", - "name": "HorizontalRotationSpeedMax", - "sentence": "the maximum horizontal rotation speed", + "name": "HorizontalRotationDeceleration", + "sentence": "the horizontal rotation deceleration", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -24608,7 +24038,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "HorizontalRotationSpeedMax" + "HorizontalRotationDeceleration" ] } ] @@ -24635,8 +24065,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "HorizontalRotationSpeedMax", - "name": "SetHorizontalRotationSpeedMax", + "getterName": "HorizontalRotationDeceleration", + "name": "SetHorizontalRotationDeceleration", "sentence": "", "events": [ { @@ -24645,11 +24075,10 @@ "actions": [ { "type": { - "value": "Gamepads::FirstPersonGamepadMapper::SetPropertyHorizontalRotationSpeedMax" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "HorizontalRotationDeceleration", "=", "Value" ] @@ -24673,12 +24102,12 @@ "objectGroups": [] }, { - "description": "the horizontal rotation acceleration of the object.", - "fullName": "Horizontal rotation acceleration", + "description": "the maximum vertical rotation speed of the object.", + "fullName": "Maximum vertical rotation speed", "functionType": "ExpressionAndCondition", - "group": "First person camera gamepad mapper horizontal rotation configuration", - "name": "HorizontalRotationAcceleration", - "sentence": "the horizontal rotation acceleration", + "group": "First person camera gamepad mapper vertical rotation configuration", + "name": "VerticalRotationSpeedMax", + "sentence": "the maximum vertical rotation speed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -24689,7 +24118,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "HorizontalRotationAcceleration" + "VerticalRotationSpeedMax" ] } ] @@ -24716,8 +24145,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "HorizontalRotationAcceleration", - "name": "SetHorizontalRotationAcceleration", + "getterName": "VerticalRotationSpeedMax", + "name": "SetVerticalRotationSpeedMax", "sentence": "", "events": [ { @@ -24726,11 +24155,10 @@ "actions": [ { "type": { - "value": "Gamepads::FirstPersonGamepadMapper::SetPropertyHorizontalRotationAcceleration" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "VerticalRotationSpeedMax", "=", "Value" ] @@ -24754,12 +24182,12 @@ "objectGroups": [] }, { - "description": "the horizontal rotation deceleration of the object.", - "fullName": "Horizontal rotation deceleration", + "description": "the vertical rotation acceleration of the object.", + "fullName": "Vertical rotation acceleration", "functionType": "ExpressionAndCondition", - "group": "First person camera gamepad mapper horizontal rotation configuration", - "name": "HorizontalRotationDeceleration", - "sentence": "the horizontal rotation deceleration", + "group": "First person camera gamepad mapper vertical rotation configuration", + "name": "VerticalRotationAcceleration", + "sentence": "the vertical rotation acceleration", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -24770,7 +24198,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "HorizontalRotationDeceleration" + "VerticalRotationAcceleration" ] } ] @@ -24797,8 +24225,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "HorizontalRotationDeceleration", - "name": "SetHorizontalRotationDeceleration", + "getterName": "VerticalRotationAcceleration", + "name": "SetVerticalRotationAcceleration", "sentence": "", "events": [ { @@ -24807,11 +24235,10 @@ "actions": [ { "type": { - "value": "Gamepads::FirstPersonGamepadMapper::SetPropertyHorizontalRotationDeceleration" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "VerticalRotationAcceleration", "=", "Value" ] @@ -24835,12 +24262,12 @@ "objectGroups": [] }, { - "description": "the maximum vertical rotation speed of the object.", - "fullName": "Maximum vertical rotation speed", + "description": "the vertical rotation deceleration of the object.", + "fullName": "Vertical rotation deceleration", "functionType": "ExpressionAndCondition", "group": "First person camera gamepad mapper vertical rotation configuration", - "name": "VerticalRotationSpeedMax", - "sentence": "the maximum vertical rotation speed", + "name": "VerticalRotationDeceleration", + "sentence": "the vertical rotation deceleration", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -24851,7 +24278,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "VerticalRotationSpeedMax" + "VerticalRotationDeceleration" ] } ] @@ -24878,8 +24305,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "VerticalRotationSpeedMax", - "name": "SetVerticalRotationSpeedMax", + "getterName": "VerticalRotationDeceleration", + "name": "SetVerticalRotationDeceleration", "sentence": "", "events": [ { @@ -24888,11 +24315,10 @@ "actions": [ { "type": { - "value": "Gamepads::FirstPersonGamepadMapper::SetPropertyVerticalRotationSpeedMax" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "VerticalRotationDeceleration", "=", "Value" ] @@ -24916,12 +24342,12 @@ "objectGroups": [] }, { - "description": "the vertical rotation acceleration of the object.", - "fullName": "Vertical rotation acceleration", + "description": "the minimum vertical camera angle of the object.", + "fullName": "Minimum vertical camera angle", "functionType": "ExpressionAndCondition", "group": "First person camera gamepad mapper vertical rotation configuration", - "name": "VerticalRotationAcceleration", - "sentence": "the vertical rotation acceleration", + "name": "VerticalAngleMin", + "sentence": "the minimum vertical camera angle", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -24932,7 +24358,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "VerticalRotationAcceleration" + "VerticalAngleMin" ] } ] @@ -24959,8 +24385,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "VerticalRotationAcceleration", - "name": "SetVerticalRotationAcceleration", + "getterName": "VerticalAngleMin", + "name": "SetVerticalAngleMin", "sentence": "", "events": [ { @@ -24969,11 +24395,10 @@ "actions": [ { "type": { - "value": "Gamepads::FirstPersonGamepadMapper::SetPropertyVerticalRotationAcceleration" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "VerticalAngleMin", "=", "Value" ] @@ -24997,12 +24422,12 @@ "objectGroups": [] }, { - "description": "the vertical rotation deceleration of the object.", - "fullName": "Vertical rotation deceleration", + "description": "the maximum vertical camera angle of the object.", + "fullName": "Maximum vertical camera angle", "functionType": "ExpressionAndCondition", "group": "First person camera gamepad mapper vertical rotation configuration", - "name": "VerticalRotationDeceleration", - "sentence": "the vertical rotation deceleration", + "name": "VerticalAngleMax", + "sentence": "the maximum vertical camera angle", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -25013,7 +24438,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "VerticalRotationDeceleration" + "VerticalAngleMax" ] } ] @@ -25040,8 +24465,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "VerticalRotationDeceleration", - "name": "SetVerticalRotationDeceleration", + "getterName": "VerticalAngleMax", + "name": "SetVerticalAngleMax", "sentence": "", "events": [ { @@ -25050,11 +24475,10 @@ "actions": [ { "type": { - "value": "Gamepads::FirstPersonGamepadMapper::SetPropertyVerticalRotationDeceleration" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "VerticalAngleMax", "=", "Value" ] @@ -25078,12 +24502,12 @@ "objectGroups": [] }, { - "description": "the minimum vertical camera angle of the object.", - "fullName": "Minimum vertical camera angle", + "description": "the z position offset of the object.", + "fullName": "Z position offset", "functionType": "ExpressionAndCondition", - "group": "First person camera gamepad mapper vertical rotation configuration", - "name": "VerticalAngleMin", - "sentence": "the minimum vertical camera angle", + "group": "First person camera gamepad mapper position configuration", + "name": "OffsetZ", + "sentence": "the z position offset", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -25094,7 +24518,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "VerticalAngleMin" + "OffsetZ" ] } ] @@ -25121,8 +24545,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "VerticalAngleMin", - "name": "SetVerticalAngleMin", + "getterName": "OffsetZ", + "name": "SetOffsetZ", "sentence": "", "events": [ { @@ -25131,11 +24555,10 @@ "actions": [ { "type": { - "value": "Gamepads::FirstPersonGamepadMapper::SetPropertyVerticalAngleMin" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "OffsetZ", "=", "Value" ] @@ -25157,200 +24580,38 @@ } ], "objectGroups": [] - }, - { - "description": "the maximum vertical camera angle of the object.", - "fullName": "Maximum vertical camera angle", - "functionType": "ExpressionAndCondition", - "group": "First person camera gamepad mapper vertical rotation configuration", - "name": "VerticalAngleMax", - "sentence": "the maximum vertical camera angle", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "VerticalAngleMax" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "Gamepads::FirstPersonGamepadMapper", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "VerticalAngleMax", - "name": "SetVerticalAngleMax", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "Gamepads::FirstPersonGamepadMapper::SetPropertyVerticalAngleMax" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "Value" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "Gamepads::FirstPersonGamepadMapper", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "the z position offset of the object.", - "fullName": "Z position offset", - "functionType": "ExpressionAndCondition", - "group": "First person camera gamepad mapper position configuration", - "name": "OffsetZ", - "sentence": "the z position offset", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "OffsetZ" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "Gamepads::FirstPersonGamepadMapper", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "OffsetZ", - "name": "SetOffsetZ", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "Gamepads::FirstPersonGamepadMapper::SetPropertyOffsetZ" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "Value" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "Gamepads::FirstPersonGamepadMapper", - "type": "behavior" - } - ], - "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "", - "type": "Behavior", - "label": "3D capability", - "description": "", - "group": "", - "extraInformation": [ - "Scene3D::Base3DBehavior" - ], - "name": "Object3D" + } + ], + "propertyDescriptors": [ + { + "value": "", + "type": "Behavior", + "label": "3D capability", + "extraInformation": [ + "Scene3D::Base3DBehavior" + ], + "choices": [], + "name": "Object3D" }, { "value": "1", "type": "Number", "label": "Gamepad identifier (1, 2, 3 or 4)", - "description": "", - "group": "", - "extraInformation": [], "name": "GamepadIdentifier" }, { "value": "Right", "type": "Choice", "label": "Camera joystick", - "description": "", - "group": "", - "extraInformation": [ - "Left", - "Right" + "choices": [ + { + "label": "Left", + "value": "Left" + }, + { + "label": "Right", + "value": "Right" + } ], "name": "CameraStick" }, @@ -25359,27 +24620,21 @@ "type": "Number", "unit": "AngularSpeed", "label": "Maximum rotation speed", - "description": "", "group": "Horizontal rotation", - "extraInformation": [], "name": "HorizontalRotationSpeedMax" }, { "value": "360", "type": "Number", "label": "Rotation acceleration", - "description": "", "group": "Horizontal rotation", - "extraInformation": [], "name": "HorizontalRotationAcceleration" }, { "value": "720", "type": "Number", "label": "Rotation deceleration", - "description": "", "group": "Horizontal rotation", - "extraInformation": [], "name": "HorizontalRotationDeceleration" }, { @@ -25387,27 +24642,21 @@ "type": "Number", "unit": "AngularSpeed", "label": "Maximum rotation speed", - "description": "", "group": "Vertical rotation", - "extraInformation": [], "name": "VerticalRotationSpeedMax" }, { "value": "240", "type": "Number", "label": "Rotation acceleration", - "description": "", "group": "Vertical rotation", - "extraInformation": [], "name": "VerticalRotationAcceleration" }, { "value": "480", "type": "Number", "label": "Rotation deceleration", - "description": "", "group": "Vertical rotation", - "extraInformation": [], "name": "VerticalRotationDeceleration" }, { @@ -25415,9 +24664,7 @@ "type": "Number", "unit": "DegreeAngle", "label": "Minimum angle", - "description": "", "group": "Vertical rotation", - "extraInformation": [], "name": "VerticalAngleMin" }, { @@ -25425,9 +24672,7 @@ "type": "Number", "unit": "DegreeAngle", "label": "Maximum angle", - "description": "", "group": "Vertical rotation", - "extraInformation": [], "name": "VerticalAngleMax" }, { @@ -25435,9 +24680,7 @@ "type": "Number", "unit": "Pixel", "label": "Z position offset", - "description": "", "group": "Position", - "extraInformation": [], "name": "OffsetZ" }, { @@ -25445,9 +24688,6 @@ "type": "Number", "unit": "AngularSpeed", "label": "Current rotation speed Z", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "CurrentRotationSpeedZ" }, @@ -25456,9 +24696,6 @@ "type": "Number", "unit": "AngularSpeed", "label": "Current rotation speed Y", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "CurrentRotationSpeedY" } @@ -25466,10 +24703,11 @@ "sharedPropertyDescriptors": [] }, { - "description": "Control a top-down character with a gamepad.", - "fullName": "Top-down gamepad mapper", - "name": "TopDownGamepadMapper", + "description": "Control a 3D physics car with a gamepad.", + "fullName": "3D car gamepad mapper", + "name": "PhysicsCar3DGamepadMapper", "objectType": "", + "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -25498,11 +24736,12 @@ "conditions": [ { "type": { - "value": "Gamepads::TopDownGamepadMapper::PropertyUseArrows" + "value": "BooleanVariable" }, "parameters": [ - "Object", - "Behavior" + "UseArrows", + "True", + "" ] } ], @@ -25526,11 +24765,11 @@ "actions": [ { "type": { - "value": "TopDownMovementBehavior::SimulateLeftKey" + "value": "Physics3D::PhysicsCar3D::SimulateLeftKey" }, "parameters": [ "Object", - "TopDownMovement" + "PhysicsCar3D" ] } ] @@ -25553,65 +24792,58 @@ "actions": [ { "type": { - "value": "TopDownMovementBehavior::SimulateRightKey" + "value": "Physics3D::PhysicsCar3D::SimulateRightKey" }, "parameters": [ "Object", - "TopDownMovement" + "PhysicsCar3D" ] } ] - }, + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "Gamepads::C_Button_pressed" - }, - "parameters": [ - "", - "GamepadIdentifier", - "\"Up\"", - "\"Left\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "TopDownMovementBehavior::SimulateUpKey" - }, - "parameters": [ - "Object", - "TopDownMovement" - ] - } + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "UseLeftStick", + "True", + "" ] - }, + } + ], + "actions": [], + "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "value": "Gamepads::C_Button_pressed" + "value": "Gamepads::C_Axis_pushed" }, "parameters": [ "", - "GamepadIdentifier", - "\"Down\"", - "\"Left\"" + "1", + "\"Left\"", + "\"Any\"", + "" ] } ], "actions": [ { "type": { - "value": "TopDownMovementBehavior::SimulateDownKey" + "value": "Physics3D::PhysicsCar3D::SimulateSteeringStick" }, "parameters": [ "Object", - "TopDownMovement" + "PhysicsCar3D", + "Gamepads::StickForceX(GamepadIdentifier, \"Left\")" ] } ] @@ -25623,11 +24855,12 @@ "conditions": [ { "type": { - "value": "Gamepads::TopDownGamepadMapper::PropertyUseLeftStick" + "value": "BooleanVariable" }, "parameters": [ - "Object", - "Behavior" + "UseRightStick", + "True", + "" ] } ], @@ -25638,55 +24871,275 @@ "conditions": [ { "type": { - "value": "Gamepads::TopDownGamepadMapper::PropertyStickMode" + "value": "Gamepads::C_Axis_pushed" }, "parameters": [ - "Object", - "Behavior", - "=", - "\"Analog\"" + "", + "1", + "\"Right\"", + "\"Any\"", + "" ] } ], "actions": [ { "type": { - "value": "TopDownMovementBehavior::SimulateStick" + "value": "Physics3D::PhysicsCar3D::SimulateSteeringStick" }, "parameters": [ "Object", - "TopDownMovement", - "Gamepads::StickRotationValue(GamepadIdentifier, \"Left\")", - "Gamepads::StickForce(GamepadIdentifier, \"Left\")" + "PhysicsCar3D", + "Gamepads::StickForceX(GamepadIdentifier, \"Right\")" ] } ] - }, + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::Or" + }, + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "Gamepads::C_Button_pressed" + }, + "parameters": [ + "", + "1", + "\"LT\"", + "\"Up\"" + ] + }, + { + "type": { + "value": "Gamepads::C_Button_pressed" + }, + "parameters": [ + "", + "1", + "\"RT\"", + "\"Up\"" + ] + } + ] + } + ], + "actions": [ + { + "type": { + "value": "Physics3D::PhysicsCar3D::SimulateAcceleratorStick" + }, + "parameters": [ + "Object", + "PhysicsCar3D", + "Gamepads::TriggerPressure(GamepadIdentifier, \"RT\") - Gamepads::TriggerPressure(GamepadIdentifier, \"LT\")" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::C_Button_pressed" + }, + "parameters": [ + "", + "GamepadIdentifier", + "Buttons[HandBrakeButton]", + "\"Left\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "Physics3D::PhysicsCar3D::SimulateHandBrakeKey" + }, + "parameters": [ + "Object", + "PhysicsCar3D" + ] + } + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "Gamepads::PhysicsCar3DGamepadMapper", + "type": "behavior" + } + ], + "objectGroups": [] + } + ], + "propertyDescriptors": [ + { + "value": "", + "type": "Behavior", + "label": "3D physics car", + "extraInformation": [ + "Physics3D::PhysicsCar3D" + ], + "choices": [], + "name": "PhysicsCar3D" + }, + { + "value": "1", + "type": "Number", + "label": "Gamepad identifier (1, 2, 3 or 4)", + "name": "GamepadIdentifier" + }, + { + "value": "true", + "type": "Boolean", + "label": "Use directional pad", + "group": "Controls", + "name": "UseArrows" + }, + { + "value": "true", + "type": "Boolean", + "label": "Use left stick", + "group": "Controls", + "name": "UseLeftStick" + }, + { + "value": "", + "type": "Boolean", + "label": "Use right stick", + "group": "Controls", + "name": "UseRightStick" + }, + { + "value": "B or Circle", + "type": "Choice", + "label": "Hand brake button", + "group": "Controls", + "choices": [ + { + "label": "A or Cross", + "value": "A or Cross" + }, + { + "label": "B or Circle", + "value": "B or Circle" + }, + { + "label": "X or Square", + "value": "X or Square" + }, + { + "label": "Y or Triangle", + "value": "Y or Triangle" + }, + { + "label": "LB or L1", + "value": "LB or L1" + }, + { + "label": "RB or R1", + "value": "RB or R1" + }, + { + "label": "LT or L2", + "value": "LT or L2" + }, + { + "label": "RT or R2", + "value": "RT or R2" + } + ], + "name": "HandBrakeButton" + } + ], + "sharedPropertyDescriptors": [] + }, + { + "description": "Control a top-down character with a gamepad.", + "fullName": "Top-down gamepad mapper", + "name": "TopDownGamepadMapper", + "objectType": "", + "quickCustomizationVisibility": "hidden", + "eventsFunctions": [ + { + "fullName": "", + "functionType": "Action", + "name": "doStepPreEvents", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::C_Controller_X_is_connected" + }, + "parameters": [ + "", + "GamepadIdentifier", + "" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "UseArrows", + "True", + "" + ] + } + ], + "actions": [], + "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "value": "Gamepads::TopDownGamepadMapper::PropertyStickMode" + "value": "Gamepads::C_Button_pressed" }, "parameters": [ - "Object", - "Behavior", - "=", - "\"360°\"" + "", + "GamepadIdentifier", + "\"Left\"", + "\"Left\"" ] } ], "actions": [ { "type": { - "value": "TopDownMovementBehavior::SimulateStick" + "value": "TopDownMovementBehavior::SimulateLeftKey" }, "parameters": [ "Object", - "TopDownMovement", - "Gamepads::StickRotationValue(GamepadIdentifier, \"Left\")", - "sign(Gamepads::StickForce(GamepadIdentifier, \"Left\"))" + "TopDownMovement" ] } ] @@ -25696,54 +25149,208 @@ "conditions": [ { "type": { - "value": "Gamepads::TopDownGamepadMapper::PropertyStickMode" + "value": "Gamepads::C_Button_pressed" }, "parameters": [ - "Object", - "Behavior", - "=", - "\"8 Directions\"" + "", + "GamepadIdentifier", + "\"Right\"", + "\"Left\"" ] } ], - "actions": [], - "events": [ + "actions": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "Gamepads::C_Axis_pushed" - }, - "parameters": [ - "", - "GamepadIdentifier", - "\"Left\"", - "\"Left\"", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "TopDownMovementBehavior::SimulateLeftKey" - }, - "parameters": [ - "Object", - "TopDownMovement" - ] - } + "type": { + "value": "TopDownMovementBehavior::SimulateRightKey" + }, + "parameters": [ + "Object", + "TopDownMovement" ] - }, + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "Gamepads::C_Axis_pushed" - }, - "parameters": [ + "type": { + "value": "Gamepads::C_Button_pressed" + }, + "parameters": [ + "", + "GamepadIdentifier", + "\"Up\"", + "\"Left\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "TopDownMovementBehavior::SimulateUpKey" + }, + "parameters": [ + "Object", + "TopDownMovement" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::C_Button_pressed" + }, + "parameters": [ + "", + "GamepadIdentifier", + "\"Down\"", + "\"Left\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "TopDownMovementBehavior::SimulateDownKey" + }, + "parameters": [ + "Object", + "TopDownMovement" + ] + } + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "UseLeftStick", + "True", + "" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "StickMode", + "=", + "\"Analog\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "TopDownMovementBehavior::SimulateStick" + }, + "parameters": [ + "Object", + "TopDownMovement", + "Gamepads::StickRotationValue(GamepadIdentifier, \"Left\")", + "Gamepads::StickForce(GamepadIdentifier, \"Left\")" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "StickMode", + "=", + "\"360°\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "TopDownMovementBehavior::SimulateStick" + }, + "parameters": [ + "Object", + "TopDownMovement", + "Gamepads::StickRotationValue(GamepadIdentifier, \"Left\")", + "sign(Gamepads::StickForce(GamepadIdentifier, \"Left\"))" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "StickMode", + "=", + "\"8 Directions\"" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::C_Axis_pushed" + }, + "parameters": [ + "", + "GamepadIdentifier", + "\"Left\"", + "\"Left\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "TopDownMovementBehavior::SimulateLeftKey" + }, + "parameters": [ + "Object", + "TopDownMovement" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::C_Axis_pushed" + }, + "parameters": [ "", "GamepadIdentifier", "\"Left\"", @@ -25829,11 +25436,12 @@ "conditions": [ { "type": { - "value": "Gamepads::TopDownGamepadMapper::PropertyUseRightStick" + "value": "BooleanVariable" }, "parameters": [ - "Object", - "Behavior" + "UseRightStick", + "True", + "" ] } ], @@ -25844,11 +25452,10 @@ "conditions": [ { "type": { - "value": "Gamepads::TopDownGamepadMapper::PropertyStickMode" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "StickMode", "=", "\"Analog\"" ] @@ -25873,11 +25480,10 @@ "conditions": [ { "type": { - "value": "Gamepads::TopDownGamepadMapper::PropertyStickMode" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "StickMode", "=", "\"360°\"" ] @@ -25902,11 +25508,10 @@ "conditions": [ { "type": { - "value": "Gamepads::TopDownGamepadMapper::PropertyStickMode" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "StickMode", "=", "\"8 Directions\"" ] @@ -26054,59 +25659,57 @@ "value": "", "type": "Behavior", "label": "Top-down movement behavior", - "description": "", - "group": "", "extraInformation": [ "TopDownMovementBehavior::TopDownMovementBehavior" ], + "choices": [], "name": "TopDownMovement" }, { "value": "1", "type": "Number", "label": "Gamepad identifier (1, 2, 3 or 4)", - "description": "", - "group": "", - "extraInformation": [], "name": "GamepadIdentifier" }, { "value": "true", "type": "Boolean", "label": "Use directional pad", - "description": "", "group": "Controls", - "extraInformation": [], "name": "UseArrows" }, { "value": "true", "type": "Boolean", "label": "Use left stick", - "description": "", "group": "Controls", - "extraInformation": [], "name": "UseLeftStick" }, { "value": "", "type": "Boolean", "label": "Use right stick", - "description": "", "group": "Controls", - "extraInformation": [], "name": "UseRightStick" }, { "value": "Analog", "type": "Choice", "label": "Stick mode", - "description": "", "group": "Controls", - "extraInformation": [ - "Analog", - "360°", - "8 Directions" + "choices": [ + { + "label": "Analog", + "value": "Analog" + }, + { + "label": "360°", + "value": "360°" + }, + { + "label": "8 Directions", + "value": "8 Directions" + } ], "name": "StickMode" } @@ -26121,13 +25724,14 @@ "category": "Input", "extensionNamespace": "", "fullName": "3D character keyboard mapper", + "gdevelopVersion": ">=5.5.222", "helpPath": "", "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyMy4wLjMsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iSWNvbnMiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB2aWV3Qm94PSIwIDAgMzIgMzIiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDMyIDMyOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8c3R5bGUgdHlwZT0idGV4dC9jc3MiPg0KCS5zdDB7ZmlsbDpub25lO3N0cm9rZTojMDAwMDAwO3N0cm9rZS13aWR0aDoyO3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1saW5lam9pbjpyb3VuZDtzdHJva2UtbWl0ZXJsaW1pdDoxMDt9DQo8L3N0eWxlPg0KPHBhdGggZD0iTTI5LDE0aC00LjJjMC4xLTAuMywwLjItMC42LDAuMi0xYzAtMS43LTEuMy0zLTMtM0g4Yy0wLjYsMC0xLTAuNC0xLTFzMC40LTEsMS0xaDZjMS43LDAsMy0xLjMsMy0zVjJjMC0wLjYtMC40LTEtMS0xDQoJcy0xLDAuNC0xLDF2M2MwLDAuNi0wLjQsMS0xLDFIOEM2LjMsNiw1LDcuMyw1LDlzMS4zLDMsMywzaDE0YzAuNiwwLDEsMC40LDEsMXMtMC40LDEtMSwxSDNjLTAuNiwwLTEsMC40LTEsMXYxNGMwLDAuNiwwLjQsMSwxLDENCgloMjZjMC42LDAsMS0wLjQsMS0xVjE1QzMwLDE0LjQsMjkuNiwxNCwyOSwxNHogTTcsMThoMmMwLjYsMCwxLDAuNCwxLDFjMC0wLjYsMC40LTEsMS0xaDJjMC42LDAsMSwwLjQsMSwxYzAtMC42LDAuNC0xLDEtMWgyDQoJYzAuNiwwLDEsMC40LDEsMWMwLTAuNiwwLjQtMSwxLTFoMmMwLjYsMCwxLDAuNCwxLDFjMC0wLjYsMC40LTEsMS0xaDJjMC42LDAsMSwwLjQsMSwxcy0wLjQsMS0xLDFoLTJjLTAuNiwwLTEtMC40LTEtMQ0KCWMwLDAuNi0wLjQsMS0xLDFoLTJjLTAuNiwwLTEtMC40LTEtMWMwLDAuNi0wLjQsMS0xLDFoLTJjLTAuNiwwLTEtMC40LTEtMWMwLDAuNi0wLjQsMS0xLDFoLTJjLTAuNiwwLTEtMC40LTEtMWMwLDAuNi0wLjQsMS0xLDFINw0KCWMtMC42LDAtMS0wLjQtMS0xUzYuNCwxOCw3LDE4eiBNMTksMjJjMCwwLjEsMCwwLjMtMC4xLDAuNHMtMC4xLDAuMi0wLjIsMC4zYzAsMC0wLjEsMC4xLTAuMiwwLjFjMCwwLTAuMSwwLjEtMC4yLDAuMQ0KCWMtMC4xLDAtMC4xLDAtMC4yLDAuMWMtMC4xLDAtMC4xLDAtMC4yLDBjLTAuMSwwLTAuMSwwLTAuMiwwYy0wLjEsMC0wLjEsMC0wLjItMC4xYy0wLjEsMC0wLjEtMC4xLTAuMi0wLjFjMCwwLTAuMS0wLjEtMC4xLTAuMQ0KCWMtMC4xLTAuMS0wLjItMC4yLTAuMi0wLjNDMTcsMjIuMywxNywyMi4xLDE3LDIyYzAtMC4xLDAtMC4zLDAuMS0wLjRjMC0wLjEsMC4xLTAuMiwwLjItMC4zYzAsMCwwLjEtMC4xLDAuMS0wLjENCgljMC4xLDAsMC4xLTAuMSwwLjItMC4xYzAuMSwwLDAuMSwwLDAuMi0wLjFjMC4xLDAsMC4zLDAsMC40LDBjMC4xLDAsMC4xLDAsMC4yLDAuMWMwLjEsMCwwLjEsMC4xLDAuMiwwLjFjMC4xLDAsMC4xLDAuMSwwLjIsMC4xDQoJYzAuMSwwLjEsMC4yLDAuMiwwLjIsMC4zQzE5LDIxLjcsMTksMjEuOSwxOSwyMnogTTE1LDIyYzAsMC4xLDAsMC4zLTAuMSwwLjRzLTAuMSwwLjItMC4yLDAuM2MwLDAtMC4xLDAuMS0wLjIsMC4xDQoJYzAsMC0wLjEsMC4xLTAuMiwwLjFjLTAuMSwwLTAuMSwwLTAuMiwwLjFjLTAuMSwwLTAuMSwwLTAuMiwwYy0wLjMsMC0wLjUtMC4xLTAuNy0wLjNjLTAuMS0wLjEtMC4yLTAuMi0wLjItMC4zDQoJQzEzLDIyLjMsMTMsMjIuMSwxMywyMmMwLTAuMSwwLTAuMSwwLTAuMmMwLTAuMSwwLTAuMSwwLjEtMC4yYzAtMC4xLDAtMC4xLDAuMS0wLjJjMC0wLjEsMC4xLTAuMSwwLjEtMC4xYzAuMi0wLjIsMC42LTAuMywwLjktMC4zDQoJYzAuMSwwLDAuMSwwLDAuMiwwLjFjMC4xLDAsMC4xLDAuMSwwLjIsMC4xYzAuMSwwLDAuMSwwLjEsMC4yLDAuMWMwLDAsMC4xLDAuMSwwLjEsMC4xYzAsMC4xLDAuMSwwLjEsMC4xLDAuMmMwLDAuMSwwLDAuMSwwLjEsMC4yDQoJQzE1LDIxLjksMTUsMjEuOSwxNSwyMnogTTUsMjJjMC0wLjEsMC0wLjMsMC4xLTAuNGMwLTAuMSwwLjEtMC4yLDAuMi0wLjNjMC4yLTAuMiwwLjYtMC4zLDAuOS0wLjNjMC4xLDAsMC4xLDAsMC4yLDAuMQ0KCWMwLjEsMCwwLjEsMC4xLDAuMiwwLjFjMCwwLDAuMSwwLjEsMC4yLDAuMWMwLjEsMC4xLDAuMiwwLjIsMC4yLDAuM0M3LDIxLjcsNywyMS45LDcsMjJjMCwwLjMtMC4xLDAuNS0wLjMsMC43YzAsMC0wLjEsMC4xLTAuMiwwLjENCgljLTAuMSwwLTAuMSwwLjEtMC4yLDAuMWMtMC4xLDAtMC4xLDAtMC4yLDAuMWMtMC4xLDAtMC4xLDAtMC4yLDBjLTAuMywwLTAuNS0wLjEtMC43LTAuM0M1LjEsMjIuNSw1LDIyLjMsNSwyMnogTTgsMjZINw0KCWMtMC42LDAtMS0wLjQtMS0xczAuNC0xLDEtMWgxYzAuNiwwLDEsMC40LDEsMVM4LjYsMjYsOCwyNnogTTEwLjksMjIuNGMwLDAuMSwwLDAuMS0wLjEsMC4yYzAsMC0wLjEsMC4xLTAuMSwwLjENCglDMTAuNSwyMi45LDEwLjMsMjMsMTAsMjNjLTAuMSwwLTAuMywwLTAuNC0wLjFjLTAuMS0wLjEtMC4yLTAuMS0wLjMtMC4yYzAtMC4xLTAuMS0wLjEtMC4xLTAuMWMwLTAuMS0wLjEtMC4xLTAuMS0wLjINCgljMC0wLjEsMC0wLjEtMC4xLTAuMmMwLTAuMSwwLTAuMSwwLTAuMmMwLTAuMywwLjEtMC41LDAuMy0wLjdjMC4xLTAuMSwwLjItMC4yLDAuMy0wLjJjMC40LTAuMiwwLjgtMC4xLDEuMSwwLjINCgljMC4yLDAuMiwwLjMsMC40LDAuMywwLjdjMCwwLjEsMCwwLjEsMCwwLjJDMTEsMjIuMywxMSwyMi4zLDEwLjksMjIuNHogTTIwLDI2aC04Yy0wLjYsMC0xLTAuNC0xLTFzMC40LTEsMS0xaDhjMC42LDAsMSwwLjQsMSwxDQoJUzIwLjYsMjYsMjAsMjZ6IE0yMi45LDIyLjRjMCwwLjEsMCwwLjEtMC4xLDAuMmMwLDAtMC4xLDAuMS0wLjEsMC4xYzAsMC0wLjEsMC4xLTAuMiwwLjFjMCwwLTAuMSwwLjEtMC4yLDAuMWMtMC4xLDAtMC4xLDAtMC4yLDAuMQ0KCWMtMC4xLDAtMC4xLDAtMC4yLDBjLTAuMSwwLTAuMSwwLTAuMiwwYy0wLjEsMC0wLjEsMC0wLjItMC4xYy0wLjEsMC0wLjEtMC4xLTAuMi0wLjFjMCwwLTAuMS0wLjEtMC4xLTAuMWMwLTAuMS0wLjEtMC4xLTAuMS0wLjENCgljMC0wLjEtMC4xLTAuMS0wLjEtMC4yYzAtMC4xLDAtMC4xLTAuMS0wLjJjMC0wLjEsMC0wLjEsMC0wLjJjMC0wLjMsMC4xLTAuNSwwLjMtMC43YzAsMCwwLjEtMC4xLDAuMS0wLjFjMC4xLDAsMC4xLTAuMSwwLjItMC4xDQoJYzAuMSwwLDAuMSwwLDAuMi0wLjFjMC4xLDAsMC4zLDAsMC40LDBjMC4xLDAsMC4xLDAsMC4yLDAuMWMwLjEsMCwwLjEsMC4xLDAuMiwwLjFjMC4xLDAsMC4xLDAuMSwwLjIsMC4xYzAuMiwwLjIsMC4zLDAuNCwwLjMsMC43DQoJYzAsMC4xLDAsMC4xLDAsMC4yQzIzLDIyLjMsMjMsMjIuMywyMi45LDIyLjR6IE0yNSwyNmgtMWMtMC42LDAtMS0wLjQtMS0xczAuNC0xLDEtMWgxYzAuNiwwLDEsMC40LDEsMVMyNS42LDI2LDI1LDI2eiBNMjYuNywyMi43DQoJQzI2LjUsMjIuOSwyNi4zLDIzLDI2LDIzYy0wLjEsMC0wLjEsMC0wLjIsMGMtMC4xLDAtMC4xLDAtMC4yLTAuMWMtMC4xLDAtMC4xLTAuMS0wLjItMC4xYy0wLjEsMC0wLjEtMC4xLTAuMi0wLjENCglDMjUuMSwyMi41LDI1LDIyLjMsMjUsMjJjMC0wLjEsMC0wLjMsMC4xLTAuNGMwLTAuMSwwLjEtMC4yLDAuMi0wLjNjMCwwLDAuMS0wLjEsMC4yLTAuMWMwLDAsMC4xLTAuMSwwLjItMC4xYzAuMSwwLDAuMSwwLDAuMi0wLjENCgljMC4zLTAuMSwwLjcsMCwwLjksMC4zYzAuMiwwLjIsMC4zLDAuNCwwLjMsMC43QzI3LDIyLjMsMjYuOSwyMi41LDI2LjcsMjIuN3oiLz4NCjwvc3ZnPg0K", "name": "PhysicsCharacter3DKeyMapper", "previewIconUrl": "https://asset-resources.gdevelop.io/public-resources/Icons/Glyphster Pack/Master/SVG/Computers and Hardware/3e5871434a72821bf3ecb44a6857e62a438cf23dc8f95966f56ae97e95315468_Computers and Hardware_keyboard.svg", "shortDescription": "3D platformer and 3D shooter keyboard controls.", - "version": "1.0.0", - "description": "3D platformer and 3D shooter keyboard controls.", + "version": "1.1.1", + "description": "3D platformer and 3D shooter keyboard controls. Add one of the \"mapper\" behaviors on an object having the \"3D physics character\" behavior so that it is controlled by the keyboard.", "origin": { "identifier": "PhysicsCharacter3DKeyMapper", "name": "gdevelop-extension-store" @@ -26161,22 +25765,22 @@ { "type": { "inverted": true, - "value": "PhysicsCharacter3DKeyMapper::Platformer3DKeyboardMapper::PropertyLockedCameraAngle" + "value": "BooleanVariable" }, "parameters": [ - "Object", - "Behavior" + "LockedCameraAngle", + "True", + "" ] } ], "actions": [ { "type": { - "value": "PhysicsCharacter3DKeyMapper::Platformer3DKeyboardMapper::SetPropertyCameraAngle" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "CameraAngle", "=", "CameraAngle(Object.Layer())" ] @@ -26189,11 +25793,11 @@ "actions": [ { "type": { - "value": "PhysicsCharacter3DKeyMapper::Platformer3DKeyboardMapper::SetPropertyLockedCameraAngle" + "value": "SetBooleanVariable" }, "parameters": [ - "Object", - "Behavior", + "LockedCameraAngle", + "False", "" ] } @@ -26627,11 +26231,12 @@ "conditions": [ { "type": { - "value": "PhysicsCharacter3DKeyMapper::Platformer3DKeyboardMapper::PropertyLockedCameraAngle" + "value": "BooleanVariable" }, "parameters": [ - "Object", - "Behavior" + "LockedCameraAngle", + "True", + "" ] } ], @@ -26676,22 +26281,24 @@ { "type": { "inverted": true, - "value": "GetArgumentAsBoolean" + "value": "BooleanVariable" }, "parameters": [ - "\"Value\"" + "Value", + "True", + "" ] } ], "actions": [ { "type": { - "value": "PhysicsCharacter3DKeyMapper::Platformer3DKeyboardMapper::SetPropertyLockedCameraAngle" + "value": "SetBooleanVariable" }, "parameters": [ - "Object", - "Behavior", - "no" + "LockedCameraAngle", + "False", + "" ] } ] @@ -26701,22 +26308,24 @@ "conditions": [ { "type": { - "value": "GetArgumentAsBoolean" + "value": "BooleanVariable" }, "parameters": [ - "\"Value\"" + "Value", + "True", + "" ] } ], "actions": [ { "type": { - "value": "PhysicsCharacter3DKeyMapper::Platformer3DKeyboardMapper::SetPropertyLockedCameraAngle" + "value": "SetBooleanVariable" }, "parameters": [ - "Object", - "Behavior", - "yes" + "LockedCameraAngle", + "True", + "" ] } ] @@ -26750,65 +26359,47 @@ "value": "", "type": "Behavior", "label": "3D physics character", - "description": "", - "group": "", "extraInformation": [ "Physics3D::PhysicsCharacter3D" ], + "choices": [], "name": "PhysicsCharacter3D" }, { "value": "Space", - "type": "String", + "type": "KeyboardKey", "label": "Jump key", - "description": "", - "group": "", - "extraInformation": [], "name": "Jump" }, { "value": "w", - "type": "String", + "type": "KeyboardKey", "label": "Up key", - "description": "", - "group": "", - "extraInformation": [], "name": "Up" }, { "value": "a", - "type": "String", + "type": "KeyboardKey", "label": "Left key", - "description": "", - "group": "", - "extraInformation": [], "name": "Left" }, { "value": "s", - "type": "String", + "type": "KeyboardKey", "label": "Down key", - "description": "", - "group": "", - "extraInformation": [], "name": "Down" }, { "value": "d", - "type": "String", + "type": "KeyboardKey", "label": "Right key", - "description": "", - "group": "", - "extraInformation": [], "name": "Right" }, { "value": "0", "type": "Number", + "unit": "DegreeAngle", "label": "", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "CameraAngle" }, @@ -26816,9 +26407,6 @@ "value": "", "type": "Boolean", "label": "Camera is locked for the frame", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "LockedCameraAngle" } @@ -26984,56 +26572,40 @@ "value": "", "type": "Behavior", "label": "3D physics character", - "description": "", - "group": "", "extraInformation": [ "Physics3D::PhysicsCharacter3D" ], + "choices": [], "name": "PhysicsCharacter3D" }, { "value": "Space", - "type": "String", + "type": "KeyboardKey", "label": "Jump key", - "description": "", - "group": "", - "extraInformation": [], "name": "Jump" }, { "value": "w", - "type": "String", + "type": "KeyboardKey", "label": "Up key", - "description": "", - "group": "", - "extraInformation": [], "name": "Up" }, { "value": "a", - "type": "String", + "type": "KeyboardKey", "label": "Left key", - "description": "", - "group": "", - "extraInformation": [], "name": "Left" }, { "value": "s", - "type": "String", + "type": "KeyboardKey", "label": "Down key", - "description": "", - "group": "", - "extraInformation": [], "name": "Down" }, { "value": "d", - "type": "String", + "type": "KeyboardKey", "label": "Right key", - "description": "", - "group": "", - "extraInformation": [], "name": "Right" } ], @@ -27047,12 +26619,13 @@ "category": "General", "extensionNamespace": "", "fullName": "3D raycast", + "gdevelopVersion": ">=5.5.222", "helpPath": "", "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0ibWRpLXJheS1zdGFydC1hcnJvdyIgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0IiB2aWV3Qm94PSIwIDAgMjQgMjQiPjxwYXRoIGQ9Ik0yMywxMkwxOSwxNlYxM0g2LjgzQzYuNDIsMTQuMTcgNS4zMSwxNSA0LDE1QTMsMyAwIDAsMSAxLDEyQTMsMyAwIDAsMSA0LDlDNS4zMSw5IDYuNDIsOS44MyA2LjgzLDExSDE5VjhMMjMsMTJaIiAvPjwvc3ZnPg==", "name": "Raycaster3D", "previewIconUrl": "https://asset-resources.gdevelop.io/public-resources/Icons/8419f46b76bce482c14b4c03b4141a64d457e4cdc92686f3470381f5d2694abd_ray-start-arrow.svg", "shortDescription": "Find 3D objects that cross a line.", - "version": "0.1.4", + "version": "0.1.7", "description": [ "It can be useful to:", "- Find 3D objects under the pointer", @@ -27109,207 +26682,187 @@ "sentence": "Define helper classes JavaScript code", "events": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "GlobalVariableAsBoolean" - }, - "parameters": [ - "_Raycaster3DExtension_ClassesDefined", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetGlobalVariableAsBoolean" - }, - "parameters": [ - "_Raycaster3DExtension_ClassesDefined", - "True" - ] - } + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "if (gdjs.__raycaster3DExtension) {", + " return;", + "}", + "", + "class Raycaster {", + " raycaster = new THREE.Raycaster();", + " pointer = new THREE.Vector2();", + " /** @type {Array} */", + " raycastResults = [];", + " lastDistance = 0;", + " lastPositionX = 0;", + " lastPositionY = 0;", + " lastPositionZ = 0;", + " lastNormal = new THREE.Vector3();", + "", + " /**", + " * @param objectsLists {Hashtable}", + " * @param objects {gdjs.RuntimeObject[]}", + " * @param pointerX {number}", + " * @param pointerY {number}", + " * @param distanceMax {number}", + " */", + " recastFromCamera(objectsLists, objects, pointerX, pointerY, distanceMax) {", + " if (objects.length === 0) {", + " return false;", + " }", + " const object = objects[0];", + " const layer = object.getInstanceContainer().getLayer(object.getLayer());", + " const camera = layer.getRenderer().getThreeCamera();", + "", + " const raycaster = this.raycaster;", + " const pointer = this.pointer;", + " pointer.x = -1 + 2 * pointerX;", + " pointer.y = 1 - 2 * pointerY;", + " raycaster.setFromCamera(pointer, camera);", + " raycaster.far = distanceMax;", + "", + " return this._doRecast(objectsLists, objects);", + " }", + "", + " /**", + " * @param objectsLists {Hashtable}", + " * @param objects {gdjs.RuntimeObject[]}", + " * @param originX {number}", + " * @param originY {number}", + " * @param originZ {number}", + " * @param rotationAngle {number}", + " * @param elevationAngle {number}", + " * @param distanceMax {number}", + " */", + " recastWithAngle(", + " objectsLists,", + " objects,", + " originX,", + " originY,", + " originZ,", + " rotationAngle,", + " elevationAngle,", + " distanceMax", + " ) {", + " if (objects.length === 0) {", + " return false;", + " }", + " const raycaster = this.raycaster;", + " raycaster.ray.origin.set(", + " originX,", + " -originY,", + " originZ,", + " );", + " const rotation = rotationAngle * Math.PI / 180;", + " const elevation = elevationAngle * Math.PI / 180;", + " const cosElevation = Math.cos(elevation);", + " raycaster.ray.direction.set(", + " Math.cos(rotation) * cosElevation,", + " -Math.sin(rotation) * cosElevation,", + " Math.sin(elevation),", + " );", + " raycaster.far = distanceMax;", + "", + " return this._doRecast(objectsLists, objects);", + " }", + "", + " /**", + " * @param objectsLists {Hashtable}", + " * @param objects {gdjs.RuntimeObject[]}", + " * @param originX {number}", + " * @param originY {number}", + " * @param originZ {number}", + " * @param targetX {number}", + " * @param targetY {number}", + " * @param targetZ {number}", + " * @param distanceMax {number}", + " */", + " recastBetweenPosition(", + " objectsLists,", + " objects,", + " originX,", + " originY,", + " originZ,", + " targetX,", + " targetY,", + " targetZ", + " ) {", + " if (objects.length === 0) {", + " return false;", + " }", + " const raycaster = this.raycaster;", + " raycaster.ray.origin.set(", + " originX,", + " -originY,", + " originZ,", + " );", + " const deltaX = targetX - originX;", + " const deltaY = targetY - originY;", + " const deltaZ = targetZ - originZ;", + " const deltaLength = Math.hypot(deltaX, deltaY, deltaZ);", + " raycaster.ray.direction.set(", + " deltaX / deltaLength,", + " -deltaY / deltaLength,", + " deltaZ / deltaLength,", + " );", + " raycaster.far = deltaLength;", + "", + " return this._doRecast(objectsLists, objects);", + " }", + "", + " /**", + " * @param objectsLists {Hashtable}", + " * @param objects {gdjs.RuntimeObject[]}", + " */", + " _doRecast(objectsLists, objects) {", + " const raycastResults = this.raycastResults;", + " let distanceMin = Number.MAX_VALUE;", + " /** @type {gdjs.RuntimeObject | null} */", + " let nearestObject = null;", + " /** @type {THREE.Object3D | null} */", + " let nearestThreeObject = null;", + " for (const object of objects) {", + " raycastResults.length = 0;", + " const threeObject = object.get3DRendererObject();", + " if (!threeObject) {", + " continue;", + " }", + " this.raycaster.intersectObject(threeObject, true, raycastResults);", + " if (raycastResults.length > 0 && raycastResults[0].distance < distanceMin) {", + " const raycastResult = raycastResults[0];", + " distanceMin = raycastResult.distance;", + " nearestObject = object;", + " this.lastDistance = raycastResult.distance;", + " this.lastPositionX = raycastResult.point.x;", + " this.lastPositionY = -raycastResult.point.y;", + " this.lastPositionZ = raycastResult.point.z;", + " this.lastNormal.copy(raycastResult.normal);", + " nearestThreeObject = raycastResult.object;", + " }", + " }", + " if (!nearestObject) {", + " return false;", + " }", + " this.lastNormal.transformDirection(nearestThreeObject.matrixWorld);", + " this.lastNormal.y = -this.lastNormal.y;", + " raycastResults.length = 0;", + " gdjs.evtTools.object.pickOnly(", + " objectsLists,", + " nearestObject", + " );", + " return true;", + " }", + "}", + "", + "gdjs.__raycaster3DExtension = {", + " Raycaster,", + " raycaster: new Raycaster(),", + "}", + "" ], - "events": [ - { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "gdjs.__raycaster3DExtension = gdjs.__raycaster3DExtension || {};", - "", - "class Raycaster {", - " raycaster = new THREE.Raycaster();", - " pointer = new THREE.Vector2();", - " raycastResults = [];", - " lastDistance = 0;", - " lastPositionX = 0;", - " lastPositionY = 0;", - " lastPositionZ = 0;", - " lastNormalX = 0;", - " lastNormalY = 0;", - " lastNormalZ = 0;", - "", - " /**", - " * @param objectsLists {Hashtable}", - " * @param objects {gdjs.RuntimeObject[]}", - " * @param pointerX {number}", - " * @param pointerY {number}", - " * @param distanceMax {number}", - " */", - " recastFromCamera(objectsLists, objects, pointerX, pointerY, distanceMax) {", - " if (objects.length === 0) {", - " return false;", - " }", - " const object = objects[0];", - " const layer = object.getInstanceContainer().getLayer(object.getLayer());", - " const camera = layer.getRenderer().getThreeCamera();", - "", - " const raycaster = this.raycaster;", - " const pointer = this.pointer;", - " pointer.x = -1 + 2 * pointerX;", - " pointer.y = 1 - 2 * pointerY;", - " raycaster.setFromCamera(pointer, camera);", - " raycaster.far = distanceMax;", - "", - " return this._doRecast(objectsLists, objects);", - " }", - "", - " /**", - " * @param objectsLists {Hashtable}", - " * @param objects {gdjs.RuntimeObject[]}", - " * @param originX {number}", - " * @param originY {number}", - " * @param originZ {number}", - " * @param rotationAngle {number}", - " * @param elevationAngle {number}", - " * @param distanceMax {number}", - " */", - " recastWithAngle(", - " objectsLists,", - " objects,", - " originX,", - " originY,", - " originZ,", - " rotationAngle,", - " elevationAngle,", - " distanceMax", - " ) {", - " if (objects.length === 0) {", - " return false;", - " }", - " const raycaster = this.raycaster;", - " raycaster.ray.origin.set(", - " originX,", - " -originY,", - " originZ,", - " );", - " const rotation = rotationAngle * Math.PI / 180;", - " const elevation = elevationAngle * Math.PI / 180;", - " const cosElevation = Math.cos(elevation);", - " raycaster.ray.direction.set(", - " Math.cos(rotation) * cosElevation,", - " -Math.sin(rotation) * cosElevation,", - " Math.sin(elevation),", - " );", - " raycaster.far = distanceMax;", - "", - " return this._doRecast(objectsLists, objects);", - " }", - "", - " /**", - " * @param objectsLists {Hashtable}", - " * @param objects {gdjs.RuntimeObject[]}", - " * @param originX {number}", - " * @param originY {number}", - " * @param originZ {number}", - " * @param targetX {number}", - " * @param targetY {number}", - " * @param targetZ {number}", - " * @param distanceMax {number}", - " */", - " recastBetweenPosition(", - " objectsLists,", - " objects,", - " originX,", - " originY,", - " originZ,", - " targetX,", - " targetY,", - " targetZ", - " ) {", - " if (objects.length === 0) {", - " return false;", - " }", - " const raycaster = this.raycaster;", - " raycaster.ray.origin.set(", - " originX,", - " -originY,", - " originZ,", - " );", - " const deltaX = targetX - originX;", - " const deltaY = targetY - originY;", - " const deltaZ = targetZ - originZ;", - " const deltaLength = Math.hypot(deltaX, deltaY, deltaZ);", - " raycaster.ray.direction.set(", - " deltaX / deltaLength,", - " -deltaY / deltaLength,", - " deltaZ / deltaLength,", - " );", - " raycaster.far = deltaLength;", - "", - " return this._doRecast(objectsLists, objects);", - " }", - "", - " /**", - " * @param objectsLists {Hashtable}", - " * @param objects {gdjs.RuntimeObject[]}", - " */", - " _doRecast(objectsLists, objects) {", - " const raycastResults = this.raycastResults;", - " let distanceMin = Number.MAX_VALUE;", - " let nearestObject = null;", - " for (const object of objects) {", - " raycastResults.length = 0;", - " const threeObject = object.get3DRendererObject();", - " if (!threeObject) {", - " continue;", - " }", - " this.raycaster.intersectObject(threeObject, true, raycastResults);", - " if (raycastResults.length > 0 && raycastResults[0].distance < distanceMin) {", - " const raycastResult = raycastResults[0];", - " distanceMin = raycastResult.distance;", - " nearestObject = object;", - " this.lastDistance = raycastResult.distance;", - " this.lastPositionX = raycastResult.point.x;", - " this.lastPositionY = -raycastResult.point.y;", - " this.lastPositionZ = raycastResult.point.z;", - " this.lastNormalX = raycastResult.normal.x;", - " this.lastNormalY = raycastResult.normal.y;", - " this.lastNormalZ = raycastResult.normal.z;", - " }", - " }", - " if (!nearestObject) {", - " return false;", - " }", - " raycastResults.length = 0;", - " gdjs.evtTools.object.pickOnly(", - " objectsLists,", - " nearestObject", - " );", - " return true;", - " }", - "}", - "", - "gdjs.__raycaster3DExtension.Raycaster = Raycaster;", - "gdjs.__raycaster3DExtension.raycaster = new Raycaster();", - "" - ], - "parameterObjects": "", - "useStrict": true, - "eventsSheetExpanded": true - } - ] + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": true } ], "parameters": [], @@ -27541,6 +27094,63 @@ ], "objectGroups": [] }, + { + "description": "Sends a ray from the cursor on the camera screen, intersecting the closest object. The intersected object will become the only one taken into account.", + "fullName": "Raycast from cursor", + "functionType": "Condition", + "group": "Collision", + "name": "RaycastFromCameraCursor", + "sentence": "Cast a ray from the cursor on 2D layer: _PARAM2_ to a maximum distance of _PARAM3_ against _PARAM1_", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const { camera, input } = gdjs.evtTools;", + "", + "const layer2D = eventsFunctionContext.getArgument(\"Layer2D\");", + "", + "const cameraMinX = camera.getCameraBorderLeft(runtimeScene, layer2D, 0);", + "const cameraMaxX = camera.getCameraBorderRight(runtimeScene, layer2D, 0);", + "const cameraMinY = camera.getCameraBorderTop(runtimeScene, layer2D, 0);", + "const cameraMaxY = camera.getCameraBorderBottom(runtimeScene, layer2D, 0);", + "", + "const cursorX = input.getCursorX(runtimeScene, layer2D, 0);", + "const cursorY = input.getCursorY(runtimeScene, layer2D, 0);", + "", + "eventsFunctionContext.returnValue =", + " gdjs.__raycaster3DExtension.raycaster.recastFromCamera(", + " eventsFunctionContext.getObjectsLists(\"Object\"),", + " objects,", + " (cursorX - cameraMinX) / (cameraMaxX - cameraMinX),", + " (cursorY - cameraMinY) / (cameraMaxY - cameraMinY),", + " eventsFunctionContext.getArgument(\"DistanceMax\")", + " );", + "" + ], + "parameterObjects": "Object", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "parameters": [ + { + "description": "Objects to test against the ray", + "name": "Object", + "type": "objectList" + }, + { + "description": "2D layer", + "name": "Layer2D", + "type": "layer" + }, + { + "description": "Ray maximum distance (in pixels)", + "name": "DistanceMax", + "type": "expression" + } + ], + "objectGroups": [] + }, { "description": "the last recast intersection distance.", "fullName": "Last recast distance", @@ -27634,7 +27244,7 @@ "events": [ { "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": "eventsFunctionContext.returnValue = gdjs.__raycaster3DExtension.raycaster.lastNormalX;", + "inlineCode": "eventsFunctionContext.returnValue = gdjs.__raycaster3DExtension.raycaster.lastNormal.x;", "parameterObjects": "", "useStrict": true, "eventsSheetExpanded": false @@ -27655,7 +27265,7 @@ "events": [ { "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": "eventsFunctionContext.returnValue = gdjs.__raycaster3DExtension.raycaster.lastNormalY;", + "inlineCode": "eventsFunctionContext.returnValue = gdjs.__raycaster3DExtension.raycaster.lastNormal.y;", "parameterObjects": "", "useStrict": true, "eventsSheetExpanded": false @@ -27676,7 +27286,7 @@ "events": [ { "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": "eventsFunctionContext.returnValue = gdjs.__raycaster3DExtension.raycaster.lastNormalZ;", + "inlineCode": "eventsFunctionContext.returnValue = gdjs.__raycaster3DExtension.raycaster.lastNormal.z;", "parameterObjects": "", "useStrict": true, "eventsSheetExpanded": false @@ -27697,12 +27307,13 @@ "category": "Camera", "extensionNamespace": "", "fullName": "3D camera shake", + "gdevelopVersion": ">=5.5.222", "helpPath": "", "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0ibWRpLXZlY3Rvci1kaWZmZXJlbmNlLWFiIiB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCI+PHBhdGggZD0iTTMsMUMxLjg5LDEgMSwxLjg5IDEsM1Y1SDNWM0g1VjFIM003LDFWM0gxMFYxSDdNMTIsMVYzSDE0VjVIMTZWM0MxNiwxLjg5IDE1LjExLDEgMTQsMUgxMk0xLDdWMTBIM1Y3SDFNMTQsN0MxNCw3IDE0LDExLjY3IDE0LDE0QzExLjY3LDE0IDcsMTQgNywxNEM3LDE0IDcsMTggNywyMEM3LDIxLjExIDcuODksMjIgOSwyMkgyMEMyMS4xMSwyMiAyMiwyMS4xMSAyMiwyMFY5QzIyLDcuODkgMjEuMTEsNyAyMCw3QzE4LDcgMTQsNyAxNCw3TTE2LDlIMjBWMjBIOVYxNkgxNEMxNS4xMSwxNiAxNiwxNS4xMSAxNiwxNFY5TTEsMTJWMTRDMSwxNS4xMSAxLjg5LDE2IDMsMTZINVYxNEgzVjEySDFaIiAvPjwvc3ZnPg==", "name": "CameraShake3D", "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/vector-difference-ab.svg", "shortDescription": "Shake 3D layer cameras.", - "version": "0.2.0", + "version": "0.3.0", "description": [ "Shake layer cameras on 3 rotations.", "", @@ -28939,10 +28550,12 @@ { "type": { "inverted": true, - "value": "GetArgumentAsBoolean" + "value": "BooleanVariable" }, "parameters": [ - "\"Shakable\"" + "Shakable", + "True", + "" ] } ], @@ -28964,10 +28577,12 @@ "conditions": [ { "type": { - "value": "GetArgumentAsBoolean" + "value": "BooleanVariable" }, "parameters": [ - "\"Shakable\"" + "Shakable", + "True", + "" ] } ], @@ -29578,7 +29193,7 @@ "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ "const angle = eventsFunctionContext.getArgument(\"Angle\");", - "const layerName = eventsFunctionContext.getArgument(\"Layer\");", + "const layerName = eventsFunctionContext.getArgument(\"NewLayer\");", "", "if (angle === 0) {", " return;", @@ -29608,7 +29223,7 @@ }, { "description": "Layer", - "name": "Layer", + "name": "NewLayer", "type": "layer" } ], @@ -29626,7 +29241,7 @@ "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ "const angle = eventsFunctionContext.getArgument(\"Angle\");", - "const layerName = eventsFunctionContext.getArgument(\"Layer\");", + "const layerName = eventsFunctionContext.getArgument(\"NewLayer\");", "", "if (angle === 0) {", " return;", @@ -29655,7 +29270,7 @@ }, { "description": "Layer", - "name": "Layer", + "name": "NewLayer", "type": "layer" } ], @@ -29673,7 +29288,7 @@ "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ "const angle = eventsFunctionContext.getArgument(\"Angle\");", - "const layerName = eventsFunctionContext.getArgument(\"Layer\");", + "const layerName = eventsFunctionContext.getArgument(\"NewLayer\");", "", "if (angle === 0) {", " return;", @@ -29702,7 +29317,7 @@ }, { "description": "Layer", - "name": "Layer", + "name": "NewLayer", "type": "layer" } ], @@ -30975,20 +30590,17 @@ "category": "Input", "extensionNamespace": "", "fullName": "Double-click and tap", + "gdevelopVersion": ">=5.5.222", "helpPath": "", "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyMy4wLjMsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iSWNvbnMiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB2aWV3Qm94PSIwIDAgMzIgMzIiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDMyIDMyOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8c3R5bGUgdHlwZT0idGV4dC9jc3MiPg0KCS5zdDB7ZmlsbDpub25lO3N0cm9rZTojMDAwMDAwO3N0cm9rZS13aWR0aDoyO3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1saW5lam9pbjpyb3VuZDtzdHJva2UtbWl0ZXJsaW1pdDoxMDt9DQoJLnN0MXtmaWxsOm5vbmU7c3Ryb2tlOiMwMDAwMDA7c3Ryb2tlLXdpZHRoOjI7c3Ryb2tlLWxpbmVqb2luOnJvdW5kO3N0cm9rZS1taXRlcmxpbWl0OjEwO30NCjwvc3R5bGU+DQo8bGluZSBjbGFzcz0ic3QwIiB4MT0iMTYiIHkxPSIzIiB4Mj0iMTYiIHkyPSI2Ii8+DQo8bGluZSBjbGFzcz0ic3QwIiB4MT0iMTYiIHkxPSIxMCIgeDI9IjE2IiB5Mj0iMTMiLz4NCjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik0xNiwxMEwxNiwxMGMtMS4xLDAtMi0wLjktMi0ydjBjMC0xLjEsMC45LTIsMi0yaDBjMS4xLDAsMiwwLjksMiwydjBDMTgsOS4xLDE3LjEsMTAsMTYsMTB6Ii8+DQo8cGF0aCBjbGFzcz0ic3QwIiBkPSJNNywxNC4xYzIuMy0wLjcsNS41LTEuMSw5LTEuMWMzLjUsMCw2LjcsMC40LDksMS4xIi8+DQo8cGF0aCBjbGFzcz0ic3QwIiBkPSJNMTYsMjlMMTYsMjljLTUsMC05LTQtOS05di01LjlWOWMwLTMuMywyLjctNiw2LTZoNmMzLjMsMCw2LDIuNyw2LDZ2MTFDMjUsMjUsMjEsMjksMTYsMjl6Ii8+DQo8L3N2Zz4NCg==", "name": "DoubleClick", "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/Line Hero Pack/Master/SVG/Computers and Hardware/Computers and Hardware_mouse_wireless_pc.svg", "shortDescription": "Check for a double-click or a tap.", - "version": "2.0.0", + "version": "2.0.1", "description": [ "Check for a double-click with a mouse, or a tap and double-click on a touchscreen.", "", - "Please note: Touch devices do not have alternatives for middle/right clicks. Taps on a touch device will get counted for _any_ use of these conditions, so you should either design your controls accordingly, or build out separate events if the device has a touch screen.", - "", - "Breaking changes from 2.0.0:", - "- Mouse button value now needs quotes", - "- The double-click sensitivity now relies on the device settings" + "Please note: Touch devices do not have alternatives for middle/right clicks. Taps on a touch device will get counted for _any_ use of these conditions, so you should either design your controls accordingly, or build out separate events if the device has a touch screen." ], "origin": { "identifier": "DoubleClick", @@ -31005,6 +30617,15 @@ "8Ih1aa8f5gWUp4UB2BdhQ2iXWxJ3", "IWykYNRvhCZBN3vEgKEbBPOR3Oc2" ], + "changelog": [ + { + "version": "2.0.0", + "breaking": [ + "- Mouse button value now needs quotes", + "- The double-click sensitivity now relies on the device settings" + ] + } + ], "dependencies": [], "globalVariables": [ { @@ -31089,9 +30710,9 @@ " this.simpleClickButton = -1;", " }", "", - " hasClicked(buttonName, count) {", + " hasClicked(buttonName, clickCount) {", " const button = gdjs.evtTools.input.mouseButtonsNameToCode[buttonName];", - " if (count === 1) {", + " if (clickCount === 1) {", " return button === this.simpleClickButton;", " }", " else {", @@ -31185,7 +30806,7 @@ "description": "Mouse button to track", "longDescription": "As touch devices do not have middle/right tap equivalents, you will need to account for this within your events if you're not using the left mouse button and building for touch devices.", "name": "MouseButton", - "type": "mouse" + "type": "mouseButton" } ], "objectGroups": [] @@ -31229,7 +30850,7 @@ "description": "Mouse button to track", "longDescription": "As touch devices do not have middle/right tap equivalents, you will need to account for this within your events if you're not using the left mouse button and building for touch devices.", "name": "MouseButton", - "type": "mouse" + "type": "mouseButton" } ], "objectGroups": [] @@ -31262,7 +30883,7 @@ "description": "Mouse button to track", "longDescription": "As touch devices do not have middle/right tap equivalents, you will need to account for this within your events if you're not using the left mouse button and building for touch devices.", "name": "MouseButton", - "type": "string" + "type": "mouseButton" }, { "description": "Click count", @@ -31281,12 +30902,13 @@ "category": "Input", "extensionNamespace": "", "fullName": "Screen Orientation Checker", + "gdevelopVersion": ">=5.5.222", "helpPath": "", "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0ibWRpLXNjcmVlbi1yb3RhdGlvbiIgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0IiB2aWV3Qm94PSIwIDAgMjQgMjQiPjxwYXRoIGQ9Ik03LjUsMjEuNUM0LjI1LDE5Ljk0IDEuOTEsMTYuNzYgMS41NSwxM0gwLjA1QzAuNTYsMTkuMTYgNS43MSwyNCAxMiwyNEwxMi42NiwyMy45N0w4Ljg1LDIwLjE2TTE0LjgzLDIxLjE5TDIuODEsOS4xN0w5LjE3LDIuODFMMjEuMTksMTQuODNNMTAuMjMsMS43NUM5LjY0LDEuMTYgOC42OSwxLjE2IDguMTEsMS43NUwxLjc1LDguMTFDMS4xNiw4LjcgMS4xNiw5LjY1IDEuNzUsMTAuMjNMMTMuNzcsMjIuMjVDMTQuMzYsMjIuODQgMTUuMzEsMjIuODQgMTUuODksMjIuMjVMMjIuMjUsMTUuODlDMjIuODQsMTUuMyAyMi44NCwxNC4zNSAyMi4yNSwxMy43N0wxMC4yMywxLjc1TTE2LjUsMi41QzE5Ljc1LDQuMDcgMjIuMDksNy4yNCAyMi40NSwxMUgyMy45NUMyMy40NCw0Ljg0IDE4LjI5LDAgMTIsMEwxMS4zNCwwLjAzTDE1LjE1LDMuODRMMTYuNSwyLjVaIiAvPjwvc3ZnPg==", "name": "ScreenOrientationChecker", "previewIconUrl": "https://asset-resources.gdevelop.io/public-resources/Icons/0126888931a4a4f82bb2824df9f096347ace1c47f510c44df42aa8dc9e49e24a_screen-rotation.svg", "shortDescription": "Display a customizable screen asking the user to rotate their phone/tablet if not in the right orientation.", - "version": "0.0.2", + "version": "0.2.0", "description": "Display a customizable screen asking the user to rotate their phone/tablet if not in the right orientation.", "origin": { "identifier": "ScreenOrientationChecker", @@ -31309,6 +30931,28 @@ ], "sceneVariables": [], "eventsFunctions": [ + { + "description": "Check if the events are running for the editor.", + "fullName": "Editor is running", + "functionType": "Condition", + "name": "IsInGameEdition", + "private": true, + "sentence": "Events are running for the editor", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const game = runtimeScene.getGame();\r", + "eventsFunctionContext.returnValue = game.isInGameEdition && game.isInGameEdition();" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [], + "objectGroups": [] + }, { "fullName": "Get game target orientation", "functionType": "StringExpression", @@ -31317,62 +30961,349 @@ "sentence": "", "events": [ { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": "eventsFunctionContext.returnValue = runtimeScene.getGame().getGameData().properties.orientation;", - "parameterObjects": "", - "useStrict": true, - "eventsSheetExpanded": false + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": "eventsFunctionContext.returnValue = runtimeScene.getGame().getGameData().properties.orientation;", + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "expressionType": { + "type": "string" + }, + "parameters": [], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "Action", + "name": "onFirstSceneLoaded", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "TargetOrientation", + "=", + "ScreenOrientationChecker::ProjectOrientation()" + ] + } + ] + } + ], + "parameters": [], + "objectGroups": [] + } + ], + "eventsBasedBehaviors": [], + "eventsBasedObjects": [ + { + "areaMaxX": 400, + "areaMaxY": 200, + "areaMaxZ": 0, + "areaMinX": 0, + "areaMinY": 0, + "areaMinZ": 0, + "defaultName": "", + "description": "Automatically display a screen asking the player to rotate their screen if needed - on mobile phones and tablets only. Set up Anchor behavior on this object so that top/bottom/left/right edges are anchored to the screen top/bottom/left/right.", + "fullName": "Screen Orientation Checker", + "isInnerAreaFollowingParentSize": true, + "isUsingLegacyInstancesRenderer": false, + "name": "ScreenOrientationChecker", + "objects": [ + { + "assetStoreId": "", + "bold": true, + "italic": false, + "name": "Text", + "smoothed": true, + "type": "TextObject::Text", + "underlined": false, + "variables": [], + "effects": [], + "behaviors": [ + { + "name": "Anchor", + "type": "AnchorBehavior::AnchorBehavior", + "bottomEdgeAnchor": 0, + "leftEdgeAnchor": 4, + "relativeToOriginalWindowSize": true, + "rightEdgeAnchor": 0, + "topEdgeAnchor": 4, + "useLegacyBottomAndRightAnchors": false + }, + { + "name": "Tween", + "type": "Tween::TweenBehavior" + } + ], + "string": "Rotate screen to play", + "font": "", + "textAlignment": "center", + "characterSize": 30, + "color": { + "b": 255, + "g": 255, + "r": 255 + }, + "content": { + "bold": true, + "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": "Rotate screen to play", + "font": "", + "textAlignment": "center", + "verticalTextAlignment": "top", + "characterSize": 30, + "lineHeight": 0, + "color": "255;255;255" + } + }, + { + "assetStoreId": "", + "name": "BackgroundPainter", + "type": "PrimitiveDrawing::Drawer", + "variables": [], + "effects": [], + "behaviors": [], + "fillOpacity": 255, + "outlineSize": 0, + "outlineOpacity": 255, + "absoluteCoordinates": true, + "clearBetweenFrames": true, + "antialiasing": "none", + "fillColor": { + "r": 0, + "g": 0, + "b": 0 + }, + "outlineColor": { + "r": 0, + "g": 0, + "b": 0 + } + }, + { + "adaptCollisionMaskAutomatically": true, + "assetStoreId": "", + "name": "Icon", + "type": "Sprite", + "updateIfNotVisible": false, + "variables": [], + "effects": [], + "behaviors": [ + { + "name": "Anchor", + "type": "AnchorBehavior::AnchorBehavior", + "bottomEdgeAnchor": 0, + "leftEdgeAnchor": 4, + "topEdgeAnchor": 4, + "relativeToOriginalWindowSize": true, + "rightEdgeAnchor": 0, + "useLegacyBottomAndRightAnchors": false + }, + { + "name": "Tween", + "type": "Tween::TweenBehavior" + } + ], + "animations": [ + { + "name": "", + "useMultipleDirections": false, + "directions": [ + { + "looping": false, + "timeBetweenFrames": 0.08, + "sprites": [ + { + "hasCustomCollisionMask": true, + "image": "rotate-screen-icon.png", + "points": [], + "originPoint": { + "name": "origine", + "x": 52.5, + "y": 56.5 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [ + [ + { + "x": 0, + "y": 1 + }, + { + "x": 105, + "y": 1 + }, + { + "x": 105, + "y": 113 + }, + { + "x": 0, + "y": 113 + } + ] + ] + } + ] + } + ] + } + ] + } + ], + "objectsFolderStructure": { + "folderName": "__ROOT", + "children": [ + { + "objectName": "Text" + }, + { + "objectName": "BackgroundPainter" + }, + { + "objectName": "Icon" + } + ] + }, + "objectsGroups": [], + "layers": [ + { + "ambientLightColorB": 200, + "ambientLightColorG": 200, + "ambientLightColorR": 200, + "camera3DFarPlaneDistance": 10000, + "camera3DFieldOfView": 45, + "camera3DNearPlaneDistance": 3, + "cameraType": "", + "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": [] + } + ], + "instances": [ + { + "angle": 0, + "customSize": true, + "depth": 1, + "height": 35, + "keepRatio": true, + "layer": "", + "name": "Text", + "persistentUuid": "65c003ea-19c0-4f18-a189-a02a24378f35", + "width": 207, + "x": 104, + "y": 120, + "zOrder": 15, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "keepRatio": true, + "layer": "", + "name": "BackgroundPainter", + "persistentUuid": "49ff4576-6406-41de-a43b-1355529d61fe", + "width": 0, + "x": 38, + "y": 17, + "zOrder": 14, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "keepRatio": true, + "layer": "", + "name": "Icon", + "persistentUuid": "39cbfc66-13f4-43dc-b6ef-2bda83153277", + "width": 0, + "x": 204, + "y": 64, + "zOrder": 16, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] } ], - "expressionType": { - "type": "string" - }, - "parameters": [], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "Action", - "name": "onFirstSceneLoaded", - "sentence": "", - "events": [ + "eventsFunctions": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ + "fullName": "", + "functionType": "Action", + "name": "onCreated", + "sentence": "", + "events": [ { - "type": { - "value": "SetStringVariable" - }, - "parameters": [ - "TargetOrientation", - "=", - "ScreenOrientationChecker::ProjectOrientation()" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "PrimitiveDrawing::ClearBetweenFrames" + }, + "parameters": [ + "BackgroundPainter", + "" + ] + } ] } - ] - } - ], - "parameters": [], - "objectGroups": [] - } - ], - "eventsBasedBehaviors": [], - "eventsBasedObjects": [ - { - "areaMaxX": 400, - "areaMaxY": 200, - "areaMaxZ": 0, - "areaMinX": 0, - "areaMinY": 0, - "areaMinZ": 0, - "defaultName": "", - "description": "Automatically display a screen asking the player to rotate their screen if needed - on mobile phones and tablets only. Set up Anchor behavior on this object so that top/bottom/left/right edges are anchored to the screen top/bottom/left/right.", - "fullName": "Screen Orientation Checker", - "isInnerAreaFollowingParentSize": true, - "isUsingLegacyInstancesRenderer": false, - "name": "ScreenOrientationChecker", - "eventsFunctions": [ + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "ScreenOrientationChecker::ScreenOrientationChecker", + "type": "object" + } + ], + "objectGroups": [] + }, { "fullName": "", "functionType": "Action", @@ -31380,41 +31311,66 @@ "sentence": "", "events": [ { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 - }, - "comment": "Check if the screen must be shown" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "ScreenOrientationChecker::IsInGameEdition" + }, + "parameters": [ + "", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "ScreenOrientationChecker::ScreenOrientationChecker::DrawBackground" + }, + "parameters": [ + "Object", + "" + ] + } + ] }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "value": "SystemInfo::IsMobile" + "inverted": true, + "value": "ScreenOrientationChecker::IsInGameEdition" }, - "parameters": [] + "parameters": [ + "", + "" + ] } ], "actions": [], "events": [ + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Check if the screen must be shown" + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "value": "BuiltinCommonInstructions::CompareNumbers" + "value": "SystemInfo::IsMobile" }, - "parameters": [ - "SceneWindowWidth()", - ">", - "SceneWindowHeight()" - ] + "parameters": [] } ], "actions": [], @@ -31424,23 +31380,69 @@ "conditions": [ { "type": { - "value": "StringVariable" + "value": "BuiltinCommonInstructions::CompareNumbers" }, "parameters": [ - "TargetOrientation", - "=", - "\"portrait\"" + "SceneWindowWidth()", + ">", + "SceneWindowHeight()" ] } ], - "actions": [ + "actions": [], + "events": [ { - "type": { - "value": "ScreenOrientationChecker::ScreenOrientationChecker::SetPropertyIsShown" - }, - "parameters": [ - "Object", - "yes" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "TargetOrientation", + "=", + "\"portrait\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsShown", + "False", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "TargetOrientation", + "!=", + "\"portrait\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsShown", + "False", + "" + ] + } ] } ] @@ -31450,357 +31452,366 @@ "conditions": [ { "type": { - "value": "StringVariable" + "value": "BuiltinCommonInstructions::CompareNumbers" }, "parameters": [ - "TargetOrientation", - "!=", - "\"portrait\"" + "SceneWindowWidth()", + "<=", + "SceneWindowHeight()" ] } ], - "actions": [ + "actions": [], + "events": [ { - "type": { - "value": "ScreenOrientationChecker::ScreenOrientationChecker::SetPropertyIsShown" - }, - "parameters": [ - "Object", - "no" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "TargetOrientation", + "=", + "\"landscape\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsShown", + "False", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "TargetOrientation", + "=", + "\"portrait\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsShown", + "False", + "" + ] + } ] } ] } ] }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Show/hide the screen as needed" + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "value": "BuiltinCommonInstructions::CompareNumbers" + "value": "BuiltinCommonInstructions::Or" }, - "parameters": [ - "SceneWindowWidth()", - "<=", - "SceneWindowHeight()" - ] - } - ], - "actions": [], - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "parameters": [], + "subInstructions": [ { "type": { - "value": "StringVariable" + "value": "BooleanVariable" }, "parameters": [ - "TargetOrientation", - "=", - "\"landscape\"" + "IsShown", + "True", + "" ] - } - ], - "actions": [ + }, { "type": { - "value": "ScreenOrientationChecker::ScreenOrientationChecker::SetPropertyIsShown" + "value": "BooleanVariable" }, "parameters": [ - "Object", - "yes" + "IsForceShown", + "True", + "" ] } ] + } + ], + "actions": [ + { + "type": { + "value": "ScreenOrientationChecker::ScreenOrientationChecker::DrawBackground" + }, + "parameters": [ + "Object", + "" + ] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "TargetOrientation", - "=", - "\"portrait\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "ScreenOrientationChecker::ScreenOrientationChecker::SetPropertyIsShown" - }, - "parameters": [ - "Object", - "no" - ] - } + "type": { + "value": "Montre" + }, + "parameters": [ + "Object", + "" ] } ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 - }, - "comment": "Show/hide the screen as needed" - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + }, { - "type": { - "value": "BuiltinCommonInstructions::Or" - }, - "parameters": [], - "subInstructions": [ + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { "type": { - "value": "ScreenOrientationChecker::ScreenOrientationChecker::PropertyIsShown" + "inverted": true, + "value": "BooleanVariable" }, "parameters": [ - "Object" + "IsShown", + "True", + "" ] }, { "type": { - "value": "ScreenOrientationChecker::ScreenOrientationChecker::PropertyIsForceShown" + "inverted": true, + "value": "BooleanVariable" + }, + "parameters": [ + "IsForceShown", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "Cache" }, "parameters": [ "Object" ] } ] - } - ], - "actions": [ - { - "type": { - "value": "PrimitiveDrawing::FillColor" - }, - "parameters": [ - "BackgroundPainter", - "BackgroundColor" - ] - }, - { - "type": { - "value": "PrimitiveDrawing::RoundedRectangle" - }, - "parameters": [ - "BackgroundPainter", - "Padding", - "Padding", - "Object.Width()-Padding", - "Object.Height()-Padding", - "CornerRadius" - ] }, { - "type": { - "value": "Montre" - }, - "parameters": [ - "Object", - "" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "inverted": true, - "value": "ScreenOrientationChecker::ScreenOrientationChecker::PropertyIsShown" - }, - "parameters": [ - "Object" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "MettreY" + }, + "parameters": [ + "Icon", + "=", + "Text.Y() - 100" + ] + } ] }, { - "type": { - "inverted": true, - "value": "ScreenOrientationChecker::ScreenOrientationChecker::PropertyIsForceShown" - }, - "parameters": [ - "Object" - ] - } - ], - "actions": [ - { - "type": { - "value": "Cache" - }, - "parameters": [ - "Object" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "MettreY" - }, - "parameters": [ - "Icon", - "=", - "Text.Y() - 100" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 - }, - "comment": "Animate the icon" - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "inverted": true, - "value": "Tween::Exists" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 }, - "parameters": [ - "Icon", - "Tween", - "\"Rotate\"" - ] + "comment": "Animate the icon" }, { - "type": { - "inverted": true, - "value": "Tween::Exists" - }, - "parameters": [ - "Icon", - "Tween", - "\"RotateBack\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "Tween::TweenBehavior::AddObjectAngleTween2" - }, - "parameters": [ - "Icon", - "Tween", - "\"Rotate\"", - "8", - "\"easeInOutQuad\"", - "2", - "" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "Tween::HasFinished" - }, - "parameters": [ - "Icon", - "Tween", - "\"RotateBack\"" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "Tween::Exists" + }, + "parameters": [ + "Icon", + "Tween", + "\"Rotate\"" + ] + }, + { + "type": { + "inverted": true, + "value": "Tween::Exists" + }, + "parameters": [ + "Icon", + "Tween", + "\"RotateBack\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "Tween::TweenBehavior::AddObjectAngleTween2" + }, + "parameters": [ + "Icon", + "Tween", + "\"Rotate\"", + "8", + "\"easeInOutQuad\"", + "2", + "" + ] + } ] - } - ], - "actions": [ + }, { - "type": { - "value": "Tween::TweenBehavior::AddObjectAngleTween2" - }, - "parameters": [ - "Icon", - "Tween", - "\"Rotate\"", - "8", - "\"easeInOutQuad\"", - "2", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Tween::HasFinished" + }, + "parameters": [ + "Icon", + "Tween", + "\"RotateBack\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "Tween::TweenBehavior::AddObjectAngleTween2" + }, + "parameters": [ + "Icon", + "Tween", + "\"Rotate\"", + "8", + "\"easeInOutQuad\"", + "2", + "" + ] + }, + { + "type": { + "value": "Tween::RemoveTween" + }, + "parameters": [ + "Icon", + "Tween", + "\"RotateBack\"" + ] + } ] }, { - "type": { - "value": "Tween::RemoveTween" - }, - "parameters": [ - "Icon", - "Tween", - "\"RotateBack\"" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Tween::HasFinished" + }, + "parameters": [ + "Icon", + "Tween", + "\"Rotate\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "Tween::TweenBehavior::AddObjectAngleTween2" + }, + "parameters": [ + "Icon", + "Tween", + "\"RotateBack\"", + "-8", + "\"easeInOutQuad\"", + "2", + "" + ] + }, + { + "type": { + "value": "Tween::RemoveTween" + }, + "parameters": [ + "Icon", + "Tween", + "\"Rotate\"" + ] + } ] } ] - }, + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "ScreenOrientationChecker::ScreenOrientationChecker", + "type": "object" + } + ], + "objectGroups": [] + }, + { + "description": "Draw the background.", + "fullName": "Draw the background", + "functionType": "Action", + "name": "DrawBackground", + "private": true, + "sentence": "Draw the background of _PARAM0_", + "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "Tween::HasFinished" - }, - "parameters": [ - "Icon", - "Tween", - "\"Rotate\"" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "Tween::TweenBehavior::AddObjectAngleTween2" - }, - "parameters": [ - "Icon", - "Tween", - "\"RotateBack\"", - "-8", - "\"easeInOutQuad\"", - "2", - "" - ] - }, - { - "type": { - "value": "Tween::RemoveTween" + "value": "PrimitiveDrawing::RoundedRectangle" }, "parameters": [ - "Icon", - "Tween", - "\"Rotate\"" + "BackgroundPainter", + "Padding", + "Padding", + "Object.Width()-Padding", + "Object.Height()-Padding", + "CornerRadius" ] } ] @@ -31820,7 +31831,6 @@ "description": "Check if the screen should be forced to be shown. Use this to test the screen in your game.", "fullName": "Force show the screen", "functionType": "Condition", - "group": "Screen Orientation Checker configuration", "name": "IsForceShown", "sentence": "_PARAM0_ is forced to be shown", "events": [ @@ -31829,10 +31839,12 @@ "conditions": [ { "type": { - "value": "ScreenOrientationChecker::ScreenOrientationChecker::PropertyIsForceShown" + "value": "BooleanVariable" }, "parameters": [ - "Object" + "IsForceShown", + "True", + "" ] } ], @@ -31862,7 +31874,6 @@ "description": "Change if the screen should be forced to be shown. Use this to test the screen in your game.", "fullName": "Force show the screen", "functionType": "Action", - "group": "Screen Orientation Checker configuration", "name": "SetIsForceShown", "sentence": "Force _PARAM0_ to be shown: _PARAM1_", "events": [ @@ -31872,21 +31883,24 @@ { "type": { "inverted": true, - "value": "GetArgumentAsBoolean" + "value": "BooleanVariable" }, "parameters": [ - "\"Value\"" + "Value", + "True", + "" ] } ], "actions": [ { "type": { - "value": "ScreenOrientationChecker::ScreenOrientationChecker::SetPropertyIsForceShown" + "value": "SetBooleanVariable" }, "parameters": [ - "Object", - "no" + "IsForceShown", + "False", + "" ] } ] @@ -31896,21 +31910,24 @@ "conditions": [ { "type": { - "value": "GetArgumentAsBoolean" + "value": "BooleanVariable" }, "parameters": [ - "\"Value\"" + "Value", + "True", + "" ] } ], "actions": [ { "type": { - "value": "ScreenOrientationChecker::ScreenOrientationChecker::SetPropertyIsForceShown" + "value": "SetBooleanVariable" }, "parameters": [ - "Object", - "yes" + "IsForceShown", + "False", + "" ] } ] @@ -31932,310 +31949,377 @@ } ], "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "", - "type": "Boolean", - "label": "", - "description": "", - "group": "", - "extraInformation": [], - "hidden": true, - "name": "IsShown" - }, - { - "value": "", - "type": "Boolean", - "label": "Force show the screen", - "description": "Use this to test the screen in your game", - "group": "", - "extraInformation": [], - "name": "IsForceShown" - }, - { - "value": "5", - "type": "Number", - "unit": "Pixel", - "label": "Padding", - "description": "", - "group": "Appearance", - "extraInformation": [], - "name": "Padding" - }, - { - "value": "10", - "type": "Number", - "unit": "Pixel", - "label": "Corner radius", - "description": "Corner radius for the background", - "group": "Appearance", - "extraInformation": [], - "name": "CornerRadius" }, { - "value": "0;0;0", - "type": "Color", - "label": "Background color", - "description": "", - "group": "Appearance", - "extraInformation": [], - "name": "BackgroundColor" - } - ], - "objects": [ - { - "assetStoreId": "", - "bold": true, - "italic": false, - "name": "Text", - "smoothed": true, - "type": "TextObject::Text", - "underlined": false, - "variables": [], - "effects": [], - "behaviors": [ - { - "name": "Anchor", - "type": "AnchorBehavior::AnchorBehavior", - "bottomEdgeAnchor": 0, - "leftEdgeAnchor": 4, - "relativeToOriginalWindowSize": true, - "rightEdgeAnchor": 0, - "topEdgeAnchor": 4, - "useLegacyBottomAndRightAnchors": false - }, + "description": "the message of the object.", + "fullName": "Message", + "functionType": "ExpressionAndCondition", + "name": "Message", + "sentence": "the message", + "events": [ { - "name": "Tween", - "type": "Tween::TweenBehavior" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnString" + }, + "parameters": [ + "Text.Text::Value()" + ] + } + ] } ], - "string": "Rotate screen to play", - "font": "", - "textAlignment": "center", - "characterSize": 30, - "color": { - "b": 255, - "g": 255, - "r": 255 - }, - "content": { - "bold": true, - "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": "Rotate screen to play", - "font": "", - "textAlignment": "center", - "verticalTextAlignment": "top", - "characterSize": 30, - "color": "255;255;255" - } - }, - { - "assetStoreId": "", - "name": "BackgroundPainter", - "type": "PrimitiveDrawing::Drawer", - "variables": [], - "effects": [], - "behaviors": [], - "fillOpacity": 255, - "outlineSize": 0, - "outlineOpacity": 255, - "absoluteCoordinates": true, - "clearBetweenFrames": true, - "antialiasing": "none", - "fillColor": { - "r": 0, - "g": 0, - "b": 0 + "expressionType": { + "type": "string" }, - "outlineColor": { - "r": 0, - "g": 0, - "b": 0 - } + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "ScreenOrientationChecker::ScreenOrientationChecker", + "type": "object" + } + ], + "objectGroups": [] }, { - "adaptCollisionMaskAutomatically": true, - "assetStoreId": "", - "name": "Icon", - "type": "Sprite", - "updateIfNotVisible": false, - "variables": [], - "effects": [], - "behaviors": [ + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "Message", + "name": "SetMessage", + "sentence": "", + "events": [ { - "name": "Anchor", - "type": "AnchorBehavior::AnchorBehavior", - "bottomEdgeAnchor": 0, - "leftEdgeAnchor": 4, - "topEdgeAnchor": 4, - "relativeToOriginalWindowSize": true, - "rightEdgeAnchor": 0, - "useLegacyBottomAndRightAnchors": false - }, + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "TextContainerCapability::TextContainerBehavior::SetValue" + }, + "parameters": [ + "Text", + "Text", + "=", + "Value" + ] + } + ] + } + ], + "parameters": [ { - "name": "Tween", - "type": "Tween::TweenBehavior" + "description": "Object", + "name": "Object", + "supplementaryInformation": "ScreenOrientationChecker::ScreenOrientationChecker", + "type": "object" } ], - "animations": [ + "objectGroups": [] + } + ], + "propertyDescriptors": [ + { + "value": "", + "type": "Boolean", + "label": "", + "hidden": true, + "name": "IsShown" + }, + { + "value": "", + "type": "Boolean", + "label": "Force show the screen", + "description": "Use this to test the screen in your game", + "name": "IsForceShown" + }, + { + "value": "5", + "type": "Number", + "unit": "Pixel", + "label": "Padding", + "group": "Appearance", + "name": "Padding" + }, + { + "value": "10", + "type": "Number", + "unit": "Pixel", + "label": "Corner radius", + "description": "Corner radius for the background", + "group": "Appearance", + "name": "CornerRadius" + } + ], + "variants": [ + { + "areaMaxX": 400, + "areaMaxY": 200, + "areaMaxZ": 0, + "areaMinX": 0, + "areaMinY": 0, + "areaMinZ": 0, + "assetStoreAssetId": "2743bcd6cf431c6c00cda3a59684eb152b3a09d598b799b15383e4f77daf8b37", + "assetStoreOriginalName": "Black screen orientation checker", + "name": "Black screen orientation checker", + "objects": [ + { + "assetStoreId": "", + "bold": true, + "italic": false, + "name": "Text", + "smoothed": true, + "type": "TextObject::Text", + "underlined": false, + "variables": [], + "effects": [], + "behaviors": [ + { + "name": "Anchor", + "type": "AnchorBehavior::AnchorBehavior", + "bottomEdgeAnchor": 0, + "leftEdgeAnchor": 4, + "relativeToOriginalWindowSize": true, + "rightEdgeAnchor": 0, + "topEdgeAnchor": 4, + "useLegacyBottomAndRightAnchors": false + }, + { + "name": "Tween", + "type": "Tween::TweenBehavior" + } + ], + "string": "Rotate screen to play", + "font": "", + "textAlignment": "center", + "characterSize": 30, + "color": { + "b": 255, + "g": 255, + "r": 255 + }, + "content": { + "bold": true, + "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": "Rotate screen to play", + "font": "", + "textAlignment": "center", + "verticalTextAlignment": "top", + "characterSize": 30, + "lineHeight": 0, + "color": "255;255;255" + } + }, { - "name": "", - "useMultipleDirections": false, - "directions": [ + "assetStoreId": "", + "name": "BackgroundPainter", + "type": "PrimitiveDrawing::Drawer", + "variables": [], + "effects": [], + "behaviors": [], + "fillOpacity": 255, + "outlineSize": 0, + "outlineOpacity": 255, + "absoluteCoordinates": true, + "clearBetweenFrames": true, + "antialiasing": "none", + "fillColor": { + "r": 0, + "g": 0, + "b": 0 + }, + "outlineColor": { + "r": 0, + "g": 0, + "b": 0 + } + }, + { + "adaptCollisionMaskAutomatically": true, + "assetStoreId": "", + "name": "Icon", + "type": "Sprite", + "updateIfNotVisible": false, + "variables": [], + "effects": [], + "behaviors": [ + { + "name": "Anchor", + "type": "AnchorBehavior::AnchorBehavior", + "bottomEdgeAnchor": 0, + "leftEdgeAnchor": 4, + "topEdgeAnchor": 4, + "relativeToOriginalWindowSize": true, + "rightEdgeAnchor": 0, + "useLegacyBottomAndRightAnchors": false + }, { - "looping": false, - "timeBetweenFrames": 0.08, - "sprites": [ + "name": "Tween", + "type": "Tween::TweenBehavior" + } + ], + "animations": [ + { + "name": "", + "useMultipleDirections": false, + "directions": [ { - "hasCustomCollisionMask": true, - "image": "rotate-screen-icon.png", - "points": [], - "originPoint": { - "name": "origine", - "x": 52.5, - "y": 56.5 - }, - "centerPoint": { - "automatic": true, - "name": "centre", - "x": 0, - "y": 0 - }, - "customCollisionMask": [ - [ - { - "x": 0, - "y": 1 - }, - { - "x": 105, - "y": 1 - }, - { - "x": 105, - "y": 113 + "looping": false, + "timeBetweenFrames": 0.08, + "sprites": [ + { + "hasCustomCollisionMask": true, + "image": "rotate-screen-icon.png", + "points": [], + "originPoint": { + "name": "origine", + "x": 52.5, + "y": 56.5 }, - { + "centerPoint": { + "automatic": true, + "name": "centre", "x": 0, - "y": 113 - } - ] + "y": 0 + }, + "customCollisionMask": [ + [ + { + "x": 0, + "y": 1 + }, + { + "x": 105, + "y": 1 + }, + { + "x": 105, + "y": 113 + }, + { + "x": 0, + "y": 113 + } + ] + ] + } ] } ] } ] } - ] - } - ], - "objectsFolderStructure": { - "folderName": "__ROOT", - "children": [ - { - "objectName": "Text" - }, - { - "objectName": "BackgroundPainter" + ], + "objectsFolderStructure": { + "folderName": "__ROOT", + "children": [ + { + "objectName": "Text" + }, + { + "objectName": "BackgroundPainter" + }, + { + "objectName": "Icon" + } + ] }, - { - "objectName": "Icon" - } - ] - }, - "objectsGroups": [], - "layers": [ - { - "ambientLightColorB": 200, - "ambientLightColorG": 200, - "ambientLightColorR": 200, - "camera3DFarPlaneDistance": 10000, - "camera3DFieldOfView": 45, - "camera3DNearPlaneDistance": 3, - "cameraType": "", - "followBaseLayerCamera": false, - "isLightingLayer": false, - "isLocked": false, - "name": "", - "renderingType": "", - "visibility": true, - "cameras": [ + "objectsGroups": [], + "layers": [ + { + "ambientLightColorB": 200, + "ambientLightColorG": 200, + "ambientLightColorR": 200, + "camera3DFarPlaneDistance": 10000, + "camera3DFieldOfView": 45, + "camera3DNearPlaneDistance": 3, + "cameraType": "", + "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": [] + } + ], + "instances": [ + { + "angle": 0, + "customSize": true, + "depth": 1, + "height": 35, + "keepRatio": true, + "layer": "", + "name": "Text", + "persistentUuid": "65c003ea-19c0-4f18-a189-a02a24378f35", + "width": 207, + "x": 104, + "y": 120, + "zOrder": 15, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, { - "defaultSize": true, - "defaultViewport": true, + "angle": 0, + "customSize": false, "height": 0, - "viewportBottom": 1, - "viewportLeft": 0, - "viewportRight": 1, - "viewportTop": 0, - "width": 0 + "keepRatio": true, + "layer": "", + "name": "BackgroundPainter", + "persistentUuid": "49ff4576-6406-41de-a43b-1355529d61fe", + "width": 0, + "x": 38, + "y": 17, + "zOrder": 14, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "keepRatio": true, + "layer": "", + "name": "Icon", + "persistentUuid": "39cbfc66-13f4-43dc-b6ef-2bda83153277", + "width": 0, + "x": 204, + "y": 64, + "zOrder": 16, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] } - ], - "effects": [] - } - ], - "instances": [ - { - "angle": 0, - "customSize": true, - "depth": 1, - "height": 35, - "keepRatio": true, - "layer": "", - "name": "Text", - "persistentUuid": "65c003ea-19c0-4f18-a189-a02a24378f35", - "width": 207, - "x": 104, - "y": 120, - "zOrder": 15, - "numberProperties": [], - "stringProperties": [], - "initialVariables": [] - }, - { - "angle": 0, - "customSize": false, - "height": 0, - "keepRatio": true, - "layer": "", - "name": "BackgroundPainter", - "persistentUuid": "49ff4576-6406-41de-a43b-1355529d61fe", - "width": 0, - "x": 38, - "y": 17, - "zOrder": 14, - "numberProperties": [], - "stringProperties": [], - "initialVariables": [] - }, - { - "angle": 0, - "customSize": false, - "height": 0, - "keepRatio": true, - "layer": "", - "name": "Icon", - "persistentUuid": "39cbfc66-13f4-43dc-b6ef-2bda83153277", - "width": 0, - "x": 204, - "y": 64, - "zOrder": 16, - "numberProperties": [], - "stringProperties": [], - "initialVariables": [] + ] } ] } diff --git a/examples/3d-shooting-gallery/assets/rotate-screen-icon.png b/examples/3d-shooting-gallery/assets/rotate-screen-icon.png index ba619fae3995e5576c1e1de0a994b5b3da7c39dc..a7726dee34eba34b401b26b73b5bf128ff7c26d7 100644 GIT binary patch delta 1155 zcmV-}1bqAP28{`j8Gi-<007npjm!W5010qNS#tmY3ljhU3ljkVnw%H_00citL_t(| z+U?!pwW2T(1>jc#B~St-Sb`f&sWc6&`9(FdUz!2ufn{)iP zFJiu(WD*ki`Z89$_tpJVezDjscc9w;Dee8UV~f~C+WUWt3x9BoE<;GAA1{n9Lr|{@ zqssu2^Y0f%*G5QJKfU}!SHTucgVg$YrDGSkF3j%!Io&_~OrSGcalK6LxB$k7zpdGt z>qJfWqT$~ihuFO(#CgD+!@nus0J<6ZiS%%a zkf}|^8PsuMdVjrc^u)TVX37}y=+c;8r;DCh5fD}nm|iOaRgvga*5YUmcf7|0vi#q!c*I(ogbVKXj!WbtPaQpC|t;`*$0UbAGITFauxcL)7eRfch zWg0}F+i+Pabb;3_pdyo0RG?zy-(H}hB0n}OAb6=+_+O}R$dcG1qkMjHi6KeFYy6Dy|o2u0uhKn1R@ZD2t*(P z5r{wpA`pR~fxZc3{|6Ds_>YpO0tuvZ9gW&Tt$+AYI|8Y;sne)z_~hZ9Kx)_Xw`h+? zJ%J1&g$m7X_6G$j)%Wj-%@-Yk7GIbCUdYHJ1zG|vy0+mdmtUF{Hz-in=Rx9>OQT)6 zc_@U5>MDEpP@q77iX^98EJC3y^@z=?x3#~_3>4B@oOqJuA;lMN4h06Z-Zo{cP-v^! zqJOLFQh#}JD8$`_k2-!rH1NXcxkeJ4Gh0@-dvY`XKK3?f$MHuG zs2Zfl{nW^dyusRsEy4v`R|hB-0p*)GT?B{GqujlnMkdMC44gj9;TS!Nv;W(ZrF^D3 z0(u;InLTk5rN`0nB&=|BPu2{HlVJA$Y|+*eXZzXz)Y7eTMu_FV^m-1=fl-q_y?(cF z2`6C`U1lOxY{B#?cRjJ&lb3|baOvu2spC}}%ON=ea-z)Z?* zMqugDC_atNmBAsU1(z{AT5-3YssWQGU52g&%X!B2s%Mq_v$$(=XiTc za}skxbf@G~0#nJw!Z{>~f8@5gv!W~3SS=M$839QocMjN)O*LdV9? zCxOu7>e+n%6@fxID5@S*;$Z0FH}9klXisOV_8tv}_R~*oyQATd>iB@{h2UF@UMScf z^n-rT|AlB4WM)D6e-tnrGSO7O2kh{OROJk_T_cC_UAK)$ZJ5INF{(-24+01>)f1p+ z95vCbs~;*Ya@)d8?~6laGW${nb&ANwFb!{XN5?_)8Eql8iwCYn^VL zlW!>ix;j1cC}j1fn;F`qpl#yz4yQpu5aSx+l7b+^xt6-1f3O{PW!7>1_eTdJOURK2$=wV@}4LZLO*%q^QFz=P%!X=ku;#hqe3bKyY{tK Date: Wed, 8 Oct 2025 15:35:55 +0200 Subject: [PATCH 10/12] [3D city builder] Update the extensions --- .../3d-tile-based-city-builder.json | 1008 +++++++++-------- 1 file changed, 542 insertions(+), 466 deletions(-) diff --git a/examples/3d-tile-based-city-builder/3d-tile-based-city-builder.json b/examples/3d-tile-based-city-builder/3d-tile-based-city-builder.json index 0d9c30a1d..e6628a400 100644 --- a/examples/3d-tile-based-city-builder/3d-tile-based-city-builder.json +++ b/examples/3d-tile-based-city-builder/3d-tile-based-city-builder.json @@ -1,7 +1,7 @@ { "firstLayout": "GameScene", "gdVersion": { - "build": 237, + "build": 242, "major": 5, "minor": 5, "revision": 0 @@ -687,6 +687,7 @@ "textAlignment": "left", "verticalTextAlignment": "top", "characterSize": 40, + "lineHeight": 0, "color": "255;255;255" } }, @@ -729,6 +730,7 @@ "textAlignment": "left", "verticalTextAlignment": "top", "characterSize": 40, + "lineHeight": 0, "color": "255;255;255" } }, @@ -771,6 +773,7 @@ "textAlignment": "left", "verticalTextAlignment": "top", "characterSize": 40, + "lineHeight": 0, "color": "255;255;255" } }, @@ -877,6 +880,7 @@ "textAlignment": "left", "verticalTextAlignment": "top", "characterSize": 25, + "lineHeight": 0, "color": "255;231;0" } }, @@ -3453,6 +3457,7 @@ "extraInformation": [ "Scene3D::Base3DBehavior" ], + "choices": [], "name": "Object3D" }, { @@ -5861,6 +5866,7 @@ "extraInformation": [ "Scene3D::Base3DBehavior" ], + "choices": [], "name": "Object3D" }, { @@ -6050,7 +6056,7 @@ "name": "SpriteToggleSwitch", "previewIconUrl": "https://asset-resources.gdevelop.io/public-resources/Icons/Line Hero Pack/Master/SVG/Interface Elements/8d0cd8cd0c9318f4f6efde6ee6b4c192bd19306467f80c9970387a259300f895_Interface Elements_interface_ui_toggle_switch_on_off.svg", "shortDescription": "Toggle switch that users can click or touch.", - "version": "2.0.0", + "version": "2.0.1", "description": [ "Toggle switch that users can click or touch. The switch can be customized with sprites.", "", @@ -6080,7 +6086,30 @@ "dependencies": [], "globalVariables": [], "sceneVariables": [], - "eventsFunctions": [], + "eventsFunctions": [ + { + "description": "Check if the events are running for the editor.", + "fullName": "Editor is running", + "functionType": "Condition", + "name": "IsInGameEdition", + "private": true, + "sentence": "Events are running for the editor", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const game = runtimeScene.getGame();\r", + "eventsFunctionContext.returnValue = game.isInGameEdition && game.isInGameEdition();" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [], + "objectGroups": [] + } + ], "eventsBasedBehaviors": [ { "description": "The finite state machine used internally by the switch object.", @@ -6728,6 +6757,7 @@ "extraInformation": [ "SpriteToggleSwitch::ButtonFSM" ], + "choices": [], "name": "ButtonFSM" }, { @@ -6767,59 +6797,27 @@ "sentence": "", "events": [ { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Finite state machine", - "source": "", - "type": "BuiltinCommonInstructions::Group", - "events": [ + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 + "type": { + "inverted": true, + "value": "SpriteToggleSwitch::IsInGameEdition" }, - "comment": "The \"Validated\" state only last one frame." - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "State", - "=", - "\"Validated\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetStringVariable" - }, - "parameters": [ - "State", - "=", - "\"Idle\"" - ] - } + "parameters": [ + "", + "" ] - }, + } + ], + "actions": [], + "events": [ { "colorB": 228, "colorG": 176, "colorR": 74, "creationTime": 0, - "name": "Check position", + "name": "Finite state machine", "source": "", "type": "BuiltinCommonInstructions::Group", "events": [ @@ -6833,478 +6831,386 @@ "textG": 0, "textR": 0 }, - "comment": "Make sure the cursor position is only checked once per frame." - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "MouseIsInside", - "False", - "" - ] - } - ] + "comment": "The \"Validated\" state only last one frame." }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "ShouldCheckHovering", - "True", - "" - ] - }, - { - "type": { - "value": "CollisionPoint" + "value": "StringVariable" }, "parameters": [ - "Object", - "MouseOnlyCursorX(Object.Layer(), 0)", - "MouseOnlyCursorY(Object.Layer(), 0)" + "State", + "=", + "\"Validated\"" ] } ], "actions": [ { "type": { - "value": "SetBooleanVariable" + "value": "SetStringVariable" }, "parameters": [ - "MouseIsInside", - "True", - "" + "State", + "=", + "\"Idle\"" ] } ] }, { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 - }, - "comment": "Touches are always pressed, so ShouldCheckHovering doesn't matter." - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Check position", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ { - "type": { - "value": "SetBooleanVariable" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 }, - "parameters": [ - "TouchIsInside", - "False", - "" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "comment": "Make sure the cursor position is only checked once per frame." + }, { - "type": { - "value": "NumberVariable" - }, - "parameters": [ - "TouchId", - "!=", - "0" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "MouseIsInside", + "False", + "" + ] + } ] }, { - "type": { - "value": "CollisionPoint" - }, - "parameters": [ - "Object", - "TouchX(TouchId, Object.Layer(), 0)", - "TouchY(TouchId, Object.Layer(), 0)" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "ShouldCheckHovering", + "True", + "" + ] + }, + { + "type": { + "value": "CollisionPoint" + }, + "parameters": [ + "Object", + "MouseOnlyCursorX(Object.Layer(), 0)", + "MouseOnlyCursorY(Object.Layer(), 0)" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "MouseIsInside", + "True", + "" + ] + } ] - } - ], - "actions": [ + }, { - "type": { - "value": "SetBooleanVariable" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 }, - "parameters": [ - "TouchIsInside", - "True", - "" - ] - } - ] - } - ], - "parameters": [] - }, - { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Handle touch start", - "source": "", - "type": "BuiltinCommonInstructions::Group", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "comment": "Touches are always pressed, so ShouldCheckHovering doesn't matter." + }, { - "type": { - "value": "HasAnyTouchOrMouseStarted" - }, - "parameters": [ - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "TouchIsInside", + "False", + "" + ] + } ] - } - ], - "actions": [ + }, { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "Index", - "=", - "0" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "!=", + "0" + ] + }, + { + "type": { + "value": "CollisionPoint" + }, + "parameters": [ + "Object", + "TouchX(TouchId, Object.Layer(), 0)", + "TouchY(TouchId, Object.Layer(), 0)" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "TouchIsInside", + "True", + "" + ] + } ] } ], + "parameters": [] + }, + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Handle touch start", + "source": "", + "type": "BuiltinCommonInstructions::Group", "events": [ { - "type": "BuiltinCommonInstructions::Repeat", - "repeatExpression": "StartedTouchOrMouseCount()", - "conditions": [], - "actions": [], + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "HasAnyTouchOrMouseStarted" + }, + "parameters": [ + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "Index", + "=", + "0" + ] + } + ], "events": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "CollisionPoint" - }, - "parameters": [ - "Object", - "TouchX(StartedTouchOrMouseId(Index), Object.Layer(), 0)", - "TouchY(StartedTouchOrMouseId(Index), Object.Layer(), 0)" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "StartedTouchOrMouseId(Index)" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "TouchIsInside", - "True", - "" - ] - } - ], + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "StartedTouchOrMouseCount()", + "conditions": [], + "actions": [], "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "value": "BuiltinCommonInstructions::Or" + "value": "CollisionPoint" + }, + "parameters": [ + "Object", + "TouchX(StartedTouchOrMouseId(Index), Object.Layer(), 0)", + "TouchY(StartedTouchOrMouseId(Index), Object.Layer(), 0)" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" }, - "parameters": [], - "subInstructions": [ + "parameters": [ + "TouchId", + "=", + "StartedTouchOrMouseId(Index)" + ] + }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "TouchIsInside", + "True", + "" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { "type": { - "value": "SpriteToggleSwitch::ButtonFSM::PropertyState" + "value": "BuiltinCommonInstructions::Or" }, - "parameters": [ - "Object", - "Behavior", - "=", - "\"Hovered\"" + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "SpriteToggleSwitch::ButtonFSM::PropertyState" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "\"Hovered\"" + ] + }, + { + "type": { + "value": "SpriteToggleSwitch::ButtonFSM::PropertyState" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "\"Idle\"" + ] + } ] - }, + } + ], + "actions": [ { "type": { - "value": "SpriteToggleSwitch::ButtonFSM::PropertyState" + "value": "SetStringVariable" }, "parameters": [ - "Object", - "Behavior", + "State", "=", - "\"Idle\"" + "\"PressedInside\"" ] } ] } - ], - "actions": [ - { - "type": { - "value": "SetStringVariable" - }, - "parameters": [ - "State", - "=", - "\"PressedInside\"" - ] - } ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ + }, { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "Index", - "+", - "1" - ] - } - ] - } - ] - } - ] - } - ], - "parameters": [] - }, - { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Apply position changes", - "source": "", - "type": "BuiltinCommonInstructions::Group", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "inverted": true, - "value": "BooleanVariable" - }, - "parameters": [ - "MouseIsInside", - "True", - "" - ] - }, - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "State", - "=", - "\"Hovered\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetStringVariable" - }, - "parameters": [ - "State", - "=", - "\"Idle\"" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "MouseIsInside", - "True", - "" - ] - }, - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "State", - "=", - "\"Idle\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetStringVariable" - }, - "parameters": [ - "State", - "=", - "\"Hovered\"" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "inverted": true, - "value": "BooleanVariable" - }, - "parameters": [ - "TouchIsInside", - "True", - "" - ] - }, - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "State", - "=", - "\"PressedInside\"" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "Index", + "+", + "1" + ] + } + ] + } + ] + } ] } ], - "actions": [ - { - "type": { - "value": "SetStringVariable" - }, - "parameters": [ - "State", - "=", - "\"PressedOutside\"" - ] - } - ] + "parameters": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Apply position changes", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ { - "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "TouchIsInside", - "True", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "BooleanVariable" + }, + "parameters": [ + "MouseIsInside", + "True", + "" + ] + }, + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "State", + "=", + "\"Hovered\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "State", + "=", + "\"Idle\"" + ] + } ] }, - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "State", - "=", - "\"PressedOutside\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetStringVariable" - }, - "parameters": [ - "State", - "=", - "\"PressedInside\"" - ] - } - ] - } - ], - "parameters": [] - }, - { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Handle touch end", - "source": "", - "type": "BuiltinCommonInstructions::Group", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "HasTouchEnded" - }, - "parameters": [ - "", - "TouchId" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "0" - ] - } - ], - "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "MouseIsInside", + "True", + "" + ] + }, { "type": { "value": "StringVariable" @@ -7312,7 +7218,7 @@ "parameters": [ "State", "=", - "\"PressedInside\"" + "\"Idle\"" ] } ], @@ -7324,7 +7230,7 @@ "parameters": [ "State", "=", - "\"Validated\"" + "\"Hovered\"" ] } ] @@ -7335,6 +7241,16 @@ { "type": { "inverted": true, + "value": "BooleanVariable" + }, + "parameters": [ + "TouchIsInside", + "True", + "" + ] + }, + { + "type": { "value": "StringVariable" }, "parameters": [ @@ -7342,16 +7258,42 @@ "=", "\"PressedInside\"" ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "State", + "=", + "\"PressedOutside\"" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "TouchIsInside", + "True", + "" + ] }, { "type": { - "inverted": true, "value": "StringVariable" }, "parameters": [ "State", "=", - "\"Validated\"" + "\"PressedOutside\"" ] } ], @@ -7363,18 +7305,124 @@ "parameters": [ "State", "=", - "\"Idle\"" + "\"PressedInside\"" ] } ] } - ] + ], + "parameters": [] + }, + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Handle touch end", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "HasTouchEnded" + }, + "parameters": [ + "", + "TouchId" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "0" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "State", + "=", + "\"PressedInside\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "State", + "=", + "\"Validated\"" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "StringVariable" + }, + "parameters": [ + "State", + "=", + "\"PressedInside\"" + ] + }, + { + "type": { + "inverted": true, + "value": "StringVariable" + }, + "parameters": [ + "State", + "=", + "\"Validated\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "State", + "=", + "\"Idle\"" + ] + } + ] + } + ] + } + ], + "parameters": [] } ], "parameters": [] } - ], - "parameters": [] + ] } ], "parameters": [ @@ -7846,12 +7894,27 @@ "value": "Idle", "type": "Choice", "label": "State", - "extraInformation": [ - "Idle", - "Hovered", - "PressedInside", - "PressedOutside", - "Validated" + "choices": [ + { + "label": "Idle", + "value": "Idle" + }, + { + "label": "Hovered", + "value": "Hovered" + }, + { + "label": "PressedInside", + "value": "PressedInside" + }, + { + "label": "PressedOutside", + "value": "PressedOutside" + }, + { + "label": "Validated", + "value": "Validated" + } ], "hidden": true, "name": "State" @@ -10925,11 +10988,23 @@ "value": "None", "type": "Choice", "label": "Selected tool", - "extraInformation": [ - "None", - "House", - "Mine", - "Lumber" + "choices": [ + { + "label": "None", + "value": "None" + }, + { + "label": "House", + "value": "House" + }, + { + "label": "Mine", + "value": "Mine" + }, + { + "label": "Lumber", + "value": "Lumber" + } ], "hidden": true, "name": "SelectedTool" @@ -11037,6 +11112,7 @@ "extraInformation": [ "Tween::TweenBehavior" ], + "choices": [], "name": "Tween" }, { From 6375aac05e4ac46182e94ed80554466db56404e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Davy=20H=C3=A9lard?= Date: Wed, 8 Oct 2025 15:55:20 +0200 Subject: [PATCH 11/12] [3D wall sliding] Update the extensions --- examples/3d-wall-sliding/3d-wall-sliding.json | 2383 +++++++++-------- .../Floating Out Button Dark Blue_Hovered.png | Bin 205 -> 305 bytes .../Floating Out Button Dark Blue_Idle.png | Bin 202 -> 300 bytes .../Floating Out Button Dark Blue_Pressed.png | Bin 188 -> 274 bytes 4 files changed, 1309 insertions(+), 1074 deletions(-) diff --git a/examples/3d-wall-sliding/3d-wall-sliding.json b/examples/3d-wall-sliding/3d-wall-sliding.json index 5b3426bec..a1ec87727 100644 --- a/examples/3d-wall-sliding/3d-wall-sliding.json +++ b/examples/3d-wall-sliding/3d-wall-sliding.json @@ -155,6 +155,17 @@ "smoothed": true, "userAdded": false }, + { + "file": "assets/Gem Green.glb", + "kind": "model3D", + "metadata": "", + "name": "Gem Green.glb", + "userAdded": false, + "origin": { + "identifier": "https://asset-resources.gdevelop.io/public-resources/3D Platformer Game Kit/Collectable/a13481ad345a2bf292784ac3660b13eda872c257917eeb0f1b02542ebc719605_Gem Green.glb", + "name": "Gem Green.glb" + } + }, { "file": "assets/Floating Out Button Dark Blue_Hovered.png", "kind": "image", @@ -201,17 +212,6 @@ "identifier": "https://asset-resources.gdevelop.io/public-resources/Menu buttons/44aceaa249d2ecb8bfe3eb7bedcb17aac44c0f5f13f9f58d85427a5afa7e92f0_CarterOne-Regular.ttf", "name": "CarterOne-Regular.ttf" } - }, - { - "file": "assets/Gem Green.glb", - "kind": "model3D", - "metadata": "", - "name": "Gem Green.glb", - "userAdded": false, - "origin": { - "identifier": "https://asset-resources.gdevelop.io/public-resources/3D Platformer Game Kit/Collectable/a13481ad345a2bf292784ac3660b13eda872c257917eeb0f1b02542ebc719605_Gem Green.glb", - "name": "Gem Green.glb" - } } ], "resourceFolders": [] @@ -243,7 +243,7 @@ "gridColor": 10401023, "gridAlpha": 0.8, "snap": false, - "zoomFactor": 0.6455105703311483, + "zoomFactor": 0.4335774304702378, "windowMask": false }, "objectsGroups": [], @@ -251,16 +251,17 @@ "instances": [ { "angle": 0, - "customSize": false, - "height": 0, + "customSize": true, + "depth": 1, + "height": 88, "keepRatio": true, "layer": "", - "name": "PlayButton", - "persistentUuid": "07ca2fcf-0a73-4b82-bfea-bc5249444576", - "width": 0, - "x": 547, - "y": 339, - "zOrder": 1, + "name": "Title", + "persistentUuid": "0fd375a3-01cc-46ed-b3cb-455316493c81", + "width": 1280, + "x": 0, + "y": 51, + "zOrder": 3, "numberProperties": [], "stringProperties": [], "initialVariables": [] @@ -271,12 +272,12 @@ "height": 0, "keepRatio": true, "layer": "", - "name": "Title", - "persistentUuid": "0fd375a3-01cc-46ed-b3cb-455316493c81", + "name": "Author", + "persistentUuid": "8141267e-305c-41d2-8f92-dd27aeac6240", "width": 0, - "x": 412, - "y": 29, - "zOrder": 3, + "x": 722, + "y": 635, + "zOrder": 4, "numberProperties": [], "stringProperties": [], "initialVariables": [] @@ -287,104 +288,18 @@ "height": 0, "keepRatio": true, "layer": "", - "name": "Author", - "persistentUuid": "8141267e-305c-41d2-8f92-dd27aeac6240", + "name": "PlayButton", + "persistentUuid": "9792fa35-4853-41aa-b78b-3f9049ad132d", "width": 0, - "x": 722, - "y": 635, - "zOrder": 4, + "x": 544, + "y": 318, + "zOrder": 5, "numberProperties": [], "stringProperties": [], "initialVariables": [] } ], "objects": [ - { - "assetStoreId": "d00645a899e762e085fa6fdf2625701baea9cc10ee903a64ca7d371e5bbb8dca", - "name": "PlayButton", - "type": "PanelSpriteButton::PanelSpriteButton", - "variant": "", - "variables": [], - "effects": [], - "behaviors": [], - "content": { - "LeftPadding": 0, - "RightPadding": 0, - "PressedLabelOffsetY": 2, - "BottomPadding": 4, - "TopPadding": 0, - "HoveredFadeOutDuration": 0 - }, - "childrenContent": { - "Hovered": { - "bottomMargin": 10, - "height": 64, - "leftMargin": 6, - "rightMargin": 6, - "texture": "Floating Out Button Dark Blue_Hovered.png", - "tiled": false, - "topMargin": 10, - "width": 192 - }, - "Idle": { - "bottomMargin": 10, - "height": 64, - "leftMargin": 6, - "rightMargin": 6, - "texture": "Floating Out Button Dark Blue_Idle.png", - "tiled": false, - "topMargin": 10, - "width": 192 - }, - "Label": { - "bold": false, - "italic": false, - "smoothed": true, - "underlined": false, - "string": "play", - "font": "CarterOne-Regular.ttf", - "textAlignment": "center", - "characterSize": 40, - "color": { - "b": 255, - "g": 255, - "r": 255 - }, - "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": "play", - "font": "CarterOne-Regular.ttf", - "textAlignment": "center", - "verticalTextAlignment": "top", - "characterSize": 40, - "lineHeight": 0, - "color": "255;255;255" - } - }, - "Pressed": { - "bottomMargin": 10, - "height": 64, - "leftMargin": 6, - "rightMargin": 6, - "texture": "Floating Out Button Dark Blue_Pressed.png", - "tiled": false, - "topMargin": 10, - "width": 192 - } - } - }, { "assetStoreId": "", "bold": false, @@ -481,6 +396,24 @@ "lineHeight": 0, "color": "255;255;255" } + }, + { + "assetStoreId": "d00645a899e762e085fa6fdf2625701baea9cc10ee903a64ca7d371e5bbb8dca", + "name": "PlayButton", + "type": "PanelSpriteButton::PanelSpriteButton", + "variant": "Floating Out Button Dark Blue", + "variables": [], + "effects": [], + "behaviors": [], + "content": { + "LeftPadding": 0, + "RightPadding": 0, + "PressedLabelOffsetY": 2, + "BottomPadding": 4, + "TopPadding": 0, + "HoveredFadeOutDuration": 0, + "LabelText": "Play" + } } ], "objectsFolderStructure": { @@ -13901,15 +13834,15 @@ "category": "User interface", "extensionNamespace": "", "fullName": "Panel sprite button", - "gdevelopVersion": ">=5.5.222", + "gdevelopVersion": ">=5.5.230", "helpPath": "/objects/button", "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyMy4wLjMsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iSWNvbnMiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB2aWV3Qm94PSIwIDAgMzIgMzIiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDMyIDMyOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8c3R5bGUgdHlwZT0idGV4dC9jc3MiPg0KCS5zdDB7ZmlsbDpub25lO3N0cm9rZTojMDAwMDAwO3N0cm9rZS13aWR0aDoyO3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1saW5lam9pbjpyb3VuZDtzdHJva2UtbWl0ZXJsaW1pdDoxMDt9DQo8L3N0eWxlPg0KPHBhdGggY2xhc3M9InN0MCIgZD0iTTI5LDIzSDNjLTEuMSwwLTItMC45LTItMlYxMWMwLTEuMSwwLjktMiwyLTJoMjZjMS4xLDAsMiwwLjksMiwydjEwQzMxLDIyLjEsMzAuMSwyMywyOSwyM3oiLz4NCjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik0xMywxOUwxMywxOWMtMS4xLDAtMi0wLjktMi0ydi0yYzAtMS4xLDAuOS0yLDItMmgwYzEuMSwwLDIsMC45LDIsMnYyQzE1LDE4LjEsMTQuMSwxOSwxMywxOXoiLz4NCjxsaW5lIGNsYXNzPSJzdDAiIHgxPSIxOCIgeTE9IjEzIiB4Mj0iMTgiIHkyPSIxOSIvPg0KPGxpbmUgY2xhc3M9InN0MCIgeDE9IjIxIiB5MT0iMTMiIHgyPSIxOCIgeTI9IjE3Ii8+DQo8bGluZSBjbGFzcz0ic3QwIiB4MT0iMjEiIHkxPSIxOSIgeDI9IjE5IiB5Mj0iMTYiLz4NCjwvc3ZnPg0K", "name": "PanelSpriteButton", "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/Line Hero Pack/Master/SVG/Interface Elements/Interface Elements_interface_ui_button_ok_cta_clock_tap.svg", "shortDescription": "A button that can be customized.", - "version": "1.5.0", + "version": "2.1.1", "description": [ - "The button can be customized with a background for each state and a label. It handles user interactions and a simple condition can be used to check if it is clicked.", + "A button that can be used for menus and most labelled buttons of a game. The button can be customized with a background for each state and a label. It handles user interactions and a simple condition can be used to check if it is clicked.", "", "There are ready-to-use buttons in the asset-store [menu buttons pack](https://editor.gdevelop.io/?initial-dialog=asset-store&asset-pack=menu-buttons-menu-buttons)." ], @@ -13924,10 +13857,39 @@ "authorIds": [ "IWykYNRvhCZBN3vEgKEbBPOR3Oc2" ], + "changelog": [ + { + "version": "2.0.0", + "breaking": "- Buttons now use \"variants\", allowing easy swapping of their visual aspect. You will have to make some adjustments to existing buttons in your project. Follow this [migration documentation](https://wiki.gdevelop.io/gdevelop5/objects/custom-objects-prefab-template/migrate-to-variants/) to do these changes." + } + ], "dependencies": [], "globalVariables": [], "sceneVariables": [], - "eventsFunctions": [], + "eventsFunctions": [ + { + "description": "Check if the events are running for the editor.", + "fullName": "Editor is running", + "functionType": "Condition", + "name": "IsInGameEdition", + "private": true, + "sentence": "Events are running for the editor", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const game = runtimeScene.getGame();\r", + "eventsFunctionContext.returnValue = game.isInGameEdition && game.isInGameEdition();" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [], + "objectGroups": [] + } + ], "eventsBasedBehaviors": [ { "description": "The finite state machine used internally by the button object.", @@ -13943,59 +13905,27 @@ "sentence": "", "events": [ { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Finite state machine", - "source": "", - "type": "BuiltinCommonInstructions::Group", - "events": [ + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 + "type": { + "inverted": true, + "value": "PanelSpriteButton::IsInGameEdition" }, - "comment": "The \"Validated\" state only last one frame." - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "State", - "=", - "\"Validated\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetStringVariable" - }, - "parameters": [ - "State", - "=", - "\"Idle\"" - ] - } + "parameters": [ + "", + "" ] - }, + } + ], + "actions": [], + "events": [ { "colorB": 228, "colorG": 176, "colorR": 74, "creationTime": 0, - "name": "Check position", + "name": "Finite state machine", "source": "", "type": "BuiltinCommonInstructions::Group", "events": [ @@ -14009,478 +13939,424 @@ "textG": 0, "textR": 0 }, - "comment": "Make sure the cursor position is only checked once per frame." - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "MouseIsInside", - "False", - "" - ] - } - ] + "comment": "The \"Validated\" state only last one frame." }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "ShouldCheckHovering", - "True", - "" - ] - }, - { - "type": { - "value": "CollisionPoint" + "value": "StringVariable" }, "parameters": [ - "Object", - "MouseOnlyCursorX(Object.Layer(), 0)", - "MouseOnlyCursorY(Object.Layer(), 0)" + "State", + "=", + "\"Validated\"" ] } ], "actions": [ { "type": { - "value": "SetBooleanVariable" + "value": "SetStringVariable" }, "parameters": [ - "MouseIsInside", - "True", - "" + "State", + "=", + "\"Idle\"" ] } ] }, { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 - }, - "comment": "Touches are always pressed, so ShouldCheckHovering doesn't matter." - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Check position", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "TouchIsInside", - "False", - "" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "NumberVariable" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 }, - "parameters": [ - "TouchId", - "!=", - "0" - ] + "comment": "Make sure the cursor position is only checked once per frame." }, { - "type": { - "value": "CollisionPoint" - }, - "parameters": [ - "Object", - "TouchX(TouchId, Object.Layer(), 0)", - "TouchY(TouchId, Object.Layer(), 0)" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "TouchIsInside", - "True", - "" - ] - } - ] - } - ], - "parameters": [] - }, - { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Handle touch start", - "source": "", - "type": "BuiltinCommonInstructions::Group", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "HasAnyTouchOrMouseStarted" - }, - "parameters": [ - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "Index", - "=", - "0" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "MouseIsInside", + "False", + "" + ] + } ] - } - ], - "events": [ + }, { - "type": "BuiltinCommonInstructions::Repeat", - "repeatExpression": "StartedTouchOrMouseCount()", - "conditions": [], - "actions": [], - "events": [ + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "CollisionPoint" - }, - "parameters": [ - "Object", - "TouchX(StartedTouchOrMouseId(Index), Object.Layer(), 0)", - "TouchY(StartedTouchOrMouseId(Index), Object.Layer(), 0)" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "StartedTouchOrMouseId(Index)" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "TouchIsInside", - "True", - "" - ] - } - ], - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::Or" - }, - "parameters": [], - "subInstructions": [ - { - "type": { - "value": "PanelSpriteButton::ButtonFSM::PropertyState" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "\"Hovered\"" - ] - }, - { - "type": { - "value": "PanelSpriteButton::ButtonFSM::PropertyState" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "\"Idle\"" - ] - } - ] - } - ], - "actions": [ - { - "type": { - "value": "SetStringVariable" - }, - "parameters": [ - "State", - "=", - "\"PressedInside\"" - ] - } - ] - } + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "ShouldCheckHovering", + "True", + "" ] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "Index", - "+", - "1" - ] - } + "type": { + "value": "CollisionPoint" + }, + "parameters": [ + "Object", + "MouseOnlyCursorX(Object.Layer(), 0)", + "MouseOnlyCursorY(Object.Layer(), 0)" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "MouseIsInside", + "True", + "" ] } - ] - } - ] - } - ], - "parameters": [] - }, - { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Apply position changes", - "source": "", - "type": "BuiltinCommonInstructions::Group", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "inverted": true, - "value": "BooleanVariable" - }, - "parameters": [ - "MouseIsInside", - "True", - "" ] }, { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "State", - "=", - "\"Hovered\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetStringVariable" - }, - "parameters": [ - "State", - "=", - "\"Idle\"" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BooleanVariable" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 }, - "parameters": [ - "MouseIsInside", - "True", - "" - ] + "comment": "Touches are always pressed, so ShouldCheckHovering doesn't matter." }, { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "State", - "=", - "\"Idle\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetStringVariable" - }, - "parameters": [ - "State", - "=", - "\"Hovered\"" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "inverted": true, - "value": "BooleanVariable" - }, - "parameters": [ - "TouchIsInside", - "True", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "TouchIsInside", + "False", + "" + ] + } ] }, { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "State", - "=", - "\"PressedInside\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetStringVariable" - }, - "parameters": [ - "State", - "=", - "\"PressedOutside\"" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "!=", + "0" + ] + }, + { + "type": { + "value": "CollisionPoint" + }, + "parameters": [ + "Object", + "TouchX(TouchId, Object.Layer(), 0)", + "TouchY(TouchId, Object.Layer(), 0)" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "TouchIsInside", + "True", + "" + ] + } ] } - ] + ], + "parameters": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "TouchIsInside", - "True", - "" - ] - }, + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Handle touch start", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "State", - "=", - "\"PressedOutside\"" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "HasAnyTouchOrMouseStarted" + }, + "parameters": [ + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "Index", + "=", + "0" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "StartedTouchOrMouseCount()", + "conditions": [], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "CollisionPoint" + }, + "parameters": [ + "Object", + "TouchX(StartedTouchOrMouseId(Index), Object.Layer(), 0)", + "TouchY(StartedTouchOrMouseId(Index), Object.Layer(), 0)" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "StartedTouchOrMouseId(Index)" + ] + }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "TouchIsInside", + "True", + "" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::Or" + }, + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "PanelSpriteButton::ButtonFSM::PropertyState" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "\"Hovered\"" + ] + }, + { + "type": { + "value": "PanelSpriteButton::ButtonFSM::PropertyState" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "\"Idle\"" + ] + } + ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "State", + "=", + "\"PressedInside\"" + ] + } + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "Index", + "+", + "1" + ] + } + ] + } + ] + } ] } ], - "actions": [ - { - "type": { - "value": "SetStringVariable" - }, - "parameters": [ - "State", - "=", - "\"PressedInside\"" - ] - } - ] - } - ], - "parameters": [] - }, - { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Handle touch end", - "source": "", - "type": "BuiltinCommonInstructions::Group", - "events": [ + "parameters": [] + }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Apply position changes", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ { - "type": { - "value": "HasTouchEnded" - }, - "parameters": [ - "", - "TouchId" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "BooleanVariable" + }, + "parameters": [ + "MouseIsInside", + "True", + "" + ] + }, + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "State", + "=", + "\"Hovered\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "State", + "=", + "\"Idle\"" + ] + } ] - } - ], - "actions": [ + }, { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "0" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "MouseIsInside", + "True", + "" + ] + }, + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "State", + "=", + "\"Idle\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "State", + "=", + "\"Hovered\"" + ] + } ] - } - ], - "events": [ + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ + { + "type": { + "inverted": true, + "value": "BooleanVariable" + }, + "parameters": [ + "TouchIsInside", + "True", + "" + ] + }, { "type": { "value": "StringVariable" @@ -14500,7 +14376,7 @@ "parameters": [ "State", "=", - "\"Validated\"" + "\"PressedOutside\"" ] } ] @@ -14510,47 +14386,151 @@ "conditions": [ { "type": { - "inverted": true, + "value": "BooleanVariable" + }, + "parameters": [ + "TouchIsInside", + "True", + "" + ] + }, + { + "type": { "value": "StringVariable" }, + "parameters": [ + "State", + "=", + "\"PressedOutside\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, "parameters": [ "State", "=", "\"PressedInside\"" ] - }, + } + ] + } + ], + "parameters": [] + }, + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Handle touch end", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { "type": { - "inverted": true, - "value": "StringVariable" + "value": "HasTouchEnded" }, "parameters": [ - "State", - "=", - "\"Validated\"" + "", + "TouchId" ] } ], "actions": [ { "type": { - "value": "SetStringVariable" + "value": "SetNumberVariable" }, "parameters": [ - "State", + "TouchId", "=", - "\"Idle\"" + "0" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "State", + "=", + "\"PressedInside\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "State", + "=", + "\"Validated\"" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "StringVariable" + }, + "parameters": [ + "State", + "=", + "\"PressedInside\"" + ] + }, + { + "type": { + "inverted": true, + "value": "StringVariable" + }, + "parameters": [ + "State", + "=", + "\"Validated\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "State", + "=", + "\"Idle\"" + ] + } ] } ] } - ] + ], + "parameters": [] } ], "parameters": [] } - ], - "parameters": [] + ] } ], "parameters": [ @@ -15082,7 +15062,7 @@ ], "eventsBasedObjects": [ { - "areaMaxX": 64, + "areaMaxX": 256, "areaMaxY": 64, "areaMaxZ": 64, "areaMinX": 0, @@ -15091,7 +15071,8 @@ "defaultName": "Button", "description": "A button that can be customized.", "fullName": "Button (panel sprite)", - "isUsingLegacyInstancesRenderer": true, + "isInnerAreaFollowingParentSize": true, + "isUsingLegacyInstancesRenderer": false, "name": "PanelSpriteButton", "objects": [ { @@ -15104,10 +15085,21 @@ "underlined": false, "variables": [], "effects": [], - "behaviors": [], + "behaviors": [ + { + "name": "Anchor", + "type": "AnchorBehavior::AnchorBehavior", + "bottomEdgeAnchor": 4, + "topEdgeAnchor": 4, + "leftEdgeAnchor": 1, + "relativeToOriginalWindowSize": true, + "rightEdgeAnchor": 2, + "useLegacyBottomAndRightAnchors": false + } + ], "string": "Text", "font": "", - "textAlignment": "", + "textAlignment": "center", "characterSize": 20, "color": { "b": 0, @@ -15130,8 +15122,8 @@ "underlined": false, "text": "Text", "font": "", - "textAlignment": "", - "verticalTextAlignment": "top", + "textAlignment": "center", + "verticalTextAlignment": "center", "characterSize": 20, "lineHeight": 0, "color": "0;0;0" @@ -15159,6 +15151,16 @@ ], "effects": [], "behaviors": [ + { + "name": "Anchor", + "type": "AnchorBehavior::AnchorBehavior", + "bottomEdgeAnchor": 2, + "leftEdgeAnchor": 1, + "relativeToOriginalWindowSize": true, + "rightEdgeAnchor": 2, + "topEdgeAnchor": 1, + "useLegacyBottomAndRightAnchors": false + }, { "name": "ButtonFSM", "type": "PanelSpriteButton::ButtonFSM", @@ -15181,6 +15183,16 @@ "variables": [], "effects": [], "behaviors": [ + { + "name": "Anchor", + "type": "AnchorBehavior::AnchorBehavior", + "bottomEdgeAnchor": 2, + "leftEdgeAnchor": 1, + "relativeToOriginalWindowSize": true, + "rightEdgeAnchor": 2, + "topEdgeAnchor": 1, + "useLegacyBottomAndRightAnchors": false + }, { "name": "Tween", "type": "Tween::TweenBehavior" @@ -15201,7 +15213,48 @@ "width": 32, "variables": [], "effects": [], - "behaviors": [] + "behaviors": [ + { + "name": "Anchor", + "type": "AnchorBehavior::AnchorBehavior", + "bottomEdgeAnchor": 2, + "leftEdgeAnchor": 1, + "relativeToOriginalWindowSize": true, + "rightEdgeAnchor": 2, + "topEdgeAnchor": 1, + "useLegacyBottomAndRightAnchors": false + } + ] + }, + { + "assetStoreId": "", + "name": "BitmapLabel", + "type": "BitmapText::BitmapTextObject", + "variables": [], + "effects": [], + "behaviors": [ + { + "name": "Anchor", + "type": "AnchorBehavior::AnchorBehavior", + "bottomEdgeAnchor": 4, + "topEdgeAnchor": 4, + "leftEdgeAnchor": 1, + "relativeToOriginalWindowSize": true, + "rightEdgeAnchor": 2, + "useLegacyBottomAndRightAnchors": false + } + ], + "content": { + "text": "Text", + "opacity": 255, + "scale": 1, + "fontSize": 20, + "tint": "255;255;255", + "bitmapFontResourceName": "", + "textureAtlasResourceName": "", + "align": "center", + "verticalTextAlignment": "center" + } } ], "objectsFolderStructure": { @@ -15210,6 +15263,9 @@ { "objectName": "Label" }, + { + "objectName": "BitmapLabel" + }, { "objectName": "Idle" }, @@ -15221,7 +15277,33 @@ } ] }, - "objectsGroups": [], + "objectsGroups": [ + { + "name": "Background", + "objects": [ + { + "name": "Idle" + }, + { + "name": "Hovered" + }, + { + "name": "Pressed" + } + ] + }, + { + "name": "Labels", + "objects": [ + { + "name": "Label" + }, + { + "name": "BitmapLabel" + } + ] + } + ], "layers": [ { "ambientLightColorB": 200, @@ -15252,7 +15334,40 @@ "effects": [] } ], - "instances": [], + "instances": [ + { + "angle": 0, + "customSize": true, + "depth": 1, + "height": 64, + "layer": "", + "name": "Idle", + "persistentUuid": "24882334-eec8-403e-8bf1-70fc928a46e6", + "width": 256, + "x": 0, + "y": 0, + "zOrder": 1, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": true, + "depth": 1, + "height": 64, + "layer": "", + "name": "Label", + "persistentUuid": "3b29c95c-5363-4e25-bf47-eecf13e8a226", + "width": 256, + "x": 0, + "y": 32, + "zOrder": 2, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + } + ], "eventsFunctions": [ { "fullName": "", @@ -15282,7 +15397,7 @@ }, "parameters": [ "", - "Idle", + "Hovered", "0", "0", "" @@ -15294,7 +15409,7 @@ }, "parameters": [ "", - "Hovered", + "Pressed", "0", "0", "" @@ -15302,14 +15417,24 @@ }, { "type": { - "value": "Create" + "value": "ResizableCapability::ResizableBehavior::SetSize" + }, + "parameters": [ + "Hovered", + "Resizable", + "Idle.Width()", + "Idle.Height()" + ] + }, + { + "type": { + "value": "ResizableCapability::ResizableBehavior::SetSize" }, "parameters": [ - "", "Pressed", - "0", - "0", - "" + "Resizable", + "Idle.Width()", + "Idle.Height()" ] }, { @@ -15337,63 +15462,26 @@ "=", "1" ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 - }, - "comment": "Place the label over the backgrounds." - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "Create" - }, - "parameters": [ - "", - "Label", - "0", - "0", - "" - ] }, { "type": { "value": "ChangePlan" }, "parameters": [ - "Label", + "Pressed", "=", - "2" - ] - }, - { - "type": { - "value": "TextObject::SetWrapping" - }, - "parameters": [ - "Label", - "yes" + "1" ] }, { "type": { - "value": "PanelSpriteButton::PanelSpriteButton::CenterLabel" + "value": "TextContainerCapability::TextContainerBehavior::SetValue" }, "parameters": [ - "Object", - "" + "Labels", + "Text", + "=", + "LabelText" ] } ] @@ -15432,18 +15520,47 @@ "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "PanelSpriteButton::PanelSpriteButton::IsPressed" + }, + "parameters": [ + "Object", + "" + ] + } + ], "actions": [ { "type": { - "value": "PanelSpriteButton::PanelSpriteButton::CenterLabel" + "value": "PanelSpriteButton::PanelSpriteButton::SetLabelOffset" }, "parameters": [ "Object", + "=", + "PressedLabelOffsetY", "" ] } ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "TextContainerCapability::TextContainerBehavior::SetValue" + }, + "parameters": [ + "Labels", + "Text", + "=", + "LabelText" + ] + } + ] } ], "parameters": [ @@ -15505,12 +15622,13 @@ "actions": [ { "type": { - "value": "SetCenterY" + "value": "PanelSpriteButton::PanelSpriteButton::SetLabelOffset" }, "parameters": [ - "Label", + "Object", "=", - "Object.CenterWithPaddingY()" + "0", + "" ] }, { @@ -15557,7 +15675,7 @@ "actions": [ { "type": { - "value": "Tween::AddObjectOpacityTween" + "value": "Tween::TweenBehavior::AddObjectOpacityTween2" }, "parameters": [ "Hovered", @@ -15565,7 +15683,7 @@ "\"Fadeout\"", "0", "\"linear\"", - "Object.PropertyHoveredFadeOutDuration() * 1000", + "HoveredFadeOutDuration", "" ] } @@ -15603,10 +15721,11 @@ "conditions": [ { "type": { - "value": "PanelSpriteObject::Opacity" + "value": "OpacityCapability::OpacityBehavior::Value" }, "parameters": [ "Hovered", + "Opacity", "=", "0" ] @@ -15623,10 +15742,11 @@ }, { "type": { - "value": "PanelSpriteObject::SetOpacity" + "value": "OpacityCapability::OpacityBehavior::SetValue" }, "parameters": [ "Hovered", + "Opacity", "=", "255" ] @@ -15655,12 +15775,13 @@ "actions": [ { "type": { - "value": "SetCenterY" + "value": "PanelSpriteButton::PanelSpriteButton::SetLabelOffset" }, "parameters": [ - "Label", + "Object", "=", - "Object.CenterWithPaddingY()" + "0", + "" ] }, { @@ -15700,10 +15821,11 @@ }, { "type": { - "value": "PanelSpriteObject::SetOpacity" + "value": "OpacityCapability::OpacityBehavior::SetValue" }, "parameters": [ "Hovered", + "Opacity", "=", "255" ] @@ -15732,12 +15854,13 @@ "actions": [ { "type": { - "value": "SetCenterY" + "value": "PanelSpriteButton::PanelSpriteButton::SetLabelOffset" }, "parameters": [ - "Label", + "Object", "=", - "Object.CenterWithPaddingY() + Object.PropertyPressedLabelOffsetY()" + "PressedLabelOffsetY", + "" ] }, { @@ -15789,28 +15912,12 @@ "actions": [ { "type": { - "value": "SetCenterY" + "value": "PanelSpriteButton::PanelSpriteButton::SetLabelOffset" }, "parameters": [ - "Label", + "Object", "=", - "Object.CenterWithPaddingY()" - ] - }, - { - "type": { - "value": "Cache" - }, - "parameters": [ - "Idle" - ] - }, - { - "type": { - "value": "Montre" - }, - "parameters": [ - "Hovered", + "0", "" ] }, @@ -15819,144 +15926,24 @@ "value": "Cache" }, "parameters": [ - "Pressed" + "Idle" ] - } - ] - } - ], - "parameters": [] - }, - { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Resize", - "source": "", - "type": "BuiltinCommonInstructions::Group", - "events": [ - { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 - }, - "comment": "Children instances must be resized when the button size change:\n- backgrounds for each state are resized to take the full dimensions of the button\n- the label is put back at the center of the button\n\nThe scale is set back to 1 because it means that the parent instance has the same dimensions as the union of its children instances." - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + }, { "type": { - "value": "BuiltinCommonInstructions::Or" + "value": "Montre" }, - "parameters": [], - "subInstructions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareNumbers" - }, - "parameters": [ - "Object.Width()", - "!=", - "max(Idle.BoundingBoxRight(), Label.BoundingBoxRight()) - min(Idle.BoundingBoxLeft(), Label.BoundingBoxLeft())" - ] - }, - { - "type": { - "value": "BuiltinCommonInstructions::CompareNumbers" - }, - "parameters": [ - "Object.Height()", - "!=", - "max(Idle.BoundingBoxBottom(), Label.BoundingBoxBottom()) - min(Idle.BoundingBoxTop(), Label.BoundingBoxTop())" - ] - } + "parameters": [ + "Hovered", + "" ] - } - ], - "actions": [], - "events": [ + }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "Width", - "=", - "Object.Width()" - ] - }, - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "Height", - "=", - "Object.Height()" - ] - }, - { - "type": { - "value": "PanelSpriteButton::Scale" - }, - "parameters": [ - "Object", - "=", - "1" - ] - }, - { - "type": { - "value": "PanelSpriteObject::Width" - }, - "parameters": [ - "Background", - "=", - "Width" - ] - }, - { - "type": { - "value": "PanelSpriteObject::Height" - }, - "parameters": [ - "Background", - "=", - "Height" - ] - }, - { - "type": { - "value": "PanelSpriteButton::PanelSpriteButton::CenterLabel" - }, - "parameters": [ - "Object", - "" - ] - } - ], - "variables": [ - { - "name": "Width", - "type": "number", - "value": 0 - }, - { - "name": "Height", - "type": "number", - "value": 0 - } + "type": { + "value": "Cache" + }, + "parameters": [ + "Pressed" ] } ] @@ -15973,22 +15960,7 @@ "type": "object" } ], - "objectGroups": [ - { - "name": "Background", - "objects": [ - { - "name": "Idle" - }, - { - "name": "Hovered" - }, - { - "name": "Pressed" - } - ] - } - ] + "objectGroups": [] }, { "description": "Check if the button is not used.", @@ -16210,206 +16182,62 @@ "fullName": "Label text", "functionType": "Action", "name": "SetLabelText", - "sentence": "Change the text of _PARAM0_ to _PARAM1_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "TextObject::String" - }, - "parameters": [ - "Label", - "=", - "LabelText" - ] - }, - { - "type": { - "value": "PanelSpriteButton::PanelSpriteButton::CenterLabel" - }, - "parameters": [ - "Object", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "supplementaryInformation": "PanelSpriteButton::PanelSpriteButton", - "type": "object" - }, - { - "description": "Text", - "name": "LabelText", - "type": "string" - } - ], - "objectGroups": [] - }, - { - "description": "the label text.", - "fullName": "Label text", - "functionType": "ExpressionAndCondition", - "name": "LabelText", - "sentence": "the label text", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnString" - }, - "parameters": [ - "Label.String()" - ] - } - ] - } - ], - "expressionType": { - "type": "string" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "supplementaryInformation": "PanelSpriteButton::PanelSpriteButton", - "type": "object" - } - ], - "objectGroups": [] - }, - { - "description": "Return the label center Y according to the button configuration. This expression is used in doStepPostEvents when the button is pressed or released.", - "fullName": "", - "functionType": "Expression", - "name": "CenterWithPaddingY", - "private": true, - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "Idle.CenterY() + (Object.PropertyTopPadding() - Object.PropertyBottomPadding()) / 2" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "supplementaryInformation": "PanelSpriteButton::PanelSpriteButton", - "type": "object" - } - ], - "objectGroups": [] - }, - { - "description": "Center the label according to the button configuration. This is used in doStepPostEvents when the button is resized.", - "fullName": "", - "functionType": "Action", - "name": "CenterLabel", "private": true, - "sentence": "Center the label of _PARAM0_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "MettreXY" - }, - "parameters": [ - "Label", - "=", - "Object.PropertyLeftPadding()", - "=", - "Object.PropertyTopPadding()" - ] - }, - { - "type": { - "value": "TextObject::WrappingWidth" - }, - "parameters": [ - "Label", - "=", - "Idle.Width() - Object.PropertyLeftPadding() - Object.PropertyRightPadding()" - ] - }, - { - "type": { - "value": "SetCenterY" - }, - "parameters": [ - "Label", - "=", - "Object.CenterWithPaddingY()" - ] - } - ], - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetCenterX" - }, - "parameters": [ - "Label", - "=", - "Background.CenterX() + (Object.PropertyLeftPadding() - Object.PropertyRightPadding()) / 2" - ] - } - ] - } - ] - }, + "sentence": "Change the text of _PARAM0_ to _PARAM1_", + "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "conditions": [], + "actions": [ { "type": { - "value": "PanelSpriteButton::PanelSpriteButton::IsPressed" + "value": "TextContainerCapability::TextContainerBehavior::SetValue" }, "parameters": [ - "Object", - "" + "Labels", + "Text", + "=", + "Value" ] } - ], + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "PanelSpriteButton::PanelSpriteButton", + "type": "object" + }, + { + "description": "Text", + "name": "Value", + "type": "string" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "LabelText", + "name": "SetLabelTextOp", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], "actions": [ { "type": { - "value": "MettreY" + "value": "TextContainerCapability::TextContainerBehavior::SetValue" }, "parameters": [ - "Label", - "+", - "Object.PropertyPressedLabelOffsetY()" + "Labels", + "Text", + "=", + "Value" ] } ] @@ -16423,22 +16251,42 @@ "type": "object" } ], - "objectGroups": [ + "objectGroups": [] + }, + { + "description": "the label text.", + "fullName": "Label text", + "functionType": "ExpressionAndCondition", + "name": "LabelText", + "sentence": "the label text", + "events": [ { - "name": "Background", - "objects": [ - { - "name": "Idle" - }, - { - "name": "Hovered" - }, + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ { - "name": "Pressed" + "type": { + "value": "SetReturnString" + }, + "parameters": [ + "Labels.Text::Value()" + ] } ] } - ] + ], + "expressionType": { + "type": "string" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "PanelSpriteButton::PanelSpriteButton", + "type": "object" + } + ], + "objectGroups": [] }, { "description": "De/activate interactions with the button.", @@ -16559,67 +16407,454 @@ } ], "objectGroups": [] + }, + { + "description": "the labelOffset of the object.", + "fullName": "LabelOffset", + "functionType": "ExpressionAndCondition", + "name": "LabelOffset", + "private": true, + "sentence": "the labelOffset", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "LabelOffset" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "PanelSpriteButton::PanelSpriteButton", + "type": "object" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "LabelOffset", + "name": "SetLabelOffset", + "private": true, + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetCenterY" + }, + "parameters": [ + "Labels", + "+", + "Value - LabelOffset" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "LabelOffset", + "=", + "Value" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "PanelSpriteButton::PanelSpriteButton", + "type": "object" + } + ], + "objectGroups": [] } ], "propertyDescriptors": [ { - "value": "0", - "type": "Number", - "label": "Label offset on Y axis when pressed", - "name": "PressedLabelOffsetY" + "value": "", + "type": "MultilineString", + "label": "Label", + "name": "LabelText" }, { - "value": "0", + "value": "0.25", "type": "Number", - "label": "Left padding", - "group": "Padding", - "extraInformation": [ - "Label" - ], - "choices": [], - "name": "LeftPadding" + "unit": "Second", + "label": "Hovered fade out duration", + "group": "States", + "name": "HoveredFadeOutDuration" }, { "value": "0", "type": "Number", - "label": "Right padding", - "group": "Padding", - "extraInformation": [ - "Label" - ], - "choices": [], - "name": "RightPadding" + "unit": "Pixel", + "label": "Label offset on Y axis when pressed", + "group": "States", + "name": "PressedLabelOffsetY" }, { "value": "0", "type": "Number", - "label": "Top padding", - "group": "Padding", - "extraInformation": [ - "Label" - ], - "choices": [], - "name": "TopPadding" + "unit": "Pixel", + "label": "", + "hidden": true, + "name": "LabelOffset" }, { - "value": "0", - "type": "Number", - "label": "Bottom padding", - "group": "Padding", - "extraInformation": [ - "Label" + "value": "", + "type": "Choice", + "label": "", + "choices": [ + { + "label": "Label.Text=LabelText", + "value": "Label.Text=LabelText" + }, + { + "label": "BitmapLabel.Text=LabelText", + "value": "BitmapLabel.Text=LabelText" + } ], - "choices": [], - "name": "BottomPadding" - }, - { - "value": "0.25", - "type": "Number", - "label": "Hovered fade out duration (in seconds)", - "name": "HoveredFadeOutDuration" + "hidden": true, + "name": "_PropertyMapping" } ], - "variants": [] + "variants": [ + { + "areaMaxX": 192, + "areaMaxY": 64, + "areaMaxZ": 64, + "areaMinX": 0, + "areaMinY": 0, + "areaMinZ": 0, + "assetStoreAssetId": "d00645a899e762e085fa6fdf2625701baea9cc10ee903a64ca7d371e5bbb8dca", + "assetStoreOriginalName": "Floating Out Button Dark Blue", + "name": "Floating Out Button Dark Blue", + "objects": [ + { + "assetStoreId": "", + "bold": false, + "italic": false, + "name": "Label", + "smoothed": true, + "type": "TextObject::Text", + "underlined": false, + "variables": [], + "effects": [], + "behaviors": [ + { + "name": "Anchor", + "type": "AnchorBehavior::AnchorBehavior", + "bottomEdgeAnchor": 2, + "leftEdgeAnchor": 1, + "relativeToOriginalWindowSize": true, + "rightEdgeAnchor": 2, + "topEdgeAnchor": 1, + "useLegacyBottomAndRightAnchors": false + } + ], + "string": "Button", + "font": "CarterOne-Regular.ttf", + "textAlignment": "center", + "characterSize": 40, + "color": { + "b": 255, + "g": 255, + "r": 255 + }, + "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": "Button", + "font": "CarterOne-Regular.ttf", + "textAlignment": "center", + "verticalTextAlignment": "center", + "characterSize": 40, + "lineHeight": 0, + "color": "255;255;255" + } + }, + { + "assetStoreId": "", + "bottomMargin": 10, + "height": 64, + "leftMargin": 6, + "name": "Idle", + "rightMargin": 6, + "texture": "Floating Out Button Dark Blue_Idle.png", + "tiled": false, + "topMargin": 10, + "type": "PanelSpriteObject::PanelSprite", + "width": 192, + "variables": [ + { + "folded": true, + "name": "State", + "type": "string", + "value": "Idle" + } + ], + "effects": [], + "behaviors": [ + { + "name": "Anchor", + "type": "AnchorBehavior::AnchorBehavior", + "bottomEdgeAnchor": 2, + "leftEdgeAnchor": 1, + "relativeToOriginalWindowSize": true, + "rightEdgeAnchor": 2, + "topEdgeAnchor": 1, + "useLegacyBottomAndRightAnchors": false + }, + { + "name": "ButtonFSM", + "type": "PanelSpriteButton::ButtonFSM", + "serializedBehavior": { + "name": "ButtonFSM", + "type": "PanelSpriteButton::ButtonFSM", + "ShouldCheckHovering": true + } + } + ] + }, + { + "assetStoreId": "", + "bottomMargin": 10, + "height": 64, + "leftMargin": 6, + "name": "Hovered", + "rightMargin": 6, + "texture": "Floating Out Button Dark Blue_Hovered.png", + "tiled": false, + "topMargin": 10, + "type": "PanelSpriteObject::PanelSprite", + "width": 192, + "variables": [], + "effects": [], + "behaviors": [ + { + "name": "Anchor", + "type": "AnchorBehavior::AnchorBehavior", + "bottomEdgeAnchor": 2, + "leftEdgeAnchor": 1, + "relativeToOriginalWindowSize": true, + "rightEdgeAnchor": 2, + "topEdgeAnchor": 1, + "useLegacyBottomAndRightAnchors": false + }, + { + "name": "Tween", + "type": "Tween::TweenBehavior", + "serializedBehavior": { + "name": "Tween", + "type": "Tween::TweenBehavior" + } + } + ] + }, + { + "assetStoreId": "", + "bottomMargin": 10, + "height": 64, + "leftMargin": 6, + "name": "Pressed", + "rightMargin": 6, + "texture": "Floating Out Button Dark Blue_Pressed.png", + "tiled": false, + "topMargin": 10, + "type": "PanelSpriteObject::PanelSprite", + "width": 192, + "variables": [], + "effects": [], + "behaviors": [ + { + "name": "Anchor", + "type": "AnchorBehavior::AnchorBehavior", + "bottomEdgeAnchor": 2, + "leftEdgeAnchor": 1, + "relativeToOriginalWindowSize": true, + "rightEdgeAnchor": 2, + "topEdgeAnchor": 1, + "useLegacyBottomAndRightAnchors": false + } + ] + }, + { + "assetStoreId": "", + "name": "BitmapLabel", + "type": "BitmapText::BitmapTextObject", + "variables": [], + "effects": [], + "behaviors": [ + { + "name": "Anchor", + "type": "AnchorBehavior::AnchorBehavior", + "bottomEdgeAnchor": 4, + "topEdgeAnchor": 4, + "leftEdgeAnchor": 1, + "relativeToOriginalWindowSize": true, + "rightEdgeAnchor": 2, + "useLegacyBottomAndRightAnchors": false + } + ], + "content": { + "text": "Text", + "opacity": 255, + "scale": 1, + "fontSize": 20, + "tint": "255;255;255", + "bitmapFontResourceName": "", + "textureAtlasResourceName": "", + "align": "center", + "verticalTextAlignment": "center" + } + } + ], + "objectsFolderStructure": { + "folderName": "__ROOT", + "children": [ + { + "objectName": "Label" + }, + { + "objectName": "Idle" + }, + { + "objectName": "Hovered" + }, + { + "objectName": "Pressed" + }, + { + "objectName": "BitmapLabel" + } + ] + }, + "objectsGroups": [ + { + "name": "Background", + "objects": [ + { + "name": "Idle" + }, + { + "name": "Hovered" + }, + { + "name": "Pressed" + } + ] + }, + { + "name": "Labels", + "objects": [ + { + "name": "Label" + }, + { + "name": "BitmapLabel" + } + ] + } + ], + "layers": [ + { + "ambientLightColorB": 200, + "ambientLightColorG": 200, + "ambientLightColorR": 200, + "camera3DFarPlaneDistance": 10000, + "camera3DFieldOfView": 45, + "camera3DNearPlaneDistance": 3, + "cameraType": "", + "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": [] + } + ], + "instances": [ + { + "angle": 0, + "customSize": false, + "depth": 1, + "height": 64, + "layer": "", + "name": "Idle", + "persistentUuid": "24882334-eec8-403e-8bf1-70fc928a46e6", + "width": 64, + "x": 0, + "y": 0, + "zOrder": 1, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": true, + "depth": 1, + "height": 57, + "keepRatio": true, + "layer": "", + "name": "Label", + "persistentUuid": "dfb1b714-aad7-4c68-9234-531c340769cd", + "width": 186, + "x": 3, + "y": 31, + "zOrder": 2, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + } + ] + } + ] } ] }, diff --git a/examples/3d-wall-sliding/assets/Floating Out Button Dark Blue_Hovered.png b/examples/3d-wall-sliding/assets/Floating Out Button Dark Blue_Hovered.png index fa60338f756e347711535718b210adcd0286fe4a..dd52bf1a5f8e6b373446df7d8efddc3a70444c05 100644 GIT binary patch literal 305 zcmeAS@N?(olHy`uVBq!ia0vp^hk)3egAGW=?VCCqNHG=%xjQkeJ16rJ$a(GQ;uumf z=k3*vxlE1%4j1cBs3vf79f-ABI{F-tzm~yBRncwGzopr0GESeyZ`_I literal 205 zcmeAS@N?(olHy`uVBq!ia0vp^hk)3egBeI>CZw(eQak}ZA+8c4sy>;8K=S|p|2KHL z{{zLDN`m}?n;Ft<*){-qoCO|{#S9GG!XV7ZFl&wkP%zTd#WAGf*4tYfc^MQ1m=Eq= z{(qiem6gK5jBQN*@1#D89#U=5w_qUzT9$L@g>pP^i3`p6|KnZ6k$HBEa;L+DStcA# Q1X{x2>FVdQ&MBb@0NFz{X8-^I diff --git a/examples/3d-wall-sliding/assets/Floating Out Button Dark Blue_Idle.png b/examples/3d-wall-sliding/assets/Floating Out Button Dark Blue_Idle.png index c2cae92ca1700aa1e64199081fddd7b2f2b2fc3a..dc726b0202539e5789295941cf85959e75a4df2f 100644 GIT binary patch literal 300 zcmeAS@N?(olHy`uVBq!ia0vp^hk)3egAGW=?VCCqNHG=%xjQkeJ16rJ$a&`J;uumf z=k4WtgI5l{21aLBH(Lr$4vg^ky_uc7}Vw%70-t^Zy zmcLyt@q>N6;1xd(Rkpg@W=&PXhZH#KPR21D7CzS|lJ+X(!&RV<89ZJ6T-G@yGywoX CEM8Cm literal 202 zcmeAS@N?(olHy`uVBq!ia0vp^hk)3egBeI>CZw(eQk(%kA+8c4sy>;8Kyv5mliol< zrjj7P;AVz2Teb}#B?TUl#S9GG!XV7ZFl&wkP%zTd#WAGf*4tYf1rI0)964bBJ>GyuFI`_t|W*Kh=r43X$tBcx#{f@%|^!5(ZCK KKbLh*2~7YLVKX}b diff --git a/examples/3d-wall-sliding/assets/Floating Out Button Dark Blue_Pressed.png b/examples/3d-wall-sliding/assets/Floating Out Button Dark Blue_Pressed.png index d2ed34f6a2c6f35dc7da4cb3926dfe49c8ba4c10..7d39eb735947c815c9d1f215575b8348311a29d2 100644 GIT binary patch literal 274 zcmeAS@N?(olHy`uVBq!ia0vp^hk)3egAGW=?VCCqNHG=%xjQkeJ16rJ$T{Qb;uumf z=k3*nf=rGAt_RCSG!;A={yg5vBEVv3(ZwO*vi(-+{XMgo8dfEzrB$=!?9SnDs8?WF zvF`r--)}c=Wv+Yo)5<CZw(eQk(%kA+A1|h5!Hmmk?3i>GEhh zP>``C$S;_|;n|HekctA2$YKTtZeb8+WSBKa0x0O?>EaktaqI1^je-meEDVNk?6)YI y?D)g>(%y;t)Mv#U#VZd52!c34oluTsC+4r!UhA`V-g^%;m%-E3&t;ucLK6Tdi!bp2 From c464fceab0f85c5d4cd512e62b7fcc8fc91a40a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Davy=20H=C3=A9lard?= Date: Wed, 8 Oct 2025 16:08:06 +0200 Subject: [PATCH 12/12] [3D platformer] Update the extensions --- examples/3d-platformer/3d-platformer.json | 4086 +++++++++-------- examples/3d-platformer/assets/Shadow.png | Bin 990 -> 0 bytes .../assets/rotate-screen-icon.png | Bin 881 -> 1165 bytes 3 files changed, 2243 insertions(+), 1843 deletions(-) delete mode 100644 examples/3d-platformer/assets/Shadow.png diff --git a/examples/3d-platformer/3d-platformer.json b/examples/3d-platformer/3d-platformer.json index b90142cdf..dd640ec35 100644 --- a/examples/3d-platformer/3d-platformer.json +++ b/examples/3d-platformer/3d-platformer.json @@ -1,7 +1,7 @@ { "firstLayout": "", "gdVersion": { - "build": 236, + "build": 242, "major": 5, "minor": 5, "revision": 0 @@ -180,14 +180,6 @@ "smoothed": true, "userAdded": true }, - { - "file": "assets/Shadow.png", - "kind": "image", - "metadata": "", - "name": "Shadow.png", - "smoothed": true, - "userAdded": true - }, { "file": "assets/3D/Cube Grass Center Tall.glb", "kind": "model3D", @@ -389,7 +381,7 @@ "smoothed": true, "userAdded": false, "origin": { - "identifier": "https://asset-resources.gdevelop.io/public-resources/Mobile Layouts/assets/6a8102ce3340bf9f62300ee1a81ef0b2327b2c6e8d62d7dda68d547f5e2b5969_rotate-screen-icon.png", + "identifier": "https://asset-resources.gdevelop.io/public-resources/Mobile Layouts/6a8102ce3340bf9f62300ee1a81ef0b2327b2c6e8d62d7dda68d547f5e2b5969_rotate-screen-icon.png", "name": "rotate-screen-icon.png" } } @@ -3643,7 +3635,7 @@ "assetStoreId": "e5919fb86a559b00001678c710efe55f4e9f2e032a9ff9610087370f998d57de", "name": "ScreenOrientationChecker", "type": "ScreenOrientationChecker::ScreenOrientationChecker", - "variant": "", + "variant": "Black screen orientation checker", "variables": [], "effects": [], "behaviors": [ @@ -3663,116 +3655,6 @@ "BackgroundColor": "24;24;24", "CornerRadius": 8, "Padding": 5 - }, - "childrenContent": { - "BackgroundPainter": { - "fillOpacity": 255, - "outlineSize": 0, - "outlineOpacity": 255, - "absoluteCoordinates": true, - "clearBetweenFrames": true, - "antialiasing": "none", - "fillColor": { - "r": 0, - "g": 0, - "b": 0 - }, - "outlineColor": { - "r": 0, - "g": 0, - "b": 0 - } - }, - "Icon": { - "adaptCollisionMaskAutomatically": true, - "updateIfNotVisible": false, - "animations": [ - { - "name": "", - "useMultipleDirections": false, - "directions": [ - { - "looping": false, - "timeBetweenFrames": 0.08, - "sprites": [ - { - "hasCustomCollisionMask": true, - "image": "rotate-screen-icon.png", - "points": [], - "originPoint": { - "name": "origine", - "x": 52.5, - "y": 56.5 - }, - "centerPoint": { - "automatic": true, - "name": "centre", - "x": 0, - "y": 0 - }, - "customCollisionMask": [ - [ - { - "x": 0, - "y": 1 - }, - { - "x": 105, - "y": 1 - }, - { - "x": 105, - "y": 113 - }, - { - "x": 0, - "y": 113 - } - ] - ] - } - ] - } - ] - } - ] - }, - "Text": { - "bold": true, - "italic": false, - "smoothed": true, - "underlined": false, - "string": "Rotate screen to play", - "font": "", - "textAlignment": "center", - "characterSize": 30, - "color": { - "b": 255, - "g": 255, - "r": 255 - }, - "content": { - "bold": true, - "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": "Rotate screen to play", - "font": "", - "textAlignment": "center", - "verticalTextAlignment": "top", - "characterSize": 30, - "color": "255;255;255" - } - } } } ], @@ -5335,142 +5217,6 @@ ], "externalEvents": [], "eventsFunctionsExtensions": [ - { - "author": "", - "category": "", - "extensionNamespace": "", - "fullName": "Shadow", - "gdevelopVersion": "", - "helpPath": "", - "iconUrl": "", - "name": "Shadow", - "previewIconUrl": "", - "shortDescription": "", - "version": "", - "description": "Originally automatically extracted from events of the project", - "tags": [], - "authorIds": [], - "dependencies": [], - "globalVariables": [], - "sceneVariables": [], - "eventsFunctions": [ - { - "fullName": "Cast a shadow", - "functionType": "Action", - "name": "Cast", - "sentence": "Cast _PARAM1_ of _PARAM3_ on _PARAM5_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "Scene3D::Base3DBehavior::SetZ" - }, - "parameters": [ - "Shadow", - "Object3D", - "=", - "-1000" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "Raycaster3D::RaycastBetweenPosition" - }, - "parameters": [ - "", - "ShadowReceiver", - "Character.X()", - "Character.Y()", - "Character.Object3D::Z()", - "Character.X()", - "Character.Y()", - "Character.Object3D::Z() - 1000", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetAngle" - }, - "parameters": [ - "Shadow", - "=", - "Character.Angle()" - ] - }, - { - "type": { - "value": "SetCenter" - }, - "parameters": [ - "Shadow", - "=", - "Character.X()", - "=", - "Character.Y()" - ] - }, - { - "type": { - "value": "Scene3D::Base3DBehavior::SetZ" - }, - "parameters": [ - "Shadow", - "Object3D", - "=", - "Raycaster3D::IntersectionZ() + 2" - ] - } - ] - } - ], - "parameters": [ - { - "description": "", - "name": "Shadow", - "supplementaryInformation": "Scene3D::Cube3DObject", - "type": "objectList" - }, - { - "description": "", - "name": "Object3D", - "supplementaryInformation": "Scene3D::Base3DBehavior", - "type": "behavior" - }, - { - "description": "", - "name": "Character", - "supplementaryInformation": "Scene3D::Model3DObject", - "type": "objectList" - }, - { - "description": "", - "name": "Object3D", - "supplementaryInformation": "Scene3D::Base3DBehavior", - "type": "behavior" - }, - { - "description": "", - "name": "ShadowReceiver", - "type": "objectList" - } - ], - "objectGroups": [] - } - ], - "eventsBasedBehaviors": [], - "eventsBasedObjects": [] - }, { "author": "", "category": "", @@ -6230,6 +5976,7 @@ "extraInformation": [ "Scene3D::Base3DBehavior" ], + "choices": [], "name": "Object3D" }, { @@ -6239,6 +5986,7 @@ "extraInformation": [ "Physics3D::PhysicsCharacter3D" ], + "choices": [], "name": "PhysicsCharacter3D" }, { @@ -6248,6 +5996,7 @@ "extraInformation": [ "Tween3D::Tween3D" ], + "choices": [], "name": "Tween3D" }, { @@ -6257,6 +6006,7 @@ "extraInformation": [ "ThirdPersonCamera::ThirdPersonCamera" ], + "choices": [], "name": "ThirdPersonCamera" }, { @@ -6266,6 +6016,7 @@ "extraInformation": [ "Respawn3D::Respawn3D" ], + "choices": [], "name": "Respawn3D" } ], @@ -7161,6 +6912,7 @@ "extraInformation": [ "Physics3D::PhysicsCharacter3D" ], + "choices": [], "name": "PhysicsCharacter3D" }, { @@ -7373,6 +7125,7 @@ "extraInformation": [ "Physics3D::PhysicsCharacter3D" ], + "choices": [], "name": "PhysicsCharacter3D" }, { @@ -7422,17 +7175,17 @@ "name": "Gamepads", "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/gamepad-variant-outline.svg", "shortDescription": "Add support for gamepads (or other controllers) to your game, giving access to information such as button presses, axis positions, trigger pressure, etc...", - "version": "0.8.1", + "version": "0.9.0", "description": [ - "Add support for gamepads (or other controllers).", + "Add support for gamepads (or other physical controllers).", "", "It gives access to:", - "- button presses", - "- axis positions and force", - "- trigger pressure", - "- configurable deadzone", - "- vibration", - "- automatic mappers for platformer characters and top-down movement", + "- button presses,", + "- axis positions and force,", + "- trigger pressure,", + "- configurable deadzone,", + "- vibration,", + "- automatic \"gamepad mapper\" behaviors for 2D and 3D movement behaviors (platformer characters, top-down movement, 3D character etc...). Add one of these to the object with the movement behavior (i.e: the player most of the time) and the behavior will then be controlled automatically by the gamepad (it works by reading the gamepad state and simulating controls). No need for additional events to make it work once the behaviors are set up.", "", "The Bomberman-like example handles 4 players with gamepads ([open the project online](https://editor.gdevelop.io/?project=example://goose-bomberman))." ], @@ -7454,7 +7207,8 @@ "authorIds": [ "2OwwM8ToR9dx9RJ2sAKTcrLmCB92", "taRwmWxwAFYFL9yyBwB3cwBw0BO2", - "mnImQKdn8nQxwzkS5D6a1JB27V23" + "mnImQKdn8nQxwzkS5D6a1JB27V23", + "IWykYNRvhCZBN3vEgKEbBPOR3Oc2" ], "dependencies": [], "globalVariables": [], @@ -7513,83 +7267,323 @@ "name": "onFirstSceneLoaded", "sentence": "", "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [] - }, { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "//Define an new private object javascript for the gamepad extension\r", - "gdjs._extensionController = {\r", - " players: {\r", - " 0: { mapping: 'DEFAULT', lastButtonUsed: -1, deadzone: 0.2, previousFrameStateButtons: {}, rumble: {} },\r", - " 1: { mapping: 'DEFAULT', lastButtonUsed: -1, deadzone: 0.2, previousFrameStateButtons: {}, rumble: {} },\r", - " 2: { mapping: 'DEFAULT', lastButtonUsed: -1, deadzone: 0.2, previousFrameStateButtons: {}, rumble: {} },\r", - " 3: { mapping: 'DEFAULT', lastButtonUsed: -1, deadzone: 0.2, previousFrameStateButtons: {}, rumble: {} },\r", + "if (gdjs._extensionController) {\r", + " return;\r", + "}\r", + "\r", + "/**\r", + " * Associate controller button ids to button names\r", + " */\r", + "const controllerButtonNames = {\r", + " \"XBOX\": {\r", + " 0: \"A\",\r", + " 1: \"B\",\r", + " 2: \"X\",\r", + " 3: \"Y\",\r", + " 4: \"LB\",\r", + " 5: \"RB\",\r", + " 6: \"LT\",\r", + " 7: \"RT\",\r", + " 8: \"BACK\",\r", + " 9: \"START\",\r", + " 10: \"CLICK_STICK_LEFT\",\r", + " 11: \"CLICK_STICK_RIGHT\",\r", + " 12: \"UP\",\r", + " 13: \"DOWN\",\r", + " 14: \"LEFT\",\r", + " 15: \"RIGHT\",\r", + " 16: \"NONE\",\r", + " 17: \"NONE\"\r", " },\r", - " lastActiveController: -1, // Last active controller\r", - " controllerButtonNames: { //Map associating controller button ids to button names\r", - " \"XBOX\": {\r", - " 0: \"A\",\r", - " 1: \"B\",\r", - " 2: \"X\",\r", - " 3: \"Y\",\r", - " 4: \"LB\",\r", - " 5: \"RB\",\r", - " 6: \"LT\",\r", - " 7: \"RT\",\r", - " 8: \"BACK\",\r", - " 9: \"START\",\r", - " 10: \"CLICK_STICK_LEFT\",\r", - " 11: \"CLICK_STICK_RIGHT\",\r", - " 12: \"UP\",\r", - " 13: \"DOWN\",\r", - " 14: \"LEFT\",\r", - " 15: \"RIGHT\",\r", - " 16: \"NONE\",\r", - " 17: \"NONE\"\r", - " },\r", - " \"PS4\": {\r", - " 0: \"CROSS\",\r", - " 1: \"CIRCLE\",\r", - " 2: \"SQUARE\",\r", - " 3: \"TRIANGLE\",\r", - " 4: \"L1\",\r", - " 5: \"R1\",\r", - " 6: \"L2\",\r", - " 7: \"R2\",\r", - " 8: \"SHARE\",\r", - " 9: \"OPTIONS\",\r", - " 10: \"CLICK_STICK_LEFT\",\r", - " 11: \"CLICK_STICK_RIGHT\",\r", - " 12: \"UP\",\r", - " 13: \"DOWN\",\r", - " 14: \"LEFT\",\r", - " 15: \"RIGHT\",\r", - " 16: \"PS_BUTTON\",\r", - " 17: \"CLICK_TOUCHPAD\"\r", - " }\r", + " \"PS4\": {\r", + " 0: \"CROSS\",\r", + " 1: \"CIRCLE\",\r", + " 2: \"SQUARE\",\r", + " 3: \"TRIANGLE\",\r", + " 4: \"L1\",\r", + " 5: \"R1\",\r", + " 6: \"L2\",\r", + " 7: \"R2\",\r", + " 8: \"SHARE\",\r", + " 9: \"OPTIONS\",\r", + " 10: \"CLICK_STICK_LEFT\",\r", + " 11: \"CLICK_STICK_RIGHT\",\r", + " 12: \"UP\",\r", + " 13: \"DOWN\",\r", + " 14: \"LEFT\",\r", + " 15: \"RIGHT\",\r", + " 16: \"PS_BUTTON\",\r", + " 17: \"CLICK_TOUCHPAD\"\r", " }\r", "};\r", "\r", - "gdjs._extensionController.getInputString = function (type, buttonId) {\r", - " const controllerButtonNames = gdjs._extensionController.controllerButtonNames;\r", - " if (controllerButtonNames[type] !== undefined) {\r", - " return controllerButtonNames[type][buttonId];\r", + "/**\r", + " * @param {number} playerId\r", + " */\r", + "function getGamepad(playerId) {\r", + " /** @type {Gamepad[]} */\r", + " const gamepads = navigator.getGamepads ? navigator.getGamepads() : [];\r", + " return gamepads[playerId];\r", + "}\r", + "\r", + "/** @type {{[playerId: number]: Player}} */\r", + "const players = {};\r", + "\r", + "/**\r", + " * @param {number} playerId\r", + " */\r", + "function getPlayer(playerId) {\r", + " let player = players[playerId];\r", + " if (!player) {\r", + " player = new Player(playerId);\r", + " players[playerId] = player;\r", " }\r", + " return player;\r", + "}\r", + "\r", + "class Player {\r", + " /** @type {number} */\r", + " playerId;\r", + " mapping = 'DEFAULT';\r", + " lastButtonUsed = -1;\r", + " deadzone = 0.2;\r", + " /** @type {{[buttonId: number]: ButtonState}} */\r", + " buttonStates = {};\r", + " rumble = { elapsedTime: 0, duration: 0, weakMagnitude: 0, strongMagnitude: 0 };\r", "\r", - " return \"UNKNOWN_BUTTON\";\r", + " /**\r", + " * @param {number} playerId\r", + " */\r", + " constructor(playerId) {\r", + " this.playerId = playerId;\r", + " }\r", + "\r", + " /**\r", + " * @param {number} buttonId\r", + " */\r", + " getButtonState(buttonId) {\r", + " let buttonState = this.buttonStates[buttonId];\r", + " if (!buttonState) {\r", + " buttonState = new ButtonState();\r", + " this.buttonStates[buttonId] = buttonState;\r", + " }\r", + " return buttonState;\r", + " }\r", + "\r", + " /**\r", + " * @param {number} buttonId\r", + " */\r", + " isButtonPressed(buttonId) {\r", + " return this.getButtonState(buttonId).isPressed;\r", + " }\r", + "\r", + " /**\r", + " * @param {number} buttonId\r", + " */\r", + " isButtonJustPressed(buttonId) {\r", + " return this.getButtonState(buttonId).isJustPressed();\r", + " }\r", + "\r", + " /**\r", + " * @param {number} buttonId\r", + " */\r", + " isButtonReleased(buttonId) {\r", + " return this.getButtonState(buttonId).isReleased();\r", + " }\r", + "\r", + " isAnyButtonReleased() {\r", + " for (const buttonId in this.buttonStates) {\r", + " const buttonState = this.buttonStates[buttonId];\r", + " if (buttonState.isReleased()) {\r", + " return true;\r", + " }\r", + " }\r", + " return false;\r", + " }\r", + "\r", + " isAnyButtonPressed() {\r", + " for (const buttonId in this.buttonStates) {\r", + " const buttonState = this.buttonStates[buttonId];\r", + " if (buttonState.isPressed) {\r", + " return true;\r", + " }\r", + " }\r", + " return false;\r", + " }\r", + "}\r", + "\r", + "class ButtonState {\r", + " wasPressed = false;\r", + " isPressed = false;\r", + "\r", + " isReleased() {\r", + " return this.wasPressed && !this.isPressed;\r", + " }\r", + "\r", + " isJustPressed() {\r", + " return !this.wasPressed && this.isPressed;\r", + " }\r", + "}\r", + "\r", + "// Async tasks are run before everything.\r", + "// This is a hack to make sure that button states are updated\r", + "// before mapping behavior events.\r", + "const frameBeginningTask = new class extends gdjs.AsyncTask {\r", + " update() {\r", + " /** @type {Gamepad[]} */\r", + " const gamepads = navigator.getGamepads ? navigator.getGamepads() : [];\r", + " for (let playerId = 0; playerId < gamepads.length; playerId++) {\r", + " const gamepad = gamepads[playerId];\r", + " if (gamepad == null) {\r", + " // The gamepad is not connected.\r", + " continue;\r", + " }\r", + " const player = getPlayer(playerId);\r", + "\r", + " for (let buttonId = 0; buttonId < Object.keys(gamepad.buttons).length; buttonId++) {\r", + " const buttonState = player.getButtonState(buttonId);\r", + " buttonState.wasPressed = buttonState.isPressed;\r", + " buttonState.isPressed = gamepad.buttons[buttonId].pressed;\r", + " if (buttonState.isJustPressed()) {\r", + " player.lastButtonUsed = buttonId;\r", + " }\r", + " }\r", + " }\r", + " return false;\r", + " }\r", + "}();\r", + "\r", + "function onScenePostEvents() {\r", + " /** @type {Gamepad[]} */\r", + " const gamepads = navigator.getGamepads ? navigator.getGamepads() : [];\r", + " for (let playerId = 0; playerId < gamepads.length; playerId++) {\r", + " let gamepad = gamepads[playerId];\r", + " if (gamepad == null) {\r", + " // The gamepad is not connected.\r", + " continue;\r", + " }\r", + " const player = getPlayer(playerId);\r", + " const rumble = player.rumble;\r", + " rumble.elapsedTime += runtimeScene.getElapsedTime(runtimeScene) / 1000;\r", + " if (rumble.duration - rumble.elapsedTime <= 0 &&\r", + " (rumble.weakMagnitude || rumble.strongMagnitude)\r", + " ) {\r", + " rumble.weakMagnitude = 0;\r", + " rumble.strongMagnitude = 0;\r", + " }\r", + " }\r", + "}\r", + "\r", + "/**\r", + " * @param {string} type\r", + " * @param {number} buttonId\r", + " */\r", + "function getInputString(type, buttonId) {\r", + " if (!controllerButtonNames[type]) {\r", + " return \"UNKNOWN_BUTTON\";\r", + " }\r", + " return controllerButtonNames[type][buttonId];\r", + "}\r", + "\r", + "function getButtonId(buttonName) {\r", + " switch (buttonName) {\r", + " case 'A':\r", + " case 'CROSS':\r", + " return 0;\r", + " case 'B':\r", + " case 'CIRCLE':\r", + " return 1;\r", + " case 'X':\r", + " case 'SQUARE':\r", + " return 2;\r", + " case 'Y':\r", + " case 'TRIANGLE':\r", + " return 3;\r", + " case 'LB':\r", + " case 'L1':\r", + " return 4;\r", + " case 'RB':\r", + " case 'R1':\r", + " return 5;\r", + " case 'LT':\r", + " case 'L2':\r", + " return 6;\r", + " case 'RT':\r", + " case 'R2':\r", + " return 7;\r", + " case 'UP':\r", + " return 12;\r", + " case 'DOWN':\r", + " return 13;\r", + " case 'LEFT':\r", + " return 14;\r", + " case 'RIGHT':\r", + " return 15;\r", + " case 'BACK':\r", + " case 'SHARE':\r", + " return 8;\r", + " case 'START':\r", + " case 'OPTIONS':\r", + " return 9;\r", + " case 'CLICK_STICK_LEFT':\r", + " return 10;\r", + " case 'CLICK_STICK_RIGHT':\r", + " return 11;\r", + " //PS4\r", + " case 'PS_BUTTON':\r", + " return 16;\r", + " case 'CLICK_TOUCHPAD':\r", + " return 17;\r", + " default:\r", + " console.error('The gamepad button: ' + buttonName + ' is not valid.');\r", + " return null;\r", + " }\r", + "}\r", + "\r", + "/**\r", + " * @param {number} playerId\r", + " * @param {string} directionName\r", + " * @param {number} axisValueX\r", + " * @param {number} axisValueY\r", + " */\r", + "function isAxisPushed(playerId, directionName, axisValueX, axisValueY) {\r", + " switch (directionName) {\r", + " case 'LEFT':\r", + " return getNormalizedAxisValue(axisValueX, playerId) < 0;\r", + " case 'RIGHT':\r", + " return getNormalizedAxisValue(axisValueX, playerId) > 0;\r", + " case 'UP':\r", + " return getNormalizedAxisValue(axisValueY, playerId) < 0;\r", + " case 'DOWN':\r", + " return getNormalizedAxisValue(axisValueY, playerId) > 0;\r", + " case 'ANY':\r", + " return getNormalizedAxisValue(axisValueX, playerId) < 0\r", + " || getNormalizedAxisValue(axisValueX, playerId) > 0\r", + " || getNormalizedAxisValue(axisValueY, playerId) < 0\r", + " || getNormalizedAxisValue(axisValueY, playerId) > 0\r", + " default:\r", + " console.error('The value stick direction is not valid.');\r", + " return false;\r", + " }\r", "}\r", "\r", - "gdjs._extensionController.axisToAngle = function (deltaX, deltaY) {\r", + "/**\r", + " * @param {number} deltaX\r", + " * @param {number} deltaY\r", + " */\r", + "function axisToAngle(deltaX, deltaY) {\r", " const rad = Math.atan2(deltaY, deltaX);\r", " const deg = rad * (180 / Math.PI);\r", " return deg;\r", "}\r", "\r", - "gdjs._extensionController.isXbox = function (gamepad) {\r", + "/**\r", + " * @param {{id: string}} gamepad\r", + " */\r", + "function isXbox(gamepad) {\r", " return (gamepad ? (\r", " gamepad.id.toUpperCase().indexOf(\"XBOX\") !== -1\r", " // \"XINPUT\" cannot be used to check if it is a xbox controller is just a generic\r", @@ -7598,44 +7592,52 @@ " ) : false);\r", "}\r", "\r", - "//Returns the new value taking into account the dead zone for the player_ID given\r", - "gdjs._extensionController.getNormalizedAxisValue = function (v, player_ID) {\r", + "/**\r", + " * Returns the new value taking into account the dead zone for the player_ID given\r", + " * @param {number} value\r", + " * @param {number} playerID\r", + " */\r", + "function getNormalizedAxisValue(value, playerID) {\r", " // gdjs._extensionController = gdjs._extensionController || { deadzone: 0.2 };\r", "\r", " // Anything smaller than this is assumed to be 0,0\r", - " const DEADZONE = gdjs._extensionController.players[player_ID].deadzone;\r", - "\r", - " if (Math.abs(v) < DEADZONE) {\r", - " // In the dead zone, set to 0\r", - " v = 0;\r", - "\r", - " if (v == null) {\r", - " return 0;\r", - " } else {\r", - " return v;\r", - " }\r", + " const deadzone = getPlayer(playerID).deadzone;\r", "\r", + " if (Math.abs(value) < deadzone) {\r", + " return 0;\r", " } else {\r", " // We're outside the dead zone, but we'd like to smooth\r", " // this value out so it still runs nicely between 0..1.\r", " // That is, we don't want it to jump suddenly from 0 to\r", - " // DEADZONE.\r", + " // deadzone.\r", "\r", - " // Remap v from\r", - " // DEADZONE..1 to 0..(1-DEADZONE)\r", + " // Remap value from\r", + " // deadzone..1 to 0..(1-deadzone)\r", " // or from\r", - " // -1..-DEADZONE to -(1-DEADZONE)..0\r", - "\r", - " v = v - Math.sign(v) * DEADZONE;\r", + " // -1..-deadzone to -(1-deadzone)..0\r", + " value = value - Math.sign(value) * deadzone;\r", "\r", - " // Remap v from\r", - " // 0..(1-DEADZONE) to 0..1\r", + " // Remap value from\r", + " // 0..(1-deadzone) to 0..1\r", " // or from\r", - " // -(1-DEADZONE)..0 to -1..0\r", - "\r", - " return v / (1 - DEADZONE);\r", + " // -(1-deadzone)..0 to -1..0\r", + " return value / (1 - deadzone);\r", " }\r", - "};" + "}\r", + "\r", + "gdjs._extensionController = {\r", + " getPlayer,\r", + " controllerButtonNames,\r", + " getInputString,\r", + " getButtonId,\r", + " axisToAngle,\r", + " isXbox,\r", + " getNormalizedAxisValue,\r", + " isAxisPushed,\r", + " getGamepad,\r", + " onScenePostEvents,\r", + " frameBeginningTask,\r", + "}" ], "parameterObjects": "", "useStrict": true, @@ -7648,59 +7650,35 @@ { "fullName": "", "functionType": "Action", - "name": "onScenePostEvents", + "name": "onSceneLoaded", "sentence": "", "events": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [] - }, + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "// Async tasks are run before everything.\r", + "// This is a hack to make sure that button states are updated\r", + "// before mapping behavior events.\r", + "runtimeScene.getAsyncTasksManager().addTask(gdjs._extensionController.frameBeginningTask);" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "Action", + "name": "onScenePostEvents", + "sentence": "", + "events": [ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "//Each time a player press a button i save the last button pressed for the next frame", - "/** @type {Gamepad[]} */", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);", - "", - "//Get function parameter", - "let countPlayers = Object.keys(gdjs._extensionController.players).length;", - "", - "//Repeat for each players", - "for (let i = 0; i < countPlayers; i++) {", - " let gamepad = gamepads[i]; // Get the gamepad of the player", - "", - " //We have to keep this condition because if the user hasn't plugged in his controller yet, we can't get the controller in the gamepad variable.", - " if (gamepad == null) {", - " continue;", - " }", - "", - " for (let b = 0; b < Object.keys(gamepad.buttons).length; b++) { //For each buttons", - " if (gamepad.buttons[b].pressed) { //One of them is pressed", - " gdjs._extensionController.players[i].lastButtonUsed = b; //Save the button pressed", - "", - " //Save the state of the button for the next frame.", - " gdjs._extensionController.players[i].previousFrameStateButtons[b] = { pressed: true };", - "", - " // Update Last Active Controller", - " gdjs._extensionController.lastActiveController = i;", - " } else {", - " gdjs._extensionController.players[i].previousFrameStateButtons[b] = { pressed: false };", - " }", - " }", - "", - "", - " gdjs._extensionController.players[i].rumble.elapsedTime += runtimeScene.getElapsedTime(runtimeScene) / 1000;", - " if (", - " gdjs._extensionController.players[i].rumble.duration - gdjs._extensionController.players[i].rumble.elapsedTime <= 0 &&", - " (gdjs._extensionController.players[i].rumble.weakMagnitude || gdjs._extensionController.players[i].rumble.strongMagnitude)", - " ) {", - " gdjs._extensionController.players[i].rumble.weakMagnitude = 0;", - " gdjs._extensionController.players[i].rumble.strongMagnitude = 0;", - " }", - "", - "", - "}", + "gdjs._extensionController.onScenePostEvents();", "" ], "parameterObjects": "", @@ -8138,27 +8116,20 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", "\r", - "//Get function parameters\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", - "const trigger = eventsFunctionContext.getArgument(\"trigger\").toUpperCase();\r", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "const trigger = eventsFunctionContext.getArgument(\"Trigger\").toUpperCase();\r", "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier in expression: \"Pressure on a gamepad trigger\", is not valid number, must be between 0 and 4.');\r", - " return;\r", - "}\r", "if (trigger != \"LT\" && trigger != \"RT\" && trigger != \"L2\" && trigger != \"R2\") {\r", " console.error('Parameter trigger is not valid in expression: \"Pressure on a gamepad trigger\"');\r", " return;\r", "}\r", - "\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", - "if (gamepad == null) return;\r", - "\r", + "/** @type {Gamepad} */\r", + "const gamepad = gdjs._extensionController.getGamepad(playerId);\r", + "if (!gamepad) {\r", + " // The gamepad is not connected.\r", + " return;\r", + "}\r", "switch (trigger) {\r", " case 'LT':\r", " case 'L2':\r", @@ -8186,12 +8157,12 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" }, { "description": "Trigger button", - "name": "trigger", + "name": "Trigger", "supplementaryInformation": "[\"LT\",\"RT\",\"L2\",\"R2\"]", "type": "stringWithSelector" } @@ -8208,43 +8179,28 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", - "\r", - "//Get function parameters\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", - "const stick = eventsFunctionContext.getArgument(\"stick\").toUpperCase();\r", + "const { getNormalizedAxisValue } = gdjs._extensionController;\r", "\r", - "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier is not valid in expression: \"Value of a stick force\"');\r", - " return;\r", - "}\r", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "const stick = eventsFunctionContext.getArgument(\"Stick\").toUpperCase();\r", "\r", "if (stick !== \"LEFT\" && stick !== \"RIGHT\") {\r", " console.error('Parameter stick is not valid in expression: \"Value of a stick force\"');\r", " return;\r", "}\r", + "/** @type {Gamepad} */\r", + "const gamepad = gdjs._extensionController.getGamepad(playerId);\r", + "if (!gamepad) {\r", + " // The gamepad is not connected.\r", + " return;\r", + "}\r", + "const axisValueX = stick === 'RIGHT' ? gamepad.axes[2] : gamepad.axes[0];\r", + "const axisValueY = stick === 'RIGHT' ? gamepad.axes[3] : gamepad.axes[1];\r", "\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", - "if (gamepad == null) return;\r", - "\r", - "\r", - "switch (stick) {\r", - " case 'LEFT':\r", - " eventsFunctionContext.returnValue = gdjs.evtTools.common.clamp(Math.abs(gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[0], playerId)) + Math.abs(gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[1], playerId)), 0, 1);\r", - " break;\r", - "\r", - " case 'RIGHT':\r", - " eventsFunctionContext.returnValue = gdjs.evtTools.common.clamp(Math.abs(gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[2], playerId)) + Math.abs(gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[3], playerId)), 0, 1);\r", - " break;\r", - "\r", - " default:\r", - " eventsFunctionContext.returnValue = -1;\r", - " break;\r", - "}" + "eventsFunctionContext.returnValue = gdjs.evtTools.common.clamp(\r", + " Math.abs(getNormalizedAxisValue(axisValueX, playerId)) +\r", + " Math.abs(getNormalizedAxisValue(axisValueY, playerId)), 0, 1);\r", + "" ], "parameterObjects": "", "useStrict": true, @@ -8257,12 +8213,12 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" }, { "description": "Stick: \"Left\" or \"Right\"", - "name": "stick", + "name": "Stick", "supplementaryInformation": "[\"Left\",\"Right\"]", "type": "stringWithSelector" } @@ -8286,7 +8242,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "Gamepads::StickAngle(player_ID, stick)" + "Gamepads::StickAngle(PlayerId, Stick)" ] } ] @@ -8298,12 +8254,12 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" }, { "description": "Stick: \"Left\" or \"Right\"", - "name": "stick", + "name": "Stick", "supplementaryInformation": "[\"Left\",\"Right\"]", "type": "stringWithSelector" } @@ -8320,40 +8276,27 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", - "\r", - "//Get function parameters\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", - "const stick = eventsFunctionContext.getArgument(\"stick\").toUpperCase();\r", + "const { getNormalizedAxisValue } = gdjs._extensionController;\r", "\r", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "const stick = eventsFunctionContext.getArgument(\"Stick\").toUpperCase();\r", "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier is not valid in expression: \"Value of a stick rotation\"');\r", - " return;\r", - "}\r", "if (stick !== \"LEFT\" && stick !== \"RIGHT\") {\r", " console.error('Parameter stick is not valid in expression: \"Value of a stick rotation\"');\r", " return;\r", "}\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", - "if (gamepad == null) return;\r", - "\r", - "switch (stick) {\r", - " case 'LEFT':\r", - " eventsFunctionContext.returnValue = gdjs._extensionController.axisToAngle(gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[0], playerId), gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[1], playerId));\r", - " break;\r", - "\r", - " case 'RIGHT':\r", - " eventsFunctionContext.returnValue = gdjs._extensionController.axisToAngle(gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[2], playerId), gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[3], playerId));\r", - " break;\r", + "/** @type {Gamepad} */\r", + "const gamepad = gdjs._extensionController.getGamepad(playerId);\r", + "if (!gamepad) {\r", + " // The gamepad is not connected.\r", + " return;\r", + "}\r", + "const axisValueX = stick === 'RIGHT' ? gamepad.axes[2] : gamepad.axes[0];\r", + "const axisValueY = stick === 'RIGHT' ? gamepad.axes[3] : gamepad.axes[1];\r", "\r", - " default:\r", - " eventsFunctionContext.returnValue = -1;\r", - " break;\r", - "}" + "eventsFunctionContext.returnValue = gdjs._extensionController.axisToAngle(\r", + " getNormalizedAxisValue(axisValueX, playerId),\r", + " getNormalizedAxisValue(axisValueY, playerId));" ], "parameterObjects": "", "useStrict": true, @@ -8366,12 +8309,12 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" }, { "description": "Stick: \"Left\" or \"Right\"", - "name": "stick", + "name": "Stick", "supplementaryInformation": "[\"Left\",\"Right\"]", "type": "stringWithSelector" } @@ -8389,18 +8332,11 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", "\r", - "//Get function parameters\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", "const stick = eventsFunctionContext.getArgument(\"stick\").toUpperCase();\r", "const direction = eventsFunctionContext.getArgument(\"direction\").toUpperCase();\r", "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier is not valid in expression: \"Value of a gamepad axis\"');\r", - " return;\r", - "}\r", "if (stick != \"LEFT\" && stick != \"RIGHT\") {\r", " console.error('Parameter stick is not valid in expression: \"Value of a gamepad axis\"');\r", " return;\r", @@ -8409,11 +8345,12 @@ " console.error('Parameter direction is not valid in expression: \"Value of a gamepad axis\"');\r", " return;\r", "}\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", - "if (gamepad == null) return;\r", - "\r", + "/** @type {Gamepad} */\r", + "const gamepad = gdjs._extensionController.getGamepad(playerId);\r", + "if (!gamepad) {\r", + " // The gamepad is not connected.\r", + " return;\r", + "}\r", "let parameterError = false;\r", "switch (stick) {\r", " case 'LEFT':\r", @@ -8510,7 +8447,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" }, { @@ -8538,26 +8475,20 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", "\r", - "//Get function parameters\r", "const playerId = eventsFunctionContext.getArgument(\"Gamepad\") - 1;\r", "const stick = eventsFunctionContext.getArgument(\"Stick\").toLowerCase();\r", "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier is not valid in expression: \"Value of a gamepad axis\"');\r", - " return;\r", - "}\r", "if (stick != \"left\" && stick != \"right\") {\r", " console.error('Parameter stick is not valid in expression: \"Value of a gamepad axis\"');\r", " return;\r", "}\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", - "if (gamepad == null) return;\r", - "\r", + "/** @type {Gamepad} */\r", + "const gamepad = gdjs._extensionController.getGamepad(playerId);\r", + "if (!gamepad) {\r", + " // The gamepad is not connected.\r", + " return;\r", + "}\r", "const axisIndex = stick === 'right' ? 2 : 0;\r", "eventsFunctionContext.returnValue = gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[axisIndex], playerId);\r", "" @@ -8595,26 +8526,20 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", "\r", - "//Get function parameters\r", "const playerId = eventsFunctionContext.getArgument(\"Gamepad\") - 1;\r", "const stick = eventsFunctionContext.getArgument(\"Stick\").toLowerCase();\r", "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier is not valid in expression: \"Value of a gamepad axis\"');\r", - " return;\r", - "}\r", "if (stick != \"left\" && stick != \"right\") {\r", " console.error('Parameter stick is not valid in expression: \"Value of a gamepad axis\"');\r", " return;\r", "}\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", - "if (gamepad == null) return;\r", - "\r", + "/** @type {Gamepad} */\r", + "const gamepad = gdjs._extensionController.getGamepad(playerId);\r", + "if (!gamepad) {\r", + " // The gamepad is not connected.\r", + " return;\r", + "}\r", "const axisIndex = stick === 'right' ? 3 : 1;\r", "eventsFunctionContext.returnValue = gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[axisIndex], playerId);\r", "" @@ -8652,136 +8577,57 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", "\r", - "//Get function parameters\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", - "const button = eventsFunctionContext.getArgument(\"button\").toUpperCase();\r", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "const button = eventsFunctionContext.getArgument(\"Button\").toUpperCase();\r", "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier in condition: \"Gamepad button released\", is not valid number, must be between 0 and 4.');\r", - " return;\r", - "}\r", - "if (button === \"\") {\r", - " console.error('Parameter button is not valid in condition: \"Gamepad button released\"');\r", + "let buttonId = gdjs._extensionController.getButtonId(button);\r", + "if (buttonId === null) {\r", " return;\r", "}\r", + "const player = gdjs._extensionController.getPlayer(playerId)\r", + "eventsFunctionContext.returnValue = player.isButtonReleased(buttonId);" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "parameters": [ + { + "description": "The gamepad identifier: 1, 2, 3 or 4", + "name": "PlayerId", + "type": "expression" + }, + { + "description": "Name of the button", + "name": "Button", + "supplementaryInformation": "[\"A\",\"Cross\",\"B\",\"Circle\",\"X\",\"Square\",\"Y\",\"Triangle\",\"LB\",\"L1\",\"RB\",\"R1\",\"LT\",\"L2\",\"RT\",\"R2\",\"Up\",\"Down\",\"Left\",\"Right\",\"Back\",\"Share\",\"Start\",\"Options\",\"Click_Stick_Left\",\"Click_Stick_Right\",\"PS_Button\",\"Click_Touchpad\"]", + "type": "stringWithSelector" + } + ], + "objectGroups": [] + }, + { + "description": "Check if a button was just pressed on a gamepad. Buttons can be:\n* Xbox: \"A\", \"B\", \"X\", \"Y\", \"LB\", \"RB\", \"LT\", \"RT\", \"BACK\", \"START\",\n* PS4: \"CROSS\", \"SQUARE\", \"CIRCLE\", \"TRIANGLE\", \"L1\", \"L2\", \"R1\", \"R2\", \"SHARE\", \"OPTIONS\", \"PS_BUTTON\", \"CLICK_TOUCHPAD\",\n* Other: \"UP\", \"DOWN\", \"LEFT\", \"RIGHT\", \"CLICK_STICK_LEFT\", \"CLICK_STICK_RIGHT\".", + "fullName": "Gamepad button just pressed", + "functionType": "Condition", + "name": "IsButtonJustPressed", + "sentence": "Button _PARAM2_ of gamepad _PARAM1_ was just pressed", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ "\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", - "if (gamepad == null) return;\r", - "\r", - "let buttonId;\r", - "\r", - "switch (button) {\r", - " case 'A':\r", - " case 'CROSS':\r", - " buttonId = 0;\r", - " break;\r", - " case 'B':\r", - " case 'CIRCLE':\r", - " buttonId = 1;\r", - " break;\r", - " case 'X':\r", - " case 'SQUARE':\r", - " buttonId = 2;\r", - " break;\r", - " case 'Y':\r", - " case 'TRIANGLE':\r", - " buttonId = 3;\r", - " break;\r", - " case 'LB':\r", - " case 'L1':\r", - " buttonId = 4;\r", - " break;\r", - " case 'RB':\r", - " case 'R1':\r", - " buttonId = 5;\r", - " break;\r", - " case 'LT':\r", - " case 'L2':\r", - " buttonId = 6;\r", - " break;\r", - " case 'RT':\r", - " case 'R2':\r", - " buttonId = 7;\r", - " break;\r", - "\r", - " case 'UP':\r", - " buttonId = 12;\r", - " break;\r", - " case 'DOWN':\r", - " buttonId = 13;\r", - " break;\r", - " case 'LEFT':\r", - " buttonId = 14;\r", - " break;\r", - " case 'RIGHT':\r", - " buttonId = 15;\r", - " break;\r", - "\r", - " case 'BACK':\r", - " case 'SHARE':\r", - " buttonId = 8;\r", - " break;\r", - " case 'START':\r", - " case 'OPTIONS':\r", - " buttonId = 9;\r", - " break;\r", - "\r", - " case 'CLICK_STICK_LEFT':\r", - " buttonId = 10;\r", - " break;\r", - " case 'CLICK_STICK_RIGHT':\r", - " buttonId = 11;\r", - " break;\r", - "\r", - " //PS4\r", - " case 'PS_BUTTON':\r", - " buttonId = 16;\r", - " break;\r", - " case 'CLICK_TOUCHPAD':\r", - " buttonId = 17;\r", - " break;\r", - "\r", - " default:\r", - " console.error('The button: ' + button + ' in condition: \"Gamepad button released\" is not valid.');\r", - " break;\r", - "}\r", - "\r", - "if (buttonId === undefined) {\r", - " console.error('There is no buttons valid in condition: \"Gamepad button released\"');\r", - " eventsFunctionContext.returnValue = false;\r", - " return;\r", - "}\r", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "const button = eventsFunctionContext.getArgument(\"Button\").toUpperCase();\r", "\r", - "if (gamepad.buttons == null || gamepad.buttons[buttonId] == null) {\r", - " console.error('Buttons on the gamepad are not accessible in condition: \"Gamepad button released\"');\r", - " eventsFunctionContext.returnValue = false;\r", + "let buttonId = gdjs._extensionController.getButtonId(button);\r", + "if (buttonId === null) {\r", " return;\r", "}\r", - "\r", - "//Define default value on pressed button or use previous value\r", - "gdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId] = gdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId] || { pressed: false };\r", - "\r", - "//Get state of button at previous frame\r", - "const previousStateButton = gdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId].pressed;\r", - "\r", - "//When previousStateButton is true and actual button state is not pressed\r", - "//Player have release the button\r", - "if (previousStateButton === true && gamepad.buttons[buttonId].pressed === false) {\r", - " // Save the last button used for the player \r", - " gdjs._extensionController.players[playerId].lastButtonUsed = buttonId;\r", - " gdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId].pressed = true;\r", - " eventsFunctionContext.returnValue = true;\r", - "\r", - "} else {\r", - " gdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId].pressed = false;\r", - " eventsFunctionContext.returnValue = false;\r", - "}\r", - "" + "const player = gdjs._extensionController.getPlayer(playerId)\r", + "eventsFunctionContext.returnValue = player.isButtonJustPressed(buttonId);" ], "parameterObjects": "", "useStrict": true, @@ -8791,12 +8637,12 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" }, { "description": "Name of the button", - "name": "button", + "name": "Button", "supplementaryInformation": "[\"A\",\"Cross\",\"B\",\"Circle\",\"X\",\"Square\",\"Y\",\"Triangle\",\"LB\",\"L1\",\"RB\",\"R1\",\"LT\",\"L2\",\"RT\",\"R2\",\"Up\",\"Down\",\"Left\",\"Right\",\"Back\",\"Share\",\"Start\",\"Options\",\"Click_Stick_Left\",\"Click_Stick_Right\",\"PS_Button\",\"Click_Touchpad\"]", "type": "stringWithSelector" } @@ -8813,17 +8659,9 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "//Get function parameter\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", - "\r", - "//Player id is not valid\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier in expression: \"Last pressed button (id)\", is not valid number, must be between 0 and 4.');\r", - " return;\r", - "}\r", "\r", - "//Return the last button used by the player\r", - "eventsFunctionContext.returnValue = gdjs._extensionController.players[playerId].lastButtonUsed;" + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "eventsFunctionContext.returnValue = gdjs._extensionController.getPlayer(playerId).lastButtonUsed;" ], "parameterObjects": "", "useStrict": true, @@ -8836,7 +8674,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" } ], @@ -8852,46 +8690,10 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", - "\r", - "//Get function parameter\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", - "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier in condition: \"Any gamepad button pressed\", is not valid number, must be between 0 and 4.');\r", - " return;\r", - "}\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", - "if (gamepad == null) return;\r", - "\r", - "let buttonId;\r", - "for (let i = 0; i < gamepad.buttons.length; i++) { //For each buttons\r", - " if (gamepad.buttons[i].pressed) { //One of them is pressed\r", - " buttonId = i; //Save the button pressed\r", - " break;\r", - " }\r", - "}\r", - "\r", - "if (buttonId === undefined) {\r", - " // No buttons are pressed.\r", - " eventsFunctionContext.returnValue = false;\r", - " return;\r", - "}\r", - "\r", - "if (gamepad.buttons == null || gamepad.buttons[buttonId] == null) {\r", - " console.error('Buttons on the gamepad are not accessible in condition: \"Any gamepad button pressed\"');\r", - " eventsFunctionContext.returnValue = false;\r", - " return;\r", - "}\r", - "\r", - "//When a button is pressed, save the button in lastButtonUsed for each players\r", - "if (gamepad.buttons[buttonId].pressed) gdjs._extensionController.players[playerId].lastButtonUsed = buttonId;\r", - "eventsFunctionContext.returnValue = gamepad.buttons[buttonId].pressed;\r", - "\r", "\r", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "const player = gdjs._extensionController.getPlayer(playerId)\r", + "eventsFunctionContext.returnValue = player.isAnyButtonPressed();\r", "" ], "parameterObjects": "", @@ -8902,7 +8704,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" } ], @@ -8918,35 +8720,18 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", "\r", - "//Get function parameters\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", "const controllerType = eventsFunctionContext.getArgument(\"controller_type\").toUpperCase();\r", - "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier in string expression: \"Last pressed button (LastButtonString)\", is not valid number, must be between 0 and 4.');\r", + "/** @type {Gamepad} */\r", + "const gamepad = gdjs._extensionController.getGamepad(playerId);\r", + "if (!gamepad) {\r", + " // The gamepad is not connected.\r", " return;\r", "}\r", - "if (controllerType === \"\") {\r", - " console.error('Parameter controller type is not valid in string expression: \"Last pressed button (LastButtonString)\"');\r", - " return;\r", - "}\r", - "\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "if (gamepad !== null) { //Gamepad exist\r", - " //Get last btn id\r", - " const lastButtonUsedID = gdjs._extensionController.players[playerId].lastButtonUsed;\r", - "\r", - " //Return last button as string \r", - " eventsFunctionContext.returnValue = gdjs._extensionController.getInputString(controllerType, lastButtonUsedID);\r", - "\r", - "} else { //Gamepad dosen't exist\r", - " console.error('Your controller is not supported or the gamepad wasn\\'t detected in string expression: \"Last pressed button (LastButtonString)\"');\r", - " eventsFunctionContext.returnValue = \"Gamepad not connected\";\r", - "}" + "const lastButtonUsedID = gdjs._extensionController.getPlayer(playerId).lastButtonUsed;\r", + "eventsFunctionContext.returnValue = gdjs._extensionController.getInputString(controllerType, lastButtonUsedID);\r", + "" ], "parameterObjects": "", "useStrict": true, @@ -8959,7 +8744,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" }, { @@ -8981,20 +8766,16 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", - "\r", - "//Get the last activated controller\r", - "const controllerId = gdjs._extensionController.lastActiveController;\r", "\r", - "// Check if controller is active\r", - "const gamepad = gamepads[controllerId];\r", - "if (gamepad == null) {\r", - " eventsFunctionContext.returnValue = 0;\r", - "} else {\r", - " // Return active controller id\r", - " eventsFunctionContext.returnValue = controllerId + 1;\r", + "const gamepads = navigator.getGamepads ? navigator.getGamepads() : [];\r", + "let lastGamepadIndex = -1;\r", + "for (let playerId = 0; playerId < gamepads.length; playerId++) {\r", + " // Gamepads can be disconnected and become null\r", + " if (gamepads[playerId]) {\r", + " lastGamepadIndex = playerId\r", + " }\r", "}\r", - "" + "eventsFunctionContext.returnValue = lastGamepadIndex + 1;" ], "parameterObjects": "", "useStrict": true, @@ -9017,127 +8798,16 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", "\r", - "//Get function parameters\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", "const button = eventsFunctionContext.getArgument(\"button\").toUpperCase();\r", "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier in condition: \"Gamepad button pressed\", is not valid number, must be between 0 and 4.');\r", - " return;\r", - "}\r", - "if (button === \"\") {\r", - " console.error('Parameter button is not valid in condition: \"Gamepad button pressed\"');\r", - " eventsFunctionContext.returnValue = false;\r", - " return;\r", - "}\r", - "\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", - "if (gamepad == null) return;\r", - "\r", - "let buttonId;\r", - "\r", - "switch (button) {\r", - " case 'A':\r", - " case 'CROSS':\r", - " buttonId = 0;\r", - " break;\r", - " case 'B':\r", - " case 'CIRCLE':\r", - " buttonId = 1;\r", - " break;\r", - " case 'X':\r", - " case 'SQUARE':\r", - " buttonId = 2;\r", - " break;\r", - " case 'Y':\r", - " case 'TRIANGLE':\r", - " buttonId = 3;\r", - " break;\r", - " case 'LB':\r", - " case 'L1':\r", - " buttonId = 4;\r", - " break;\r", - " case 'RB':\r", - " case 'R1':\r", - " buttonId = 5;\r", - " break;\r", - " case 'LT':\r", - " case 'L2':\r", - " buttonId = 6;\r", - " break;\r", - " case 'RT':\r", - " case 'R2':\r", - " buttonId = 7;\r", - " break;\r", - "\r", - " case 'UP':\r", - " buttonId = 12;\r", - " break;\r", - " case 'DOWN':\r", - " buttonId = 13;\r", - " break;\r", - " case 'LEFT':\r", - " buttonId = 14;\r", - " break;\r", - " case 'RIGHT':\r", - " buttonId = 15;\r", - " break;\r", - "\r", - " case 'BACK':\r", - " case 'SHARE':\r", - " buttonId = 8;\r", - " break;\r", - " case 'START':\r", - " case 'OPTIONS':\r", - " buttonId = 9;\r", - " break;\r", - "\r", - " case 'CLICK_STICK_LEFT':\r", - " buttonId = 10;\r", - " break;\r", - " case 'CLICK_STICK_RIGHT':\r", - " buttonId = 11;\r", - " break;\r", - "\r", - " //PS4\r", - " case 'PS_BUTTON':\r", - " buttonId = 16;\r", - " break;\r", - " case 'CLICK_TOUCHPAD':\r", - " buttonId = 17;\r", - " break;\r", - "\r", - " default:\r", - " console.error('The button: ' + button + ' in condition: \"Gamepad button pressed\" is not valid.');\r", - " eventsFunctionContext.returnValue = false;\r", - " break;\r", - "}\r", - "\r", - "\r", - "\r", - "if (buttonId === undefined) {\r", - " console.error('There is no buttons valid in condition: \"Gamepad button pressed\"');\r", - " eventsFunctionContext.returnValue = false;\r", - " return;\r", - "}\r", - "\r", - "if (gamepad.buttons == null || gamepad.buttons[buttonId] == null) {\r", - " console.error('Buttons on the gamepad are not accessible in condition: \"Gamepad button pressed\"');\r", - " eventsFunctionContext.returnValue = false;\r", + "const buttonId = gdjs._extensionController.getButtonId(button);\r", + "if (buttonId === null) {\r", " return;\r", "}\r", - "\r", - "//When a button is pressed, save the button in lastButtonUsed for each players\r", - "if (gamepad.buttons[buttonId].pressed) gdjs._extensionController.players[playerId].lastButtonUsed = buttonId;\r", - "eventsFunctionContext.returnValue = gamepad.buttons[buttonId].pressed;\r", - "\r", - "\r", - "\r", + "const player = gdjs._extensionController.getPlayer(playerId)\r", + "eventsFunctionContext.returnValue = player.isButtonPressed(buttonId);\r", "" ], "parameterObjects": "", @@ -9148,7 +8818,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" }, { @@ -9175,15 +8845,9 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "//Get function parameter\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier in expression: \"Gamepad deadzone for sticks\", is not valid number, must be between 0 and 4.');\r", - " return;\r", - "}\r", - "///Return the deadzone value for a given player\r", - "eventsFunctionContext.returnValue = gdjs._extensionController.players[playerId].deadzone;" + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "eventsFunctionContext.returnValue = gdjs._extensionController.getPlayer(playerId).deadzone;" ], "parameterObjects": "", "useStrict": true, @@ -9196,7 +8860,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" } ], @@ -9212,18 +8876,12 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "//Get function parameter\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", - "const newDeadzone = eventsFunctionContext.getArgument(\"deadzone\");\r", "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier in action: \"Set gamepad deadzone for sticks\", is not valid, must be between 0 and 4.');\r", - " return;\r", - "}\r", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "const newDeadzone = eventsFunctionContext.getArgument(\"deadzone\");\r", "\r", - "// clamp the newDeadzone in range [0, 1].\r", "// https://github.com/4ian/GDevelop-extensions/pull/33#issuecomment-618224857\r", - "gdjs._extensionController.players[playerId].deadzone = gdjs.evtTools.common.clamp(newDeadzone, 0, 1);\r", + "gdjs._extensionController.getPlayer(playerId).deadzone = gdjs.evtTools.common.clamp(newDeadzone, 0, 1);\r", "" ], "parameterObjects": "", @@ -9234,7 +8892,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" }, { @@ -9255,141 +8913,28 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", "\r", - "//Get function parameters\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", "const stick = eventsFunctionContext.getArgument(\"stick\").toUpperCase();\r", "const direction = eventsFunctionContext.getArgument(\"direction\").toUpperCase();\r", "\r", - "if (playerId < 0 || playerId > 4) {\r", - " console.error('Parameter gamepad identifier in condition: \"Gamepad stick pushed (axis)\", is not valid number, must be between 0 and 4.');\r", - " return;\r", - "}\r", "if (stick != \"LEFT\" && stick != \"RIGHT\") {\r", " console.error('Parameter stick in condition: \"Gamepad stick pushed (axis)\", is not valid, must be LEFT or RIGHT');\r", " return;\r", "}\r", "if (direction != \"UP\" && direction != \"DOWN\" && direction != \"LEFT\" && direction != \"RIGHT\" && direction != \"ANY\") {\r", - " console.error('Parameter deadzone in condition: \"Gamepad stick pushed (axis)\", is not valid, must be UP, DOWN, LEFT or RIGHT');\r", + " console.error('Parameter direction in condition: \"Gamepad stick pushed (axis)\", is not valid, must be UP, DOWN, LEFT or RIGHT');\r", " return;\r", "}\r", - "\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", - "if (gamepad == null) {\r", - " eventsFunctionContext.returnValue = false;\r", + "/** @type {Gamepad} */\r", + "const gamepad = gdjs._extensionController.getGamepad(playerId);\r", + "if (!gamepad) {\r", + " // The gamepad is not connected.\r", " return;\r", "}\r", - "\r", - "\r", - "//Define in onFirstSceneLoaded function\r", - "const getNormalizedAxisValue = gdjs._extensionController.getNormalizedAxisValue;\r", - "\r", - "switch (stick) {\r", - " case 'LEFT':\r", - " switch (direction) {\r", - " case 'LEFT':\r", - " if (getNormalizedAxisValue(gamepad.axes[0], playerId) < 0) {\r", - " eventsFunctionContext.returnValue = true;\r", - " return;\r", - " }\r", - " break;\r", - "\r", - " case 'RIGHT':\r", - " if (getNormalizedAxisValue(gamepad.axes[0], playerId) > 0) {\r", - " eventsFunctionContext.returnValue = true;\r", - " return;\r", - " }\r", - " break;\r", - "\r", - " case 'UP':\r", - " if (getNormalizedAxisValue(gamepad.axes[1], playerId) < 0) {\r", - " eventsFunctionContext.returnValue = true;\r", - " return;\r", - " }\r", - " break;\r", - "\r", - " case 'DOWN':\r", - " if (getNormalizedAxisValue(gamepad.axes[1], playerId) > 0) {\r", - " eventsFunctionContext.returnValue = true;\r", - " return;\r", - " }\r", - " break;\r", - "\r", - " case 'ANY':\r", - " if ( getNormalizedAxisValue(gamepad.axes[0], playerId) < 0\r", - " || getNormalizedAxisValue(gamepad.axes[0], playerId) > 0\r", - " || getNormalizedAxisValue(gamepad.axes[1], playerId) < 0 \r", - " || getNormalizedAxisValue(gamepad.axes[1], playerId) > 0) {\r", - " eventsFunctionContext.returnValue = true;\r", - " return;\r", - " }\r", - " break;\r", - "\r", - " default:\r", - " console.error('The value Direction on stick Left on the condition: \"Gamepad stick pushed (axis)\" is not valid.');\r", - " eventsFunctionContext.returnValue = false;\r", - " break;\r", - " }\r", - " break;\r", - "\r", - " case 'RIGHT':\r", - " switch (direction) {\r", - " case 'LEFT':\r", - " if (getNormalizedAxisValue(gamepad.axes[2], playerId) < 0) {\r", - " eventsFunctionContext.returnValue = true;\r", - " return;\r", - " }\r", - " break;\r", - "\r", - " case 'RIGHT':\r", - " if (getNormalizedAxisValue(gamepad.axes[2], playerId) > 0) {\r", - " eventsFunctionContext.returnValue = true;\r", - " return;\r", - " }\r", - " break;\r", - "\r", - " case 'UP':\r", - " if (getNormalizedAxisValue(gamepad.axes[3], playerId) < 0) {\r", - " eventsFunctionContext.returnValue = true;\r", - " return;\r", - " }\r", - " break;\r", - "\r", - " case 'DOWN':\r", - " if (getNormalizedAxisValue(gamepad.axes[3], playerId) > 0) {\r", - " eventsFunctionContext.returnValue = true;\r", - " return;\r", - " }\r", - " break;\r", - "\r", - " case 'ANY':\r", - " if ( getNormalizedAxisValue(gamepad.axes[2], playerId) < 0\r", - " || getNormalizedAxisValue(gamepad.axes[2], playerId) > 0\r", - " || getNormalizedAxisValue(gamepad.axes[3], playerId) < 0 \r", - " || getNormalizedAxisValue(gamepad.axes[3], playerId) > 0) {\r", - " eventsFunctionContext.returnValue = true;\r", - " return;\r", - " }\r", - " break;\r", - "\r", - " default:\r", - " console.error('The value Direction on stick Right on the condition: \"Gamepad stick pushed (axis)\" is not valid.');\r", - " eventsFunctionContext.returnValue = false;\r", - " break;\r", - " }\r", - " break;\r", - "\r", - " default:\r", - " console.error('The value Stick on the condition: \"Gamepad stick pushed (axis)\" is not valid.');\r", - " eventsFunctionContext.returnValue = false;\r", - " break;\r", - "}\r", - "\r", - "eventsFunctionContext.returnValue = false;\r", + "const axisValueX = stick === 'RIGHT' ? gamepad.axes[2] : gamepad.axes[0];\r", + "const axisValueY = stick === 'RIGHT' ? gamepad.axes[3] : gamepad.axes[1];\r", + "eventsFunctionContext.returnValue = gdjs._extensionController.isAxisPushed(playerId, direction, axisValueX, axisValueY);\r", "" ], "parameterObjects": "", @@ -9400,7 +8945,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" }, { @@ -9420,24 +8965,24 @@ }, { "description": "Return the number of connected gamepads.", - "fullName": "Connected gamepads number", + "fullName": "Connected gamepads count", "functionType": "Expression", "name": "ConnectedGamepadsCount", "sentence": "", "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [] - }, { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", "\r", - "// Gamepads can be disconnected and become null, so we have to filter them.\r", - "eventsFunctionContext.returnValue = Object.keys(gamepads).filter(key => !!gamepads[key]).length;\r", + "const gamepads = navigator.getGamepads ? navigator.getGamepads() : [];\r", + "let connectedGamepadCount = 0;\r", + "for (let playerId = 0; playerId < gamepads.length; playerId++) {\r", + " // Gamepads can be disconnected and become null\r", + " if (gamepads[playerId]) {\r", + " connectedGamepadCount++;\r", + " }\r", + "}\r", + "eventsFunctionContext.returnValue = connectedGamepadCount;\r", "" ], "parameterObjects": "", @@ -9461,22 +9006,13 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);", - "", - "//Get function parameter", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;", - "", - "if (playerId < 0 || playerId > 4) {", - " console.error('Parameter gamepad identifier in string expression: \"Gamepad type\", is not valid number, must be between 0 and 4');", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;", + "/** @type {Gamepad} */", + "const gamepad = gdjs._extensionController.getGamepad(playerId);", + "if (!gamepad) {", + " // The gamepad is not connected.", " return;", "}", - "", - "const gamepad = gamepads[playerId];", - "", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.", - "if (gamepad == null) return;", - "", "eventsFunctionContext.returnValue = (gamepad && gamepad.id) ? gamepad.id : \"No information for player \" + (playerId + 1)", "" ], @@ -9491,7 +9027,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" } ], @@ -9507,28 +9043,14 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);", - "", - "//Get function parameters", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;", "const controllerType = eventsFunctionContext.getArgument(\"controller_type\").toUpperCase();", - "", - "if (playerId < 0 || playerId > 4) {", - " console.error('Parameter gamepad identifier in condition: \"Gamepad type\", is not valid number, must be between 0 and 4.');", + "/** @type {Gamepad} */", + "const gamepad = gdjs._extensionController.getGamepad(playerId);", + "if (!gamepad) {", + " // The gamepad is not connected.", " return;", "}", - "if (controllerType === \"\") {", - " console.error('Parameter type in condition: \"Gamepad type\", is not a string.');", - " return;", - "}", - "", - "const gamepad = gamepads[playerId];", - "", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.", - "if (gamepad == null) return;", - "", - "", "if (controllerType == \"XBOX\") {", " eventsFunctionContext.returnValue = gdjs._extensionController.isXbox(gamepad);", "} else {", @@ -9543,7 +9065,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" }, { @@ -9564,17 +9086,9 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;", "/** @type {Gamepad[]} */", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);", - "", - "//Get function parameter", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;", - "", - "if (playerId < 0 || playerId > 4) {", - " console.error('Parameter gamepad identifier in condition: \"Gamepad connected\", is not valid number, must be between 0 and 4.');", - " return;", - "}", - "", + "const gamepads = navigator.getGamepads ? navigator.getGamepads() : [];", "// If gamepad was disconnected it will be null (so this will return false)", "// If gamepad was never connected it will be undefined (so this will return false)", "eventsFunctionContext.returnValue = !!gamepads[playerId];" @@ -9587,7 +9101,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" } ], @@ -9603,25 +9117,16 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */", - "//Vibration work only on game in browser.", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);", - "", - "//Get function parameters", - "const playerId = eventsFunctionContext.getArgument(\"Player_ID\") - 1;", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;", "const duration = eventsFunctionContext.getArgument(\"Duration\") || 1;", - "", - "if (playerId < 0 || playerId > 4) {", - " console.error('Parameter gamepad identifier in action: \"Gamepad connected\", is not valid number, must be between 0 and 4.');", - " return;", + "/** @type {Gamepad} */", + "const gamepad = gdjs._extensionController.getGamepad(playerId);", + "if (!gamepad) {", + " // The gamepad is not connected.", + " return;", "}", - "", - "const gamepad = gamepads[playerId];", - "", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.", - "if (gamepad == null) return;", - "", - "if (gamepad && gamepad.vibrationActuator) {", + "//Vibration work only on game in browser.", + "if (gamepad.vibrationActuator) {", " gamepad.vibrationActuator.playEffect(\"dual-rumble\", {", " startDelay: 0,", " duration: duration * 1000,", @@ -9638,7 +9143,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "Player_ID", + "name": "PlayerId", "type": "expression" }, { @@ -9659,35 +9164,19 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */", - "//Vibration work only on game in browser.", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);", - "", - "//Get function parameters", - "const playerId = eventsFunctionContext.getArgument(\"Player_ID\") - 1;", + "const { clamp } = gdjs.evtTools.common;", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;", "const duration = eventsFunctionContext.getArgument(\"Duration\") || 1;", - "const strongRumbleMagnitude = eventsFunctionContext.getArgument(\"StrongMagnitude\");", - "const weakRumbleMagnitude = eventsFunctionContext.getArgument(\"WeakMagnitude\");", - "", - "if (playerId < 0 || playerId > 4) {", - " console.error('Parameter gamepad identifier in action: \"Advanced gamepad vibration\", is not valid number, must be between 0 and 4.');", - " return;", - "}", - "if (weakRumbleMagnitude < 0 || weakRumbleMagnitude > 1) {", - " console.error('Parameter weakRumble identifier in action: \"Advanced gamepad vibration\", is not valid number, must be between 0 and 1.');", - " return;", - "}", - "if (strongRumbleMagnitude < 0 || strongRumbleMagnitude > 1) {", - " console.error('Parameter strongRumble identifier in action: \"Advanced gamepad vibration\", is not valid number, must be between 0 and 1.');", - " return;", + "const strongRumbleMagnitude = clamp(eventsFunctionContext.getArgument(\"StrongMagnitude\"), 0, 1);", + "const weakRumbleMagnitude = clamp(eventsFunctionContext.getArgument(\"WeakMagnitude\"), 0, 1);", + "/** @type {Gamepad} */", + "const gamepad = gdjs._extensionController.getGamepad(playerId);", + "if (!gamepad) {", + " // The gamepad is not connected.", + " return;", "}", - "", - "const gamepad = gamepads[playerId];", - "", - "//we need keep this condition because when use have not yet plug the controller we can't get the controller in the gamepad variable.", - "if (gamepad == null) return;", - "", - "if (gamepad && gamepad.vibrationActuator) {", + "//Vibration work only on game in browser.", + "if (gamepad.vibrationActuator) {", " gamepad.vibrationActuator.playEffect(\"dual-rumble\", {", " startDelay: 0,", " duration: duration * 1000,", @@ -9695,11 +9184,11 @@ " strongMagnitude: strongRumbleMagnitude", " });", "}", - "", - "gdjs._extensionController.players[playerId].rumble.duration = duration;", - "gdjs._extensionController.players[playerId].rumble.elapsedTime = 0;", - "gdjs._extensionController.players[playerId].rumble.weakMagnitude = weakRumbleMagnitude;", - "gdjs._extensionController.players[playerId].rumble.strongMagnitude = strongRumbleMagnitude;" + "const player = gdjs._extensionController.getPlayer(playerId)", + "player.rumble.duration = duration;", + "player.rumble.elapsedTime = 0;", + "player.rumble.weakMagnitude = weakRumbleMagnitude;", + "player.rumble.strongMagnitude = strongRumbleMagnitude;" ], "parameterObjects": "", "useStrict": true, @@ -9709,7 +9198,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "Player_ID", + "name": "PlayerId", "type": "expression" }, { @@ -9740,39 +9229,22 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */", - "//Vibration work only on game in browser.", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);", - "", - "//Get function parameters", - "const playerId = eventsFunctionContext.getArgument(\"Player_ID\") - 1;", - "const elapsedTime = gdjs._extensionController.players[playerId].rumble.elapsedTime || 0;", - "const originalDuration = gdjs._extensionController.players[playerId].rumble.duration || 1;", - "const strongRumbleMagnitude = eventsFunctionContext.getArgument(\"StrongMagnitude\");", - "const weakRumbleMagnitude = eventsFunctionContext.getArgument(\"WeakMagnitude\");", - "", - "", - "if (playerId < 0 || playerId > 4) {", - " console.error('Parameter gamepad identifier in action: \"Change gamepad active vibration\", is not valid number, must be between 0 and 4.');", - " return;", - "}", - "if (weakRumbleMagnitude < 0 || weakRumbleMagnitude > 1) {", - " console.error('Parameter weakRumble identifier in action: \"Change gamepad active vibration\", is not valid number, must be between 0 and 1.');", - " return;", - "}", - "if (strongRumbleMagnitude < 0 || strongRumbleMagnitude > 1) {", - " console.error('Parameter strongRumble identifier in action: \"Change gamepad active vibration\", is not valid number, must be between 0 and 1.');", - " return;", + "const { clamp } = gdjs.evtTools.common;", + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;", + "const player = gdjs._extensionController.getPlayer(playerId);", + "const elapsedTime = player.rumble.elapsedTime || 0;", + "const originalDuration = player.rumble.duration || 1;", + "const strongRumbleMagnitude = clamp(eventsFunctionContext.getArgument(\"StrongMagnitude\"), 0, 1);", + "const weakRumbleMagnitude = clamp(eventsFunctionContext.getArgument(\"WeakMagnitude\"), 0, 1);", + "/** @type {Gamepad} */", + "const gamepad = gdjs._extensionController.getGamepad(playerId);", + "if (!gamepad) {", + " // The gamepad is not connected.", + " return;", "}", - "", - "const gamepad = gamepads[playerId];", - "", - "//we need keep this condition because when use have not yet plug the controller we can't get the controller in the gamepad variable.", - "if (gamepad == null) return;", - "", "if (originalDuration - elapsedTime <= 0) return;", - "", - "if (gamepad && gamepad.vibrationActuator) {", + "//Vibration work only on game in browser.", + "if (gamepad.vibrationActuator) {", " gamepad.vibrationActuator.playEffect(\"dual-rumble\", {", " startDelay: 0,", " duration: 1000 * (originalDuration - elapsedTime),", @@ -9781,8 +9253,8 @@ " });", "}", "", - "gdjs._extensionController.players[playerId].rumble.weakMagnitude = weakRumbleMagnitude;", - "gdjs._extensionController.players[playerId].rumble.strongMagnitude = strongRumbleMagnitude;" + "player.rumble.weakMagnitude = weakRumbleMagnitude;", + "player.rumble.strongMagnitude = strongRumbleMagnitude;" ], "parameterObjects": "", "useStrict": true, @@ -9792,7 +9264,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "Player_ID", + "name": "PlayerId", "type": "expression" }, { @@ -9823,54 +9295,10 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "/** @type {Gamepad[]} */\r", - "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", - "\r", - "//Get function parameters\r", - "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", - "\r", - "if (playerId < 0 || playerId > 4) {\r", - "\tconsole.error('Parameter gamepad identifier in condition: \"Any gamepad button released\", is not valid number, must be between 0 and 4.');\r", - "\treturn;\r", - "}\r", - "\r", - "const gamepad = gamepads[playerId];\r", - "\r", - "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", - "if (gamepad == null) return;\r", - "\r", - "for (let buttonId = 0; buttonId < gamepad.buttons.length; buttonId++) { //For each buttons on current frame.\r", - "\r", - "\tif (buttonId === undefined) {\r", - "\t\teventsFunctionContext.returnValue = false;\r", - "\t\treturn;\r", - "\t}\r", - "\r", - "\t//Get previous value or define value by default for the current button\r", - "\tgdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId] = gdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId] || { pressed: false };\r", - "\r", - "\t//Get state of the button at previous frame\r", - "\tconst previousStateButtonIsPressed = gdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId].pressed;\r", - "\r", - "\t//Get the state of the button on the current frame.\r", - "\tconst currentFrameStateButtonIsPressed = gamepad.buttons[buttonId].pressed;\r", "\r", - "\t//When previousStateButtonIsPressed is true and actual button state is not pressed\r", - "\t//Player have release the button\r", - "\tif (previousStateButtonIsPressed === true && currentFrameStateButtonIsPressed === false) {\r", - "\t\tgdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId].pressed = true;\r", - "\t\teventsFunctionContext.returnValue = true;\r", - "\t\t//break;\r", - "\t\treturn;\r", - "\t} else {\r", - "\t\t//The player didn't released the button yet, the previous frame state is still true\r", - "\t\tgdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId].pressed = false;\r", - "\t\teventsFunctionContext.returnValue = false;\r", - "\t}\r", - "\r", - "\tif (currentFrameStateButtonIsPressed) gdjs._extensionController.players[playerId].lastButtonUsed = buttonId;\r", - "}\r", - "" + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "const player = gdjs._extensionController.getPlayer(playerId)\r", + "eventsFunctionContext.returnValue = player.isAnyButtonReleased();" ], "parameterObjects": "", "useStrict": true, @@ -9880,7 +9308,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "player_ID", + "name": "PlayerId", "type": "expression" } ], @@ -9896,8 +9324,8 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "const playerId = eventsFunctionContext.getArgument(\"Player_ID\") - 1;\r", - "eventsFunctionContext.returnValue = gdjs._extensionController.players[playerId].rumble.weakMagnitude;" + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "eventsFunctionContext.returnValue = gdjs._extensionController.getPlayer(playerId).rumble.weakMagnitude;" ], "parameterObjects": "", "useStrict": true, @@ -9910,7 +9338,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "Player_ID", + "name": "PlayerId", "type": "expression" } ], @@ -9926,8 +9354,8 @@ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ - "const playerId = eventsFunctionContext.getArgument(\"Player_ID\") - 1;\r", - "eventsFunctionContext.returnValue = gdjs._extensionController.players[playerId].rumble.strongMagnitude;" + "const playerId = eventsFunctionContext.getArgument(\"PlayerId\") - 1;\r", + "eventsFunctionContext.returnValue = gdjs._extensionController.getPlayer(playerId).rumble.strongMagnitude;" ], "parameterObjects": "", "useStrict": true, @@ -9940,7 +9368,7 @@ "parameters": [ { "description": "The gamepad identifier: 1, 2, 3 or 4", - "name": "Player_ID", + "name": "PlayerId", "type": "expression" } ], @@ -10444,6 +9872,7 @@ "extraInformation": [ "PlatformBehavior::PlatformerObjectBehavior" ], + "choices": [], "name": "PlatformerCharacter" }, { @@ -10478,15 +9907,39 @@ "type": "Choice", "label": "Jump button", "group": "Controls", - "extraInformation": [ - "A or Cross", - "B or Circle", - "X or Square", - "Y or Triangle", - "LB or L1", - "RB or R1", - "LT or L2", - "RT or R2" + "choices": [ + { + "label": "A or Cross", + "value": "A or Cross" + }, + { + "label": "B or Circle", + "value": "B or Circle" + }, + { + "label": "X or Square", + "value": "X or Square" + }, + { + "label": "Y or Triangle", + "value": "Y or Triangle" + }, + { + "label": "LB or L1", + "value": "LB or L1" + }, + { + "label": "RB or R1", + "value": "RB or R1" + }, + { + "label": "LT or L2", + "value": "LT or L2" + }, + { + "label": "RT or R2", + "value": "RT or R2" + } ], "name": "JumpButton" } @@ -10618,6 +10071,7 @@ "extraInformation": [ "Physics3D::PhysicsCharacter3D" ], + "choices": [], "name": "PhysicsCharacter3D" }, { @@ -10631,9 +10085,15 @@ "type": "Choice", "label": "Walk joystick", "group": "Controls", - "extraInformation": [ - "Left", - "Right" + "choices": [ + { + "label": "Left", + "value": "Left" + }, + { + "label": "Right", + "value": "Right" + } ], "name": "JoystickIdentifier" }, @@ -10642,15 +10102,39 @@ "type": "Choice", "label": "Jump button", "group": "Controls", - "extraInformation": [ - "A or Cross", - "B or Circle", - "X or Square", - "Y or Triangle", - "LB or L1", - "RB or R1", - "LT or L2", - "RT or R2" + "choices": [ + { + "label": "A or Cross", + "value": "A or Cross" + }, + { + "label": "B or Circle", + "value": "B or Circle" + }, + { + "label": "X or Square", + "value": "X or Square" + }, + { + "label": "Y or Triangle", + "value": "Y or Triangle" + }, + { + "label": "LB or L1", + "value": "LB or L1" + }, + { + "label": "RB or R1", + "value": "RB or R1" + }, + { + "label": "LT or L2", + "value": "LT or L2" + }, + { + "label": "RT or R2", + "value": "RT or R2" + } ], "name": "JumpButton" } @@ -10771,6 +10255,7 @@ "extraInformation": [ "Physics3D::PhysicsCharacter3D" ], + "choices": [], "name": "PhysicsCharacter3D" }, { @@ -10784,9 +10269,15 @@ "type": "Choice", "label": "Walk joystick", "group": "Controls", - "extraInformation": [ - "Left", - "Right" + "choices": [ + { + "label": "Left", + "value": "Left" + }, + { + "label": "Right", + "value": "Right" + } ], "name": "WalkStick" }, @@ -10795,9 +10286,15 @@ "type": "Choice", "label": "Camera joystick", "group": "Controls", - "extraInformation": [ - "Left", - "Right" + "choices": [ + { + "label": "Left", + "value": "Left" + }, + { + "label": "Right", + "value": "Right" + } ], "name": "CameraStick" }, @@ -10806,15 +10303,39 @@ "type": "Choice", "label": "Jump button", "group": "Controls", - "extraInformation": [ - "A or Cross", - "B or Circle", - "X or Square", - "Y or Triangle", - "LB or L1", - "RB or R1", - "LT or L2", - "RT or R2" + "choices": [ + { + "label": "A or Cross", + "value": "A or Cross" + }, + { + "label": "B or Circle", + "value": "B or Circle" + }, + { + "label": "X or Square", + "value": "X or Square" + }, + { + "label": "Y or Triangle", + "value": "Y or Triangle" + }, + { + "label": "LB or L1", + "value": "LB or L1" + }, + { + "label": "RB or R1", + "value": "RB or R1" + }, + { + "label": "LT or L2", + "value": "LT or L2" + }, + { + "label": "RT or R2", + "value": "RT or R2" + } ], "name": "JumpButton" } @@ -11750,6 +11271,7 @@ "extraInformation": [ "Scene3D::Base3DBehavior" ], + "choices": [], "name": "Object3D" }, { @@ -11762,9 +11284,15 @@ "value": "Right", "type": "Choice", "label": "Camera joystick", - "extraInformation": [ - "Left", - "Right" + "choices": [ + { + "label": "Left", + "value": "Left" + }, + { + "label": "Right", + "value": "Right" + } ], "name": "CameraStick" }, @@ -12151,6 +11679,7 @@ "extraInformation": [ "Physics3D::PhysicsCar3D" ], + "choices": [], "name": "PhysicsCar3D" }, { @@ -12185,15 +11714,39 @@ "type": "Choice", "label": "Hand brake button", "group": "Controls", - "extraInformation": [ - "A or Cross", - "B or Circle", - "X or Square", - "Y or Triangle", - "LB or L1", - "RB or R1", - "LT or L2", - "RT or R2" + "choices": [ + { + "label": "A or Cross", + "value": "A or Cross" + }, + { + "label": "B or Circle", + "value": "B or Circle" + }, + { + "label": "X or Square", + "value": "X or Square" + }, + { + "label": "Y or Triangle", + "value": "Y or Triangle" + }, + { + "label": "LB or L1", + "value": "LB or L1" + }, + { + "label": "RB or R1", + "value": "RB or R1" + }, + { + "label": "LT or L2", + "value": "LT or L2" + }, + { + "label": "RT or R2", + "value": "RT or R2" + } ], "name": "HandBrakeButton" } @@ -12790,6 +12343,7 @@ "extraInformation": [ "TopDownMovementBehavior::TopDownMovementBehavior" ], + "choices": [], "name": "TopDownMovement" }, { @@ -12824,10 +12378,19 @@ "type": "Choice", "label": "Stick mode", "group": "Controls", - "extraInformation": [ - "Analog", - "360°", - "8 Directions" + "choices": [ + { + "label": "Analog", + "value": "Analog" + }, + { + "label": "360°", + "value": "360°" + }, + { + "label": "8 Directions", + "value": "8 Directions" + } ], "name": "StickMode" } @@ -12848,13 +12411,13 @@ "name": "SpriteMultitouchJoystick", "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/Line Hero Pack/Master/SVG/Videogames/Videogames_controller_joystick_arrows_direction.svg", "shortDescription": "Joysticks or buttons for touchscreens.", - "version": "1.8.3", + "version": "1.9.0", "description": [ - "Multitouch joysticks can be used the same way as physical gamepads:", + "Multitouch joysticks are objects showing a joystick on the screen, useful for mobile. They work like a physical gamepad:", "- 4 or 8 directions", "- Analogus pads", "- Player selection", - "- Controls mapping for top-down movement and platformer characters", + "- Automatic \"mapper\" behaviors for 2D and 3D movement behaviors (platformer characters, top-down movement, 3D character etc...). Add one of these to the object with the movement behavior (i.e: the player most of the time) and the behavior will then be controlled automatically by the virtual joystick (it works by reading the multitouch joystick state and simulating controls). No need for additional events to make it work once the behaviors are set up.", "", "There are ready-to-use joysticks in the asset-store [multitouch joysticks pack](https://editor.gdevelop.io/?initial-dialog=asset-store&asset-pack=multitouch-joysticks-multitouch-joysticks)." ], @@ -12918,6 +12481,28 @@ } ], "eventsFunctions": [ + { + "description": "Check if the events are running for the editor.", + "fullName": "Editor is running", + "functionType": "Condition", + "name": "IsInGameEdition", + "private": true, + "sentence": "Events are running for the editor", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const game = runtimeScene.getGame();\r", + "eventsFunctionContext.returnValue = game.isInGameEdition && game.isInGameEdition();" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [], + "objectGroups": [] + }, { "fullName": "Accelerated speed", "functionType": "Expression", @@ -13336,11 +12921,11 @@ "objectGroups": [] }, { - "description": "Check if a button is pressed on a gamepad.", - "fullName": "Multitouch controller button pressed", + "description": "Check if a button was just pressed on a multitouch controller.", + "fullName": "Multitouch controller button just pressed", "functionType": "Condition", - "name": "IsButtonPressed", - "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", + "name": "IsButtonJustPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ was just pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -13352,7 +12937,73 @@ "parameters": [ "Controllers[ControllerIdentifier].Buttons[Button].State", "=", - "\"Pressed\"" + "\"JustPressed\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier", + "type": "expression" + }, + { + "description": "Button name", + "name": "Button", + "supplementaryInformation": "[\"A\",\"CROSS\",\"B\",\"CIRCLE\",\"X\",\"SQUARE\",\"Y\",\"TRIANGLE\",\"LB\",\"L1\",\"RB\",\"R1\",\"LT\",\"L2\",\"RT\",\"R2\",\"UP\",\"DOWN\",\"LEFT\",\"RIGHT\",\"BACK\",\"SHARE\",\"START\",\"OPTIONS\",\"CLICK_STICK_LEFT\",\"CLICK_STICK_RIGHT\",\"PS_BUTTON\",\"CLICK_TOUCHPAD\"]", + "type": "string" + } + ], + "objectGroups": [] + }, + { + "description": "Check if a button is pressed on a multitouch controller.", + "fullName": "Multitouch controller button pressed", + "functionType": "Condition", + "name": "IsButtonPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::Or" + }, + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"Pressed\"" + ] + }, + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"JustPressed\"" + ] + } ] } ], @@ -13384,7 +13035,7 @@ "objectGroups": [] }, { - "description": "Check if a button is released on a gamepad.", + "description": "Check if a button is released on a multitouch controller.", "fullName": "Multitouch controller button released", "functionType": "Condition", "name": "IsButtonReleased", @@ -13470,7 +13121,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"JustPressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -14843,41 +14494,23 @@ "conditions": [ { "type": { - "value": "HasGameJustResumed" + "inverted": true, + "value": "SpriteMultitouchJoystick::IsInGameEdition" }, "parameters": [ + "", "" ] } ], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - } - ] - }, - { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Manage touches", - "source": "", - "type": "BuiltinCommonInstructions::Group", + "actions": [], "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "value": "HasAnyTouchOrMouseStarted" + "value": "HasGameJustResumed" }, "parameters": [ "" @@ -14887,171 +14520,207 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" }, "parameters": [ - "TouchIndex", - "=", - "0" + "Object", + "Behavior", + "" ] } - ], + ] + }, + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Manage touches", + "source": "", + "type": "BuiltinCommonInstructions::Group", "events": [ { - "type": "BuiltinCommonInstructions::Repeat", - "repeatExpression": "StartedTouchOrMouseCount()", - "conditions": [], - "actions": [], + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "HasAnyTouchOrMouseStarted" + }, + "parameters": [ + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchIndex", + "=", + "0" + ] + } + ], "events": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "StartedTouchOrMouseCount()", + "conditions": [], + "actions": [], + "events": [ { - "type": { - "value": "NumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "0" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "0" + ] + }, + { + "type": { + "value": "CollisionPoint" + }, + "parameters": [ + "Object", + "TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)", + "TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "StartedTouchOrMouseId(TouchIndex)" + ] + } ] }, { - "type": { - "value": "CollisionPoint" - }, - "parameters": [ - "Object", - "TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)", - "TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "StartedTouchOrMouseId(TouchIndex)" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchIndex", - "+", - "1" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchIndex", + "+", + "1" + ] + } ] } ] } ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 - }, - "comment": "Move thumb back to center when not being pressed (acts like a spring on a real controller)" - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + }, { - "type": { - "value": "HasTouchEnded" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 }, - "parameters": [ - "", - "TouchId" - ] - } - ], - "actions": [ + "comment": "Move thumb back to center when not being pressed (acts like a spring on a real controller)" + }, { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" - }, - "parameters": [ - "Object", - "Behavior", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "HasTouchEnded" + }, + "parameters": [ + "", + "TouchId" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } ] } - ] - } - ], - "parameters": [] - }, - { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Update joystick position", - "source": "", - "type": "BuiltinCommonInstructions::Group", - "events": [ + ], + "parameters": [] + }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Update joystick position", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ { - "type": { - "value": "NumberVariable" - }, - "parameters": [ - "TouchId", - "!=", - "0" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "!=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickAngle" + }, + "parameters": [ + "Object", + "Behavior", + "AngleBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0))", + "AngleBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0))" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "clamp(2 * DistanceBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0)) / Object.Width(), 0, 1)", + "" + ] + } ] } ], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickAngle" - }, - "parameters": [ - "Object", - "Behavior", - "AngleBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0))", - "AngleBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0))" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "clamp(2 * DistanceBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0)) / Object.Width(), 0, 1)", - "" - ] - } - ] + "parameters": [] } - ], - "parameters": [] + ] } ], "parameters": [ @@ -15926,7 +15595,7 @@ "sharedPropertyDescriptors": [] }, { - "description": "Detect button presses made on a touchscreen.", + "description": "Detect presses made on a touchscreen on the object so it acts like a button and automatically trigger the button having the same identifier for the mapper behaviors.", "fullName": "Multitouch button", "name": "MultitouchButton", "objectType": "", @@ -15942,11 +15611,11 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::IsReleased" + "value": "BooleanVariable" }, "parameters": [ - "Object", - "Behavior", + "IsReleased", + "True", "" ] } @@ -15975,6 +15644,44 @@ } ] }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "False", + "" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + }, + "parameters": [ + "Object", + "Behavior", + "\"Pressed\"", + "" + ] + } + ] + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ @@ -16067,7 +15774,17 @@ "parameters": [ "Object", "Behavior", - "\"Pressed\"", + "\"JustPressed\"", + "" + ] + }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "True", "" ] } @@ -16138,6 +15855,16 @@ "" ] }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "False", + "" + ] + }, { "type": { "value": "SetNumberVariable" @@ -16167,11 +15894,11 @@ "objectGroups": [] }, { - "description": "Check if button is released.", - "fullName": "Button released", + "description": "Check if the button was just pressed.", + "fullName": "Button just pressed", "functionType": "Condition", - "name": "IsReleased", - "sentence": "Button _PARAM0_ is released", + "name": "IsJustPressed", + "sentence": "Button _PARAM0_ was just pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -16181,7 +15908,7 @@ "value": "BooleanVariable" }, "parameters": [ - "IsReleased", + "IsJustPressed", "True", "" ] @@ -16215,7 +15942,7 @@ "objectGroups": [] }, { - "description": "Check if button is pressed.", + "description": "Check if the button is pressed.", "fullName": "Button pressed", "functionType": "Condition", "name": "IsPressed", @@ -16262,6 +15989,54 @@ ], "objectGroups": [] }, + { + "description": "Check if the button is released.", + "fullName": "Button released", + "functionType": "Condition", + "name": "IsReleased", + "sentence": "Button _PARAM0_ is released", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsReleased", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "type": "behavior" + } + ], + "objectGroups": [] + }, { "fullName": "Button state", "functionType": "Action", @@ -16303,7 +16078,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"JustPressed\",\"Pressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -16344,6 +16119,13 @@ "hidden": true, "name": "IsReleased" }, + { + "value": "", + "type": "Boolean", + "label": "Button just pressed", + "hidden": true, + "name": "IsJustPressed" + }, { "value": "0", "type": "Number", @@ -16541,6 +16323,7 @@ "extraInformation": [ "PlatformBehavior::PlatformerObjectBehavior" ], + "choices": [], "name": "Property" }, { @@ -16554,9 +16337,15 @@ "type": "Choice", "label": "Joystick name", "group": "Controls", - "extraInformation": [ - "Primary", - "Secondary" + "choices": [ + { + "label": "Primary", + "value": "Primary" + }, + { + "label": "Secondary", + "value": "Secondary" + } ], "name": "JoystickIdentifier" }, @@ -16677,6 +16466,7 @@ "extraInformation": [ "Physics3D::PhysicsCharacter3D" ], + "choices": [], "name": "PhysicsCharacter3D" }, { @@ -16690,9 +16480,15 @@ "type": "Choice", "label": "Walk joystick", "group": "Controls", - "extraInformation": [ - "Primary", - "Secondary" + "choices": [ + { + "label": "Primary", + "value": "Primary" + }, + { + "label": "Secondary", + "value": "Secondary" + } ], "name": "JoystickIdentifier" }, @@ -16802,6 +16598,7 @@ "extraInformation": [ "Physics3D::PhysicsCharacter3D" ], + "choices": [], "name": "PhysicsCharacter3D" }, { @@ -16815,9 +16612,15 @@ "type": "Choice", "label": "Walk joystick", "group": "Controls", - "extraInformation": [ - "Primary", - "Secondary" + "choices": [ + { + "label": "Primary", + "value": "Primary" + }, + { + "label": "Secondary", + "value": "Secondary" + } ], "name": "JoystickIdentifier" }, @@ -17760,6 +17563,7 @@ "extraInformation": [ "Scene3D::Base3DBehavior" ], + "choices": [], "name": "Object3D" }, { @@ -17773,9 +17577,15 @@ "type": "Choice", "label": "Camera joystick", "group": "Controls", - "extraInformation": [ - "Primary", - "Secondary" + "choices": [ + { + "label": "Primary", + "value": "Primary" + }, + { + "label": "Secondary", + "value": "Secondary" + } ], "name": "CameraStick" }, @@ -17991,6 +17801,7 @@ "extraInformation": [ "Physics3D::PhysicsCar3D" ], + "choices": [], "name": "PhysicsCar3D" }, { @@ -18004,9 +17815,15 @@ "type": "Choice", "label": "Steer joystick", "group": "Controls", - "extraInformation": [ - "Primary", - "Secondary" + "choices": [ + { + "label": "Primary", + "value": "Primary" + }, + { + "label": "Secondary", + "value": "Secondary" + } ], "name": "SteerJoystickIdentifier" }, @@ -18015,9 +17832,15 @@ "type": "Choice", "label": "Speed joystick", "group": "Controls", - "extraInformation": [ - "Primary", - "Secondary" + "choices": [ + { + "label": "Primary", + "value": "Primary" + }, + { + "label": "Secondary", + "value": "Secondary" + } ], "name": "SpeedJoystickIdentifier" }, @@ -18550,6 +18373,7 @@ "extraInformation": [ "TopDownMovementBehavior::TopDownMovementBehavior" ], + "choices": [], "name": "TopDownMovement" }, { @@ -18562,9 +18386,15 @@ "value": "Primary", "type": "Choice", "label": "Joystick name", - "extraInformation": [ - "Primary", - "Secondary" + "choices": [ + { + "label": "Primary", + "value": "Primary" + }, + { + "label": "Secondary", + "value": "Secondary" + } ], "name": "JoystickIdentifier" }, @@ -18573,10 +18403,19 @@ "type": "Choice", "label": "Stick mode", "group": "Controls", - "extraInformation": [ - "Analog", - "360°", - "8 Directions" + "choices": [ + { + "label": "Analog", + "value": "Analog" + }, + { + "label": "360°", + "value": "360°" + }, + { + "label": "8 Directions", + "value": "8 Directions" + } ], "name": "StickMode" } @@ -18817,74 +18656,92 @@ "name": "doStepPostEvents", "sentence": "", "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "MettreAutour" - }, - "parameters": [ - "Thumb", - "Border", - "Border.MultitouchJoystick::JoystickForce() * Border.Width() / 2", - "Border.MultitouchJoystick::JoystickAngle()" - ] - } - ] - }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ - { - "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "ShouldBeHiddenWhenReleased", - "True", - "" - ] - }, { "type": { "inverted": true, - "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::IsPressed" + "value": "SpriteMultitouchJoystick::IsInGameEdition" }, "parameters": [ - "Object", + "", "" ] } ], - "actions": [ - { - "type": { - "value": "Cache" - }, - "parameters": [ - "Object" - ] - }, + "actions": [], + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::ActivateControl" - }, - "parameters": [ - "Object", - "no", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "MettreAutour" + }, + "parameters": [ + "Thumb", + "Border", + "Border.MultitouchJoystick::JoystickForce() * Border.Width() / 2", + "Border.MultitouchJoystick::JoystickAngle()" + ] + } ] }, { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "ShouldBeHiddenWhenReleased", - "False", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "ShouldBeHiddenWhenReleased", + "True", + "" + ] + }, + { + "type": { + "inverted": true, + "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::IsPressed" + }, + "parameters": [ + "Object", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "Cache" + }, + "parameters": [ + "Object" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::ActivateControl" + }, + "parameters": [ + "Object", + "no", + "" + ] + }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "ShouldBeHiddenWhenReleased", + "False", + "" + ] + } ] } ] @@ -19825,9 +19682,15 @@ "value": "Primary", "type": "Choice", "label": "Joystick name", - "extraInformation": [ - "Primary", - "Secondary" + "choices": [ + { + "label": "Primary", + "value": "Primary" + }, + { + "label": "Secondary", + "value": "Secondary" + } ], "name": "JoystickIdentifier" }, @@ -19846,6 +19709,7 @@ "extraInformation": [ "Thumb" ], + "choices": [], "hidden": true, "name": "ThumbAnchorOrigin" }, @@ -19865,6 +19729,7 @@ "extraInformation": [ "Thumb" ], + "choices": [], "hidden": true, "name": "ThumbIsScaledProportionally" }, @@ -21312,6 +21177,7 @@ "extraInformation": [ "Scene3D::Base3DBehavior" ], + "choices": [], "name": "Object3D" }, { @@ -22985,6 +22851,7 @@ "extraInformation": [ "Physics3D::PhysicsCharacter3D" ], + "choices": [], "name": "PhysicsCharacter3D" }, { @@ -23446,6 +23313,7 @@ "extraInformation": [ "Physics3D::PhysicsCharacter3D" ], + "choices": [], "name": "PhysicsCharacter3D" }, { @@ -23455,6 +23323,7 @@ "extraInformation": [ "AnimatableCapability::AnimatableBehavior" ], + "choices": [], "name": "Animation" }, { @@ -25222,6 +25091,7 @@ "extraInformation": [ "Scene3D::Base3DBehavior" ], + "choices": [], "name": "Object3D" }, { @@ -25231,6 +25101,7 @@ "extraInformation": [ "Physics3D::Physics3DBehavior" ], + "choices": [], "name": "Physics3D" }, { @@ -25253,10 +25124,19 @@ "value": "Z", "type": "Choice", "label": "", - "extraInformation": [ - "Z", - "Y", - "X" + "choices": [ + { + "label": "Z", + "value": "Z" + }, + { + "label": "Y", + "value": "Y" + }, + { + "label": "X", + "value": "X" + } ], "name": "Plane" }, @@ -26421,6 +26301,7 @@ "extraInformation": [ "Grass3" ], + "choices": [], "hidden": true, "name": "ShowGrass3" } @@ -29177,6 +29058,7 @@ "extraInformation": [ "Scene3D::Base3DBehavior" ], + "choices": [], "name": "Object3D" }, { @@ -33938,6 +33820,7 @@ "extraInformation": [ "Scene3D::Base3DBehavior" ], + "choices": [], "name": "Object3D" }, { @@ -33947,6 +33830,7 @@ "extraInformation": [ "ScalableCapability::ScalableBehavior" ], + "choices": [], "name": "Scale" }, { @@ -33956,6 +33840,7 @@ "extraInformation": [ "Tween::TweenBehavior" ], + "choices": [], "name": "Tween" } ], @@ -35295,9 +35180,15 @@ "value": "Z+", "type": "Choice", "label": "Top orientation", - "extraInformation": [ - "Z+", - "Y-" + "choices": [ + { + "label": "Z+", + "value": "Z+" + }, + { + "label": "Y-", + "value": "Y-" + } ], "name": "Top" }, @@ -35308,6 +35199,7 @@ "extraInformation": [ "Tween3D::Tween3D" ], + "choices": [], "name": "Tween3D" } ], @@ -37675,6 +37567,7 @@ "extraInformation": [ "Scene3D::Base3DBehavior" ], + "choices": [], "name": "Object3D" }, { @@ -37864,7 +37757,7 @@ "name": "Sticker", "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/sticker-outline.svg", "shortDescription": "Make objects follow the position and rotation of the object they are stuck to.", - "version": "0.5.3", + "version": "0.5.4", "description": [ "This extension can be useful to:", "- Stick accessories to moving objects", @@ -37920,8 +37813,10 @@ " 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()) {", @@ -38264,7 +38159,9 @@ " allStickers: new Set(),", "};", "// Register this object as a sticker.", - "runtimeScene._stickerExtension.allStickers.add(behavior);", + "/** @type {Set} */", + "const allStickers = runtimeScene._stickerExtension.allStickers;", + "allStickers.add(behavior);", "" ], "parameterObjects": "Object", @@ -38452,7 +38349,9 @@ "const object = objects[0];", "const behavior = object.getBehavior(behaviorName);", "", - "runtimeScene._stickerExtension.allStickers.delete(behavior._sticker);", + "/** @type {Set} */", + "const allStickers = runtimeScene._stickerExtension.allStickers;", + "allStickers.delete(behavior);", "" ], "parameterObjects": "Object", @@ -38506,7 +38405,7 @@ "name": "ParticleEmitter3D", "previewIconUrl": "https://asset-resources.gdevelop.io/public-resources/Icons/f2e5a34bf465f781866677762d385d6c8e9e8d203383f2df9a3b7e0fad6a2cb5_fire.svg", "shortDescription": "Display a large number of particles in 3D to create visual effects in a 3D game.", - "version": "2.2.0", + "version": "3.0.1", "description": [ "3D particle emitters let you create and display many small particles to simulate visual effects in your game — like fire, explosions, smoke, or dust.", "", @@ -38531,6 +38430,10 @@ "IWykYNRvhCZBN3vEgKEbBPOR3Oc2" ], "changelog": [ + { + "version": "3.0.0", + "breaking": "- the object rotates the other way around X axis." + }, { "version": "2.0.0", "breaking": "- Object properties for position and rotation have been removed. They must be set with the instance editor or the action." @@ -38574,9 +38477,7 @@ " const threeObject3D = this.get3DRendererObject();", "", " threeObject3D.rotation.set(", - " // TODO The rotation on X goes the wrong way.", - " // Increment the major and remove this sign.", - " - gdjs.toRad(this._object.getRotationX()),", + " gdjs.toRad(this._object.getRotationX()),", " gdjs.toRad(this._object.getRotationY()),", " gdjs.toRad(this._object.angle)", " );", @@ -45490,6 +45391,19 @@ "", "/** @type {gdjs.CustomRuntimeObject} */", "const object = objects[0];", + "// Force the size of the object because it doesn't contain any instance.", + "object._innerArea = {", + " min: [-16, -16, -16],", + " max: [16, 16, 16],", + " };", + "const hitbox = new gdjs.Polygon();", + "hitbox.vertices = [[-16, -16], [16, -16], [16, 16], [-16, 16]];", + "object._untransformedHitBoxes = [hitbox];", + "object._unrotatedAABB.min[0] = -16;", + "object._unrotatedAABB.min[1] = -16;", + "object._unrotatedAABB.max[0] = 16;", + "object._unrotatedAABB.max[1] = 16;", + "object._updateUntransformedHitBoxes = () => {};", "", "// Here runtimeScene is the gdjs.CustomRuntimeObjectInstanceContainer inside the custom object.", "const gameScene = object.getRuntimeScene();", @@ -48400,12 +48314,27 @@ "type": "Choice", "label": "Blending", "group": "Color", - "extraInformation": [ - "Normal", - "Additive", - "Subtractive", - "Multiply", - "None" + "choices": [ + { + "label": "Normal", + "value": "Normal" + }, + { + "label": "Additive", + "value": "Additive" + }, + { + "label": "Subtractive", + "value": "Subtractive" + }, + { + "label": "Multiply", + "value": "Multiply" + }, + { + "label": "None", + "value": "None" + } ], "name": "Blending" }, @@ -48414,9 +48343,15 @@ "type": "Choice", "label": "Gravity top", "group": "Speed", - "extraInformation": [ - "Y-", - "Z+" + "choices": [ + { + "label": "Y-", + "value": "Y-" + }, + { + "label": "Z+", + "value": "Z+" + } ], "name": "GravityTop" }, @@ -51154,6 +51089,7 @@ "extraInformation": [ "TopCenter" ], + "choices": [], "hidden": true, "name": "ShowTopCenter" }, @@ -51165,6 +51101,7 @@ "extraInformation": [ "TopSide" ], + "choices": [], "hidden": true, "name": "ShowTopSide" }, @@ -51176,6 +51113,7 @@ "extraInformation": [ "TopCorner" ], + "choices": [], "hidden": true, "name": "ShowTopCorner" }, @@ -51187,6 +51125,7 @@ "extraInformation": [ "CenterSide" ], + "choices": [], "hidden": true, "name": "ShowCenterSide" }, @@ -51198,6 +51137,7 @@ "extraInformation": [ "CenterCorner" ], + "choices": [], "hidden": true, "name": "ShowCenterCorner" }, @@ -51209,6 +51149,7 @@ "extraInformation": [ "BottomSide" ], + "choices": [], "hidden": true, "name": "ShowBottomSide" }, @@ -51220,6 +51161,7 @@ "extraInformation": [ "BottomCorner" ], + "choices": [], "hidden": true, "name": "ShowBottomCorner" }, @@ -51231,6 +51173,7 @@ "extraInformation": [ "BottomCenter" ], + "choices": [], "hidden": true, "name": "ShowBottomCenter" }, @@ -53121,6 +53064,7 @@ "extraInformation": [ "TopCenter" ], + "choices": [], "hidden": true, "name": "ShowTopCenter" }, @@ -53132,6 +53076,7 @@ "extraInformation": [ "Side" ], + "choices": [], "hidden": true, "name": "ShowSide" }, @@ -53143,6 +53088,7 @@ "extraInformation": [ "Corner" ], + "choices": [], "hidden": true, "name": "ShowCorner" }, @@ -53154,6 +53100,7 @@ "extraInformation": [ "BottomCenter" ], + "choices": [], "hidden": true, "name": "ShowBottomCenter" }, @@ -53369,6 +53316,7 @@ "extraInformation": [ "Scene3D::Base3DBehavior" ], + "choices": [], "name": "Object3D" }, { @@ -53378,6 +53326,7 @@ "extraInformation": [ "Physics3D::PhysicsCharacter3D" ], + "choices": [], "name": "PhysicsCharacter3D" }, { @@ -53421,7 +53370,7 @@ "name": "ScreenOrientationChecker", "previewIconUrl": "https://asset-resources.gdevelop.io/public-resources/Icons/0126888931a4a4f82bb2824df9f096347ace1c47f510c44df42aa8dc9e49e24a_screen-rotation.svg", "shortDescription": "Display a customizable screen asking the user to rotate their phone/tablet if not in the right orientation.", - "version": "0.1.1", + "version": "0.2.0", "description": "Display a customizable screen asking the user to rotate their phone/tablet if not in the right orientation.", "origin": { "identifier": "ScreenOrientationChecker", @@ -53444,6 +53393,28 @@ ], "sceneVariables": [], "eventsFunctions": [ + { + "description": "Check if the events are running for the editor.", + "fullName": "Editor is running", + "functionType": "Condition", + "name": "IsInGameEdition", + "private": true, + "sentence": "Events are running for the editor", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const game = runtimeScene.getGame();\r", + "eventsFunctionContext.returnValue = game.isInGameEdition && game.isInGameEdition();" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [], + "objectGroups": [] + }, { "fullName": "Get game target orientation", "functionType": "StringExpression", @@ -53562,6 +53533,7 @@ "textAlignment": "center", "verticalTextAlignment": "top", "characterSize": 30, + "lineHeight": 0, "color": "255;255;255" } }, @@ -53762,6 +53734,38 @@ } ], "eventsFunctions": [ + { + "fullName": "", + "functionType": "Action", + "name": "onCreated", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "PrimitiveDrawing::ClearBetweenFrames" + }, + "parameters": [ + "BackgroundPainter", + "" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "ScreenOrientationChecker::ScreenOrientationChecker", + "type": "object" + } + ], + "objectGroups": [] + }, { "fullName": "", "functionType": "Action", @@ -53769,41 +53773,66 @@ "sentence": "", "events": [ { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 - }, - "comment": "Check if the screen must be shown" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "ScreenOrientationChecker::IsInGameEdition" + }, + "parameters": [ + "", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "ScreenOrientationChecker::ScreenOrientationChecker::DrawBackground" + }, + "parameters": [ + "Object", + "" + ] + } + ] }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "value": "SystemInfo::IsMobile" + "inverted": true, + "value": "ScreenOrientationChecker::IsInGameEdition" }, - "parameters": [] + "parameters": [ + "", + "" + ] } ], "actions": [], "events": [ + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Check if the screen must be shown" + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "value": "BuiltinCommonInstructions::CompareNumbers" + "value": "SystemInfo::IsMobile" }, - "parameters": [ - "SceneWindowWidth()", - ">", - "SceneWindowHeight()" - ] + "parameters": [] } ], "actions": [], @@ -53813,24 +53842,69 @@ "conditions": [ { "type": { - "value": "StringVariable" + "value": "BuiltinCommonInstructions::CompareNumbers" }, "parameters": [ - "TargetOrientation", - "=", - "\"portrait\"" + "SceneWindowWidth()", + ">", + "SceneWindowHeight()" ] } ], - "actions": [ + "actions": [], + "events": [ { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsShown", - "False", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "TargetOrientation", + "=", + "\"portrait\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsShown", + "False", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "TargetOrientation", + "!=", + "\"portrait\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsShown", + "False", + "" + ] + } ] } ] @@ -53840,127 +53914,146 @@ "conditions": [ { "type": { - "value": "StringVariable" + "value": "BuiltinCommonInstructions::CompareNumbers" }, "parameters": [ - "TargetOrientation", - "!=", - "\"portrait\"" + "SceneWindowWidth()", + "<=", + "SceneWindowHeight()" ] } ], - "actions": [ + "actions": [], + "events": [ { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsShown", - "False", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "TargetOrientation", + "=", + "\"landscape\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsShown", + "False", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "TargetOrientation", + "=", + "\"portrait\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsShown", + "False", + "" + ] + } ] } ] } ] }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Show/hide the screen as needed" + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "value": "BuiltinCommonInstructions::CompareNumbers" + "value": "BuiltinCommonInstructions::Or" }, - "parameters": [ - "SceneWindowWidth()", - "<=", - "SceneWindowHeight()" - ] - } - ], - "actions": [], - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "parameters": [], + "subInstructions": [ { "type": { - "value": "StringVariable" + "value": "BooleanVariable" }, "parameters": [ - "TargetOrientation", - "=", - "\"landscape\"" + "IsShown", + "True", + "" ] - } - ], - "actions": [ + }, { "type": { - "value": "SetBooleanVariable" + "value": "BooleanVariable" }, "parameters": [ - "IsShown", - "False", + "IsForceShown", + "True", "" ] } ] + } + ], + "actions": [ + { + "type": { + "value": "ScreenOrientationChecker::ScreenOrientationChecker::DrawBackground" + }, + "parameters": [ + "Object", + "" + ] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "TargetOrientation", - "=", - "\"portrait\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsShown", - "False", - "" - ] - } + "type": { + "value": "Montre" + }, + "parameters": [ + "Object", + "" ] } ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 - }, - "comment": "Show/hide the screen as needed" - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + }, { - "type": { - "value": "BuiltinCommonInstructions::Or" - }, - "parameters": [], - "subInstructions": [ + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { "type": { + "inverted": true, "value": "BooleanVariable" }, "parameters": [ @@ -53971,6 +54064,7 @@ }, { "type": { + "inverted": true, "value": "BooleanVariable" }, "parameters": [ @@ -53979,229 +54073,207 @@ "" ] } - ] - } - ], - "actions": [ - { - "type": { - "value": "PrimitiveDrawing::FillColor" - }, - "parameters": [ - "BackgroundPainter", - "BackgroundColor" + ], + "actions": [ + { + "type": { + "value": "Cache" + }, + "parameters": [ + "Object" + ] + } ] }, { - "type": { - "value": "PrimitiveDrawing::RoundedRectangle" - }, - "parameters": [ - "BackgroundPainter", - "Padding", - "Padding", - "Object.Width()-Padding", - "Object.Height()-Padding", - "CornerRadius" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "MettreY" + }, + "parameters": [ + "Icon", + "=", + "Text.Y() - 100" + ] + } ] }, { - "type": { - "value": "Montre" - }, - "parameters": [ - "Object", - "" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "inverted": true, - "value": "BooleanVariable" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 }, - "parameters": [ - "IsShown", - "True", - "" - ] + "comment": "Animate the icon" }, { - "type": { - "inverted": true, - "value": "BooleanVariable" - }, - "parameters": [ - "IsForceShown", - "True", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "Cache" - }, - "parameters": [ - "Object" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "MettreY" - }, - "parameters": [ - "Icon", - "=", - "Text.Y() - 100" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 - }, - "comment": "Animate the icon" - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "inverted": true, - "value": "Tween::Exists" - }, - "parameters": [ - "Icon", - "Tween", - "\"Rotate\"" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "Tween::Exists" + }, + "parameters": [ + "Icon", + "Tween", + "\"Rotate\"" + ] + }, + { + "type": { + "inverted": true, + "value": "Tween::Exists" + }, + "parameters": [ + "Icon", + "Tween", + "\"RotateBack\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "Tween::TweenBehavior::AddObjectAngleTween2" + }, + "parameters": [ + "Icon", + "Tween", + "\"Rotate\"", + "8", + "\"easeInOutQuad\"", + "2", + "" + ] + } ] }, { - "type": { - "inverted": true, - "value": "Tween::Exists" - }, - "parameters": [ - "Icon", - "Tween", - "\"RotateBack\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "Tween::TweenBehavior::AddObjectAngleTween2" - }, - "parameters": [ - "Icon", - "Tween", - "\"Rotate\"", - "8", - "\"easeInOutQuad\"", - "2", - "" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "Tween::HasFinished" - }, - "parameters": [ - "Icon", - "Tween", - "\"RotateBack\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "Tween::TweenBehavior::AddObjectAngleTween2" - }, - "parameters": [ - "Icon", - "Tween", - "\"Rotate\"", - "8", - "\"easeInOutQuad\"", - "2", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Tween::HasFinished" + }, + "parameters": [ + "Icon", + "Tween", + "\"RotateBack\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "Tween::TweenBehavior::AddObjectAngleTween2" + }, + "parameters": [ + "Icon", + "Tween", + "\"Rotate\"", + "8", + "\"easeInOutQuad\"", + "2", + "" + ] + }, + { + "type": { + "value": "Tween::RemoveTween" + }, + "parameters": [ + "Icon", + "Tween", + "\"RotateBack\"" + ] + } ] }, { - "type": { - "value": "Tween::RemoveTween" - }, - "parameters": [ - "Icon", - "Tween", - "\"RotateBack\"" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Tween::HasFinished" + }, + "parameters": [ + "Icon", + "Tween", + "\"Rotate\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "Tween::TweenBehavior::AddObjectAngleTween2" + }, + "parameters": [ + "Icon", + "Tween", + "\"RotateBack\"", + "-8", + "\"easeInOutQuad\"", + "2", + "" + ] + }, + { + "type": { + "value": "Tween::RemoveTween" + }, + "parameters": [ + "Icon", + "Tween", + "\"Rotate\"" + ] + } ] } ] - }, + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "ScreenOrientationChecker::ScreenOrientationChecker", + "type": "object" + } + ], + "objectGroups": [] + }, + { + "description": "Draw the background.", + "fullName": "Draw the background", + "functionType": "Action", + "name": "DrawBackground", + "private": true, + "sentence": "Draw the background of _PARAM0_", + "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "Tween::HasFinished" - }, - "parameters": [ - "Icon", - "Tween", - "\"Rotate\"" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "Tween::TweenBehavior::AddObjectAngleTween2" - }, - "parameters": [ - "Icon", - "Tween", - "\"RotateBack\"", - "-8", - "\"easeInOutQuad\"", - "2", - "" - ] - }, - { - "type": { - "value": "Tween::RemoveTween" + "value": "PrimitiveDrawing::RoundedRectangle" }, "parameters": [ - "Icon", - "Tween", - "\"Rotate\"" + "BackgroundPainter", + "Padding", + "Padding", + "Object.Width()-Padding", + "Object.Height()-Padding", + "CornerRadius" ] } ] @@ -54221,7 +54293,6 @@ "description": "Check if the screen should be forced to be shown. Use this to test the screen in your game.", "fullName": "Force show the screen", "functionType": "Condition", - "group": "Screen Orientation Checker configuration", "name": "IsForceShown", "sentence": "_PARAM0_ is forced to be shown", "events": [ @@ -54265,7 +54336,6 @@ "description": "Change if the screen should be forced to be shown. Use this to test the screen in your game.", "fullName": "Force show the screen", "functionType": "Action", - "group": "Screen Orientation Checker configuration", "name": "SetIsForceShown", "sentence": "Force _PARAM0_ to be shown: _PARAM1_", "events": [ @@ -54341,6 +54411,76 @@ } ], "objectGroups": [] + }, + { + "description": "the message of the object.", + "fullName": "Message", + "functionType": "ExpressionAndCondition", + "name": "Message", + "sentence": "the message", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnString" + }, + "parameters": [ + "Text.Text::Value()" + ] + } + ] + } + ], + "expressionType": { + "type": "string" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "ScreenOrientationChecker::ScreenOrientationChecker", + "type": "object" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "Message", + "name": "SetMessage", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "TextContainerCapability::TextContainerBehavior::SetValue" + }, + "parameters": [ + "Text", + "Text", + "=", + "Value" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "ScreenOrientationChecker::ScreenOrientationChecker", + "type": "object" + } + ], + "objectGroups": [] } ], "propertyDescriptors": [ @@ -54374,16 +54514,276 @@ "description": "Corner radius for the background", "group": "Appearance", "name": "CornerRadius" - }, - { - "value": "0;0;0", - "type": "Color", - "label": "Background color", - "group": "Appearance", - "name": "BackgroundColor" } ], - "variants": [] + "variants": [ + { + "areaMaxX": 400, + "areaMaxY": 200, + "areaMaxZ": 0, + "areaMinX": 0, + "areaMinY": 0, + "areaMinZ": 0, + "assetStoreAssetId": "2743bcd6cf431c6c00cda3a59684eb152b3a09d598b799b15383e4f77daf8b37", + "assetStoreOriginalName": "Black screen orientation checker", + "name": "Black screen orientation checker", + "objects": [ + { + "assetStoreId": "", + "bold": true, + "italic": false, + "name": "Text", + "smoothed": true, + "type": "TextObject::Text", + "underlined": false, + "variables": [], + "effects": [], + "behaviors": [ + { + "name": "Anchor", + "type": "AnchorBehavior::AnchorBehavior", + "bottomEdgeAnchor": 0, + "leftEdgeAnchor": 4, + "relativeToOriginalWindowSize": true, + "rightEdgeAnchor": 0, + "topEdgeAnchor": 4, + "useLegacyBottomAndRightAnchors": false + }, + { + "name": "Tween", + "type": "Tween::TweenBehavior" + } + ], + "string": "Rotate screen to play", + "font": "", + "textAlignment": "center", + "characterSize": 30, + "color": { + "b": 255, + "g": 255, + "r": 255 + }, + "content": { + "bold": true, + "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": "Rotate screen to play", + "font": "", + "textAlignment": "center", + "verticalTextAlignment": "top", + "characterSize": 30, + "lineHeight": 0, + "color": "255;255;255" + } + }, + { + "assetStoreId": "", + "name": "BackgroundPainter", + "type": "PrimitiveDrawing::Drawer", + "variables": [], + "effects": [], + "behaviors": [], + "fillOpacity": 255, + "outlineSize": 0, + "outlineOpacity": 255, + "absoluteCoordinates": true, + "clearBetweenFrames": true, + "antialiasing": "none", + "fillColor": { + "r": 0, + "g": 0, + "b": 0 + }, + "outlineColor": { + "r": 0, + "g": 0, + "b": 0 + } + }, + { + "adaptCollisionMaskAutomatically": true, + "assetStoreId": "", + "name": "Icon", + "type": "Sprite", + "updateIfNotVisible": false, + "variables": [], + "effects": [], + "behaviors": [ + { + "name": "Anchor", + "type": "AnchorBehavior::AnchorBehavior", + "bottomEdgeAnchor": 0, + "leftEdgeAnchor": 4, + "topEdgeAnchor": 4, + "relativeToOriginalWindowSize": true, + "rightEdgeAnchor": 0, + "useLegacyBottomAndRightAnchors": false + }, + { + "name": "Tween", + "type": "Tween::TweenBehavior" + } + ], + "animations": [ + { + "name": "", + "useMultipleDirections": false, + "directions": [ + { + "looping": false, + "timeBetweenFrames": 0.08, + "sprites": [ + { + "hasCustomCollisionMask": true, + "image": "rotate-screen-icon.png", + "points": [], + "originPoint": { + "name": "origine", + "x": 52.5, + "y": 56.5 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [ + [ + { + "x": 0, + "y": 1 + }, + { + "x": 105, + "y": 1 + }, + { + "x": 105, + "y": 113 + }, + { + "x": 0, + "y": 113 + } + ] + ] + } + ] + } + ] + } + ] + } + ], + "objectsFolderStructure": { + "folderName": "__ROOT", + "children": [ + { + "objectName": "Text" + }, + { + "objectName": "BackgroundPainter" + }, + { + "objectName": "Icon" + } + ] + }, + "objectsGroups": [], + "layers": [ + { + "ambientLightColorB": 200, + "ambientLightColorG": 200, + "ambientLightColorR": 200, + "camera3DFarPlaneDistance": 10000, + "camera3DFieldOfView": 45, + "camera3DNearPlaneDistance": 3, + "cameraType": "", + "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": [] + } + ], + "instances": [ + { + "angle": 0, + "customSize": true, + "depth": 1, + "height": 35, + "keepRatio": true, + "layer": "", + "name": "Text", + "persistentUuid": "65c003ea-19c0-4f18-a189-a02a24378f35", + "width": 207, + "x": 104, + "y": 120, + "zOrder": 15, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "keepRatio": true, + "layer": "", + "name": "BackgroundPainter", + "persistentUuid": "49ff4576-6406-41de-a43b-1355529d61fe", + "width": 0, + "x": 38, + "y": 17, + "zOrder": 14, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "keepRatio": true, + "layer": "", + "name": "Icon", + "persistentUuid": "39cbfc66-13f4-43dc-b6ef-2bda83153277", + "width": 0, + "x": 204, + "y": 64, + "zOrder": 16, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + } + ] + } + ] } ] } diff --git a/examples/3d-platformer/assets/Shadow.png b/examples/3d-platformer/assets/Shadow.png deleted file mode 100644 index b9a09a08ebfb7df65b3484dc7b04c5e092d9ce10..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 990 zcmV<410np0P)A0099300000000000000000000000000G>yFMgRZ+3v^OWQ-1+>3l=gXVnl9K zV6jSQ00009a7bBm000XU000XU0RWnu7ytkROi4sRRCwCOTHA8#APihX>^S}Z4?Zzh zAqg89&j~Yq=uEY&7GXeJEZXp4yvm5btA7e5dLhvp#aR3ZK$(0aqYr`J^hem5MuJe& zfI=XKhtPfB3r2+C93bZp@iDlJ0Fe+*8HD&S{So$;MuZ3?1P93Z)AUE=JB)~tNN^5N z<`2{7=!}s_2n6WyarRFdkp)5U8o-f2jZfk3I|@Wa&>2JmIX*?l5g-x*6B4ul69ExV z5x5K_g_=N($9E6}B?+_y+V~J2ej0>^0vLfTK#q?ia%hssDu9#_5ugcA5D6h9Q7J&I zfSkWU;7On=kO`>qISWAn9RiR;rvROR8n047E#geT=>Sm%N}*wJNuWmoWET|z=!{CC zmLsTyrv%DUMhaO*Z~~uxJY9&A12h7|6ga^9JOe_Z=791cyOc0*%Qgp$OQ`1nQUq5L zsyV=t0WSptFqnao1Na&MrW_6cO9nCr*fJ(4d#0R#Me72Go^%$4%PyK(x1Vm;Yr0oYf0?p)Yr&xLzO8`#nI z`_tJ9;N%5k?us*g$+EAb&3>NB~Q{(%k`uFH~|E>9c;@)@Nf8V2c3dj`=r5mQUCw| M07*qoM6N<$g1Tdx0{{R3 diff --git a/examples/3d-platformer/assets/rotate-screen-icon.png b/examples/3d-platformer/assets/rotate-screen-icon.png index ba619fae3995e5576c1e1de0a994b5b3da7c39dc..a7726dee34eba34b401b26b73b5bf128ff7c26d7 100644 GIT binary patch delta 1155 zcmV-}1bqAP28{`j8Gi-<007npjm!W5010qNS#tmY3ljhU3ljkVnw%H_00citL_t(| z+U?!pwW2T(1>jc#B~St-Sb`f&sWc6&`9(FdUz!2ufn{)iP zFJiu(WD*ki`Z89$_tpJVezDjscc9w;Dee8UV~f~C+WUWt3x9BoE<;GAA1{n9Lr|{@ zqssu2^Y0f%*G5QJKfU}!SHTucgVg$YrDGSkF3j%!Io&_~OrSGcalK6LxB$k7zpdGt z>qJfWqT$~ihuFO(#CgD+!@nus0J<6ZiS%%a zkf}|^8PsuMdVjrc^u)TVX37}y=+c;8r;DCh5fD}nm|iOaRgvga*5YUmcf7|0vi#q!c*I(ogbVKXj!WbtPaQpC|t;`*$0UbAGITFauxcL)7eRfch zWg0}F+i+Pabb;3_pdyo0RG?zy-(H}hB0n}OAb6=+_+O}R$dcG1qkMjHi6KeFYy6Dy|o2u0uhKn1R@ZD2t*(P z5r{wpA`pR~fxZc3{|6Ds_>YpO0tuvZ9gW&Tt$+AYI|8Y;sne)z_~hZ9Kx)_Xw`h+? zJ%J1&g$m7X_6G$j)%Wj-%@-Yk7GIbCUdYHJ1zG|vy0+mdmtUF{Hz-in=Rx9>OQT)6 zc_@U5>MDEpP@q77iX^98EJC3y^@z=?x3#~_3>4B@oOqJuA;lMN4h06Z-Zo{cP-v^! zqJOLFQh#}JD8$`_k2-!rH1NXcxkeJ4Gh0@-dvY`XKK3?f$MHuG zs2Zfl{nW^dyusRsEy4v`R|hB-0p*)GT?B{GqujlnMkdMC44gj9;TS!Nv;W(ZrF^D3 z0(u;InLTk5rN`0nB&=|BPu2{HlVJA$Y|+*eXZzXz)Y7eTMu_FV^m-1=fl-q_y?(cF z2`6C`U1lOxY{B#?cRjJ&lb3|baOvu2spC}}%ON=ea-z)Z?* zMqugDC_atNmBAsU1(z{AT5-3YssWQGU52g&%X!B2s%Mq_v$$(=XiTc za}skxbf@G~0#nJw!Z{>~f8@5gv!W~3SS=M$839QocMjN)O*LdV9? zCxOu7>e+n%6@fxID5@S*;$Z0FH}9klXisOV_8tv}_R~*oyQATd>iB@{h2UF@UMScf z^n-rT|AlB4WM)D6e-tnrGSO7O2kh{OROJk_T_cC_UAK)$ZJ5INF{(-24+01>)f1p+ z95vCbs~;*Ya@)d8?~6laGW${nb&ANwFb!{XN5?_)8Eql8iwCYn^VL zlW!>ix;j1cC}j1fn;F`qpl#yz4yQpu5aSx+l7b+^xt6-1f3O{PW!7>1_eTdJOURK2$=wV@}4LZLO*%q^QFz=P%!X=ku;#hqe3bKyY{tK