diff --git a/examples/crazygames-sdk-demo/crazygames-sdk-demo.json b/examples/crazygames-sdk-demo/crazygames-sdk-demo.json index 9fd8303ef..9959ecc79 100644 --- a/examples/crazygames-sdk-demo/crazygames-sdk-demo.json +++ b/examples/crazygames-sdk-demo/crazygames-sdk-demo.json @@ -6223,6 +6223,88 @@ "TopPadding": 16, "HoveredFadeOutDuration": 0.25, "LabelText": "Generate Ingame purchase token" + }, + "childrenContent": { + "BitmapLabel": { + "content": { + "text": "Text", + "opacity": 255, + "scale": 1, + "fontSize": 20, + "tint": "255;255;255", + "bitmapFontResourceName": "", + "textureAtlasResourceName": "", + "align": "center", + "verticalTextAlignment": "center" + } + }, + "Hovered": { + "bottomMargin": 32, + "height": 106, + "leftMargin": 16, + "rightMargin": 16, + "texture": "Grey Button_Hovered.png", + "tiled": true, + "topMargin": 16, + "width": 256 + }, + "Idle": { + "bottomMargin": 32, + "height": 106, + "leftMargin": 16, + "rightMargin": 16, + "texture": "Grey Button_Idle.png", + "tiled": true, + "topMargin": 16, + "width": 256 + }, + "Label": { + "bold": false, + "italic": false, + "smoothed": true, + "underlined": false, + "string": "Generate Ingame purchase token", + "font": "", + "textAlignment": "center", + "characterSize": 30, + "color": { + "b": 79, + "g": 72, + "r": 72 + }, + "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": "Generate Ingame purchase token", + "font": "", + "textAlignment": "center", + "verticalTextAlignment": "top", + "characterSize": 30, + "lineHeight": 0, + "color": "72;72;79" + } + }, + "Pressed": { + "bottomMargin": 16, + "height": 106, + "leftMargin": 16, + "rightMargin": 16, + "texture": "Grey Button_Pressed.png", + "tiled": true, + "topMargin": 32, + "width": 256 + } } }, { diff --git a/examples/multiplayer-platformer-pickup/multiplayer-platformer-pickup.json b/examples/multiplayer-platformer-pickup/multiplayer-platformer-pickup.json index 07f2869b1..d267b41ab 100644 --- a/examples/multiplayer-platformer-pickup/multiplayer-platformer-pickup.json +++ b/examples/multiplayer-platformer-pickup/multiplayer-platformer-pickup.json @@ -8735,19 +8735,19 @@ "category": "Input", "extensionNamespace": "", "fullName": "Multitouch joystick and buttons (sprite)", - "gdevelopVersion": ">=5.5.222", + "gdevelopVersion": "", "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", + "version": "1.6.1", "description": [ - "Multitouch joysticks are objects showing a joystick on the screen, useful for mobile. They work like a physical gamepad:", + "Multitouch joysticks can be used the same way as physical gamepads:", "- 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.", + "- 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)." ], @@ -8811,28 +8811,6 @@ } ], "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", @@ -8861,10 +8839,10 @@ "conditions": [ { "type": { - "value": "NumberVariable" + "value": "CompareArgumentAsNumber" }, "parameters": [ - "TargetedSpeed", + "\"TargetedSpeed\"", "<", "0" ] @@ -8889,10 +8867,10 @@ "conditions": [ { "type": { - "value": "NumberVariable" + "value": "CompareArgumentAsNumber" }, "parameters": [ - "CurrentSpeed", + "\"CurrentSpeed\"", "<", "TargetedSpeed" ] @@ -8916,20 +8894,20 @@ "conditions": [ { "type": { - "value": "NumberVariable" + "value": "CompareArgumentAsNumber" }, "parameters": [ - "CurrentSpeed", + "\"CurrentSpeed\"", ">", "TargetedSpeed" ] }, { "type": { - "value": "NumberVariable" + "value": "CompareArgumentAsNumber" }, "parameters": [ - "CurrentSpeed", + "\"CurrentSpeed\"", "<", "0" ] @@ -8965,10 +8943,10 @@ "conditions": [ { "type": { - "value": "NumberVariable" + "value": "CompareArgumentAsNumber" }, "parameters": [ - "CurrentSpeed", + "\"CurrentSpeed\"", ">=", "0" ] @@ -8994,10 +8972,10 @@ "conditions": [ { "type": { - "value": "NumberVariable" + "value": "CompareArgumentAsNumber" }, "parameters": [ - "TargetedSpeed", + "\"TargetedSpeed\"", ">", "0" ] @@ -9022,10 +9000,10 @@ "conditions": [ { "type": { - "value": "NumberVariable" + "value": "CompareArgumentAsNumber" }, "parameters": [ - "CurrentSpeed", + "\"CurrentSpeed\"", ">", "TargetedSpeed" ] @@ -9049,20 +9027,20 @@ "conditions": [ { "type": { - "value": "NumberVariable" + "value": "CompareArgumentAsNumber" }, "parameters": [ - "CurrentSpeed", + "\"CurrentSpeed\"", "<", "TargetedSpeed" ] }, { "type": { - "value": "NumberVariable" + "value": "CompareArgumentAsNumber" }, "parameters": [ - "CurrentSpeed", + "\"CurrentSpeed\"", ">", "0" ] @@ -9098,10 +9076,10 @@ "conditions": [ { "type": { - "value": "NumberVariable" + "value": "CompareArgumentAsNumber" }, "parameters": [ - "CurrentSpeed", + "\"CurrentSpeed\"", "<=", "0" ] @@ -9127,10 +9105,10 @@ "conditions": [ { "type": { - "value": "NumberVariable" + "value": "CompareArgumentAsNumber" }, "parameters": [ - "TargetedSpeed", + "\"TargetedSpeed\"", "=", "0" ] @@ -9143,10 +9121,10 @@ "conditions": [ { "type": { - "value": "NumberVariable" + "value": "CompareArgumentAsNumber" }, "parameters": [ - "CurrentSpeed", + "\"CurrentSpeed\"", "<", "0" ] @@ -9170,10 +9148,10 @@ "conditions": [ { "type": { - "value": "NumberVariable" + "value": "CompareArgumentAsNumber" }, "parameters": [ - "CurrentSpeed", + "\"CurrentSpeed\"", ">", "0" ] @@ -9251,11 +9229,11 @@ "objectGroups": [] }, { - "description": "Check if a button was just pressed on a multitouch controller.", - "fullName": "Multitouch controller button just pressed", + "description": "Check if a button is pressed on a gamepad.", + "fullName": "Multitouch controller button pressed", "functionType": "Condition", - "name": "IsButtonJustPressed", - "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ was just pressed", + "name": "IsButtonPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -9267,73 +9245,7 @@ "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 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\"" - ] - } + "\"Pressed\"" ] } ], @@ -9365,7 +9277,7 @@ "objectGroups": [] }, { - "description": "Check if a button is released on a multitouch controller.", + "description": "Check if a button is released on a gamepad.", "fullName": "Multitouch controller button released", "functionType": "Condition", "name": "IsButtonReleased", @@ -9451,7 +9363,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"JustPressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -10626,10 +10538,10 @@ "conditions": [ { "type": { - "value": "StringVariable" + "value": "CompareArgumentAsString" }, "parameters": [ - "Side", + "\"Side\"", "=", "\"Left\"" ] @@ -10664,10 +10576,10 @@ "conditions": [ { "type": { - "value": "StringVariable" + "value": "CompareArgumentAsString" }, "parameters": [ - "Side", + "\"Side\"", "=", "\"Right\"" ] @@ -10824,23 +10736,41 @@ "conditions": [ { "type": { - "inverted": true, - "value": "SpriteMultitouchJoystick::IsInGameEdition" + "value": "HasGameJustResumed" }, "parameters": [ - "", "" ] } ], - "actions": [], + "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": "HasGameJustResumed" + "value": "HasAnyTouchOrMouseStarted" }, "parameters": [ "" @@ -10850,207 +10780,176 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyTouchIndex" }, "parameters": [ "Object", "Behavior", - "" + "=", + "0" ] } - ] - }, - { - "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" - ] - } - ], + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "StartedTouchOrMouseCount()", + "conditions": [], + "actions": [], "events": [ { - "type": "BuiltinCommonInstructions::Repeat", - "repeatExpression": "StartedTouchOrMouseCount()", - "conditions": [], - "actions": [], - "events": [ + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { - "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": "SpriteMultitouchJoystick::MultitouchJoystick::PropertyTouchId" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "0" ] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchIndex", - "+", - "1" - ] - } + "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::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" - }, - "parameters": [ - "Object", - "Behavior", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyTouchIndex" + }, + "parameters": [ + "Object", + "Behavior", + "+", + "1" + ] + } ] } ] } - ], - "parameters": [] + ] }, { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Update joystick position", - "source": "", - "type": "BuiltinCommonInstructions::Group", - "events": [ + "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": "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)", - "" - ] - } + "type": { + "value": "HasTouchEnded" + }, + "parameters": [ + "", + "TouchId" ] } ], - "parameters": [] + "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": "SpriteMultitouchJoystick::MultitouchJoystick::PropertyTouchId" + }, + "parameters": [ + "Object", + "Behavior", + "!=", + "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": [ @@ -11122,10 +11021,11 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickForce" }, "parameters": [ - "JoystickForce", + "Object", + "Behavior", "=", "Value" ] @@ -11219,10 +11119,11 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickAngle" }, "parameters": [ - "JoystickAngle", + "Object", + "Behavior", "=", "Value" ] @@ -11488,10 +11389,11 @@ "conditions": [ { "type": { - "value": "NumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::PropertyTouchId" }, "parameters": [ - "TouchId", + "Object", + "Behavior", "!=", "0" ] @@ -11550,10 +11452,11 @@ }, { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyTouchId" }, "parameters": [ - "TouchId", + "Object", + "Behavior", "=", "0" ] @@ -11630,10 +11533,11 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyControllerIdentifier" }, "parameters": [ - "ControllerIdentifier", + "Object", + "Behavior", "=", "Value" ] @@ -11710,10 +11614,11 @@ "actions": [ { "type": { - "value": "SetStringVariable" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickIdentifier" }, "parameters": [ - "JoystickIdentifier", + "Object", + "Behavior", "=", "Value" ] @@ -11790,10 +11695,11 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyDeadZoneRadius" }, "parameters": [ - "DeadZoneRadius", + "Object", + "Behavior", "=", "Value" ] @@ -11841,10 +11747,11 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyTouchId" }, "parameters": [ - "TouchId", + "Object", + "Behavior", "=", "Value" ] @@ -11925,7 +11832,7 @@ "sharedPropertyDescriptors": [] }, { - "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.", + "description": "Detect button presses made on a touchscreen.", "fullName": "Multitouch button", "name": "MultitouchButton", "objectType": "", @@ -11941,49 +11848,11 @@ "conditions": [ { "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "IsReleased", - "True", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsReleased", - "False", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + "value": "SpriteMultitouchJoystick::MultitouchButton::IsReleased" }, "parameters": [ "Object", "Behavior", - "\"Idle\"", - "" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "True", "" ] } @@ -11991,12 +11860,12 @@ "actions": [ { "type": { - "value": "SetBooleanVariable" + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyIsReleased" }, "parameters": [ - "IsJustPressed", - "False", - "" + "Object", + "Behavior", + "no" ] }, { @@ -12006,7 +11875,7 @@ "parameters": [ "Object", "Behavior", - "\"Pressed\"", + "\"Idle\"", "" ] } @@ -12038,10 +11907,11 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchIndex" }, "parameters": [ - "TouchIndex", + "Object", + "Behavior", "=", "0" ] @@ -12075,10 +11945,11 @@ }, { "type": { - "value": "NumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchButton::PropertyRadius" }, "parameters": [ - "Radius", + "Object", + "Behavior", ">", "DistanceBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer()), TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer()))" ] @@ -12089,10 +11960,11 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchId" }, "parameters": [ - "TouchId", + "Object", + "Behavior", "=", "StartedTouchOrMouseId(TouchIndex)" ] @@ -12104,17 +11976,7 @@ "parameters": [ "Object", "Behavior", - "\"JustPressed\"", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "True", + "\"Pressed\"", "" ] } @@ -12126,10 +11988,11 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchIndex" }, "parameters": [ - "TouchIndex", + "Object", + "Behavior", "+", "1" ] @@ -12177,30 +12040,21 @@ }, { "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsReleased", - "True", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyIsReleased" }, "parameters": [ - "IsJustPressed", - "False", - "" + "Object", + "Behavior", + "yes" ] }, { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchId" }, "parameters": [ - "TouchId", + "Object", + "Behavior", "=", "0" ] @@ -12224,23 +12078,22 @@ "objectGroups": [] }, { - "description": "Check if the button was just pressed.", - "fullName": "Button just pressed", + "description": "Check if button is released.", + "fullName": "Button released", "functionType": "Condition", - "name": "IsJustPressed", - "sentence": "Button _PARAM0_ was just pressed", + "name": "IsReleased", + "sentence": "Button _PARAM0_ is released", "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "value": "BooleanVariable" + "value": "SpriteMultitouchJoystick::MultitouchButton::PropertyIsReleased" }, "parameters": [ - "IsJustPressed", - "True", - "" + "Object", + "Behavior" ] } ], @@ -12272,7 +12125,7 @@ "objectGroups": [] }, { - "description": "Check if the button is pressed.", + "description": "Check if button is pressed.", "fullName": "Button pressed", "functionType": "Condition", "name": "IsPressed", @@ -12283,10 +12136,11 @@ "conditions": [ { "type": { - "value": "NumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchButton::PropertyTouchId" }, "parameters": [ - "TouchId", + "Object", + "Behavior", "!=", "0" ] @@ -12319,54 +12173,6 @@ ], "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", @@ -12408,7 +12214,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"JustPressed\",\"Pressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -12449,13 +12255,6 @@ "hidden": true, "name": "IsReleased" }, - { - "value": "", - "type": "Boolean", - "label": "Button just pressed", - "hidden": true, - "name": "IsJustPressed" - }, { "value": "0", "type": "Number", @@ -12472,7 +12271,6 @@ "fullName": "Platformer multitouch controller mapper", "name": "PlatformerMultitouchMapper", "objectType": "", - "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -12653,7 +12451,6 @@ "extraInformation": [ "PlatformBehavior::PlatformerObjectBehavior" ], - "choices": [], "name": "Property" }, { @@ -12667,15 +12464,9 @@ "type": "Choice", "label": "Joystick name", "group": "Controls", - "choices": [ - { - "label": "Primary", - "value": "Primary" - }, - { - "label": "Secondary", - "value": "Secondary" - } + "extraInformation": [ + "Primary", + "Secondary" ], "name": "JoystickIdentifier" }, @@ -12694,7 +12485,6 @@ "fullName": "3D platformer multitouch controller mapper", "name": "Platformer3DMultitouchMapper", "objectType": "", - "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -12796,7 +12586,6 @@ "extraInformation": [ "Physics3D::PhysicsCharacter3D" ], - "choices": [], "name": "PhysicsCharacter3D" }, { @@ -12810,15 +12599,9 @@ "type": "Choice", "label": "Walk joystick", "group": "Controls", - "choices": [ - { - "label": "Primary", - "value": "Primary" - }, - { - "label": "Secondary", - "value": "Secondary" - } + "extraInformation": [ + "Primary", + "Secondary" ], "name": "JoystickIdentifier" }, @@ -12837,7 +12620,6 @@ "fullName": "3D shooter multitouch controller mapper", "name": "Shooter3DMultitouchMapper", "objectType": "", - "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -12928,7 +12710,6 @@ "extraInformation": [ "Physics3D::PhysicsCharacter3D" ], - "choices": [], "name": "PhysicsCharacter3D" }, { @@ -12942,15 +12723,9 @@ "type": "Choice", "label": "Walk joystick", "group": "Controls", - "choices": [ - { - "label": "Primary", - "value": "Primary" - }, - { - "label": "Secondary", - "value": "Secondary" - } + "extraInformation": [ + "Primary", + "Secondary" ], "name": "JoystickIdentifier" }, @@ -12969,7 +12744,6 @@ "fullName": "First person camera multitouch controller mapper", "name": "FirstPersonMultitouchMapper", "objectType": "", - "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -12995,10 +12769,11 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper::SetPropertyCurrentRotationSpeedZ" }, "parameters": [ - "CurrentRotationSpeedZ", + "Object", + "Behavior", "=", "SpriteMultitouchJoystick::AcceleratedSpeed(CurrentRotationSpeedZ, SpriteMultitouchJoystick::StickForceX(ControllerIdentifier, CameraStick) * HorizontalRotationSpeedMax, HorizontalRotationSpeedMax, HorizontalRotationAcceleration, HorizontalRotationDeceleration)" ] @@ -13015,10 +12790,11 @@ }, { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper::SetPropertyCurrentRotationSpeedY" }, "parameters": [ - "CurrentRotationSpeedY", + "Object", + "Behavior", "=", "SpriteMultitouchJoystick::AcceleratedSpeed(CurrentRotationSpeedY, SpriteMultitouchJoystick::StickForceY(ControllerIdentifier, CameraStick) * VerticalRotationSpeedMax, VerticalRotationSpeedMax, VerticalRotationAcceleration, VerticalRotationDeceleration)" ] @@ -13218,10 +12994,11 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper::SetPropertyHorizontalRotationSpeedMax" }, "parameters": [ - "HorizontalRotationSpeedMax", + "Object", + "Behavior", "=", "Value" ] @@ -13298,10 +13075,11 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper::SetPropertyHorizontalRotationAcceleration" }, "parameters": [ - "HorizontalRotationAcceleration", + "Object", + "Behavior", "=", "Value" ] @@ -13378,10 +13156,11 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper::SetPropertyHorizontalRotationDeceleration" }, "parameters": [ - "HorizontalRotationDeceleration", + "Object", + "Behavior", "=", "Value" ] @@ -13458,10 +13237,11 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper::SetPropertyVerticalRotationSpeedMax" }, "parameters": [ - "VerticalRotationSpeedMax", + "Object", + "Behavior", "=", "Value" ] @@ -13538,10 +13318,11 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper::SetPropertyVerticalRotationAcceleration" }, "parameters": [ - "VerticalRotationAcceleration", + "Object", + "Behavior", "=", "Value" ] @@ -13618,10 +13399,11 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper::SetPropertyVerticalRotationDeceleration" }, "parameters": [ - "VerticalRotationDeceleration", + "Object", + "Behavior", "=", "Value" ] @@ -13698,10 +13480,11 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper::SetPropertyVerticalAngleMin" }, "parameters": [ - "VerticalAngleMin", + "Object", + "Behavior", "=", "Value" ] @@ -13778,10 +13561,11 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper::SetPropertyVerticalAngleMax" }, "parameters": [ - "VerticalAngleMax", + "Object", + "Behavior", "=", "Value" ] @@ -13845,263 +13629,26 @@ ], "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": "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\")" - ] - } - ] - }, + { + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "OffsetZ", + "name": "SetOffsetZ", + "sentence": "", + "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::IsButtonPressed" - }, - "parameters": [ - "", - "ControllerIdentifier", - "HandBrakeButton", - "\"Down\"" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "Physics3D::PhysicsCar3D::SimulateHandBrakeKey" + "value": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper::SetPropertyOffsetZ" }, "parameters": [ "Object", - "PhysicsCar3D" + "Behavior", + "=", + "Value" ] } ] @@ -14116,7 +13663,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::PhysicsCar3DMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], @@ -14127,12 +13674,11 @@ { "value": "", "type": "Behavior", - "label": "3D physics car", + "label": "3D capability", "extraInformation": [ - "Physics3D::PhysicsCar3D" + "Scene3D::Base3DBehavior" ], - "choices": [], - "name": "PhysicsCar3D" + "name": "Object3D" }, { "value": "1", @@ -14141,45 +13687,99 @@ "name": "ControllerIdentifier" }, { - "value": "Primary", + "value": "Secondary", "type": "Choice", - "label": "Steer joystick", + "label": "Camera joystick", "group": "Controls", - "choices": [ - { - "label": "Primary", - "value": "Primary" - }, - { - "label": "Secondary", - "value": "Secondary" - } + "extraInformation": [ + "Primary", + "Secondary" ], - "name": "SteerJoystickIdentifier" + "name": "CameraStick" }, { - "value": "Secondary", - "type": "Choice", - "label": "Speed joystick", - "group": "Controls", - "choices": [ - { - "label": "Primary", - "value": "Primary" - }, - { - "label": "Secondary", - "value": "Secondary" - } - ], - "name": "SpeedJoystickIdentifier" + "value": "180", + "type": "Number", + "unit": "AngularSpeed", + "label": "Maximum rotation speed", + "group": "Horizontal rotation", + "name": "HorizontalRotationSpeedMax" }, { - "value": "B", - "type": "String", - "label": "Hand brake button name", - "group": "Controls", - "name": "HandBrakeButton" + "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": [] @@ -14189,7 +13789,6 @@ "fullName": "Top-down multitouch controller mapper", "name": "TopDownMultitouchMapper", "objectType": "", - "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -14202,10 +13801,11 @@ "conditions": [ { "type": { - "value": "StringVariable" + "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" }, "parameters": [ - "StickMode", + "Object", + "Behavior", "=", "\"Analog\"" ] @@ -14230,10 +13830,11 @@ "conditions": [ { "type": { - "value": "StringVariable" + "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" }, "parameters": [ - "StickMode", + "Object", + "Behavior", "=", "\"360°\"" ] @@ -14258,10 +13859,11 @@ "conditions": [ { "type": { - "value": "StringVariable" + "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" }, "parameters": [ - "StickMode", + "Object", + "Behavior", "=", "\"8 Directions\"" ] @@ -14703,7 +14305,6 @@ "extraInformation": [ "TopDownMovementBehavior::TopDownMovementBehavior" ], - "choices": [], "name": "TopDownMovement" }, { @@ -14716,15 +14317,9 @@ "value": "Primary", "type": "Choice", "label": "Joystick name", - "choices": [ - { - "label": "Primary", - "value": "Primary" - }, - { - "label": "Secondary", - "value": "Secondary" - } + "extraInformation": [ + "Primary", + "Secondary" ], "name": "JoystickIdentifier" }, @@ -14733,19 +14328,10 @@ "type": "Choice", "label": "Stick mode", "group": "Controls", - "choices": [ - { - "label": "Analog", - "value": "Analog" - }, - { - "label": "360°", - "value": "360°" - }, - { - "label": "8 Directions", - "value": "8 Directions" - } + "extraInformation": [ + "Analog", + "360°", + "8 Directions" ], "name": "StickMode" } @@ -14986,92 +14572,62 @@ "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::IsInGameEdition" + "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::IsPressed" }, "parameters": [ - "", + "Object", "" ] } ], - "actions": [], - "events": [ + "actions": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "MettreAutour" - }, - "parameters": [ - "Thumb", - "Border", - "Border.MultitouchJoystick::JoystickForce() * Border.Width() / 2", - "Border.MultitouchJoystick::JoystickAngle()" - ] - } + "type": { + "value": "Cache" + }, + "parameters": [ + "Object" ] }, { - "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", - "" - ] - } + "type": { + "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::ActivateControl" + }, + "parameters": [ + "Object", + "no", + "" ] } ] @@ -15233,12 +14789,11 @@ }, { "type": { - "value": "SetBooleanVariable" + "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::SetPropertyShouldBeHiddenWhenReleased" }, "parameters": [ - "ShouldBeHiddenWhenReleased", - "True", - "" + "Object", + "yes" ] }, { @@ -15364,12 +14919,10 @@ { "type": { "inverted": true, - "value": "BooleanVariable" + "value": "GetArgumentAsBoolean" }, "parameters": [ - "ShouldActivate", - "True", - "" + "\"ShouldActivate\"" ] } ], @@ -15391,12 +14944,10 @@ "conditions": [ { "type": { - "value": "BooleanVariable" + "value": "GetArgumentAsBoolean" }, "parameters": [ - "ShouldActivate", - "True", - "" + "\"ShouldActivate\"" ] } ], @@ -16012,15 +15563,9 @@ "value": "Primary", "type": "Choice", "label": "Joystick name", - "choices": [ - { - "label": "Primary", - "value": "Primary" - }, - { - "label": "Secondary", - "value": "Secondary" - } + "extraInformation": [ + "Primary", + "Secondary" ], "name": "JoystickIdentifier" }, @@ -16039,7 +15584,6 @@ "extraInformation": [ "Thumb" ], - "choices": [], "hidden": true, "name": "ThumbAnchorOrigin" }, @@ -16059,7 +15603,6 @@ "extraInformation": [ "Thumb" ], - "choices": [], "hidden": true, "name": "ThumbIsScaledProportionally" }, @@ -16078,7 +15621,8 @@ "hidden": true, "name": "ShouldBeHiddenWhenReleased" } - ] + ], + "variants": [] } ] }, diff --git a/examples/save-load-simple/save-load-simple.json b/examples/save-load-simple/save-load-simple.json index 1d9045092..93cadd2a2 100644 --- a/examples/save-load-simple/save-load-simple.json +++ b/examples/save-load-simple/save-load-simple.json @@ -2333,7 +2333,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.9.0", + "version": "1.8.4", "description": [ "Multitouch joysticks are objects showing a joystick on the screen, useful for mobile. They work like a physical gamepad:", "- 4 or 8 directions", @@ -2843,11 +2843,11 @@ "objectGroups": [] }, { - "description": "Check if a button was just pressed on a multitouch controller.", - "fullName": "Multitouch controller button just pressed", + "description": "Check if a button is pressed on a gamepad.", + "fullName": "Multitouch controller button pressed", "functionType": "Condition", - "name": "IsButtonJustPressed", - "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ was just pressed", + "name": "IsButtonPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -2859,73 +2859,7 @@ "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 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\"" - ] - } + "\"Pressed\"" ] } ], @@ -2957,7 +2891,7 @@ "objectGroups": [] }, { - "description": "Check if a button is released on a multitouch controller.", + "description": "Check if a button is released on a gamepad.", "fullName": "Multitouch controller button released", "functionType": "Condition", "name": "IsButtonReleased", @@ -3043,7 +2977,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"JustPressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -5533,49 +5467,11 @@ "conditions": [ { "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "IsReleased", - "True", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsReleased", - "False", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + "value": "SpriteMultitouchJoystick::MultitouchButton::IsReleased" }, "parameters": [ "Object", "Behavior", - "\"Idle\"", - "" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "True", "" ] } @@ -5586,7 +5482,7 @@ "value": "SetBooleanVariable" }, "parameters": [ - "IsJustPressed", + "IsReleased", "False", "" ] @@ -5598,7 +5494,7 @@ "parameters": [ "Object", "Behavior", - "\"Pressed\"", + "\"Idle\"", "" ] } @@ -5696,17 +5592,7 @@ "parameters": [ "Object", "Behavior", - "\"JustPressed\"", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "True", + "\"Pressed\"", "" ] } @@ -5777,16 +5663,6 @@ "" ] }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "False", - "" - ] - }, { "type": { "value": "SetNumberVariable" @@ -5816,11 +5692,11 @@ "objectGroups": [] }, { - "description": "Check if the button was just pressed.", - "fullName": "Button just pressed", + "description": "Check if button is released.", + "fullName": "Button released", "functionType": "Condition", - "name": "IsJustPressed", - "sentence": "Button _PARAM0_ was just pressed", + "name": "IsReleased", + "sentence": "Button _PARAM0_ is released", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -5830,7 +5706,7 @@ "value": "BooleanVariable" }, "parameters": [ - "IsJustPressed", + "IsReleased", "True", "" ] @@ -5864,7 +5740,7 @@ "objectGroups": [] }, { - "description": "Check if the button is pressed.", + "description": "Check if button is pressed.", "fullName": "Button pressed", "functionType": "Condition", "name": "IsPressed", @@ -5911,54 +5787,6 @@ ], "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", @@ -6000,7 +5828,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"JustPressed\",\"Pressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -6041,13 +5869,6 @@ "hidden": true, "name": "IsReleased" }, - { - "value": "", - "type": "Boolean", - "label": "Button just pressed", - "hidden": true, - "name": "IsJustPressed" - }, { "value": "0", "type": "Number", @@ -8462,6 +8283,7 @@ } ], "instances": [], + "editionSettings": {}, "eventsFunctions": [ { "fullName": "", @@ -9670,7 +9492,8 @@ "hidden": true, "name": "ShouldBeHiddenWhenReleased" } - ] + ], + "variants": [] } ] }, diff --git a/examples/space-asteroids/space-asteroids.json b/examples/space-asteroids/space-asteroids.json index e8440bb1a..7124c3df2 100644 --- a/examples/space-asteroids/space-asteroids.json +++ b/examples/space-asteroids/space-asteroids.json @@ -11212,13 +11212,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.9.0", + "version": "1.8.3", "description": [ - "Multitouch joysticks are objects showing a joystick on the screen, useful for mobile. They work like a physical gamepad:", + "Multitouch joysticks can be used the same way as physical gamepads:", "- 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.", + "- 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)." ], @@ -11282,28 +11282,6 @@ } ], "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", @@ -11722,11 +11700,11 @@ "objectGroups": [] }, { - "description": "Check if a button was just pressed on a multitouch controller.", - "fullName": "Multitouch controller button just pressed", + "description": "Check if a button is pressed on a gamepad.", + "fullName": "Multitouch controller button pressed", "functionType": "Condition", - "name": "IsButtonJustPressed", - "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ was just pressed", + "name": "IsButtonPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -11738,73 +11716,7 @@ "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 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\"" - ] - } + "\"Pressed\"" ] } ], @@ -11836,7 +11748,7 @@ "objectGroups": [] }, { - "description": "Check if a button is released on a multitouch controller.", + "description": "Check if a button is released on a gamepad.", "fullName": "Multitouch controller button released", "functionType": "Condition", "name": "IsButtonReleased", @@ -11922,7 +11834,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"JustPressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -13295,23 +13207,41 @@ "conditions": [ { "type": { - "inverted": true, - "value": "SpriteMultitouchJoystick::IsInGameEdition" + "value": "HasGameJustResumed" }, "parameters": [ - "", "" ] } ], - "actions": [], + "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": "HasGameJustResumed" + "value": "HasAnyTouchOrMouseStarted" }, "parameters": [ "" @@ -13321,207 +13251,171 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", - "" + "TouchIndex", + "=", + "0" ] } - ] - }, - { - "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" - ] - } - ], + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "StartedTouchOrMouseCount()", + "conditions": [], + "actions": [], "events": [ { - "type": "BuiltinCommonInstructions::Repeat", - "repeatExpression": "StartedTouchOrMouseCount()", - "conditions": [], - "actions": [], - "events": [ + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { - "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": "NumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "0" ] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchIndex", - "+", - "1" - ] - } + "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)" + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 + "type": { + "value": "HasTouchEnded" }, - "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" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - } + "parameters": [ + "", + "TouchId" ] } ], - "parameters": [] - }, + "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": [ { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Update joystick position", - "source": "", - "type": "BuiltinCommonInstructions::Group", - "events": [ + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { - "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)", - "" - ] - } + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "!=", + "0" ] } ], - "parameters": [] + "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": [ @@ -14383,78 +14277,40 @@ "type": "Number", "label": "", "hidden": true, - "name": "TouchId" - }, - { - "value": "", - "type": "Number", - "label": "", - "hidden": true, - "name": "TouchIndex" - } - ], - "sharedPropertyDescriptors": [] - }, - { - "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": "", - "eventsFunctions": [ - { - "fullName": "", - "functionType": "Action", - "name": "doStepPreEvents", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "IsReleased", - "True", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsReleased", - "False", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" - }, - "parameters": [ - "Object", - "Behavior", - "\"Idle\"", - "" - ] - } - ] - }, + "name": "TouchId" + }, + { + "value": "", + "type": "Number", + "label": "", + "hidden": true, + "name": "TouchIndex" + } + ], + "sharedPropertyDescriptors": [] + }, + { + "description": "Detect button presses made on a touchscreen.", + "fullName": "Multitouch button", + "name": "MultitouchButton", + "objectType": "", + "eventsFunctions": [ + { + "fullName": "", + "functionType": "Action", + "name": "doStepPreEvents", + "sentence": "", + "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "value": "BooleanVariable" + "value": "SpriteMultitouchJoystick::MultitouchButton::IsReleased" }, "parameters": [ - "IsJustPressed", - "True", + "Object", + "Behavior", "" ] } @@ -14465,7 +14321,7 @@ "value": "SetBooleanVariable" }, "parameters": [ - "IsJustPressed", + "IsReleased", "False", "" ] @@ -14477,7 +14333,7 @@ "parameters": [ "Object", "Behavior", - "\"Pressed\"", + "\"Idle\"", "" ] } @@ -14575,17 +14431,7 @@ "parameters": [ "Object", "Behavior", - "\"JustPressed\"", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "True", + "\"Pressed\"", "" ] } @@ -14656,16 +14502,6 @@ "" ] }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "False", - "" - ] - }, { "type": { "value": "SetNumberVariable" @@ -14695,11 +14531,11 @@ "objectGroups": [] }, { - "description": "Check if the button was just pressed.", - "fullName": "Button just pressed", + "description": "Check if button is released.", + "fullName": "Button released", "functionType": "Condition", - "name": "IsJustPressed", - "sentence": "Button _PARAM0_ was just pressed", + "name": "IsReleased", + "sentence": "Button _PARAM0_ is released", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -14709,7 +14545,7 @@ "value": "BooleanVariable" }, "parameters": [ - "IsJustPressed", + "IsReleased", "True", "" ] @@ -14743,7 +14579,7 @@ "objectGroups": [] }, { - "description": "Check if the button is pressed.", + "description": "Check if button is pressed.", "fullName": "Button pressed", "functionType": "Condition", "name": "IsPressed", @@ -14790,54 +14626,6 @@ ], "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", @@ -14879,7 +14667,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"JustPressed\",\"Pressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -14920,13 +14708,6 @@ "hidden": true, "name": "IsReleased" }, - { - "value": "", - "type": "Boolean", - "label": "Button just pressed", - "hidden": true, - "name": "IsJustPressed" - }, { "value": "0", "type": "Number", @@ -15124,7 +14905,6 @@ "extraInformation": [ "PlatformBehavior::PlatformerObjectBehavior" ], - "choices": [], "name": "Property" }, { @@ -15138,15 +14918,9 @@ "type": "Choice", "label": "Joystick name", "group": "Controls", - "choices": [ - { - "label": "Primary", - "value": "Primary" - }, - { - "label": "Secondary", - "value": "Secondary" - } + "extraInformation": [ + "Primary", + "Secondary" ], "name": "JoystickIdentifier" }, @@ -15267,7 +15041,6 @@ "extraInformation": [ "Physics3D::PhysicsCharacter3D" ], - "choices": [], "name": "PhysicsCharacter3D" }, { @@ -15281,15 +15054,9 @@ "type": "Choice", "label": "Walk joystick", "group": "Controls", - "choices": [ - { - "label": "Primary", - "value": "Primary" - }, - { - "label": "Secondary", - "value": "Secondary" - } + "extraInformation": [ + "Primary", + "Secondary" ], "name": "JoystickIdentifier" }, @@ -15399,7 +15166,6 @@ "extraInformation": [ "Physics3D::PhysicsCharacter3D" ], - "choices": [], "name": "PhysicsCharacter3D" }, { @@ -15413,15 +15179,9 @@ "type": "Choice", "label": "Walk joystick", "group": "Controls", - "choices": [ - { - "label": "Primary", - "value": "Primary" - }, - { - "label": "Secondary", - "value": "Secondary" - } + "extraInformation": [ + "Primary", + "Secondary" ], "name": "JoystickIdentifier" }, @@ -16364,7 +16124,6 @@ "extraInformation": [ "Scene3D::Base3DBehavior" ], - "choices": [], "name": "Object3D" }, { @@ -16378,15 +16137,9 @@ "type": "Choice", "label": "Camera joystick", "group": "Controls", - "choices": [ - { - "label": "Primary", - "value": "Primary" - }, - { - "label": "Secondary", - "value": "Secondary" - } + "extraInformation": [ + "Primary", + "Secondary" ], "name": "CameraStick" }, @@ -16602,7 +16355,6 @@ "extraInformation": [ "Physics3D::PhysicsCar3D" ], - "choices": [], "name": "PhysicsCar3D" }, { @@ -16616,15 +16368,9 @@ "type": "Choice", "label": "Steer joystick", "group": "Controls", - "choices": [ - { - "label": "Primary", - "value": "Primary" - }, - { - "label": "Secondary", - "value": "Secondary" - } + "extraInformation": [ + "Primary", + "Secondary" ], "name": "SteerJoystickIdentifier" }, @@ -16633,15 +16379,9 @@ "type": "Choice", "label": "Speed joystick", "group": "Controls", - "choices": [ - { - "label": "Primary", - "value": "Primary" - }, - { - "label": "Secondary", - "value": "Secondary" - } + "extraInformation": [ + "Primary", + "Secondary" ], "name": "SpeedJoystickIdentifier" }, @@ -17174,7 +16914,6 @@ "extraInformation": [ "TopDownMovementBehavior::TopDownMovementBehavior" ], - "choices": [], "name": "TopDownMovement" }, { @@ -17187,15 +16926,9 @@ "value": "Primary", "type": "Choice", "label": "Joystick name", - "choices": [ - { - "label": "Primary", - "value": "Primary" - }, - { - "label": "Secondary", - "value": "Secondary" - } + "extraInformation": [ + "Primary", + "Secondary" ], "name": "JoystickIdentifier" }, @@ -17204,19 +16937,10 @@ "type": "Choice", "label": "Stick mode", "group": "Controls", - "choices": [ - { - "label": "Analog", - "value": "Analog" - }, - { - "label": "360°", - "value": "360°" - }, - { - "label": "8 Directions", - "value": "8 Directions" - } + "extraInformation": [ + "Analog", + "360°", + "8 Directions" ], "name": "StickMode" } @@ -17457,92 +17181,74 @@ "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::IsInGameEdition" + "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::IsPressed" }, "parameters": [ - "", + "Object", "" ] } ], - "actions": [], - "events": [ + "actions": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "MettreAutour" - }, - "parameters": [ - "Thumb", - "Border", - "Border.MultitouchJoystick::JoystickForce() * Border.Width() / 2", - "Border.MultitouchJoystick::JoystickAngle()" - ] - } + "type": { + "value": "Cache" + }, + "parameters": [ + "Object" ] }, { - "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", - "" - ] - } + "type": { + "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::ActivateControl" + }, + "parameters": [ + "Object", + "no", + "" + ] + }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "ShouldBeHiddenWhenReleased", + "False", + "" ] } ] @@ -18483,15 +18189,9 @@ "value": "Primary", "type": "Choice", "label": "Joystick name", - "choices": [ - { - "label": "Primary", - "value": "Primary" - }, - { - "label": "Secondary", - "value": "Secondary" - } + "extraInformation": [ + "Primary", + "Secondary" ], "name": "JoystickIdentifier" }, @@ -18510,7 +18210,6 @@ "extraInformation": [ "Thumb" ], - "choices": [], "hidden": true, "name": "ThumbAnchorOrigin" }, @@ -18530,7 +18229,6 @@ "extraInformation": [ "Thumb" ], - "choices": [], "hidden": true, "name": "ThumbIsScaledProportionally" }, @@ -18549,7 +18247,8 @@ "hidden": true, "name": "ShouldBeHiddenWhenReleased" } - ] + ], + "variants": [] } ] }, diff --git a/examples/starting-2d-car-racing/starting-2d-car-racing.json b/examples/starting-2d-car-racing/starting-2d-car-racing.json index 25327a419..c8fd222ae 100644 --- a/examples/starting-2d-car-racing/starting-2d-car-racing.json +++ b/examples/starting-2d-car-racing/starting-2d-car-racing.json @@ -1963,7 +1963,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.9.0", + "version": "1.8.4", "description": [ "Multitouch joysticks are objects showing a joystick on the screen, useful for mobile. They work like a physical gamepad:", "- 4 or 8 directions", @@ -2473,11 +2473,11 @@ "objectGroups": [] }, { - "description": "Check if a button was just pressed on a multitouch controller.", - "fullName": "Multitouch controller button just pressed", + "description": "Check if a button is pressed on a gamepad.", + "fullName": "Multitouch controller button pressed", "functionType": "Condition", - "name": "IsButtonJustPressed", - "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ was just pressed", + "name": "IsButtonPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -2489,73 +2489,7 @@ "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 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\"" - ] - } + "\"Pressed\"" ] } ], @@ -2587,7 +2521,7 @@ "objectGroups": [] }, { - "description": "Check if a button is released on a multitouch controller.", + "description": "Check if a button is released on a gamepad.", "fullName": "Multitouch controller button released", "functionType": "Condition", "name": "IsButtonReleased", @@ -2673,7 +2607,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"JustPressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -5163,49 +5097,11 @@ "conditions": [ { "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "IsReleased", - "True", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsReleased", - "False", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + "value": "SpriteMultitouchJoystick::MultitouchButton::IsReleased" }, "parameters": [ "Object", "Behavior", - "\"Idle\"", - "" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "True", "" ] } @@ -5216,7 +5112,7 @@ "value": "SetBooleanVariable" }, "parameters": [ - "IsJustPressed", + "IsReleased", "False", "" ] @@ -5228,7 +5124,7 @@ "parameters": [ "Object", "Behavior", - "\"Pressed\"", + "\"Idle\"", "" ] } @@ -5326,17 +5222,7 @@ "parameters": [ "Object", "Behavior", - "\"JustPressed\"", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "True", + "\"Pressed\"", "" ] } @@ -5407,16 +5293,6 @@ "" ] }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "False", - "" - ] - }, { "type": { "value": "SetNumberVariable" @@ -5446,11 +5322,11 @@ "objectGroups": [] }, { - "description": "Check if the button was just pressed.", - "fullName": "Button just pressed", + "description": "Check if button is released.", + "fullName": "Button released", "functionType": "Condition", - "name": "IsJustPressed", - "sentence": "Button _PARAM0_ was just pressed", + "name": "IsReleased", + "sentence": "Button _PARAM0_ is released", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -5460,7 +5336,7 @@ "value": "BooleanVariable" }, "parameters": [ - "IsJustPressed", + "IsReleased", "True", "" ] @@ -5494,7 +5370,7 @@ "objectGroups": [] }, { - "description": "Check if the button is pressed.", + "description": "Check if button is pressed.", "fullName": "Button pressed", "functionType": "Condition", "name": "IsPressed", @@ -5541,54 +5417,6 @@ ], "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", @@ -5630,7 +5458,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"JustPressed\",\"Pressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -5671,13 +5499,6 @@ "hidden": true, "name": "IsReleased" }, - { - "value": "", - "type": "Boolean", - "label": "Button just pressed", - "hidden": true, - "name": "IsJustPressed" - }, { "value": "0", "type": "Number", @@ -8092,6 +7913,7 @@ } ], "instances": [], + "editionSettings": {}, "eventsFunctions": [ { "fullName": "", @@ -9300,7 +9122,8 @@ "hidden": true, "name": "ShouldBeHiddenWhenReleased" } - ] + ], + "variants": [] } ] }, diff --git a/examples/starting-2d-driving/starting-2d-driving.json b/examples/starting-2d-driving/starting-2d-driving.json index 3877f9483..0d83ac72a 100644 --- a/examples/starting-2d-driving/starting-2d-driving.json +++ b/examples/starting-2d-driving/starting-2d-driving.json @@ -1416,7 +1416,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.9.0", + "version": "1.8.4", "description": [ "Multitouch joysticks are objects showing a joystick on the screen, useful for mobile. They work like a physical gamepad:", "- 4 or 8 directions", @@ -1926,11 +1926,11 @@ "objectGroups": [] }, { - "description": "Check if a button was just pressed on a multitouch controller.", - "fullName": "Multitouch controller button just pressed", + "description": "Check if a button is pressed on a gamepad.", + "fullName": "Multitouch controller button pressed", "functionType": "Condition", - "name": "IsButtonJustPressed", - "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ was just pressed", + "name": "IsButtonPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -1942,73 +1942,7 @@ "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 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\"" - ] - } + "\"Pressed\"" ] } ], @@ -2040,7 +1974,7 @@ "objectGroups": [] }, { - "description": "Check if a button is released on a multitouch controller.", + "description": "Check if a button is released on a gamepad.", "fullName": "Multitouch controller button released", "functionType": "Condition", "name": "IsButtonReleased", @@ -2126,7 +2060,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"JustPressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -4616,49 +4550,11 @@ "conditions": [ { "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "IsReleased", - "True", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsReleased", - "False", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + "value": "SpriteMultitouchJoystick::MultitouchButton::IsReleased" }, "parameters": [ "Object", "Behavior", - "\"Idle\"", - "" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "True", "" ] } @@ -4669,7 +4565,7 @@ "value": "SetBooleanVariable" }, "parameters": [ - "IsJustPressed", + "IsReleased", "False", "" ] @@ -4681,7 +4577,7 @@ "parameters": [ "Object", "Behavior", - "\"Pressed\"", + "\"Idle\"", "" ] } @@ -4779,17 +4675,7 @@ "parameters": [ "Object", "Behavior", - "\"JustPressed\"", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "True", + "\"Pressed\"", "" ] } @@ -4860,16 +4746,6 @@ "" ] }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "False", - "" - ] - }, { "type": { "value": "SetNumberVariable" @@ -4899,11 +4775,11 @@ "objectGroups": [] }, { - "description": "Check if the button was just pressed.", - "fullName": "Button just pressed", + "description": "Check if button is released.", + "fullName": "Button released", "functionType": "Condition", - "name": "IsJustPressed", - "sentence": "Button _PARAM0_ was just pressed", + "name": "IsReleased", + "sentence": "Button _PARAM0_ is released", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -4913,7 +4789,7 @@ "value": "BooleanVariable" }, "parameters": [ - "IsJustPressed", + "IsReleased", "True", "" ] @@ -4947,7 +4823,7 @@ "objectGroups": [] }, { - "description": "Check if the button is pressed.", + "description": "Check if button is pressed.", "fullName": "Button pressed", "functionType": "Condition", "name": "IsPressed", @@ -4994,54 +4870,6 @@ ], "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", @@ -5083,7 +4911,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"JustPressed\",\"Pressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -5124,13 +4952,6 @@ "hidden": true, "name": "IsReleased" }, - { - "value": "", - "type": "Boolean", - "label": "Button just pressed", - "hidden": true, - "name": "IsJustPressed" - }, { "value": "0", "type": "Number", @@ -7545,6 +7366,7 @@ } ], "instances": [], + "editionSettings": {}, "eventsFunctions": [ { "fullName": "", @@ -8753,7 +8575,8 @@ "hidden": true, "name": "ShouldBeHiddenWhenReleased" } - ] + ], + "variants": [] } ] }, diff --git a/examples/starting-2d-platformer-shooter/starting-2d-platformer-shooter.json b/examples/starting-2d-platformer-shooter/starting-2d-platformer-shooter.json index ca9694b7b..829a17a3d 100644 --- a/examples/starting-2d-platformer-shooter/starting-2d-platformer-shooter.json +++ b/examples/starting-2d-platformer-shooter/starting-2d-platformer-shooter.json @@ -7928,19 +7928,19 @@ "category": "Input", "extensionNamespace": "", "fullName": "Multitouch joystick and buttons (sprite)", - "gdevelopVersion": ">=5.5.222", + "gdevelopVersion": "", "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", + "version": "1.4.0", "description": [ - "Multitouch joysticks are objects showing a joystick on the screen, useful for mobile. They work like a physical gamepad:", + "Multitouch joysticks can be used the same way as physical gamepads:", "- 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.", + "- 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)." ], @@ -8005,33 +8005,108 @@ ], "eventsFunctions": [ { - "description": "Check if the events are running for the editor.", - "fullName": "Editor is running", + "description": "Check if a button is pressed on a gamepad.", + "fullName": "Multitouch controller button pressed", "functionType": "Condition", - "name": "IsInGameEdition", - "private": true, - "sentence": "Events are running for the editor", + "name": "IsButtonPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", "events": [ { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "const game = runtimeScene.getGame();\r", - "eventsFunctionContext.returnValue = game.isInGameEdition && game.isInGameEdition();" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"Pressed\"" + ] + } ], - "parameterObjects": "", - "useStrict": true, - "eventsSheetExpanded": false + "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" } ], - "parameters": [], "objectGroups": [] }, { - "fullName": "Accelerated speed", - "functionType": "Expression", - "name": "AcceleratedSpeed", + "description": "Check if a button is released on a gamepad.", + "fullName": "Multitouch controller button released", + "functionType": "Condition", + "name": "IsButtonReleased", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is released", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"Released\"" + ] + } + ], + "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": "Change a button state for a multitouch controller.", + "fullName": "Button state", + "functionType": "Action", + "name": "SetButtonState", "private": true, - "sentence": "", + "sentence": "Mark _PARAM2_ button as _PARAM3_ for multitouch controller _PARAM1_", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -8039,443 +8114,108 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SetStringVariable" }, "parameters": [ - "AcceleratedSpeed", + "Controllers[ControllerIdentifier].Buttons[Button].State", "=", - "CurrentSpeed" + "ButtonState" ] } - ], - "events": [ + ] + } + ], + "parameters": [ + { + "description": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier", + "type": "expression" + }, + { + "description": "Button name", + "name": "Button", + "type": "string" + }, + { + "description": "Button state", + "name": "ButtonState", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "type": "stringWithSelector" + } + ], + "objectGroups": [] + }, + { + "description": "Change the dead zone radius of a joystick. 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).", + "fullName": "Dead zone radius", + "functionType": "Action", + "name": "SetDeadZone", + "private": true, + "sentence": "Change the dead zone of multitouch joystick _PARAM2_ of multitouch controller _PARAM1_ to _PARAM3_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ { - "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", - "=", - "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": { + "value": "SetNumberVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].DeadZone", + "=", + "DeadZoneRadius" ] - }, - { - "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": "NumberVariable" - }, - "parameters": [ - "TargetedSpeed", - "=", - "0" - ] - } - ], - "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", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "clamp(AcceleratedSpeed, -SpeedMax, SpeedMax)" - ] - } - ] - } - ], - "variables": [ - { - "name": "AcceleratedSpeed", - "type": "number", - "value": 0 } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { - "description": "Current speed", - "name": "CurrentSpeed", - "type": "expression" - }, - { - "description": "Targeted speed", - "name": "TargetedSpeed", - "type": "expression" - }, - { - "description": "Max speed", - "name": "SpeedMax", + "description": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier", "type": "expression" }, { - "description": "Acceleration", - "name": "Acceleration", - "type": "expression" + "description": "Joystick name", + "name": "JoystickIdentifier", + "type": "string" }, { - "description": "Deceleration", - "name": "Deceleration", + "description": "Dead zone radius", + "name": "DeadZoneRadius", + "supplementaryInformation": "[]", "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", + "description": "Return the dead zone radius of a joystick. 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).", + "fullName": "Dead zone radius", + "functionType": "Expression", + "name": "DeadZone", + "private": true, + "sentence": "Change multitouch joystick _PARAM2_ of multitouch controller _PARAM1_ dead zone to _PARAM3_", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Buttons[Button].State", - "=", - "\"JustPressed\"" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "SetReturnBoolean" + "value": "SetReturnNumber" }, "parameters": [ - "True" + "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].DeadZone" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Multitouch controller identifier (1, 2, 3, 4...)", @@ -8483,265 +8223,20 @@ "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\"]", + "description": "Joystick name", + "name": "JoystickIdentifier", "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\"" - ] - } - ] - } - ], - "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", - "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is released", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Buttons[Button].State", - "=", - "\"Released\"" - ] - } - ], - "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": "Change a button state for a multitouch controller.", - "fullName": "Button state", - "functionType": "Action", - "name": "SetButtonState", - "private": true, - "sentence": "Mark _PARAM2_ button as _PARAM3_ for multitouch controller _PARAM1_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetStringVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Buttons[Button].State", - "=", - "ButtonState" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" - }, - { - "description": "Button name", - "name": "Button", - "type": "string" - }, - { - "description": "Button state", - "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"JustPressed\",\"Released\"]", - "type": "stringWithSelector" - } - ], - "objectGroups": [] - }, - { - "description": "Change the dead zone radius of a joystick. 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).", - "fullName": "Dead zone radius", - "functionType": "Action", - "name": "SetDeadZone", - "private": true, - "sentence": "Change the dead zone of multitouch joystick _PARAM2_ of multitouch controller _PARAM1_ to _PARAM3_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].DeadZone", - "=", - "DeadZoneRadius" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" - }, - { - "description": "Joystick name", - "name": "JoystickIdentifier", - "type": "string" - }, - { - "description": "Dead zone radius", - "name": "DeadZoneRadius", - "supplementaryInformation": "[]", - "type": "expression" - } - ], - "objectGroups": [] - }, - { - "description": "Return the dead zone radius of a joystick. 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).", - "fullName": "Dead zone radius", - "functionType": "Expression", - "name": "DeadZone", - "private": true, - "sentence": "Change multitouch joystick _PARAM2_ of multitouch controller _PARAM1_ dead zone to _PARAM3_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].DeadZone" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" - }, - { - "description": "Joystick name", - "name": "JoystickIdentifier", - "type": "string" - } - ], - "objectGroups": [] - }, - { - "description": "the direction index (left = 1, bottom = 1, right = 2, top = 3) for an angle (in degrees).", - "fullName": "Angle to 4-way index", - "functionType": "ExpressionAndCondition", - "name": "AngleTo4Way", - "private": true, - "sentence": "The angle _PARAM1_ 4-way index", + "description": "the direction index (left = 1, bottom = 1, right = 2, top = 3) for an angle (in degrees).", + "fullName": "Angle to 4-way index", + "functionType": "ExpressionAndCondition", + "name": "AngleTo4Way", + "private": true, + "sentence": "The angle _PARAM1_ 4-way index", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -9494,11 +8989,6 @@ "name": "JoystickIdentifier", "supplementaryInformation": "[\"Primary\",\"Secondary\"]", "type": "stringWithSelector" - }, - { - "description": "", - "name": "Coucou", - "type": "expression" } ], "objectGroups": [] @@ -9728,7 +9218,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "XFromAngleAndDistance(SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier), SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier))" + "SpriteMultitouchJoystick::JoystickForce(ControllerIdentifier, JoystickIdentifier) * cos(ToRad(SpriteMultitouchJoystick::JoystickAngle(ControllerIdentifier, JoystickIdentifier)))" ] } ] @@ -9768,7 +9258,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "YFromAngleAndDistance(SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier), SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier))" + "SpriteMultitouchJoystick::JoystickForce(ControllerIdentifier, JoystickIdentifier) * sin(ToRad(SpriteMultitouchJoystick::JoystickAngle(ControllerIdentifier, JoystickIdentifier)))" ] } ] @@ -9791,133 +9281,16 @@ } ], "objectGroups": [] - }, + } + ], + "eventsBasedBehaviors": [ { - "description": "Check if a new touch has started on the right or left side of the screen.", - "fullName": "New touch on a screen side", - "functionType": "Condition", - "group": "Multitouch Joystick", - "name": "HasTouchStartedOnScreenSide", - "sentence": "A new touch has started on the _PARAM2_ side of the screen on _PARAM1_'s layer", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "HasAnyTouchOrMouseStarted" - }, - "parameters": [ - "" - ] - } - ], - "actions": [], - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "Side", - "=", - "\"Left\"" - ] - }, - { - "type": { - "value": "TouchX" - }, - "parameters": [ - "", - "StartedTouchOrMouseId(0)", - "<", - "CameraCenterX(Object.Layer())", - "Object.Layer()", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "Side", - "=", - "\"Right\"" - ] - }, - { - "type": { - "value": "TouchX" - }, - "parameters": [ - "", - "StartedTouchOrMouseId(0)", - ">=", - "CameraCenterX(Object.Layer())", - "Object.Layer()", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - } - ] - } - ], - "parameters": [ - { - "description": "Multitouch joystick", - "name": "Object", - "supplementaryInformation": "SpriteMultitouchJoystick::SpriteMultitouchJoystick", - "type": "objectList" - }, - { - "description": "Screen side", - "name": "Side", - "supplementaryInformation": "[\"Left\",\"Right\"]", - "type": "stringWithSelector" - } - ], - "objectGroups": [] - } - ], - "eventsBasedBehaviors": [ - { - "description": "Joystick that can be controlled by interacting with a touchscreen.", - "fullName": "Multitouch Joystick", - "name": "MultitouchJoystick", - "objectType": "", - "private": true, - "eventsFunctions": [ + "description": "Joystick that can be controlled by interacting with a touchscreen.", + "fullName": "Multitouch Joystick", + "name": "MultitouchJoystick", + "objectType": "", + "private": true, + "eventsFunctions": [ { "fullName": "", "functionType": "Action", @@ -9938,1885 +9311,16 @@ "JoystickIdentifier", "DeadZoneRadius", "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "Action", - "name": "onDeActivate", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "Action", - "name": "doStepPreEvents", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "inverted": true, - "value": "SpriteMultitouchJoystick::IsInGameEdition" - }, - "parameters": [ - "", - "" - ] - } - ], - "actions": [], - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "HasGameJustResumed" - }, - "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)" - }, - { - "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": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "the joystick force (from 0 to 1).", - "fullName": "Joystick force", - "functionType": "ExpressionAndCondition", - "name": "JoystickForce", - "sentence": "the joystick force", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "max(0, JoystickForce - DeadZoneRadius) / (1 - DeadZoneRadius)" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "JoystickForce", - "name": "SetJoystickForce", - "private": true, - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "JoystickForce", - "=", - "Value" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::SetJoystickForce" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "JoystickForce", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - }, - { - "description": "", - "name": "Parameter", - "type": "objectList" - } - ], - "objectGroups": [] - }, - { - "description": "Return the angle the joystick is pointing towards (Range: -180 to 180).", - "fullName": "Joystick angle", - "functionType": "Expression", - "name": "JoystickAngle", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "JoystickAngle" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "Change the angle the joystick is pointing towards (Range: -180 to 180).", - "fullName": "Joystick angle", - "functionType": "Action", - "name": "SetJoystickAngle", - "private": true, - "sentence": "Change the joystick angle of _PARAM0_ to _PARAM2_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "JoystickAngle", - "=", - "Value" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::SetJoystickAngle" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "JoystickAngle", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - }, - { - "description": "Angle", - "name": "Value", - "type": "expression" - } - ], - "objectGroups": [] - }, - { - "description": "Return the stick force on X axis (from -1 at the left to 1 at the right).", - "fullName": "Stick X force", - "functionType": "Expression", - "name": "StickForceX", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "Object.Behavior::JoystickForce() * cos(ToRad(Object.Behavior::JoystickAngle()))" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "Return the stick force on Y axis (from -1 at the top to 1 at the bottom).", - "fullName": "Stick Y force", - "functionType": "Expression", - "name": "StickForceY", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "Object.Behavior::JoystickForce() * sin(ToRad(Object.Behavior::JoystickAngle()))" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "Check if joystick is pushed in a given direction.", - "fullName": "Joystick pushed in a direction (4-way movement)", - "functionType": "Condition", - "name": "IsDirectionPushed4Way", - "sentence": "_PARAM0_ is pushed in direction _PARAM2_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::JoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - ">", - "0", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::IsAngleIn4WayDirection" - }, - "parameters": [ - "", - "JoystickAngle", - "Direction", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - }, - { - "description": "Direction", - "name": "Direction", - "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\"]", - "type": "stringWithSelector" - } - ], - "objectGroups": [] - }, - { - "description": "Check if joystick is pushed in a given direction.", - "fullName": "Joystick pushed in a direction (8-way movement)", - "functionType": "Condition", - "name": "IsDirectionPushed8Way", - "sentence": "_PARAM0_ is pushed in direction _PARAM2_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::JoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - ">", - "0", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::IsAngleIn8WayDirection" - }, - "parameters": [ - "", - "JoystickAngle", - "Direction", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - }, - { - "description": "Direction", - "name": "Direction", - "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\",\"UpLeft\",\"UpRight\",\"DownLeft\",\"DownRight\"]", - "type": "stringWithSelector" - } - ], - "objectGroups": [] - }, - { - "description": "Check if a joystick is pressed.", - "fullName": "Joystick pressed", - "functionType": "Condition", - "name": "IsPressed", - "sentence": "Joystick _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::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "Reset the joystick values (except for angle, which stays the same)", - "fullName": "Reset", - "functionType": "Action", - "name": "Reset", - "private": true, - "sentence": "Reset the joystick of _PARAM0_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "0", - "" - ] - }, - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "0" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "the multitouch controller identifier.", - "fullName": "Multitouch controller identifier", - "functionType": "ExpressionAndCondition", - "group": "Multitouch Joystick configuration", - "name": "ControllerIdentifier", - "sentence": "the multitouch controller identifier", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "ControllerIdentifier" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "ControllerIdentifier", - "name": "SetControllerIdentifier", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "ControllerIdentifier", - "=", - "Value" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "the joystick name.", - "fullName": "Joystick name", - "functionType": "ExpressionAndCondition", - "group": "Multitouch Joystick configuration", - "name": "JoystickIdentifier", - "sentence": "the joystick name", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnString" - }, - "parameters": [ - "JoystickIdentifier" - ] - } - ] - } - ], - "expressionType": { - "type": "string" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "JoystickIdentifier", - "name": "SetJoystickIdentifier", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetStringVariable" - }, - "parameters": [ - "JoystickIdentifier", - "=", - "Value" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "the dead zone radius (range: 0 to 1) of the joystick. 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).", - "fullName": "Dead zone radius", - "functionType": "ExpressionAndCondition", - "group": "Multitouch Joystick configuration", - "name": "DeadZoneRadius", - "sentence": "the dead zone radius", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "DeadZoneRadius" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "DeadZoneRadius", - "name": "SetDeadZoneRadius", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "DeadZoneRadius", - "=", - "Value" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::SetDeadZone" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "Value", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "Force the joystick into the pressing state.", - "fullName": "Force start pressing", - "functionType": "Action", - "name": "ForceStartPressing", - "sentence": "Force start pressing _PARAM0_ with touch identifier: _PARAM2_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "Value" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - }, - { - "description": "Touch identifier", - "name": "Value", - "type": "expression" - } - ], - "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "1", - "type": "Number", - "label": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier" - }, - { - "value": "Primary", - "type": "String", - "label": "Joystick name", - "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": "0", - "type": "Number", - "label": "Joystick angle (range: -180 to 180)", - "hidden": true, - "name": "JoystickAngle" - }, - { - "value": "0", - "type": "Number", - "label": "Joystick force (range: 0 to 1)", - "hidden": true, - "name": "JoystickForce" - }, - { - "value": "0", - "type": "Number", - "label": "", - "hidden": true, - "name": "TouchId" - }, - { - "value": "", - "type": "Number", - "label": "", - "hidden": true, - "name": "TouchIndex" - } - ], - "sharedPropertyDescriptors": [] - }, - { - "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": "", - "eventsFunctions": [ - { - "fullName": "", - "functionType": "Action", - "name": "doStepPreEvents", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "IsReleased", - "True", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsReleased", - "False", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" - }, - "parameters": [ - "Object", - "Behavior", - "\"Idle\"", - "" - ] - } - ] - }, - { - "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": [ - { - "type": { - "inverted": true, - "value": "SpriteMultitouchJoystick::MultitouchButton::IsPressed" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - }, - { - "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": "BuiltinCommonInstructions::Or" - }, - "parameters": [], - "subInstructions": [ - { - "type": { - "value": "CollisionPoint" - }, - "parameters": [ - "Object", - "TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer())", - "TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer())" - ] - }, - { - "type": { - "value": "NumberVariable" - }, - "parameters": [ - "Radius", - ">", - "DistanceBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer()), TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer()))" - ] - } - ] - } - ], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "StartedTouchOrMouseId(TouchIndex)" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" - }, - "parameters": [ - "Object", - "Behavior", - "\"JustPressed\"", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "True", - "" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchIndex", - "+", - "1" - ] - } - ] - } - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::IsPressed" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - }, - { - "type": { - "value": "HasTouchEnded" - }, - "parameters": [ - "", - "TouchId" - ] - } - ], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" - }, - "parameters": [ - "Object", - "Behavior", - "\"Released\"", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsReleased", - "True", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "False", - "" - ] - }, - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "0" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "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", - "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", - "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": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", - "type": "behavior" - }, - { - "description": "Button state", - "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"JustPressed\",\"Pressed\",\"Released\"]", - "type": "stringWithSelector" - } - ], - "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "1", - "type": "Number", - "label": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier" - }, - { - "value": "A", - "type": "String", - "label": "Button identifier", - "name": "ButtonIdentifier" - }, - { - "value": "0", - "type": "Number", - "label": "TouchID", - "hidden": true, - "name": "TouchId" - }, - { - "value": "", - "type": "Number", - "label": "", - "hidden": true, - "name": "TouchIndex" - }, - { - "value": "", - "type": "Boolean", - "label": "Button released", - "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.", - "name": "Radius" - } - ], - "sharedPropertyDescriptors": [] - }, - { - "description": "Control a platformer character with a multitouch controller.", - "fullName": "Platformer multitouch controller mapper", - "name": "PlatformerMultitouchMapper", - "objectType": "", - "quickCustomizationVisibility": "hidden", - "eventsFunctions": [ - { - "fullName": "", - "functionType": "Action", - "name": "doStepPreEvents", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "\"Left\"", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateLeftKey" - }, - "parameters": [ - "Object", - "Property" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "\"Right\"", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateRightKey" - }, - "parameters": [ - "Object", - "Property" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "\"Up\"", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateUpKey" - }, - "parameters": [ - "Object", - "Property" - ] - }, - { - "type": { - "value": "PlatformBehavior::SimulateLadderKey" - }, - "parameters": [ - "Object", - "Property" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "\"Down\"", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateDownKey" - }, - "parameters": [ - "Object", - "Property" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::IsButtonPressed" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JumpButton", - "\"Down\"" - ] - } - ], - "actions": [ + ] + }, { "type": { - "value": "PlatformBehavior::SimulateJumpKey" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" }, "parameters": [ "Object", - "Property" + "Behavior", + "" ] } ] @@ -11831,64 +9335,50 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::PlatformerMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "", - "type": "Behavior", - "label": "Platform character behavior", - "extraInformation": [ - "PlatformBehavior::PlatformerObjectBehavior" - ], - "choices": [], - "name": "Property" - }, - { - "value": "1", - "type": "Number", - "label": "Controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier" }, { - "value": "Primary", - "type": "Choice", - "label": "Joystick name", - "group": "Controls", - "choices": [ + "fullName": "", + "functionType": "Action", + "name": "onDeActivate", + "sentence": "", + "events": [ { - "label": "Primary", - "value": "Primary" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" }, { - "label": "Secondary", - "value": "Secondary" + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } ], - "name": "JoystickIdentifier" + "objectGroups": [] }, - { - "value": "A", - "type": "String", - "label": "Jump button name", - "group": "Controls", - "name": "JumpButton" - } - ], - "sharedPropertyDescriptors": [] - }, - { - "description": "Control a 3D physics character with a multitouch controller.", - "fullName": "3D platformer multitouch controller mapper", - "name": "Platformer3DMultitouchMapper", - "objectType": "", - "quickCustomizationVisibility": "hidden", - "eventsFunctions": [ { "fullName": "", "functionType": "Action", @@ -11900,14 +9390,9 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::StickForce" + "value": "HasGameJustResumed" }, "parameters": [ - "", - ">", - "0", - "ControllerIdentifier", - "JoystickIdentifier", "" ] } @@ -11915,56 +9400,252 @@ "actions": [ { "type": { - "value": "Physics3D::PhysicsCharacter3D::SetForwardAngle" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" }, "parameters": [ "Object", - "PhysicsCharacter3D", - "=", - "SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier) + CameraAngle(Object.Layer())" + "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": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyTouchIndex" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "0" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "StartedTouchOrMouseCount()", + "conditions": [], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::PropertyTouchId" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "0" + ] + }, + { + "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": { - "value": "Physics3D::PhysicsCharacter3D::SimulateStick" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 }, - "parameters": [ - "Object", - "PhysicsCharacter3D", - "-90", - "SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier)" + "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" + }, + "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": "SpriteMultitouchJoystick::MultitouchJoystick::PropertyTouchId" + }, + "parameters": [ + "Object", + "Behavior", + "!=", + "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": [ + { + "description": "Object", + "name": "Object", + "type": "object" }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "the joystick force (from 0 to 1).", + "fullName": "Joystick force", + "functionType": "ExpressionAndCondition", + "name": "JoystickForce", + "sentence": "the joystick force", + "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::IsButtonPressed" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JumpButton", - "\"Down\"" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" + "value": "SetReturnNumber" }, "parameters": [ - "Object", - "PhysicsCharacter3D" + "max(0, JoystickForce - DeadZoneRadius) / (1 - DeadZoneRadius)" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -11974,124 +9655,45 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::Platformer3DMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "", - "type": "Behavior", - "label": "3D physics character", - "extraInformation": [ - "Physics3D::PhysicsCharacter3D" - ], - "choices": [], - "name": "PhysicsCharacter3D" }, - { - "value": "1", - "type": "Number", - "label": "Controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier" - }, - { - "value": "Primary", - "type": "Choice", - "label": "Walk joystick", - "group": "Controls", - "choices": [ - { - "label": "Primary", - "value": "Primary" - }, - { - "label": "Secondary", - "value": "Secondary" - } - ], - "name": "JoystickIdentifier" - }, - { - "value": "A", - "type": "String", - "label": "Jump button name", - "group": "Controls", - "name": "JumpButton" - } - ], - "sharedPropertyDescriptors": [] - }, - { - "description": "Control a 3D physics character with a multitouch controller.", - "fullName": "3D shooter multitouch controller mapper", - "name": "Shooter3DMultitouchMapper", - "objectType": "", - "quickCustomizationVisibility": "hidden", - "eventsFunctions": [ { "fullName": "", - "functionType": "Action", - "name": "doStepPreEvents", + "functionType": "ActionWithOperator", + "getterName": "JoystickForce", + "name": "SetJoystickForce", + "private": true, "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::StickForce" - }, - "parameters": [ - "", - ">", - "0", - "ControllerIdentifier", - "JoystickIdentifier", - "" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateStick" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickForce" }, "parameters": [ "Object", - "PhysicsCharacter3D", - "SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier)", - "SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier)" + "Behavior", + "=", + "Value" ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + }, { "type": { - "value": "SpriteMultitouchJoystick::IsButtonPressed" + "value": "SpriteMultitouchJoystick::SetJoystickForce" }, "parameters": [ "", "ControllerIdentifier", - "JumpButton", - "\"Down\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" - }, - "parameters": [ - "Object", - "PhysicsCharacter3D" + "JoystickIdentifier", + "JoystickForce", + "" ] } ] @@ -12106,151 +9708,37 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::Shooter3DMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "", - "type": "Behavior", - "label": "3D physics character", - "extraInformation": [ - "Physics3D::PhysicsCharacter3D" - ], - "choices": [], - "name": "PhysicsCharacter3D" - }, - { - "value": "1", - "type": "Number", - "label": "Controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier" - }, - { - "value": "Primary", - "type": "Choice", - "label": "Walk joystick", - "group": "Controls", - "choices": [ - { - "label": "Primary", - "value": "Primary" - }, - { - "label": "Secondary", - "value": "Secondary" - } - ], - "name": "JoystickIdentifier" }, { - "value": "A", - "type": "String", - "label": "Jump button name", - "group": "Controls", - "name": "JumpButton" - } - ], - "sharedPropertyDescriptors": [] - }, - { - "description": "Control camera rotations with a multitouch controller.", - "fullName": "First person camera multitouch controller mapper", - "name": "FirstPersonMultitouchMapper", - "objectType": "", - "quickCustomizationVisibility": "hidden", - "eventsFunctions": [ - { - "fullName": "", - "functionType": "Action", - "name": "doStepPreEvents", + "description": "Return the angle the joystick is pointing towards (Range: -180 to 180).", + "fullName": "Joystick angle", + "functionType": "Expression", + "name": "JoystickAngle", "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", - "=", - "SpriteMultitouchJoystick::AcceleratedSpeed(CurrentRotationSpeedZ, SpriteMultitouchJoystick::StickForceX(ControllerIdentifier, CameraStick) * HorizontalRotationSpeedMax, HorizontalRotationSpeedMax, HorizontalRotationAcceleration, HorizontalRotationDeceleration)" - ] - }, - { - "type": { - "value": "SetAngle" - }, - "parameters": [ - "Object", - "+", - "CurrentRotationSpeedZ * TimeDelta()" - ] - }, - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "CurrentRotationSpeedY", - "=", - "SpriteMultitouchJoystick::AcceleratedSpeed(CurrentRotationSpeedY, SpriteMultitouchJoystick::StickForceY(ControllerIdentifier, 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)" - ] - }, + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper::LookFromObjectEyes" + "value": "SetReturnNumber" }, "parameters": [ - "Object", - "Behavior", - "" + "JoystickAngle" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -12260,20 +9748,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "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", + "description": "Change the angle the joystick is pointing towards (Range: -180 to 180).", + "fullName": "Joystick angle", "functionType": "Action", - "group": "Layers and cameras", - "name": "LookFromObjectEyes", + "name": "SetJoystickAngle", "private": true, - "sentence": "Move the camera to look though _PARAM0_ eyes", + "sentence": "Change the joystick angle of _PARAM0_ to _PARAM2_", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -12281,61 +9768,24 @@ "actions": [ { "type": { - "value": "CentreCamera" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickAngle" }, "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": [ - "", + "Behavior", "=", - "Object.Object3D::RotationX()", - "GetArgumentAsString(\"Layer\")", - "" + "Value" ] }, { "type": { - "value": "SetCameraAngle" + "value": "SpriteMultitouchJoystick::SetJoystickAngle" }, "parameters": [ "", - "=", - "Object.Angle() + 90", - "Object.Layer()", + "ControllerIdentifier", + "JoystickIdentifier", + "JoystickAngle", "" ] } @@ -12351,19 +9801,23 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" + }, + { + "description": "Angle", + "name": "Value", + "type": "expression" } ], "objectGroups": [] }, { - "description": "the maximum horizontal rotation speed of the object.", - "fullName": "Maximum horizontal rotation speed", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper horizontal rotation configuration", - "name": "HorizontalRotationSpeedMax", - "sentence": "the maximum horizontal rotation speed", + "description": "Return the stick force on X axis (from -1 at the left to 1 at the right).", + "fullName": "Stick X force", + "functionType": "Expression", + "name": "StickForceX", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -12374,7 +9828,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "HorizontalRotationSpeedMax" + "Object.Behavior::JoystickForce() * cos(ToRad(Object.Behavior::JoystickAngle()))" ] } ] @@ -12392,17 +9846,17 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] }, { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "HorizontalRotationSpeedMax", - "name": "SetHorizontalRotationSpeedMax", + "description": "Return the stick force on Y axis (from -1 at the top to 1 at the bottom).", + "fullName": "Stick Y force", + "functionType": "Expression", + "name": "StickForceY", "sentence": "", "events": [ { @@ -12411,17 +9865,18 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SetReturnNumber" }, "parameters": [ - "HorizontalRotationSpeedMax", - "=", - "Value" + "Object.Behavior::JoystickForce() * sin(ToRad(Object.Behavior::JoystickAngle()))" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -12431,38 +9886,58 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the horizontal rotation acceleration of the object.", - "fullName": "Horizontal rotation acceleration", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper horizontal rotation configuration", - "name": "HorizontalRotationAcceleration", - "sentence": "the horizontal rotation acceleration", + "description": "Check if joystick is pushed in a given direction.", + "fullName": "Joystick pushed in a direction (4-way movement)", + "functionType": "Condition", + "name": "IsDirectionPushed4Way", + "sentence": "_PARAM0_ is pushed in direction _PARAM2_", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::JoystickForce" + }, + "parameters": [ + "Object", + "Behavior", + ">", + "0", + "" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::IsAngleIn4WayDirection" + }, + "parameters": [ + "", + "JoystickAngle", + "Direction", + "" + ] + } + ], "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "SetReturnBoolean" }, "parameters": [ - "HorizontalRotationAcceleration" + "True" ] } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -12472,31 +9947,59 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" + }, + { + "description": "Direction", + "name": "Direction", + "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\"]", + "type": "stringWithSelector" } ], "objectGroups": [] }, { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "HorizontalRotationAcceleration", - "name": "SetHorizontalRotationAcceleration", - "sentence": "", + "description": "Check if joystick is pushed in a given direction.", + "fullName": "Joystick pushed in a direction (8-way movement)", + "functionType": "Condition", + "name": "IsDirectionPushed8Way", + "sentence": "_PARAM0_ is pushed in direction _PARAM2_", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::JoystickForce" + }, + "parameters": [ + "Object", + "Behavior", + ">", + "0", + "" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::IsAngleIn8WayDirection" + }, + "parameters": [ + "", + "JoystickAngle", + "Direction", + "" + ] + } + ], "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SetReturnBoolean" }, "parameters": [ - "HorizontalRotationAcceleration", - "=", - "Value" + "True" ] } ] @@ -12511,38 +10014,52 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" + }, + { + "description": "Direction", + "name": "Direction", + "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\",\"UpLeft\",\"UpRight\",\"DownLeft\",\"DownRight\"]", + "type": "stringWithSelector" } ], "objectGroups": [] }, { - "description": "the horizontal rotation deceleration of the object.", - "fullName": "Horizontal rotation deceleration", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper horizontal rotation configuration", - "name": "HorizontalRotationDeceleration", - "sentence": "the horizontal rotation deceleration", + "description": "Check if a joystick is pressed.", + "fullName": "Joystick pressed", + "functionType": "Condition", + "name": "IsPressed", + "sentence": "Joystick _PARAM0_ is pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::PropertyTouchId" + }, + "parameters": [ + "Object", + "Behavior", + "!=", + "0" + ] + } + ], "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "SetReturnBoolean" }, "parameters": [ - "HorizontalRotationDeceleration" + "True" ] } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -12552,18 +10069,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] }, { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "HorizontalRotationDeceleration", - "name": "SetHorizontalRotationDeceleration", - "sentence": "", + "description": "Reset the joystick values (except for angle, which stays the same)", + "fullName": "Reset", + "functionType": "Action", + "name": "Reset", + "private": true, + "sentence": "Reset the joystick of _PARAM0_", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -12571,12 +10089,25 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" }, "parameters": [ - "HorizontalRotationDeceleration", + "Object", + "Behavior", "=", - "Value" + "0", + "" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyTouchId" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "0" ] } ] @@ -12591,19 +10122,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the maximum vertical rotation speed of the object.", - "fullName": "Maximum vertical rotation speed", + "description": "the multitouch controller identifier.", + "fullName": "Multitouch controller identifier", "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper vertical rotation configuration", - "name": "VerticalRotationSpeedMax", - "sentence": "the maximum vertical rotation speed", + "group": "Multitouch Joystick configuration", + "name": "ControllerIdentifier", + "sentence": "the multitouch controller identifier", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -12614,7 +10145,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "VerticalRotationSpeedMax" + "ControllerIdentifier" ] } ] @@ -12632,7 +10163,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], @@ -12641,8 +10172,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "VerticalRotationSpeedMax", - "name": "SetVerticalRotationSpeedMax", + "getterName": "ControllerIdentifier", + "name": "SetControllerIdentifier", "sentence": "", "events": [ { @@ -12651,10 +10182,11 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyControllerIdentifier" }, "parameters": [ - "VerticalRotationSpeedMax", + "Object", + "Behavior", "=", "Value" ] @@ -12671,19 +10203,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the vertical rotation acceleration of the object.", - "fullName": "Vertical rotation acceleration", + "description": "the joystick name.", + "fullName": "Joystick name", "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper vertical rotation configuration", - "name": "VerticalRotationAcceleration", - "sentence": "the vertical rotation acceleration", + "group": "Multitouch Joystick configuration", + "name": "JoystickIdentifier", + "sentence": "the joystick name", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -12691,17 +10223,17 @@ "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "SetReturnString" }, "parameters": [ - "VerticalRotationAcceleration" + "JoystickIdentifier" ] } ] } ], "expressionType": { - "type": "expression" + "type": "string" }, "parameters": [ { @@ -12712,7 +10244,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], @@ -12721,8 +10253,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "VerticalRotationAcceleration", - "name": "SetVerticalRotationAcceleration", + "getterName": "JoystickIdentifier", + "name": "SetJoystickIdentifier", "sentence": "", "events": [ { @@ -12731,10 +10263,11 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickIdentifier" }, "parameters": [ - "VerticalRotationAcceleration", + "Object", + "Behavior", "=", "Value" ] @@ -12751,19 +10284,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the vertical rotation deceleration of the object.", - "fullName": "Vertical rotation deceleration", + "description": "the dead zone radius (range: 0 to 1) of the joystick. 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).", + "fullName": "Dead zone radius", "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper vertical rotation configuration", - "name": "VerticalRotationDeceleration", - "sentence": "the vertical rotation deceleration", + "group": "Multitouch Joystick configuration", + "name": "DeadZoneRadius", + "sentence": "the dead zone radius", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -12774,7 +10307,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "VerticalRotationDeceleration" + "DeadZoneRadius" ] } ] @@ -12792,7 +10325,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], @@ -12801,8 +10334,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "VerticalRotationDeceleration", - "name": "SetVerticalRotationDeceleration", + "getterName": "DeadZoneRadius", + "name": "SetDeadZoneRadius", "sentence": "", "events": [ { @@ -12811,10 +10344,11 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyDeadZoneRadius" }, "parameters": [ - "VerticalRotationDeceleration", + "Object", + "Behavior", "=", "Value" ] @@ -12831,72 +10365,271 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] + } + ], + "propertyDescriptors": [ + { + "value": "1", + "type": "Number", + "label": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier" }, { - "description": "the minimum vertical camera angle of the object.", - "fullName": "Minimum vertical camera angle", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper vertical rotation configuration", - "name": "VerticalAngleMin", - "sentence": "the minimum vertical camera angle", + "value": "Primary", + "type": "String", + "label": "Joystick name", + "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": "0", + "type": "Number", + "label": "Joystick angle (range: -180 to 180)", + "hidden": true, + "name": "JoystickAngle" + }, + { + "value": "0", + "type": "Number", + "label": "Joystick force (range: 0 to 1)", + "hidden": true, + "name": "JoystickForce" + }, + { + "value": "0", + "type": "Number", + "label": "", + "hidden": true, + "name": "TouchId" + }, + { + "value": "", + "type": "Number", + "label": "", + "hidden": true, + "name": "TouchIndex" + } + ], + "sharedPropertyDescriptors": [] + }, + { + "description": "Detect button presses made on a touchscreen.", + "fullName": "Multitouch button", + "name": "MultitouchButton", + "objectType": "", + "eventsFunctions": [ + { + "fullName": "", + "functionType": "Action", + "name": "doStepPreEvents", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::IsReleased" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } + ], "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyIsReleased" + }, + "parameters": [ + "Object", + "Behavior", + "no" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" }, "parameters": [ - "VerticalAngleMin" + "Object", + "Behavior", + "\"Idle\"", + "" ] } ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" }, { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "VerticalAngleMin", - "name": "SetVerticalAngleMin", - "sentence": "", - "events": [ + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "SpriteMultitouchJoystick::MultitouchButton::IsPressed" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + }, + { + "type": { + "value": "HasAnyTouchOrMouseStarted" + }, + "parameters": [ + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchIndex" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "0" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "StartedTouchOrMouseCount()", + "conditions": [], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "CollisionPoint" + }, + "parameters": [ + "Object", + "TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)", + "TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchId" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "StartedTouchOrMouseId(TouchIndex)" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + }, + "parameters": [ + "Object", + "Behavior", + "\"Pressed\"", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchIndex" + }, + "parameters": [ + "Object", + "Behavior", + "+", + "1" + ] + } + ] + } + ] + } + ] + }, { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::IsPressed" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + }, + { + "type": { + "value": "HasTouchEnded" + }, + "parameters": [ + "", + "TouchId" + ] + } + ], "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + }, + "parameters": [ + "Object", + "Behavior", + "\"Released\"", + "" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyIsReleased" + }, + "parameters": [ + "Object", + "Behavior", + "yes" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchId" }, "parameters": [ - "VerticalAngleMin", + "Object", + "Behavior", "=", - "Value" + "0" ] } ] @@ -12911,72 +10644,39 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the maximum vertical camera angle of the object.", - "fullName": "Maximum vertical camera angle", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper vertical rotation configuration", - "name": "VerticalAngleMax", - "sentence": "the maximum vertical camera angle", + "description": "Check if button is released.", + "fullName": "Button released", + "functionType": "Condition", + "name": "IsReleased", + "sentence": "Button _PARAM0_ is released", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ + "conditions": [ { "type": { - "value": "SetReturnNumber" + "value": "SpriteMultitouchJoystick::MultitouchButton::PropertyIsReleased" }, "parameters": [ - "VerticalAngleMax" + "Object", + "Behavior" ] } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "VerticalAngleMax", - "name": "SetVerticalAngleMax", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + ], "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SetReturnBoolean" }, "parameters": [ - "VerticalAngleMax", - "=", - "Value" + "True" ] } ] @@ -12991,38 +10691,46 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the z position offset of the object.", - "fullName": "Z position offset", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper position configuration", - "name": "OffsetZ", - "sentence": "the z position offset", + "description": "Check if button is pressed.", + "fullName": "Button pressed", + "functionType": "Condition", + "name": "IsPressed", + "sentence": "Button _PARAM0_ is pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::PropertyTouchId" + }, + "parameters": [ + "Object", + "Behavior", + "!=", + "0" + ] + } + ], "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "SetReturnBoolean" }, "parameters": [ - "OffsetZ" + "True" ] } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -13032,18 +10740,18 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", "type": "behavior" } ], "objectGroups": [] }, { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "OffsetZ", - "name": "SetOffsetZ", - "sentence": "", + "fullName": "Button state", + "functionType": "Action", + "name": "SetButtonState", + "private": true, + "sentence": "Mark the button _PARAM0_ as _PARAM2_", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -13051,12 +10759,14 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::SetButtonState" }, "parameters": [ - "OffsetZ", - "=", - "Value" + "", + "ControllerIdentifier", + "ButtonIdentifier", + "ButtonState", + "" ] } ] @@ -13071,140 +10781,61 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", "type": "behavior" + }, + { + "description": "Button state", + "name": "ButtonState", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "type": "stringWithSelector" } ], "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...)", + "label": "Multitouch 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": "A", + "type": "String", + "label": "Button identifier", + "name": "ButtonIdentifier" }, { "value": "0", "type": "Number", - "unit": "Pixel", - "label": "Z position offset", - "group": "Position", - "name": "OffsetZ" + "label": "TouchID", + "hidden": true, + "name": "TouchId" }, { - "value": "0", + "value": "", "type": "Number", - "unit": "AngularSpeed", - "label": "Current rotation speed Z", + "label": "", "hidden": true, - "name": "CurrentRotationSpeedZ" + "name": "TouchIndex" }, { - "value": "0", - "type": "Number", - "unit": "AngularSpeed", - "label": "Current rotation speed Y", + "value": "", + "type": "Boolean", + "label": "Button released", "hidden": true, - "name": "CurrentRotationSpeedY" + "name": "IsReleased" } ], "sharedPropertyDescriptors": [] }, { - "description": "Control a 3D physics car with a multitouch controller.", - "fullName": "3D car multitouch controller mapper", - "name": "PhysicsCar3DMultitouchMapper", + "description": "Control a platformer character with a multitouch controller.", + "fullName": "Platformer multitouch controller mapper", + "name": "PlatformerMultitouchMapper", "objectType": "", - "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -13217,14 +10848,13 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::StickForce" + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" }, "parameters": [ "", - ">", - "0", "ControllerIdentifier", - "SteerJoystickIdentifier", + "JoystickIdentifier", + "\"Left\"", "" ] } @@ -13232,12 +10862,11 @@ "actions": [ { "type": { - "value": "Physics3D::PhysicsCar3D::SimulateSteeringStick" + "value": "PlatformBehavior::SimulateLeftKey" }, "parameters": [ "Object", - "PhysicsCar3D", - "SpriteMultitouchJoystick::StickForceX(ControllerIdentifier, \"Primary\")" + "Property" ] } ] @@ -13247,14 +10876,78 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::StickForce" + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JoystickIdentifier", + "\"Right\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "PlatformBehavior::SimulateRightKey" + }, + "parameters": [ + "Object", + "Property" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JoystickIdentifier", + "\"Up\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "PlatformBehavior::SimulateUpKey" + }, + "parameters": [ + "Object", + "Property" + ] + }, + { + "type": { + "value": "PlatformBehavior::SimulateLadderKey" + }, + "parameters": [ + "Object", + "Property" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" }, "parameters": [ "", - ">", - "0", "ControllerIdentifier", - "SpeedJoystickIdentifier", + "JoystickIdentifier", + "\"Down\"", "" ] } @@ -13262,12 +10955,11 @@ "actions": [ { "type": { - "value": "Physics3D::PhysicsCar3D::SimulateAcceleratorStick" + "value": "PlatformBehavior::SimulateDownKey" }, "parameters": [ "Object", - "PhysicsCar3D", - "-SpriteMultitouchJoystick::StickForceY(ControllerIdentifier, \"Secondary\")" + "Property" ] } ] @@ -13282,7 +10974,7 @@ "parameters": [ "", "ControllerIdentifier", - "HandBrakeButton", + "JumpButton", "\"Down\"" ] } @@ -13290,11 +10982,11 @@ "actions": [ { "type": { - "value": "Physics3D::PhysicsCar3D::SimulateHandBrakeKey" + "value": "PlatformBehavior::SimulateJumpKey" }, "parameters": [ "Object", - "PhysicsCar3D" + "Property" ] } ] @@ -13309,7 +11001,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::PhysicsCar3DMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::PlatformerMultitouchMapper", "type": "behavior" } ], @@ -13320,12 +11012,12 @@ { "value": "", "type": "Behavior", - "label": "3D physics car", + "label": "Platform character behavior", "extraInformation": [ - "Physics3D::PhysicsCar3D" + "PlatformBehavior::PlatformerObjectBehavior" ], "choices": [], - "name": "PhysicsCar3D" + "name": "Property" }, { "value": "1", @@ -13336,24 +11028,7 @@ { "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", + "label": "Joystick name", "group": "Controls", "choices": [ { @@ -13365,14 +11040,14 @@ "value": "Secondary" } ], - "name": "SpeedJoystickIdentifier" + "name": "JoystickIdentifier" }, { - "value": "B", + "value": "A", "type": "String", - "label": "Hand brake button name", + "label": "Jump button name", "group": "Controls", - "name": "HandBrakeButton" + "name": "JumpButton" } ], "sharedPropertyDescriptors": [] @@ -13382,7 +11057,6 @@ "fullName": "Top-down multitouch controller mapper", "name": "TopDownMultitouchMapper", "objectType": "", - "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -13395,10 +11069,11 @@ "conditions": [ { "type": { - "value": "StringVariable" + "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" }, "parameters": [ - "StickMode", + "Object", + "Behavior", "=", "\"Analog\"" ] @@ -13423,10 +11098,11 @@ "conditions": [ { "type": { - "value": "StringVariable" + "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" }, "parameters": [ - "StickMode", + "Object", + "Behavior", "=", "\"360°\"" ] @@ -13451,10 +11127,11 @@ "conditions": [ { "type": { - "value": "StringVariable" + "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" }, "parameters": [ - "StickMode", + "Object", + "Behavior", "=", "\"8 Directions\"" ] @@ -14063,6 +11740,7 @@ } ], "instances": [], + "editionSettings": {}, "eventsFunctions": [ { "fullName": "", @@ -14181,90 +11859,17 @@ "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "conditions": [], + "actions": [ { "type": { - "inverted": true, - "value": "SpriteMultitouchJoystick::IsInGameEdition" + "value": "MettreAutour" }, "parameters": [ - "", - "" - ] - } - ], - "actions": [], - "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" - }, - "parameters": [ - "Object", - "no", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "ShouldBeHiddenWhenReleased", - "False", - "" - ] - } + "Thumb", + "Border", + "Border.MultitouchJoystick::JoystickForce() * Border.Width() / 2", + "Border.MultitouchJoystick::JoystickAngle()" ] } ] @@ -14332,7 +11937,7 @@ "Border", "MultitouchJoystick", "=", - "ControllerIdentifier", + "Object.PropertyControllerIdentifier()", "" ] }, @@ -14344,7 +11949,7 @@ "Border", "MultitouchJoystick", "=", - "JoystickIdentifier", + "Object.PropertyJoystickIdentifier()", "" ] }, @@ -14356,92 +11961,7 @@ "Border", "MultitouchJoystick", "=", - "DeadZoneRadius", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "supplementaryInformation": "SpriteMultitouchJoystick::SpriteMultitouchJoystick", - "type": "object" - } - ], - "objectGroups": [] - }, - { - "description": "Show the joystick until it is released.", - "fullName": "Show and start pressing", - "functionType": "Action", - "name": "TeleportAndPress", - "sentence": "Show _PARAM0_ at the cursor position and start pressing", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "HasAnyTouchOrMouseStarted" - }, - "parameters": [ - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "MettreXY" - }, - "parameters": [ - "Object", - "=", - "Object.ParentTouchX(StartedTouchOrMouseId(0))", - "=", - "Object.ParentTouchY(StartedTouchOrMouseId(0))" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::ActivateControl" - }, - "parameters": [ - "Object", - "yes", - "" - ] - }, - { - "type": { - "value": "Montre" - }, - "parameters": [ - "Object", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "ShouldBeHiddenWhenReleased", - "True", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::ForceStartPressing" - }, - "parameters": [ - "Border", - "MultitouchJoystick", - "StartedTouchOrMouseId(0)", + "Object.PropertyDeadZoneRadius()", "" ] } @@ -14458,92 +11978,6 @@ ], "objectGroups": [] }, - { - "description": "Return the X position of a specified touch", - "fullName": "Touch X position (on parent)", - "functionType": "Expression", - "name": "ParentTouchX", - "private": true, - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [] - }, - { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "const object = objects[0];", - "const touchId = eventsFunctionContext.getArgument(\"TouchId\");", - "eventsFunctionContext.returnValue = gdjs.evtTools.input.getTouchX(object.getInstanceContainer(), touchId, object.getLayer());" - ], - "parameterObjects": "Object", - "useStrict": true, - "eventsSheetExpanded": false - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "supplementaryInformation": "SpriteMultitouchJoystick::SpriteMultitouchJoystick", - "type": "object" - }, - { - "description": "Touch identifier", - "name": "TouchId", - "type": "expression" - } - ], - "objectGroups": [] - }, - { - "description": "Return the X position of a specified touch", - "fullName": "Touch X position (on parent)", - "functionType": "Expression", - "name": "ParentTouchY", - "private": true, - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [] - }, - { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "const object = objects[0];", - "const touchId = eventsFunctionContext.getArgument(\"TouchId\");", - "eventsFunctionContext.returnValue = gdjs.evtTools.input.getTouchY(object.getInstanceContainer(), touchId, object.getLayer());" - ], - "parameterObjects": "Object", - "useStrict": true, - "eventsSheetExpanded": false - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "supplementaryInformation": "SpriteMultitouchJoystick::SpriteMultitouchJoystick", - "type": "object" - }, - { - "description": "Touch identifier", - "name": "TouchId", - "type": "expression" - } - ], - "objectGroups": [] - }, { "description": "De/activate control of the joystick.", "fullName": "De/activate control", @@ -14557,12 +11991,10 @@ { "type": { "inverted": true, - "value": "BooleanVariable" + "value": "GetArgumentAsBoolean" }, "parameters": [ - "ShouldActivate", - "True", - "" + "\"ShouldActivate\"" ] } ], @@ -14584,12 +12016,10 @@ "conditions": [ { "type": { - "value": "BooleanVariable" + "value": "GetArgumentAsBoolean" }, "parameters": [ - "ShouldActivate", - "True", - "" + "\"ShouldActivate\"" ] } ], @@ -15263,15 +12693,9 @@ "description": "Only used by the scene editor.", "hidden": true, "name": "ParentOrigin" - }, - { - "value": "", - "type": "Boolean", - "label": "", - "hidden": true, - "name": "ShouldBeHiddenWhenReleased" } - ] + ], + "variants": [] } ] }, diff --git a/examples/starting-3D-platformer/starting-3D-platformer.json b/examples/starting-3D-platformer/starting-3D-platformer.json index 3ac429239..377f673d6 100644 --- a/examples/starting-3D-platformer/starting-3D-platformer.json +++ b/examples/starting-3D-platformer/starting-3D-platformer.json @@ -6464,13 +6464,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.9.0", + "version": "1.8.3", "description": [ - "Multitouch joysticks are objects showing a joystick on the screen, useful for mobile. They work like a physical gamepad:", + "Multitouch joysticks can be used the same way as physical gamepads:", "- 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.", + "- 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)." ], @@ -6534,28 +6534,6 @@ } ], "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", @@ -6974,11 +6952,11 @@ "objectGroups": [] }, { - "description": "Check if a button was just pressed on a multitouch controller.", - "fullName": "Multitouch controller button just pressed", + "description": "Check if a button is pressed on a gamepad.", + "fullName": "Multitouch controller button pressed", "functionType": "Condition", - "name": "IsButtonJustPressed", - "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ was just pressed", + "name": "IsButtonPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -6990,7 +6968,7 @@ "parameters": [ "Controllers[ControllerIdentifier].Buttons[Button].State", "=", - "\"JustPressed\"" + "\"Pressed\"" ] } ], @@ -7022,73 +7000,7 @@ "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\"" - ] - } - ] - } - ], - "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.", + "description": "Check if a button is released on a gamepad.", "fullName": "Multitouch controller button released", "functionType": "Condition", "name": "IsButtonReleased", @@ -7174,7 +7086,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"JustPressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -8547,23 +8459,41 @@ "conditions": [ { "type": { - "inverted": true, - "value": "SpriteMultitouchJoystick::IsInGameEdition" + "value": "HasGameJustResumed" }, "parameters": [ - "", "" ] } ], - "actions": [], + "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": "HasGameJustResumed" + "value": "HasAnyTouchOrMouseStarted" }, "parameters": [ "" @@ -8573,207 +8503,171 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", - "" + "TouchIndex", + "=", + "0" ] } - ] - }, - { - "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" - ] - } - ], + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "StartedTouchOrMouseCount()", + "conditions": [], + "actions": [], "events": [ { - "type": "BuiltinCommonInstructions::Repeat", - "repeatExpression": "StartedTouchOrMouseCount()", - "conditions": [], - "actions": [], - "events": [ + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { - "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": "NumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "0" ] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchIndex", - "+", - "1" - ] - } + "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::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" - }, - "parameters": [ - "Object", - "Behavior", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchIndex", + "+", + "1" + ] + } ] } ] } - ], - "parameters": [] + ] }, { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Update joystick position", - "source": "", - "type": "BuiltinCommonInstructions::Group", - "events": [ + "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": "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)", - "" - ] - } + "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" ] } ], - "parameters": [] + "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": [ @@ -9648,7 +9542,7 @@ "sharedPropertyDescriptors": [] }, { - "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.", + "description": "Detect button presses made on a touchscreen.", "fullName": "Multitouch button", "name": "MultitouchButton", "objectType": "", @@ -9664,49 +9558,11 @@ "conditions": [ { "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "IsReleased", - "True", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsReleased", - "False", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + "value": "SpriteMultitouchJoystick::MultitouchButton::IsReleased" }, "parameters": [ "Object", "Behavior", - "\"Idle\"", - "" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "True", "" ] } @@ -9717,7 +9573,7 @@ "value": "SetBooleanVariable" }, "parameters": [ - "IsJustPressed", + "IsReleased", "False", "" ] @@ -9729,7 +9585,7 @@ "parameters": [ "Object", "Behavior", - "\"Pressed\"", + "\"Idle\"", "" ] } @@ -9827,17 +9683,7 @@ "parameters": [ "Object", "Behavior", - "\"JustPressed\"", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "True", + "\"Pressed\"", "" ] } @@ -9908,16 +9754,6 @@ "" ] }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "False", - "" - ] - }, { "type": { "value": "SetNumberVariable" @@ -9947,11 +9783,11 @@ "objectGroups": [] }, { - "description": "Check if the button was just pressed.", - "fullName": "Button just pressed", + "description": "Check if button is released.", + "fullName": "Button released", "functionType": "Condition", - "name": "IsJustPressed", - "sentence": "Button _PARAM0_ was just pressed", + "name": "IsReleased", + "sentence": "Button _PARAM0_ is released", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -9961,7 +9797,7 @@ "value": "BooleanVariable" }, "parameters": [ - "IsJustPressed", + "IsReleased", "True", "" ] @@ -9995,7 +9831,7 @@ "objectGroups": [] }, { - "description": "Check if the button is pressed.", + "description": "Check if button is pressed.", "fullName": "Button pressed", "functionType": "Condition", "name": "IsPressed", @@ -10042,54 +9878,6 @@ ], "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", @@ -10131,7 +9919,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"JustPressed\",\"Pressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -10172,13 +9960,6 @@ "hidden": true, "name": "IsReleased" }, - { - "value": "", - "type": "Boolean", - "label": "Button just pressed", - "hidden": true, - "name": "IsJustPressed" - }, { "value": "0", "type": "Number", @@ -12593,6 +12374,7 @@ } ], "instances": [], + "editionSettings": {}, "eventsFunctions": [ { "fullName": "", @@ -12709,92 +12491,74 @@ "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::IsInGameEdition" + "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::IsPressed" }, "parameters": [ - "", + "Object", "" ] } ], - "actions": [], - "events": [ + "actions": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "MettreAutour" - }, - "parameters": [ - "Thumb", - "Border", - "Border.MultitouchJoystick::JoystickForce() * Border.Width() / 2", - "Border.MultitouchJoystick::JoystickAngle()" - ] - } + "type": { + "value": "Cache" + }, + "parameters": [ + "Object" ] }, { - "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", - "" - ] - } + "type": { + "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::ActivateControl" + }, + "parameters": [ + "Object", + "no", + "" + ] + }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "ShouldBeHiddenWhenReleased", + "False", + "" ] } ] @@ -13801,7 +13565,8 @@ "hidden": true, "name": "ShouldBeHiddenWhenReleased" } - ] + ], + "variants": [] } ] }, diff --git a/examples/starting-3d-car-racing/starting-3d-car-racing.json b/examples/starting-3d-car-racing/starting-3d-car-racing.json index 5a3fae886..26eecc443 100644 --- a/examples/starting-3d-car-racing/starting-3d-car-racing.json +++ b/examples/starting-3d-car-racing/starting-3d-car-racing.json @@ -4352,13 +4352,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.9.0", + "version": "1.8.2", "description": [ - "Multitouch joysticks are objects showing a joystick on the screen, useful for mobile. They work like a physical gamepad:", + "Multitouch joysticks can be used the same way as physical gamepads:", "- 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.", + "- 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)." ], @@ -4422,28 +4422,6 @@ } ], "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", @@ -4862,11 +4840,11 @@ "objectGroups": [] }, { - "description": "Check if a button was just pressed on a multitouch controller.", - "fullName": "Multitouch controller button just pressed", + "description": "Check if a button is pressed on a gamepad.", + "fullName": "Multitouch controller button pressed", "functionType": "Condition", - "name": "IsButtonJustPressed", - "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ was just pressed", + "name": "IsButtonPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -4878,7 +4856,7 @@ "parameters": [ "Controllers[ControllerIdentifier].Buttons[Button].State", "=", - "\"JustPressed\"" + "\"Pressed\"" ] } ], @@ -4910,73 +4888,7 @@ "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\"" - ] - } - ] - } - ], - "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.", + "description": "Check if a button is released on a gamepad.", "fullName": "Multitouch controller button released", "functionType": "Condition", "name": "IsButtonReleased", @@ -5062,7 +4974,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"JustPressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -6435,23 +6347,41 @@ "conditions": [ { "type": { - "inverted": true, - "value": "SpriteMultitouchJoystick::IsInGameEdition" + "value": "HasGameJustResumed" }, "parameters": [ - "", "" ] } ], - "actions": [], + "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": "HasGameJustResumed" + "value": "HasAnyTouchOrMouseStarted" }, "parameters": [ "" @@ -6461,207 +6391,171 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", - "" + "TouchIndex", + "=", + "0" ] } - ] - }, - { - "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" - ] - } - ], + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "StartedTouchOrMouseCount()", + "conditions": [], + "actions": [], "events": [ { - "type": "BuiltinCommonInstructions::Repeat", - "repeatExpression": "StartedTouchOrMouseCount()", - "conditions": [], - "actions": [], - "events": [ + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { - "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": "NumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "0" ] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchIndex", - "+", - "1" - ] - } + "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)" + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 + "type": { + "value": "HasTouchEnded" }, - "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" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - } + "parameters": [ + "", + "TouchId" ] } ], - "parameters": [] - }, + "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": [ { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Update joystick position", - "source": "", - "type": "BuiltinCommonInstructions::Group", - "events": [ + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { - "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)", - "" - ] - } + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "!=", + "0" ] } ], - "parameters": [] + "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": [ @@ -7536,7 +7430,7 @@ "sharedPropertyDescriptors": [] }, { - "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.", + "description": "Detect button presses made on a touchscreen.", "fullName": "Multitouch button", "name": "MultitouchButton", "objectType": "", @@ -7552,49 +7446,11 @@ "conditions": [ { "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "IsReleased", - "True", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsReleased", - "False", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + "value": "SpriteMultitouchJoystick::MultitouchButton::IsReleased" }, "parameters": [ "Object", "Behavior", - "\"Idle\"", - "" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "True", "" ] } @@ -7605,7 +7461,7 @@ "value": "SetBooleanVariable" }, "parameters": [ - "IsJustPressed", + "IsReleased", "False", "" ] @@ -7617,7 +7473,7 @@ "parameters": [ "Object", "Behavior", - "\"Pressed\"", + "\"Idle\"", "" ] } @@ -7686,10 +7542,11 @@ }, { "type": { - "value": "NumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchButton::PropertyRadius" }, "parameters": [ - "Radius", + "Object", + "Behavior", ">", "DistanceBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer()), TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer()))" ] @@ -7715,17 +7572,7 @@ "parameters": [ "Object", "Behavior", - "\"JustPressed\"", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "True", + "\"Pressed\"", "" ] } @@ -7796,16 +7643,6 @@ "" ] }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "False", - "" - ] - }, { "type": { "value": "SetNumberVariable" @@ -7835,11 +7672,11 @@ "objectGroups": [] }, { - "description": "Check if the button was just pressed.", - "fullName": "Button just pressed", + "description": "Check if button is released.", + "fullName": "Button released", "functionType": "Condition", - "name": "IsJustPressed", - "sentence": "Button _PARAM0_ was just pressed", + "name": "IsReleased", + "sentence": "Button _PARAM0_ is released", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -7849,7 +7686,7 @@ "value": "BooleanVariable" }, "parameters": [ - "IsJustPressed", + "IsReleased", "True", "" ] @@ -7883,7 +7720,7 @@ "objectGroups": [] }, { - "description": "Check if the button is pressed.", + "description": "Check if button is pressed.", "fullName": "Button pressed", "functionType": "Condition", "name": "IsPressed", @@ -7930,54 +7767,6 @@ ], "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", @@ -8019,7 +7808,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"JustPressed\",\"Pressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -8060,13 +7849,6 @@ "hidden": true, "name": "IsReleased" }, - { - "value": "", - "type": "Boolean", - "label": "Button just pressed", - "hidden": true, - "name": "IsJustPressed" - }, { "value": "0", "type": "Number", @@ -10481,6 +10263,7 @@ } ], "instances": [], + "editionSettings": {}, "eventsFunctions": [ { "fullName": "", @@ -10597,92 +10380,74 @@ "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::IsInGameEdition" + "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::IsPressed" }, "parameters": [ - "", + "Object", "" ] } ], - "actions": [], - "events": [ + "actions": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "MettreAutour" - }, - "parameters": [ - "Thumb", - "Border", - "Border.MultitouchJoystick::JoystickForce() * Border.Width() / 2", - "Border.MultitouchJoystick::JoystickAngle()" - ] - } + "type": { + "value": "Cache" + }, + "parameters": [ + "Object" ] }, { - "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", - "" - ] - } + "type": { + "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::ActivateControl" + }, + "parameters": [ + "Object", + "no", + "" + ] + }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "ShouldBeHiddenWhenReleased", + "False", + "" ] } ] @@ -11689,7 +11454,8 @@ "hidden": true, "name": "ShouldBeHiddenWhenReleased" } - ] + ], + "variants": [] } ] }, diff --git a/examples/starting-3d-draggable-tiles/starting-3d-draggable-tiles.json b/examples/starting-3d-draggable-tiles/starting-3d-draggable-tiles.json index b90d6ae09..b7c11659a 100644 --- a/examples/starting-3d-draggable-tiles/starting-3d-draggable-tiles.json +++ b/examples/starting-3d-draggable-tiles/starting-3d-draggable-tiles.json @@ -1050,19 +1050,19 @@ "category": "Input", "extensionNamespace": "", "fullName": "Multitouch joystick and buttons (sprite)", - "gdevelopVersion": ">=5.5.222", + "gdevelopVersion": "", "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", + "version": "1.4.0", "description": [ - "Multitouch joysticks are objects showing a joystick on the screen, useful for mobile. They work like a physical gamepad:", + "Multitouch joysticks can be used the same way as physical gamepads:", "- 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.", + "- 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)." ], @@ -1127,33 +1127,108 @@ ], "eventsFunctions": [ { - "description": "Check if the events are running for the editor.", - "fullName": "Editor is running", + "description": "Check if a button is pressed on a gamepad.", + "fullName": "Multitouch controller button pressed", "functionType": "Condition", - "name": "IsInGameEdition", - "private": true, - "sentence": "Events are running for the editor", + "name": "IsButtonPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", "events": [ { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "const game = runtimeScene.getGame();\r", - "eventsFunctionContext.returnValue = game.isInGameEdition && game.isInGameEdition();" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"Pressed\"" + ] + } ], - "parameterObjects": "", - "useStrict": true, - "eventsSheetExpanded": false + "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" } ], - "parameters": [], "objectGroups": [] }, { - "fullName": "Accelerated speed", - "functionType": "Expression", - "name": "AcceleratedSpeed", + "description": "Check if a button is released on a gamepad.", + "fullName": "Multitouch controller button released", + "functionType": "Condition", + "name": "IsButtonReleased", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is released", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"Released\"" + ] + } + ], + "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": "Change a button state for a multitouch controller.", + "fullName": "Button state", + "functionType": "Action", + "name": "SetButtonState", "private": true, - "sentence": "", + "sentence": "Mark _PARAM2_ button as _PARAM3_ for multitouch controller _PARAM1_", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -1161,443 +1236,108 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SetStringVariable" }, "parameters": [ - "AcceleratedSpeed", + "Controllers[ControllerIdentifier].Buttons[Button].State", "=", - "CurrentSpeed" + "ButtonState" ] } - ], - "events": [ + ] + } + ], + "parameters": [ + { + "description": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier", + "type": "expression" + }, + { + "description": "Button name", + "name": "Button", + "type": "string" + }, + { + "description": "Button state", + "name": "ButtonState", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "type": "stringWithSelector" + } + ], + "objectGroups": [] + }, + { + "description": "Change the dead zone radius of a joystick. 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).", + "fullName": "Dead zone radius", + "functionType": "Action", + "name": "SetDeadZone", + "private": true, + "sentence": "Change the dead zone of multitouch joystick _PARAM2_ of multitouch controller _PARAM1_ to _PARAM3_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ { - "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", - "=", - "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": { + "value": "SetNumberVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].DeadZone", + "=", + "DeadZoneRadius" ] - }, - { - "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": "NumberVariable" - }, - "parameters": [ - "TargetedSpeed", - "=", - "0" - ] - } - ], - "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", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "clamp(AcceleratedSpeed, -SpeedMax, SpeedMax)" - ] - } - ] - } - ], - "variables": [ - { - "name": "AcceleratedSpeed", - "type": "number", - "value": 0 } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { - "description": "Current speed", - "name": "CurrentSpeed", - "type": "expression" - }, - { - "description": "Targeted speed", - "name": "TargetedSpeed", - "type": "expression" - }, - { - "description": "Max speed", - "name": "SpeedMax", + "description": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier", "type": "expression" }, { - "description": "Acceleration", - "name": "Acceleration", - "type": "expression" + "description": "Joystick name", + "name": "JoystickIdentifier", + "type": "string" }, { - "description": "Deceleration", - "name": "Deceleration", + "description": "Dead zone radius", + "name": "DeadZoneRadius", + "supplementaryInformation": "[]", "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", + "description": "Return the dead zone radius of a joystick. 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).", + "fullName": "Dead zone radius", + "functionType": "Expression", + "name": "DeadZone", + "private": true, + "sentence": "Change multitouch joystick _PARAM2_ of multitouch controller _PARAM1_ dead zone to _PARAM3_", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Buttons[Button].State", - "=", - "\"JustPressed\"" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "SetReturnBoolean" + "value": "SetReturnNumber" }, "parameters": [ - "True" + "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].DeadZone" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Multitouch controller identifier (1, 2, 3, 4...)", @@ -1605,288 +1345,43 @@ "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\"]", + "description": "Joystick name", + "name": "JoystickIdentifier", "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", + "description": "the direction index (left = 1, bottom = 1, right = 2, top = 3) for an angle (in degrees).", + "fullName": "Angle to 4-way index", + "functionType": "ExpressionAndCondition", + "name": "AngleTo4Way", + "private": true, + "sentence": "The angle _PARAM1_ 4-way index", "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\"" - ] - } - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "SetReturnBoolean" + "value": "SetReturnNumber" }, "parameters": [ - "True" + "mod(round(Angle * 4 / 360), 4)" ] } ] } ], + "expressionType": { + "type": "expression" + }, "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", - "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is released", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Buttons[Button].State", - "=", - "\"Released\"" - ] - } - ], - "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": "Change a button state for a multitouch controller.", - "fullName": "Button state", - "functionType": "Action", - "name": "SetButtonState", - "private": true, - "sentence": "Mark _PARAM2_ button as _PARAM3_ for multitouch controller _PARAM1_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetStringVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Buttons[Button].State", - "=", - "ButtonState" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" - }, - { - "description": "Button name", - "name": "Button", - "type": "string" - }, - { - "description": "Button state", - "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"JustPressed\",\"Released\"]", - "type": "stringWithSelector" - } - ], - "objectGroups": [] - }, - { - "description": "Change the dead zone radius of a joystick. 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).", - "fullName": "Dead zone radius", - "functionType": "Action", - "name": "SetDeadZone", - "private": true, - "sentence": "Change the dead zone of multitouch joystick _PARAM2_ of multitouch controller _PARAM1_ to _PARAM3_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].DeadZone", - "=", - "DeadZoneRadius" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" - }, - { - "description": "Joystick name", - "name": "JoystickIdentifier", - "type": "string" - }, - { - "description": "Dead zone radius", - "name": "DeadZoneRadius", - "supplementaryInformation": "[]", - "type": "expression" - } - ], - "objectGroups": [] - }, - { - "description": "Return the dead zone radius of a joystick. 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).", - "fullName": "Dead zone radius", - "functionType": "Expression", - "name": "DeadZone", - "private": true, - "sentence": "Change multitouch joystick _PARAM2_ of multitouch controller _PARAM1_ dead zone to _PARAM3_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].DeadZone" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" - }, - { - "description": "Joystick name", - "name": "JoystickIdentifier", - "type": "string" - } - ], - "objectGroups": [] - }, - { - "description": "the direction index (left = 1, bottom = 1, right = 2, top = 3) for an angle (in degrees).", - "fullName": "Angle to 4-way index", - "functionType": "ExpressionAndCondition", - "name": "AngleTo4Way", - "private": true, - "sentence": "The angle _PARAM1_ 4-way index", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "mod(round(Angle * 4 / 360), 4)" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Angle", - "name": "Angle", + "description": "Angle", + "name": "Angle", "type": "expression" } ], @@ -2616,11 +2111,6 @@ "name": "JoystickIdentifier", "supplementaryInformation": "[\"Primary\",\"Secondary\"]", "type": "stringWithSelector" - }, - { - "description": "", - "name": "Coucou", - "type": "expression" } ], "objectGroups": [] @@ -2850,7 +2340,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "XFromAngleAndDistance(SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier), SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier))" + "SpriteMultitouchJoystick::JoystickForce(ControllerIdentifier, JoystickIdentifier) * cos(ToRad(SpriteMultitouchJoystick::JoystickAngle(ControllerIdentifier, JoystickIdentifier)))" ] } ] @@ -2890,7 +2380,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "YFromAngleAndDistance(SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier), SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier))" + "SpriteMultitouchJoystick::JoystickForce(ControllerIdentifier, JoystickIdentifier) * sin(ToRad(SpriteMultitouchJoystick::JoystickAngle(ControllerIdentifier, JoystickIdentifier)))" ] } ] @@ -2913,2032 +2403,84 @@ } ], "objectGroups": [] - }, + } + ], + "eventsBasedBehaviors": [ { - "description": "Check if a new touch has started on the right or left side of the screen.", - "fullName": "New touch on a screen side", - "functionType": "Condition", - "group": "Multitouch Joystick", - "name": "HasTouchStartedOnScreenSide", - "sentence": "A new touch has started on the _PARAM2_ side of the screen on _PARAM1_'s layer", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "HasAnyTouchOrMouseStarted" - }, - "parameters": [ - "" - ] - } - ], - "actions": [], - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "Side", - "=", - "\"Left\"" - ] - }, - { - "type": { - "value": "TouchX" - }, - "parameters": [ - "", - "StartedTouchOrMouseId(0)", - "<", - "CameraCenterX(Object.Layer())", - "Object.Layer()", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "Side", - "=", - "\"Right\"" - ] - }, - { - "type": { - "value": "TouchX" - }, - "parameters": [ - "", - "StartedTouchOrMouseId(0)", - ">=", - "CameraCenterX(Object.Layer())", - "Object.Layer()", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - } - ] - } - ], - "parameters": [ - { - "description": "Multitouch joystick", - "name": "Object", - "supplementaryInformation": "SpriteMultitouchJoystick::SpriteMultitouchJoystick", - "type": "objectList" - }, - { - "description": "Screen side", - "name": "Side", - "supplementaryInformation": "[\"Left\",\"Right\"]", - "type": "stringWithSelector" - } - ], - "objectGroups": [] - } - ], - "eventsBasedBehaviors": [ - { - "description": "Joystick that can be controlled by interacting with a touchscreen.", - "fullName": "Multitouch Joystick", - "name": "MultitouchJoystick", - "objectType": "", - "private": true, - "eventsFunctions": [ - { - "fullName": "", - "functionType": "Action", - "name": "onCreated", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::SetDeadZone" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "DeadZoneRadius", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "Action", - "name": "onDeActivate", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "Action", - "name": "doStepPreEvents", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "inverted": true, - "value": "SpriteMultitouchJoystick::IsInGameEdition" - }, - "parameters": [ - "", - "" - ] - } - ], - "actions": [], - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "HasGameJustResumed" - }, - "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)" - }, - { - "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": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "the joystick force (from 0 to 1).", - "fullName": "Joystick force", - "functionType": "ExpressionAndCondition", - "name": "JoystickForce", - "sentence": "the joystick force", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "max(0, JoystickForce - DeadZoneRadius) / (1 - DeadZoneRadius)" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "JoystickForce", - "name": "SetJoystickForce", - "private": true, - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "JoystickForce", - "=", - "Value" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::SetJoystickForce" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "JoystickForce", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - }, - { - "description": "", - "name": "Parameter", - "type": "objectList" - } - ], - "objectGroups": [] - }, - { - "description": "Return the angle the joystick is pointing towards (Range: -180 to 180).", - "fullName": "Joystick angle", - "functionType": "Expression", - "name": "JoystickAngle", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "JoystickAngle" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "Change the angle the joystick is pointing towards (Range: -180 to 180).", - "fullName": "Joystick angle", - "functionType": "Action", - "name": "SetJoystickAngle", - "private": true, - "sentence": "Change the joystick angle of _PARAM0_ to _PARAM2_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "JoystickAngle", - "=", - "Value" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::SetJoystickAngle" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "JoystickAngle", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - }, - { - "description": "Angle", - "name": "Value", - "type": "expression" - } - ], - "objectGroups": [] - }, - { - "description": "Return the stick force on X axis (from -1 at the left to 1 at the right).", - "fullName": "Stick X force", - "functionType": "Expression", - "name": "StickForceX", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "Object.Behavior::JoystickForce() * cos(ToRad(Object.Behavior::JoystickAngle()))" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "Return the stick force on Y axis (from -1 at the top to 1 at the bottom).", - "fullName": "Stick Y force", - "functionType": "Expression", - "name": "StickForceY", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "Object.Behavior::JoystickForce() * sin(ToRad(Object.Behavior::JoystickAngle()))" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "Check if joystick is pushed in a given direction.", - "fullName": "Joystick pushed in a direction (4-way movement)", - "functionType": "Condition", - "name": "IsDirectionPushed4Way", - "sentence": "_PARAM0_ is pushed in direction _PARAM2_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::JoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - ">", - "0", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::IsAngleIn4WayDirection" - }, - "parameters": [ - "", - "JoystickAngle", - "Direction", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - }, - { - "description": "Direction", - "name": "Direction", - "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\"]", - "type": "stringWithSelector" - } - ], - "objectGroups": [] - }, - { - "description": "Check if joystick is pushed in a given direction.", - "fullName": "Joystick pushed in a direction (8-way movement)", - "functionType": "Condition", - "name": "IsDirectionPushed8Way", - "sentence": "_PARAM0_ is pushed in direction _PARAM2_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::JoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - ">", - "0", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::IsAngleIn8WayDirection" - }, - "parameters": [ - "", - "JoystickAngle", - "Direction", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - }, - { - "description": "Direction", - "name": "Direction", - "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\",\"UpLeft\",\"UpRight\",\"DownLeft\",\"DownRight\"]", - "type": "stringWithSelector" - } - ], - "objectGroups": [] - }, - { - "description": "Check if a joystick is pressed.", - "fullName": "Joystick pressed", - "functionType": "Condition", - "name": "IsPressed", - "sentence": "Joystick _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::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "Reset the joystick values (except for angle, which stays the same)", - "fullName": "Reset", - "functionType": "Action", - "name": "Reset", - "private": true, - "sentence": "Reset the joystick of _PARAM0_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "0", - "" - ] - }, - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "0" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "the multitouch controller identifier.", - "fullName": "Multitouch controller identifier", - "functionType": "ExpressionAndCondition", - "group": "Multitouch Joystick configuration", - "name": "ControllerIdentifier", - "sentence": "the multitouch controller identifier", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "ControllerIdentifier" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "ControllerIdentifier", - "name": "SetControllerIdentifier", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "ControllerIdentifier", - "=", - "Value" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "the joystick name.", - "fullName": "Joystick name", - "functionType": "ExpressionAndCondition", - "group": "Multitouch Joystick configuration", - "name": "JoystickIdentifier", - "sentence": "the joystick name", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnString" - }, - "parameters": [ - "JoystickIdentifier" - ] - } - ] - } - ], - "expressionType": { - "type": "string" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "JoystickIdentifier", - "name": "SetJoystickIdentifier", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetStringVariable" - }, - "parameters": [ - "JoystickIdentifier", - "=", - "Value" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "the dead zone radius (range: 0 to 1) of the joystick. 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).", - "fullName": "Dead zone radius", - "functionType": "ExpressionAndCondition", - "group": "Multitouch Joystick configuration", - "name": "DeadZoneRadius", - "sentence": "the dead zone radius", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "DeadZoneRadius" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "DeadZoneRadius", - "name": "SetDeadZoneRadius", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "DeadZoneRadius", - "=", - "Value" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::SetDeadZone" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "Value", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "Force the joystick into the pressing state.", - "fullName": "Force start pressing", - "functionType": "Action", - "name": "ForceStartPressing", - "sentence": "Force start pressing _PARAM0_ with touch identifier: _PARAM2_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "Value" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - }, - { - "description": "Touch identifier", - "name": "Value", - "type": "expression" - } - ], - "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "1", - "type": "Number", - "label": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier" - }, - { - "value": "Primary", - "type": "String", - "label": "Joystick name", - "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": "0", - "type": "Number", - "label": "Joystick angle (range: -180 to 180)", - "hidden": true, - "name": "JoystickAngle" - }, - { - "value": "0", - "type": "Number", - "label": "Joystick force (range: 0 to 1)", - "hidden": true, - "name": "JoystickForce" - }, - { - "value": "0", - "type": "Number", - "label": "", - "hidden": true, - "name": "TouchId" - }, - { - "value": "", - "type": "Number", - "label": "", - "hidden": true, - "name": "TouchIndex" - } - ], - "sharedPropertyDescriptors": [] - }, - { - "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": "", - "eventsFunctions": [ - { - "fullName": "", - "functionType": "Action", - "name": "doStepPreEvents", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "IsReleased", - "True", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsReleased", - "False", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" - }, - "parameters": [ - "Object", - "Behavior", - "\"Idle\"", - "" - ] - } - ] - }, - { - "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": [ - { - "type": { - "inverted": true, - "value": "SpriteMultitouchJoystick::MultitouchButton::IsPressed" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - }, - { - "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": "BuiltinCommonInstructions::Or" - }, - "parameters": [], - "subInstructions": [ - { - "type": { - "value": "CollisionPoint" - }, - "parameters": [ - "Object", - "TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer())", - "TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer())" - ] - }, - { - "type": { - "value": "NumberVariable" - }, - "parameters": [ - "Radius", - ">", - "DistanceBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer()), TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer()))" - ] - } - ] - } - ], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "StartedTouchOrMouseId(TouchIndex)" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" - }, - "parameters": [ - "Object", - "Behavior", - "\"JustPressed\"", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "True", - "" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchIndex", - "+", - "1" - ] - } - ] - } - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::IsPressed" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - }, - { - "type": { - "value": "HasTouchEnded" - }, - "parameters": [ - "", - "TouchId" - ] - } - ], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" - }, - "parameters": [ - "Object", - "Behavior", - "\"Released\"", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsReleased", - "True", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "False", - "" - ] - }, - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "0" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "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", - "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", - "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": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", - "type": "behavior" - }, - { - "description": "Button state", - "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"JustPressed\",\"Pressed\",\"Released\"]", - "type": "stringWithSelector" - } - ], - "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "1", - "type": "Number", - "label": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier" - }, - { - "value": "A", - "type": "String", - "label": "Button identifier", - "name": "ButtonIdentifier" - }, - { - "value": "0", - "type": "Number", - "label": "TouchID", - "hidden": true, - "name": "TouchId" - }, - { - "value": "", - "type": "Number", - "label": "", - "hidden": true, - "name": "TouchIndex" - }, - { - "value": "", - "type": "Boolean", - "label": "Button released", - "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.", - "name": "Radius" - } - ], - "sharedPropertyDescriptors": [] - }, - { - "description": "Control a platformer character with a multitouch controller.", - "fullName": "Platformer multitouch controller mapper", - "name": "PlatformerMultitouchMapper", - "objectType": "", - "quickCustomizationVisibility": "hidden", - "eventsFunctions": [ + "description": "Joystick that can be controlled by interacting with a touchscreen.", + "fullName": "Multitouch Joystick", + "name": "MultitouchJoystick", + "objectType": "", + "private": true, + "eventsFunctions": [ { "fullName": "", "functionType": "Action", - "name": "doStepPreEvents", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "\"Left\"", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateLeftKey" - }, - "parameters": [ - "Object", - "Property" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "\"Right\"", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateRightKey" - }, - "parameters": [ - "Object", - "Property" - ] - } - ] - }, + "name": "onCreated", + "sentence": "", + "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "conditions": [], + "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" + "value": "SpriteMultitouchJoystick::SetDeadZone" }, "parameters": [ "", "ControllerIdentifier", "JoystickIdentifier", - "\"Up\"", + "DeadZoneRadius", "" ] - } - ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateUpKey" - }, - "parameters": [ - "Object", - "Property" - ] }, { "type": { - "value": "PlatformBehavior::SimulateLadderKey" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" }, "parameters": [ "Object", - "Property" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "\"Down\"", + "Behavior", "" ] } - ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateDownKey" - }, - "parameters": [ - "Object", - "Property" - ] - } ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "Action", + "name": "onDeActivate", + "sentence": "", + "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::IsButtonPressed" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JumpButton", - "\"Down\"" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "PlatformBehavior::SimulateJumpKey" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" }, "parameters": [ "Object", - "Property" + "Behavior", + "" ] } ] @@ -4953,64 +2495,12 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::PlatformerMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "", - "type": "Behavior", - "label": "Platform character behavior", - "extraInformation": [ - "PlatformBehavior::PlatformerObjectBehavior" - ], - "choices": [], - "name": "Property" - }, - { - "value": "1", - "type": "Number", - "label": "Controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier" - }, - { - "value": "Primary", - "type": "Choice", - "label": "Joystick name", - "group": "Controls", - "choices": [ - { - "label": "Primary", - "value": "Primary" - }, - { - "label": "Secondary", - "value": "Secondary" - } - ], - "name": "JoystickIdentifier" }, - { - "value": "A", - "type": "String", - "label": "Jump button name", - "group": "Controls", - "name": "JumpButton" - } - ], - "sharedPropertyDescriptors": [] - }, - { - "description": "Control a 3D physics character with a multitouch controller.", - "fullName": "3D platformer multitouch controller mapper", - "name": "Platformer3DMultitouchMapper", - "objectType": "", - "quickCustomizationVisibility": "hidden", - "eventsFunctions": [ { "fullName": "", "functionType": "Action", @@ -5022,14 +2512,9 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::StickForce" + "value": "HasGameJustResumed" }, "parameters": [ - "", - ">", - "0", - "ControllerIdentifier", - "JoystickIdentifier", "" ] } @@ -5037,54 +2522,210 @@ "actions": [ { "type": { - "value": "Physics3D::PhysicsCharacter3D::SetForwardAngle" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" }, "parameters": [ "Object", - "PhysicsCharacter3D", - "=", - "SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier) + CameraAngle(Object.Layer())" + "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": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyTouchIndex" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "0" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "StartedTouchOrMouseCount()", + "conditions": [], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::PropertyTouchId" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "0" + ] + }, + { + "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": { - "value": "Physics3D::PhysicsCharacter3D::SimulateStick" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 }, - "parameters": [ - "Object", - "PhysicsCharacter3D", - "-90", - "SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier)" + "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" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } ] } - ] + ], + "parameters": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Update joystick position", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::IsButtonPressed" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JumpButton", - "\"Down\"" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::PropertyTouchId" + }, + "parameters": [ + "Object", + "Behavior", + "!=", + "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": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" - }, - "parameters": [ - "Object", - "PhysicsCharacter3D" - ] - } - ] + "parameters": [] } ], "parameters": [ @@ -5096,129 +2737,37 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::Platformer3DMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "", - "type": "Behavior", - "label": "3D physics character", - "extraInformation": [ - "Physics3D::PhysicsCharacter3D" - ], - "choices": [], - "name": "PhysicsCharacter3D" }, { - "value": "1", - "type": "Number", - "label": "Controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier" - }, - { - "value": "Primary", - "type": "Choice", - "label": "Walk joystick", - "group": "Controls", - "choices": [ - { - "label": "Primary", - "value": "Primary" - }, - { - "label": "Secondary", - "value": "Secondary" - } - ], - "name": "JoystickIdentifier" - }, - { - "value": "A", - "type": "String", - "label": "Jump button name", - "group": "Controls", - "name": "JumpButton" - } - ], - "sharedPropertyDescriptors": [] - }, - { - "description": "Control a 3D physics character with a multitouch controller.", - "fullName": "3D shooter multitouch controller mapper", - "name": "Shooter3DMultitouchMapper", - "objectType": "", - "quickCustomizationVisibility": "hidden", - "eventsFunctions": [ - { - "fullName": "", - "functionType": "Action", - "name": "doStepPreEvents", - "sentence": "", + "description": "the joystick force (from 0 to 1).", + "fullName": "Joystick force", + "functionType": "ExpressionAndCondition", + "name": "JoystickForce", + "sentence": "the joystick force", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::StickForce" - }, - "parameters": [ - "", - ">", - "0", - "ControllerIdentifier", - "JoystickIdentifier", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateStick" - }, - "parameters": [ - "Object", - "PhysicsCharacter3D", - "SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier)", - "SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier)" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::IsButtonPressed" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JumpButton", - "\"Down\"" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" + "value": "SetReturnNumber" }, "parameters": [ - "Object", - "PhysicsCharacter3D" + "max(0, JoystickForce - DeadZoneRadius) / (1 - DeadZoneRadius)" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -5228,151 +2777,90 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::Shooter3DMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "", - "type": "Behavior", - "label": "3D physics character", - "extraInformation": [ - "Physics3D::PhysicsCharacter3D" - ], - "choices": [], - "name": "PhysicsCharacter3D" - }, - { - "value": "1", - "type": "Number", - "label": "Controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier" - }, - { - "value": "Primary", - "type": "Choice", - "label": "Walk joystick", - "group": "Controls", - "choices": [ - { - "label": "Primary", - "value": "Primary" - }, - { - "label": "Secondary", - "value": "Secondary" - } - ], - "name": "JoystickIdentifier" }, - { - "value": "A", - "type": "String", - "label": "Jump button name", - "group": "Controls", - "name": "JumpButton" - } - ], - "sharedPropertyDescriptors": [] - }, - { - "description": "Control camera rotations with a multitouch controller.", - "fullName": "First person camera multitouch controller mapper", - "name": "FirstPersonMultitouchMapper", - "objectType": "", - "quickCustomizationVisibility": "hidden", - "eventsFunctions": [ { "fullName": "", - "functionType": "Action", - "name": "doStepPreEvents", + "functionType": "ActionWithOperator", + "getterName": "JoystickForce", + "name": "SetJoystickForce", + "private": true, "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", - "=", - "SpriteMultitouchJoystick::AcceleratedSpeed(CurrentRotationSpeedZ, SpriteMultitouchJoystick::StickForceX(ControllerIdentifier, CameraStick) * HorizontalRotationSpeedMax, HorizontalRotationSpeedMax, HorizontalRotationAcceleration, HorizontalRotationDeceleration)" - ] - }, - { - "type": { - "value": "SetAngle" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickForce" }, "parameters": [ "Object", - "+", - "CurrentRotationSpeedZ * TimeDelta()" - ] - }, - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "CurrentRotationSpeedY", + "Behavior", "=", - "SpriteMultitouchJoystick::AcceleratedSpeed(CurrentRotationSpeedY, SpriteMultitouchJoystick::StickForceY(ControllerIdentifier, CameraStick) * VerticalRotationSpeedMax, VerticalRotationSpeedMax, VerticalRotationAcceleration, VerticalRotationDeceleration)" - ] - }, - { - "type": { - "value": "Scene3D::Base3DBehavior::SetRotationY" - }, - "parameters": [ - "Object", - "Object3D", - "+", - "CurrentRotationSpeedY * TimeDelta()" + "Value" ] }, { "type": { - "value": "Scene3D::Base3DBehavior::SetRotationY" + "value": "SpriteMultitouchJoystick::SetJoystickForce" }, "parameters": [ - "Object", - "Object3D", - "=", - "clamp(Object.Object3D::RotationY(), VerticalAngleMin, VerticalAngleMax)" + "", + "ControllerIdentifier", + "JoystickIdentifier", + "JoystickForce", + "" ] - }, + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Return the angle the joystick is pointing towards (Range: -180 to 180).", + "fullName": "Joystick angle", + "functionType": "Expression", + "name": "JoystickAngle", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper::LookFromObjectEyes" + "value": "SetReturnNumber" }, "parameters": [ - "Object", - "Behavior", - "" + "JoystickAngle" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -5382,20 +2870,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "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", + "description": "Change the angle the joystick is pointing towards (Range: -180 to 180).", + "fullName": "Joystick angle", "functionType": "Action", - "group": "Layers and cameras", - "name": "LookFromObjectEyes", + "name": "SetJoystickAngle", "private": true, - "sentence": "Move the camera to look though _PARAM0_ eyes", + "sentence": "Change the joystick angle of _PARAM0_ to _PARAM2_", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -5403,61 +2890,24 @@ "actions": [ { "type": { - "value": "CentreCamera" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickAngle" }, "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": [ - "", + "Behavior", "=", - "Object.Object3D::RotationX()", - "GetArgumentAsString(\"Layer\")", - "" + "Value" ] }, { "type": { - "value": "SetCameraAngle" + "value": "SpriteMultitouchJoystick::SetJoystickAngle" }, "parameters": [ "", - "=", - "Object.Angle() + 90", - "Object.Layer()", + "ControllerIdentifier", + "JoystickIdentifier", + "JoystickAngle", "" ] } @@ -5473,19 +2923,23 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" + }, + { + "description": "Angle", + "name": "Value", + "type": "expression" } ], "objectGroups": [] }, { - "description": "the maximum horizontal rotation speed of the object.", - "fullName": "Maximum horizontal rotation speed", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper horizontal rotation configuration", - "name": "HorizontalRotationSpeedMax", - "sentence": "the maximum horizontal rotation speed", + "description": "Return the stick force on X axis (from -1 at the left to 1 at the right).", + "fullName": "Stick X force", + "functionType": "Expression", + "name": "StickForceX", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -5496,7 +2950,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "HorizontalRotationSpeedMax" + "Object.Behavior::JoystickForce() * cos(ToRad(Object.Behavior::JoystickAngle()))" ] } ] @@ -5514,17 +2968,17 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] }, { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "HorizontalRotationSpeedMax", - "name": "SetHorizontalRotationSpeedMax", + "description": "Return the stick force on Y axis (from -1 at the top to 1 at the bottom).", + "fullName": "Stick Y force", + "functionType": "Expression", + "name": "StickForceY", "sentence": "", "events": [ { @@ -5533,17 +2987,18 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SetReturnNumber" }, "parameters": [ - "HorizontalRotationSpeedMax", - "=", - "Value" + "Object.Behavior::JoystickForce() * sin(ToRad(Object.Behavior::JoystickAngle()))" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -5553,38 +3008,58 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the horizontal rotation acceleration of the object.", - "fullName": "Horizontal rotation acceleration", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper horizontal rotation configuration", - "name": "HorizontalRotationAcceleration", - "sentence": "the horizontal rotation acceleration", + "description": "Check if joystick is pushed in a given direction.", + "fullName": "Joystick pushed in a direction (4-way movement)", + "functionType": "Condition", + "name": "IsDirectionPushed4Way", + "sentence": "_PARAM0_ is pushed in direction _PARAM2_", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::JoystickForce" + }, + "parameters": [ + "Object", + "Behavior", + ">", + "0", + "" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::IsAngleIn4WayDirection" + }, + "parameters": [ + "", + "JoystickAngle", + "Direction", + "" + ] + } + ], "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "SetReturnBoolean" }, "parameters": [ - "HorizontalRotationAcceleration" + "True" ] } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -5594,31 +3069,59 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" + }, + { + "description": "Direction", + "name": "Direction", + "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\"]", + "type": "stringWithSelector" } ], "objectGroups": [] }, { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "HorizontalRotationAcceleration", - "name": "SetHorizontalRotationAcceleration", - "sentence": "", + "description": "Check if joystick is pushed in a given direction.", + "fullName": "Joystick pushed in a direction (8-way movement)", + "functionType": "Condition", + "name": "IsDirectionPushed8Way", + "sentence": "_PARAM0_ is pushed in direction _PARAM2_", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::JoystickForce" + }, + "parameters": [ + "Object", + "Behavior", + ">", + "0", + "" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::IsAngleIn8WayDirection" + }, + "parameters": [ + "", + "JoystickAngle", + "Direction", + "" + ] + } + ], "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SetReturnBoolean" }, "parameters": [ - "HorizontalRotationAcceleration", - "=", - "Value" + "True" ] } ] @@ -5633,38 +3136,52 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" + }, + { + "description": "Direction", + "name": "Direction", + "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\",\"UpLeft\",\"UpRight\",\"DownLeft\",\"DownRight\"]", + "type": "stringWithSelector" } ], "objectGroups": [] }, { - "description": "the horizontal rotation deceleration of the object.", - "fullName": "Horizontal rotation deceleration", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper horizontal rotation configuration", - "name": "HorizontalRotationDeceleration", - "sentence": "the horizontal rotation deceleration", + "description": "Check if a joystick is pressed.", + "fullName": "Joystick pressed", + "functionType": "Condition", + "name": "IsPressed", + "sentence": "Joystick _PARAM0_ is pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::PropertyTouchId" + }, + "parameters": [ + "Object", + "Behavior", + "!=", + "0" + ] + } + ], "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "SetReturnBoolean" }, "parameters": [ - "HorizontalRotationDeceleration" + "True" ] } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -5674,18 +3191,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] }, { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "HorizontalRotationDeceleration", - "name": "SetHorizontalRotationDeceleration", - "sentence": "", + "description": "Reset the joystick values (except for angle, which stays the same)", + "fullName": "Reset", + "functionType": "Action", + "name": "Reset", + "private": true, + "sentence": "Reset the joystick of _PARAM0_", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -5693,12 +3211,25 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" }, "parameters": [ - "HorizontalRotationDeceleration", + "Object", + "Behavior", "=", - "Value" + "0", + "" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyTouchId" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "0" ] } ] @@ -5713,19 +3244,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the maximum vertical rotation speed of the object.", - "fullName": "Maximum vertical rotation speed", + "description": "the multitouch controller identifier.", + "fullName": "Multitouch controller identifier", "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper vertical rotation configuration", - "name": "VerticalRotationSpeedMax", - "sentence": "the maximum vertical rotation speed", + "group": "Multitouch Joystick configuration", + "name": "ControllerIdentifier", + "sentence": "the multitouch controller identifier", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -5736,7 +3267,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "VerticalRotationSpeedMax" + "ControllerIdentifier" ] } ] @@ -5754,7 +3285,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], @@ -5763,8 +3294,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "VerticalRotationSpeedMax", - "name": "SetVerticalRotationSpeedMax", + "getterName": "ControllerIdentifier", + "name": "SetControllerIdentifier", "sentence": "", "events": [ { @@ -5773,10 +3304,11 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyControllerIdentifier" }, "parameters": [ - "VerticalRotationSpeedMax", + "Object", + "Behavior", "=", "Value" ] @@ -5793,19 +3325,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the vertical rotation acceleration of the object.", - "fullName": "Vertical rotation acceleration", + "description": "the joystick name.", + "fullName": "Joystick name", "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper vertical rotation configuration", - "name": "VerticalRotationAcceleration", - "sentence": "the vertical rotation acceleration", + "group": "Multitouch Joystick configuration", + "name": "JoystickIdentifier", + "sentence": "the joystick name", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -5813,17 +3345,17 @@ "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "SetReturnString" }, "parameters": [ - "VerticalRotationAcceleration" + "JoystickIdentifier" ] } ] } ], "expressionType": { - "type": "expression" + "type": "string" }, "parameters": [ { @@ -5834,7 +3366,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], @@ -5843,8 +3375,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "VerticalRotationAcceleration", - "name": "SetVerticalRotationAcceleration", + "getterName": "JoystickIdentifier", + "name": "SetJoystickIdentifier", "sentence": "", "events": [ { @@ -5853,10 +3385,11 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickIdentifier" }, "parameters": [ - "VerticalRotationAcceleration", + "Object", + "Behavior", "=", "Value" ] @@ -5873,19 +3406,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the vertical rotation deceleration of the object.", - "fullName": "Vertical rotation deceleration", + "description": "the dead zone radius (range: 0 to 1) of the joystick. 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).", + "fullName": "Dead zone radius", "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper vertical rotation configuration", - "name": "VerticalRotationDeceleration", - "sentence": "the vertical rotation deceleration", + "group": "Multitouch Joystick configuration", + "name": "DeadZoneRadius", + "sentence": "the dead zone radius", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -5896,7 +3429,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "VerticalRotationDeceleration" + "DeadZoneRadius" ] } ] @@ -5914,7 +3447,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], @@ -5923,8 +3456,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "VerticalRotationDeceleration", - "name": "SetVerticalRotationDeceleration", + "getterName": "DeadZoneRadius", + "name": "SetDeadZoneRadius", "sentence": "", "events": [ { @@ -5933,10 +3466,11 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyDeadZoneRadius" }, "parameters": [ - "VerticalRotationDeceleration", + "Object", + "Behavior", "=", "Value" ] @@ -5953,38 +3487,276 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] + } + ], + "propertyDescriptors": [ + { + "value": "1", + "type": "Number", + "label": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier" }, { - "description": "the minimum vertical camera angle of the object.", - "fullName": "Minimum vertical camera angle", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper vertical rotation configuration", - "name": "VerticalAngleMin", - "sentence": "the minimum vertical camera angle", + "value": "Primary", + "type": "String", + "label": "Joystick name", + "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": "0", + "type": "Number", + "label": "Joystick angle (range: -180 to 180)", + "hidden": true, + "name": "JoystickAngle" + }, + { + "value": "0", + "type": "Number", + "label": "Joystick force (range: 0 to 1)", + "hidden": true, + "name": "JoystickForce" + }, + { + "value": "0", + "type": "Number", + "label": "", + "hidden": true, + "name": "TouchId" + }, + { + "value": "", + "type": "Number", + "label": "", + "hidden": true, + "name": "TouchIndex" + } + ], + "sharedPropertyDescriptors": [] + }, + { + "description": "Detect button presses made on a touchscreen.", + "fullName": "Multitouch button", + "name": "MultitouchButton", + "objectType": "", + "eventsFunctions": [ + { + "fullName": "", + "functionType": "Action", + "name": "doStepPreEvents", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::IsReleased" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } + ], "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyIsReleased" + }, + "parameters": [ + "Object", + "Behavior", + "no" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + }, + "parameters": [ + "Object", + "Behavior", + "\"Idle\"", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "SpriteMultitouchJoystick::MultitouchButton::IsPressed" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + }, + { + "type": { + "value": "HasAnyTouchOrMouseStarted" + }, + "parameters": [ + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchIndex" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "0" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "StartedTouchOrMouseCount()", + "conditions": [], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "CollisionPoint" + }, + "parameters": [ + "Object", + "TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)", + "TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchId" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "StartedTouchOrMouseId(TouchIndex)" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + }, + "parameters": [ + "Object", + "Behavior", + "\"Pressed\"", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchIndex" + }, + "parameters": [ + "Object", + "Behavior", + "+", + "1" + ] + } + ] + } + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::IsPressed" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + }, + { + "type": { + "value": "HasTouchEnded" + }, + "parameters": [ + "", + "TouchId" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + }, + "parameters": [ + "Object", + "Behavior", + "\"Released\"", + "" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyIsReleased" + }, + "parameters": [ + "Object", + "Behavior", + "yes" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchId" }, "parameters": [ - "VerticalAngleMin" + "Object", + "Behavior", + "=", + "0" ] } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -5994,77 +3766,44 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", "type": "behavior" } ], "objectGroups": [] }, { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "VerticalAngleMin", - "name": "SetVerticalAngleMin", - "sentence": "", + "description": "Check if button is released.", + "fullName": "Button released", + "functionType": "Condition", + "name": "IsReleased", + "sentence": "Button _PARAM0_ is released", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ + "conditions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchButton::PropertyIsReleased" }, "parameters": [ - "VerticalAngleMin", - "=", - "Value" + "Object", + "Behavior" ] } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "the maximum vertical camera angle of the object.", - "fullName": "Maximum vertical camera angle", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper vertical rotation configuration", - "name": "VerticalAngleMax", - "sentence": "the maximum vertical camera angle", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + ], "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "SetReturnBoolean" }, "parameters": [ - "VerticalAngleMax" + "True" ] } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -6074,77 +3813,46 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", "type": "behavior" } ], "objectGroups": [] }, { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "VerticalAngleMax", - "name": "SetVerticalAngleMax", - "sentence": "", + "description": "Check if button is pressed.", + "fullName": "Button pressed", + "functionType": "Condition", + "name": "IsPressed", + "sentence": "Button _PARAM0_ is pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ + "conditions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchButton::PropertyTouchId" }, "parameters": [ - "VerticalAngleMax", - "=", - "Value" + "Object", + "Behavior", + "!=", + "0" ] } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "the z position offset of the object.", - "fullName": "Z position offset", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper position configuration", - "name": "OffsetZ", - "sentence": "the z position offset", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + ], "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "SetReturnBoolean" }, "parameters": [ - "OffsetZ" + "True" ] } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -6154,18 +3862,18 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", "type": "behavior" } ], "objectGroups": [] }, { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "OffsetZ", - "name": "SetOffsetZ", - "sentence": "", + "fullName": "Button state", + "functionType": "Action", + "name": "SetButtonState", + "private": true, + "sentence": "Mark the button _PARAM0_ as _PARAM2_", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -6173,12 +3881,14 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::SetButtonState" }, "parameters": [ - "OffsetZ", - "=", - "Value" + "", + "ControllerIdentifier", + "ButtonIdentifier", + "ButtonState", + "" ] } ] @@ -6193,140 +3903,61 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", "type": "behavior" + }, + { + "description": "Button state", + "name": "ButtonState", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "type": "stringWithSelector" } ], "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...)", + "label": "Multitouch 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": "A", + "type": "String", + "label": "Button identifier", + "name": "ButtonIdentifier" }, { "value": "0", "type": "Number", - "unit": "Pixel", - "label": "Z position offset", - "group": "Position", - "name": "OffsetZ" + "label": "TouchID", + "hidden": true, + "name": "TouchId" }, { - "value": "0", + "value": "", "type": "Number", - "unit": "AngularSpeed", - "label": "Current rotation speed Z", + "label": "", "hidden": true, - "name": "CurrentRotationSpeedZ" + "name": "TouchIndex" }, { - "value": "0", - "type": "Number", - "unit": "AngularSpeed", - "label": "Current rotation speed Y", + "value": "", + "type": "Boolean", + "label": "Button released", "hidden": true, - "name": "CurrentRotationSpeedY" + "name": "IsReleased" } ], "sharedPropertyDescriptors": [] }, { - "description": "Control a 3D physics car with a multitouch controller.", - "fullName": "3D car multitouch controller mapper", - "name": "PhysicsCar3DMultitouchMapper", + "description": "Control a platformer character with a multitouch controller.", + "fullName": "Platformer multitouch controller mapper", + "name": "PlatformerMultitouchMapper", "objectType": "", - "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -6339,27 +3970,90 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::StickForce" + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JoystickIdentifier", + "\"Left\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "PlatformBehavior::SimulateLeftKey" + }, + "parameters": [ + "Object", + "Property" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JoystickIdentifier", + "\"Right\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "PlatformBehavior::SimulateRightKey" + }, + "parameters": [ + "Object", + "Property" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" }, "parameters": [ "", - ">", - "0", "ControllerIdentifier", - "SteerJoystickIdentifier", + "JoystickIdentifier", + "\"Up\"", "" ] - } - ], - "actions": [ + } + ], + "actions": [ + { + "type": { + "value": "PlatformBehavior::SimulateUpKey" + }, + "parameters": [ + "Object", + "Property" + ] + }, { "type": { - "value": "Physics3D::PhysicsCar3D::SimulateSteeringStick" + "value": "PlatformBehavior::SimulateLadderKey" }, "parameters": [ "Object", - "PhysicsCar3D", - "SpriteMultitouchJoystick::StickForceX(ControllerIdentifier, \"Primary\")" + "Property" ] } ] @@ -6369,14 +4063,13 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::StickForce" + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" }, "parameters": [ "", - ">", - "0", "ControllerIdentifier", - "SpeedJoystickIdentifier", + "JoystickIdentifier", + "\"Down\"", "" ] } @@ -6384,12 +4077,11 @@ "actions": [ { "type": { - "value": "Physics3D::PhysicsCar3D::SimulateAcceleratorStick" + "value": "PlatformBehavior::SimulateDownKey" }, "parameters": [ "Object", - "PhysicsCar3D", - "-SpriteMultitouchJoystick::StickForceY(ControllerIdentifier, \"Secondary\")" + "Property" ] } ] @@ -6404,7 +4096,7 @@ "parameters": [ "", "ControllerIdentifier", - "HandBrakeButton", + "JumpButton", "\"Down\"" ] } @@ -6412,11 +4104,11 @@ "actions": [ { "type": { - "value": "Physics3D::PhysicsCar3D::SimulateHandBrakeKey" + "value": "PlatformBehavior::SimulateJumpKey" }, "parameters": [ "Object", - "PhysicsCar3D" + "Property" ] } ] @@ -6431,7 +4123,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::PhysicsCar3DMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::PlatformerMultitouchMapper", "type": "behavior" } ], @@ -6442,12 +4134,12 @@ { "value": "", "type": "Behavior", - "label": "3D physics car", + "label": "Platform character behavior", "extraInformation": [ - "Physics3D::PhysicsCar3D" + "PlatformBehavior::PlatformerObjectBehavior" ], "choices": [], - "name": "PhysicsCar3D" + "name": "Property" }, { "value": "1", @@ -6458,24 +4150,7 @@ { "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", + "label": "Joystick name", "group": "Controls", "choices": [ { @@ -6487,14 +4162,14 @@ "value": "Secondary" } ], - "name": "SpeedJoystickIdentifier" + "name": "JoystickIdentifier" }, { - "value": "B", + "value": "A", "type": "String", - "label": "Hand brake button name", + "label": "Jump button name", "group": "Controls", - "name": "HandBrakeButton" + "name": "JumpButton" } ], "sharedPropertyDescriptors": [] @@ -6504,7 +4179,6 @@ "fullName": "Top-down multitouch controller mapper", "name": "TopDownMultitouchMapper", "objectType": "", - "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -6517,10 +4191,11 @@ "conditions": [ { "type": { - "value": "StringVariable" + "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" }, "parameters": [ - "StickMode", + "Object", + "Behavior", "=", "\"Analog\"" ] @@ -6545,10 +4220,11 @@ "conditions": [ { "type": { - "value": "StringVariable" + "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" }, "parameters": [ - "StickMode", + "Object", + "Behavior", "=", "\"360°\"" ] @@ -6573,10 +4249,11 @@ "conditions": [ { "type": { - "value": "StringVariable" + "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" }, "parameters": [ - "StickMode", + "Object", + "Behavior", "=", "\"8 Directions\"" ] @@ -7185,6 +4862,7 @@ } ], "instances": [], + "editionSettings": {}, "eventsFunctions": [ { "fullName": "", @@ -7303,90 +4981,17 @@ "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "conditions": [], + "actions": [ { "type": { - "inverted": true, - "value": "SpriteMultitouchJoystick::IsInGameEdition" + "value": "MettreAutour" }, "parameters": [ - "", - "" - ] - } - ], - "actions": [], - "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" - }, - "parameters": [ - "Object", - "no", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "ShouldBeHiddenWhenReleased", - "False", - "" - ] - } + "Thumb", + "Border", + "Border.MultitouchJoystick::JoystickForce() * Border.Width() / 2", + "Border.MultitouchJoystick::JoystickAngle()" ] } ] @@ -7454,7 +5059,7 @@ "Border", "MultitouchJoystick", "=", - "ControllerIdentifier", + "Object.PropertyControllerIdentifier()", "" ] }, @@ -7466,7 +5071,7 @@ "Border", "MultitouchJoystick", "=", - "JoystickIdentifier", + "Object.PropertyJoystickIdentifier()", "" ] }, @@ -7478,92 +5083,7 @@ "Border", "MultitouchJoystick", "=", - "DeadZoneRadius", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "supplementaryInformation": "SpriteMultitouchJoystick::SpriteMultitouchJoystick", - "type": "object" - } - ], - "objectGroups": [] - }, - { - "description": "Show the joystick until it is released.", - "fullName": "Show and start pressing", - "functionType": "Action", - "name": "TeleportAndPress", - "sentence": "Show _PARAM0_ at the cursor position and start pressing", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "HasAnyTouchOrMouseStarted" - }, - "parameters": [ - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "MettreXY" - }, - "parameters": [ - "Object", - "=", - "Object.ParentTouchX(StartedTouchOrMouseId(0))", - "=", - "Object.ParentTouchY(StartedTouchOrMouseId(0))" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::ActivateControl" - }, - "parameters": [ - "Object", - "yes", - "" - ] - }, - { - "type": { - "value": "Montre" - }, - "parameters": [ - "Object", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "ShouldBeHiddenWhenReleased", - "True", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::ForceStartPressing" - }, - "parameters": [ - "Border", - "MultitouchJoystick", - "StartedTouchOrMouseId(0)", + "Object.PropertyDeadZoneRadius()", "" ] } @@ -7580,92 +5100,6 @@ ], "objectGroups": [] }, - { - "description": "Return the X position of a specified touch", - "fullName": "Touch X position (on parent)", - "functionType": "Expression", - "name": "ParentTouchX", - "private": true, - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [] - }, - { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "const object = objects[0];", - "const touchId = eventsFunctionContext.getArgument(\"TouchId\");", - "eventsFunctionContext.returnValue = gdjs.evtTools.input.getTouchX(object.getInstanceContainer(), touchId, object.getLayer());" - ], - "parameterObjects": "Object", - "useStrict": true, - "eventsSheetExpanded": false - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "supplementaryInformation": "SpriteMultitouchJoystick::SpriteMultitouchJoystick", - "type": "object" - }, - { - "description": "Touch identifier", - "name": "TouchId", - "type": "expression" - } - ], - "objectGroups": [] - }, - { - "description": "Return the X position of a specified touch", - "fullName": "Touch X position (on parent)", - "functionType": "Expression", - "name": "ParentTouchY", - "private": true, - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [] - }, - { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "const object = objects[0];", - "const touchId = eventsFunctionContext.getArgument(\"TouchId\");", - "eventsFunctionContext.returnValue = gdjs.evtTools.input.getTouchY(object.getInstanceContainer(), touchId, object.getLayer());" - ], - "parameterObjects": "Object", - "useStrict": true, - "eventsSheetExpanded": false - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "supplementaryInformation": "SpriteMultitouchJoystick::SpriteMultitouchJoystick", - "type": "object" - }, - { - "description": "Touch identifier", - "name": "TouchId", - "type": "expression" - } - ], - "objectGroups": [] - }, { "description": "De/activate control of the joystick.", "fullName": "De/activate control", @@ -7679,12 +5113,10 @@ { "type": { "inverted": true, - "value": "BooleanVariable" + "value": "GetArgumentAsBoolean" }, "parameters": [ - "ShouldActivate", - "True", - "" + "\"ShouldActivate\"" ] } ], @@ -7706,12 +5138,10 @@ "conditions": [ { "type": { - "value": "BooleanVariable" + "value": "GetArgumentAsBoolean" }, "parameters": [ - "ShouldActivate", - "True", - "" + "\"ShouldActivate\"" ] } ], @@ -8385,15 +5815,9 @@ "description": "Only used by the scene editor.", "hidden": true, "name": "ParentOrigin" - }, - { - "value": "", - "type": "Boolean", - "label": "", - "hidden": true, - "name": "ShouldBeHiddenWhenReleased" } - ] + ], + "variants": [] } ] }, diff --git a/examples/starting-3d-driving/starting-3d-driving.json b/examples/starting-3d-driving/starting-3d-driving.json index b88ba711b..3e51f978a 100644 --- a/examples/starting-3d-driving/starting-3d-driving.json +++ b/examples/starting-3d-driving/starting-3d-driving.json @@ -3821,13 +3821,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.9.0", + "version": "1.8.2", "description": [ - "Multitouch joysticks are objects showing a joystick on the screen, useful for mobile. They work like a physical gamepad:", + "Multitouch joysticks can be used the same way as physical gamepads:", "- 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.", + "- 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)." ], @@ -3891,28 +3891,6 @@ } ], "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", @@ -4331,11 +4309,11 @@ "objectGroups": [] }, { - "description": "Check if a button was just pressed on a multitouch controller.", - "fullName": "Multitouch controller button just pressed", + "description": "Check if a button is pressed on a gamepad.", + "fullName": "Multitouch controller button pressed", "functionType": "Condition", - "name": "IsButtonJustPressed", - "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ was just pressed", + "name": "IsButtonPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -4347,7 +4325,7 @@ "parameters": [ "Controllers[ControllerIdentifier].Buttons[Button].State", "=", - "\"JustPressed\"" + "\"Pressed\"" ] } ], @@ -4379,73 +4357,7 @@ "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\"" - ] - } - ] - } - ], - "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.", + "description": "Check if a button is released on a gamepad.", "fullName": "Multitouch controller button released", "functionType": "Condition", "name": "IsButtonReleased", @@ -4531,7 +4443,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"JustPressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -5904,23 +5816,41 @@ "conditions": [ { "type": { - "inverted": true, - "value": "SpriteMultitouchJoystick::IsInGameEdition" + "value": "HasGameJustResumed" }, "parameters": [ - "", "" ] } ], - "actions": [], + "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": "HasGameJustResumed" + "value": "HasAnyTouchOrMouseStarted" }, "parameters": [ "" @@ -5930,207 +5860,171 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", - "" + "TouchIndex", + "=", + "0" ] } - ] - }, - { - "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" - ] - } - ], + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "StartedTouchOrMouseCount()", + "conditions": [], + "actions": [], "events": [ { - "type": "BuiltinCommonInstructions::Repeat", - "repeatExpression": "StartedTouchOrMouseCount()", - "conditions": [], - "actions": [], - "events": [ + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { - "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": "NumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "0" ] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchIndex", - "+", - "1" - ] - } + "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)" + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 + "type": { + "value": "HasTouchEnded" }, - "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" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - } + "parameters": [ + "", + "TouchId" ] } ], - "parameters": [] - }, + "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": [ { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Update joystick position", - "source": "", - "type": "BuiltinCommonInstructions::Group", - "events": [ + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { - "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)", - "" - ] - } + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "!=", + "0" ] } ], - "parameters": [] + "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": [ @@ -7005,7 +6899,7 @@ "sharedPropertyDescriptors": [] }, { - "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.", + "description": "Detect button presses made on a touchscreen.", "fullName": "Multitouch button", "name": "MultitouchButton", "objectType": "", @@ -7021,49 +6915,11 @@ "conditions": [ { "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "IsReleased", - "True", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsReleased", - "False", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + "value": "SpriteMultitouchJoystick::MultitouchButton::IsReleased" }, "parameters": [ "Object", "Behavior", - "\"Idle\"", - "" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "True", "" ] } @@ -7074,7 +6930,7 @@ "value": "SetBooleanVariable" }, "parameters": [ - "IsJustPressed", + "IsReleased", "False", "" ] @@ -7086,7 +6942,7 @@ "parameters": [ "Object", "Behavior", - "\"Pressed\"", + "\"Idle\"", "" ] } @@ -7155,10 +7011,11 @@ }, { "type": { - "value": "NumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchButton::PropertyRadius" }, "parameters": [ - "Radius", + "Object", + "Behavior", ">", "DistanceBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer()), TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer()))" ] @@ -7184,17 +7041,7 @@ "parameters": [ "Object", "Behavior", - "\"JustPressed\"", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "True", + "\"Pressed\"", "" ] } @@ -7265,16 +7112,6 @@ "" ] }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "False", - "" - ] - }, { "type": { "value": "SetNumberVariable" @@ -7304,11 +7141,11 @@ "objectGroups": [] }, { - "description": "Check if the button was just pressed.", - "fullName": "Button just pressed", + "description": "Check if button is released.", + "fullName": "Button released", "functionType": "Condition", - "name": "IsJustPressed", - "sentence": "Button _PARAM0_ was just pressed", + "name": "IsReleased", + "sentence": "Button _PARAM0_ is released", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -7318,7 +7155,7 @@ "value": "BooleanVariable" }, "parameters": [ - "IsJustPressed", + "IsReleased", "True", "" ] @@ -7352,7 +7189,7 @@ "objectGroups": [] }, { - "description": "Check if the button is pressed.", + "description": "Check if button is pressed.", "fullName": "Button pressed", "functionType": "Condition", "name": "IsPressed", @@ -7399,54 +7236,6 @@ ], "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", @@ -7488,7 +7277,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"JustPressed\",\"Pressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -7529,13 +7318,6 @@ "hidden": true, "name": "IsReleased" }, - { - "value": "", - "type": "Boolean", - "label": "Button just pressed", - "hidden": true, - "name": "IsJustPressed" - }, { "value": "0", "type": "Number", @@ -9950,6 +9732,7 @@ } ], "instances": [], + "editionSettings": {}, "eventsFunctions": [ { "fullName": "", @@ -10066,92 +9849,74 @@ "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::IsInGameEdition" + "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::IsPressed" }, "parameters": [ - "", + "Object", "" ] } ], - "actions": [], - "events": [ + "actions": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "MettreAutour" - }, - "parameters": [ - "Thumb", - "Border", - "Border.MultitouchJoystick::JoystickForce() * Border.Width() / 2", - "Border.MultitouchJoystick::JoystickAngle()" - ] - } + "type": { + "value": "Cache" + }, + "parameters": [ + "Object" ] }, { - "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", - "" - ] - } + "type": { + "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::ActivateControl" + }, + "parameters": [ + "Object", + "no", + "" + ] + }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "ShouldBeHiddenWhenReleased", + "False", + "" ] } ] @@ -11158,7 +10923,8 @@ "hidden": true, "name": "ShouldBeHiddenWhenReleased" } - ] + ], + "variants": [] } ] }, diff --git a/examples/starting-3d-flight-sim/starting-3d-flight-sim.json b/examples/starting-3d-flight-sim/starting-3d-flight-sim.json index 66b1b1317..bc2fa03d0 100644 --- a/examples/starting-3d-flight-sim/starting-3d-flight-sim.json +++ b/examples/starting-3d-flight-sim/starting-3d-flight-sim.json @@ -1044,19 +1044,19 @@ "category": "Input", "extensionNamespace": "", "fullName": "Multitouch joystick and buttons (sprite)", - "gdevelopVersion": ">=5.5.222", + "gdevelopVersion": "", "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", + "version": "1.4.0", "description": [ - "Multitouch joysticks are objects showing a joystick on the screen, useful for mobile. They work like a physical gamepad:", + "Multitouch joysticks can be used the same way as physical gamepads:", "- 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.", + "- 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)." ], @@ -1121,33 +1121,108 @@ ], "eventsFunctions": [ { - "description": "Check if the events are running for the editor.", - "fullName": "Editor is running", + "description": "Check if a button is pressed on a gamepad.", + "fullName": "Multitouch controller button pressed", "functionType": "Condition", - "name": "IsInGameEdition", - "private": true, - "sentence": "Events are running for the editor", + "name": "IsButtonPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", "events": [ { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "const game = runtimeScene.getGame();\r", - "eventsFunctionContext.returnValue = game.isInGameEdition && game.isInGameEdition();" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"Pressed\"" + ] + } ], - "parameterObjects": "", - "useStrict": true, - "eventsSheetExpanded": false + "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" } ], - "parameters": [], "objectGroups": [] }, { - "fullName": "Accelerated speed", - "functionType": "Expression", - "name": "AcceleratedSpeed", + "description": "Check if a button is released on a gamepad.", + "fullName": "Multitouch controller button released", + "functionType": "Condition", + "name": "IsButtonReleased", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is released", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"Released\"" + ] + } + ], + "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": "Change a button state for a multitouch controller.", + "fullName": "Button state", + "functionType": "Action", + "name": "SetButtonState", "private": true, - "sentence": "", + "sentence": "Mark _PARAM2_ button as _PARAM3_ for multitouch controller _PARAM1_", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -1155,443 +1230,108 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SetStringVariable" }, "parameters": [ - "AcceleratedSpeed", + "Controllers[ControllerIdentifier].Buttons[Button].State", "=", - "CurrentSpeed" + "ButtonState" ] } - ], - "events": [ + ] + } + ], + "parameters": [ + { + "description": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier", + "type": "expression" + }, + { + "description": "Button name", + "name": "Button", + "type": "string" + }, + { + "description": "Button state", + "name": "ButtonState", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "type": "stringWithSelector" + } + ], + "objectGroups": [] + }, + { + "description": "Change the dead zone radius of a joystick. 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).", + "fullName": "Dead zone radius", + "functionType": "Action", + "name": "SetDeadZone", + "private": true, + "sentence": "Change the dead zone of multitouch joystick _PARAM2_ of multitouch controller _PARAM1_ to _PARAM3_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ { - "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", - "=", - "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": { + "value": "SetNumberVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].DeadZone", + "=", + "DeadZoneRadius" ] - }, - { - "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": "NumberVariable" - }, - "parameters": [ - "TargetedSpeed", - "=", - "0" - ] - } - ], - "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", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "clamp(AcceleratedSpeed, -SpeedMax, SpeedMax)" - ] - } - ] - } - ], - "variables": [ - { - "name": "AcceleratedSpeed", - "type": "number", - "value": 0 } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { - "description": "Current speed", - "name": "CurrentSpeed", - "type": "expression" - }, - { - "description": "Targeted speed", - "name": "TargetedSpeed", - "type": "expression" - }, - { - "description": "Max speed", - "name": "SpeedMax", + "description": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier", "type": "expression" }, { - "description": "Acceleration", - "name": "Acceleration", - "type": "expression" + "description": "Joystick name", + "name": "JoystickIdentifier", + "type": "string" }, { - "description": "Deceleration", - "name": "Deceleration", + "description": "Dead zone radius", + "name": "DeadZoneRadius", + "supplementaryInformation": "[]", "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", + "description": "Return the dead zone radius of a joystick. 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).", + "fullName": "Dead zone radius", + "functionType": "Expression", + "name": "DeadZone", + "private": true, + "sentence": "Change multitouch joystick _PARAM2_ of multitouch controller _PARAM1_ dead zone to _PARAM3_", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Buttons[Button].State", - "=", - "\"JustPressed\"" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "SetReturnBoolean" + "value": "SetReturnNumber" }, "parameters": [ - "True" + "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].DeadZone" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Multitouch controller identifier (1, 2, 3, 4...)", @@ -1599,276 +1339,31 @@ "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\"]", + "description": "Joystick name", + "name": "JoystickIdentifier", "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", + "description": "the direction index (left = 1, bottom = 1, right = 2, top = 3) for an angle (in degrees).", + "fullName": "Angle to 4-way index", + "functionType": "ExpressionAndCondition", + "name": "AngleTo4Way", + "private": true, + "sentence": "The angle _PARAM1_ 4-way index", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "conditions": [], + "actions": [ { "type": { - "value": "BuiltinCommonInstructions::Or" + "value": "SetReturnNumber" }, - "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", - "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is released", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Buttons[Button].State", - "=", - "\"Released\"" - ] - } - ], - "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": "Change a button state for a multitouch controller.", - "fullName": "Button state", - "functionType": "Action", - "name": "SetButtonState", - "private": true, - "sentence": "Mark _PARAM2_ button as _PARAM3_ for multitouch controller _PARAM1_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetStringVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Buttons[Button].State", - "=", - "ButtonState" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" - }, - { - "description": "Button name", - "name": "Button", - "type": "string" - }, - { - "description": "Button state", - "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"JustPressed\",\"Released\"]", - "type": "stringWithSelector" - } - ], - "objectGroups": [] - }, - { - "description": "Change the dead zone radius of a joystick. 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).", - "fullName": "Dead zone radius", - "functionType": "Action", - "name": "SetDeadZone", - "private": true, - "sentence": "Change the dead zone of multitouch joystick _PARAM2_ of multitouch controller _PARAM1_ to _PARAM3_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].DeadZone", - "=", - "DeadZoneRadius" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" - }, - { - "description": "Joystick name", - "name": "JoystickIdentifier", - "type": "string" - }, - { - "description": "Dead zone radius", - "name": "DeadZoneRadius", - "supplementaryInformation": "[]", - "type": "expression" - } - ], - "objectGroups": [] - }, - { - "description": "Return the dead zone radius of a joystick. 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).", - "fullName": "Dead zone radius", - "functionType": "Expression", - "name": "DeadZone", - "private": true, - "sentence": "Change multitouch joystick _PARAM2_ of multitouch controller _PARAM1_ dead zone to _PARAM3_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].DeadZone" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" - }, - { - "description": "Joystick name", - "name": "JoystickIdentifier", - "type": "string" - } - ], - "objectGroups": [] - }, - { - "description": "the direction index (left = 1, bottom = 1, right = 2, top = 3) for an angle (in degrees).", - "fullName": "Angle to 4-way index", - "functionType": "ExpressionAndCondition", - "name": "AngleTo4Way", - "private": true, - "sentence": "The angle _PARAM1_ 4-way index", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "mod(round(Angle * 4 / 360), 4)" + "parameters": [ + "mod(round(Angle * 4 / 360), 4)" ] } ] @@ -2610,11 +2105,6 @@ "name": "JoystickIdentifier", "supplementaryInformation": "[\"Primary\",\"Secondary\"]", "type": "stringWithSelector" - }, - { - "description": "", - "name": "Coucou", - "type": "expression" } ], "objectGroups": [] @@ -2844,7 +2334,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "XFromAngleAndDistance(SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier), SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier))" + "SpriteMultitouchJoystick::JoystickForce(ControllerIdentifier, JoystickIdentifier) * cos(ToRad(SpriteMultitouchJoystick::JoystickAngle(ControllerIdentifier, JoystickIdentifier)))" ] } ] @@ -2884,7 +2374,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "YFromAngleAndDistance(SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier), SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier))" + "SpriteMultitouchJoystick::JoystickForce(ControllerIdentifier, JoystickIdentifier) * sin(ToRad(SpriteMultitouchJoystick::JoystickAngle(ControllerIdentifier, JoystickIdentifier)))" ] } ] @@ -2907,2032 +2397,46 @@ } ], "objectGroups": [] - }, - { - "description": "Check if a new touch has started on the right or left side of the screen.", - "fullName": "New touch on a screen side", - "functionType": "Condition", - "group": "Multitouch Joystick", - "name": "HasTouchStartedOnScreenSide", - "sentence": "A new touch has started on the _PARAM2_ side of the screen on _PARAM1_'s layer", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "HasAnyTouchOrMouseStarted" - }, - "parameters": [ - "" - ] - } - ], - "actions": [], - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "Side", - "=", - "\"Left\"" - ] - }, - { - "type": { - "value": "TouchX" - }, - "parameters": [ - "", - "StartedTouchOrMouseId(0)", - "<", - "CameraCenterX(Object.Layer())", - "Object.Layer()", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "Side", - "=", - "\"Right\"" - ] - }, - { - "type": { - "value": "TouchX" - }, - "parameters": [ - "", - "StartedTouchOrMouseId(0)", - ">=", - "CameraCenterX(Object.Layer())", - "Object.Layer()", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - } - ] - } - ], - "parameters": [ - { - "description": "Multitouch joystick", - "name": "Object", - "supplementaryInformation": "SpriteMultitouchJoystick::SpriteMultitouchJoystick", - "type": "objectList" - }, - { - "description": "Screen side", - "name": "Side", - "supplementaryInformation": "[\"Left\",\"Right\"]", - "type": "stringWithSelector" - } - ], - "objectGroups": [] - } - ], - "eventsBasedBehaviors": [ + } + ], + "eventsBasedBehaviors": [ { "description": "Joystick that can be controlled by interacting with a touchscreen.", "fullName": "Multitouch Joystick", "name": "MultitouchJoystick", "objectType": "", "private": true, - "eventsFunctions": [ - { - "fullName": "", - "functionType": "Action", - "name": "onCreated", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::SetDeadZone" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "DeadZoneRadius", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "Action", - "name": "onDeActivate", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "Action", - "name": "doStepPreEvents", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "inverted": true, - "value": "SpriteMultitouchJoystick::IsInGameEdition" - }, - "parameters": [ - "", - "" - ] - } - ], - "actions": [], - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "HasGameJustResumed" - }, - "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)" - }, - { - "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": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "the joystick force (from 0 to 1).", - "fullName": "Joystick force", - "functionType": "ExpressionAndCondition", - "name": "JoystickForce", - "sentence": "the joystick force", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "max(0, JoystickForce - DeadZoneRadius) / (1 - DeadZoneRadius)" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "JoystickForce", - "name": "SetJoystickForce", - "private": true, - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "JoystickForce", - "=", - "Value" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::SetJoystickForce" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "JoystickForce", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - }, - { - "description": "", - "name": "Parameter", - "type": "objectList" - } - ], - "objectGroups": [] - }, - { - "description": "Return the angle the joystick is pointing towards (Range: -180 to 180).", - "fullName": "Joystick angle", - "functionType": "Expression", - "name": "JoystickAngle", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "JoystickAngle" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "Change the angle the joystick is pointing towards (Range: -180 to 180).", - "fullName": "Joystick angle", - "functionType": "Action", - "name": "SetJoystickAngle", - "private": true, - "sentence": "Change the joystick angle of _PARAM0_ to _PARAM2_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "JoystickAngle", - "=", - "Value" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::SetJoystickAngle" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "JoystickAngle", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - }, - { - "description": "Angle", - "name": "Value", - "type": "expression" - } - ], - "objectGroups": [] - }, - { - "description": "Return the stick force on X axis (from -1 at the left to 1 at the right).", - "fullName": "Stick X force", - "functionType": "Expression", - "name": "StickForceX", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "Object.Behavior::JoystickForce() * cos(ToRad(Object.Behavior::JoystickAngle()))" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "Return the stick force on Y axis (from -1 at the top to 1 at the bottom).", - "fullName": "Stick Y force", - "functionType": "Expression", - "name": "StickForceY", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "Object.Behavior::JoystickForce() * sin(ToRad(Object.Behavior::JoystickAngle()))" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "Check if joystick is pushed in a given direction.", - "fullName": "Joystick pushed in a direction (4-way movement)", - "functionType": "Condition", - "name": "IsDirectionPushed4Way", - "sentence": "_PARAM0_ is pushed in direction _PARAM2_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::JoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - ">", - "0", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::IsAngleIn4WayDirection" - }, - "parameters": [ - "", - "JoystickAngle", - "Direction", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - }, - { - "description": "Direction", - "name": "Direction", - "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\"]", - "type": "stringWithSelector" - } - ], - "objectGroups": [] - }, - { - "description": "Check if joystick is pushed in a given direction.", - "fullName": "Joystick pushed in a direction (8-way movement)", - "functionType": "Condition", - "name": "IsDirectionPushed8Way", - "sentence": "_PARAM0_ is pushed in direction _PARAM2_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::JoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - ">", - "0", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::IsAngleIn8WayDirection" - }, - "parameters": [ - "", - "JoystickAngle", - "Direction", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - }, - { - "description": "Direction", - "name": "Direction", - "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\",\"UpLeft\",\"UpRight\",\"DownLeft\",\"DownRight\"]", - "type": "stringWithSelector" - } - ], - "objectGroups": [] - }, - { - "description": "Check if a joystick is pressed.", - "fullName": "Joystick pressed", - "functionType": "Condition", - "name": "IsPressed", - "sentence": "Joystick _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::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "Reset the joystick values (except for angle, which stays the same)", - "fullName": "Reset", - "functionType": "Action", - "name": "Reset", - "private": true, - "sentence": "Reset the joystick of _PARAM0_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "0", - "" - ] - }, - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "0" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "the multitouch controller identifier.", - "fullName": "Multitouch controller identifier", - "functionType": "ExpressionAndCondition", - "group": "Multitouch Joystick configuration", - "name": "ControllerIdentifier", - "sentence": "the multitouch controller identifier", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "ControllerIdentifier" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "ControllerIdentifier", - "name": "SetControllerIdentifier", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "ControllerIdentifier", - "=", - "Value" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "the joystick name.", - "fullName": "Joystick name", - "functionType": "ExpressionAndCondition", - "group": "Multitouch Joystick configuration", - "name": "JoystickIdentifier", - "sentence": "the joystick name", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnString" - }, - "parameters": [ - "JoystickIdentifier" - ] - } - ] - } - ], - "expressionType": { - "type": "string" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "JoystickIdentifier", - "name": "SetJoystickIdentifier", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetStringVariable" - }, - "parameters": [ - "JoystickIdentifier", - "=", - "Value" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "the dead zone radius (range: 0 to 1) of the joystick. 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).", - "fullName": "Dead zone radius", - "functionType": "ExpressionAndCondition", - "group": "Multitouch Joystick configuration", - "name": "DeadZoneRadius", - "sentence": "the dead zone radius", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "DeadZoneRadius" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "DeadZoneRadius", - "name": "SetDeadZoneRadius", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "DeadZoneRadius", - "=", - "Value" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::SetDeadZone" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "Value", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "Force the joystick into the pressing state.", - "fullName": "Force start pressing", - "functionType": "Action", - "name": "ForceStartPressing", - "sentence": "Force start pressing _PARAM0_ with touch identifier: _PARAM2_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "Value" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - }, - { - "description": "Touch identifier", - "name": "Value", - "type": "expression" - } - ], - "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "1", - "type": "Number", - "label": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier" - }, - { - "value": "Primary", - "type": "String", - "label": "Joystick name", - "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": "0", - "type": "Number", - "label": "Joystick angle (range: -180 to 180)", - "hidden": true, - "name": "JoystickAngle" - }, - { - "value": "0", - "type": "Number", - "label": "Joystick force (range: 0 to 1)", - "hidden": true, - "name": "JoystickForce" - }, - { - "value": "0", - "type": "Number", - "label": "", - "hidden": true, - "name": "TouchId" - }, - { - "value": "", - "type": "Number", - "label": "", - "hidden": true, - "name": "TouchIndex" - } - ], - "sharedPropertyDescriptors": [] - }, - { - "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": "", - "eventsFunctions": [ - { - "fullName": "", - "functionType": "Action", - "name": "doStepPreEvents", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "IsReleased", - "True", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsReleased", - "False", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" - }, - "parameters": [ - "Object", - "Behavior", - "\"Idle\"", - "" - ] - } - ] - }, - { - "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": [ - { - "type": { - "inverted": true, - "value": "SpriteMultitouchJoystick::MultitouchButton::IsPressed" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - }, - { - "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": "BuiltinCommonInstructions::Or" - }, - "parameters": [], - "subInstructions": [ - { - "type": { - "value": "CollisionPoint" - }, - "parameters": [ - "Object", - "TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer())", - "TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer())" - ] - }, - { - "type": { - "value": "NumberVariable" - }, - "parameters": [ - "Radius", - ">", - "DistanceBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer()), TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer()))" - ] - } - ] - } - ], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "StartedTouchOrMouseId(TouchIndex)" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" - }, - "parameters": [ - "Object", - "Behavior", - "\"JustPressed\"", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "True", - "" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchIndex", - "+", - "1" - ] - } - ] - } - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::IsPressed" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - }, - { - "type": { - "value": "HasTouchEnded" - }, - "parameters": [ - "", - "TouchId" - ] - } - ], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" - }, - "parameters": [ - "Object", - "Behavior", - "\"Released\"", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsReleased", - "True", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "False", - "" - ] - }, - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "0" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "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", - "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", - "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": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", - "type": "behavior" - }, - { - "description": "Button state", - "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"JustPressed\",\"Pressed\",\"Released\"]", - "type": "stringWithSelector" - } - ], - "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "1", - "type": "Number", - "label": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier" - }, - { - "value": "A", - "type": "String", - "label": "Button identifier", - "name": "ButtonIdentifier" - }, - { - "value": "0", - "type": "Number", - "label": "TouchID", - "hidden": true, - "name": "TouchId" - }, - { - "value": "", - "type": "Number", - "label": "", - "hidden": true, - "name": "TouchIndex" - }, - { - "value": "", - "type": "Boolean", - "label": "Button released", - "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.", - "name": "Radius" - } - ], - "sharedPropertyDescriptors": [] - }, - { - "description": "Control a platformer character with a multitouch controller.", - "fullName": "Platformer multitouch controller mapper", - "name": "PlatformerMultitouchMapper", - "objectType": "", - "quickCustomizationVisibility": "hidden", - "eventsFunctions": [ - { - "fullName": "", - "functionType": "Action", - "name": "doStepPreEvents", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "\"Left\"", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateLeftKey" - }, - "parameters": [ - "Object", - "Property" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "\"Right\"", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateRightKey" - }, - "parameters": [ - "Object", - "Property" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "\"Up\"", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateUpKey" - }, - "parameters": [ - "Object", - "Property" - ] - }, - { - "type": { - "value": "PlatformBehavior::SimulateLadderKey" - }, - "parameters": [ - "Object", - "Property" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "\"Down\"", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateDownKey" - }, - "parameters": [ - "Object", - "Property" - ] - } - ] - }, + "eventsFunctions": [ + { + "fullName": "", + "functionType": "Action", + "name": "onCreated", + "sentence": "", + "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "conditions": [], + "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::IsButtonPressed" + "value": "SpriteMultitouchJoystick::SetDeadZone" }, "parameters": [ "", "ControllerIdentifier", - "JumpButton", - "\"Down\"" + "JoystickIdentifier", + "DeadZoneRadius", + "" ] - } - ], - "actions": [ + }, { "type": { - "value": "PlatformBehavior::SimulateJumpKey" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" }, "parameters": [ "Object", - "Property" + "Behavior", + "" ] } ] @@ -4947,64 +2451,50 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::PlatformerMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "", - "type": "Behavior", - "label": "Platform character behavior", - "extraInformation": [ - "PlatformBehavior::PlatformerObjectBehavior" - ], - "choices": [], - "name": "Property" }, { - "value": "1", - "type": "Number", - "label": "Controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier" - }, - { - "value": "Primary", - "type": "Choice", - "label": "Joystick name", - "group": "Controls", - "choices": [ + "fullName": "", + "functionType": "Action", + "name": "onDeActivate", + "sentence": "", + "events": [ { - "label": "Primary", - "value": "Primary" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" }, { - "label": "Secondary", - "value": "Secondary" + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } ], - "name": "JoystickIdentifier" + "objectGroups": [] }, - { - "value": "A", - "type": "String", - "label": "Jump button name", - "group": "Controls", - "name": "JumpButton" - } - ], - "sharedPropertyDescriptors": [] - }, - { - "description": "Control a 3D physics character with a multitouch controller.", - "fullName": "3D platformer multitouch controller mapper", - "name": "Platformer3DMultitouchMapper", - "objectType": "", - "quickCustomizationVisibility": "hidden", - "eventsFunctions": [ { "fullName": "", "functionType": "Action", @@ -5016,14 +2506,9 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::StickForce" + "value": "HasGameJustResumed" }, "parameters": [ - "", - ">", - "0", - "ControllerIdentifier", - "JoystickIdentifier", "" ] } @@ -5031,56 +2516,252 @@ "actions": [ { "type": { - "value": "Physics3D::PhysicsCharacter3D::SetForwardAngle" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" }, "parameters": [ "Object", - "PhysicsCharacter3D", - "=", - "SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier) + CameraAngle(Object.Layer())" + "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": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyTouchIndex" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "0" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "StartedTouchOrMouseCount()", + "conditions": [], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::PropertyTouchId" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "0" + ] + }, + { + "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": { - "value": "Physics3D::PhysicsCharacter3D::SimulateStick" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 }, - "parameters": [ - "Object", - "PhysicsCharacter3D", - "-90", - "SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier)" + "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" + }, + "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": "SpriteMultitouchJoystick::MultitouchJoystick::PropertyTouchId" + }, + "parameters": [ + "Object", + "Behavior", + "!=", + "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": [ + { + "description": "Object", + "name": "Object", + "type": "object" }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "the joystick force (from 0 to 1).", + "fullName": "Joystick force", + "functionType": "ExpressionAndCondition", + "name": "JoystickForce", + "sentence": "the joystick force", + "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::IsButtonPressed" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JumpButton", - "\"Down\"" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" + "value": "SetReturnNumber" }, "parameters": [ - "Object", - "PhysicsCharacter3D" + "max(0, JoystickForce - DeadZoneRadius) / (1 - DeadZoneRadius)" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -5090,124 +2771,45 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::Platformer3DMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "", - "type": "Behavior", - "label": "3D physics character", - "extraInformation": [ - "Physics3D::PhysicsCharacter3D" - ], - "choices": [], - "name": "PhysicsCharacter3D" - }, - { - "value": "1", - "type": "Number", - "label": "Controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier" - }, - { - "value": "Primary", - "type": "Choice", - "label": "Walk joystick", - "group": "Controls", - "choices": [ - { - "label": "Primary", - "value": "Primary" - }, - { - "label": "Secondary", - "value": "Secondary" - } - ], - "name": "JoystickIdentifier" }, - { - "value": "A", - "type": "String", - "label": "Jump button name", - "group": "Controls", - "name": "JumpButton" - } - ], - "sharedPropertyDescriptors": [] - }, - { - "description": "Control a 3D physics character with a multitouch controller.", - "fullName": "3D shooter multitouch controller mapper", - "name": "Shooter3DMultitouchMapper", - "objectType": "", - "quickCustomizationVisibility": "hidden", - "eventsFunctions": [ { "fullName": "", - "functionType": "Action", - "name": "doStepPreEvents", + "functionType": "ActionWithOperator", + "getterName": "JoystickForce", + "name": "SetJoystickForce", + "private": true, "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::StickForce" - }, - "parameters": [ - "", - ">", - "0", - "ControllerIdentifier", - "JoystickIdentifier", - "" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateStick" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickForce" }, "parameters": [ "Object", - "PhysicsCharacter3D", - "SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier)", - "SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier)" + "Behavior", + "=", + "Value" ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + }, { "type": { - "value": "SpriteMultitouchJoystick::IsButtonPressed" + "value": "SpriteMultitouchJoystick::SetJoystickForce" }, "parameters": [ "", "ControllerIdentifier", - "JumpButton", - "\"Down\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" - }, - "parameters": [ - "Object", - "PhysicsCharacter3D" + "JoystickIdentifier", + "JoystickForce", + "" ] } ] @@ -5222,151 +2824,37 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::Shooter3DMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "", - "type": "Behavior", - "label": "3D physics character", - "extraInformation": [ - "Physics3D::PhysicsCharacter3D" - ], - "choices": [], - "name": "PhysicsCharacter3D" - }, - { - "value": "1", - "type": "Number", - "label": "Controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier" - }, - { - "value": "Primary", - "type": "Choice", - "label": "Walk joystick", - "group": "Controls", - "choices": [ - { - "label": "Primary", - "value": "Primary" - }, - { - "label": "Secondary", - "value": "Secondary" - } - ], - "name": "JoystickIdentifier" }, { - "value": "A", - "type": "String", - "label": "Jump button name", - "group": "Controls", - "name": "JumpButton" - } - ], - "sharedPropertyDescriptors": [] - }, - { - "description": "Control camera rotations with a multitouch controller.", - "fullName": "First person camera multitouch controller mapper", - "name": "FirstPersonMultitouchMapper", - "objectType": "", - "quickCustomizationVisibility": "hidden", - "eventsFunctions": [ - { - "fullName": "", - "functionType": "Action", - "name": "doStepPreEvents", + "description": "Return the angle the joystick is pointing towards (Range: -180 to 180).", + "fullName": "Joystick angle", + "functionType": "Expression", + "name": "JoystickAngle", "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", - "=", - "SpriteMultitouchJoystick::AcceleratedSpeed(CurrentRotationSpeedZ, SpriteMultitouchJoystick::StickForceX(ControllerIdentifier, CameraStick) * HorizontalRotationSpeedMax, HorizontalRotationSpeedMax, HorizontalRotationAcceleration, HorizontalRotationDeceleration)" - ] - }, - { - "type": { - "value": "SetAngle" - }, - "parameters": [ - "Object", - "+", - "CurrentRotationSpeedZ * TimeDelta()" - ] - }, - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "CurrentRotationSpeedY", - "=", - "SpriteMultitouchJoystick::AcceleratedSpeed(CurrentRotationSpeedY, SpriteMultitouchJoystick::StickForceY(ControllerIdentifier, 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)" - ] - }, + "conditions": [], + "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper::LookFromObjectEyes" + "value": "SetReturnNumber" }, "parameters": [ - "Object", - "Behavior", - "" + "JoystickAngle" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -5376,20 +2864,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "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", + "description": "Change the angle the joystick is pointing towards (Range: -180 to 180).", + "fullName": "Joystick angle", "functionType": "Action", - "group": "Layers and cameras", - "name": "LookFromObjectEyes", + "name": "SetJoystickAngle", "private": true, - "sentence": "Move the camera to look though _PARAM0_ eyes", + "sentence": "Change the joystick angle of _PARAM0_ to _PARAM2_", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -5397,61 +2884,24 @@ "actions": [ { "type": { - "value": "CentreCamera" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickAngle" }, "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": [ - "", + "Behavior", "=", - "Object.Object3D::RotationX()", - "GetArgumentAsString(\"Layer\")", - "" + "Value" ] }, { "type": { - "value": "SetCameraAngle" + "value": "SpriteMultitouchJoystick::SetJoystickAngle" }, "parameters": [ "", - "=", - "Object.Angle() + 90", - "Object.Layer()", + "ControllerIdentifier", + "JoystickIdentifier", + "JoystickAngle", "" ] } @@ -5467,19 +2917,23 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" + }, + { + "description": "Angle", + "name": "Value", + "type": "expression" } ], "objectGroups": [] }, { - "description": "the maximum horizontal rotation speed of the object.", - "fullName": "Maximum horizontal rotation speed", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper horizontal rotation configuration", - "name": "HorizontalRotationSpeedMax", - "sentence": "the maximum horizontal rotation speed", + "description": "Return the stick force on X axis (from -1 at the left to 1 at the right).", + "fullName": "Stick X force", + "functionType": "Expression", + "name": "StickForceX", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -5490,7 +2944,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "HorizontalRotationSpeedMax" + "Object.Behavior::JoystickForce() * cos(ToRad(Object.Behavior::JoystickAngle()))" ] } ] @@ -5508,17 +2962,17 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] }, { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "HorizontalRotationSpeedMax", - "name": "SetHorizontalRotationSpeedMax", + "description": "Return the stick force on Y axis (from -1 at the top to 1 at the bottom).", + "fullName": "Stick Y force", + "functionType": "Expression", + "name": "StickForceY", "sentence": "", "events": [ { @@ -5527,17 +2981,18 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SetReturnNumber" }, "parameters": [ - "HorizontalRotationSpeedMax", - "=", - "Value" + "Object.Behavior::JoystickForce() * sin(ToRad(Object.Behavior::JoystickAngle()))" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -5547,38 +3002,58 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the horizontal rotation acceleration of the object.", - "fullName": "Horizontal rotation acceleration", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper horizontal rotation configuration", - "name": "HorizontalRotationAcceleration", - "sentence": "the horizontal rotation acceleration", + "description": "Check if joystick is pushed in a given direction.", + "fullName": "Joystick pushed in a direction (4-way movement)", + "functionType": "Condition", + "name": "IsDirectionPushed4Way", + "sentence": "_PARAM0_ is pushed in direction _PARAM2_", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::JoystickForce" + }, + "parameters": [ + "Object", + "Behavior", + ">", + "0", + "" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::IsAngleIn4WayDirection" + }, + "parameters": [ + "", + "JoystickAngle", + "Direction", + "" + ] + } + ], "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "SetReturnBoolean" }, "parameters": [ - "HorizontalRotationAcceleration" + "True" ] } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -5588,31 +3063,59 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" + }, + { + "description": "Direction", + "name": "Direction", + "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\"]", + "type": "stringWithSelector" } ], "objectGroups": [] }, { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "HorizontalRotationAcceleration", - "name": "SetHorizontalRotationAcceleration", - "sentence": "", + "description": "Check if joystick is pushed in a given direction.", + "fullName": "Joystick pushed in a direction (8-way movement)", + "functionType": "Condition", + "name": "IsDirectionPushed8Way", + "sentence": "_PARAM0_ is pushed in direction _PARAM2_", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::JoystickForce" + }, + "parameters": [ + "Object", + "Behavior", + ">", + "0", + "" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::IsAngleIn8WayDirection" + }, + "parameters": [ + "", + "JoystickAngle", + "Direction", + "" + ] + } + ], "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SetReturnBoolean" }, "parameters": [ - "HorizontalRotationAcceleration", - "=", - "Value" + "True" ] } ] @@ -5627,38 +3130,52 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" + }, + { + "description": "Direction", + "name": "Direction", + "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\",\"UpLeft\",\"UpRight\",\"DownLeft\",\"DownRight\"]", + "type": "stringWithSelector" } ], "objectGroups": [] }, { - "description": "the horizontal rotation deceleration of the object.", - "fullName": "Horizontal rotation deceleration", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper horizontal rotation configuration", - "name": "HorizontalRotationDeceleration", - "sentence": "the horizontal rotation deceleration", + "description": "Check if a joystick is pressed.", + "fullName": "Joystick pressed", + "functionType": "Condition", + "name": "IsPressed", + "sentence": "Joystick _PARAM0_ is pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::PropertyTouchId" + }, + "parameters": [ + "Object", + "Behavior", + "!=", + "0" + ] + } + ], "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "SetReturnBoolean" }, "parameters": [ - "HorizontalRotationDeceleration" + "True" ] } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -5668,18 +3185,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] }, { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "HorizontalRotationDeceleration", - "name": "SetHorizontalRotationDeceleration", - "sentence": "", + "description": "Reset the joystick values (except for angle, which stays the same)", + "fullName": "Reset", + "functionType": "Action", + "name": "Reset", + "private": true, + "sentence": "Reset the joystick of _PARAM0_", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -5687,12 +3205,25 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" }, "parameters": [ - "HorizontalRotationDeceleration", + "Object", + "Behavior", "=", - "Value" + "0", + "" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyTouchId" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "0" ] } ] @@ -5707,19 +3238,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the maximum vertical rotation speed of the object.", - "fullName": "Maximum vertical rotation speed", + "description": "the multitouch controller identifier.", + "fullName": "Multitouch controller identifier", "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper vertical rotation configuration", - "name": "VerticalRotationSpeedMax", - "sentence": "the maximum vertical rotation speed", + "group": "Multitouch Joystick configuration", + "name": "ControllerIdentifier", + "sentence": "the multitouch controller identifier", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -5730,7 +3261,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "VerticalRotationSpeedMax" + "ControllerIdentifier" ] } ] @@ -5748,7 +3279,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], @@ -5757,8 +3288,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "VerticalRotationSpeedMax", - "name": "SetVerticalRotationSpeedMax", + "getterName": "ControllerIdentifier", + "name": "SetControllerIdentifier", "sentence": "", "events": [ { @@ -5767,10 +3298,11 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyControllerIdentifier" }, "parameters": [ - "VerticalRotationSpeedMax", + "Object", + "Behavior", "=", "Value" ] @@ -5787,19 +3319,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the vertical rotation acceleration of the object.", - "fullName": "Vertical rotation acceleration", + "description": "the joystick name.", + "fullName": "Joystick name", "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper vertical rotation configuration", - "name": "VerticalRotationAcceleration", - "sentence": "the vertical rotation acceleration", + "group": "Multitouch Joystick configuration", + "name": "JoystickIdentifier", + "sentence": "the joystick name", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -5807,17 +3339,17 @@ "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "SetReturnString" }, "parameters": [ - "VerticalRotationAcceleration" + "JoystickIdentifier" ] } ] } ], "expressionType": { - "type": "expression" + "type": "string" }, "parameters": [ { @@ -5828,7 +3360,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], @@ -5837,8 +3369,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "VerticalRotationAcceleration", - "name": "SetVerticalRotationAcceleration", + "getterName": "JoystickIdentifier", + "name": "SetJoystickIdentifier", "sentence": "", "events": [ { @@ -5847,10 +3379,11 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickIdentifier" }, "parameters": [ - "VerticalRotationAcceleration", + "Object", + "Behavior", "=", "Value" ] @@ -5867,19 +3400,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the vertical rotation deceleration of the object.", - "fullName": "Vertical rotation deceleration", + "description": "the dead zone radius (range: 0 to 1) of the joystick. 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).", + "fullName": "Dead zone radius", "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper vertical rotation configuration", - "name": "VerticalRotationDeceleration", - "sentence": "the vertical rotation deceleration", + "group": "Multitouch Joystick configuration", + "name": "DeadZoneRadius", + "sentence": "the dead zone radius", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -5890,7 +3423,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "VerticalRotationDeceleration" + "DeadZoneRadius" ] } ] @@ -5908,7 +3441,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], @@ -5917,8 +3450,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "VerticalRotationDeceleration", - "name": "SetVerticalRotationDeceleration", + "getterName": "DeadZoneRadius", + "name": "SetDeadZoneRadius", "sentence": "", "events": [ { @@ -5927,10 +3460,11 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyDeadZoneRadius" }, "parameters": [ - "VerticalRotationDeceleration", + "Object", + "Behavior", "=", "Value" ] @@ -5947,72 +3481,271 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] + } + ], + "propertyDescriptors": [ + { + "value": "1", + "type": "Number", + "label": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier" }, { - "description": "the minimum vertical camera angle of the object.", - "fullName": "Minimum vertical camera angle", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper vertical rotation configuration", - "name": "VerticalAngleMin", - "sentence": "the minimum vertical camera angle", + "value": "Primary", + "type": "String", + "label": "Joystick name", + "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": "0", + "type": "Number", + "label": "Joystick angle (range: -180 to 180)", + "hidden": true, + "name": "JoystickAngle" + }, + { + "value": "0", + "type": "Number", + "label": "Joystick force (range: 0 to 1)", + "hidden": true, + "name": "JoystickForce" + }, + { + "value": "0", + "type": "Number", + "label": "", + "hidden": true, + "name": "TouchId" + }, + { + "value": "", + "type": "Number", + "label": "", + "hidden": true, + "name": "TouchIndex" + } + ], + "sharedPropertyDescriptors": [] + }, + { + "description": "Detect button presses made on a touchscreen.", + "fullName": "Multitouch button", + "name": "MultitouchButton", + "objectType": "", + "eventsFunctions": [ + { + "fullName": "", + "functionType": "Action", + "name": "doStepPreEvents", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::IsReleased" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } + ], "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyIsReleased" + }, + "parameters": [ + "Object", + "Behavior", + "no" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" }, "parameters": [ - "VerticalAngleMin" + "Object", + "Behavior", + "\"Idle\"", + "" ] } ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" }, { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "VerticalAngleMin", - "name": "SetVerticalAngleMin", - "sentence": "", - "events": [ + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "SpriteMultitouchJoystick::MultitouchButton::IsPressed" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + }, + { + "type": { + "value": "HasAnyTouchOrMouseStarted" + }, + "parameters": [ + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchIndex" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "0" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "StartedTouchOrMouseCount()", + "conditions": [], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "CollisionPoint" + }, + "parameters": [ + "Object", + "TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)", + "TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchId" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "StartedTouchOrMouseId(TouchIndex)" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + }, + "parameters": [ + "Object", + "Behavior", + "\"Pressed\"", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchIndex" + }, + "parameters": [ + "Object", + "Behavior", + "+", + "1" + ] + } + ] + } + ] + } + ] + }, { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::IsPressed" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + }, + { + "type": { + "value": "HasTouchEnded" + }, + "parameters": [ + "", + "TouchId" + ] + } + ], "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + }, + "parameters": [ + "Object", + "Behavior", + "\"Released\"", + "" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyIsReleased" + }, + "parameters": [ + "Object", + "Behavior", + "yes" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchId" }, "parameters": [ - "VerticalAngleMin", + "Object", + "Behavior", "=", - "Value" + "0" ] } ] @@ -6027,72 +3760,39 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the maximum vertical camera angle of the object.", - "fullName": "Maximum vertical camera angle", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper vertical rotation configuration", - "name": "VerticalAngleMax", - "sentence": "the maximum vertical camera angle", + "description": "Check if button is released.", + "fullName": "Button released", + "functionType": "Condition", + "name": "IsReleased", + "sentence": "Button _PARAM0_ is released", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ + "conditions": [ { "type": { - "value": "SetReturnNumber" + "value": "SpriteMultitouchJoystick::MultitouchButton::PropertyIsReleased" }, "parameters": [ - "VerticalAngleMax" + "Object", + "Behavior" ] } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "VerticalAngleMax", - "name": "SetVerticalAngleMax", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + ], "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SetReturnBoolean" }, "parameters": [ - "VerticalAngleMax", - "=", - "Value" + "True" ] } ] @@ -6107,38 +3807,46 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the z position offset of the object.", - "fullName": "Z position offset", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper position configuration", - "name": "OffsetZ", - "sentence": "the z position offset", + "description": "Check if button is pressed.", + "fullName": "Button pressed", + "functionType": "Condition", + "name": "IsPressed", + "sentence": "Button _PARAM0_ is pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::PropertyTouchId" + }, + "parameters": [ + "Object", + "Behavior", + "!=", + "0" + ] + } + ], "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "SetReturnBoolean" }, "parameters": [ - "OffsetZ" + "True" ] } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -6148,18 +3856,18 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", "type": "behavior" } ], "objectGroups": [] }, { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "OffsetZ", - "name": "SetOffsetZ", - "sentence": "", + "fullName": "Button state", + "functionType": "Action", + "name": "SetButtonState", + "private": true, + "sentence": "Mark the button _PARAM0_ as _PARAM2_", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -6167,12 +3875,14 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::SetButtonState" }, "parameters": [ - "OffsetZ", - "=", - "Value" + "", + "ControllerIdentifier", + "ButtonIdentifier", + "ButtonState", + "" ] } ] @@ -6187,140 +3897,61 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", "type": "behavior" + }, + { + "description": "Button state", + "name": "ButtonState", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "type": "stringWithSelector" } ], "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...)", + "label": "Multitouch 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": "A", + "type": "String", + "label": "Button identifier", + "name": "ButtonIdentifier" }, { "value": "0", "type": "Number", - "unit": "Pixel", - "label": "Z position offset", - "group": "Position", - "name": "OffsetZ" + "label": "TouchID", + "hidden": true, + "name": "TouchId" }, { - "value": "0", + "value": "", "type": "Number", - "unit": "AngularSpeed", - "label": "Current rotation speed Z", + "label": "", "hidden": true, - "name": "CurrentRotationSpeedZ" + "name": "TouchIndex" }, { - "value": "0", - "type": "Number", - "unit": "AngularSpeed", - "label": "Current rotation speed Y", + "value": "", + "type": "Boolean", + "label": "Button released", "hidden": true, - "name": "CurrentRotationSpeedY" + "name": "IsReleased" } ], "sharedPropertyDescriptors": [] }, { - "description": "Control a 3D physics car with a multitouch controller.", - "fullName": "3D car multitouch controller mapper", - "name": "PhysicsCar3DMultitouchMapper", + "description": "Control a platformer character with a multitouch controller.", + "fullName": "Platformer multitouch controller mapper", + "name": "PlatformerMultitouchMapper", "objectType": "", - "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -6333,14 +3964,69 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::StickForce" + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JoystickIdentifier", + "\"Left\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "PlatformBehavior::SimulateLeftKey" + }, + "parameters": [ + "Object", + "Property" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JoystickIdentifier", + "\"Right\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "PlatformBehavior::SimulateRightKey" + }, + "parameters": [ + "Object", + "Property" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" }, "parameters": [ "", - ">", - "0", "ControllerIdentifier", - "SteerJoystickIdentifier", + "JoystickIdentifier", + "\"Up\"", "" ] } @@ -6348,12 +4034,20 @@ "actions": [ { "type": { - "value": "Physics3D::PhysicsCar3D::SimulateSteeringStick" + "value": "PlatformBehavior::SimulateUpKey" + }, + "parameters": [ + "Object", + "Property" + ] + }, + { + "type": { + "value": "PlatformBehavior::SimulateLadderKey" }, "parameters": [ "Object", - "PhysicsCar3D", - "SpriteMultitouchJoystick::StickForceX(ControllerIdentifier, \"Primary\")" + "Property" ] } ] @@ -6363,14 +4057,13 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::StickForce" + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" }, "parameters": [ "", - ">", - "0", "ControllerIdentifier", - "SpeedJoystickIdentifier", + "JoystickIdentifier", + "\"Down\"", "" ] } @@ -6378,12 +4071,11 @@ "actions": [ { "type": { - "value": "Physics3D::PhysicsCar3D::SimulateAcceleratorStick" + "value": "PlatformBehavior::SimulateDownKey" }, "parameters": [ "Object", - "PhysicsCar3D", - "-SpriteMultitouchJoystick::StickForceY(ControllerIdentifier, \"Secondary\")" + "Property" ] } ] @@ -6398,7 +4090,7 @@ "parameters": [ "", "ControllerIdentifier", - "HandBrakeButton", + "JumpButton", "\"Down\"" ] } @@ -6406,11 +4098,11 @@ "actions": [ { "type": { - "value": "Physics3D::PhysicsCar3D::SimulateHandBrakeKey" + "value": "PlatformBehavior::SimulateJumpKey" }, "parameters": [ "Object", - "PhysicsCar3D" + "Property" ] } ] @@ -6425,7 +4117,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::PhysicsCar3DMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::PlatformerMultitouchMapper", "type": "behavior" } ], @@ -6436,12 +4128,12 @@ { "value": "", "type": "Behavior", - "label": "3D physics car", + "label": "Platform character behavior", "extraInformation": [ - "Physics3D::PhysicsCar3D" + "PlatformBehavior::PlatformerObjectBehavior" ], "choices": [], - "name": "PhysicsCar3D" + "name": "Property" }, { "value": "1", @@ -6452,24 +4144,7 @@ { "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", + "label": "Joystick name", "group": "Controls", "choices": [ { @@ -6481,14 +4156,14 @@ "value": "Secondary" } ], - "name": "SpeedJoystickIdentifier" + "name": "JoystickIdentifier" }, { - "value": "B", + "value": "A", "type": "String", - "label": "Hand brake button name", + "label": "Jump button name", "group": "Controls", - "name": "HandBrakeButton" + "name": "JumpButton" } ], "sharedPropertyDescriptors": [] @@ -6498,7 +4173,6 @@ "fullName": "Top-down multitouch controller mapper", "name": "TopDownMultitouchMapper", "objectType": "", - "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -6511,10 +4185,11 @@ "conditions": [ { "type": { - "value": "StringVariable" + "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" }, "parameters": [ - "StickMode", + "Object", + "Behavior", "=", "\"Analog\"" ] @@ -6539,10 +4214,11 @@ "conditions": [ { "type": { - "value": "StringVariable" + "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" }, "parameters": [ - "StickMode", + "Object", + "Behavior", "=", "\"360°\"" ] @@ -6567,10 +4243,11 @@ "conditions": [ { "type": { - "value": "StringVariable" + "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" }, "parameters": [ - "StickMode", + "Object", + "Behavior", "=", "\"8 Directions\"" ] @@ -7179,6 +4856,7 @@ } ], "instances": [], + "editionSettings": {}, "eventsFunctions": [ { "fullName": "", @@ -7297,90 +4975,17 @@ "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "conditions": [], + "actions": [ { "type": { - "inverted": true, - "value": "SpriteMultitouchJoystick::IsInGameEdition" + "value": "MettreAutour" }, "parameters": [ - "", - "" - ] - } - ], - "actions": [], - "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" - }, - "parameters": [ - "Object", - "no", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "ShouldBeHiddenWhenReleased", - "False", - "" - ] - } + "Thumb", + "Border", + "Border.MultitouchJoystick::JoystickForce() * Border.Width() / 2", + "Border.MultitouchJoystick::JoystickAngle()" ] } ] @@ -7448,7 +5053,7 @@ "Border", "MultitouchJoystick", "=", - "ControllerIdentifier", + "Object.PropertyControllerIdentifier()", "" ] }, @@ -7460,7 +5065,7 @@ "Border", "MultitouchJoystick", "=", - "JoystickIdentifier", + "Object.PropertyJoystickIdentifier()", "" ] }, @@ -7472,92 +5077,7 @@ "Border", "MultitouchJoystick", "=", - "DeadZoneRadius", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "supplementaryInformation": "SpriteMultitouchJoystick::SpriteMultitouchJoystick", - "type": "object" - } - ], - "objectGroups": [] - }, - { - "description": "Show the joystick until it is released.", - "fullName": "Show and start pressing", - "functionType": "Action", - "name": "TeleportAndPress", - "sentence": "Show _PARAM0_ at the cursor position and start pressing", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "HasAnyTouchOrMouseStarted" - }, - "parameters": [ - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "MettreXY" - }, - "parameters": [ - "Object", - "=", - "Object.ParentTouchX(StartedTouchOrMouseId(0))", - "=", - "Object.ParentTouchY(StartedTouchOrMouseId(0))" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::ActivateControl" - }, - "parameters": [ - "Object", - "yes", - "" - ] - }, - { - "type": { - "value": "Montre" - }, - "parameters": [ - "Object", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "ShouldBeHiddenWhenReleased", - "True", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::ForceStartPressing" - }, - "parameters": [ - "Border", - "MultitouchJoystick", - "StartedTouchOrMouseId(0)", + "Object.PropertyDeadZoneRadius()", "" ] } @@ -7574,92 +5094,6 @@ ], "objectGroups": [] }, - { - "description": "Return the X position of a specified touch", - "fullName": "Touch X position (on parent)", - "functionType": "Expression", - "name": "ParentTouchX", - "private": true, - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [] - }, - { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "const object = objects[0];", - "const touchId = eventsFunctionContext.getArgument(\"TouchId\");", - "eventsFunctionContext.returnValue = gdjs.evtTools.input.getTouchX(object.getInstanceContainer(), touchId, object.getLayer());" - ], - "parameterObjects": "Object", - "useStrict": true, - "eventsSheetExpanded": false - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "supplementaryInformation": "SpriteMultitouchJoystick::SpriteMultitouchJoystick", - "type": "object" - }, - { - "description": "Touch identifier", - "name": "TouchId", - "type": "expression" - } - ], - "objectGroups": [] - }, - { - "description": "Return the X position of a specified touch", - "fullName": "Touch X position (on parent)", - "functionType": "Expression", - "name": "ParentTouchY", - "private": true, - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [] - }, - { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "const object = objects[0];", - "const touchId = eventsFunctionContext.getArgument(\"TouchId\");", - "eventsFunctionContext.returnValue = gdjs.evtTools.input.getTouchY(object.getInstanceContainer(), touchId, object.getLayer());" - ], - "parameterObjects": "Object", - "useStrict": true, - "eventsSheetExpanded": false - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "supplementaryInformation": "SpriteMultitouchJoystick::SpriteMultitouchJoystick", - "type": "object" - }, - { - "description": "Touch identifier", - "name": "TouchId", - "type": "expression" - } - ], - "objectGroups": [] - }, { "description": "De/activate control of the joystick.", "fullName": "De/activate control", @@ -7673,12 +5107,10 @@ { "type": { "inverted": true, - "value": "BooleanVariable" + "value": "GetArgumentAsBoolean" }, "parameters": [ - "ShouldActivate", - "True", - "" + "\"ShouldActivate\"" ] } ], @@ -7700,12 +5132,10 @@ "conditions": [ { "type": { - "value": "BooleanVariable" + "value": "GetArgumentAsBoolean" }, "parameters": [ - "ShouldActivate", - "True", - "" + "\"ShouldActivate\"" ] } ], @@ -8379,15 +5809,9 @@ "description": "Only used by the scene editor.", "hidden": true, "name": "ParentOrigin" - }, - { - "value": "", - "type": "Boolean", - "label": "", - "hidden": true, - "name": "ShouldBeHiddenWhenReleased" } - ] + ], + "variants": [] } ] }, diff --git a/examples/starting-3d-point-and-click-adventure/starting-3d-point-and-click-adventure.json b/examples/starting-3d-point-and-click-adventure/starting-3d-point-and-click-adventure.json index fae1edaab..f13b5865f 100644 --- a/examples/starting-3d-point-and-click-adventure/starting-3d-point-and-click-adventure.json +++ b/examples/starting-3d-point-and-click-adventure/starting-3d-point-and-click-adventure.json @@ -1499,7 +1499,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.9.0", + "version": "1.8.4", "description": [ "Multitouch joysticks are objects showing a joystick on the screen, useful for mobile. They work like a physical gamepad:", "- 4 or 8 directions", @@ -2009,11 +2009,11 @@ "objectGroups": [] }, { - "description": "Check if a button was just pressed on a multitouch controller.", - "fullName": "Multitouch controller button just pressed", + "description": "Check if a button is pressed on a gamepad.", + "fullName": "Multitouch controller button pressed", "functionType": "Condition", - "name": "IsButtonJustPressed", - "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ was just pressed", + "name": "IsButtonPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -2025,7 +2025,7 @@ "parameters": [ "Controllers[ControllerIdentifier].Buttons[Button].State", "=", - "\"JustPressed\"" + "\"Pressed\"" ] } ], @@ -2057,73 +2057,7 @@ "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\"" - ] - } - ] - } - ], - "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.", + "description": "Check if a button is released on a gamepad.", "fullName": "Multitouch controller button released", "functionType": "Condition", "name": "IsButtonReleased", @@ -2209,7 +2143,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"JustPressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -4699,49 +4633,11 @@ "conditions": [ { "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "IsReleased", - "True", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsReleased", - "False", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + "value": "SpriteMultitouchJoystick::MultitouchButton::IsReleased" }, "parameters": [ "Object", "Behavior", - "\"Idle\"", - "" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "True", "" ] } @@ -4752,7 +4648,7 @@ "value": "SetBooleanVariable" }, "parameters": [ - "IsJustPressed", + "IsReleased", "False", "" ] @@ -4764,7 +4660,7 @@ "parameters": [ "Object", "Behavior", - "\"Pressed\"", + "\"Idle\"", "" ] } @@ -4862,17 +4758,7 @@ "parameters": [ "Object", "Behavior", - "\"JustPressed\"", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "True", + "\"Pressed\"", "" ] } @@ -4943,16 +4829,6 @@ "" ] }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "False", - "" - ] - }, { "type": { "value": "SetNumberVariable" @@ -4982,11 +4858,11 @@ "objectGroups": [] }, { - "description": "Check if the button was just pressed.", - "fullName": "Button just pressed", + "description": "Check if button is released.", + "fullName": "Button released", "functionType": "Condition", - "name": "IsJustPressed", - "sentence": "Button _PARAM0_ was just pressed", + "name": "IsReleased", + "sentence": "Button _PARAM0_ is released", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -4996,7 +4872,7 @@ "value": "BooleanVariable" }, "parameters": [ - "IsJustPressed", + "IsReleased", "True", "" ] @@ -5030,7 +4906,7 @@ "objectGroups": [] }, { - "description": "Check if the button is pressed.", + "description": "Check if button is pressed.", "fullName": "Button pressed", "functionType": "Condition", "name": "IsPressed", @@ -5077,54 +4953,6 @@ ], "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", @@ -5166,7 +4994,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"JustPressed\",\"Pressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -5207,13 +5035,6 @@ "hidden": true, "name": "IsReleased" }, - { - "value": "", - "type": "Boolean", - "label": "Button just pressed", - "hidden": true, - "name": "IsJustPressed" - }, { "value": "0", "type": "Number", @@ -7628,6 +7449,7 @@ } ], "instances": [], + "editionSettings": {}, "eventsFunctions": [ { "fullName": "", @@ -8836,7 +8658,8 @@ "hidden": true, "name": "ShouldBeHiddenWhenReleased" } - ] + ], + "variants": [] } ] }, diff --git a/examples/starting-3d-shootemup/starting-3d-shootemup.json b/examples/starting-3d-shootemup/starting-3d-shootemup.json index b08abdb82..53dc9269c 100644 --- a/examples/starting-3d-shootemup/starting-3d-shootemup.json +++ b/examples/starting-3d-shootemup/starting-3d-shootemup.json @@ -1200,7 +1200,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.9.0", + "version": "1.8.4", "description": [ "Multitouch joysticks are objects showing a joystick on the screen, useful for mobile. They work like a physical gamepad:", "- 4 or 8 directions", @@ -1710,11 +1710,11 @@ "objectGroups": [] }, { - "description": "Check if a button was just pressed on a multitouch controller.", - "fullName": "Multitouch controller button just pressed", + "description": "Check if a button is pressed on a gamepad.", + "fullName": "Multitouch controller button pressed", "functionType": "Condition", - "name": "IsButtonJustPressed", - "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ was just pressed", + "name": "IsButtonPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -1726,73 +1726,7 @@ "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 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\"" - ] - } + "\"Pressed\"" ] } ], @@ -1824,7 +1758,7 @@ "objectGroups": [] }, { - "description": "Check if a button is released on a multitouch controller.", + "description": "Check if a button is released on a gamepad.", "fullName": "Multitouch controller button released", "functionType": "Condition", "name": "IsButtonReleased", @@ -1910,7 +1844,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"JustPressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -4400,49 +4334,11 @@ "conditions": [ { "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "IsReleased", - "True", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsReleased", - "False", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + "value": "SpriteMultitouchJoystick::MultitouchButton::IsReleased" }, "parameters": [ "Object", "Behavior", - "\"Idle\"", - "" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "True", "" ] } @@ -4453,7 +4349,7 @@ "value": "SetBooleanVariable" }, "parameters": [ - "IsJustPressed", + "IsReleased", "False", "" ] @@ -4465,7 +4361,7 @@ "parameters": [ "Object", "Behavior", - "\"Pressed\"", + "\"Idle\"", "" ] } @@ -4563,17 +4459,7 @@ "parameters": [ "Object", "Behavior", - "\"JustPressed\"", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "True", + "\"Pressed\"", "" ] } @@ -4644,16 +4530,6 @@ "" ] }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "False", - "" - ] - }, { "type": { "value": "SetNumberVariable" @@ -4683,11 +4559,11 @@ "objectGroups": [] }, { - "description": "Check if the button was just pressed.", - "fullName": "Button just pressed", + "description": "Check if button is released.", + "fullName": "Button released", "functionType": "Condition", - "name": "IsJustPressed", - "sentence": "Button _PARAM0_ was just pressed", + "name": "IsReleased", + "sentence": "Button _PARAM0_ is released", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -4697,7 +4573,7 @@ "value": "BooleanVariable" }, "parameters": [ - "IsJustPressed", + "IsReleased", "True", "" ] @@ -4731,7 +4607,7 @@ "objectGroups": [] }, { - "description": "Check if the button is pressed.", + "description": "Check if button is pressed.", "fullName": "Button pressed", "functionType": "Condition", "name": "IsPressed", @@ -4778,54 +4654,6 @@ ], "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", @@ -4867,7 +4695,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"JustPressed\",\"Pressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -4908,13 +4736,6 @@ "hidden": true, "name": "IsReleased" }, - { - "value": "", - "type": "Boolean", - "label": "Button just pressed", - "hidden": true, - "name": "IsJustPressed" - }, { "value": "0", "type": "Number", @@ -7329,6 +7150,7 @@ } ], "instances": [], + "editionSettings": {}, "eventsFunctions": [ { "fullName": "", @@ -8537,7 +8359,8 @@ "hidden": true, "name": "ShouldBeHiddenWhenReleased" } - ] + ], + "variants": [] } ] }, diff --git a/examples/starting-3d-tank/starting-3d-tank.json b/examples/starting-3d-tank/starting-3d-tank.json index fdd417e73..6ecb306dc 100644 --- a/examples/starting-3d-tank/starting-3d-tank.json +++ b/examples/starting-3d-tank/starting-3d-tank.json @@ -5265,13 +5265,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.9.0", + "version": "1.8.2", "description": [ - "Multitouch joysticks are objects showing a joystick on the screen, useful for mobile. They work like a physical gamepad:", + "Multitouch joysticks can be used the same way as physical gamepads:", "- 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.", + "- 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)." ], @@ -5335,28 +5335,6 @@ } ], "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", @@ -5775,11 +5753,11 @@ "objectGroups": [] }, { - "description": "Check if a button was just pressed on a multitouch controller.", - "fullName": "Multitouch controller button just pressed", + "description": "Check if a button is pressed on a gamepad.", + "fullName": "Multitouch controller button pressed", "functionType": "Condition", - "name": "IsButtonJustPressed", - "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ was just pressed", + "name": "IsButtonPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -5791,73 +5769,7 @@ "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 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\"" - ] - } + "\"Pressed\"" ] } ], @@ -5889,7 +5801,7 @@ "objectGroups": [] }, { - "description": "Check if a button is released on a multitouch controller.", + "description": "Check if a button is released on a gamepad.", "fullName": "Multitouch controller button released", "functionType": "Condition", "name": "IsButtonReleased", @@ -5975,7 +5887,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"JustPressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -7348,23 +7260,41 @@ "conditions": [ { "type": { - "inverted": true, - "value": "SpriteMultitouchJoystick::IsInGameEdition" + "value": "HasGameJustResumed" }, "parameters": [ - "", "" ] } ], - "actions": [], + "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": "HasGameJustResumed" + "value": "HasAnyTouchOrMouseStarted" }, "parameters": [ "" @@ -7374,207 +7304,171 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", - "" + "TouchIndex", + "=", + "0" ] } - ] - }, - { - "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" - ] - } - ], + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "StartedTouchOrMouseCount()", + "conditions": [], + "actions": [], "events": [ { - "type": "BuiltinCommonInstructions::Repeat", - "repeatExpression": "StartedTouchOrMouseCount()", - "conditions": [], - "actions": [], - "events": [ + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { - "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": "NumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "0" ] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchIndex", - "+", - "1" - ] - } + "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::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" - }, - "parameters": [ - "Object", - "Behavior", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchIndex", + "+", + "1" + ] + } ] } ] } - ], - "parameters": [] + ] }, { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Update joystick position", - "source": "", - "type": "BuiltinCommonInstructions::Group", - "events": [ + "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": "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)", - "" - ] - } + "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" ] } ], - "parameters": [] + "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": [ @@ -8449,7 +8343,7 @@ "sharedPropertyDescriptors": [] }, { - "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.", + "description": "Detect button presses made on a touchscreen.", "fullName": "Multitouch button", "name": "MultitouchButton", "objectType": "", @@ -8465,49 +8359,11 @@ "conditions": [ { "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "IsReleased", - "True", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsReleased", - "False", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + "value": "SpriteMultitouchJoystick::MultitouchButton::IsReleased" }, "parameters": [ "Object", "Behavior", - "\"Idle\"", - "" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "True", "" ] } @@ -8518,7 +8374,7 @@ "value": "SetBooleanVariable" }, "parameters": [ - "IsJustPressed", + "IsReleased", "False", "" ] @@ -8530,7 +8386,7 @@ "parameters": [ "Object", "Behavior", - "\"Pressed\"", + "\"Idle\"", "" ] } @@ -8599,10 +8455,11 @@ }, { "type": { - "value": "NumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchButton::PropertyRadius" }, "parameters": [ - "Radius", + "Object", + "Behavior", ">", "DistanceBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer()), TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer()))" ] @@ -8628,17 +8485,7 @@ "parameters": [ "Object", "Behavior", - "\"JustPressed\"", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "True", + "\"Pressed\"", "" ] } @@ -8709,16 +8556,6 @@ "" ] }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "False", - "" - ] - }, { "type": { "value": "SetNumberVariable" @@ -8748,11 +8585,11 @@ "objectGroups": [] }, { - "description": "Check if the button was just pressed.", - "fullName": "Button just pressed", + "description": "Check if button is released.", + "fullName": "Button released", "functionType": "Condition", - "name": "IsJustPressed", - "sentence": "Button _PARAM0_ was just pressed", + "name": "IsReleased", + "sentence": "Button _PARAM0_ is released", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -8762,7 +8599,7 @@ "value": "BooleanVariable" }, "parameters": [ - "IsJustPressed", + "IsReleased", "True", "" ] @@ -8796,7 +8633,7 @@ "objectGroups": [] }, { - "description": "Check if the button is pressed.", + "description": "Check if button is pressed.", "fullName": "Button pressed", "functionType": "Condition", "name": "IsPressed", @@ -8843,54 +8680,6 @@ ], "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", @@ -8932,7 +8721,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"JustPressed\",\"Pressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -8973,13 +8762,6 @@ "hidden": true, "name": "IsReleased" }, - { - "value": "", - "type": "Boolean", - "label": "Button just pressed", - "hidden": true, - "name": "IsJustPressed" - }, { "value": "0", "type": "Number", @@ -11394,6 +11176,7 @@ } ], "instances": [], + "editionSettings": [], "eventsFunctions": [ { "fullName": "", @@ -11510,92 +11293,74 @@ "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::IsInGameEdition" + "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::IsPressed" }, "parameters": [ - "", + "Object", "" ] } ], - "actions": [], - "events": [ + "actions": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "MettreAutour" - }, - "parameters": [ - "Thumb", - "Border", - "Border.MultitouchJoystick::JoystickForce() * Border.Width() / 2", - "Border.MultitouchJoystick::JoystickAngle()" - ] - } + "type": { + "value": "Cache" + }, + "parameters": [ + "Object" ] }, { - "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", - "" - ] - } + "type": { + "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::ActivateControl" + }, + "parameters": [ + "Object", + "no", + "" + ] + }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "ShouldBeHiddenWhenReleased", + "False", + "" ] } ] @@ -12602,7 +12367,8 @@ "hidden": true, "name": "ShouldBeHiddenWhenReleased" } - ] + ], + "variants": [] } ] }, diff --git a/examples/starting-3d-top-down-rpg/starting-3d-top-down-rpg.json b/examples/starting-3d-top-down-rpg/starting-3d-top-down-rpg.json index ffcd80e1f..978e72a36 100644 --- a/examples/starting-3d-top-down-rpg/starting-3d-top-down-rpg.json +++ b/examples/starting-3d-top-down-rpg/starting-3d-top-down-rpg.json @@ -1495,7 +1495,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.9.0", + "version": "1.8.4", "description": [ "Multitouch joysticks are objects showing a joystick on the screen, useful for mobile. They work like a physical gamepad:", "- 4 or 8 directions", @@ -2005,11 +2005,11 @@ "objectGroups": [] }, { - "description": "Check if a button was just pressed on a multitouch controller.", - "fullName": "Multitouch controller button just pressed", + "description": "Check if a button is pressed on a gamepad.", + "fullName": "Multitouch controller button pressed", "functionType": "Condition", - "name": "IsButtonJustPressed", - "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ was just pressed", + "name": "IsButtonPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -2021,7 +2021,7 @@ "parameters": [ "Controllers[ControllerIdentifier].Buttons[Button].State", "=", - "\"JustPressed\"" + "\"Pressed\"" ] } ], @@ -2053,73 +2053,7 @@ "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\"" - ] - } - ] - } - ], - "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.", + "description": "Check if a button is released on a gamepad.", "fullName": "Multitouch controller button released", "functionType": "Condition", "name": "IsButtonReleased", @@ -2205,7 +2139,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"JustPressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -4695,49 +4629,11 @@ "conditions": [ { "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "IsReleased", - "True", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsReleased", - "False", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + "value": "SpriteMultitouchJoystick::MultitouchButton::IsReleased" }, "parameters": [ "Object", "Behavior", - "\"Idle\"", - "" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "True", "" ] } @@ -4748,7 +4644,7 @@ "value": "SetBooleanVariable" }, "parameters": [ - "IsJustPressed", + "IsReleased", "False", "" ] @@ -4760,7 +4656,7 @@ "parameters": [ "Object", "Behavior", - "\"Pressed\"", + "\"Idle\"", "" ] } @@ -4858,17 +4754,7 @@ "parameters": [ "Object", "Behavior", - "\"JustPressed\"", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "True", + "\"Pressed\"", "" ] } @@ -4939,16 +4825,6 @@ "" ] }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "False", - "" - ] - }, { "type": { "value": "SetNumberVariable" @@ -4978,11 +4854,11 @@ "objectGroups": [] }, { - "description": "Check if the button was just pressed.", - "fullName": "Button just pressed", + "description": "Check if button is released.", + "fullName": "Button released", "functionType": "Condition", - "name": "IsJustPressed", - "sentence": "Button _PARAM0_ was just pressed", + "name": "IsReleased", + "sentence": "Button _PARAM0_ is released", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -4992,7 +4868,7 @@ "value": "BooleanVariable" }, "parameters": [ - "IsJustPressed", + "IsReleased", "True", "" ] @@ -5026,7 +4902,7 @@ "objectGroups": [] }, { - "description": "Check if the button is pressed.", + "description": "Check if button is pressed.", "fullName": "Button pressed", "functionType": "Condition", "name": "IsPressed", @@ -5073,54 +4949,6 @@ ], "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", @@ -5162,7 +4990,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"JustPressed\",\"Pressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -5203,13 +5031,6 @@ "hidden": true, "name": "IsReleased" }, - { - "value": "", - "type": "Boolean", - "label": "Button just pressed", - "hidden": true, - "name": "IsJustPressed" - }, { "value": "0", "type": "Number", @@ -7624,6 +7445,7 @@ } ], "instances": [], + "editionSettings": {}, "eventsFunctions": [ { "fullName": "", @@ -8832,7 +8654,8 @@ "hidden": true, "name": "ShouldBeHiddenWhenReleased" } - ] + ], + "variants": [] } ] }, diff --git a/examples/starting-3d-twin-stick-shooter/starting-3d-twin-stick-shooter.json b/examples/starting-3d-twin-stick-shooter/starting-3d-twin-stick-shooter.json index 62afafbad..d4a9f0c81 100644 --- a/examples/starting-3d-twin-stick-shooter/starting-3d-twin-stick-shooter.json +++ b/examples/starting-3d-twin-stick-shooter/starting-3d-twin-stick-shooter.json @@ -1285,19 +1285,19 @@ "category": "Input", "extensionNamespace": "", "fullName": "Multitouch joystick and buttons (sprite)", - "gdevelopVersion": ">=5.5.222", + "gdevelopVersion": "", "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", + "version": "1.4.0", "description": [ - "Multitouch joysticks are objects showing a joystick on the screen, useful for mobile. They work like a physical gamepad:", + "Multitouch joysticks can be used the same way as physical gamepads:", "- 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.", + "- 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)." ], @@ -1362,33 +1362,108 @@ ], "eventsFunctions": [ { - "description": "Check if the events are running for the editor.", - "fullName": "Editor is running", + "description": "Check if a button is pressed on a gamepad.", + "fullName": "Multitouch controller button pressed", "functionType": "Condition", - "name": "IsInGameEdition", - "private": true, - "sentence": "Events are running for the editor", + "name": "IsButtonPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", "events": [ { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "const game = runtimeScene.getGame();\r", - "eventsFunctionContext.returnValue = game.isInGameEdition && game.isInGameEdition();" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"Pressed\"" + ] + } ], - "parameterObjects": "", - "useStrict": true, - "eventsSheetExpanded": false + "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" } ], - "parameters": [], "objectGroups": [] }, { - "fullName": "Accelerated speed", - "functionType": "Expression", - "name": "AcceleratedSpeed", + "description": "Check if a button is released on a gamepad.", + "fullName": "Multitouch controller button released", + "functionType": "Condition", + "name": "IsButtonReleased", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is released", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"Released\"" + ] + } + ], + "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": "Change a button state for a multitouch controller.", + "fullName": "Button state", + "functionType": "Action", + "name": "SetButtonState", "private": true, - "sentence": "", + "sentence": "Mark _PARAM2_ button as _PARAM3_ for multitouch controller _PARAM1_", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -1396,443 +1471,108 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SetStringVariable" }, "parameters": [ - "AcceleratedSpeed", + "Controllers[ControllerIdentifier].Buttons[Button].State", "=", - "CurrentSpeed" + "ButtonState" ] } - ], - "events": [ + ] + } + ], + "parameters": [ + { + "description": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier", + "type": "expression" + }, + { + "description": "Button name", + "name": "Button", + "type": "string" + }, + { + "description": "Button state", + "name": "ButtonState", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "type": "stringWithSelector" + } + ], + "objectGroups": [] + }, + { + "description": "Change the dead zone radius of a joystick. 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).", + "fullName": "Dead zone radius", + "functionType": "Action", + "name": "SetDeadZone", + "private": true, + "sentence": "Change the dead zone of multitouch joystick _PARAM2_ of multitouch controller _PARAM1_ to _PARAM3_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ { - "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", - "=", - "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": { + "value": "SetNumberVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].DeadZone", + "=", + "DeadZoneRadius" ] - }, - { - "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": "NumberVariable" - }, - "parameters": [ - "TargetedSpeed", - "=", - "0" - ] - } - ], - "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", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "clamp(AcceleratedSpeed, -SpeedMax, SpeedMax)" - ] - } - ] - } - ], - "variables": [ - { - "name": "AcceleratedSpeed", - "type": "number", - "value": 0 } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { - "description": "Current speed", - "name": "CurrentSpeed", - "type": "expression" - }, - { - "description": "Targeted speed", - "name": "TargetedSpeed", - "type": "expression" - }, - { - "description": "Max speed", - "name": "SpeedMax", + "description": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier", "type": "expression" }, { - "description": "Acceleration", - "name": "Acceleration", - "type": "expression" + "description": "Joystick name", + "name": "JoystickIdentifier", + "type": "string" }, { - "description": "Deceleration", - "name": "Deceleration", + "description": "Dead zone radius", + "name": "DeadZoneRadius", + "supplementaryInformation": "[]", "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", + "description": "Return the dead zone radius of a joystick. 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).", + "fullName": "Dead zone radius", + "functionType": "Expression", + "name": "DeadZone", + "private": true, + "sentence": "Change multitouch joystick _PARAM2_ of multitouch controller _PARAM1_ dead zone to _PARAM3_", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Buttons[Button].State", - "=", - "\"JustPressed\"" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "SetReturnBoolean" + "value": "SetReturnNumber" }, "parameters": [ - "True" + "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].DeadZone" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Multitouch controller identifier (1, 2, 3, 4...)", @@ -1840,265 +1580,20 @@ "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\"]", + "description": "Joystick name", + "name": "JoystickIdentifier", "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\"" - ] - } - ] - } - ], - "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", - "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is released", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Buttons[Button].State", - "=", - "\"Released\"" - ] - } - ], - "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": "Change a button state for a multitouch controller.", - "fullName": "Button state", - "functionType": "Action", - "name": "SetButtonState", - "private": true, - "sentence": "Mark _PARAM2_ button as _PARAM3_ for multitouch controller _PARAM1_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetStringVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Buttons[Button].State", - "=", - "ButtonState" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" - }, - { - "description": "Button name", - "name": "Button", - "type": "string" - }, - { - "description": "Button state", - "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"JustPressed\",\"Released\"]", - "type": "stringWithSelector" - } - ], - "objectGroups": [] - }, - { - "description": "Change the dead zone radius of a joystick. 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).", - "fullName": "Dead zone radius", - "functionType": "Action", - "name": "SetDeadZone", - "private": true, - "sentence": "Change the dead zone of multitouch joystick _PARAM2_ of multitouch controller _PARAM1_ to _PARAM3_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].DeadZone", - "=", - "DeadZoneRadius" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" - }, - { - "description": "Joystick name", - "name": "JoystickIdentifier", - "type": "string" - }, - { - "description": "Dead zone radius", - "name": "DeadZoneRadius", - "supplementaryInformation": "[]", - "type": "expression" - } - ], - "objectGroups": [] - }, - { - "description": "Return the dead zone radius of a joystick. 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).", - "fullName": "Dead zone radius", - "functionType": "Expression", - "name": "DeadZone", - "private": true, - "sentence": "Change multitouch joystick _PARAM2_ of multitouch controller _PARAM1_ dead zone to _PARAM3_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].DeadZone" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" - }, - { - "description": "Joystick name", - "name": "JoystickIdentifier", - "type": "string" - } - ], - "objectGroups": [] - }, - { - "description": "the direction index (left = 1, bottom = 1, right = 2, top = 3) for an angle (in degrees).", - "fullName": "Angle to 4-way index", - "functionType": "ExpressionAndCondition", - "name": "AngleTo4Way", - "private": true, - "sentence": "The angle _PARAM1_ 4-way index", + "description": "the direction index (left = 1, bottom = 1, right = 2, top = 3) for an angle (in degrees).", + "fullName": "Angle to 4-way index", + "functionType": "ExpressionAndCondition", + "name": "AngleTo4Way", + "private": true, + "sentence": "The angle _PARAM1_ 4-way index", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -2851,11 +2346,6 @@ "name": "JoystickIdentifier", "supplementaryInformation": "[\"Primary\",\"Secondary\"]", "type": "stringWithSelector" - }, - { - "description": "", - "name": "Coucou", - "type": "expression" } ], "objectGroups": [] @@ -3085,7 +2575,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "XFromAngleAndDistance(SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier), SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier))" + "SpriteMultitouchJoystick::JoystickForce(ControllerIdentifier, JoystickIdentifier) * cos(ToRad(SpriteMultitouchJoystick::JoystickAngle(ControllerIdentifier, JoystickIdentifier)))" ] } ] @@ -3125,7 +2615,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "YFromAngleAndDistance(SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier), SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier))" + "SpriteMultitouchJoystick::JoystickForce(ControllerIdentifier, JoystickIdentifier) * sin(ToRad(SpriteMultitouchJoystick::JoystickAngle(ControllerIdentifier, JoystickIdentifier)))" ] } ] @@ -3148,2032 +2638,46 @@ } ], "objectGroups": [] - }, + } + ], + "eventsBasedBehaviors": [ { - "description": "Check if a new touch has started on the right or left side of the screen.", - "fullName": "New touch on a screen side", - "functionType": "Condition", - "group": "Multitouch Joystick", - "name": "HasTouchStartedOnScreenSide", - "sentence": "A new touch has started on the _PARAM2_ side of the screen on _PARAM1_'s layer", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "HasAnyTouchOrMouseStarted" - }, - "parameters": [ - "" - ] - } - ], - "actions": [], - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "Side", - "=", - "\"Left\"" - ] - }, - { - "type": { - "value": "TouchX" - }, - "parameters": [ - "", - "StartedTouchOrMouseId(0)", - "<", - "CameraCenterX(Object.Layer())", - "Object.Layer()", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "Side", - "=", - "\"Right\"" - ] - }, - { - "type": { - "value": "TouchX" - }, - "parameters": [ - "", - "StartedTouchOrMouseId(0)", - ">=", - "CameraCenterX(Object.Layer())", - "Object.Layer()", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - } - ] - } - ], - "parameters": [ - { - "description": "Multitouch joystick", - "name": "Object", - "supplementaryInformation": "SpriteMultitouchJoystick::SpriteMultitouchJoystick", - "type": "objectList" - }, - { - "description": "Screen side", - "name": "Side", - "supplementaryInformation": "[\"Left\",\"Right\"]", - "type": "stringWithSelector" - } - ], - "objectGroups": [] - } - ], - "eventsBasedBehaviors": [ - { - "description": "Joystick that can be controlled by interacting with a touchscreen.", - "fullName": "Multitouch Joystick", - "name": "MultitouchJoystick", - "objectType": "", - "private": true, - "eventsFunctions": [ + "description": "Joystick that can be controlled by interacting with a touchscreen.", + "fullName": "Multitouch Joystick", + "name": "MultitouchJoystick", + "objectType": "", + "private": true, + "eventsFunctions": [ { "fullName": "", "functionType": "Action", "name": "onCreated", "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::SetDeadZone" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "DeadZoneRadius", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "Action", - "name": "onDeActivate", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "Action", - "name": "doStepPreEvents", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "inverted": true, - "value": "SpriteMultitouchJoystick::IsInGameEdition" - }, - "parameters": [ - "", - "" - ] - } - ], - "actions": [], - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "HasGameJustResumed" - }, - "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)" - }, - { - "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": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "the joystick force (from 0 to 1).", - "fullName": "Joystick force", - "functionType": "ExpressionAndCondition", - "name": "JoystickForce", - "sentence": "the joystick force", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "max(0, JoystickForce - DeadZoneRadius) / (1 - DeadZoneRadius)" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "JoystickForce", - "name": "SetJoystickForce", - "private": true, - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "JoystickForce", - "=", - "Value" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::SetJoystickForce" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "JoystickForce", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - }, - { - "description": "", - "name": "Parameter", - "type": "objectList" - } - ], - "objectGroups": [] - }, - { - "description": "Return the angle the joystick is pointing towards (Range: -180 to 180).", - "fullName": "Joystick angle", - "functionType": "Expression", - "name": "JoystickAngle", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "JoystickAngle" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "Change the angle the joystick is pointing towards (Range: -180 to 180).", - "fullName": "Joystick angle", - "functionType": "Action", - "name": "SetJoystickAngle", - "private": true, - "sentence": "Change the joystick angle of _PARAM0_ to _PARAM2_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "JoystickAngle", - "=", - "Value" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::SetJoystickAngle" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "JoystickAngle", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - }, - { - "description": "Angle", - "name": "Value", - "type": "expression" - } - ], - "objectGroups": [] - }, - { - "description": "Return the stick force on X axis (from -1 at the left to 1 at the right).", - "fullName": "Stick X force", - "functionType": "Expression", - "name": "StickForceX", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "Object.Behavior::JoystickForce() * cos(ToRad(Object.Behavior::JoystickAngle()))" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "Return the stick force on Y axis (from -1 at the top to 1 at the bottom).", - "fullName": "Stick Y force", - "functionType": "Expression", - "name": "StickForceY", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "Object.Behavior::JoystickForce() * sin(ToRad(Object.Behavior::JoystickAngle()))" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "Check if joystick is pushed in a given direction.", - "fullName": "Joystick pushed in a direction (4-way movement)", - "functionType": "Condition", - "name": "IsDirectionPushed4Way", - "sentence": "_PARAM0_ is pushed in direction _PARAM2_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::JoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - ">", - "0", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::IsAngleIn4WayDirection" - }, - "parameters": [ - "", - "JoystickAngle", - "Direction", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - }, - { - "description": "Direction", - "name": "Direction", - "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\"]", - "type": "stringWithSelector" - } - ], - "objectGroups": [] - }, - { - "description": "Check if joystick is pushed in a given direction.", - "fullName": "Joystick pushed in a direction (8-way movement)", - "functionType": "Condition", - "name": "IsDirectionPushed8Way", - "sentence": "_PARAM0_ is pushed in direction _PARAM2_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::JoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - ">", - "0", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::IsAngleIn8WayDirection" - }, - "parameters": [ - "", - "JoystickAngle", - "Direction", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - }, - { - "description": "Direction", - "name": "Direction", - "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\",\"UpLeft\",\"UpRight\",\"DownLeft\",\"DownRight\"]", - "type": "stringWithSelector" - } - ], - "objectGroups": [] - }, - { - "description": "Check if a joystick is pressed.", - "fullName": "Joystick pressed", - "functionType": "Condition", - "name": "IsPressed", - "sentence": "Joystick _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::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "Reset the joystick values (except for angle, which stays the same)", - "fullName": "Reset", - "functionType": "Action", - "name": "Reset", - "private": true, - "sentence": "Reset the joystick of _PARAM0_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "0", - "" - ] - }, - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "0" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "the multitouch controller identifier.", - "fullName": "Multitouch controller identifier", - "functionType": "ExpressionAndCondition", - "group": "Multitouch Joystick configuration", - "name": "ControllerIdentifier", - "sentence": "the multitouch controller identifier", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "ControllerIdentifier" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "ControllerIdentifier", - "name": "SetControllerIdentifier", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "ControllerIdentifier", - "=", - "Value" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "the joystick name.", - "fullName": "Joystick name", - "functionType": "ExpressionAndCondition", - "group": "Multitouch Joystick configuration", - "name": "JoystickIdentifier", - "sentence": "the joystick name", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnString" - }, - "parameters": [ - "JoystickIdentifier" - ] - } - ] - } - ], - "expressionType": { - "type": "string" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "JoystickIdentifier", - "name": "SetJoystickIdentifier", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetStringVariable" - }, - "parameters": [ - "JoystickIdentifier", - "=", - "Value" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "the dead zone radius (range: 0 to 1) of the joystick. 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).", - "fullName": "Dead zone radius", - "functionType": "ExpressionAndCondition", - "group": "Multitouch Joystick configuration", - "name": "DeadZoneRadius", - "sentence": "the dead zone radius", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "DeadZoneRadius" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "DeadZoneRadius", - "name": "SetDeadZoneRadius", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "DeadZoneRadius", - "=", - "Value" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::SetDeadZone" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "Value", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "Force the joystick into the pressing state.", - "fullName": "Force start pressing", - "functionType": "Action", - "name": "ForceStartPressing", - "sentence": "Force start pressing _PARAM0_ with touch identifier: _PARAM2_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "Value" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - }, - { - "description": "Touch identifier", - "name": "Value", - "type": "expression" - } - ], - "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "1", - "type": "Number", - "label": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier" - }, - { - "value": "Primary", - "type": "String", - "label": "Joystick name", - "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": "0", - "type": "Number", - "label": "Joystick angle (range: -180 to 180)", - "hidden": true, - "name": "JoystickAngle" - }, - { - "value": "0", - "type": "Number", - "label": "Joystick force (range: 0 to 1)", - "hidden": true, - "name": "JoystickForce" - }, - { - "value": "0", - "type": "Number", - "label": "", - "hidden": true, - "name": "TouchId" - }, - { - "value": "", - "type": "Number", - "label": "", - "hidden": true, - "name": "TouchIndex" - } - ], - "sharedPropertyDescriptors": [] - }, - { - "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": "", - "eventsFunctions": [ - { - "fullName": "", - "functionType": "Action", - "name": "doStepPreEvents", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "IsReleased", - "True", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsReleased", - "False", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" - }, - "parameters": [ - "Object", - "Behavior", - "\"Idle\"", - "" - ] - } - ] - }, - { - "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": [ - { - "type": { - "inverted": true, - "value": "SpriteMultitouchJoystick::MultitouchButton::IsPressed" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - }, - { - "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": "BuiltinCommonInstructions::Or" - }, - "parameters": [], - "subInstructions": [ - { - "type": { - "value": "CollisionPoint" - }, - "parameters": [ - "Object", - "TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer())", - "TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer())" - ] - }, - { - "type": { - "value": "NumberVariable" - }, - "parameters": [ - "Radius", - ">", - "DistanceBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer()), TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer()))" - ] - } - ] - } - ], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "StartedTouchOrMouseId(TouchIndex)" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" - }, - "parameters": [ - "Object", - "Behavior", - "\"JustPressed\"", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "True", - "" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchIndex", - "+", - "1" - ] - } - ] - } - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::IsPressed" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - }, - { - "type": { - "value": "HasTouchEnded" - }, - "parameters": [ - "", - "TouchId" - ] - } - ], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" - }, - "parameters": [ - "Object", - "Behavior", - "\"Released\"", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsReleased", - "True", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "False", - "" - ] - }, - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "0" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "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", - "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", - "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": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", - "type": "behavior" - }, - { - "description": "Button state", - "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"JustPressed\",\"Pressed\",\"Released\"]", - "type": "stringWithSelector" - } - ], - "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "1", - "type": "Number", - "label": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier" - }, - { - "value": "A", - "type": "String", - "label": "Button identifier", - "name": "ButtonIdentifier" - }, - { - "value": "0", - "type": "Number", - "label": "TouchID", - "hidden": true, - "name": "TouchId" - }, - { - "value": "", - "type": "Number", - "label": "", - "hidden": true, - "name": "TouchIndex" - }, - { - "value": "", - "type": "Boolean", - "label": "Button released", - "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.", - "name": "Radius" - } - ], - "sharedPropertyDescriptors": [] - }, - { - "description": "Control a platformer character with a multitouch controller.", - "fullName": "Platformer multitouch controller mapper", - "name": "PlatformerMultitouchMapper", - "objectType": "", - "quickCustomizationVisibility": "hidden", - "eventsFunctions": [ - { - "fullName": "", - "functionType": "Action", - "name": "doStepPreEvents", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "\"Left\"", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateLeftKey" - }, - "parameters": [ - "Object", - "Property" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "\"Right\"", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateRightKey" - }, - "parameters": [ - "Object", - "Property" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "\"Up\"", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateUpKey" - }, - "parameters": [ - "Object", - "Property" - ] - }, - { - "type": { - "value": "PlatformBehavior::SimulateLadderKey" - }, - "parameters": [ - "Object", - "Property" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "\"Down\"", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateDownKey" - }, - "parameters": [ - "Object", - "Property" - ] - } - ] - }, + "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "conditions": [], + "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::IsButtonPressed" + "value": "SpriteMultitouchJoystick::SetDeadZone" }, "parameters": [ "", "ControllerIdentifier", - "JumpButton", - "\"Down\"" + "JoystickIdentifier", + "DeadZoneRadius", + "" ] - } - ], - "actions": [ + }, { "type": { - "value": "PlatformBehavior::SimulateJumpKey" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" }, "parameters": [ "Object", - "Property" + "Behavior", + "" ] } ] @@ -5188,64 +2692,50 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::PlatformerMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "", - "type": "Behavior", - "label": "Platform character behavior", - "extraInformation": [ - "PlatformBehavior::PlatformerObjectBehavior" - ], - "choices": [], - "name": "Property" - }, - { - "value": "1", - "type": "Number", - "label": "Controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier" }, { - "value": "Primary", - "type": "Choice", - "label": "Joystick name", - "group": "Controls", - "choices": [ + "fullName": "", + "functionType": "Action", + "name": "onDeActivate", + "sentence": "", + "events": [ { - "label": "Primary", - "value": "Primary" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" }, { - "label": "Secondary", - "value": "Secondary" + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } ], - "name": "JoystickIdentifier" + "objectGroups": [] }, - { - "value": "A", - "type": "String", - "label": "Jump button name", - "group": "Controls", - "name": "JumpButton" - } - ], - "sharedPropertyDescriptors": [] - }, - { - "description": "Control a 3D physics character with a multitouch controller.", - "fullName": "3D platformer multitouch controller mapper", - "name": "Platformer3DMultitouchMapper", - "objectType": "", - "quickCustomizationVisibility": "hidden", - "eventsFunctions": [ { "fullName": "", "functionType": "Action", @@ -5257,14 +2747,9 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::StickForce" + "value": "HasGameJustResumed" }, "parameters": [ - "", - ">", - "0", - "ControllerIdentifier", - "JoystickIdentifier", "" ] } @@ -5272,54 +2757,210 @@ "actions": [ { "type": { - "value": "Physics3D::PhysicsCharacter3D::SetForwardAngle" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" }, "parameters": [ "Object", - "PhysicsCharacter3D", - "=", - "SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier) + CameraAngle(Object.Layer())" + "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": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyTouchIndex" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "0" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "StartedTouchOrMouseCount()", + "conditions": [], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::PropertyTouchId" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "0" + ] + }, + { + "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": { - "value": "Physics3D::PhysicsCharacter3D::SimulateStick" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 }, - "parameters": [ - "Object", - "PhysicsCharacter3D", - "-90", - "SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier)" + "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" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } ] } - ] + ], + "parameters": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Update joystick position", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::IsButtonPressed" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JumpButton", - "\"Down\"" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::PropertyTouchId" + }, + "parameters": [ + "Object", + "Behavior", + "!=", + "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": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" - }, - "parameters": [ - "Object", - "PhysicsCharacter3D" - ] - } - ] + "parameters": [] } ], "parameters": [ @@ -5331,129 +2972,37 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::Platformer3DMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "", - "type": "Behavior", - "label": "3D physics character", - "extraInformation": [ - "Physics3D::PhysicsCharacter3D" - ], - "choices": [], - "name": "PhysicsCharacter3D" - }, - { - "value": "1", - "type": "Number", - "label": "Controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier" - }, - { - "value": "Primary", - "type": "Choice", - "label": "Walk joystick", - "group": "Controls", - "choices": [ - { - "label": "Primary", - "value": "Primary" - }, - { - "label": "Secondary", - "value": "Secondary" - } - ], - "name": "JoystickIdentifier" }, { - "value": "A", - "type": "String", - "label": "Jump button name", - "group": "Controls", - "name": "JumpButton" - } - ], - "sharedPropertyDescriptors": [] - }, - { - "description": "Control a 3D physics character with a multitouch controller.", - "fullName": "3D shooter multitouch controller mapper", - "name": "Shooter3DMultitouchMapper", - "objectType": "", - "quickCustomizationVisibility": "hidden", - "eventsFunctions": [ - { - "fullName": "", - "functionType": "Action", - "name": "doStepPreEvents", - "sentence": "", + "description": "the joystick force (from 0 to 1).", + "fullName": "Joystick force", + "functionType": "ExpressionAndCondition", + "name": "JoystickForce", + "sentence": "the joystick force", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::StickForce" - }, - "parameters": [ - "", - ">", - "0", - "ControllerIdentifier", - "JoystickIdentifier", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateStick" - }, - "parameters": [ - "Object", - "PhysicsCharacter3D", - "SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier)", - "SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier)" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::IsButtonPressed" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JumpButton", - "\"Down\"" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" + "value": "SetReturnNumber" }, "parameters": [ - "Object", - "PhysicsCharacter3D" + "max(0, JoystickForce - DeadZoneRadius) / (1 - DeadZoneRadius)" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -5463,151 +3012,90 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::Shooter3DMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "", - "type": "Behavior", - "label": "3D physics character", - "extraInformation": [ - "Physics3D::PhysicsCharacter3D" - ], - "choices": [], - "name": "PhysicsCharacter3D" - }, - { - "value": "1", - "type": "Number", - "label": "Controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier" - }, - { - "value": "Primary", - "type": "Choice", - "label": "Walk joystick", - "group": "Controls", - "choices": [ - { - "label": "Primary", - "value": "Primary" - }, - { - "label": "Secondary", - "value": "Secondary" - } - ], - "name": "JoystickIdentifier" }, - { - "value": "A", - "type": "String", - "label": "Jump button name", - "group": "Controls", - "name": "JumpButton" - } - ], - "sharedPropertyDescriptors": [] - }, - { - "description": "Control camera rotations with a multitouch controller.", - "fullName": "First person camera multitouch controller mapper", - "name": "FirstPersonMultitouchMapper", - "objectType": "", - "quickCustomizationVisibility": "hidden", - "eventsFunctions": [ { "fullName": "", - "functionType": "Action", - "name": "doStepPreEvents", + "functionType": "ActionWithOperator", + "getterName": "JoystickForce", + "name": "SetJoystickForce", + "private": true, "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", - "=", - "SpriteMultitouchJoystick::AcceleratedSpeed(CurrentRotationSpeedZ, SpriteMultitouchJoystick::StickForceX(ControllerIdentifier, CameraStick) * HorizontalRotationSpeedMax, HorizontalRotationSpeedMax, HorizontalRotationAcceleration, HorizontalRotationDeceleration)" - ] - }, - { - "type": { - "value": "SetAngle" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickForce" }, "parameters": [ "Object", - "+", - "CurrentRotationSpeedZ * TimeDelta()" - ] - }, - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "CurrentRotationSpeedY", + "Behavior", "=", - "SpriteMultitouchJoystick::AcceleratedSpeed(CurrentRotationSpeedY, SpriteMultitouchJoystick::StickForceY(ControllerIdentifier, CameraStick) * VerticalRotationSpeedMax, VerticalRotationSpeedMax, VerticalRotationAcceleration, VerticalRotationDeceleration)" - ] - }, - { - "type": { - "value": "Scene3D::Base3DBehavior::SetRotationY" - }, - "parameters": [ - "Object", - "Object3D", - "+", - "CurrentRotationSpeedY * TimeDelta()" + "Value" ] }, { "type": { - "value": "Scene3D::Base3DBehavior::SetRotationY" + "value": "SpriteMultitouchJoystick::SetJoystickForce" }, "parameters": [ - "Object", - "Object3D", - "=", - "clamp(Object.Object3D::RotationY(), VerticalAngleMin, VerticalAngleMax)" + "", + "ControllerIdentifier", + "JoystickIdentifier", + "JoystickForce", + "" ] - }, + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Return the angle the joystick is pointing towards (Range: -180 to 180).", + "fullName": "Joystick angle", + "functionType": "Expression", + "name": "JoystickAngle", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper::LookFromObjectEyes" + "value": "SetReturnNumber" }, "parameters": [ - "Object", - "Behavior", - "" + "JoystickAngle" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -5617,20 +3105,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "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", + "description": "Change the angle the joystick is pointing towards (Range: -180 to 180).", + "fullName": "Joystick angle", "functionType": "Action", - "group": "Layers and cameras", - "name": "LookFromObjectEyes", + "name": "SetJoystickAngle", "private": true, - "sentence": "Move the camera to look though _PARAM0_ eyes", + "sentence": "Change the joystick angle of _PARAM0_ to _PARAM2_", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -5638,61 +3125,24 @@ "actions": [ { "type": { - "value": "CentreCamera" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickAngle" }, "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": [ - "", + "Behavior", "=", - "Object.Object3D::RotationX()", - "GetArgumentAsString(\"Layer\")", - "" + "Value" ] }, { "type": { - "value": "SetCameraAngle" + "value": "SpriteMultitouchJoystick::SetJoystickAngle" }, "parameters": [ "", - "=", - "Object.Angle() + 90", - "Object.Layer()", + "ControllerIdentifier", + "JoystickIdentifier", + "JoystickAngle", "" ] } @@ -5708,19 +3158,23 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" + }, + { + "description": "Angle", + "name": "Value", + "type": "expression" } ], "objectGroups": [] }, { - "description": "the maximum horizontal rotation speed of the object.", - "fullName": "Maximum horizontal rotation speed", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper horizontal rotation configuration", - "name": "HorizontalRotationSpeedMax", - "sentence": "the maximum horizontal rotation speed", + "description": "Return the stick force on X axis (from -1 at the left to 1 at the right).", + "fullName": "Stick X force", + "functionType": "Expression", + "name": "StickForceX", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -5731,7 +3185,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "HorizontalRotationSpeedMax" + "Object.Behavior::JoystickForce() * cos(ToRad(Object.Behavior::JoystickAngle()))" ] } ] @@ -5749,17 +3203,17 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] }, { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "HorizontalRotationSpeedMax", - "name": "SetHorizontalRotationSpeedMax", + "description": "Return the stick force on Y axis (from -1 at the top to 1 at the bottom).", + "fullName": "Stick Y force", + "functionType": "Expression", + "name": "StickForceY", "sentence": "", "events": [ { @@ -5768,17 +3222,18 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SetReturnNumber" }, "parameters": [ - "HorizontalRotationSpeedMax", - "=", - "Value" + "Object.Behavior::JoystickForce() * sin(ToRad(Object.Behavior::JoystickAngle()))" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -5788,38 +3243,58 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the horizontal rotation acceleration of the object.", - "fullName": "Horizontal rotation acceleration", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper horizontal rotation configuration", - "name": "HorizontalRotationAcceleration", - "sentence": "the horizontal rotation acceleration", + "description": "Check if joystick is pushed in a given direction.", + "fullName": "Joystick pushed in a direction (4-way movement)", + "functionType": "Condition", + "name": "IsDirectionPushed4Way", + "sentence": "_PARAM0_ is pushed in direction _PARAM2_", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::JoystickForce" + }, + "parameters": [ + "Object", + "Behavior", + ">", + "0", + "" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::IsAngleIn4WayDirection" + }, + "parameters": [ + "", + "JoystickAngle", + "Direction", + "" + ] + } + ], "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "SetReturnBoolean" }, "parameters": [ - "HorizontalRotationAcceleration" + "True" ] } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -5829,31 +3304,59 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" + }, + { + "description": "Direction", + "name": "Direction", + "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\"]", + "type": "stringWithSelector" } ], "objectGroups": [] }, { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "HorizontalRotationAcceleration", - "name": "SetHorizontalRotationAcceleration", - "sentence": "", + "description": "Check if joystick is pushed in a given direction.", + "fullName": "Joystick pushed in a direction (8-way movement)", + "functionType": "Condition", + "name": "IsDirectionPushed8Way", + "sentence": "_PARAM0_ is pushed in direction _PARAM2_", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::JoystickForce" + }, + "parameters": [ + "Object", + "Behavior", + ">", + "0", + "" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::IsAngleIn8WayDirection" + }, + "parameters": [ + "", + "JoystickAngle", + "Direction", + "" + ] + } + ], "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SetReturnBoolean" }, "parameters": [ - "HorizontalRotationAcceleration", - "=", - "Value" + "True" ] } ] @@ -5868,38 +3371,52 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" + }, + { + "description": "Direction", + "name": "Direction", + "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\",\"UpLeft\",\"UpRight\",\"DownLeft\",\"DownRight\"]", + "type": "stringWithSelector" } ], "objectGroups": [] }, { - "description": "the horizontal rotation deceleration of the object.", - "fullName": "Horizontal rotation deceleration", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper horizontal rotation configuration", - "name": "HorizontalRotationDeceleration", - "sentence": "the horizontal rotation deceleration", + "description": "Check if a joystick is pressed.", + "fullName": "Joystick pressed", + "functionType": "Condition", + "name": "IsPressed", + "sentence": "Joystick _PARAM0_ is pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::PropertyTouchId" + }, + "parameters": [ + "Object", + "Behavior", + "!=", + "0" + ] + } + ], "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "SetReturnBoolean" }, "parameters": [ - "HorizontalRotationDeceleration" + "True" ] } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -5909,18 +3426,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] }, { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "HorizontalRotationDeceleration", - "name": "SetHorizontalRotationDeceleration", - "sentence": "", + "description": "Reset the joystick values (except for angle, which stays the same)", + "fullName": "Reset", + "functionType": "Action", + "name": "Reset", + "private": true, + "sentence": "Reset the joystick of _PARAM0_", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -5928,12 +3446,25 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" }, "parameters": [ - "HorizontalRotationDeceleration", + "Object", + "Behavior", "=", - "Value" + "0", + "" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyTouchId" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "0" ] } ] @@ -5948,19 +3479,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the maximum vertical rotation speed of the object.", - "fullName": "Maximum vertical rotation speed", + "description": "the multitouch controller identifier.", + "fullName": "Multitouch controller identifier", "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper vertical rotation configuration", - "name": "VerticalRotationSpeedMax", - "sentence": "the maximum vertical rotation speed", + "group": "Multitouch Joystick configuration", + "name": "ControllerIdentifier", + "sentence": "the multitouch controller identifier", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -5971,7 +3502,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "VerticalRotationSpeedMax" + "ControllerIdentifier" ] } ] @@ -5989,7 +3520,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], @@ -5998,8 +3529,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "VerticalRotationSpeedMax", - "name": "SetVerticalRotationSpeedMax", + "getterName": "ControllerIdentifier", + "name": "SetControllerIdentifier", "sentence": "", "events": [ { @@ -6008,10 +3539,11 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyControllerIdentifier" }, "parameters": [ - "VerticalRotationSpeedMax", + "Object", + "Behavior", "=", "Value" ] @@ -6028,19 +3560,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the vertical rotation acceleration of the object.", - "fullName": "Vertical rotation acceleration", + "description": "the joystick name.", + "fullName": "Joystick name", "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper vertical rotation configuration", - "name": "VerticalRotationAcceleration", - "sentence": "the vertical rotation acceleration", + "group": "Multitouch Joystick configuration", + "name": "JoystickIdentifier", + "sentence": "the joystick name", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -6048,17 +3580,17 @@ "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "SetReturnString" }, "parameters": [ - "VerticalRotationAcceleration" + "JoystickIdentifier" ] } ] } ], "expressionType": { - "type": "expression" + "type": "string" }, "parameters": [ { @@ -6069,7 +3601,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], @@ -6078,8 +3610,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "VerticalRotationAcceleration", - "name": "SetVerticalRotationAcceleration", + "getterName": "JoystickIdentifier", + "name": "SetJoystickIdentifier", "sentence": "", "events": [ { @@ -6088,10 +3620,11 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickIdentifier" }, "parameters": [ - "VerticalRotationAcceleration", + "Object", + "Behavior", "=", "Value" ] @@ -6108,19 +3641,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the vertical rotation deceleration of the object.", - "fullName": "Vertical rotation deceleration", + "description": "the dead zone radius (range: 0 to 1) of the joystick. 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).", + "fullName": "Dead zone radius", "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper vertical rotation configuration", - "name": "VerticalRotationDeceleration", - "sentence": "the vertical rotation deceleration", + "group": "Multitouch Joystick configuration", + "name": "DeadZoneRadius", + "sentence": "the dead zone radius", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -6131,7 +3664,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "VerticalRotationDeceleration" + "DeadZoneRadius" ] } ] @@ -6149,7 +3682,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], @@ -6158,8 +3691,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "VerticalRotationDeceleration", - "name": "SetVerticalRotationDeceleration", + "getterName": "DeadZoneRadius", + "name": "SetDeadZoneRadius", "sentence": "", "events": [ { @@ -6168,10 +3701,11 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyDeadZoneRadius" }, "parameters": [ - "VerticalRotationDeceleration", + "Object", + "Behavior", "=", "Value" ] @@ -6188,72 +3722,271 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] + } + ], + "propertyDescriptors": [ + { + "value": "1", + "type": "Number", + "label": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier" }, { - "description": "the minimum vertical camera angle of the object.", - "fullName": "Minimum vertical camera angle", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper vertical rotation configuration", - "name": "VerticalAngleMin", - "sentence": "the minimum vertical camera angle", + "value": "Primary", + "type": "String", + "label": "Joystick name", + "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": "0", + "type": "Number", + "label": "Joystick angle (range: -180 to 180)", + "hidden": true, + "name": "JoystickAngle" + }, + { + "value": "0", + "type": "Number", + "label": "Joystick force (range: 0 to 1)", + "hidden": true, + "name": "JoystickForce" + }, + { + "value": "0", + "type": "Number", + "label": "", + "hidden": true, + "name": "TouchId" + }, + { + "value": "", + "type": "Number", + "label": "", + "hidden": true, + "name": "TouchIndex" + } + ], + "sharedPropertyDescriptors": [] + }, + { + "description": "Detect button presses made on a touchscreen.", + "fullName": "Multitouch button", + "name": "MultitouchButton", + "objectType": "", + "eventsFunctions": [ + { + "fullName": "", + "functionType": "Action", + "name": "doStepPreEvents", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::IsReleased" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } + ], "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyIsReleased" + }, + "parameters": [ + "Object", + "Behavior", + "no" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" }, "parameters": [ - "VerticalAngleMin" + "Object", + "Behavior", + "\"Idle\"", + "" ] } ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" }, { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "VerticalAngleMin", - "name": "SetVerticalAngleMin", - "sentence": "", - "events": [ + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "SpriteMultitouchJoystick::MultitouchButton::IsPressed" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + }, + { + "type": { + "value": "HasAnyTouchOrMouseStarted" + }, + "parameters": [ + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchIndex" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "0" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "StartedTouchOrMouseCount()", + "conditions": [], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "CollisionPoint" + }, + "parameters": [ + "Object", + "TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)", + "TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchId" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "StartedTouchOrMouseId(TouchIndex)" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + }, + "parameters": [ + "Object", + "Behavior", + "\"Pressed\"", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchIndex" + }, + "parameters": [ + "Object", + "Behavior", + "+", + "1" + ] + } + ] + } + ] + } + ] + }, { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::IsPressed" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + }, + { + "type": { + "value": "HasTouchEnded" + }, + "parameters": [ + "", + "TouchId" + ] + } + ], "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + }, + "parameters": [ + "Object", + "Behavior", + "\"Released\"", + "" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyIsReleased" + }, + "parameters": [ + "Object", + "Behavior", + "yes" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchId" }, "parameters": [ - "VerticalAngleMin", + "Object", + "Behavior", "=", - "Value" + "0" ] } ] @@ -6268,72 +4001,39 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the maximum vertical camera angle of the object.", - "fullName": "Maximum vertical camera angle", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper vertical rotation configuration", - "name": "VerticalAngleMax", - "sentence": "the maximum vertical camera angle", + "description": "Check if button is released.", + "fullName": "Button released", + "functionType": "Condition", + "name": "IsReleased", + "sentence": "Button _PARAM0_ is released", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ + "conditions": [ { "type": { - "value": "SetReturnNumber" + "value": "SpriteMultitouchJoystick::MultitouchButton::PropertyIsReleased" }, "parameters": [ - "VerticalAngleMax" + "Object", + "Behavior" ] } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "VerticalAngleMax", - "name": "SetVerticalAngleMax", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + ], "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SetReturnBoolean" }, "parameters": [ - "VerticalAngleMax", - "=", - "Value" + "True" ] } ] @@ -6348,38 +4048,46 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the z position offset of the object.", - "fullName": "Z position offset", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper position configuration", - "name": "OffsetZ", - "sentence": "the z position offset", + "description": "Check if button is pressed.", + "fullName": "Button pressed", + "functionType": "Condition", + "name": "IsPressed", + "sentence": "Button _PARAM0_ is pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::PropertyTouchId" + }, + "parameters": [ + "Object", + "Behavior", + "!=", + "0" + ] + } + ], "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "SetReturnBoolean" }, "parameters": [ - "OffsetZ" + "True" ] } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -6389,18 +4097,18 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", "type": "behavior" } ], "objectGroups": [] }, { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "OffsetZ", - "name": "SetOffsetZ", - "sentence": "", + "fullName": "Button state", + "functionType": "Action", + "name": "SetButtonState", + "private": true, + "sentence": "Mark the button _PARAM0_ as _PARAM2_", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -6408,12 +4116,14 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::SetButtonState" }, "parameters": [ - "OffsetZ", - "=", - "Value" + "", + "ControllerIdentifier", + "ButtonIdentifier", + "ButtonState", + "" ] } ] @@ -6428,140 +4138,61 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", "type": "behavior" + }, + { + "description": "Button state", + "name": "ButtonState", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "type": "stringWithSelector" } ], "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...)", + "label": "Multitouch 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": "A", + "type": "String", + "label": "Button identifier", + "name": "ButtonIdentifier" }, { "value": "0", "type": "Number", - "unit": "Pixel", - "label": "Z position offset", - "group": "Position", - "name": "OffsetZ" + "label": "TouchID", + "hidden": true, + "name": "TouchId" }, { - "value": "0", + "value": "", "type": "Number", - "unit": "AngularSpeed", - "label": "Current rotation speed Z", + "label": "", "hidden": true, - "name": "CurrentRotationSpeedZ" + "name": "TouchIndex" }, { - "value": "0", - "type": "Number", - "unit": "AngularSpeed", - "label": "Current rotation speed Y", + "value": "", + "type": "Boolean", + "label": "Button released", "hidden": true, - "name": "CurrentRotationSpeedY" + "name": "IsReleased" } ], "sharedPropertyDescriptors": [] }, { - "description": "Control a 3D physics car with a multitouch controller.", - "fullName": "3D car multitouch controller mapper", - "name": "PhysicsCar3DMultitouchMapper", + "description": "Control a platformer character with a multitouch controller.", + "fullName": "Platformer multitouch controller mapper", + "name": "PlatformerMultitouchMapper", "objectType": "", - "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -6574,14 +4205,13 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::StickForce" + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" }, "parameters": [ "", - ">", - "0", "ControllerIdentifier", - "SteerJoystickIdentifier", + "JoystickIdentifier", + "\"Left\"", "" ] } @@ -6589,12 +4219,11 @@ "actions": [ { "type": { - "value": "Physics3D::PhysicsCar3D::SimulateSteeringStick" + "value": "PlatformBehavior::SimulateLeftKey" }, "parameters": [ "Object", - "PhysicsCar3D", - "SpriteMultitouchJoystick::StickForceX(ControllerIdentifier, \"Primary\")" + "Property" ] } ] @@ -6604,14 +4233,78 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::StickForce" + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JoystickIdentifier", + "\"Right\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "PlatformBehavior::SimulateRightKey" + }, + "parameters": [ + "Object", + "Property" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JoystickIdentifier", + "\"Up\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "PlatformBehavior::SimulateUpKey" + }, + "parameters": [ + "Object", + "Property" + ] + }, + { + "type": { + "value": "PlatformBehavior::SimulateLadderKey" + }, + "parameters": [ + "Object", + "Property" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" }, "parameters": [ "", - ">", - "0", "ControllerIdentifier", - "SpeedJoystickIdentifier", + "JoystickIdentifier", + "\"Down\"", "" ] } @@ -6619,12 +4312,11 @@ "actions": [ { "type": { - "value": "Physics3D::PhysicsCar3D::SimulateAcceleratorStick" + "value": "PlatformBehavior::SimulateDownKey" }, "parameters": [ "Object", - "PhysicsCar3D", - "-SpriteMultitouchJoystick::StickForceY(ControllerIdentifier, \"Secondary\")" + "Property" ] } ] @@ -6639,7 +4331,7 @@ "parameters": [ "", "ControllerIdentifier", - "HandBrakeButton", + "JumpButton", "\"Down\"" ] } @@ -6647,11 +4339,11 @@ "actions": [ { "type": { - "value": "Physics3D::PhysicsCar3D::SimulateHandBrakeKey" + "value": "PlatformBehavior::SimulateJumpKey" }, "parameters": [ "Object", - "PhysicsCar3D" + "Property" ] } ] @@ -6666,7 +4358,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::PhysicsCar3DMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::PlatformerMultitouchMapper", "type": "behavior" } ], @@ -6677,12 +4369,12 @@ { "value": "", "type": "Behavior", - "label": "3D physics car", + "label": "Platform character behavior", "extraInformation": [ - "Physics3D::PhysicsCar3D" + "PlatformBehavior::PlatformerObjectBehavior" ], "choices": [], - "name": "PhysicsCar3D" + "name": "Property" }, { "value": "1", @@ -6693,24 +4385,7 @@ { "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", + "label": "Joystick name", "group": "Controls", "choices": [ { @@ -6722,14 +4397,14 @@ "value": "Secondary" } ], - "name": "SpeedJoystickIdentifier" + "name": "JoystickIdentifier" }, { - "value": "B", + "value": "A", "type": "String", - "label": "Hand brake button name", + "label": "Jump button name", "group": "Controls", - "name": "HandBrakeButton" + "name": "JumpButton" } ], "sharedPropertyDescriptors": [] @@ -6739,7 +4414,6 @@ "fullName": "Top-down multitouch controller mapper", "name": "TopDownMultitouchMapper", "objectType": "", - "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -6752,10 +4426,11 @@ "conditions": [ { "type": { - "value": "StringVariable" + "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" }, "parameters": [ - "StickMode", + "Object", + "Behavior", "=", "\"Analog\"" ] @@ -6780,10 +4455,11 @@ "conditions": [ { "type": { - "value": "StringVariable" + "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" }, "parameters": [ - "StickMode", + "Object", + "Behavior", "=", "\"360°\"" ] @@ -6808,10 +4484,11 @@ "conditions": [ { "type": { - "value": "StringVariable" + "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" }, "parameters": [ - "StickMode", + "Object", + "Behavior", "=", "\"8 Directions\"" ] @@ -7420,6 +5097,7 @@ } ], "instances": [], + "editionSettings": {}, "eventsFunctions": [ { "fullName": "", @@ -7538,90 +5216,17 @@ "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "conditions": [], + "actions": [ { "type": { - "inverted": true, - "value": "SpriteMultitouchJoystick::IsInGameEdition" + "value": "MettreAutour" }, "parameters": [ - "", - "" - ] - } - ], - "actions": [], - "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" - }, - "parameters": [ - "Object", - "no", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "ShouldBeHiddenWhenReleased", - "False", - "" - ] - } + "Thumb", + "Border", + "Border.MultitouchJoystick::JoystickForce() * Border.Width() / 2", + "Border.MultitouchJoystick::JoystickAngle()" ] } ] @@ -7689,7 +5294,7 @@ "Border", "MultitouchJoystick", "=", - "ControllerIdentifier", + "Object.PropertyControllerIdentifier()", "" ] }, @@ -7701,7 +5306,7 @@ "Border", "MultitouchJoystick", "=", - "JoystickIdentifier", + "Object.PropertyJoystickIdentifier()", "" ] }, @@ -7713,92 +5318,7 @@ "Border", "MultitouchJoystick", "=", - "DeadZoneRadius", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "supplementaryInformation": "SpriteMultitouchJoystick::SpriteMultitouchJoystick", - "type": "object" - } - ], - "objectGroups": [] - }, - { - "description": "Show the joystick until it is released.", - "fullName": "Show and start pressing", - "functionType": "Action", - "name": "TeleportAndPress", - "sentence": "Show _PARAM0_ at the cursor position and start pressing", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "HasAnyTouchOrMouseStarted" - }, - "parameters": [ - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "MettreXY" - }, - "parameters": [ - "Object", - "=", - "Object.ParentTouchX(StartedTouchOrMouseId(0))", - "=", - "Object.ParentTouchY(StartedTouchOrMouseId(0))" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::ActivateControl" - }, - "parameters": [ - "Object", - "yes", - "" - ] - }, - { - "type": { - "value": "Montre" - }, - "parameters": [ - "Object", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "ShouldBeHiddenWhenReleased", - "True", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::ForceStartPressing" - }, - "parameters": [ - "Border", - "MultitouchJoystick", - "StartedTouchOrMouseId(0)", + "Object.PropertyDeadZoneRadius()", "" ] } @@ -7815,92 +5335,6 @@ ], "objectGroups": [] }, - { - "description": "Return the X position of a specified touch", - "fullName": "Touch X position (on parent)", - "functionType": "Expression", - "name": "ParentTouchX", - "private": true, - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [] - }, - { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "const object = objects[0];", - "const touchId = eventsFunctionContext.getArgument(\"TouchId\");", - "eventsFunctionContext.returnValue = gdjs.evtTools.input.getTouchX(object.getInstanceContainer(), touchId, object.getLayer());" - ], - "parameterObjects": "Object", - "useStrict": true, - "eventsSheetExpanded": false - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "supplementaryInformation": "SpriteMultitouchJoystick::SpriteMultitouchJoystick", - "type": "object" - }, - { - "description": "Touch identifier", - "name": "TouchId", - "type": "expression" - } - ], - "objectGroups": [] - }, - { - "description": "Return the X position of a specified touch", - "fullName": "Touch X position (on parent)", - "functionType": "Expression", - "name": "ParentTouchY", - "private": true, - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [] - }, - { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "const object = objects[0];", - "const touchId = eventsFunctionContext.getArgument(\"TouchId\");", - "eventsFunctionContext.returnValue = gdjs.evtTools.input.getTouchY(object.getInstanceContainer(), touchId, object.getLayer());" - ], - "parameterObjects": "Object", - "useStrict": true, - "eventsSheetExpanded": false - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "supplementaryInformation": "SpriteMultitouchJoystick::SpriteMultitouchJoystick", - "type": "object" - }, - { - "description": "Touch identifier", - "name": "TouchId", - "type": "expression" - } - ], - "objectGroups": [] - }, { "description": "De/activate control of the joystick.", "fullName": "De/activate control", @@ -7914,12 +5348,10 @@ { "type": { "inverted": true, - "value": "BooleanVariable" + "value": "GetArgumentAsBoolean" }, "parameters": [ - "ShouldActivate", - "True", - "" + "\"ShouldActivate\"" ] } ], @@ -7941,12 +5373,10 @@ "conditions": [ { "type": { - "value": "BooleanVariable" + "value": "GetArgumentAsBoolean" }, "parameters": [ - "ShouldActivate", - "True", - "" + "\"ShouldActivate\"" ] } ], @@ -8620,15 +6050,9 @@ "description": "Only used by the scene editor.", "hidden": true, "name": "ParentOrigin" - }, - { - "value": "", - "type": "Boolean", - "label": "", - "hidden": true, - "name": "ShouldBeHiddenWhenReleased" } - ] + ], + "variants": [] } ] }, diff --git a/examples/starting-3d-vampire-survivor/starting-3d-vampire-survivor.json b/examples/starting-3d-vampire-survivor/starting-3d-vampire-survivor.json index f875fb759..bd1aabd54 100644 --- a/examples/starting-3d-vampire-survivor/starting-3d-vampire-survivor.json +++ b/examples/starting-3d-vampire-survivor/starting-3d-vampire-survivor.json @@ -1108,19 +1108,19 @@ "category": "Input", "extensionNamespace": "", "fullName": "Multitouch joystick and buttons (sprite)", - "gdevelopVersion": ">=5.5.222", + "gdevelopVersion": "", "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", + "version": "1.4.0", "description": [ - "Multitouch joysticks are objects showing a joystick on the screen, useful for mobile. They work like a physical gamepad:", + "Multitouch joysticks can be used the same way as physical gamepads:", "- 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.", + "- 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)." ], @@ -1185,33 +1185,108 @@ ], "eventsFunctions": [ { - "description": "Check if the events are running for the editor.", - "fullName": "Editor is running", + "description": "Check if a button is pressed on a gamepad.", + "fullName": "Multitouch controller button pressed", "functionType": "Condition", - "name": "IsInGameEdition", - "private": true, - "sentence": "Events are running for the editor", + "name": "IsButtonPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", "events": [ { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "const game = runtimeScene.getGame();\r", - "eventsFunctionContext.returnValue = game.isInGameEdition && game.isInGameEdition();" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"Pressed\"" + ] + } ], - "parameterObjects": "", - "useStrict": true, - "eventsSheetExpanded": false + "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" } ], - "parameters": [], "objectGroups": [] }, { - "fullName": "Accelerated speed", - "functionType": "Expression", - "name": "AcceleratedSpeed", + "description": "Check if a button is released on a gamepad.", + "fullName": "Multitouch controller button released", + "functionType": "Condition", + "name": "IsButtonReleased", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is released", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"Released\"" + ] + } + ], + "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": "Change a button state for a multitouch controller.", + "fullName": "Button state", + "functionType": "Action", + "name": "SetButtonState", "private": true, - "sentence": "", + "sentence": "Mark _PARAM2_ button as _PARAM3_ for multitouch controller _PARAM1_", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -1219,443 +1294,108 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SetStringVariable" }, "parameters": [ - "AcceleratedSpeed", + "Controllers[ControllerIdentifier].Buttons[Button].State", "=", - "CurrentSpeed" + "ButtonState" ] } - ], - "events": [ + ] + } + ], + "parameters": [ + { + "description": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier", + "type": "expression" + }, + { + "description": "Button name", + "name": "Button", + "type": "string" + }, + { + "description": "Button state", + "name": "ButtonState", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "type": "stringWithSelector" + } + ], + "objectGroups": [] + }, + { + "description": "Change the dead zone radius of a joystick. 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).", + "fullName": "Dead zone radius", + "functionType": "Action", + "name": "SetDeadZone", + "private": true, + "sentence": "Change the dead zone of multitouch joystick _PARAM2_ of multitouch controller _PARAM1_ to _PARAM3_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ { - "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", - "=", - "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": { + "value": "SetNumberVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].DeadZone", + "=", + "DeadZoneRadius" ] - }, - { - "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": "NumberVariable" - }, - "parameters": [ - "TargetedSpeed", - "=", - "0" - ] - } - ], - "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", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "clamp(AcceleratedSpeed, -SpeedMax, SpeedMax)" - ] - } - ] - } - ], - "variables": [ - { - "name": "AcceleratedSpeed", - "type": "number", - "value": 0 } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { - "description": "Current speed", - "name": "CurrentSpeed", - "type": "expression" - }, - { - "description": "Targeted speed", - "name": "TargetedSpeed", - "type": "expression" - }, - { - "description": "Max speed", - "name": "SpeedMax", + "description": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier", "type": "expression" }, { - "description": "Acceleration", - "name": "Acceleration", - "type": "expression" + "description": "Joystick name", + "name": "JoystickIdentifier", + "type": "string" }, { - "description": "Deceleration", - "name": "Deceleration", + "description": "Dead zone radius", + "name": "DeadZoneRadius", + "supplementaryInformation": "[]", "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", + "description": "Return the dead zone radius of a joystick. 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).", + "fullName": "Dead zone radius", + "functionType": "Expression", + "name": "DeadZone", + "private": true, + "sentence": "Change multitouch joystick _PARAM2_ of multitouch controller _PARAM1_ dead zone to _PARAM3_", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Buttons[Button].State", - "=", - "\"JustPressed\"" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "SetReturnBoolean" + "value": "SetReturnNumber" }, "parameters": [ - "True" + "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].DeadZone" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Multitouch controller identifier (1, 2, 3, 4...)", @@ -1663,265 +1403,20 @@ "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\"]", + "description": "Joystick name", + "name": "JoystickIdentifier", "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\"" - ] - } - ] - } - ], - "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", - "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is released", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Buttons[Button].State", - "=", - "\"Released\"" - ] - } - ], - "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": "Change a button state for a multitouch controller.", - "fullName": "Button state", - "functionType": "Action", - "name": "SetButtonState", - "private": true, - "sentence": "Mark _PARAM2_ button as _PARAM3_ for multitouch controller _PARAM1_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetStringVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Buttons[Button].State", - "=", - "ButtonState" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" - }, - { - "description": "Button name", - "name": "Button", - "type": "string" - }, - { - "description": "Button state", - "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"JustPressed\",\"Released\"]", - "type": "stringWithSelector" - } - ], - "objectGroups": [] - }, - { - "description": "Change the dead zone radius of a joystick. 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).", - "fullName": "Dead zone radius", - "functionType": "Action", - "name": "SetDeadZone", - "private": true, - "sentence": "Change the dead zone of multitouch joystick _PARAM2_ of multitouch controller _PARAM1_ to _PARAM3_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].DeadZone", - "=", - "DeadZoneRadius" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" - }, - { - "description": "Joystick name", - "name": "JoystickIdentifier", - "type": "string" - }, - { - "description": "Dead zone radius", - "name": "DeadZoneRadius", - "supplementaryInformation": "[]", - "type": "expression" - } - ], - "objectGroups": [] - }, - { - "description": "Return the dead zone radius of a joystick. 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).", - "fullName": "Dead zone radius", - "functionType": "Expression", - "name": "DeadZone", - "private": true, - "sentence": "Change multitouch joystick _PARAM2_ of multitouch controller _PARAM1_ dead zone to _PARAM3_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].DeadZone" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" - }, - { - "description": "Joystick name", - "name": "JoystickIdentifier", - "type": "string" - } - ], - "objectGroups": [] - }, - { - "description": "the direction index (left = 1, bottom = 1, right = 2, top = 3) for an angle (in degrees).", - "fullName": "Angle to 4-way index", - "functionType": "ExpressionAndCondition", - "name": "AngleTo4Way", - "private": true, - "sentence": "The angle _PARAM1_ 4-way index", + "description": "the direction index (left = 1, bottom = 1, right = 2, top = 3) for an angle (in degrees).", + "fullName": "Angle to 4-way index", + "functionType": "ExpressionAndCondition", + "name": "AngleTo4Way", + "private": true, + "sentence": "The angle _PARAM1_ 4-way index", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -2674,11 +2169,6 @@ "name": "JoystickIdentifier", "supplementaryInformation": "[\"Primary\",\"Secondary\"]", "type": "stringWithSelector" - }, - { - "description": "", - "name": "Coucou", - "type": "expression" } ], "objectGroups": [] @@ -2908,7 +2398,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "XFromAngleAndDistance(SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier), SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier))" + "SpriteMultitouchJoystick::JoystickForce(ControllerIdentifier, JoystickIdentifier) * cos(ToRad(SpriteMultitouchJoystick::JoystickAngle(ControllerIdentifier, JoystickIdentifier)))" ] } ] @@ -2948,7 +2438,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "YFromAngleAndDistance(SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier), SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier))" + "SpriteMultitouchJoystick::JoystickForce(ControllerIdentifier, JoystickIdentifier) * sin(ToRad(SpriteMultitouchJoystick::JoystickAngle(ControllerIdentifier, JoystickIdentifier)))" ] } ] @@ -2971,2032 +2461,46 @@ } ], "objectGroups": [] - }, + } + ], + "eventsBasedBehaviors": [ { - "description": "Check if a new touch has started on the right or left side of the screen.", - "fullName": "New touch on a screen side", - "functionType": "Condition", - "group": "Multitouch Joystick", - "name": "HasTouchStartedOnScreenSide", - "sentence": "A new touch has started on the _PARAM2_ side of the screen on _PARAM1_'s layer", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "HasAnyTouchOrMouseStarted" - }, - "parameters": [ - "" - ] - } - ], - "actions": [], - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "Side", - "=", - "\"Left\"" - ] - }, - { - "type": { - "value": "TouchX" - }, - "parameters": [ - "", - "StartedTouchOrMouseId(0)", - "<", - "CameraCenterX(Object.Layer())", - "Object.Layer()", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "Side", - "=", - "\"Right\"" - ] - }, - { - "type": { - "value": "TouchX" - }, - "parameters": [ - "", - "StartedTouchOrMouseId(0)", - ">=", - "CameraCenterX(Object.Layer())", - "Object.Layer()", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - } - ] - } - ], - "parameters": [ - { - "description": "Multitouch joystick", - "name": "Object", - "supplementaryInformation": "SpriteMultitouchJoystick::SpriteMultitouchJoystick", - "type": "objectList" - }, - { - "description": "Screen side", - "name": "Side", - "supplementaryInformation": "[\"Left\",\"Right\"]", - "type": "stringWithSelector" - } - ], - "objectGroups": [] - } - ], - "eventsBasedBehaviors": [ - { - "description": "Joystick that can be controlled by interacting with a touchscreen.", - "fullName": "Multitouch Joystick", - "name": "MultitouchJoystick", - "objectType": "", - "private": true, - "eventsFunctions": [ + "description": "Joystick that can be controlled by interacting with a touchscreen.", + "fullName": "Multitouch Joystick", + "name": "MultitouchJoystick", + "objectType": "", + "private": true, + "eventsFunctions": [ { "fullName": "", "functionType": "Action", "name": "onCreated", "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::SetDeadZone" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "DeadZoneRadius", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "Action", - "name": "onDeActivate", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "Action", - "name": "doStepPreEvents", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "inverted": true, - "value": "SpriteMultitouchJoystick::IsInGameEdition" - }, - "parameters": [ - "", - "" - ] - } - ], - "actions": [], - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "HasGameJustResumed" - }, - "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)" - }, - { - "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": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "the joystick force (from 0 to 1).", - "fullName": "Joystick force", - "functionType": "ExpressionAndCondition", - "name": "JoystickForce", - "sentence": "the joystick force", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "max(0, JoystickForce - DeadZoneRadius) / (1 - DeadZoneRadius)" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "JoystickForce", - "name": "SetJoystickForce", - "private": true, - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "JoystickForce", - "=", - "Value" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::SetJoystickForce" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "JoystickForce", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - }, - { - "description": "", - "name": "Parameter", - "type": "objectList" - } - ], - "objectGroups": [] - }, - { - "description": "Return the angle the joystick is pointing towards (Range: -180 to 180).", - "fullName": "Joystick angle", - "functionType": "Expression", - "name": "JoystickAngle", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "JoystickAngle" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "Change the angle the joystick is pointing towards (Range: -180 to 180).", - "fullName": "Joystick angle", - "functionType": "Action", - "name": "SetJoystickAngle", - "private": true, - "sentence": "Change the joystick angle of _PARAM0_ to _PARAM2_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "JoystickAngle", - "=", - "Value" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::SetJoystickAngle" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "JoystickAngle", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - }, - { - "description": "Angle", - "name": "Value", - "type": "expression" - } - ], - "objectGroups": [] - }, - { - "description": "Return the stick force on X axis (from -1 at the left to 1 at the right).", - "fullName": "Stick X force", - "functionType": "Expression", - "name": "StickForceX", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "Object.Behavior::JoystickForce() * cos(ToRad(Object.Behavior::JoystickAngle()))" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "Return the stick force on Y axis (from -1 at the top to 1 at the bottom).", - "fullName": "Stick Y force", - "functionType": "Expression", - "name": "StickForceY", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "Object.Behavior::JoystickForce() * sin(ToRad(Object.Behavior::JoystickAngle()))" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "Check if joystick is pushed in a given direction.", - "fullName": "Joystick pushed in a direction (4-way movement)", - "functionType": "Condition", - "name": "IsDirectionPushed4Way", - "sentence": "_PARAM0_ is pushed in direction _PARAM2_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::JoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - ">", - "0", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::IsAngleIn4WayDirection" - }, - "parameters": [ - "", - "JoystickAngle", - "Direction", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - }, - { - "description": "Direction", - "name": "Direction", - "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\"]", - "type": "stringWithSelector" - } - ], - "objectGroups": [] - }, - { - "description": "Check if joystick is pushed in a given direction.", - "fullName": "Joystick pushed in a direction (8-way movement)", - "functionType": "Condition", - "name": "IsDirectionPushed8Way", - "sentence": "_PARAM0_ is pushed in direction _PARAM2_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::JoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - ">", - "0", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::IsAngleIn8WayDirection" - }, - "parameters": [ - "", - "JoystickAngle", - "Direction", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - }, - { - "description": "Direction", - "name": "Direction", - "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\",\"UpLeft\",\"UpRight\",\"DownLeft\",\"DownRight\"]", - "type": "stringWithSelector" - } - ], - "objectGroups": [] - }, - { - "description": "Check if a joystick is pressed.", - "fullName": "Joystick pressed", - "functionType": "Condition", - "name": "IsPressed", - "sentence": "Joystick _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::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "Reset the joystick values (except for angle, which stays the same)", - "fullName": "Reset", - "functionType": "Action", - "name": "Reset", - "private": true, - "sentence": "Reset the joystick of _PARAM0_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "0", - "" - ] - }, - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "0" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "the multitouch controller identifier.", - "fullName": "Multitouch controller identifier", - "functionType": "ExpressionAndCondition", - "group": "Multitouch Joystick configuration", - "name": "ControllerIdentifier", - "sentence": "the multitouch controller identifier", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "ControllerIdentifier" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "ControllerIdentifier", - "name": "SetControllerIdentifier", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "ControllerIdentifier", - "=", - "Value" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "the joystick name.", - "fullName": "Joystick name", - "functionType": "ExpressionAndCondition", - "group": "Multitouch Joystick configuration", - "name": "JoystickIdentifier", - "sentence": "the joystick name", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnString" - }, - "parameters": [ - "JoystickIdentifier" - ] - } - ] - } - ], - "expressionType": { - "type": "string" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "JoystickIdentifier", - "name": "SetJoystickIdentifier", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetStringVariable" - }, - "parameters": [ - "JoystickIdentifier", - "=", - "Value" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "the dead zone radius (range: 0 to 1) of the joystick. 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).", - "fullName": "Dead zone radius", - "functionType": "ExpressionAndCondition", - "group": "Multitouch Joystick configuration", - "name": "DeadZoneRadius", - "sentence": "the dead zone radius", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "DeadZoneRadius" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "DeadZoneRadius", - "name": "SetDeadZoneRadius", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "DeadZoneRadius", - "=", - "Value" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::SetDeadZone" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "Value", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "Force the joystick into the pressing state.", - "fullName": "Force start pressing", - "functionType": "Action", - "name": "ForceStartPressing", - "sentence": "Force start pressing _PARAM0_ with touch identifier: _PARAM2_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "Value" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - }, - { - "description": "Touch identifier", - "name": "Value", - "type": "expression" - } - ], - "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "1", - "type": "Number", - "label": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier" - }, - { - "value": "Primary", - "type": "String", - "label": "Joystick name", - "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": "0", - "type": "Number", - "label": "Joystick angle (range: -180 to 180)", - "hidden": true, - "name": "JoystickAngle" - }, - { - "value": "0", - "type": "Number", - "label": "Joystick force (range: 0 to 1)", - "hidden": true, - "name": "JoystickForce" - }, - { - "value": "0", - "type": "Number", - "label": "", - "hidden": true, - "name": "TouchId" - }, - { - "value": "", - "type": "Number", - "label": "", - "hidden": true, - "name": "TouchIndex" - } - ], - "sharedPropertyDescriptors": [] - }, - { - "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": "", - "eventsFunctions": [ - { - "fullName": "", - "functionType": "Action", - "name": "doStepPreEvents", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "IsReleased", - "True", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsReleased", - "False", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" - }, - "parameters": [ - "Object", - "Behavior", - "\"Idle\"", - "" - ] - } - ] - }, - { - "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": [ - { - "type": { - "inverted": true, - "value": "SpriteMultitouchJoystick::MultitouchButton::IsPressed" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - }, - { - "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": "BuiltinCommonInstructions::Or" - }, - "parameters": [], - "subInstructions": [ - { - "type": { - "value": "CollisionPoint" - }, - "parameters": [ - "Object", - "TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer())", - "TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer())" - ] - }, - { - "type": { - "value": "NumberVariable" - }, - "parameters": [ - "Radius", - ">", - "DistanceBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer()), TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer()))" - ] - } - ] - } - ], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "StartedTouchOrMouseId(TouchIndex)" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" - }, - "parameters": [ - "Object", - "Behavior", - "\"JustPressed\"", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "True", - "" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchIndex", - "+", - "1" - ] - } - ] - } - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::IsPressed" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - }, - { - "type": { - "value": "HasTouchEnded" - }, - "parameters": [ - "", - "TouchId" - ] - } - ], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" - }, - "parameters": [ - "Object", - "Behavior", - "\"Released\"", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsReleased", - "True", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "False", - "" - ] - }, - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "0" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "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", - "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", - "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": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", - "type": "behavior" - }, - { - "description": "Button state", - "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"JustPressed\",\"Pressed\",\"Released\"]", - "type": "stringWithSelector" - } - ], - "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "1", - "type": "Number", - "label": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier" - }, - { - "value": "A", - "type": "String", - "label": "Button identifier", - "name": "ButtonIdentifier" - }, - { - "value": "0", - "type": "Number", - "label": "TouchID", - "hidden": true, - "name": "TouchId" - }, - { - "value": "", - "type": "Number", - "label": "", - "hidden": true, - "name": "TouchIndex" - }, - { - "value": "", - "type": "Boolean", - "label": "Button released", - "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.", - "name": "Radius" - } - ], - "sharedPropertyDescriptors": [] - }, - { - "description": "Control a platformer character with a multitouch controller.", - "fullName": "Platformer multitouch controller mapper", - "name": "PlatformerMultitouchMapper", - "objectType": "", - "quickCustomizationVisibility": "hidden", - "eventsFunctions": [ - { - "fullName": "", - "functionType": "Action", - "name": "doStepPreEvents", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "\"Left\"", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateLeftKey" - }, - "parameters": [ - "Object", - "Property" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "\"Right\"", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateRightKey" - }, - "parameters": [ - "Object", - "Property" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "\"Up\"", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateUpKey" - }, - "parameters": [ - "Object", - "Property" - ] - }, - { - "type": { - "value": "PlatformBehavior::SimulateLadderKey" - }, - "parameters": [ - "Object", - "Property" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "\"Down\"", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateDownKey" - }, - "parameters": [ - "Object", - "Property" - ] - } - ] - }, + "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "conditions": [], + "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::IsButtonPressed" + "value": "SpriteMultitouchJoystick::SetDeadZone" }, "parameters": [ "", "ControllerIdentifier", - "JumpButton", - "\"Down\"" + "JoystickIdentifier", + "DeadZoneRadius", + "" ] - } - ], - "actions": [ + }, { "type": { - "value": "PlatformBehavior::SimulateJumpKey" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" }, "parameters": [ "Object", - "Property" + "Behavior", + "" ] } ] @@ -5011,64 +2515,50 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::PlatformerMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "", - "type": "Behavior", - "label": "Platform character behavior", - "extraInformation": [ - "PlatformBehavior::PlatformerObjectBehavior" - ], - "choices": [], - "name": "Property" - }, - { - "value": "1", - "type": "Number", - "label": "Controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier" }, { - "value": "Primary", - "type": "Choice", - "label": "Joystick name", - "group": "Controls", - "choices": [ + "fullName": "", + "functionType": "Action", + "name": "onDeActivate", + "sentence": "", + "events": [ { - "label": "Primary", - "value": "Primary" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" }, { - "label": "Secondary", - "value": "Secondary" + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } ], - "name": "JoystickIdentifier" + "objectGroups": [] }, - { - "value": "A", - "type": "String", - "label": "Jump button name", - "group": "Controls", - "name": "JumpButton" - } - ], - "sharedPropertyDescriptors": [] - }, - { - "description": "Control a 3D physics character with a multitouch controller.", - "fullName": "3D platformer multitouch controller mapper", - "name": "Platformer3DMultitouchMapper", - "objectType": "", - "quickCustomizationVisibility": "hidden", - "eventsFunctions": [ { "fullName": "", "functionType": "Action", @@ -5080,14 +2570,9 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::StickForce" + "value": "HasGameJustResumed" }, "parameters": [ - "", - ">", - "0", - "ControllerIdentifier", - "JoystickIdentifier", "" ] } @@ -5095,54 +2580,210 @@ "actions": [ { "type": { - "value": "Physics3D::PhysicsCharacter3D::SetForwardAngle" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" }, "parameters": [ "Object", - "PhysicsCharacter3D", - "=", - "SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier) + CameraAngle(Object.Layer())" + "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": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyTouchIndex" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "0" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "StartedTouchOrMouseCount()", + "conditions": [], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::PropertyTouchId" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "0" + ] + }, + { + "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": { - "value": "Physics3D::PhysicsCharacter3D::SimulateStick" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 }, - "parameters": [ - "Object", - "PhysicsCharacter3D", - "-90", - "SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier)" + "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" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } ] } - ] + ], + "parameters": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Update joystick position", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::IsButtonPressed" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JumpButton", - "\"Down\"" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::PropertyTouchId" + }, + "parameters": [ + "Object", + "Behavior", + "!=", + "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": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" - }, - "parameters": [ - "Object", - "PhysicsCharacter3D" - ] - } - ] + "parameters": [] } ], "parameters": [ @@ -5154,129 +2795,37 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::Platformer3DMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "", - "type": "Behavior", - "label": "3D physics character", - "extraInformation": [ - "Physics3D::PhysicsCharacter3D" - ], - "choices": [], - "name": "PhysicsCharacter3D" - }, - { - "value": "1", - "type": "Number", - "label": "Controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier" - }, - { - "value": "Primary", - "type": "Choice", - "label": "Walk joystick", - "group": "Controls", - "choices": [ - { - "label": "Primary", - "value": "Primary" - }, - { - "label": "Secondary", - "value": "Secondary" - } - ], - "name": "JoystickIdentifier" }, { - "value": "A", - "type": "String", - "label": "Jump button name", - "group": "Controls", - "name": "JumpButton" - } - ], - "sharedPropertyDescriptors": [] - }, - { - "description": "Control a 3D physics character with a multitouch controller.", - "fullName": "3D shooter multitouch controller mapper", - "name": "Shooter3DMultitouchMapper", - "objectType": "", - "quickCustomizationVisibility": "hidden", - "eventsFunctions": [ - { - "fullName": "", - "functionType": "Action", - "name": "doStepPreEvents", - "sentence": "", + "description": "the joystick force (from 0 to 1).", + "fullName": "Joystick force", + "functionType": "ExpressionAndCondition", + "name": "JoystickForce", + "sentence": "the joystick force", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::StickForce" - }, - "parameters": [ - "", - ">", - "0", - "ControllerIdentifier", - "JoystickIdentifier", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateStick" - }, - "parameters": [ - "Object", - "PhysicsCharacter3D", - "SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier)", - "SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier)" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::IsButtonPressed" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JumpButton", - "\"Down\"" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" + "value": "SetReturnNumber" }, "parameters": [ - "Object", - "PhysicsCharacter3D" + "max(0, JoystickForce - DeadZoneRadius) / (1 - DeadZoneRadius)" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -5286,151 +2835,90 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::Shooter3DMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "", - "type": "Behavior", - "label": "3D physics character", - "extraInformation": [ - "Physics3D::PhysicsCharacter3D" - ], - "choices": [], - "name": "PhysicsCharacter3D" - }, - { - "value": "1", - "type": "Number", - "label": "Controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier" - }, - { - "value": "Primary", - "type": "Choice", - "label": "Walk joystick", - "group": "Controls", - "choices": [ - { - "label": "Primary", - "value": "Primary" - }, - { - "label": "Secondary", - "value": "Secondary" - } - ], - "name": "JoystickIdentifier" }, - { - "value": "A", - "type": "String", - "label": "Jump button name", - "group": "Controls", - "name": "JumpButton" - } - ], - "sharedPropertyDescriptors": [] - }, - { - "description": "Control camera rotations with a multitouch controller.", - "fullName": "First person camera multitouch controller mapper", - "name": "FirstPersonMultitouchMapper", - "objectType": "", - "quickCustomizationVisibility": "hidden", - "eventsFunctions": [ { "fullName": "", - "functionType": "Action", - "name": "doStepPreEvents", + "functionType": "ActionWithOperator", + "getterName": "JoystickForce", + "name": "SetJoystickForce", + "private": true, "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", - "=", - "SpriteMultitouchJoystick::AcceleratedSpeed(CurrentRotationSpeedZ, SpriteMultitouchJoystick::StickForceX(ControllerIdentifier, CameraStick) * HorizontalRotationSpeedMax, HorizontalRotationSpeedMax, HorizontalRotationAcceleration, HorizontalRotationDeceleration)" - ] - }, - { - "type": { - "value": "SetAngle" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickForce" }, "parameters": [ "Object", - "+", - "CurrentRotationSpeedZ * TimeDelta()" - ] - }, - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "CurrentRotationSpeedY", + "Behavior", "=", - "SpriteMultitouchJoystick::AcceleratedSpeed(CurrentRotationSpeedY, SpriteMultitouchJoystick::StickForceY(ControllerIdentifier, CameraStick) * VerticalRotationSpeedMax, VerticalRotationSpeedMax, VerticalRotationAcceleration, VerticalRotationDeceleration)" - ] - }, - { - "type": { - "value": "Scene3D::Base3DBehavior::SetRotationY" - }, - "parameters": [ - "Object", - "Object3D", - "+", - "CurrentRotationSpeedY * TimeDelta()" + "Value" ] }, { "type": { - "value": "Scene3D::Base3DBehavior::SetRotationY" + "value": "SpriteMultitouchJoystick::SetJoystickForce" }, "parameters": [ - "Object", - "Object3D", - "=", - "clamp(Object.Object3D::RotationY(), VerticalAngleMin, VerticalAngleMax)" + "", + "ControllerIdentifier", + "JoystickIdentifier", + "JoystickForce", + "" ] - }, + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Return the angle the joystick is pointing towards (Range: -180 to 180).", + "fullName": "Joystick angle", + "functionType": "Expression", + "name": "JoystickAngle", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper::LookFromObjectEyes" + "value": "SetReturnNumber" }, "parameters": [ - "Object", - "Behavior", - "" + "JoystickAngle" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -5440,20 +2928,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "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", + "description": "Change the angle the joystick is pointing towards (Range: -180 to 180).", + "fullName": "Joystick angle", "functionType": "Action", - "group": "Layers and cameras", - "name": "LookFromObjectEyes", + "name": "SetJoystickAngle", "private": true, - "sentence": "Move the camera to look though _PARAM0_ eyes", + "sentence": "Change the joystick angle of _PARAM0_ to _PARAM2_", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -5461,61 +2948,24 @@ "actions": [ { "type": { - "value": "CentreCamera" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickAngle" }, "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": [ - "", + "Behavior", "=", - "Object.Object3D::RotationX()", - "GetArgumentAsString(\"Layer\")", - "" + "Value" ] }, { "type": { - "value": "SetCameraAngle" + "value": "SpriteMultitouchJoystick::SetJoystickAngle" }, "parameters": [ "", - "=", - "Object.Angle() + 90", - "Object.Layer()", + "ControllerIdentifier", + "JoystickIdentifier", + "JoystickAngle", "" ] } @@ -5531,19 +2981,23 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" + }, + { + "description": "Angle", + "name": "Value", + "type": "expression" } ], "objectGroups": [] }, { - "description": "the maximum horizontal rotation speed of the object.", - "fullName": "Maximum horizontal rotation speed", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper horizontal rotation configuration", - "name": "HorizontalRotationSpeedMax", - "sentence": "the maximum horizontal rotation speed", + "description": "Return the stick force on X axis (from -1 at the left to 1 at the right).", + "fullName": "Stick X force", + "functionType": "Expression", + "name": "StickForceX", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -5554,7 +3008,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "HorizontalRotationSpeedMax" + "Object.Behavior::JoystickForce() * cos(ToRad(Object.Behavior::JoystickAngle()))" ] } ] @@ -5572,17 +3026,17 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] }, { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "HorizontalRotationSpeedMax", - "name": "SetHorizontalRotationSpeedMax", + "description": "Return the stick force on Y axis (from -1 at the top to 1 at the bottom).", + "fullName": "Stick Y force", + "functionType": "Expression", + "name": "StickForceY", "sentence": "", "events": [ { @@ -5591,17 +3045,18 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SetReturnNumber" }, "parameters": [ - "HorizontalRotationSpeedMax", - "=", - "Value" + "Object.Behavior::JoystickForce() * sin(ToRad(Object.Behavior::JoystickAngle()))" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -5611,38 +3066,58 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the horizontal rotation acceleration of the object.", - "fullName": "Horizontal rotation acceleration", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper horizontal rotation configuration", - "name": "HorizontalRotationAcceleration", - "sentence": "the horizontal rotation acceleration", + "description": "Check if joystick is pushed in a given direction.", + "fullName": "Joystick pushed in a direction (4-way movement)", + "functionType": "Condition", + "name": "IsDirectionPushed4Way", + "sentence": "_PARAM0_ is pushed in direction _PARAM2_", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::JoystickForce" + }, + "parameters": [ + "Object", + "Behavior", + ">", + "0", + "" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::IsAngleIn4WayDirection" + }, + "parameters": [ + "", + "JoystickAngle", + "Direction", + "" + ] + } + ], "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "SetReturnBoolean" }, "parameters": [ - "HorizontalRotationAcceleration" + "True" ] } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -5652,31 +3127,59 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" + }, + { + "description": "Direction", + "name": "Direction", + "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\"]", + "type": "stringWithSelector" } ], "objectGroups": [] }, { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "HorizontalRotationAcceleration", - "name": "SetHorizontalRotationAcceleration", - "sentence": "", + "description": "Check if joystick is pushed in a given direction.", + "fullName": "Joystick pushed in a direction (8-way movement)", + "functionType": "Condition", + "name": "IsDirectionPushed8Way", + "sentence": "_PARAM0_ is pushed in direction _PARAM2_", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::JoystickForce" + }, + "parameters": [ + "Object", + "Behavior", + ">", + "0", + "" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::IsAngleIn8WayDirection" + }, + "parameters": [ + "", + "JoystickAngle", + "Direction", + "" + ] + } + ], "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SetReturnBoolean" }, "parameters": [ - "HorizontalRotationAcceleration", - "=", - "Value" + "True" ] } ] @@ -5691,38 +3194,52 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" + }, + { + "description": "Direction", + "name": "Direction", + "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\",\"UpLeft\",\"UpRight\",\"DownLeft\",\"DownRight\"]", + "type": "stringWithSelector" } ], "objectGroups": [] }, { - "description": "the horizontal rotation deceleration of the object.", - "fullName": "Horizontal rotation deceleration", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper horizontal rotation configuration", - "name": "HorizontalRotationDeceleration", - "sentence": "the horizontal rotation deceleration", + "description": "Check if a joystick is pressed.", + "fullName": "Joystick pressed", + "functionType": "Condition", + "name": "IsPressed", + "sentence": "Joystick _PARAM0_ is pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::PropertyTouchId" + }, + "parameters": [ + "Object", + "Behavior", + "!=", + "0" + ] + } + ], "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "SetReturnBoolean" }, "parameters": [ - "HorizontalRotationDeceleration" + "True" ] } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -5732,18 +3249,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] }, { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "HorizontalRotationDeceleration", - "name": "SetHorizontalRotationDeceleration", - "sentence": "", + "description": "Reset the joystick values (except for angle, which stays the same)", + "fullName": "Reset", + "functionType": "Action", + "name": "Reset", + "private": true, + "sentence": "Reset the joystick of _PARAM0_", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -5751,12 +3269,25 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" }, "parameters": [ - "HorizontalRotationDeceleration", + "Object", + "Behavior", "=", - "Value" + "0", + "" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyTouchId" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "0" ] } ] @@ -5771,19 +3302,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the maximum vertical rotation speed of the object.", - "fullName": "Maximum vertical rotation speed", + "description": "the multitouch controller identifier.", + "fullName": "Multitouch controller identifier", "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper vertical rotation configuration", - "name": "VerticalRotationSpeedMax", - "sentence": "the maximum vertical rotation speed", + "group": "Multitouch Joystick configuration", + "name": "ControllerIdentifier", + "sentence": "the multitouch controller identifier", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -5794,7 +3325,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "VerticalRotationSpeedMax" + "ControllerIdentifier" ] } ] @@ -5812,7 +3343,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], @@ -5821,8 +3352,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "VerticalRotationSpeedMax", - "name": "SetVerticalRotationSpeedMax", + "getterName": "ControllerIdentifier", + "name": "SetControllerIdentifier", "sentence": "", "events": [ { @@ -5831,10 +3362,11 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyControllerIdentifier" }, "parameters": [ - "VerticalRotationSpeedMax", + "Object", + "Behavior", "=", "Value" ] @@ -5851,19 +3383,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the vertical rotation acceleration of the object.", - "fullName": "Vertical rotation acceleration", + "description": "the joystick name.", + "fullName": "Joystick name", "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper vertical rotation configuration", - "name": "VerticalRotationAcceleration", - "sentence": "the vertical rotation acceleration", + "group": "Multitouch Joystick configuration", + "name": "JoystickIdentifier", + "sentence": "the joystick name", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -5871,17 +3403,17 @@ "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "SetReturnString" }, "parameters": [ - "VerticalRotationAcceleration" + "JoystickIdentifier" ] } ] } ], "expressionType": { - "type": "expression" + "type": "string" }, "parameters": [ { @@ -5892,7 +3424,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], @@ -5901,8 +3433,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "VerticalRotationAcceleration", - "name": "SetVerticalRotationAcceleration", + "getterName": "JoystickIdentifier", + "name": "SetJoystickIdentifier", "sentence": "", "events": [ { @@ -5911,10 +3443,11 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickIdentifier" }, "parameters": [ - "VerticalRotationAcceleration", + "Object", + "Behavior", "=", "Value" ] @@ -5931,19 +3464,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the vertical rotation deceleration of the object.", - "fullName": "Vertical rotation deceleration", + "description": "the dead zone radius (range: 0 to 1) of the joystick. 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).", + "fullName": "Dead zone radius", "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper vertical rotation configuration", - "name": "VerticalRotationDeceleration", - "sentence": "the vertical rotation deceleration", + "group": "Multitouch Joystick configuration", + "name": "DeadZoneRadius", + "sentence": "the dead zone radius", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -5954,7 +3487,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "VerticalRotationDeceleration" + "DeadZoneRadius" ] } ] @@ -5972,7 +3505,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], @@ -5981,8 +3514,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "VerticalRotationDeceleration", - "name": "SetVerticalRotationDeceleration", + "getterName": "DeadZoneRadius", + "name": "SetDeadZoneRadius", "sentence": "", "events": [ { @@ -5991,10 +3524,11 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyDeadZoneRadius" }, "parameters": [ - "VerticalRotationDeceleration", + "Object", + "Behavior", "=", "Value" ] @@ -6011,72 +3545,271 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] + } + ], + "propertyDescriptors": [ + { + "value": "1", + "type": "Number", + "label": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier" }, { - "description": "the minimum vertical camera angle of the object.", - "fullName": "Minimum vertical camera angle", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper vertical rotation configuration", - "name": "VerticalAngleMin", - "sentence": "the minimum vertical camera angle", + "value": "Primary", + "type": "String", + "label": "Joystick name", + "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": "0", + "type": "Number", + "label": "Joystick angle (range: -180 to 180)", + "hidden": true, + "name": "JoystickAngle" + }, + { + "value": "0", + "type": "Number", + "label": "Joystick force (range: 0 to 1)", + "hidden": true, + "name": "JoystickForce" + }, + { + "value": "0", + "type": "Number", + "label": "", + "hidden": true, + "name": "TouchId" + }, + { + "value": "", + "type": "Number", + "label": "", + "hidden": true, + "name": "TouchIndex" + } + ], + "sharedPropertyDescriptors": [] + }, + { + "description": "Detect button presses made on a touchscreen.", + "fullName": "Multitouch button", + "name": "MultitouchButton", + "objectType": "", + "eventsFunctions": [ + { + "fullName": "", + "functionType": "Action", + "name": "doStepPreEvents", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::IsReleased" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } + ], "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyIsReleased" + }, + "parameters": [ + "Object", + "Behavior", + "no" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" }, "parameters": [ - "VerticalAngleMin" + "Object", + "Behavior", + "\"Idle\"", + "" ] } ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" }, { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "VerticalAngleMin", - "name": "SetVerticalAngleMin", - "sentence": "", - "events": [ + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "SpriteMultitouchJoystick::MultitouchButton::IsPressed" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + }, + { + "type": { + "value": "HasAnyTouchOrMouseStarted" + }, + "parameters": [ + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchIndex" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "0" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "StartedTouchOrMouseCount()", + "conditions": [], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "CollisionPoint" + }, + "parameters": [ + "Object", + "TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)", + "TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchId" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "StartedTouchOrMouseId(TouchIndex)" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + }, + "parameters": [ + "Object", + "Behavior", + "\"Pressed\"", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchIndex" + }, + "parameters": [ + "Object", + "Behavior", + "+", + "1" + ] + } + ] + } + ] + } + ] + }, { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::IsPressed" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + }, + { + "type": { + "value": "HasTouchEnded" + }, + "parameters": [ + "", + "TouchId" + ] + } + ], "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + }, + "parameters": [ + "Object", + "Behavior", + "\"Released\"", + "" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyIsReleased" + }, + "parameters": [ + "Object", + "Behavior", + "yes" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchId" }, "parameters": [ - "VerticalAngleMin", + "Object", + "Behavior", "=", - "Value" + "0" ] } ] @@ -6091,72 +3824,39 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the maximum vertical camera angle of the object.", - "fullName": "Maximum vertical camera angle", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper vertical rotation configuration", - "name": "VerticalAngleMax", - "sentence": "the maximum vertical camera angle", + "description": "Check if button is released.", + "fullName": "Button released", + "functionType": "Condition", + "name": "IsReleased", + "sentence": "Button _PARAM0_ is released", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ + "conditions": [ { "type": { - "value": "SetReturnNumber" + "value": "SpriteMultitouchJoystick::MultitouchButton::PropertyIsReleased" }, "parameters": [ - "VerticalAngleMax" + "Object", + "Behavior" ] } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "VerticalAngleMax", - "name": "SetVerticalAngleMax", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + ], "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SetReturnBoolean" }, "parameters": [ - "VerticalAngleMax", - "=", - "Value" + "True" ] } ] @@ -6171,38 +3871,46 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the z position offset of the object.", - "fullName": "Z position offset", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper position configuration", - "name": "OffsetZ", - "sentence": "the z position offset", + "description": "Check if button is pressed.", + "fullName": "Button pressed", + "functionType": "Condition", + "name": "IsPressed", + "sentence": "Button _PARAM0_ is pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::PropertyTouchId" + }, + "parameters": [ + "Object", + "Behavior", + "!=", + "0" + ] + } + ], "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "SetReturnBoolean" }, "parameters": [ - "OffsetZ" + "True" ] } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -6212,18 +3920,18 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", "type": "behavior" } ], "objectGroups": [] }, { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "OffsetZ", - "name": "SetOffsetZ", - "sentence": "", + "fullName": "Button state", + "functionType": "Action", + "name": "SetButtonState", + "private": true, + "sentence": "Mark the button _PARAM0_ as _PARAM2_", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -6231,12 +3939,14 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::SetButtonState" }, "parameters": [ - "OffsetZ", - "=", - "Value" + "", + "ControllerIdentifier", + "ButtonIdentifier", + "ButtonState", + "" ] } ] @@ -6251,140 +3961,61 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", "type": "behavior" + }, + { + "description": "Button state", + "name": "ButtonState", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "type": "stringWithSelector" } ], "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...)", + "label": "Multitouch 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": "A", + "type": "String", + "label": "Button identifier", + "name": "ButtonIdentifier" }, { "value": "0", "type": "Number", - "unit": "Pixel", - "label": "Z position offset", - "group": "Position", - "name": "OffsetZ" + "label": "TouchID", + "hidden": true, + "name": "TouchId" }, { - "value": "0", + "value": "", "type": "Number", - "unit": "AngularSpeed", - "label": "Current rotation speed Z", + "label": "", "hidden": true, - "name": "CurrentRotationSpeedZ" + "name": "TouchIndex" }, { - "value": "0", - "type": "Number", - "unit": "AngularSpeed", - "label": "Current rotation speed Y", + "value": "", + "type": "Boolean", + "label": "Button released", "hidden": true, - "name": "CurrentRotationSpeedY" + "name": "IsReleased" } ], "sharedPropertyDescriptors": [] }, { - "description": "Control a 3D physics car with a multitouch controller.", - "fullName": "3D car multitouch controller mapper", - "name": "PhysicsCar3DMultitouchMapper", + "description": "Control a platformer character with a multitouch controller.", + "fullName": "Platformer multitouch controller mapper", + "name": "PlatformerMultitouchMapper", "objectType": "", - "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -6397,14 +4028,13 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::StickForce" + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" }, "parameters": [ "", - ">", - "0", "ControllerIdentifier", - "SteerJoystickIdentifier", + "JoystickIdentifier", + "\"Left\"", "" ] } @@ -6412,12 +4042,11 @@ "actions": [ { "type": { - "value": "Physics3D::PhysicsCar3D::SimulateSteeringStick" + "value": "PlatformBehavior::SimulateLeftKey" }, "parameters": [ "Object", - "PhysicsCar3D", - "SpriteMultitouchJoystick::StickForceX(ControllerIdentifier, \"Primary\")" + "Property" ] } ] @@ -6427,14 +4056,78 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::StickForce" + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JoystickIdentifier", + "\"Right\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "PlatformBehavior::SimulateRightKey" + }, + "parameters": [ + "Object", + "Property" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JoystickIdentifier", + "\"Up\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "PlatformBehavior::SimulateUpKey" + }, + "parameters": [ + "Object", + "Property" + ] + }, + { + "type": { + "value": "PlatformBehavior::SimulateLadderKey" + }, + "parameters": [ + "Object", + "Property" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" }, "parameters": [ "", - ">", - "0", "ControllerIdentifier", - "SpeedJoystickIdentifier", + "JoystickIdentifier", + "\"Down\"", "" ] } @@ -6442,12 +4135,11 @@ "actions": [ { "type": { - "value": "Physics3D::PhysicsCar3D::SimulateAcceleratorStick" + "value": "PlatformBehavior::SimulateDownKey" }, "parameters": [ "Object", - "PhysicsCar3D", - "-SpriteMultitouchJoystick::StickForceY(ControllerIdentifier, \"Secondary\")" + "Property" ] } ] @@ -6462,7 +4154,7 @@ "parameters": [ "", "ControllerIdentifier", - "HandBrakeButton", + "JumpButton", "\"Down\"" ] } @@ -6470,11 +4162,11 @@ "actions": [ { "type": { - "value": "Physics3D::PhysicsCar3D::SimulateHandBrakeKey" + "value": "PlatformBehavior::SimulateJumpKey" }, "parameters": [ "Object", - "PhysicsCar3D" + "Property" ] } ] @@ -6489,7 +4181,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::PhysicsCar3DMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::PlatformerMultitouchMapper", "type": "behavior" } ], @@ -6500,12 +4192,12 @@ { "value": "", "type": "Behavior", - "label": "3D physics car", + "label": "Platform character behavior", "extraInformation": [ - "Physics3D::PhysicsCar3D" + "PlatformBehavior::PlatformerObjectBehavior" ], "choices": [], - "name": "PhysicsCar3D" + "name": "Property" }, { "value": "1", @@ -6516,24 +4208,7 @@ { "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", + "label": "Joystick name", "group": "Controls", "choices": [ { @@ -6545,14 +4220,14 @@ "value": "Secondary" } ], - "name": "SpeedJoystickIdentifier" + "name": "JoystickIdentifier" }, { - "value": "B", + "value": "A", "type": "String", - "label": "Hand brake button name", + "label": "Jump button name", "group": "Controls", - "name": "HandBrakeButton" + "name": "JumpButton" } ], "sharedPropertyDescriptors": [] @@ -6562,7 +4237,6 @@ "fullName": "Top-down multitouch controller mapper", "name": "TopDownMultitouchMapper", "objectType": "", - "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -6575,10 +4249,11 @@ "conditions": [ { "type": { - "value": "StringVariable" + "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" }, "parameters": [ - "StickMode", + "Object", + "Behavior", "=", "\"Analog\"" ] @@ -6603,10 +4278,11 @@ "conditions": [ { "type": { - "value": "StringVariable" + "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" }, "parameters": [ - "StickMode", + "Object", + "Behavior", "=", "\"360°\"" ] @@ -6631,10 +4307,11 @@ "conditions": [ { "type": { - "value": "StringVariable" + "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" }, "parameters": [ - "StickMode", + "Object", + "Behavior", "=", "\"8 Directions\"" ] @@ -7243,6 +4920,7 @@ } ], "instances": [], + "editionSettings": {}, "eventsFunctions": [ { "fullName": "", @@ -7361,90 +5039,17 @@ "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "conditions": [], + "actions": [ { "type": { - "inverted": true, - "value": "SpriteMultitouchJoystick::IsInGameEdition" + "value": "MettreAutour" }, "parameters": [ - "", - "" - ] - } - ], - "actions": [], - "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" - }, - "parameters": [ - "Object", - "no", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "ShouldBeHiddenWhenReleased", - "False", - "" - ] - } + "Thumb", + "Border", + "Border.MultitouchJoystick::JoystickForce() * Border.Width() / 2", + "Border.MultitouchJoystick::JoystickAngle()" ] } ] @@ -7512,7 +5117,7 @@ "Border", "MultitouchJoystick", "=", - "ControllerIdentifier", + "Object.PropertyControllerIdentifier()", "" ] }, @@ -7524,7 +5129,7 @@ "Border", "MultitouchJoystick", "=", - "JoystickIdentifier", + "Object.PropertyJoystickIdentifier()", "" ] }, @@ -7536,92 +5141,7 @@ "Border", "MultitouchJoystick", "=", - "DeadZoneRadius", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "supplementaryInformation": "SpriteMultitouchJoystick::SpriteMultitouchJoystick", - "type": "object" - } - ], - "objectGroups": [] - }, - { - "description": "Show the joystick until it is released.", - "fullName": "Show and start pressing", - "functionType": "Action", - "name": "TeleportAndPress", - "sentence": "Show _PARAM0_ at the cursor position and start pressing", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "HasAnyTouchOrMouseStarted" - }, - "parameters": [ - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "MettreXY" - }, - "parameters": [ - "Object", - "=", - "Object.ParentTouchX(StartedTouchOrMouseId(0))", - "=", - "Object.ParentTouchY(StartedTouchOrMouseId(0))" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::ActivateControl" - }, - "parameters": [ - "Object", - "yes", - "" - ] - }, - { - "type": { - "value": "Montre" - }, - "parameters": [ - "Object", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "ShouldBeHiddenWhenReleased", - "True", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::ForceStartPressing" - }, - "parameters": [ - "Border", - "MultitouchJoystick", - "StartedTouchOrMouseId(0)", + "Object.PropertyDeadZoneRadius()", "" ] } @@ -7638,92 +5158,6 @@ ], "objectGroups": [] }, - { - "description": "Return the X position of a specified touch", - "fullName": "Touch X position (on parent)", - "functionType": "Expression", - "name": "ParentTouchX", - "private": true, - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [] - }, - { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "const object = objects[0];", - "const touchId = eventsFunctionContext.getArgument(\"TouchId\");", - "eventsFunctionContext.returnValue = gdjs.evtTools.input.getTouchX(object.getInstanceContainer(), touchId, object.getLayer());" - ], - "parameterObjects": "Object", - "useStrict": true, - "eventsSheetExpanded": false - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "supplementaryInformation": "SpriteMultitouchJoystick::SpriteMultitouchJoystick", - "type": "object" - }, - { - "description": "Touch identifier", - "name": "TouchId", - "type": "expression" - } - ], - "objectGroups": [] - }, - { - "description": "Return the X position of a specified touch", - "fullName": "Touch X position (on parent)", - "functionType": "Expression", - "name": "ParentTouchY", - "private": true, - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [] - }, - { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "const object = objects[0];", - "const touchId = eventsFunctionContext.getArgument(\"TouchId\");", - "eventsFunctionContext.returnValue = gdjs.evtTools.input.getTouchY(object.getInstanceContainer(), touchId, object.getLayer());" - ], - "parameterObjects": "Object", - "useStrict": true, - "eventsSheetExpanded": false - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "supplementaryInformation": "SpriteMultitouchJoystick::SpriteMultitouchJoystick", - "type": "object" - }, - { - "description": "Touch identifier", - "name": "TouchId", - "type": "expression" - } - ], - "objectGroups": [] - }, { "description": "De/activate control of the joystick.", "fullName": "De/activate control", @@ -7737,12 +5171,10 @@ { "type": { "inverted": true, - "value": "BooleanVariable" + "value": "GetArgumentAsBoolean" }, "parameters": [ - "ShouldActivate", - "True", - "" + "\"ShouldActivate\"" ] } ], @@ -7764,12 +5196,10 @@ "conditions": [ { "type": { - "value": "BooleanVariable" + "value": "GetArgumentAsBoolean" }, "parameters": [ - "ShouldActivate", - "True", - "" + "\"ShouldActivate\"" ] } ], @@ -8443,15 +5873,9 @@ "description": "Only used by the scene editor.", "hidden": true, "name": "ParentOrigin" - }, - { - "value": "", - "type": "Boolean", - "label": "", - "hidden": true, - "name": "ShouldBeHiddenWhenReleased" } - ] + ], + "variants": [] } ] }, diff --git a/examples/starting-beatemup/starting-beatemup.json b/examples/starting-beatemup/starting-beatemup.json index c534ec43b..a766dc984 100644 --- a/examples/starting-beatemup/starting-beatemup.json +++ b/examples/starting-beatemup/starting-beatemup.json @@ -2074,7 +2074,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.9.0", + "version": "1.8.4", "description": [ "Multitouch joysticks are objects showing a joystick on the screen, useful for mobile. They work like a physical gamepad:", "- 4 or 8 directions", @@ -2584,11 +2584,11 @@ "objectGroups": [] }, { - "description": "Check if a button was just pressed on a multitouch controller.", - "fullName": "Multitouch controller button just pressed", + "description": "Check if a button is pressed on a gamepad.", + "fullName": "Multitouch controller button pressed", "functionType": "Condition", - "name": "IsButtonJustPressed", - "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ was just pressed", + "name": "IsButtonPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -2600,73 +2600,7 @@ "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 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\"" - ] - } + "\"Pressed\"" ] } ], @@ -2698,7 +2632,7 @@ "objectGroups": [] }, { - "description": "Check if a button is released on a multitouch controller.", + "description": "Check if a button is released on a gamepad.", "fullName": "Multitouch controller button released", "functionType": "Condition", "name": "IsButtonReleased", @@ -2784,7 +2718,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"JustPressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -5274,49 +5208,11 @@ "conditions": [ { "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "IsReleased", - "True", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsReleased", - "False", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + "value": "SpriteMultitouchJoystick::MultitouchButton::IsReleased" }, "parameters": [ "Object", "Behavior", - "\"Idle\"", - "" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "True", "" ] } @@ -5327,7 +5223,7 @@ "value": "SetBooleanVariable" }, "parameters": [ - "IsJustPressed", + "IsReleased", "False", "" ] @@ -5339,7 +5235,7 @@ "parameters": [ "Object", "Behavior", - "\"Pressed\"", + "\"Idle\"", "" ] } @@ -5437,17 +5333,7 @@ "parameters": [ "Object", "Behavior", - "\"JustPressed\"", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "True", + "\"Pressed\"", "" ] } @@ -5518,16 +5404,6 @@ "" ] }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "False", - "" - ] - }, { "type": { "value": "SetNumberVariable" @@ -5557,11 +5433,11 @@ "objectGroups": [] }, { - "description": "Check if the button was just pressed.", - "fullName": "Button just pressed", + "description": "Check if button is released.", + "fullName": "Button released", "functionType": "Condition", - "name": "IsJustPressed", - "sentence": "Button _PARAM0_ was just pressed", + "name": "IsReleased", + "sentence": "Button _PARAM0_ is released", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -5571,7 +5447,7 @@ "value": "BooleanVariable" }, "parameters": [ - "IsJustPressed", + "IsReleased", "True", "" ] @@ -5605,7 +5481,7 @@ "objectGroups": [] }, { - "description": "Check if the button is pressed.", + "description": "Check if button is pressed.", "fullName": "Button pressed", "functionType": "Condition", "name": "IsPressed", @@ -5652,54 +5528,6 @@ ], "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", @@ -5741,7 +5569,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"JustPressed\",\"Pressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -5782,13 +5610,6 @@ "hidden": true, "name": "IsReleased" }, - { - "value": "", - "type": "Boolean", - "label": "Button just pressed", - "hidden": true, - "name": "IsJustPressed" - }, { "value": "0", "type": "Number", @@ -8203,6 +8024,7 @@ } ], "instances": [], + "editionSettings": {}, "eventsFunctions": [ { "fullName": "", @@ -9411,7 +9233,8 @@ "hidden": true, "name": "ShouldBeHiddenWhenReleased" } - ] + ], + "variants": [] } ] }, diff --git a/examples/starting-first-person-farming/starting-first-person-farming.json b/examples/starting-first-person-farming/starting-first-person-farming.json index a2b300d21..84cb70245 100644 --- a/examples/starting-first-person-farming/starting-first-person-farming.json +++ b/examples/starting-first-person-farming/starting-first-person-farming.json @@ -7024,13 +7024,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.9.0", + "version": "1.8.3", "description": [ - "Multitouch joysticks are objects showing a joystick on the screen, useful for mobile. They work like a physical gamepad:", + "Multitouch joysticks can be used the same way as physical gamepads:", "- 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.", + "- 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)." ], @@ -7094,28 +7094,6 @@ } ], "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", @@ -7534,11 +7512,11 @@ "objectGroups": [] }, { - "description": "Check if a button was just pressed on a multitouch controller.", - "fullName": "Multitouch controller button just pressed", + "description": "Check if a button is pressed on a gamepad.", + "fullName": "Multitouch controller button pressed", "functionType": "Condition", - "name": "IsButtonJustPressed", - "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ was just pressed", + "name": "IsButtonPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -7550,73 +7528,7 @@ "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 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\"" - ] - } + "\"Pressed\"" ] } ], @@ -7648,7 +7560,7 @@ "objectGroups": [] }, { - "description": "Check if a button is released on a multitouch controller.", + "description": "Check if a button is released on a gamepad.", "fullName": "Multitouch controller button released", "functionType": "Condition", "name": "IsButtonReleased", @@ -7734,7 +7646,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"JustPressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -9107,23 +9019,41 @@ "conditions": [ { "type": { - "inverted": true, - "value": "SpriteMultitouchJoystick::IsInGameEdition" + "value": "HasGameJustResumed" }, "parameters": [ - "", "" ] } ], - "actions": [], + "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": "HasGameJustResumed" + "value": "HasAnyTouchOrMouseStarted" }, "parameters": [ "" @@ -9133,207 +9063,171 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", - "" + "TouchIndex", + "=", + "0" ] } - ] - }, - { - "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" - ] - } - ], + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "StartedTouchOrMouseCount()", + "conditions": [], + "actions": [], "events": [ { - "type": "BuiltinCommonInstructions::Repeat", - "repeatExpression": "StartedTouchOrMouseCount()", - "conditions": [], - "actions": [], - "events": [ + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { - "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": "NumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "0" ] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchIndex", - "+", - "1" - ] - } + "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::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" - }, - "parameters": [ - "Object", - "Behavior", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchIndex", + "+", + "1" + ] + } ] } ] } - ], - "parameters": [] + ] }, { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Update joystick position", - "source": "", - "type": "BuiltinCommonInstructions::Group", - "events": [ + "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": "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)", - "" - ] - } + "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" ] } ], - "parameters": [] + "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": [ @@ -10208,7 +10102,7 @@ "sharedPropertyDescriptors": [] }, { - "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.", + "description": "Detect button presses made on a touchscreen.", "fullName": "Multitouch button", "name": "MultitouchButton", "objectType": "", @@ -10224,49 +10118,11 @@ "conditions": [ { "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "IsReleased", - "True", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsReleased", - "False", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + "value": "SpriteMultitouchJoystick::MultitouchButton::IsReleased" }, "parameters": [ "Object", "Behavior", - "\"Idle\"", - "" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "True", "" ] } @@ -10277,7 +10133,7 @@ "value": "SetBooleanVariable" }, "parameters": [ - "IsJustPressed", + "IsReleased", "False", "" ] @@ -10289,7 +10145,7 @@ "parameters": [ "Object", "Behavior", - "\"Pressed\"", + "\"Idle\"", "" ] } @@ -10387,17 +10243,7 @@ "parameters": [ "Object", "Behavior", - "\"JustPressed\"", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "True", + "\"Pressed\"", "" ] } @@ -10468,16 +10314,6 @@ "" ] }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "False", - "" - ] - }, { "type": { "value": "SetNumberVariable" @@ -10507,11 +10343,11 @@ "objectGroups": [] }, { - "description": "Check if the button was just pressed.", - "fullName": "Button just pressed", + "description": "Check if button is released.", + "fullName": "Button released", "functionType": "Condition", - "name": "IsJustPressed", - "sentence": "Button _PARAM0_ was just pressed", + "name": "IsReleased", + "sentence": "Button _PARAM0_ is released", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -10521,7 +10357,7 @@ "value": "BooleanVariable" }, "parameters": [ - "IsJustPressed", + "IsReleased", "True", "" ] @@ -10555,7 +10391,7 @@ "objectGroups": [] }, { - "description": "Check if the button is pressed.", + "description": "Check if button is pressed.", "fullName": "Button pressed", "functionType": "Condition", "name": "IsPressed", @@ -10602,54 +10438,6 @@ ], "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", @@ -10691,7 +10479,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"JustPressed\",\"Pressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -10732,13 +10520,6 @@ "hidden": true, "name": "IsReleased" }, - { - "value": "", - "type": "Boolean", - "label": "Button just pressed", - "hidden": true, - "name": "IsJustPressed" - }, { "value": "0", "type": "Number", @@ -13153,6 +12934,7 @@ } ], "instances": [], + "editionSettings": [], "eventsFunctions": [ { "fullName": "", @@ -13269,92 +13051,74 @@ "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::IsInGameEdition" + "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::IsPressed" }, "parameters": [ - "", + "Object", "" ] } ], - "actions": [], - "events": [ + "actions": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "MettreAutour" - }, - "parameters": [ - "Thumb", - "Border", - "Border.MultitouchJoystick::JoystickForce() * Border.Width() / 2", - "Border.MultitouchJoystick::JoystickAngle()" - ] - } + "type": { + "value": "Cache" + }, + "parameters": [ + "Object" ] }, { - "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", - "" - ] - } + "type": { + "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::ActivateControl" + }, + "parameters": [ + "Object", + "no", + "" + ] + }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "ShouldBeHiddenWhenReleased", + "False", + "" ] } ] @@ -14361,7 +14125,8 @@ "hidden": true, "name": "ShouldBeHiddenWhenReleased" } - ] + ], + "variants": [] } ] }, diff --git a/examples/starting-first-person-horror/starting-first-person-horror.json b/examples/starting-first-person-horror/starting-first-person-horror.json index 00137cc4f..9150b3494 100644 --- a/examples/starting-first-person-horror/starting-first-person-horror.json +++ b/examples/starting-first-person-horror/starting-first-person-horror.json @@ -3363,13 +3363,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.9.0", + "version": "1.8.3", "description": [ - "Multitouch joysticks are objects showing a joystick on the screen, useful for mobile. They work like a physical gamepad:", + "Multitouch joysticks can be used the same way as physical gamepads:", "- 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.", + "- 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)." ], @@ -3433,28 +3433,6 @@ } ], "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", @@ -3873,11 +3851,11 @@ "objectGroups": [] }, { - "description": "Check if a button was just pressed on a multitouch controller.", - "fullName": "Multitouch controller button just pressed", + "description": "Check if a button is pressed on a gamepad.", + "fullName": "Multitouch controller button pressed", "functionType": "Condition", - "name": "IsButtonJustPressed", - "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ was just pressed", + "name": "IsButtonPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -3889,73 +3867,7 @@ "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 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\"" - ] - } + "\"Pressed\"" ] } ], @@ -3987,7 +3899,7 @@ "objectGroups": [] }, { - "description": "Check if a button is released on a multitouch controller.", + "description": "Check if a button is released on a gamepad.", "fullName": "Multitouch controller button released", "functionType": "Condition", "name": "IsButtonReleased", @@ -4073,7 +3985,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"JustPressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -5446,23 +5358,41 @@ "conditions": [ { "type": { - "inverted": true, - "value": "SpriteMultitouchJoystick::IsInGameEdition" + "value": "HasGameJustResumed" }, "parameters": [ - "", "" ] } ], - "actions": [], + "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": "HasGameJustResumed" + "value": "HasAnyTouchOrMouseStarted" }, "parameters": [ "" @@ -5472,207 +5402,171 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", - "" + "TouchIndex", + "=", + "0" ] } - ] - }, - { - "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" - ] - } - ], + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "StartedTouchOrMouseCount()", + "conditions": [], + "actions": [], "events": [ { - "type": "BuiltinCommonInstructions::Repeat", - "repeatExpression": "StartedTouchOrMouseCount()", - "conditions": [], - "actions": [], - "events": [ + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { - "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": "NumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "0" ] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchIndex", - "+", - "1" - ] - } + "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::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" - }, - "parameters": [ - "Object", - "Behavior", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchIndex", + "+", + "1" + ] + } ] } ] } - ], - "parameters": [] + ] }, { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Update joystick position", - "source": "", - "type": "BuiltinCommonInstructions::Group", - "events": [ + "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": "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)", - "" - ] - } + "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" ] } ], - "parameters": [] + "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": [ @@ -6547,7 +6441,7 @@ "sharedPropertyDescriptors": [] }, { - "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.", + "description": "Detect button presses made on a touchscreen.", "fullName": "Multitouch button", "name": "MultitouchButton", "objectType": "", @@ -6563,49 +6457,11 @@ "conditions": [ { "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "IsReleased", - "True", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsReleased", - "False", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + "value": "SpriteMultitouchJoystick::MultitouchButton::IsReleased" }, "parameters": [ "Object", "Behavior", - "\"Idle\"", - "" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "True", "" ] } @@ -6616,7 +6472,7 @@ "value": "SetBooleanVariable" }, "parameters": [ - "IsJustPressed", + "IsReleased", "False", "" ] @@ -6628,7 +6484,7 @@ "parameters": [ "Object", "Behavior", - "\"Pressed\"", + "\"Idle\"", "" ] } @@ -6726,17 +6582,7 @@ "parameters": [ "Object", "Behavior", - "\"JustPressed\"", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "True", + "\"Pressed\"", "" ] } @@ -6807,16 +6653,6 @@ "" ] }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "False", - "" - ] - }, { "type": { "value": "SetNumberVariable" @@ -6846,11 +6682,11 @@ "objectGroups": [] }, { - "description": "Check if the button was just pressed.", - "fullName": "Button just pressed", + "description": "Check if button is released.", + "fullName": "Button released", "functionType": "Condition", - "name": "IsJustPressed", - "sentence": "Button _PARAM0_ was just pressed", + "name": "IsReleased", + "sentence": "Button _PARAM0_ is released", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -6860,7 +6696,7 @@ "value": "BooleanVariable" }, "parameters": [ - "IsJustPressed", + "IsReleased", "True", "" ] @@ -6894,7 +6730,7 @@ "objectGroups": [] }, { - "description": "Check if the button is pressed.", + "description": "Check if button is pressed.", "fullName": "Button pressed", "functionType": "Condition", "name": "IsPressed", @@ -6941,54 +6777,6 @@ ], "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", @@ -7030,7 +6818,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"JustPressed\",\"Pressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -7071,13 +6859,6 @@ "hidden": true, "name": "IsReleased" }, - { - "value": "", - "type": "Boolean", - "label": "Button just pressed", - "hidden": true, - "name": "IsJustPressed" - }, { "value": "0", "type": "Number", @@ -9492,6 +9273,7 @@ } ], "instances": [], + "editionSettings": {}, "eventsFunctions": [ { "fullName": "", @@ -9608,92 +9390,74 @@ "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::IsInGameEdition" + "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::IsPressed" }, "parameters": [ - "", + "Object", "" ] } ], - "actions": [], - "events": [ + "actions": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "MettreAutour" - }, - "parameters": [ - "Thumb", - "Border", - "Border.MultitouchJoystick::JoystickForce() * Border.Width() / 2", - "Border.MultitouchJoystick::JoystickAngle()" - ] - } + "type": { + "value": "Cache" + }, + "parameters": [ + "Object" ] }, { - "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", - "" - ] - } + "type": { + "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::ActivateControl" + }, + "parameters": [ + "Object", + "no", + "" + ] + }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "ShouldBeHiddenWhenReleased", + "False", + "" ] } ] @@ -10700,7 +10464,8 @@ "hidden": true, "name": "ShouldBeHiddenWhenReleased" } - ] + ], + "variants": [] } ] }, diff --git a/examples/starting-first-person-shooter-horror/starting-first-person-shooter-horror.json b/examples/starting-first-person-shooter-horror/starting-first-person-shooter-horror.json index 37ab5cc3f..3593817a2 100644 --- a/examples/starting-first-person-shooter-horror/starting-first-person-shooter-horror.json +++ b/examples/starting-first-person-shooter-horror/starting-first-person-shooter-horror.json @@ -4282,13 +4282,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.9.0", + "version": "1.8.3", "description": [ - "Multitouch joysticks are objects showing a joystick on the screen, useful for mobile. They work like a physical gamepad:", + "Multitouch joysticks can be used the same way as physical gamepads:", "- 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.", + "- 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)." ], @@ -4352,28 +4352,6 @@ } ], "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", @@ -4792,11 +4770,11 @@ "objectGroups": [] }, { - "description": "Check if a button was just pressed on a multitouch controller.", - "fullName": "Multitouch controller button just pressed", + "description": "Check if a button is pressed on a gamepad.", + "fullName": "Multitouch controller button pressed", "functionType": "Condition", - "name": "IsButtonJustPressed", - "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ was just pressed", + "name": "IsButtonPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -4808,7 +4786,7 @@ "parameters": [ "Controllers[ControllerIdentifier].Buttons[Button].State", "=", - "\"JustPressed\"" + "\"Pressed\"" ] } ], @@ -4840,73 +4818,7 @@ "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\"" - ] - } - ] - } - ], - "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.", + "description": "Check if a button is released on a gamepad.", "fullName": "Multitouch controller button released", "functionType": "Condition", "name": "IsButtonReleased", @@ -4992,7 +4904,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"JustPressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -6365,23 +6277,41 @@ "conditions": [ { "type": { - "inverted": true, - "value": "SpriteMultitouchJoystick::IsInGameEdition" + "value": "HasGameJustResumed" }, "parameters": [ - "", "" ] } ], - "actions": [], + "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": "HasGameJustResumed" + "value": "HasAnyTouchOrMouseStarted" }, "parameters": [ "" @@ -6391,207 +6321,171 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", - "" + "TouchIndex", + "=", + "0" ] } - ] - }, - { - "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" - ] - } - ], + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "StartedTouchOrMouseCount()", + "conditions": [], + "actions": [], "events": [ { - "type": "BuiltinCommonInstructions::Repeat", - "repeatExpression": "StartedTouchOrMouseCount()", - "conditions": [], - "actions": [], - "events": [ + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { - "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": "NumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "0" ] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchIndex", - "+", - "1" - ] - } + "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::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" - }, - "parameters": [ - "Object", - "Behavior", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchIndex", + "+", + "1" + ] + } ] } ] } - ], - "parameters": [] + ] }, { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Update joystick position", - "source": "", - "type": "BuiltinCommonInstructions::Group", - "events": [ + "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": "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)", - "" - ] - } + "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" ] } ], - "parameters": [] + "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": [ @@ -7466,7 +7360,7 @@ "sharedPropertyDescriptors": [] }, { - "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.", + "description": "Detect button presses made on a touchscreen.", "fullName": "Multitouch button", "name": "MultitouchButton", "objectType": "", @@ -7482,49 +7376,11 @@ "conditions": [ { "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "IsReleased", - "True", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsReleased", - "False", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + "value": "SpriteMultitouchJoystick::MultitouchButton::IsReleased" }, "parameters": [ "Object", "Behavior", - "\"Idle\"", - "" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "True", "" ] } @@ -7535,7 +7391,7 @@ "value": "SetBooleanVariable" }, "parameters": [ - "IsJustPressed", + "IsReleased", "False", "" ] @@ -7547,7 +7403,7 @@ "parameters": [ "Object", "Behavior", - "\"Pressed\"", + "\"Idle\"", "" ] } @@ -7645,17 +7501,7 @@ "parameters": [ "Object", "Behavior", - "\"JustPressed\"", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "True", + "\"Pressed\"", "" ] } @@ -7726,16 +7572,6 @@ "" ] }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "False", - "" - ] - }, { "type": { "value": "SetNumberVariable" @@ -7765,11 +7601,11 @@ "objectGroups": [] }, { - "description": "Check if the button was just pressed.", - "fullName": "Button just pressed", + "description": "Check if button is released.", + "fullName": "Button released", "functionType": "Condition", - "name": "IsJustPressed", - "sentence": "Button _PARAM0_ was just pressed", + "name": "IsReleased", + "sentence": "Button _PARAM0_ is released", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -7779,7 +7615,7 @@ "value": "BooleanVariable" }, "parameters": [ - "IsJustPressed", + "IsReleased", "True", "" ] @@ -7813,7 +7649,7 @@ "objectGroups": [] }, { - "description": "Check if the button is pressed.", + "description": "Check if button is pressed.", "fullName": "Button pressed", "functionType": "Condition", "name": "IsPressed", @@ -7860,54 +7696,6 @@ ], "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", @@ -7949,7 +7737,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"JustPressed\",\"Pressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -7990,13 +7778,6 @@ "hidden": true, "name": "IsReleased" }, - { - "value": "", - "type": "Boolean", - "label": "Button just pressed", - "hidden": true, - "name": "IsJustPressed" - }, { "value": "0", "type": "Number", @@ -10411,6 +10192,7 @@ } ], "instances": [], + "editionSettings": {}, "eventsFunctions": [ { "fullName": "", @@ -10527,92 +10309,74 @@ "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::IsInGameEdition" + "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::IsPressed" }, "parameters": [ - "", + "Object", "" ] } ], - "actions": [], - "events": [ + "actions": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "MettreAutour" - }, - "parameters": [ - "Thumb", - "Border", - "Border.MultitouchJoystick::JoystickForce() * Border.Width() / 2", - "Border.MultitouchJoystick::JoystickAngle()" - ] - } + "type": { + "value": "Cache" + }, + "parameters": [ + "Object" ] }, { - "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", - "" - ] - } + "type": { + "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::ActivateControl" + }, + "parameters": [ + "Object", + "no", + "" + ] + }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "ShouldBeHiddenWhenReleased", + "False", + "" ] } ] @@ -11619,7 +11383,8 @@ "hidden": true, "name": "ShouldBeHiddenWhenReleased" } - ] + ], + "variants": [] } ] }, diff --git a/examples/starting-first-person-shooter/starting-first-person-shooter.json b/examples/starting-first-person-shooter/starting-first-person-shooter.json index ee3977cf6..f3b4506fc 100644 --- a/examples/starting-first-person-shooter/starting-first-person-shooter.json +++ b/examples/starting-first-person-shooter/starting-first-person-shooter.json @@ -3405,13 +3405,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.9.0", + "version": "1.8.3", "description": [ - "Multitouch joysticks are objects showing a joystick on the screen, useful for mobile. They work like a physical gamepad:", + "Multitouch joysticks can be used the same way as physical gamepads:", "- 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.", + "- 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)." ], @@ -3475,28 +3475,6 @@ } ], "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", @@ -3915,11 +3893,11 @@ "objectGroups": [] }, { - "description": "Check if a button was just pressed on a multitouch controller.", - "fullName": "Multitouch controller button just pressed", + "description": "Check if a button is pressed on a gamepad.", + "fullName": "Multitouch controller button pressed", "functionType": "Condition", - "name": "IsButtonJustPressed", - "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ was just pressed", + "name": "IsButtonPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -3931,7 +3909,7 @@ "parameters": [ "Controllers[ControllerIdentifier].Buttons[Button].State", "=", - "\"JustPressed\"" + "\"Pressed\"" ] } ], @@ -3963,73 +3941,7 @@ "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\"" - ] - } - ] - } - ], - "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.", + "description": "Check if a button is released on a gamepad.", "fullName": "Multitouch controller button released", "functionType": "Condition", "name": "IsButtonReleased", @@ -4115,7 +4027,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"JustPressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -5488,23 +5400,41 @@ "conditions": [ { "type": { - "inverted": true, - "value": "SpriteMultitouchJoystick::IsInGameEdition" + "value": "HasGameJustResumed" }, "parameters": [ - "", "" ] } ], - "actions": [], + "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": "HasGameJustResumed" + "value": "HasAnyTouchOrMouseStarted" }, "parameters": [ "" @@ -5514,207 +5444,171 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", - "" + "TouchIndex", + "=", + "0" ] } - ] - }, - { - "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" - ] - } - ], + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "StartedTouchOrMouseCount()", + "conditions": [], + "actions": [], "events": [ { - "type": "BuiltinCommonInstructions::Repeat", - "repeatExpression": "StartedTouchOrMouseCount()", - "conditions": [], - "actions": [], - "events": [ + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { - "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": "NumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "0" ] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchIndex", - "+", - "1" - ] - } + "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::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" - }, - "parameters": [ - "Object", - "Behavior", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchIndex", + "+", + "1" + ] + } ] } ] } - ], - "parameters": [] + ] }, { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Update joystick position", - "source": "", - "type": "BuiltinCommonInstructions::Group", - "events": [ + "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": "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)", - "" - ] - } + "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" ] } ], - "parameters": [] + "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": [ @@ -6589,7 +6483,7 @@ "sharedPropertyDescriptors": [] }, { - "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.", + "description": "Detect button presses made on a touchscreen.", "fullName": "Multitouch button", "name": "MultitouchButton", "objectType": "", @@ -6605,49 +6499,11 @@ "conditions": [ { "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "IsReleased", - "True", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsReleased", - "False", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + "value": "SpriteMultitouchJoystick::MultitouchButton::IsReleased" }, "parameters": [ "Object", "Behavior", - "\"Idle\"", - "" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "True", "" ] } @@ -6658,7 +6514,7 @@ "value": "SetBooleanVariable" }, "parameters": [ - "IsJustPressed", + "IsReleased", "False", "" ] @@ -6670,7 +6526,7 @@ "parameters": [ "Object", "Behavior", - "\"Pressed\"", + "\"Idle\"", "" ] } @@ -6768,17 +6624,7 @@ "parameters": [ "Object", "Behavior", - "\"JustPressed\"", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "True", + "\"Pressed\"", "" ] } @@ -6849,16 +6695,6 @@ "" ] }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "False", - "" - ] - }, { "type": { "value": "SetNumberVariable" @@ -6888,11 +6724,11 @@ "objectGroups": [] }, { - "description": "Check if the button was just pressed.", - "fullName": "Button just pressed", + "description": "Check if button is released.", + "fullName": "Button released", "functionType": "Condition", - "name": "IsJustPressed", - "sentence": "Button _PARAM0_ was just pressed", + "name": "IsReleased", + "sentence": "Button _PARAM0_ is released", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -6902,7 +6738,7 @@ "value": "BooleanVariable" }, "parameters": [ - "IsJustPressed", + "IsReleased", "True", "" ] @@ -6936,7 +6772,7 @@ "objectGroups": [] }, { - "description": "Check if the button is pressed.", + "description": "Check if button is pressed.", "fullName": "Button pressed", "functionType": "Condition", "name": "IsPressed", @@ -6983,54 +6819,6 @@ ], "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", @@ -7072,7 +6860,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"JustPressed\",\"Pressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -7113,13 +6901,6 @@ "hidden": true, "name": "IsReleased" }, - { - "value": "", - "type": "Boolean", - "label": "Button just pressed", - "hidden": true, - "name": "IsJustPressed" - }, { "value": "0", "type": "Number", @@ -9534,6 +9315,7 @@ } ], "instances": [], + "editionSettings": {}, "eventsFunctions": [ { "fullName": "", @@ -9650,92 +9432,74 @@ "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::IsInGameEdition" + "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::IsPressed" }, "parameters": [ - "", + "Object", "" ] } ], - "actions": [], - "events": [ + "actions": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "MettreAutour" - }, - "parameters": [ - "Thumb", - "Border", - "Border.MultitouchJoystick::JoystickForce() * Border.Width() / 2", - "Border.MultitouchJoystick::JoystickAngle()" - ] - } + "type": { + "value": "Cache" + }, + "parameters": [ + "Object" ] }, { - "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", - "" - ] - } + "type": { + "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::ActivateControl" + }, + "parameters": [ + "Object", + "no", + "" + ] + }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "ShouldBeHiddenWhenReleased", + "False", + "" ] } ] @@ -10742,7 +10506,8 @@ "hidden": true, "name": "ShouldBeHiddenWhenReleased" } - ] + ], + "variants": [] } ] }, diff --git a/examples/starting-first-person-survival-crafting/starting-first-person-survival-crafting.json b/examples/starting-first-person-survival-crafting/starting-first-person-survival-crafting.json index 02b9b3615..a010975a8 100644 --- a/examples/starting-first-person-survival-crafting/starting-first-person-survival-crafting.json +++ b/examples/starting-first-person-survival-crafting/starting-first-person-survival-crafting.json @@ -5462,13 +5462,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.9.0", + "version": "1.8.3", "description": [ - "Multitouch joysticks are objects showing a joystick on the screen, useful for mobile. They work like a physical gamepad:", + "Multitouch joysticks can be used the same way as physical gamepads:", "- 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.", + "- 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)." ], @@ -5532,28 +5532,6 @@ } ], "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", @@ -5972,11 +5950,11 @@ "objectGroups": [] }, { - "description": "Check if a button was just pressed on a multitouch controller.", - "fullName": "Multitouch controller button just pressed", + "description": "Check if a button is pressed on a gamepad.", + "fullName": "Multitouch controller button pressed", "functionType": "Condition", - "name": "IsButtonJustPressed", - "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ was just pressed", + "name": "IsButtonPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -5988,73 +5966,7 @@ "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 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\"" - ] - } + "\"Pressed\"" ] } ], @@ -6086,7 +5998,7 @@ "objectGroups": [] }, { - "description": "Check if a button is released on a multitouch controller.", + "description": "Check if a button is released on a gamepad.", "fullName": "Multitouch controller button released", "functionType": "Condition", "name": "IsButtonReleased", @@ -6172,7 +6084,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"JustPressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -7545,23 +7457,41 @@ "conditions": [ { "type": { - "inverted": true, - "value": "SpriteMultitouchJoystick::IsInGameEdition" + "value": "HasGameJustResumed" }, "parameters": [ - "", "" ] } ], - "actions": [], + "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": "HasGameJustResumed" + "value": "HasAnyTouchOrMouseStarted" }, "parameters": [ "" @@ -7571,207 +7501,171 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", - "" + "TouchIndex", + "=", + "0" ] } - ] - }, - { - "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" - ] - } - ], + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "StartedTouchOrMouseCount()", + "conditions": [], + "actions": [], "events": [ { - "type": "BuiltinCommonInstructions::Repeat", - "repeatExpression": "StartedTouchOrMouseCount()", - "conditions": [], - "actions": [], - "events": [ + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { - "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": "NumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "0" ] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchIndex", - "+", - "1" - ] - } + "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::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" - }, - "parameters": [ - "Object", - "Behavior", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchIndex", + "+", + "1" + ] + } ] } ] } - ], - "parameters": [] + ] }, { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Update joystick position", - "source": "", - "type": "BuiltinCommonInstructions::Group", - "events": [ + "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": "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)", - "" - ] - } + "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" ] } ], - "parameters": [] + "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": [ @@ -8646,7 +8540,7 @@ "sharedPropertyDescriptors": [] }, { - "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.", + "description": "Detect button presses made on a touchscreen.", "fullName": "Multitouch button", "name": "MultitouchButton", "objectType": "", @@ -8662,49 +8556,11 @@ "conditions": [ { "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "IsReleased", - "True", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsReleased", - "False", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + "value": "SpriteMultitouchJoystick::MultitouchButton::IsReleased" }, "parameters": [ "Object", "Behavior", - "\"Idle\"", - "" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "True", "" ] } @@ -8715,7 +8571,7 @@ "value": "SetBooleanVariable" }, "parameters": [ - "IsJustPressed", + "IsReleased", "False", "" ] @@ -8727,7 +8583,7 @@ "parameters": [ "Object", "Behavior", - "\"Pressed\"", + "\"Idle\"", "" ] } @@ -8825,17 +8681,7 @@ "parameters": [ "Object", "Behavior", - "\"JustPressed\"", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "True", + "\"Pressed\"", "" ] } @@ -8906,16 +8752,6 @@ "" ] }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "False", - "" - ] - }, { "type": { "value": "SetNumberVariable" @@ -8945,11 +8781,11 @@ "objectGroups": [] }, { - "description": "Check if the button was just pressed.", - "fullName": "Button just pressed", + "description": "Check if button is released.", + "fullName": "Button released", "functionType": "Condition", - "name": "IsJustPressed", - "sentence": "Button _PARAM0_ was just pressed", + "name": "IsReleased", + "sentence": "Button _PARAM0_ is released", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -8959,7 +8795,7 @@ "value": "BooleanVariable" }, "parameters": [ - "IsJustPressed", + "IsReleased", "True", "" ] @@ -8993,7 +8829,7 @@ "objectGroups": [] }, { - "description": "Check if the button is pressed.", + "description": "Check if button is pressed.", "fullName": "Button pressed", "functionType": "Condition", "name": "IsPressed", @@ -9040,54 +8876,6 @@ ], "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", @@ -9129,7 +8917,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"JustPressed\",\"Pressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -9170,13 +8958,6 @@ "hidden": true, "name": "IsReleased" }, - { - "value": "", - "type": "Boolean", - "label": "Button just pressed", - "hidden": true, - "name": "IsJustPressed" - }, { "value": "0", "type": "Number", @@ -11591,6 +11372,7 @@ } ], "instances": [], + "editionSettings": [], "eventsFunctions": [ { "fullName": "", @@ -11707,92 +11489,74 @@ "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::IsInGameEdition" + "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::IsPressed" }, "parameters": [ - "", + "Object", "" ] } ], - "actions": [], - "events": [ + "actions": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "MettreAutour" - }, - "parameters": [ - "Thumb", - "Border", - "Border.MultitouchJoystick::JoystickForce() * Border.Width() / 2", - "Border.MultitouchJoystick::JoystickAngle()" - ] - } + "type": { + "value": "Cache" + }, + "parameters": [ + "Object" ] }, { - "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", - "" - ] - } + "type": { + "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::ActivateControl" + }, + "parameters": [ + "Object", + "no", + "" + ] + }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "ShouldBeHiddenWhenReleased", + "False", + "" ] } ] @@ -12799,7 +12563,8 @@ "hidden": true, "name": "ShouldBeHiddenWhenReleased" } - ] + ], + "variants": [] } ] }, diff --git a/examples/starting-first-person/starting-first-person.json b/examples/starting-first-person/starting-first-person.json index 741047b5f..69c47f305 100644 --- a/examples/starting-first-person/starting-first-person.json +++ b/examples/starting-first-person/starting-first-person.json @@ -2504,13 +2504,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.9.0", + "version": "1.8.3", "description": [ - "Multitouch joysticks are objects showing a joystick on the screen, useful for mobile. They work like a physical gamepad:", + "Multitouch joysticks can be used the same way as physical gamepads:", "- 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.", + "- 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)." ], @@ -2574,28 +2574,6 @@ } ], "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", @@ -3014,11 +2992,11 @@ "objectGroups": [] }, { - "description": "Check if a button was just pressed on a multitouch controller.", - "fullName": "Multitouch controller button just pressed", + "description": "Check if a button is pressed on a gamepad.", + "fullName": "Multitouch controller button pressed", "functionType": "Condition", - "name": "IsButtonJustPressed", - "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ was just pressed", + "name": "IsButtonPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -3030,73 +3008,7 @@ "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 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\"" - ] - } + "\"Pressed\"" ] } ], @@ -3128,7 +3040,7 @@ "objectGroups": [] }, { - "description": "Check if a button is released on a multitouch controller.", + "description": "Check if a button is released on a gamepad.", "fullName": "Multitouch controller button released", "functionType": "Condition", "name": "IsButtonReleased", @@ -3214,7 +3126,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"JustPressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -4587,23 +4499,41 @@ "conditions": [ { "type": { - "inverted": true, - "value": "SpriteMultitouchJoystick::IsInGameEdition" + "value": "HasGameJustResumed" }, "parameters": [ - "", "" ] } ], - "actions": [], + "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": "HasGameJustResumed" + "value": "HasAnyTouchOrMouseStarted" }, "parameters": [ "" @@ -4613,207 +4543,171 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", - "" + "TouchIndex", + "=", + "0" ] } - ] - }, - { - "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" - ] - } - ], + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "StartedTouchOrMouseCount()", + "conditions": [], + "actions": [], "events": [ { - "type": "BuiltinCommonInstructions::Repeat", - "repeatExpression": "StartedTouchOrMouseCount()", - "conditions": [], - "actions": [], - "events": [ + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { - "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": "NumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "0" ] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchIndex", - "+", - "1" - ] - } + "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::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" - }, - "parameters": [ - "Object", - "Behavior", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchIndex", + "+", + "1" + ] + } ] } ] } - ], - "parameters": [] + ] }, { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Update joystick position", - "source": "", - "type": "BuiltinCommonInstructions::Group", - "events": [ + "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": "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)", - "" - ] - } + "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" ] } ], - "parameters": [] + "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": [ @@ -5688,7 +5582,7 @@ "sharedPropertyDescriptors": [] }, { - "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.", + "description": "Detect button presses made on a touchscreen.", "fullName": "Multitouch button", "name": "MultitouchButton", "objectType": "", @@ -5704,49 +5598,11 @@ "conditions": [ { "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "IsReleased", - "True", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsReleased", - "False", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + "value": "SpriteMultitouchJoystick::MultitouchButton::IsReleased" }, "parameters": [ "Object", "Behavior", - "\"Idle\"", - "" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "True", "" ] } @@ -5757,7 +5613,7 @@ "value": "SetBooleanVariable" }, "parameters": [ - "IsJustPressed", + "IsReleased", "False", "" ] @@ -5769,7 +5625,7 @@ "parameters": [ "Object", "Behavior", - "\"Pressed\"", + "\"Idle\"", "" ] } @@ -5867,17 +5723,7 @@ "parameters": [ "Object", "Behavior", - "\"JustPressed\"", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "True", + "\"Pressed\"", "" ] } @@ -5948,16 +5794,6 @@ "" ] }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "False", - "" - ] - }, { "type": { "value": "SetNumberVariable" @@ -5987,11 +5823,11 @@ "objectGroups": [] }, { - "description": "Check if the button was just pressed.", - "fullName": "Button just pressed", + "description": "Check if button is released.", + "fullName": "Button released", "functionType": "Condition", - "name": "IsJustPressed", - "sentence": "Button _PARAM0_ was just pressed", + "name": "IsReleased", + "sentence": "Button _PARAM0_ is released", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -6001,7 +5837,7 @@ "value": "BooleanVariable" }, "parameters": [ - "IsJustPressed", + "IsReleased", "True", "" ] @@ -6035,7 +5871,7 @@ "objectGroups": [] }, { - "description": "Check if the button is pressed.", + "description": "Check if button is pressed.", "fullName": "Button pressed", "functionType": "Condition", "name": "IsPressed", @@ -6082,54 +5918,6 @@ ], "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", @@ -6171,7 +5959,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"JustPressed\",\"Pressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -6212,13 +6000,6 @@ "hidden": true, "name": "IsReleased" }, - { - "value": "", - "type": "Boolean", - "label": "Button just pressed", - "hidden": true, - "name": "IsJustPressed" - }, { "value": "0", "type": "Number", @@ -8633,6 +8414,7 @@ } ], "instances": [], + "editionSettings": {}, "eventsFunctions": [ { "fullName": "", @@ -8749,92 +8531,74 @@ "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::IsInGameEdition" + "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::IsPressed" }, "parameters": [ - "", + "Object", "" ] } ], - "actions": [], - "events": [ + "actions": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "MettreAutour" - }, - "parameters": [ - "Thumb", - "Border", - "Border.MultitouchJoystick::JoystickForce() * Border.Width() / 2", - "Border.MultitouchJoystick::JoystickAngle()" - ] - } + "type": { + "value": "Cache" + }, + "parameters": [ + "Object" ] }, { - "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", - "" - ] - } + "type": { + "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::ActivateControl" + }, + "parameters": [ + "Object", + "no", + "" + ] + }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "ShouldBeHiddenWhenReleased", + "False", + "" ] } ] @@ -9841,7 +9605,8 @@ "hidden": true, "name": "ShouldBeHiddenWhenReleased" } - ] + ], + "variants": [] } ] }, diff --git a/examples/starting-platformer-pixel/starting-platformer-pixel.json b/examples/starting-platformer-pixel/starting-platformer-pixel.json index ee7088a69..f31d91c9e 100644 --- a/examples/starting-platformer-pixel/starting-platformer-pixel.json +++ b/examples/starting-platformer-pixel/starting-platformer-pixel.json @@ -7731,19 +7731,19 @@ "category": "Input", "extensionNamespace": "", "fullName": "Multitouch joystick and buttons (sprite)", - "gdevelopVersion": ">=5.5.222", + "gdevelopVersion": "", "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", + "version": "1.4.0", "description": [ - "Multitouch joysticks are objects showing a joystick on the screen, useful for mobile. They work like a physical gamepad:", + "Multitouch joysticks can be used the same way as physical gamepads:", "- 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.", + "- 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)." ], @@ -7808,33 +7808,108 @@ ], "eventsFunctions": [ { - "description": "Check if the events are running for the editor.", - "fullName": "Editor is running", + "description": "Check if a button is pressed on a gamepad.", + "fullName": "Multitouch controller button pressed", "functionType": "Condition", - "name": "IsInGameEdition", - "private": true, - "sentence": "Events are running for the editor", + "name": "IsButtonPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", "events": [ { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "const game = runtimeScene.getGame();\r", - "eventsFunctionContext.returnValue = game.isInGameEdition && game.isInGameEdition();" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"Pressed\"" + ] + } ], - "parameterObjects": "", - "useStrict": true, - "eventsSheetExpanded": false + "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" } ], - "parameters": [], "objectGroups": [] }, { - "fullName": "Accelerated speed", - "functionType": "Expression", - "name": "AcceleratedSpeed", + "description": "Check if a button is released on a gamepad.", + "fullName": "Multitouch controller button released", + "functionType": "Condition", + "name": "IsButtonReleased", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is released", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"Released\"" + ] + } + ], + "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": "Change a button state for a multitouch controller.", + "fullName": "Button state", + "functionType": "Action", + "name": "SetButtonState", "private": true, - "sentence": "", + "sentence": "Mark _PARAM2_ button as _PARAM3_ for multitouch controller _PARAM1_", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -7842,443 +7917,108 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SetStringVariable" }, "parameters": [ - "AcceleratedSpeed", + "Controllers[ControllerIdentifier].Buttons[Button].State", "=", - "CurrentSpeed" + "ButtonState" ] } - ], - "events": [ + ] + } + ], + "parameters": [ + { + "description": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier", + "type": "expression" + }, + { + "description": "Button name", + "name": "Button", + "type": "string" + }, + { + "description": "Button state", + "name": "ButtonState", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "type": "stringWithSelector" + } + ], + "objectGroups": [] + }, + { + "description": "Change the dead zone radius of a joystick. 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).", + "fullName": "Dead zone radius", + "functionType": "Action", + "name": "SetDeadZone", + "private": true, + "sentence": "Change the dead zone of multitouch joystick _PARAM2_ of multitouch controller _PARAM1_ to _PARAM3_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ { - "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", - "=", - "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": { + "value": "SetNumberVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].DeadZone", + "=", + "DeadZoneRadius" ] - }, - { - "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": "NumberVariable" - }, - "parameters": [ - "TargetedSpeed", - "=", - "0" - ] - } - ], - "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", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "clamp(AcceleratedSpeed, -SpeedMax, SpeedMax)" - ] - } - ] - } - ], - "variables": [ - { - "name": "AcceleratedSpeed", - "type": "number", - "value": 0 } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { - "description": "Current speed", - "name": "CurrentSpeed", - "type": "expression" - }, - { - "description": "Targeted speed", - "name": "TargetedSpeed", - "type": "expression" - }, - { - "description": "Max speed", - "name": "SpeedMax", + "description": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier", "type": "expression" }, { - "description": "Acceleration", - "name": "Acceleration", - "type": "expression" + "description": "Joystick name", + "name": "JoystickIdentifier", + "type": "string" }, { - "description": "Deceleration", - "name": "Deceleration", + "description": "Dead zone radius", + "name": "DeadZoneRadius", + "supplementaryInformation": "[]", "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", + "description": "Return the dead zone radius of a joystick. 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).", + "fullName": "Dead zone radius", + "functionType": "Expression", + "name": "DeadZone", + "private": true, + "sentence": "Change multitouch joystick _PARAM2_ of multitouch controller _PARAM1_ dead zone to _PARAM3_", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Buttons[Button].State", - "=", - "\"JustPressed\"" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "SetReturnBoolean" + "value": "SetReturnNumber" }, "parameters": [ - "True" + "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].DeadZone" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Multitouch controller identifier (1, 2, 3, 4...)", @@ -8286,276 +8026,31 @@ "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\"]", + "description": "Joystick name", + "name": "JoystickIdentifier", "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", + "description": "the direction index (left = 1, bottom = 1, right = 2, top = 3) for an angle (in degrees).", + "fullName": "Angle to 4-way index", + "functionType": "ExpressionAndCondition", + "name": "AngleTo4Way", + "private": true, + "sentence": "The angle _PARAM1_ 4-way index", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "conditions": [], + "actions": [ { "type": { - "value": "BuiltinCommonInstructions::Or" + "value": "SetReturnNumber" }, - "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", - "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is released", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Buttons[Button].State", - "=", - "\"Released\"" - ] - } - ], - "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": "Change a button state for a multitouch controller.", - "fullName": "Button state", - "functionType": "Action", - "name": "SetButtonState", - "private": true, - "sentence": "Mark _PARAM2_ button as _PARAM3_ for multitouch controller _PARAM1_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetStringVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Buttons[Button].State", - "=", - "ButtonState" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" - }, - { - "description": "Button name", - "name": "Button", - "type": "string" - }, - { - "description": "Button state", - "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"JustPressed\",\"Released\"]", - "type": "stringWithSelector" - } - ], - "objectGroups": [] - }, - { - "description": "Change the dead zone radius of a joystick. 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).", - "fullName": "Dead zone radius", - "functionType": "Action", - "name": "SetDeadZone", - "private": true, - "sentence": "Change the dead zone of multitouch joystick _PARAM2_ of multitouch controller _PARAM1_ to _PARAM3_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].DeadZone", - "=", - "DeadZoneRadius" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" - }, - { - "description": "Joystick name", - "name": "JoystickIdentifier", - "type": "string" - }, - { - "description": "Dead zone radius", - "name": "DeadZoneRadius", - "supplementaryInformation": "[]", - "type": "expression" - } - ], - "objectGroups": [] - }, - { - "description": "Return the dead zone radius of a joystick. 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).", - "fullName": "Dead zone radius", - "functionType": "Expression", - "name": "DeadZone", - "private": true, - "sentence": "Change multitouch joystick _PARAM2_ of multitouch controller _PARAM1_ dead zone to _PARAM3_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].DeadZone" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" - }, - { - "description": "Joystick name", - "name": "JoystickIdentifier", - "type": "string" - } - ], - "objectGroups": [] - }, - { - "description": "the direction index (left = 1, bottom = 1, right = 2, top = 3) for an angle (in degrees).", - "fullName": "Angle to 4-way index", - "functionType": "ExpressionAndCondition", - "name": "AngleTo4Way", - "private": true, - "sentence": "The angle _PARAM1_ 4-way index", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "mod(round(Angle * 4 / 360), 4)" + "parameters": [ + "mod(round(Angle * 4 / 360), 4)" ] } ] @@ -9297,11 +8792,6 @@ "name": "JoystickIdentifier", "supplementaryInformation": "[\"Primary\",\"Secondary\"]", "type": "stringWithSelector" - }, - { - "description": "", - "name": "Coucou", - "type": "expression" } ], "objectGroups": [] @@ -9531,7 +9021,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "XFromAngleAndDistance(SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier), SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier))" + "SpriteMultitouchJoystick::JoystickForce(ControllerIdentifier, JoystickIdentifier) * cos(ToRad(SpriteMultitouchJoystick::JoystickAngle(ControllerIdentifier, JoystickIdentifier)))" ] } ] @@ -9571,7 +9061,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "YFromAngleAndDistance(SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier), SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier))" + "SpriteMultitouchJoystick::JoystickForce(ControllerIdentifier, JoystickIdentifier) * sin(ToRad(SpriteMultitouchJoystick::JoystickAngle(ControllerIdentifier, JoystickIdentifier)))" ] } ] @@ -9594,126 +9084,9 @@ } ], "objectGroups": [] - }, - { - "description": "Check if a new touch has started on the right or left side of the screen.", - "fullName": "New touch on a screen side", - "functionType": "Condition", - "group": "Multitouch Joystick", - "name": "HasTouchStartedOnScreenSide", - "sentence": "A new touch has started on the _PARAM2_ side of the screen on _PARAM1_'s layer", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "HasAnyTouchOrMouseStarted" - }, - "parameters": [ - "" - ] - } - ], - "actions": [], - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "Side", - "=", - "\"Left\"" - ] - }, - { - "type": { - "value": "TouchX" - }, - "parameters": [ - "", - "StartedTouchOrMouseId(0)", - "<", - "CameraCenterX(Object.Layer())", - "Object.Layer()", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "Side", - "=", - "\"Right\"" - ] - }, - { - "type": { - "value": "TouchX" - }, - "parameters": [ - "", - "StartedTouchOrMouseId(0)", - ">=", - "CameraCenterX(Object.Layer())", - "Object.Layer()", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - } - ] - } - ], - "parameters": [ - { - "description": "Multitouch joystick", - "name": "Object", - "supplementaryInformation": "SpriteMultitouchJoystick::SpriteMultitouchJoystick", - "type": "objectList" - }, - { - "description": "Screen side", - "name": "Side", - "supplementaryInformation": "[\"Left\",\"Right\"]", - "type": "stringWithSelector" - } - ], - "objectGroups": [] - } - ], - "eventsBasedBehaviors": [ + } + ], + "eventsBasedBehaviors": [ { "description": "Joystick that can be controlled by interacting with a touchscreen.", "fullName": "Multitouch Joystick", @@ -9721,1905 +9094,74 @@ "objectType": "", "private": true, "eventsFunctions": [ - { - "fullName": "", - "functionType": "Action", - "name": "onCreated", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::SetDeadZone" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "DeadZoneRadius", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "Action", - "name": "onDeActivate", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "Action", - "name": "doStepPreEvents", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "inverted": true, - "value": "SpriteMultitouchJoystick::IsInGameEdition" - }, - "parameters": [ - "", - "" - ] - } - ], - "actions": [], - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "HasGameJustResumed" - }, - "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)" - }, - { - "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": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "the joystick force (from 0 to 1).", - "fullName": "Joystick force", - "functionType": "ExpressionAndCondition", - "name": "JoystickForce", - "sentence": "the joystick force", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "max(0, JoystickForce - DeadZoneRadius) / (1 - DeadZoneRadius)" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "JoystickForce", - "name": "SetJoystickForce", - "private": true, - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "JoystickForce", - "=", - "Value" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::SetJoystickForce" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "JoystickForce", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - }, - { - "description": "", - "name": "Parameter", - "type": "objectList" - } - ], - "objectGroups": [] - }, - { - "description": "Return the angle the joystick is pointing towards (Range: -180 to 180).", - "fullName": "Joystick angle", - "functionType": "Expression", - "name": "JoystickAngle", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "JoystickAngle" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "Change the angle the joystick is pointing towards (Range: -180 to 180).", - "fullName": "Joystick angle", - "functionType": "Action", - "name": "SetJoystickAngle", - "private": true, - "sentence": "Change the joystick angle of _PARAM0_ to _PARAM2_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "JoystickAngle", - "=", - "Value" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::SetJoystickAngle" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "JoystickAngle", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - }, - { - "description": "Angle", - "name": "Value", - "type": "expression" - } - ], - "objectGroups": [] - }, - { - "description": "Return the stick force on X axis (from -1 at the left to 1 at the right).", - "fullName": "Stick X force", - "functionType": "Expression", - "name": "StickForceX", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "Object.Behavior::JoystickForce() * cos(ToRad(Object.Behavior::JoystickAngle()))" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "Return the stick force on Y axis (from -1 at the top to 1 at the bottom).", - "fullName": "Stick Y force", - "functionType": "Expression", - "name": "StickForceY", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "Object.Behavior::JoystickForce() * sin(ToRad(Object.Behavior::JoystickAngle()))" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "Check if joystick is pushed in a given direction.", - "fullName": "Joystick pushed in a direction (4-way movement)", - "functionType": "Condition", - "name": "IsDirectionPushed4Way", - "sentence": "_PARAM0_ is pushed in direction _PARAM2_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::JoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - ">", - "0", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::IsAngleIn4WayDirection" - }, - "parameters": [ - "", - "JoystickAngle", - "Direction", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - }, - { - "description": "Direction", - "name": "Direction", - "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\"]", - "type": "stringWithSelector" - } - ], - "objectGroups": [] - }, - { - "description": "Check if joystick is pushed in a given direction.", - "fullName": "Joystick pushed in a direction (8-way movement)", - "functionType": "Condition", - "name": "IsDirectionPushed8Way", - "sentence": "_PARAM0_ is pushed in direction _PARAM2_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::JoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - ">", - "0", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::IsAngleIn8WayDirection" - }, - "parameters": [ - "", - "JoystickAngle", - "Direction", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - }, - { - "description": "Direction", - "name": "Direction", - "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\",\"UpLeft\",\"UpRight\",\"DownLeft\",\"DownRight\"]", - "type": "stringWithSelector" - } - ], - "objectGroups": [] - }, - { - "description": "Check if a joystick is pressed.", - "fullName": "Joystick pressed", - "functionType": "Condition", - "name": "IsPressed", - "sentence": "Joystick _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::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "Reset the joystick values (except for angle, which stays the same)", - "fullName": "Reset", - "functionType": "Action", - "name": "Reset", - "private": true, - "sentence": "Reset the joystick of _PARAM0_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "0", - "" - ] - }, - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "0" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "the multitouch controller identifier.", - "fullName": "Multitouch controller identifier", - "functionType": "ExpressionAndCondition", - "group": "Multitouch Joystick configuration", - "name": "ControllerIdentifier", - "sentence": "the multitouch controller identifier", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "ControllerIdentifier" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "ControllerIdentifier", - "name": "SetControllerIdentifier", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "ControllerIdentifier", - "=", - "Value" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "the joystick name.", - "fullName": "Joystick name", - "functionType": "ExpressionAndCondition", - "group": "Multitouch Joystick configuration", - "name": "JoystickIdentifier", - "sentence": "the joystick name", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnString" - }, - "parameters": [ - "JoystickIdentifier" - ] - } - ] - } - ], - "expressionType": { - "type": "string" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "JoystickIdentifier", - "name": "SetJoystickIdentifier", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetStringVariable" - }, - "parameters": [ - "JoystickIdentifier", - "=", - "Value" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "the dead zone radius (range: 0 to 1) of the joystick. 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).", - "fullName": "Dead zone radius", - "functionType": "ExpressionAndCondition", - "group": "Multitouch Joystick configuration", - "name": "DeadZoneRadius", - "sentence": "the dead zone radius", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "DeadZoneRadius" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "DeadZoneRadius", - "name": "SetDeadZoneRadius", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "DeadZoneRadius", - "=", - "Value" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::SetDeadZone" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "Value", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "Force the joystick into the pressing state.", - "fullName": "Force start pressing", - "functionType": "Action", - "name": "ForceStartPressing", - "sentence": "Force start pressing _PARAM0_ with touch identifier: _PARAM2_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "Value" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - }, - { - "description": "Touch identifier", - "name": "Value", - "type": "expression" - } - ], - "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "1", - "type": "Number", - "label": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier" - }, - { - "value": "Primary", - "type": "String", - "label": "Joystick name", - "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": "0", - "type": "Number", - "label": "Joystick angle (range: -180 to 180)", - "hidden": true, - "name": "JoystickAngle" - }, - { - "value": "0", - "type": "Number", - "label": "Joystick force (range: 0 to 1)", - "hidden": true, - "name": "JoystickForce" - }, - { - "value": "0", - "type": "Number", - "label": "", - "hidden": true, - "name": "TouchId" - }, - { - "value": "", - "type": "Number", - "label": "", - "hidden": true, - "name": "TouchIndex" - } - ], - "sharedPropertyDescriptors": [] - }, - { - "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": "", - "eventsFunctions": [ - { - "fullName": "", - "functionType": "Action", - "name": "doStepPreEvents", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "IsReleased", - "True", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsReleased", - "False", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" - }, - "parameters": [ - "Object", - "Behavior", - "\"Idle\"", - "" - ] - } - ] - }, - { - "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": [ - { - "type": { - "inverted": true, - "value": "SpriteMultitouchJoystick::MultitouchButton::IsPressed" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - }, - { - "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": "BuiltinCommonInstructions::Or" - }, - "parameters": [], - "subInstructions": [ - { - "type": { - "value": "CollisionPoint" - }, - "parameters": [ - "Object", - "TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer())", - "TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer())" - ] - }, - { - "type": { - "value": "NumberVariable" - }, - "parameters": [ - "Radius", - ">", - "DistanceBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer()), TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer()))" - ] - } - ] - } - ], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "StartedTouchOrMouseId(TouchIndex)" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" - }, - "parameters": [ - "Object", - "Behavior", - "\"JustPressed\"", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "True", - "" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchIndex", - "+", - "1" - ] - } - ] - } - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::IsPressed" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - }, - { - "type": { - "value": "HasTouchEnded" - }, - "parameters": [ - "", - "TouchId" - ] - } - ], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" - }, - "parameters": [ - "Object", - "Behavior", - "\"Released\"", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsReleased", - "True", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "False", - "" - ] - }, - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "0" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "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", - "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", - "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": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", - "type": "behavior" - }, - { - "description": "Button state", - "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"JustPressed\",\"Pressed\",\"Released\"]", - "type": "stringWithSelector" - } - ], - "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "1", - "type": "Number", - "label": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier" - }, - { - "value": "A", - "type": "String", - "label": "Button identifier", - "name": "ButtonIdentifier" - }, - { - "value": "0", - "type": "Number", - "label": "TouchID", - "hidden": true, - "name": "TouchId" - }, - { - "value": "", - "type": "Number", - "label": "", - "hidden": true, - "name": "TouchIndex" - }, - { - "value": "", - "type": "Boolean", - "label": "Button released", - "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.", - "name": "Radius" - } - ], - "sharedPropertyDescriptors": [] - }, - { - "description": "Control a platformer character with a multitouch controller.", - "fullName": "Platformer multitouch controller mapper", - "name": "PlatformerMultitouchMapper", - "objectType": "", - "quickCustomizationVisibility": "hidden", - "eventsFunctions": [ - { - "fullName": "", - "functionType": "Action", - "name": "doStepPreEvents", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "\"Left\"", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateLeftKey" - }, - "parameters": [ - "Object", - "Property" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "\"Right\"", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateRightKey" - }, - "parameters": [ - "Object", - "Property" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "\"Up\"", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateUpKey" - }, - "parameters": [ - "Object", - "Property" - ] - }, - { - "type": { - "value": "PlatformBehavior::SimulateLadderKey" - }, - "parameters": [ - "Object", - "Property" - ] - } - ] - }, + { + "fullName": "", + "functionType": "Action", + "name": "onCreated", + "sentence": "", + "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "conditions": [], + "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" + "value": "SpriteMultitouchJoystick::SetDeadZone" }, "parameters": [ "", "ControllerIdentifier", "JoystickIdentifier", - "\"Down\"", + "DeadZoneRadius", "" ] - } - ], - "actions": [ + }, { "type": { - "value": "PlatformBehavior::SimulateDownKey" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" }, "parameters": [ "Object", - "Property" + "Behavior", + "" ] } ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "Action", + "name": "onDeActivate", + "sentence": "", + "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::IsButtonPressed" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JumpButton", - "\"Down\"" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "PlatformBehavior::SimulateJumpKey" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" }, "parameters": [ "Object", - "Property" + "Behavior", + "" ] } ] @@ -11634,64 +9176,12 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::PlatformerMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "", - "type": "Behavior", - "label": "Platform character behavior", - "extraInformation": [ - "PlatformBehavior::PlatformerObjectBehavior" - ], - "choices": [], - "name": "Property" - }, - { - "value": "1", - "type": "Number", - "label": "Controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier" - }, - { - "value": "Primary", - "type": "Choice", - "label": "Joystick name", - "group": "Controls", - "choices": [ - { - "label": "Primary", - "value": "Primary" - }, - { - "label": "Secondary", - "value": "Secondary" - } - ], - "name": "JoystickIdentifier" }, - { - "value": "A", - "type": "String", - "label": "Jump button name", - "group": "Controls", - "name": "JumpButton" - } - ], - "sharedPropertyDescriptors": [] - }, - { - "description": "Control a 3D physics character with a multitouch controller.", - "fullName": "3D platformer multitouch controller mapper", - "name": "Platformer3DMultitouchMapper", - "objectType": "", - "quickCustomizationVisibility": "hidden", - "eventsFunctions": [ { "fullName": "", "functionType": "Action", @@ -11703,14 +9193,9 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::StickForce" + "value": "HasGameJustResumed" }, "parameters": [ - "", - ">", - "0", - "ControllerIdentifier", - "JoystickIdentifier", "" ] } @@ -11718,54 +9203,210 @@ "actions": [ { "type": { - "value": "Physics3D::PhysicsCharacter3D::SetForwardAngle" - }, - "parameters": [ - "Object", - "PhysicsCharacter3D", - "=", - "SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier) + CameraAngle(Object.Layer())" - ] - }, - { - "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateStick" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" }, "parameters": [ "Object", - "PhysicsCharacter3D", - "-90", - "SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier)" + "Behavior", + "" ] } ] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Manage touches", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::IsButtonPressed" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "HasAnyTouchOrMouseStarted" + }, + "parameters": [ + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyTouchIndex" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "0" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "StartedTouchOrMouseCount()", + "conditions": [], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::PropertyTouchId" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "0" + ] + }, + { + "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::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 }, - "parameters": [ - "", - "ControllerIdentifier", - "JumpButton", - "\"Down\"" + "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" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } ] } ], - "actions": [ + "parameters": [] + }, + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Update joystick position", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ { - "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" - }, - "parameters": [ - "Object", - "PhysicsCharacter3D" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::PropertyTouchId" + }, + "parameters": [ + "Object", + "Behavior", + "!=", + "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": [ @@ -11777,129 +9418,37 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::Platformer3DMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "", - "type": "Behavior", - "label": "3D physics character", - "extraInformation": [ - "Physics3D::PhysicsCharacter3D" - ], - "choices": [], - "name": "PhysicsCharacter3D" - }, - { - "value": "1", - "type": "Number", - "label": "Controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier" - }, - { - "value": "Primary", - "type": "Choice", - "label": "Walk joystick", - "group": "Controls", - "choices": [ - { - "label": "Primary", - "value": "Primary" - }, - { - "label": "Secondary", - "value": "Secondary" - } - ], - "name": "JoystickIdentifier" }, { - "value": "A", - "type": "String", - "label": "Jump button name", - "group": "Controls", - "name": "JumpButton" - } - ], - "sharedPropertyDescriptors": [] - }, - { - "description": "Control a 3D physics character with a multitouch controller.", - "fullName": "3D shooter multitouch controller mapper", - "name": "Shooter3DMultitouchMapper", - "objectType": "", - "quickCustomizationVisibility": "hidden", - "eventsFunctions": [ - { - "fullName": "", - "functionType": "Action", - "name": "doStepPreEvents", - "sentence": "", + "description": "the joystick force (from 0 to 1).", + "fullName": "Joystick force", + "functionType": "ExpressionAndCondition", + "name": "JoystickForce", + "sentence": "the joystick force", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::StickForce" - }, - "parameters": [ - "", - ">", - "0", - "ControllerIdentifier", - "JoystickIdentifier", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateStick" - }, - "parameters": [ - "Object", - "PhysicsCharacter3D", - "SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier)", - "SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier)" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::IsButtonPressed" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JumpButton", - "\"Down\"" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" + "value": "SetReturnNumber" }, "parameters": [ - "Object", - "PhysicsCharacter3D" + "max(0, JoystickForce - DeadZoneRadius) / (1 - DeadZoneRadius)" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -11909,151 +9458,90 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::Shooter3DMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "", - "type": "Behavior", - "label": "3D physics character", - "extraInformation": [ - "Physics3D::PhysicsCharacter3D" - ], - "choices": [], - "name": "PhysicsCharacter3D" - }, - { - "value": "1", - "type": "Number", - "label": "Controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier" - }, - { - "value": "Primary", - "type": "Choice", - "label": "Walk joystick", - "group": "Controls", - "choices": [ - { - "label": "Primary", - "value": "Primary" - }, - { - "label": "Secondary", - "value": "Secondary" - } - ], - "name": "JoystickIdentifier" }, - { - "value": "A", - "type": "String", - "label": "Jump button name", - "group": "Controls", - "name": "JumpButton" - } - ], - "sharedPropertyDescriptors": [] - }, - { - "description": "Control camera rotations with a multitouch controller.", - "fullName": "First person camera multitouch controller mapper", - "name": "FirstPersonMultitouchMapper", - "objectType": "", - "quickCustomizationVisibility": "hidden", - "eventsFunctions": [ { "fullName": "", - "functionType": "Action", - "name": "doStepPreEvents", + "functionType": "ActionWithOperator", + "getterName": "JoystickForce", + "name": "SetJoystickForce", + "private": true, "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", - "=", - "SpriteMultitouchJoystick::AcceleratedSpeed(CurrentRotationSpeedZ, SpriteMultitouchJoystick::StickForceX(ControllerIdentifier, CameraStick) * HorizontalRotationSpeedMax, HorizontalRotationSpeedMax, HorizontalRotationAcceleration, HorizontalRotationDeceleration)" - ] - }, - { - "type": { - "value": "SetAngle" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickForce" }, "parameters": [ "Object", - "+", - "CurrentRotationSpeedZ * TimeDelta()" - ] - }, - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "CurrentRotationSpeedY", + "Behavior", "=", - "SpriteMultitouchJoystick::AcceleratedSpeed(CurrentRotationSpeedY, SpriteMultitouchJoystick::StickForceY(ControllerIdentifier, CameraStick) * VerticalRotationSpeedMax, VerticalRotationSpeedMax, VerticalRotationAcceleration, VerticalRotationDeceleration)" - ] - }, - { - "type": { - "value": "Scene3D::Base3DBehavior::SetRotationY" - }, - "parameters": [ - "Object", - "Object3D", - "+", - "CurrentRotationSpeedY * TimeDelta()" + "Value" ] }, { "type": { - "value": "Scene3D::Base3DBehavior::SetRotationY" + "value": "SpriteMultitouchJoystick::SetJoystickForce" }, "parameters": [ - "Object", - "Object3D", - "=", - "clamp(Object.Object3D::RotationY(), VerticalAngleMin, VerticalAngleMax)" + "", + "ControllerIdentifier", + "JoystickIdentifier", + "JoystickForce", + "" ] - }, + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Return the angle the joystick is pointing towards (Range: -180 to 180).", + "fullName": "Joystick angle", + "functionType": "Expression", + "name": "JoystickAngle", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper::LookFromObjectEyes" + "value": "SetReturnNumber" }, "parameters": [ - "Object", - "Behavior", - "" + "JoystickAngle" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -12063,20 +9551,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "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", + "description": "Change the angle the joystick is pointing towards (Range: -180 to 180).", + "fullName": "Joystick angle", "functionType": "Action", - "group": "Layers and cameras", - "name": "LookFromObjectEyes", + "name": "SetJoystickAngle", "private": true, - "sentence": "Move the camera to look though _PARAM0_ eyes", + "sentence": "Change the joystick angle of _PARAM0_ to _PARAM2_", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -12084,61 +9571,24 @@ "actions": [ { "type": { - "value": "CentreCamera" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickAngle" }, "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": [ - "", + "Behavior", "=", - "Object.Object3D::RotationX()", - "GetArgumentAsString(\"Layer\")", - "" + "Value" ] }, { "type": { - "value": "SetCameraAngle" + "value": "SpriteMultitouchJoystick::SetJoystickAngle" }, "parameters": [ "", - "=", - "Object.Angle() + 90", - "Object.Layer()", + "ControllerIdentifier", + "JoystickIdentifier", + "JoystickAngle", "" ] } @@ -12154,19 +9604,23 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" + }, + { + "description": "Angle", + "name": "Value", + "type": "expression" } ], "objectGroups": [] }, { - "description": "the maximum horizontal rotation speed of the object.", - "fullName": "Maximum horizontal rotation speed", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper horizontal rotation configuration", - "name": "HorizontalRotationSpeedMax", - "sentence": "the maximum horizontal rotation speed", + "description": "Return the stick force on X axis (from -1 at the left to 1 at the right).", + "fullName": "Stick X force", + "functionType": "Expression", + "name": "StickForceX", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -12177,7 +9631,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "HorizontalRotationSpeedMax" + "Object.Behavior::JoystickForce() * cos(ToRad(Object.Behavior::JoystickAngle()))" ] } ] @@ -12195,17 +9649,17 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] }, { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "HorizontalRotationSpeedMax", - "name": "SetHorizontalRotationSpeedMax", + "description": "Return the stick force on Y axis (from -1 at the top to 1 at the bottom).", + "fullName": "Stick Y force", + "functionType": "Expression", + "name": "StickForceY", "sentence": "", "events": [ { @@ -12214,17 +9668,18 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SetReturnNumber" }, "parameters": [ - "HorizontalRotationSpeedMax", - "=", - "Value" + "Object.Behavior::JoystickForce() * sin(ToRad(Object.Behavior::JoystickAngle()))" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -12234,38 +9689,58 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the horizontal rotation acceleration of the object.", - "fullName": "Horizontal rotation acceleration", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper horizontal rotation configuration", - "name": "HorizontalRotationAcceleration", - "sentence": "the horizontal rotation acceleration", + "description": "Check if joystick is pushed in a given direction.", + "fullName": "Joystick pushed in a direction (4-way movement)", + "functionType": "Condition", + "name": "IsDirectionPushed4Way", + "sentence": "_PARAM0_ is pushed in direction _PARAM2_", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::JoystickForce" + }, + "parameters": [ + "Object", + "Behavior", + ">", + "0", + "" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::IsAngleIn4WayDirection" + }, + "parameters": [ + "", + "JoystickAngle", + "Direction", + "" + ] + } + ], "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "SetReturnBoolean" }, "parameters": [ - "HorizontalRotationAcceleration" + "True" ] } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -12275,31 +9750,59 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" + }, + { + "description": "Direction", + "name": "Direction", + "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\"]", + "type": "stringWithSelector" } ], "objectGroups": [] }, { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "HorizontalRotationAcceleration", - "name": "SetHorizontalRotationAcceleration", - "sentence": "", + "description": "Check if joystick is pushed in a given direction.", + "fullName": "Joystick pushed in a direction (8-way movement)", + "functionType": "Condition", + "name": "IsDirectionPushed8Way", + "sentence": "_PARAM0_ is pushed in direction _PARAM2_", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::JoystickForce" + }, + "parameters": [ + "Object", + "Behavior", + ">", + "0", + "" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::IsAngleIn8WayDirection" + }, + "parameters": [ + "", + "JoystickAngle", + "Direction", + "" + ] + } + ], "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SetReturnBoolean" }, "parameters": [ - "HorizontalRotationAcceleration", - "=", - "Value" + "True" ] } ] @@ -12314,38 +9817,52 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" + }, + { + "description": "Direction", + "name": "Direction", + "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\",\"UpLeft\",\"UpRight\",\"DownLeft\",\"DownRight\"]", + "type": "stringWithSelector" } ], "objectGroups": [] }, { - "description": "the horizontal rotation deceleration of the object.", - "fullName": "Horizontal rotation deceleration", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper horizontal rotation configuration", - "name": "HorizontalRotationDeceleration", - "sentence": "the horizontal rotation deceleration", + "description": "Check if a joystick is pressed.", + "fullName": "Joystick pressed", + "functionType": "Condition", + "name": "IsPressed", + "sentence": "Joystick _PARAM0_ is pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::PropertyTouchId" + }, + "parameters": [ + "Object", + "Behavior", + "!=", + "0" + ] + } + ], "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "SetReturnBoolean" }, "parameters": [ - "HorizontalRotationDeceleration" + "True" ] } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -12355,18 +9872,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] }, { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "HorizontalRotationDeceleration", - "name": "SetHorizontalRotationDeceleration", - "sentence": "", + "description": "Reset the joystick values (except for angle, which stays the same)", + "fullName": "Reset", + "functionType": "Action", + "name": "Reset", + "private": true, + "sentence": "Reset the joystick of _PARAM0_", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -12374,12 +9892,25 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" }, "parameters": [ - "HorizontalRotationDeceleration", + "Object", + "Behavior", "=", - "Value" + "0", + "" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyTouchId" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "0" ] } ] @@ -12394,19 +9925,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the maximum vertical rotation speed of the object.", - "fullName": "Maximum vertical rotation speed", + "description": "the multitouch controller identifier.", + "fullName": "Multitouch controller identifier", "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper vertical rotation configuration", - "name": "VerticalRotationSpeedMax", - "sentence": "the maximum vertical rotation speed", + "group": "Multitouch Joystick configuration", + "name": "ControllerIdentifier", + "sentence": "the multitouch controller identifier", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -12417,7 +9948,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "VerticalRotationSpeedMax" + "ControllerIdentifier" ] } ] @@ -12435,7 +9966,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], @@ -12444,8 +9975,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "VerticalRotationSpeedMax", - "name": "SetVerticalRotationSpeedMax", + "getterName": "ControllerIdentifier", + "name": "SetControllerIdentifier", "sentence": "", "events": [ { @@ -12454,10 +9985,11 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyControllerIdentifier" }, "parameters": [ - "VerticalRotationSpeedMax", + "Object", + "Behavior", "=", "Value" ] @@ -12474,19 +10006,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the vertical rotation acceleration of the object.", - "fullName": "Vertical rotation acceleration", + "description": "the joystick name.", + "fullName": "Joystick name", "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper vertical rotation configuration", - "name": "VerticalRotationAcceleration", - "sentence": "the vertical rotation acceleration", + "group": "Multitouch Joystick configuration", + "name": "JoystickIdentifier", + "sentence": "the joystick name", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -12494,17 +10026,17 @@ "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "SetReturnString" }, "parameters": [ - "VerticalRotationAcceleration" + "JoystickIdentifier" ] } ] } ], "expressionType": { - "type": "expression" + "type": "string" }, "parameters": [ { @@ -12515,7 +10047,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], @@ -12524,8 +10056,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "VerticalRotationAcceleration", - "name": "SetVerticalRotationAcceleration", + "getterName": "JoystickIdentifier", + "name": "SetJoystickIdentifier", "sentence": "", "events": [ { @@ -12534,10 +10066,11 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickIdentifier" }, "parameters": [ - "VerticalRotationAcceleration", + "Object", + "Behavior", "=", "Value" ] @@ -12554,19 +10087,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the vertical rotation deceleration of the object.", - "fullName": "Vertical rotation deceleration", + "description": "the dead zone radius (range: 0 to 1) of the joystick. 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).", + "fullName": "Dead zone radius", "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper vertical rotation configuration", - "name": "VerticalRotationDeceleration", - "sentence": "the vertical rotation deceleration", + "group": "Multitouch Joystick configuration", + "name": "DeadZoneRadius", + "sentence": "the dead zone radius", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -12577,7 +10110,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "VerticalRotationDeceleration" + "DeadZoneRadius" ] } ] @@ -12595,7 +10128,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], @@ -12604,8 +10137,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "VerticalRotationDeceleration", - "name": "SetVerticalRotationDeceleration", + "getterName": "DeadZoneRadius", + "name": "SetDeadZoneRadius", "sentence": "", "events": [ { @@ -12614,10 +10147,11 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyDeadZoneRadius" }, "parameters": [ - "VerticalRotationDeceleration", + "Object", + "Behavior", "=", "Value" ] @@ -12634,72 +10168,271 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] + } + ], + "propertyDescriptors": [ + { + "value": "1", + "type": "Number", + "label": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier" }, { - "description": "the minimum vertical camera angle of the object.", - "fullName": "Minimum vertical camera angle", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper vertical rotation configuration", - "name": "VerticalAngleMin", - "sentence": "the minimum vertical camera angle", + "value": "Primary", + "type": "String", + "label": "Joystick name", + "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": "0", + "type": "Number", + "label": "Joystick angle (range: -180 to 180)", + "hidden": true, + "name": "JoystickAngle" + }, + { + "value": "0", + "type": "Number", + "label": "Joystick force (range: 0 to 1)", + "hidden": true, + "name": "JoystickForce" + }, + { + "value": "0", + "type": "Number", + "label": "", + "hidden": true, + "name": "TouchId" + }, + { + "value": "", + "type": "Number", + "label": "", + "hidden": true, + "name": "TouchIndex" + } + ], + "sharedPropertyDescriptors": [] + }, + { + "description": "Detect button presses made on a touchscreen.", + "fullName": "Multitouch button", + "name": "MultitouchButton", + "objectType": "", + "eventsFunctions": [ + { + "fullName": "", + "functionType": "Action", + "name": "doStepPreEvents", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::IsReleased" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } + ], "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyIsReleased" + }, + "parameters": [ + "Object", + "Behavior", + "no" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" }, "parameters": [ - "VerticalAngleMin" + "Object", + "Behavior", + "\"Idle\"", + "" ] } ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" }, { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "VerticalAngleMin", - "name": "SetVerticalAngleMin", - "sentence": "", - "events": [ + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "SpriteMultitouchJoystick::MultitouchButton::IsPressed" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + }, + { + "type": { + "value": "HasAnyTouchOrMouseStarted" + }, + "parameters": [ + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchIndex" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "0" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "StartedTouchOrMouseCount()", + "conditions": [], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "CollisionPoint" + }, + "parameters": [ + "Object", + "TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)", + "TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchId" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "StartedTouchOrMouseId(TouchIndex)" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + }, + "parameters": [ + "Object", + "Behavior", + "\"Pressed\"", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchIndex" + }, + "parameters": [ + "Object", + "Behavior", + "+", + "1" + ] + } + ] + } + ] + } + ] + }, { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::IsPressed" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + }, + { + "type": { + "value": "HasTouchEnded" + }, + "parameters": [ + "", + "TouchId" + ] + } + ], "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + }, + "parameters": [ + "Object", + "Behavior", + "\"Released\"", + "" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyIsReleased" + }, + "parameters": [ + "Object", + "Behavior", + "yes" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchId" }, "parameters": [ - "VerticalAngleMin", + "Object", + "Behavior", "=", - "Value" + "0" ] } ] @@ -12714,72 +10447,39 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the maximum vertical camera angle of the object.", - "fullName": "Maximum vertical camera angle", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper vertical rotation configuration", - "name": "VerticalAngleMax", - "sentence": "the maximum vertical camera angle", + "description": "Check if button is released.", + "fullName": "Button released", + "functionType": "Condition", + "name": "IsReleased", + "sentence": "Button _PARAM0_ is released", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ + "conditions": [ { "type": { - "value": "SetReturnNumber" + "value": "SpriteMultitouchJoystick::MultitouchButton::PropertyIsReleased" }, "parameters": [ - "VerticalAngleMax" + "Object", + "Behavior" ] } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "VerticalAngleMax", - "name": "SetVerticalAngleMax", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + ], "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SetReturnBoolean" }, "parameters": [ - "VerticalAngleMax", - "=", - "Value" + "True" ] } ] @@ -12794,38 +10494,46 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the z position offset of the object.", - "fullName": "Z position offset", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper position configuration", - "name": "OffsetZ", - "sentence": "the z position offset", + "description": "Check if button is pressed.", + "fullName": "Button pressed", + "functionType": "Condition", + "name": "IsPressed", + "sentence": "Button _PARAM0_ is pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::PropertyTouchId" + }, + "parameters": [ + "Object", + "Behavior", + "!=", + "0" + ] + } + ], "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "SetReturnBoolean" }, "parameters": [ - "OffsetZ" + "True" ] } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -12835,18 +10543,18 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", "type": "behavior" } ], "objectGroups": [] }, { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "OffsetZ", - "name": "SetOffsetZ", - "sentence": "", + "fullName": "Button state", + "functionType": "Action", + "name": "SetButtonState", + "private": true, + "sentence": "Mark the button _PARAM0_ as _PARAM2_", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -12854,12 +10562,14 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::SetButtonState" }, "parameters": [ - "OffsetZ", - "=", - "Value" + "", + "ControllerIdentifier", + "ButtonIdentifier", + "ButtonState", + "" ] } ] @@ -12874,140 +10584,61 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", "type": "behavior" + }, + { + "description": "Button state", + "name": "ButtonState", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "type": "stringWithSelector" } ], "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...)", + "label": "Multitouch 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": "A", + "type": "String", + "label": "Button identifier", + "name": "ButtonIdentifier" }, { "value": "0", "type": "Number", - "unit": "Pixel", - "label": "Z position offset", - "group": "Position", - "name": "OffsetZ" + "label": "TouchID", + "hidden": true, + "name": "TouchId" }, { - "value": "0", + "value": "", "type": "Number", - "unit": "AngularSpeed", - "label": "Current rotation speed Z", + "label": "", "hidden": true, - "name": "CurrentRotationSpeedZ" + "name": "TouchIndex" }, { - "value": "0", - "type": "Number", - "unit": "AngularSpeed", - "label": "Current rotation speed Y", + "value": "", + "type": "Boolean", + "label": "Button released", "hidden": true, - "name": "CurrentRotationSpeedY" + "name": "IsReleased" } ], "sharedPropertyDescriptors": [] }, { - "description": "Control a 3D physics car with a multitouch controller.", - "fullName": "3D car multitouch controller mapper", - "name": "PhysicsCar3DMultitouchMapper", + "description": "Control a platformer character with a multitouch controller.", + "fullName": "Platformer multitouch controller mapper", + "name": "PlatformerMultitouchMapper", "objectType": "", - "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -13020,27 +10651,90 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::StickForce" + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JoystickIdentifier", + "\"Left\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "PlatformBehavior::SimulateLeftKey" + }, + "parameters": [ + "Object", + "Property" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JoystickIdentifier", + "\"Right\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "PlatformBehavior::SimulateRightKey" + }, + "parameters": [ + "Object", + "Property" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" }, "parameters": [ "", - ">", - "0", "ControllerIdentifier", - "SteerJoystickIdentifier", + "JoystickIdentifier", + "\"Up\"", "" ] - } - ], - "actions": [ + } + ], + "actions": [ + { + "type": { + "value": "PlatformBehavior::SimulateUpKey" + }, + "parameters": [ + "Object", + "Property" + ] + }, { "type": { - "value": "Physics3D::PhysicsCar3D::SimulateSteeringStick" + "value": "PlatformBehavior::SimulateLadderKey" }, "parameters": [ "Object", - "PhysicsCar3D", - "SpriteMultitouchJoystick::StickForceX(ControllerIdentifier, \"Primary\")" + "Property" ] } ] @@ -13050,14 +10744,13 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::StickForce" + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" }, "parameters": [ "", - ">", - "0", "ControllerIdentifier", - "SpeedJoystickIdentifier", + "JoystickIdentifier", + "\"Down\"", "" ] } @@ -13065,12 +10758,11 @@ "actions": [ { "type": { - "value": "Physics3D::PhysicsCar3D::SimulateAcceleratorStick" + "value": "PlatformBehavior::SimulateDownKey" }, "parameters": [ "Object", - "PhysicsCar3D", - "-SpriteMultitouchJoystick::StickForceY(ControllerIdentifier, \"Secondary\")" + "Property" ] } ] @@ -13085,7 +10777,7 @@ "parameters": [ "", "ControllerIdentifier", - "HandBrakeButton", + "JumpButton", "\"Down\"" ] } @@ -13093,11 +10785,11 @@ "actions": [ { "type": { - "value": "Physics3D::PhysicsCar3D::SimulateHandBrakeKey" + "value": "PlatformBehavior::SimulateJumpKey" }, "parameters": [ "Object", - "PhysicsCar3D" + "Property" ] } ] @@ -13112,7 +10804,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::PhysicsCar3DMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::PlatformerMultitouchMapper", "type": "behavior" } ], @@ -13123,12 +10815,12 @@ { "value": "", "type": "Behavior", - "label": "3D physics car", + "label": "Platform character behavior", "extraInformation": [ - "Physics3D::PhysicsCar3D" + "PlatformBehavior::PlatformerObjectBehavior" ], "choices": [], - "name": "PhysicsCar3D" + "name": "Property" }, { "value": "1", @@ -13139,24 +10831,7 @@ { "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", + "label": "Joystick name", "group": "Controls", "choices": [ { @@ -13168,14 +10843,14 @@ "value": "Secondary" } ], - "name": "SpeedJoystickIdentifier" + "name": "JoystickIdentifier" }, { - "value": "B", + "value": "A", "type": "String", - "label": "Hand brake button name", + "label": "Jump button name", "group": "Controls", - "name": "HandBrakeButton" + "name": "JumpButton" } ], "sharedPropertyDescriptors": [] @@ -13185,7 +10860,6 @@ "fullName": "Top-down multitouch controller mapper", "name": "TopDownMultitouchMapper", "objectType": "", - "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -13198,10 +10872,11 @@ "conditions": [ { "type": { - "value": "StringVariable" + "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" }, "parameters": [ - "StickMode", + "Object", + "Behavior", "=", "\"Analog\"" ] @@ -13226,10 +10901,11 @@ "conditions": [ { "type": { - "value": "StringVariable" + "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" }, "parameters": [ - "StickMode", + "Object", + "Behavior", "=", "\"360°\"" ] @@ -13254,10 +10930,11 @@ "conditions": [ { "type": { - "value": "StringVariable" + "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" }, "parameters": [ - "StickMode", + "Object", + "Behavior", "=", "\"8 Directions\"" ] @@ -13866,6 +11543,7 @@ } ], "instances": [], + "editionSettings": {}, "eventsFunctions": [ { "fullName": "", @@ -13984,90 +11662,17 @@ "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "conditions": [], + "actions": [ { "type": { - "inverted": true, - "value": "SpriteMultitouchJoystick::IsInGameEdition" + "value": "MettreAutour" }, "parameters": [ - "", - "" - ] - } - ], - "actions": [], - "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" - }, - "parameters": [ - "Object", - "no", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "ShouldBeHiddenWhenReleased", - "False", - "" - ] - } + "Thumb", + "Border", + "Border.MultitouchJoystick::JoystickForce() * Border.Width() / 2", + "Border.MultitouchJoystick::JoystickAngle()" ] } ] @@ -14135,7 +11740,7 @@ "Border", "MultitouchJoystick", "=", - "ControllerIdentifier", + "Object.PropertyControllerIdentifier()", "" ] }, @@ -14147,7 +11752,7 @@ "Border", "MultitouchJoystick", "=", - "JoystickIdentifier", + "Object.PropertyJoystickIdentifier()", "" ] }, @@ -14159,92 +11764,7 @@ "Border", "MultitouchJoystick", "=", - "DeadZoneRadius", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "supplementaryInformation": "SpriteMultitouchJoystick::SpriteMultitouchJoystick", - "type": "object" - } - ], - "objectGroups": [] - }, - { - "description": "Show the joystick until it is released.", - "fullName": "Show and start pressing", - "functionType": "Action", - "name": "TeleportAndPress", - "sentence": "Show _PARAM0_ at the cursor position and start pressing", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "HasAnyTouchOrMouseStarted" - }, - "parameters": [ - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "MettreXY" - }, - "parameters": [ - "Object", - "=", - "Object.ParentTouchX(StartedTouchOrMouseId(0))", - "=", - "Object.ParentTouchY(StartedTouchOrMouseId(0))" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::ActivateControl" - }, - "parameters": [ - "Object", - "yes", - "" - ] - }, - { - "type": { - "value": "Montre" - }, - "parameters": [ - "Object", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "ShouldBeHiddenWhenReleased", - "True", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::ForceStartPressing" - }, - "parameters": [ - "Border", - "MultitouchJoystick", - "StartedTouchOrMouseId(0)", + "Object.PropertyDeadZoneRadius()", "" ] } @@ -14261,92 +11781,6 @@ ], "objectGroups": [] }, - { - "description": "Return the X position of a specified touch", - "fullName": "Touch X position (on parent)", - "functionType": "Expression", - "name": "ParentTouchX", - "private": true, - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [] - }, - { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "const object = objects[0];", - "const touchId = eventsFunctionContext.getArgument(\"TouchId\");", - "eventsFunctionContext.returnValue = gdjs.evtTools.input.getTouchX(object.getInstanceContainer(), touchId, object.getLayer());" - ], - "parameterObjects": "Object", - "useStrict": true, - "eventsSheetExpanded": false - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "supplementaryInformation": "SpriteMultitouchJoystick::SpriteMultitouchJoystick", - "type": "object" - }, - { - "description": "Touch identifier", - "name": "TouchId", - "type": "expression" - } - ], - "objectGroups": [] - }, - { - "description": "Return the X position of a specified touch", - "fullName": "Touch X position (on parent)", - "functionType": "Expression", - "name": "ParentTouchY", - "private": true, - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [] - }, - { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "const object = objects[0];", - "const touchId = eventsFunctionContext.getArgument(\"TouchId\");", - "eventsFunctionContext.returnValue = gdjs.evtTools.input.getTouchY(object.getInstanceContainer(), touchId, object.getLayer());" - ], - "parameterObjects": "Object", - "useStrict": true, - "eventsSheetExpanded": false - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "supplementaryInformation": "SpriteMultitouchJoystick::SpriteMultitouchJoystick", - "type": "object" - }, - { - "description": "Touch identifier", - "name": "TouchId", - "type": "expression" - } - ], - "objectGroups": [] - }, { "description": "De/activate control of the joystick.", "fullName": "De/activate control", @@ -14360,12 +11794,10 @@ { "type": { "inverted": true, - "value": "BooleanVariable" + "value": "GetArgumentAsBoolean" }, "parameters": [ - "ShouldActivate", - "True", - "" + "\"ShouldActivate\"" ] } ], @@ -14387,12 +11819,10 @@ "conditions": [ { "type": { - "value": "BooleanVariable" + "value": "GetArgumentAsBoolean" }, "parameters": [ - "ShouldActivate", - "True", - "" + "\"ShouldActivate\"" ] } ], @@ -15066,15 +12496,9 @@ "description": "Only used by the scene editor.", "hidden": true, "name": "ParentOrigin" - }, - { - "value": "", - "type": "Boolean", - "label": "", - "hidden": true, - "name": "ShouldBeHiddenWhenReleased" } - ] + ], + "variants": [] } ] }, diff --git a/examples/starting-platformer/starting-platformer.json b/examples/starting-platformer/starting-platformer.json index b67b3a0dd..99cc4900d 100644 --- a/examples/starting-platformer/starting-platformer.json +++ b/examples/starting-platformer/starting-platformer.json @@ -7698,19 +7698,19 @@ "category": "Input", "extensionNamespace": "", "fullName": "Multitouch joystick and buttons (sprite)", - "gdevelopVersion": ">=5.5.222", + "gdevelopVersion": "", "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", + "version": "1.4.0", "description": [ - "Multitouch joysticks are objects showing a joystick on the screen, useful for mobile. They work like a physical gamepad:", + "Multitouch joysticks can be used the same way as physical gamepads:", "- 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.", + "- 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)." ], @@ -7775,33 +7775,108 @@ ], "eventsFunctions": [ { - "description": "Check if the events are running for the editor.", - "fullName": "Editor is running", + "description": "Check if a button is pressed on a gamepad.", + "fullName": "Multitouch controller button pressed", "functionType": "Condition", - "name": "IsInGameEdition", - "private": true, - "sentence": "Events are running for the editor", + "name": "IsButtonPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", "events": [ { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "const game = runtimeScene.getGame();\r", - "eventsFunctionContext.returnValue = game.isInGameEdition && game.isInGameEdition();" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"Pressed\"" + ] + } ], - "parameterObjects": "", - "useStrict": true, - "eventsSheetExpanded": false + "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" } ], - "parameters": [], "objectGroups": [] }, { - "fullName": "Accelerated speed", - "functionType": "Expression", - "name": "AcceleratedSpeed", + "description": "Check if a button is released on a gamepad.", + "fullName": "Multitouch controller button released", + "functionType": "Condition", + "name": "IsButtonReleased", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is released", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"Released\"" + ] + } + ], + "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": "Change a button state for a multitouch controller.", + "fullName": "Button state", + "functionType": "Action", + "name": "SetButtonState", "private": true, - "sentence": "", + "sentence": "Mark _PARAM2_ button as _PARAM3_ for multitouch controller _PARAM1_", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -7809,443 +7884,108 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SetStringVariable" }, "parameters": [ - "AcceleratedSpeed", + "Controllers[ControllerIdentifier].Buttons[Button].State", "=", - "CurrentSpeed" + "ButtonState" ] } - ], - "events": [ + ] + } + ], + "parameters": [ + { + "description": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier", + "type": "expression" + }, + { + "description": "Button name", + "name": "Button", + "type": "string" + }, + { + "description": "Button state", + "name": "ButtonState", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "type": "stringWithSelector" + } + ], + "objectGroups": [] + }, + { + "description": "Change the dead zone radius of a joystick. 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).", + "fullName": "Dead zone radius", + "functionType": "Action", + "name": "SetDeadZone", + "private": true, + "sentence": "Change the dead zone of multitouch joystick _PARAM2_ of multitouch controller _PARAM1_ to _PARAM3_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ { - "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", - "=", - "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": { + "value": "SetNumberVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].DeadZone", + "=", + "DeadZoneRadius" ] - }, - { - "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": "NumberVariable" - }, - "parameters": [ - "TargetedSpeed", - "=", - "0" - ] - } - ], - "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", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "clamp(AcceleratedSpeed, -SpeedMax, SpeedMax)" - ] - } - ] - } - ], - "variables": [ - { - "name": "AcceleratedSpeed", - "type": "number", - "value": 0 } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { - "description": "Current speed", - "name": "CurrentSpeed", - "type": "expression" - }, - { - "description": "Targeted speed", - "name": "TargetedSpeed", - "type": "expression" - }, - { - "description": "Max speed", - "name": "SpeedMax", + "description": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier", "type": "expression" }, { - "description": "Acceleration", - "name": "Acceleration", - "type": "expression" + "description": "Joystick name", + "name": "JoystickIdentifier", + "type": "string" }, { - "description": "Deceleration", - "name": "Deceleration", + "description": "Dead zone radius", + "name": "DeadZoneRadius", + "supplementaryInformation": "[]", "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", + "description": "Return the dead zone radius of a joystick. 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).", + "fullName": "Dead zone radius", + "functionType": "Expression", + "name": "DeadZone", + "private": true, + "sentence": "Change multitouch joystick _PARAM2_ of multitouch controller _PARAM1_ dead zone to _PARAM3_", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Buttons[Button].State", - "=", - "\"JustPressed\"" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "SetReturnBoolean" + "value": "SetReturnNumber" }, "parameters": [ - "True" + "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].DeadZone" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Multitouch controller identifier (1, 2, 3, 4...)", @@ -8253,276 +7993,31 @@ "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\"]", + "description": "Joystick name", + "name": "JoystickIdentifier", "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", + "description": "the direction index (left = 1, bottom = 1, right = 2, top = 3) for an angle (in degrees).", + "fullName": "Angle to 4-way index", + "functionType": "ExpressionAndCondition", + "name": "AngleTo4Way", + "private": true, + "sentence": "The angle _PARAM1_ 4-way index", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "conditions": [], + "actions": [ { "type": { - "value": "BuiltinCommonInstructions::Or" + "value": "SetReturnNumber" }, - "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", - "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is released", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Buttons[Button].State", - "=", - "\"Released\"" - ] - } - ], - "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": "Change a button state for a multitouch controller.", - "fullName": "Button state", - "functionType": "Action", - "name": "SetButtonState", - "private": true, - "sentence": "Mark _PARAM2_ button as _PARAM3_ for multitouch controller _PARAM1_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetStringVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Buttons[Button].State", - "=", - "ButtonState" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" - }, - { - "description": "Button name", - "name": "Button", - "type": "string" - }, - { - "description": "Button state", - "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"JustPressed\",\"Released\"]", - "type": "stringWithSelector" - } - ], - "objectGroups": [] - }, - { - "description": "Change the dead zone radius of a joystick. 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).", - "fullName": "Dead zone radius", - "functionType": "Action", - "name": "SetDeadZone", - "private": true, - "sentence": "Change the dead zone of multitouch joystick _PARAM2_ of multitouch controller _PARAM1_ to _PARAM3_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].DeadZone", - "=", - "DeadZoneRadius" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" - }, - { - "description": "Joystick name", - "name": "JoystickIdentifier", - "type": "string" - }, - { - "description": "Dead zone radius", - "name": "DeadZoneRadius", - "supplementaryInformation": "[]", - "type": "expression" - } - ], - "objectGroups": [] - }, - { - "description": "Return the dead zone radius of a joystick. 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).", - "fullName": "Dead zone radius", - "functionType": "Expression", - "name": "DeadZone", - "private": true, - "sentence": "Change multitouch joystick _PARAM2_ of multitouch controller _PARAM1_ dead zone to _PARAM3_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].DeadZone" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" - }, - { - "description": "Joystick name", - "name": "JoystickIdentifier", - "type": "string" - } - ], - "objectGroups": [] - }, - { - "description": "the direction index (left = 1, bottom = 1, right = 2, top = 3) for an angle (in degrees).", - "fullName": "Angle to 4-way index", - "functionType": "ExpressionAndCondition", - "name": "AngleTo4Way", - "private": true, - "sentence": "The angle _PARAM1_ 4-way index", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "mod(round(Angle * 4 / 360), 4)" + "parameters": [ + "mod(round(Angle * 4 / 360), 4)" ] } ] @@ -9264,11 +8759,6 @@ "name": "JoystickIdentifier", "supplementaryInformation": "[\"Primary\",\"Secondary\"]", "type": "stringWithSelector" - }, - { - "description": "", - "name": "Coucou", - "type": "expression" } ], "objectGroups": [] @@ -9498,7 +8988,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "XFromAngleAndDistance(SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier), SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier))" + "SpriteMultitouchJoystick::JoystickForce(ControllerIdentifier, JoystickIdentifier) * cos(ToRad(SpriteMultitouchJoystick::JoystickAngle(ControllerIdentifier, JoystickIdentifier)))" ] } ] @@ -9538,7 +9028,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "YFromAngleAndDistance(SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier), SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier))" + "SpriteMultitouchJoystick::JoystickForce(ControllerIdentifier, JoystickIdentifier) * sin(ToRad(SpriteMultitouchJoystick::JoystickAngle(ControllerIdentifier, JoystickIdentifier)))" ] } ] @@ -9561,126 +9051,9 @@ } ], "objectGroups": [] - }, - { - "description": "Check if a new touch has started on the right or left side of the screen.", - "fullName": "New touch on a screen side", - "functionType": "Condition", - "group": "Multitouch Joystick", - "name": "HasTouchStartedOnScreenSide", - "sentence": "A new touch has started on the _PARAM2_ side of the screen on _PARAM1_'s layer", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "HasAnyTouchOrMouseStarted" - }, - "parameters": [ - "" - ] - } - ], - "actions": [], - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "Side", - "=", - "\"Left\"" - ] - }, - { - "type": { - "value": "TouchX" - }, - "parameters": [ - "", - "StartedTouchOrMouseId(0)", - "<", - "CameraCenterX(Object.Layer())", - "Object.Layer()", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "Side", - "=", - "\"Right\"" - ] - }, - { - "type": { - "value": "TouchX" - }, - "parameters": [ - "", - "StartedTouchOrMouseId(0)", - ">=", - "CameraCenterX(Object.Layer())", - "Object.Layer()", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - } - ] - } - ], - "parameters": [ - { - "description": "Multitouch joystick", - "name": "Object", - "supplementaryInformation": "SpriteMultitouchJoystick::SpriteMultitouchJoystick", - "type": "objectList" - }, - { - "description": "Screen side", - "name": "Side", - "supplementaryInformation": "[\"Left\",\"Right\"]", - "type": "stringWithSelector" - } - ], - "objectGroups": [] - } - ], - "eventsBasedBehaviors": [ + } + ], + "eventsBasedBehaviors": [ { "description": "Joystick that can be controlled by interacting with a touchscreen.", "fullName": "Multitouch Joystick", @@ -9688,1905 +9061,74 @@ "objectType": "", "private": true, "eventsFunctions": [ - { - "fullName": "", - "functionType": "Action", - "name": "onCreated", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::SetDeadZone" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "DeadZoneRadius", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "Action", - "name": "onDeActivate", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "Action", - "name": "doStepPreEvents", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "inverted": true, - "value": "SpriteMultitouchJoystick::IsInGameEdition" - }, - "parameters": [ - "", - "" - ] - } - ], - "actions": [], - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "HasGameJustResumed" - }, - "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)" - }, - { - "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": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "the joystick force (from 0 to 1).", - "fullName": "Joystick force", - "functionType": "ExpressionAndCondition", - "name": "JoystickForce", - "sentence": "the joystick force", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "max(0, JoystickForce - DeadZoneRadius) / (1 - DeadZoneRadius)" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "JoystickForce", - "name": "SetJoystickForce", - "private": true, - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "JoystickForce", - "=", - "Value" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::SetJoystickForce" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "JoystickForce", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - }, - { - "description": "", - "name": "Parameter", - "type": "objectList" - } - ], - "objectGroups": [] - }, - { - "description": "Return the angle the joystick is pointing towards (Range: -180 to 180).", - "fullName": "Joystick angle", - "functionType": "Expression", - "name": "JoystickAngle", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "JoystickAngle" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "Change the angle the joystick is pointing towards (Range: -180 to 180).", - "fullName": "Joystick angle", - "functionType": "Action", - "name": "SetJoystickAngle", - "private": true, - "sentence": "Change the joystick angle of _PARAM0_ to _PARAM2_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "JoystickAngle", - "=", - "Value" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::SetJoystickAngle" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "JoystickAngle", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - }, - { - "description": "Angle", - "name": "Value", - "type": "expression" - } - ], - "objectGroups": [] - }, - { - "description": "Return the stick force on X axis (from -1 at the left to 1 at the right).", - "fullName": "Stick X force", - "functionType": "Expression", - "name": "StickForceX", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "Object.Behavior::JoystickForce() * cos(ToRad(Object.Behavior::JoystickAngle()))" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "Return the stick force on Y axis (from -1 at the top to 1 at the bottom).", - "fullName": "Stick Y force", - "functionType": "Expression", - "name": "StickForceY", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "Object.Behavior::JoystickForce() * sin(ToRad(Object.Behavior::JoystickAngle()))" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "Check if joystick is pushed in a given direction.", - "fullName": "Joystick pushed in a direction (4-way movement)", - "functionType": "Condition", - "name": "IsDirectionPushed4Way", - "sentence": "_PARAM0_ is pushed in direction _PARAM2_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::JoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - ">", - "0", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::IsAngleIn4WayDirection" - }, - "parameters": [ - "", - "JoystickAngle", - "Direction", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - }, - { - "description": "Direction", - "name": "Direction", - "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\"]", - "type": "stringWithSelector" - } - ], - "objectGroups": [] - }, - { - "description": "Check if joystick is pushed in a given direction.", - "fullName": "Joystick pushed in a direction (8-way movement)", - "functionType": "Condition", - "name": "IsDirectionPushed8Way", - "sentence": "_PARAM0_ is pushed in direction _PARAM2_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::JoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - ">", - "0", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::IsAngleIn8WayDirection" - }, - "parameters": [ - "", - "JoystickAngle", - "Direction", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - }, - { - "description": "Direction", - "name": "Direction", - "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\",\"UpLeft\",\"UpRight\",\"DownLeft\",\"DownRight\"]", - "type": "stringWithSelector" - } - ], - "objectGroups": [] - }, - { - "description": "Check if a joystick is pressed.", - "fullName": "Joystick pressed", - "functionType": "Condition", - "name": "IsPressed", - "sentence": "Joystick _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::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "Reset the joystick values (except for angle, which stays the same)", - "fullName": "Reset", - "functionType": "Action", - "name": "Reset", - "private": true, - "sentence": "Reset the joystick of _PARAM0_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "0", - "" - ] - }, - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "0" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "the multitouch controller identifier.", - "fullName": "Multitouch controller identifier", - "functionType": "ExpressionAndCondition", - "group": "Multitouch Joystick configuration", - "name": "ControllerIdentifier", - "sentence": "the multitouch controller identifier", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "ControllerIdentifier" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "ControllerIdentifier", - "name": "SetControllerIdentifier", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "ControllerIdentifier", - "=", - "Value" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "the joystick name.", - "fullName": "Joystick name", - "functionType": "ExpressionAndCondition", - "group": "Multitouch Joystick configuration", - "name": "JoystickIdentifier", - "sentence": "the joystick name", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnString" - }, - "parameters": [ - "JoystickIdentifier" - ] - } - ] - } - ], - "expressionType": { - "type": "string" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "JoystickIdentifier", - "name": "SetJoystickIdentifier", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetStringVariable" - }, - "parameters": [ - "JoystickIdentifier", - "=", - "Value" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "the dead zone radius (range: 0 to 1) of the joystick. 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).", - "fullName": "Dead zone radius", - "functionType": "ExpressionAndCondition", - "group": "Multitouch Joystick configuration", - "name": "DeadZoneRadius", - "sentence": "the dead zone radius", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "DeadZoneRadius" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "DeadZoneRadius", - "name": "SetDeadZoneRadius", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "DeadZoneRadius", - "=", - "Value" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::SetDeadZone" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "Value", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "Force the joystick into the pressing state.", - "fullName": "Force start pressing", - "functionType": "Action", - "name": "ForceStartPressing", - "sentence": "Force start pressing _PARAM0_ with touch identifier: _PARAM2_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "Value" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - }, - { - "description": "Touch identifier", - "name": "Value", - "type": "expression" - } - ], - "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "1", - "type": "Number", - "label": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier" - }, - { - "value": "Primary", - "type": "String", - "label": "Joystick name", - "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": "0", - "type": "Number", - "label": "Joystick angle (range: -180 to 180)", - "hidden": true, - "name": "JoystickAngle" - }, - { - "value": "0", - "type": "Number", - "label": "Joystick force (range: 0 to 1)", - "hidden": true, - "name": "JoystickForce" - }, - { - "value": "0", - "type": "Number", - "label": "", - "hidden": true, - "name": "TouchId" - }, - { - "value": "", - "type": "Number", - "label": "", - "hidden": true, - "name": "TouchIndex" - } - ], - "sharedPropertyDescriptors": [] - }, - { - "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": "", - "eventsFunctions": [ - { - "fullName": "", - "functionType": "Action", - "name": "doStepPreEvents", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "IsReleased", - "True", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsReleased", - "False", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" - }, - "parameters": [ - "Object", - "Behavior", - "\"Idle\"", - "" - ] - } - ] - }, - { - "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": [ - { - "type": { - "inverted": true, - "value": "SpriteMultitouchJoystick::MultitouchButton::IsPressed" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - }, - { - "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": "BuiltinCommonInstructions::Or" - }, - "parameters": [], - "subInstructions": [ - { - "type": { - "value": "CollisionPoint" - }, - "parameters": [ - "Object", - "TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer())", - "TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer())" - ] - }, - { - "type": { - "value": "NumberVariable" - }, - "parameters": [ - "Radius", - ">", - "DistanceBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer()), TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer()))" - ] - } - ] - } - ], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "StartedTouchOrMouseId(TouchIndex)" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" - }, - "parameters": [ - "Object", - "Behavior", - "\"JustPressed\"", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "True", - "" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchIndex", - "+", - "1" - ] - } - ] - } - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::IsPressed" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - }, - { - "type": { - "value": "HasTouchEnded" - }, - "parameters": [ - "", - "TouchId" - ] - } - ], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" - }, - "parameters": [ - "Object", - "Behavior", - "\"Released\"", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsReleased", - "True", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "False", - "" - ] - }, - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "0" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "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", - "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", - "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": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", - "type": "behavior" - }, - { - "description": "Button state", - "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"JustPressed\",\"Pressed\",\"Released\"]", - "type": "stringWithSelector" - } - ], - "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "1", - "type": "Number", - "label": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier" - }, - { - "value": "A", - "type": "String", - "label": "Button identifier", - "name": "ButtonIdentifier" - }, - { - "value": "0", - "type": "Number", - "label": "TouchID", - "hidden": true, - "name": "TouchId" - }, - { - "value": "", - "type": "Number", - "label": "", - "hidden": true, - "name": "TouchIndex" - }, - { - "value": "", - "type": "Boolean", - "label": "Button released", - "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.", - "name": "Radius" - } - ], - "sharedPropertyDescriptors": [] - }, - { - "description": "Control a platformer character with a multitouch controller.", - "fullName": "Platformer multitouch controller mapper", - "name": "PlatformerMultitouchMapper", - "objectType": "", - "quickCustomizationVisibility": "hidden", - "eventsFunctions": [ - { - "fullName": "", - "functionType": "Action", - "name": "doStepPreEvents", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "\"Left\"", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateLeftKey" - }, - "parameters": [ - "Object", - "Property" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "\"Right\"", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateRightKey" - }, - "parameters": [ - "Object", - "Property" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "\"Up\"", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateUpKey" - }, - "parameters": [ - "Object", - "Property" - ] - }, - { - "type": { - "value": "PlatformBehavior::SimulateLadderKey" - }, - "parameters": [ - "Object", - "Property" - ] - } - ] - }, + { + "fullName": "", + "functionType": "Action", + "name": "onCreated", + "sentence": "", + "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "conditions": [], + "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" + "value": "SpriteMultitouchJoystick::SetDeadZone" }, "parameters": [ "", "ControllerIdentifier", "JoystickIdentifier", - "\"Down\"", + "DeadZoneRadius", "" ] - } - ], - "actions": [ + }, { "type": { - "value": "PlatformBehavior::SimulateDownKey" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" }, "parameters": [ "Object", - "Property" + "Behavior", + "" ] } ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "Action", + "name": "onDeActivate", + "sentence": "", + "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::IsButtonPressed" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JumpButton", - "\"Down\"" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "PlatformBehavior::SimulateJumpKey" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" }, "parameters": [ "Object", - "Property" + "Behavior", + "" ] } ] @@ -11601,64 +9143,12 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::PlatformerMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "", - "type": "Behavior", - "label": "Platform character behavior", - "extraInformation": [ - "PlatformBehavior::PlatformerObjectBehavior" - ], - "choices": [], - "name": "Property" - }, - { - "value": "1", - "type": "Number", - "label": "Controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier" - }, - { - "value": "Primary", - "type": "Choice", - "label": "Joystick name", - "group": "Controls", - "choices": [ - { - "label": "Primary", - "value": "Primary" - }, - { - "label": "Secondary", - "value": "Secondary" - } - ], - "name": "JoystickIdentifier" }, - { - "value": "A", - "type": "String", - "label": "Jump button name", - "group": "Controls", - "name": "JumpButton" - } - ], - "sharedPropertyDescriptors": [] - }, - { - "description": "Control a 3D physics character with a multitouch controller.", - "fullName": "3D platformer multitouch controller mapper", - "name": "Platformer3DMultitouchMapper", - "objectType": "", - "quickCustomizationVisibility": "hidden", - "eventsFunctions": [ { "fullName": "", "functionType": "Action", @@ -11670,14 +9160,9 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::StickForce" + "value": "HasGameJustResumed" }, "parameters": [ - "", - ">", - "0", - "ControllerIdentifier", - "JoystickIdentifier", "" ] } @@ -11685,54 +9170,210 @@ "actions": [ { "type": { - "value": "Physics3D::PhysicsCharacter3D::SetForwardAngle" - }, - "parameters": [ - "Object", - "PhysicsCharacter3D", - "=", - "SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier) + CameraAngle(Object.Layer())" - ] - }, - { - "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateStick" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" }, "parameters": [ "Object", - "PhysicsCharacter3D", - "-90", - "SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier)" + "Behavior", + "" ] } ] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Manage touches", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::IsButtonPressed" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "HasAnyTouchOrMouseStarted" + }, + "parameters": [ + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyTouchIndex" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "0" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "StartedTouchOrMouseCount()", + "conditions": [], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::PropertyTouchId" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "0" + ] + }, + { + "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::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 }, - "parameters": [ - "", - "ControllerIdentifier", - "JumpButton", - "\"Down\"" + "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" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } ] } ], - "actions": [ + "parameters": [] + }, + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Update joystick position", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ { - "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" - }, - "parameters": [ - "Object", - "PhysicsCharacter3D" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::PropertyTouchId" + }, + "parameters": [ + "Object", + "Behavior", + "!=", + "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": [ @@ -11744,129 +9385,37 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::Platformer3DMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "", - "type": "Behavior", - "label": "3D physics character", - "extraInformation": [ - "Physics3D::PhysicsCharacter3D" - ], - "choices": [], - "name": "PhysicsCharacter3D" - }, - { - "value": "1", - "type": "Number", - "label": "Controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier" - }, - { - "value": "Primary", - "type": "Choice", - "label": "Walk joystick", - "group": "Controls", - "choices": [ - { - "label": "Primary", - "value": "Primary" - }, - { - "label": "Secondary", - "value": "Secondary" - } - ], - "name": "JoystickIdentifier" }, { - "value": "A", - "type": "String", - "label": "Jump button name", - "group": "Controls", - "name": "JumpButton" - } - ], - "sharedPropertyDescriptors": [] - }, - { - "description": "Control a 3D physics character with a multitouch controller.", - "fullName": "3D shooter multitouch controller mapper", - "name": "Shooter3DMultitouchMapper", - "objectType": "", - "quickCustomizationVisibility": "hidden", - "eventsFunctions": [ - { - "fullName": "", - "functionType": "Action", - "name": "doStepPreEvents", - "sentence": "", + "description": "the joystick force (from 0 to 1).", + "fullName": "Joystick force", + "functionType": "ExpressionAndCondition", + "name": "JoystickForce", + "sentence": "the joystick force", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::StickForce" - }, - "parameters": [ - "", - ">", - "0", - "ControllerIdentifier", - "JoystickIdentifier", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateStick" - }, - "parameters": [ - "Object", - "PhysicsCharacter3D", - "SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier)", - "SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier)" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::IsButtonPressed" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JumpButton", - "\"Down\"" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" + "value": "SetReturnNumber" }, "parameters": [ - "Object", - "PhysicsCharacter3D" + "max(0, JoystickForce - DeadZoneRadius) / (1 - DeadZoneRadius)" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -11876,151 +9425,90 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::Shooter3DMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "", - "type": "Behavior", - "label": "3D physics character", - "extraInformation": [ - "Physics3D::PhysicsCharacter3D" - ], - "choices": [], - "name": "PhysicsCharacter3D" - }, - { - "value": "1", - "type": "Number", - "label": "Controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier" - }, - { - "value": "Primary", - "type": "Choice", - "label": "Walk joystick", - "group": "Controls", - "choices": [ - { - "label": "Primary", - "value": "Primary" - }, - { - "label": "Secondary", - "value": "Secondary" - } - ], - "name": "JoystickIdentifier" }, - { - "value": "A", - "type": "String", - "label": "Jump button name", - "group": "Controls", - "name": "JumpButton" - } - ], - "sharedPropertyDescriptors": [] - }, - { - "description": "Control camera rotations with a multitouch controller.", - "fullName": "First person camera multitouch controller mapper", - "name": "FirstPersonMultitouchMapper", - "objectType": "", - "quickCustomizationVisibility": "hidden", - "eventsFunctions": [ { "fullName": "", - "functionType": "Action", - "name": "doStepPreEvents", + "functionType": "ActionWithOperator", + "getterName": "JoystickForce", + "name": "SetJoystickForce", + "private": true, "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", - "=", - "SpriteMultitouchJoystick::AcceleratedSpeed(CurrentRotationSpeedZ, SpriteMultitouchJoystick::StickForceX(ControllerIdentifier, CameraStick) * HorizontalRotationSpeedMax, HorizontalRotationSpeedMax, HorizontalRotationAcceleration, HorizontalRotationDeceleration)" - ] - }, - { - "type": { - "value": "SetAngle" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickForce" }, "parameters": [ "Object", - "+", - "CurrentRotationSpeedZ * TimeDelta()" - ] - }, - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "CurrentRotationSpeedY", + "Behavior", "=", - "SpriteMultitouchJoystick::AcceleratedSpeed(CurrentRotationSpeedY, SpriteMultitouchJoystick::StickForceY(ControllerIdentifier, CameraStick) * VerticalRotationSpeedMax, VerticalRotationSpeedMax, VerticalRotationAcceleration, VerticalRotationDeceleration)" - ] - }, - { - "type": { - "value": "Scene3D::Base3DBehavior::SetRotationY" - }, - "parameters": [ - "Object", - "Object3D", - "+", - "CurrentRotationSpeedY * TimeDelta()" + "Value" ] }, { "type": { - "value": "Scene3D::Base3DBehavior::SetRotationY" + "value": "SpriteMultitouchJoystick::SetJoystickForce" }, "parameters": [ - "Object", - "Object3D", - "=", - "clamp(Object.Object3D::RotationY(), VerticalAngleMin, VerticalAngleMax)" + "", + "ControllerIdentifier", + "JoystickIdentifier", + "JoystickForce", + "" ] - }, + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Return the angle the joystick is pointing towards (Range: -180 to 180).", + "fullName": "Joystick angle", + "functionType": "Expression", + "name": "JoystickAngle", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper::LookFromObjectEyes" + "value": "SetReturnNumber" }, "parameters": [ - "Object", - "Behavior", - "" + "JoystickAngle" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -12030,20 +9518,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "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", + "description": "Change the angle the joystick is pointing towards (Range: -180 to 180).", + "fullName": "Joystick angle", "functionType": "Action", - "group": "Layers and cameras", - "name": "LookFromObjectEyes", + "name": "SetJoystickAngle", "private": true, - "sentence": "Move the camera to look though _PARAM0_ eyes", + "sentence": "Change the joystick angle of _PARAM0_ to _PARAM2_", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -12051,61 +9538,24 @@ "actions": [ { "type": { - "value": "CentreCamera" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickAngle" }, "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": [ - "", + "Behavior", "=", - "Object.Object3D::RotationX()", - "GetArgumentAsString(\"Layer\")", - "" + "Value" ] }, { "type": { - "value": "SetCameraAngle" + "value": "SpriteMultitouchJoystick::SetJoystickAngle" }, "parameters": [ "", - "=", - "Object.Angle() + 90", - "Object.Layer()", + "ControllerIdentifier", + "JoystickIdentifier", + "JoystickAngle", "" ] } @@ -12121,19 +9571,23 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" + }, + { + "description": "Angle", + "name": "Value", + "type": "expression" } ], "objectGroups": [] }, { - "description": "the maximum horizontal rotation speed of the object.", - "fullName": "Maximum horizontal rotation speed", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper horizontal rotation configuration", - "name": "HorizontalRotationSpeedMax", - "sentence": "the maximum horizontal rotation speed", + "description": "Return the stick force on X axis (from -1 at the left to 1 at the right).", + "fullName": "Stick X force", + "functionType": "Expression", + "name": "StickForceX", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -12144,7 +9598,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "HorizontalRotationSpeedMax" + "Object.Behavior::JoystickForce() * cos(ToRad(Object.Behavior::JoystickAngle()))" ] } ] @@ -12162,17 +9616,17 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] }, { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "HorizontalRotationSpeedMax", - "name": "SetHorizontalRotationSpeedMax", + "description": "Return the stick force on Y axis (from -1 at the top to 1 at the bottom).", + "fullName": "Stick Y force", + "functionType": "Expression", + "name": "StickForceY", "sentence": "", "events": [ { @@ -12181,17 +9635,18 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SetReturnNumber" }, "parameters": [ - "HorizontalRotationSpeedMax", - "=", - "Value" + "Object.Behavior::JoystickForce() * sin(ToRad(Object.Behavior::JoystickAngle()))" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -12201,38 +9656,58 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the horizontal rotation acceleration of the object.", - "fullName": "Horizontal rotation acceleration", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper horizontal rotation configuration", - "name": "HorizontalRotationAcceleration", - "sentence": "the horizontal rotation acceleration", + "description": "Check if joystick is pushed in a given direction.", + "fullName": "Joystick pushed in a direction (4-way movement)", + "functionType": "Condition", + "name": "IsDirectionPushed4Way", + "sentence": "_PARAM0_ is pushed in direction _PARAM2_", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::JoystickForce" + }, + "parameters": [ + "Object", + "Behavior", + ">", + "0", + "" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::IsAngleIn4WayDirection" + }, + "parameters": [ + "", + "JoystickAngle", + "Direction", + "" + ] + } + ], "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "SetReturnBoolean" }, "parameters": [ - "HorizontalRotationAcceleration" + "True" ] } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -12242,31 +9717,59 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" + }, + { + "description": "Direction", + "name": "Direction", + "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\"]", + "type": "stringWithSelector" } ], "objectGroups": [] }, { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "HorizontalRotationAcceleration", - "name": "SetHorizontalRotationAcceleration", - "sentence": "", + "description": "Check if joystick is pushed in a given direction.", + "fullName": "Joystick pushed in a direction (8-way movement)", + "functionType": "Condition", + "name": "IsDirectionPushed8Way", + "sentence": "_PARAM0_ is pushed in direction _PARAM2_", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::JoystickForce" + }, + "parameters": [ + "Object", + "Behavior", + ">", + "0", + "" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::IsAngleIn8WayDirection" + }, + "parameters": [ + "", + "JoystickAngle", + "Direction", + "" + ] + } + ], "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SetReturnBoolean" }, "parameters": [ - "HorizontalRotationAcceleration", - "=", - "Value" + "True" ] } ] @@ -12281,38 +9784,52 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" + }, + { + "description": "Direction", + "name": "Direction", + "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\",\"UpLeft\",\"UpRight\",\"DownLeft\",\"DownRight\"]", + "type": "stringWithSelector" } ], "objectGroups": [] }, { - "description": "the horizontal rotation deceleration of the object.", - "fullName": "Horizontal rotation deceleration", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper horizontal rotation configuration", - "name": "HorizontalRotationDeceleration", - "sentence": "the horizontal rotation deceleration", + "description": "Check if a joystick is pressed.", + "fullName": "Joystick pressed", + "functionType": "Condition", + "name": "IsPressed", + "sentence": "Joystick _PARAM0_ is pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::PropertyTouchId" + }, + "parameters": [ + "Object", + "Behavior", + "!=", + "0" + ] + } + ], "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "SetReturnBoolean" }, "parameters": [ - "HorizontalRotationDeceleration" + "True" ] } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -12322,18 +9839,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] }, { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "HorizontalRotationDeceleration", - "name": "SetHorizontalRotationDeceleration", - "sentence": "", + "description": "Reset the joystick values (except for angle, which stays the same)", + "fullName": "Reset", + "functionType": "Action", + "name": "Reset", + "private": true, + "sentence": "Reset the joystick of _PARAM0_", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -12341,12 +9859,25 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" }, "parameters": [ - "HorizontalRotationDeceleration", + "Object", + "Behavior", "=", - "Value" + "0", + "" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyTouchId" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "0" ] } ] @@ -12361,19 +9892,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the maximum vertical rotation speed of the object.", - "fullName": "Maximum vertical rotation speed", + "description": "the multitouch controller identifier.", + "fullName": "Multitouch controller identifier", "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper vertical rotation configuration", - "name": "VerticalRotationSpeedMax", - "sentence": "the maximum vertical rotation speed", + "group": "Multitouch Joystick configuration", + "name": "ControllerIdentifier", + "sentence": "the multitouch controller identifier", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -12384,7 +9915,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "VerticalRotationSpeedMax" + "ControllerIdentifier" ] } ] @@ -12402,7 +9933,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], @@ -12411,8 +9942,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "VerticalRotationSpeedMax", - "name": "SetVerticalRotationSpeedMax", + "getterName": "ControllerIdentifier", + "name": "SetControllerIdentifier", "sentence": "", "events": [ { @@ -12421,10 +9952,11 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyControllerIdentifier" }, "parameters": [ - "VerticalRotationSpeedMax", + "Object", + "Behavior", "=", "Value" ] @@ -12441,19 +9973,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the vertical rotation acceleration of the object.", - "fullName": "Vertical rotation acceleration", + "description": "the joystick name.", + "fullName": "Joystick name", "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper vertical rotation configuration", - "name": "VerticalRotationAcceleration", - "sentence": "the vertical rotation acceleration", + "group": "Multitouch Joystick configuration", + "name": "JoystickIdentifier", + "sentence": "the joystick name", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -12461,17 +9993,17 @@ "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "SetReturnString" }, "parameters": [ - "VerticalRotationAcceleration" + "JoystickIdentifier" ] } ] } ], "expressionType": { - "type": "expression" + "type": "string" }, "parameters": [ { @@ -12482,7 +10014,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], @@ -12491,8 +10023,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "VerticalRotationAcceleration", - "name": "SetVerticalRotationAcceleration", + "getterName": "JoystickIdentifier", + "name": "SetJoystickIdentifier", "sentence": "", "events": [ { @@ -12501,10 +10033,11 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickIdentifier" }, "parameters": [ - "VerticalRotationAcceleration", + "Object", + "Behavior", "=", "Value" ] @@ -12521,19 +10054,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the vertical rotation deceleration of the object.", - "fullName": "Vertical rotation deceleration", + "description": "the dead zone radius (range: 0 to 1) of the joystick. 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).", + "fullName": "Dead zone radius", "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper vertical rotation configuration", - "name": "VerticalRotationDeceleration", - "sentence": "the vertical rotation deceleration", + "group": "Multitouch Joystick configuration", + "name": "DeadZoneRadius", + "sentence": "the dead zone radius", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -12544,7 +10077,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "VerticalRotationDeceleration" + "DeadZoneRadius" ] } ] @@ -12562,7 +10095,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], @@ -12571,8 +10104,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "VerticalRotationDeceleration", - "name": "SetVerticalRotationDeceleration", + "getterName": "DeadZoneRadius", + "name": "SetDeadZoneRadius", "sentence": "", "events": [ { @@ -12581,10 +10114,11 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyDeadZoneRadius" }, "parameters": [ - "VerticalRotationDeceleration", + "Object", + "Behavior", "=", "Value" ] @@ -12601,72 +10135,271 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] + } + ], + "propertyDescriptors": [ + { + "value": "1", + "type": "Number", + "label": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier" }, { - "description": "the minimum vertical camera angle of the object.", - "fullName": "Minimum vertical camera angle", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper vertical rotation configuration", - "name": "VerticalAngleMin", - "sentence": "the minimum vertical camera angle", + "value": "Primary", + "type": "String", + "label": "Joystick name", + "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": "0", + "type": "Number", + "label": "Joystick angle (range: -180 to 180)", + "hidden": true, + "name": "JoystickAngle" + }, + { + "value": "0", + "type": "Number", + "label": "Joystick force (range: 0 to 1)", + "hidden": true, + "name": "JoystickForce" + }, + { + "value": "0", + "type": "Number", + "label": "", + "hidden": true, + "name": "TouchId" + }, + { + "value": "", + "type": "Number", + "label": "", + "hidden": true, + "name": "TouchIndex" + } + ], + "sharedPropertyDescriptors": [] + }, + { + "description": "Detect button presses made on a touchscreen.", + "fullName": "Multitouch button", + "name": "MultitouchButton", + "objectType": "", + "eventsFunctions": [ + { + "fullName": "", + "functionType": "Action", + "name": "doStepPreEvents", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::IsReleased" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } + ], "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyIsReleased" + }, + "parameters": [ + "Object", + "Behavior", + "no" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" }, "parameters": [ - "VerticalAngleMin" + "Object", + "Behavior", + "\"Idle\"", + "" ] } ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" }, { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "VerticalAngleMin", - "name": "SetVerticalAngleMin", - "sentence": "", - "events": [ + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "SpriteMultitouchJoystick::MultitouchButton::IsPressed" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + }, + { + "type": { + "value": "HasAnyTouchOrMouseStarted" + }, + "parameters": [ + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchIndex" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "0" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "StartedTouchOrMouseCount()", + "conditions": [], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "CollisionPoint" + }, + "parameters": [ + "Object", + "TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)", + "TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchId" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "StartedTouchOrMouseId(TouchIndex)" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + }, + "parameters": [ + "Object", + "Behavior", + "\"Pressed\"", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchIndex" + }, + "parameters": [ + "Object", + "Behavior", + "+", + "1" + ] + } + ] + } + ] + } + ] + }, { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::IsPressed" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + }, + { + "type": { + "value": "HasTouchEnded" + }, + "parameters": [ + "", + "TouchId" + ] + } + ], "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + }, + "parameters": [ + "Object", + "Behavior", + "\"Released\"", + "" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyIsReleased" + }, + "parameters": [ + "Object", + "Behavior", + "yes" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchId" }, "parameters": [ - "VerticalAngleMin", + "Object", + "Behavior", "=", - "Value" + "0" ] } ] @@ -12681,72 +10414,39 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the maximum vertical camera angle of the object.", - "fullName": "Maximum vertical camera angle", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper vertical rotation configuration", - "name": "VerticalAngleMax", - "sentence": "the maximum vertical camera angle", + "description": "Check if button is released.", + "fullName": "Button released", + "functionType": "Condition", + "name": "IsReleased", + "sentence": "Button _PARAM0_ is released", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ + "conditions": [ { "type": { - "value": "SetReturnNumber" + "value": "SpriteMultitouchJoystick::MultitouchButton::PropertyIsReleased" }, "parameters": [ - "VerticalAngleMax" + "Object", + "Behavior" ] } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "VerticalAngleMax", - "name": "SetVerticalAngleMax", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + ], "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SetReturnBoolean" }, "parameters": [ - "VerticalAngleMax", - "=", - "Value" + "True" ] } ] @@ -12761,38 +10461,46 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the z position offset of the object.", - "fullName": "Z position offset", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper position configuration", - "name": "OffsetZ", - "sentence": "the z position offset", + "description": "Check if button is pressed.", + "fullName": "Button pressed", + "functionType": "Condition", + "name": "IsPressed", + "sentence": "Button _PARAM0_ is pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::PropertyTouchId" + }, + "parameters": [ + "Object", + "Behavior", + "!=", + "0" + ] + } + ], "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "SetReturnBoolean" }, "parameters": [ - "OffsetZ" + "True" ] } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -12802,18 +10510,18 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", "type": "behavior" } ], "objectGroups": [] }, { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "OffsetZ", - "name": "SetOffsetZ", - "sentence": "", + "fullName": "Button state", + "functionType": "Action", + "name": "SetButtonState", + "private": true, + "sentence": "Mark the button _PARAM0_ as _PARAM2_", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -12821,12 +10529,14 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::SetButtonState" }, "parameters": [ - "OffsetZ", - "=", - "Value" + "", + "ControllerIdentifier", + "ButtonIdentifier", + "ButtonState", + "" ] } ] @@ -12841,140 +10551,61 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", "type": "behavior" + }, + { + "description": "Button state", + "name": "ButtonState", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "type": "stringWithSelector" } ], "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...)", + "label": "Multitouch 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": "A", + "type": "String", + "label": "Button identifier", + "name": "ButtonIdentifier" }, { "value": "0", "type": "Number", - "unit": "Pixel", - "label": "Z position offset", - "group": "Position", - "name": "OffsetZ" + "label": "TouchID", + "hidden": true, + "name": "TouchId" }, { - "value": "0", + "value": "", "type": "Number", - "unit": "AngularSpeed", - "label": "Current rotation speed Z", + "label": "", "hidden": true, - "name": "CurrentRotationSpeedZ" + "name": "TouchIndex" }, { - "value": "0", - "type": "Number", - "unit": "AngularSpeed", - "label": "Current rotation speed Y", + "value": "", + "type": "Boolean", + "label": "Button released", "hidden": true, - "name": "CurrentRotationSpeedY" + "name": "IsReleased" } ], "sharedPropertyDescriptors": [] }, { - "description": "Control a 3D physics car with a multitouch controller.", - "fullName": "3D car multitouch controller mapper", - "name": "PhysicsCar3DMultitouchMapper", + "description": "Control a platformer character with a multitouch controller.", + "fullName": "Platformer multitouch controller mapper", + "name": "PlatformerMultitouchMapper", "objectType": "", - "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -12987,27 +10618,90 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::StickForce" + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JoystickIdentifier", + "\"Left\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "PlatformBehavior::SimulateLeftKey" + }, + "parameters": [ + "Object", + "Property" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JoystickIdentifier", + "\"Right\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "PlatformBehavior::SimulateRightKey" + }, + "parameters": [ + "Object", + "Property" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" }, "parameters": [ "", - ">", - "0", "ControllerIdentifier", - "SteerJoystickIdentifier", + "JoystickIdentifier", + "\"Up\"", "" ] - } - ], - "actions": [ + } + ], + "actions": [ + { + "type": { + "value": "PlatformBehavior::SimulateUpKey" + }, + "parameters": [ + "Object", + "Property" + ] + }, { "type": { - "value": "Physics3D::PhysicsCar3D::SimulateSteeringStick" + "value": "PlatformBehavior::SimulateLadderKey" }, "parameters": [ "Object", - "PhysicsCar3D", - "SpriteMultitouchJoystick::StickForceX(ControllerIdentifier, \"Primary\")" + "Property" ] } ] @@ -13017,14 +10711,13 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::StickForce" + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" }, "parameters": [ "", - ">", - "0", "ControllerIdentifier", - "SpeedJoystickIdentifier", + "JoystickIdentifier", + "\"Down\"", "" ] } @@ -13032,12 +10725,11 @@ "actions": [ { "type": { - "value": "Physics3D::PhysicsCar3D::SimulateAcceleratorStick" + "value": "PlatformBehavior::SimulateDownKey" }, "parameters": [ "Object", - "PhysicsCar3D", - "-SpriteMultitouchJoystick::StickForceY(ControllerIdentifier, \"Secondary\")" + "Property" ] } ] @@ -13052,7 +10744,7 @@ "parameters": [ "", "ControllerIdentifier", - "HandBrakeButton", + "JumpButton", "\"Down\"" ] } @@ -13060,11 +10752,11 @@ "actions": [ { "type": { - "value": "Physics3D::PhysicsCar3D::SimulateHandBrakeKey" + "value": "PlatformBehavior::SimulateJumpKey" }, "parameters": [ "Object", - "PhysicsCar3D" + "Property" ] } ] @@ -13079,7 +10771,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::PhysicsCar3DMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::PlatformerMultitouchMapper", "type": "behavior" } ], @@ -13090,12 +10782,12 @@ { "value": "", "type": "Behavior", - "label": "3D physics car", + "label": "Platform character behavior", "extraInformation": [ - "Physics3D::PhysicsCar3D" + "PlatformBehavior::PlatformerObjectBehavior" ], "choices": [], - "name": "PhysicsCar3D" + "name": "Property" }, { "value": "1", @@ -13106,24 +10798,7 @@ { "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", + "label": "Joystick name", "group": "Controls", "choices": [ { @@ -13135,14 +10810,14 @@ "value": "Secondary" } ], - "name": "SpeedJoystickIdentifier" + "name": "JoystickIdentifier" }, { - "value": "B", + "value": "A", "type": "String", - "label": "Hand brake button name", + "label": "Jump button name", "group": "Controls", - "name": "HandBrakeButton" + "name": "JumpButton" } ], "sharedPropertyDescriptors": [] @@ -13152,7 +10827,6 @@ "fullName": "Top-down multitouch controller mapper", "name": "TopDownMultitouchMapper", "objectType": "", - "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -13165,10 +10839,11 @@ "conditions": [ { "type": { - "value": "StringVariable" + "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" }, "parameters": [ - "StickMode", + "Object", + "Behavior", "=", "\"Analog\"" ] @@ -13193,10 +10868,11 @@ "conditions": [ { "type": { - "value": "StringVariable" + "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" }, "parameters": [ - "StickMode", + "Object", + "Behavior", "=", "\"360°\"" ] @@ -13221,10 +10897,11 @@ "conditions": [ { "type": { - "value": "StringVariable" + "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" }, "parameters": [ - "StickMode", + "Object", + "Behavior", "=", "\"8 Directions\"" ] @@ -13833,6 +11510,7 @@ } ], "instances": [], + "editionSettings": {}, "eventsFunctions": [ { "fullName": "", @@ -13951,90 +11629,17 @@ "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "conditions": [], + "actions": [ { "type": { - "inverted": true, - "value": "SpriteMultitouchJoystick::IsInGameEdition" + "value": "MettreAutour" }, "parameters": [ - "", - "" - ] - } - ], - "actions": [], - "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" - }, - "parameters": [ - "Object", - "no", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "ShouldBeHiddenWhenReleased", - "False", - "" - ] - } + "Thumb", + "Border", + "Border.MultitouchJoystick::JoystickForce() * Border.Width() / 2", + "Border.MultitouchJoystick::JoystickAngle()" ] } ] @@ -14102,7 +11707,7 @@ "Border", "MultitouchJoystick", "=", - "ControllerIdentifier", + "Object.PropertyControllerIdentifier()", "" ] }, @@ -14114,7 +11719,7 @@ "Border", "MultitouchJoystick", "=", - "JoystickIdentifier", + "Object.PropertyJoystickIdentifier()", "" ] }, @@ -14126,92 +11731,7 @@ "Border", "MultitouchJoystick", "=", - "DeadZoneRadius", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "supplementaryInformation": "SpriteMultitouchJoystick::SpriteMultitouchJoystick", - "type": "object" - } - ], - "objectGroups": [] - }, - { - "description": "Show the joystick until it is released.", - "fullName": "Show and start pressing", - "functionType": "Action", - "name": "TeleportAndPress", - "sentence": "Show _PARAM0_ at the cursor position and start pressing", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "HasAnyTouchOrMouseStarted" - }, - "parameters": [ - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "MettreXY" - }, - "parameters": [ - "Object", - "=", - "Object.ParentTouchX(StartedTouchOrMouseId(0))", - "=", - "Object.ParentTouchY(StartedTouchOrMouseId(0))" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::ActivateControl" - }, - "parameters": [ - "Object", - "yes", - "" - ] - }, - { - "type": { - "value": "Montre" - }, - "parameters": [ - "Object", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "ShouldBeHiddenWhenReleased", - "True", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::ForceStartPressing" - }, - "parameters": [ - "Border", - "MultitouchJoystick", - "StartedTouchOrMouseId(0)", + "Object.PropertyDeadZoneRadius()", "" ] } @@ -14228,92 +11748,6 @@ ], "objectGroups": [] }, - { - "description": "Return the X position of a specified touch", - "fullName": "Touch X position (on parent)", - "functionType": "Expression", - "name": "ParentTouchX", - "private": true, - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [] - }, - { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "const object = objects[0];", - "const touchId = eventsFunctionContext.getArgument(\"TouchId\");", - "eventsFunctionContext.returnValue = gdjs.evtTools.input.getTouchX(object.getInstanceContainer(), touchId, object.getLayer());" - ], - "parameterObjects": "Object", - "useStrict": true, - "eventsSheetExpanded": false - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "supplementaryInformation": "SpriteMultitouchJoystick::SpriteMultitouchJoystick", - "type": "object" - }, - { - "description": "Touch identifier", - "name": "TouchId", - "type": "expression" - } - ], - "objectGroups": [] - }, - { - "description": "Return the X position of a specified touch", - "fullName": "Touch X position (on parent)", - "functionType": "Expression", - "name": "ParentTouchY", - "private": true, - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [] - }, - { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "const object = objects[0];", - "const touchId = eventsFunctionContext.getArgument(\"TouchId\");", - "eventsFunctionContext.returnValue = gdjs.evtTools.input.getTouchY(object.getInstanceContainer(), touchId, object.getLayer());" - ], - "parameterObjects": "Object", - "useStrict": true, - "eventsSheetExpanded": false - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "supplementaryInformation": "SpriteMultitouchJoystick::SpriteMultitouchJoystick", - "type": "object" - }, - { - "description": "Touch identifier", - "name": "TouchId", - "type": "expression" - } - ], - "objectGroups": [] - }, { "description": "De/activate control of the joystick.", "fullName": "De/activate control", @@ -14327,12 +11761,10 @@ { "type": { "inverted": true, - "value": "BooleanVariable" + "value": "GetArgumentAsBoolean" }, "parameters": [ - "ShouldActivate", - "True", - "" + "\"ShouldActivate\"" ] } ], @@ -14354,12 +11786,10 @@ "conditions": [ { "type": { - "value": "BooleanVariable" + "value": "GetArgumentAsBoolean" }, "parameters": [ - "ShouldActivate", - "True", - "" + "\"ShouldActivate\"" ] } ], @@ -15033,15 +12463,9 @@ "description": "Only used by the scene editor.", "hidden": true, "name": "ParentOrigin" - }, - { - "value": "", - "type": "Boolean", - "label": "", - "hidden": true, - "name": "ShouldBeHiddenWhenReleased" } - ] + ], + "variants": [] } ] }, diff --git a/examples/starting-point-and-click-adventure/starting-point-and-click-adventure.json b/examples/starting-point-and-click-adventure/starting-point-and-click-adventure.json index 0137d7a4b..e55402317 100644 --- a/examples/starting-point-and-click-adventure/starting-point-and-click-adventure.json +++ b/examples/starting-point-and-click-adventure/starting-point-and-click-adventure.json @@ -1318,7 +1318,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.9.0", + "version": "1.8.4", "description": [ "Multitouch joysticks are objects showing a joystick on the screen, useful for mobile. They work like a physical gamepad:", "- 4 or 8 directions", @@ -1828,11 +1828,11 @@ "objectGroups": [] }, { - "description": "Check if a button was just pressed on a multitouch controller.", - "fullName": "Multitouch controller button just pressed", + "description": "Check if a button is pressed on a gamepad.", + "fullName": "Multitouch controller button pressed", "functionType": "Condition", - "name": "IsButtonJustPressed", - "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ was just pressed", + "name": "IsButtonPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -1844,7 +1844,7 @@ "parameters": [ "Controllers[ControllerIdentifier].Buttons[Button].State", "=", - "\"JustPressed\"" + "\"Pressed\"" ] } ], @@ -1876,73 +1876,7 @@ "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\"" - ] - } - ] - } - ], - "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.", + "description": "Check if a button is released on a gamepad.", "fullName": "Multitouch controller button released", "functionType": "Condition", "name": "IsButtonReleased", @@ -2028,7 +1962,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"JustPressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -4518,49 +4452,11 @@ "conditions": [ { "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "IsReleased", - "True", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsReleased", - "False", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + "value": "SpriteMultitouchJoystick::MultitouchButton::IsReleased" }, "parameters": [ "Object", "Behavior", - "\"Idle\"", - "" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "True", "" ] } @@ -4571,7 +4467,7 @@ "value": "SetBooleanVariable" }, "parameters": [ - "IsJustPressed", + "IsReleased", "False", "" ] @@ -4583,7 +4479,7 @@ "parameters": [ "Object", "Behavior", - "\"Pressed\"", + "\"Idle\"", "" ] } @@ -4681,17 +4577,7 @@ "parameters": [ "Object", "Behavior", - "\"JustPressed\"", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "True", + "\"Pressed\"", "" ] } @@ -4762,16 +4648,6 @@ "" ] }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "False", - "" - ] - }, { "type": { "value": "SetNumberVariable" @@ -4801,11 +4677,11 @@ "objectGroups": [] }, { - "description": "Check if the button was just pressed.", - "fullName": "Button just pressed", + "description": "Check if button is released.", + "fullName": "Button released", "functionType": "Condition", - "name": "IsJustPressed", - "sentence": "Button _PARAM0_ was just pressed", + "name": "IsReleased", + "sentence": "Button _PARAM0_ is released", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -4815,7 +4691,7 @@ "value": "BooleanVariable" }, "parameters": [ - "IsJustPressed", + "IsReleased", "True", "" ] @@ -4849,7 +4725,7 @@ "objectGroups": [] }, { - "description": "Check if the button is pressed.", + "description": "Check if button is pressed.", "fullName": "Button pressed", "functionType": "Condition", "name": "IsPressed", @@ -4896,54 +4772,6 @@ ], "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", @@ -4985,7 +4813,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"JustPressed\",\"Pressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -5026,13 +4854,6 @@ "hidden": true, "name": "IsReleased" }, - { - "value": "", - "type": "Boolean", - "label": "Button just pressed", - "hidden": true, - "name": "IsJustPressed" - }, { "value": "0", "type": "Number", @@ -7447,6 +7268,7 @@ } ], "instances": [], + "editionSettings": {}, "eventsFunctions": [ { "fullName": "", @@ -8655,7 +8477,8 @@ "hidden": true, "name": "ShouldBeHiddenWhenReleased" } - ] + ], + "variants": [] } ] }, diff --git a/examples/starting-shootemup/starting-shootemup.json b/examples/starting-shootemup/starting-shootemup.json index 1b0feac82..d098f31c0 100644 --- a/examples/starting-shootemup/starting-shootemup.json +++ b/examples/starting-shootemup/starting-shootemup.json @@ -1169,7 +1169,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.9.0", + "version": "1.8.4", "description": [ "Multitouch joysticks are objects showing a joystick on the screen, useful for mobile. They work like a physical gamepad:", "- 4 or 8 directions", @@ -1679,11 +1679,11 @@ "objectGroups": [] }, { - "description": "Check if a button was just pressed on a multitouch controller.", - "fullName": "Multitouch controller button just pressed", + "description": "Check if a button is pressed on a gamepad.", + "fullName": "Multitouch controller button pressed", "functionType": "Condition", - "name": "IsButtonJustPressed", - "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ was just pressed", + "name": "IsButtonPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -1695,73 +1695,7 @@ "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 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\"" - ] - } + "\"Pressed\"" ] } ], @@ -1793,7 +1727,7 @@ "objectGroups": [] }, { - "description": "Check if a button is released on a multitouch controller.", + "description": "Check if a button is released on a gamepad.", "fullName": "Multitouch controller button released", "functionType": "Condition", "name": "IsButtonReleased", @@ -1879,7 +1813,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"JustPressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -4369,49 +4303,11 @@ "conditions": [ { "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "IsReleased", - "True", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsReleased", - "False", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + "value": "SpriteMultitouchJoystick::MultitouchButton::IsReleased" }, "parameters": [ "Object", "Behavior", - "\"Idle\"", - "" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "True", "" ] } @@ -4422,7 +4318,7 @@ "value": "SetBooleanVariable" }, "parameters": [ - "IsJustPressed", + "IsReleased", "False", "" ] @@ -4434,7 +4330,7 @@ "parameters": [ "Object", "Behavior", - "\"Pressed\"", + "\"Idle\"", "" ] } @@ -4532,17 +4428,7 @@ "parameters": [ "Object", "Behavior", - "\"JustPressed\"", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "True", + "\"Pressed\"", "" ] } @@ -4613,16 +4499,6 @@ "" ] }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "False", - "" - ] - }, { "type": { "value": "SetNumberVariable" @@ -4652,11 +4528,11 @@ "objectGroups": [] }, { - "description": "Check if the button was just pressed.", - "fullName": "Button just pressed", + "description": "Check if button is released.", + "fullName": "Button released", "functionType": "Condition", - "name": "IsJustPressed", - "sentence": "Button _PARAM0_ was just pressed", + "name": "IsReleased", + "sentence": "Button _PARAM0_ is released", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -4666,7 +4542,7 @@ "value": "BooleanVariable" }, "parameters": [ - "IsJustPressed", + "IsReleased", "True", "" ] @@ -4700,7 +4576,7 @@ "objectGroups": [] }, { - "description": "Check if the button is pressed.", + "description": "Check if button is pressed.", "fullName": "Button pressed", "functionType": "Condition", "name": "IsPressed", @@ -4747,54 +4623,6 @@ ], "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", @@ -4836,7 +4664,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"JustPressed\",\"Pressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -4877,13 +4705,6 @@ "hidden": true, "name": "IsReleased" }, - { - "value": "", - "type": "Boolean", - "label": "Button just pressed", - "hidden": true, - "name": "IsJustPressed" - }, { "value": "0", "type": "Number", @@ -7298,6 +7119,7 @@ } ], "instances": [], + "editionSettings": {}, "eventsFunctions": [ { "fullName": "", @@ -8506,7 +8328,8 @@ "hidden": true, "name": "ShouldBeHiddenWhenReleased" } - ] + ], + "variants": [] } ] }, diff --git a/examples/starting-top-down-farming/starting-top-down-farming.json b/examples/starting-top-down-farming/starting-top-down-farming.json index f23300973..bb493c3ef 100644 --- a/examples/starting-top-down-farming/starting-top-down-farming.json +++ b/examples/starting-top-down-farming/starting-top-down-farming.json @@ -4787,19 +4787,19 @@ "category": "Input", "extensionNamespace": "", "fullName": "Multitouch joystick and buttons (sprite)", - "gdevelopVersion": ">=5.5.222", + "gdevelopVersion": "", "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", + "version": "1.4.0", "description": [ - "Multitouch joysticks are objects showing a joystick on the screen, useful for mobile. They work like a physical gamepad:", + "Multitouch joysticks can be used the same way as physical gamepads:", "- 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.", + "- 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)." ], @@ -4864,33 +4864,108 @@ ], "eventsFunctions": [ { - "description": "Check if the events are running for the editor.", - "fullName": "Editor is running", + "description": "Check if a button is pressed on a gamepad.", + "fullName": "Multitouch controller button pressed", "functionType": "Condition", - "name": "IsInGameEdition", - "private": true, - "sentence": "Events are running for the editor", + "name": "IsButtonPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", "events": [ { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "const game = runtimeScene.getGame();\r", - "eventsFunctionContext.returnValue = game.isInGameEdition && game.isInGameEdition();" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"Pressed\"" + ] + } ], - "parameterObjects": "", - "useStrict": true, - "eventsSheetExpanded": false + "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" } ], - "parameters": [], "objectGroups": [] }, { - "fullName": "Accelerated speed", - "functionType": "Expression", - "name": "AcceleratedSpeed", + "description": "Check if a button is released on a gamepad.", + "fullName": "Multitouch controller button released", + "functionType": "Condition", + "name": "IsButtonReleased", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is released", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"Released\"" + ] + } + ], + "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": "Change a button state for a multitouch controller.", + "fullName": "Button state", + "functionType": "Action", + "name": "SetButtonState", "private": true, - "sentence": "", + "sentence": "Mark _PARAM2_ button as _PARAM3_ for multitouch controller _PARAM1_", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -4898,443 +4973,108 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SetStringVariable" }, "parameters": [ - "AcceleratedSpeed", + "Controllers[ControllerIdentifier].Buttons[Button].State", "=", - "CurrentSpeed" + "ButtonState" ] } - ], - "events": [ + ] + } + ], + "parameters": [ + { + "description": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier", + "type": "expression" + }, + { + "description": "Button name", + "name": "Button", + "type": "string" + }, + { + "description": "Button state", + "name": "ButtonState", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "type": "stringWithSelector" + } + ], + "objectGroups": [] + }, + { + "description": "Change the dead zone radius of a joystick. 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).", + "fullName": "Dead zone radius", + "functionType": "Action", + "name": "SetDeadZone", + "private": true, + "sentence": "Change the dead zone of multitouch joystick _PARAM2_ of multitouch controller _PARAM1_ to _PARAM3_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ { - "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", - "=", - "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": "NumberVariable" - }, - "parameters": [ - "TargetedSpeed", - "=", - "0" - ] - } - ], - "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", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "clamp(AcceleratedSpeed, -SpeedMax, SpeedMax)" - ] - } + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].DeadZone", + "=", + "DeadZoneRadius" ] } - ], - "variables": [ - { - "name": "AcceleratedSpeed", - "type": "number", - "value": 0 - } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { - "description": "Current speed", - "name": "CurrentSpeed", - "type": "expression" - }, - { - "description": "Targeted speed", - "name": "TargetedSpeed", - "type": "expression" - }, - { - "description": "Max speed", - "name": "SpeedMax", + "description": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier", "type": "expression" }, { - "description": "Acceleration", - "name": "Acceleration", - "type": "expression" + "description": "Joystick name", + "name": "JoystickIdentifier", + "type": "string" }, { - "description": "Deceleration", - "name": "Deceleration", + "description": "Dead zone radius", + "name": "DeadZoneRadius", + "supplementaryInformation": "[]", "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", + "description": "Return the dead zone radius of a joystick. 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).", + "fullName": "Dead zone radius", + "functionType": "Expression", + "name": "DeadZone", + "private": true, + "sentence": "Change multitouch joystick _PARAM2_ of multitouch controller _PARAM1_ dead zone to _PARAM3_", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Buttons[Button].State", - "=", - "\"JustPressed\"" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "SetReturnBoolean" + "value": "SetReturnNumber" }, "parameters": [ - "True" + "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].DeadZone" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Multitouch controller identifier (1, 2, 3, 4...)", @@ -5342,273 +5082,28 @@ "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\"]", + "description": "Joystick name", + "name": "JoystickIdentifier", "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", + "description": "the direction index (left = 1, bottom = 1, right = 2, top = 3) for an angle (in degrees).", + "fullName": "Angle to 4-way index", + "functionType": "ExpressionAndCondition", + "name": "AngleTo4Way", + "private": true, + "sentence": "The angle _PARAM1_ 4-way index", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "conditions": [], + "actions": [ { "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", - "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is released", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Buttons[Button].State", - "=", - "\"Released\"" - ] - } - ], - "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": "Change a button state for a multitouch controller.", - "fullName": "Button state", - "functionType": "Action", - "name": "SetButtonState", - "private": true, - "sentence": "Mark _PARAM2_ button as _PARAM3_ for multitouch controller _PARAM1_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetStringVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Buttons[Button].State", - "=", - "ButtonState" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" - }, - { - "description": "Button name", - "name": "Button", - "type": "string" - }, - { - "description": "Button state", - "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"JustPressed\",\"Released\"]", - "type": "stringWithSelector" - } - ], - "objectGroups": [] - }, - { - "description": "Change the dead zone radius of a joystick. 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).", - "fullName": "Dead zone radius", - "functionType": "Action", - "name": "SetDeadZone", - "private": true, - "sentence": "Change the dead zone of multitouch joystick _PARAM2_ of multitouch controller _PARAM1_ to _PARAM3_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].DeadZone", - "=", - "DeadZoneRadius" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" - }, - { - "description": "Joystick name", - "name": "JoystickIdentifier", - "type": "string" - }, - { - "description": "Dead zone radius", - "name": "DeadZoneRadius", - "supplementaryInformation": "[]", - "type": "expression" - } - ], - "objectGroups": [] - }, - { - "description": "Return the dead zone radius of a joystick. 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).", - "fullName": "Dead zone radius", - "functionType": "Expression", - "name": "DeadZone", - "private": true, - "sentence": "Change multitouch joystick _PARAM2_ of multitouch controller _PARAM1_ dead zone to _PARAM3_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].DeadZone" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" - }, - { - "description": "Joystick name", - "name": "JoystickIdentifier", - "type": "string" - } - ], - "objectGroups": [] - }, - { - "description": "the direction index (left = 1, bottom = 1, right = 2, top = 3) for an angle (in degrees).", - "fullName": "Angle to 4-way index", - "functionType": "ExpressionAndCondition", - "name": "AngleTo4Way", - "private": true, - "sentence": "The angle _PARAM1_ 4-way index", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" + "value": "SetReturnNumber" }, "parameters": [ "mod(round(Angle * 4 / 360), 4)" @@ -6353,11 +5848,6 @@ "name": "JoystickIdentifier", "supplementaryInformation": "[\"Primary\",\"Secondary\"]", "type": "stringWithSelector" - }, - { - "description": "", - "name": "Coucou", - "type": "expression" } ], "objectGroups": [] @@ -6587,7 +6077,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "XFromAngleAndDistance(SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier), SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier))" + "SpriteMultitouchJoystick::JoystickForce(ControllerIdentifier, JoystickIdentifier) * cos(ToRad(SpriteMultitouchJoystick::JoystickAngle(ControllerIdentifier, JoystickIdentifier)))" ] } ] @@ -6627,7 +6117,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "YFromAngleAndDistance(SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier), SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier))" + "SpriteMultitouchJoystick::JoystickForce(ControllerIdentifier, JoystickIdentifier) * sin(ToRad(SpriteMultitouchJoystick::JoystickAngle(ControllerIdentifier, JoystickIdentifier)))" ] } ] @@ -6650,133 +6140,16 @@ } ], "objectGroups": [] - }, + } + ], + "eventsBasedBehaviors": [ { - "description": "Check if a new touch has started on the right or left side of the screen.", - "fullName": "New touch on a screen side", - "functionType": "Condition", - "group": "Multitouch Joystick", - "name": "HasTouchStartedOnScreenSide", - "sentence": "A new touch has started on the _PARAM2_ side of the screen on _PARAM1_'s layer", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "HasAnyTouchOrMouseStarted" - }, - "parameters": [ - "" - ] - } - ], - "actions": [], - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "Side", - "=", - "\"Left\"" - ] - }, - { - "type": { - "value": "TouchX" - }, - "parameters": [ - "", - "StartedTouchOrMouseId(0)", - "<", - "CameraCenterX(Object.Layer())", - "Object.Layer()", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "Side", - "=", - "\"Right\"" - ] - }, - { - "type": { - "value": "TouchX" - }, - "parameters": [ - "", - "StartedTouchOrMouseId(0)", - ">=", - "CameraCenterX(Object.Layer())", - "Object.Layer()", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - } - ] - } - ], - "parameters": [ - { - "description": "Multitouch joystick", - "name": "Object", - "supplementaryInformation": "SpriteMultitouchJoystick::SpriteMultitouchJoystick", - "type": "objectList" - }, - { - "description": "Screen side", - "name": "Side", - "supplementaryInformation": "[\"Left\",\"Right\"]", - "type": "stringWithSelector" - } - ], - "objectGroups": [] - } - ], - "eventsBasedBehaviors": [ - { - "description": "Joystick that can be controlled by interacting with a touchscreen.", - "fullName": "Multitouch Joystick", - "name": "MultitouchJoystick", - "objectType": "", - "private": true, - "eventsFunctions": [ + "description": "Joystick that can be controlled by interacting with a touchscreen.", + "fullName": "Multitouch Joystick", + "name": "MultitouchJoystick", + "objectType": "", + "private": true, + "eventsFunctions": [ { "fullName": "", "functionType": "Action", @@ -6795,1887 +6168,18 @@ "", "ControllerIdentifier", "JoystickIdentifier", - "DeadZoneRadius", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "Action", - "name": "onDeActivate", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "Action", - "name": "doStepPreEvents", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "inverted": true, - "value": "SpriteMultitouchJoystick::IsInGameEdition" - }, - "parameters": [ - "", - "" - ] - } - ], - "actions": [], - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "HasGameJustResumed" - }, - "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)" - }, - { - "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": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "the joystick force (from 0 to 1).", - "fullName": "Joystick force", - "functionType": "ExpressionAndCondition", - "name": "JoystickForce", - "sentence": "the joystick force", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "max(0, JoystickForce - DeadZoneRadius) / (1 - DeadZoneRadius)" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "JoystickForce", - "name": "SetJoystickForce", - "private": true, - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "JoystickForce", - "=", - "Value" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::SetJoystickForce" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "JoystickForce", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - }, - { - "description": "", - "name": "Parameter", - "type": "objectList" - } - ], - "objectGroups": [] - }, - { - "description": "Return the angle the joystick is pointing towards (Range: -180 to 180).", - "fullName": "Joystick angle", - "functionType": "Expression", - "name": "JoystickAngle", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "JoystickAngle" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "Change the angle the joystick is pointing towards (Range: -180 to 180).", - "fullName": "Joystick angle", - "functionType": "Action", - "name": "SetJoystickAngle", - "private": true, - "sentence": "Change the joystick angle of _PARAM0_ to _PARAM2_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "JoystickAngle", - "=", - "Value" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::SetJoystickAngle" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "JoystickAngle", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - }, - { - "description": "Angle", - "name": "Value", - "type": "expression" - } - ], - "objectGroups": [] - }, - { - "description": "Return the stick force on X axis (from -1 at the left to 1 at the right).", - "fullName": "Stick X force", - "functionType": "Expression", - "name": "StickForceX", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "Object.Behavior::JoystickForce() * cos(ToRad(Object.Behavior::JoystickAngle()))" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "Return the stick force on Y axis (from -1 at the top to 1 at the bottom).", - "fullName": "Stick Y force", - "functionType": "Expression", - "name": "StickForceY", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "Object.Behavior::JoystickForce() * sin(ToRad(Object.Behavior::JoystickAngle()))" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "Check if joystick is pushed in a given direction.", - "fullName": "Joystick pushed in a direction (4-way movement)", - "functionType": "Condition", - "name": "IsDirectionPushed4Way", - "sentence": "_PARAM0_ is pushed in direction _PARAM2_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::JoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - ">", - "0", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::IsAngleIn4WayDirection" - }, - "parameters": [ - "", - "JoystickAngle", - "Direction", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - }, - { - "description": "Direction", - "name": "Direction", - "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\"]", - "type": "stringWithSelector" - } - ], - "objectGroups": [] - }, - { - "description": "Check if joystick is pushed in a given direction.", - "fullName": "Joystick pushed in a direction (8-way movement)", - "functionType": "Condition", - "name": "IsDirectionPushed8Way", - "sentence": "_PARAM0_ is pushed in direction _PARAM2_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::JoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - ">", - "0", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::IsAngleIn8WayDirection" - }, - "parameters": [ - "", - "JoystickAngle", - "Direction", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - }, - { - "description": "Direction", - "name": "Direction", - "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\",\"UpLeft\",\"UpRight\",\"DownLeft\",\"DownRight\"]", - "type": "stringWithSelector" - } - ], - "objectGroups": [] - }, - { - "description": "Check if a joystick is pressed.", - "fullName": "Joystick pressed", - "functionType": "Condition", - "name": "IsPressed", - "sentence": "Joystick _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::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "Reset the joystick values (except for angle, which stays the same)", - "fullName": "Reset", - "functionType": "Action", - "name": "Reset", - "private": true, - "sentence": "Reset the joystick of _PARAM0_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "0", - "" - ] - }, - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "0" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "the multitouch controller identifier.", - "fullName": "Multitouch controller identifier", - "functionType": "ExpressionAndCondition", - "group": "Multitouch Joystick configuration", - "name": "ControllerIdentifier", - "sentence": "the multitouch controller identifier", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "ControllerIdentifier" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "ControllerIdentifier", - "name": "SetControllerIdentifier", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "ControllerIdentifier", - "=", - "Value" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "the joystick name.", - "fullName": "Joystick name", - "functionType": "ExpressionAndCondition", - "group": "Multitouch Joystick configuration", - "name": "JoystickIdentifier", - "sentence": "the joystick name", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnString" - }, - "parameters": [ - "JoystickIdentifier" - ] - } - ] - } - ], - "expressionType": { - "type": "string" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "JoystickIdentifier", - "name": "SetJoystickIdentifier", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetStringVariable" - }, - "parameters": [ - "JoystickIdentifier", - "=", - "Value" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "the dead zone radius (range: 0 to 1) of the joystick. 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).", - "fullName": "Dead zone radius", - "functionType": "ExpressionAndCondition", - "group": "Multitouch Joystick configuration", - "name": "DeadZoneRadius", - "sentence": "the dead zone radius", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "DeadZoneRadius" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "DeadZoneRadius", - "name": "SetDeadZoneRadius", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "DeadZoneRadius", - "=", - "Value" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::SetDeadZone" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "Value", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "Force the joystick into the pressing state.", - "fullName": "Force start pressing", - "functionType": "Action", - "name": "ForceStartPressing", - "sentence": "Force start pressing _PARAM0_ with touch identifier: _PARAM2_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "Value" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - }, - { - "description": "Touch identifier", - "name": "Value", - "type": "expression" - } - ], - "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "1", - "type": "Number", - "label": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier" - }, - { - "value": "Primary", - "type": "String", - "label": "Joystick name", - "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": "0", - "type": "Number", - "label": "Joystick angle (range: -180 to 180)", - "hidden": true, - "name": "JoystickAngle" - }, - { - "value": "0", - "type": "Number", - "label": "Joystick force (range: 0 to 1)", - "hidden": true, - "name": "JoystickForce" - }, - { - "value": "0", - "type": "Number", - "label": "", - "hidden": true, - "name": "TouchId" - }, - { - "value": "", - "type": "Number", - "label": "", - "hidden": true, - "name": "TouchIndex" - } - ], - "sharedPropertyDescriptors": [] - }, - { - "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": "", - "eventsFunctions": [ - { - "fullName": "", - "functionType": "Action", - "name": "doStepPreEvents", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "IsReleased", - "True", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsReleased", - "False", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" - }, - "parameters": [ - "Object", - "Behavior", - "\"Idle\"", - "" - ] - } - ] - }, - { - "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": [ - { - "type": { - "inverted": true, - "value": "SpriteMultitouchJoystick::MultitouchButton::IsPressed" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - }, - { - "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": "BuiltinCommonInstructions::Or" - }, - "parameters": [], - "subInstructions": [ - { - "type": { - "value": "CollisionPoint" - }, - "parameters": [ - "Object", - "TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer())", - "TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer())" - ] - }, - { - "type": { - "value": "NumberVariable" - }, - "parameters": [ - "Radius", - ">", - "DistanceBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer()), TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer()))" - ] - } - ] - } - ], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "StartedTouchOrMouseId(TouchIndex)" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" - }, - "parameters": [ - "Object", - "Behavior", - "\"JustPressed\"", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "True", - "" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchIndex", - "+", - "1" - ] - } - ] - } - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::IsPressed" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - }, - { - "type": { - "value": "HasTouchEnded" - }, - "parameters": [ - "", - "TouchId" - ] - } - ], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" - }, - "parameters": [ - "Object", - "Behavior", - "\"Released\"", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsReleased", - "True", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "False", - "" - ] - }, - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "0" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "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", - "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", - "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": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", - "type": "behavior" - }, - { - "description": "Button state", - "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"JustPressed\",\"Pressed\",\"Released\"]", - "type": "stringWithSelector" - } - ], - "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "1", - "type": "Number", - "label": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier" - }, - { - "value": "A", - "type": "String", - "label": "Button identifier", - "name": "ButtonIdentifier" - }, - { - "value": "0", - "type": "Number", - "label": "TouchID", - "hidden": true, - "name": "TouchId" - }, - { - "value": "", - "type": "Number", - "label": "", - "hidden": true, - "name": "TouchIndex" - }, - { - "value": "", - "type": "Boolean", - "label": "Button released", - "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.", - "name": "Radius" - } - ], - "sharedPropertyDescriptors": [] - }, - { - "description": "Control a platformer character with a multitouch controller.", - "fullName": "Platformer multitouch controller mapper", - "name": "PlatformerMultitouchMapper", - "objectType": "", - "quickCustomizationVisibility": "hidden", - "eventsFunctions": [ - { - "fullName": "", - "functionType": "Action", - "name": "doStepPreEvents", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "\"Left\"", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateLeftKey" - }, - "parameters": [ - "Object", - "Property" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "\"Right\"", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateRightKey" - }, - "parameters": [ - "Object", - "Property" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "\"Up\"", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateUpKey" - }, - "parameters": [ - "Object", - "Property" - ] - }, - { - "type": { - "value": "PlatformBehavior::SimulateLadderKey" - }, - "parameters": [ - "Object", - "Property" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "\"Down\"", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateDownKey" - }, - "parameters": [ - "Object", - "Property" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::IsButtonPressed" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JumpButton", - "\"Down\"" + "DeadZoneRadius", + "" ] - } - ], - "actions": [ + }, { "type": { - "value": "PlatformBehavior::SimulateJumpKey" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" }, "parameters": [ "Object", - "Property" + "Behavior", + "" ] } ] @@ -8690,64 +6194,50 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::PlatformerMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "", - "type": "Behavior", - "label": "Platform character behavior", - "extraInformation": [ - "PlatformBehavior::PlatformerObjectBehavior" - ], - "choices": [], - "name": "Property" - }, - { - "value": "1", - "type": "Number", - "label": "Controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier" }, { - "value": "Primary", - "type": "Choice", - "label": "Joystick name", - "group": "Controls", - "choices": [ + "fullName": "", + "functionType": "Action", + "name": "onDeActivate", + "sentence": "", + "events": [ { - "label": "Primary", - "value": "Primary" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" }, { - "label": "Secondary", - "value": "Secondary" + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } ], - "name": "JoystickIdentifier" + "objectGroups": [] }, - { - "value": "A", - "type": "String", - "label": "Jump button name", - "group": "Controls", - "name": "JumpButton" - } - ], - "sharedPropertyDescriptors": [] - }, - { - "description": "Control a 3D physics character with a multitouch controller.", - "fullName": "3D platformer multitouch controller mapper", - "name": "Platformer3DMultitouchMapper", - "objectType": "", - "quickCustomizationVisibility": "hidden", - "eventsFunctions": [ { "fullName": "", "functionType": "Action", @@ -8759,14 +6249,9 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::StickForce" + "value": "HasGameJustResumed" }, "parameters": [ - "", - ">", - "0", - "ControllerIdentifier", - "JoystickIdentifier", "" ] } @@ -8774,56 +6259,252 @@ "actions": [ { "type": { - "value": "Physics3D::PhysicsCharacter3D::SetForwardAngle" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" }, "parameters": [ "Object", - "PhysicsCharacter3D", - "=", - "SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier) + CameraAngle(Object.Layer())" + "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": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyTouchIndex" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "0" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "StartedTouchOrMouseCount()", + "conditions": [], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::PropertyTouchId" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "0" + ] + }, + { + "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": { - "value": "Physics3D::PhysicsCharacter3D::SimulateStick" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 }, - "parameters": [ - "Object", - "PhysicsCharacter3D", - "-90", - "SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier)" + "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" + }, + "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": "SpriteMultitouchJoystick::MultitouchJoystick::PropertyTouchId" + }, + "parameters": [ + "Object", + "Behavior", + "!=", + "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": [ + { + "description": "Object", + "name": "Object", + "type": "object" }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "the joystick force (from 0 to 1).", + "fullName": "Joystick force", + "functionType": "ExpressionAndCondition", + "name": "JoystickForce", + "sentence": "the joystick force", + "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::IsButtonPressed" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JumpButton", - "\"Down\"" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" + "value": "SetReturnNumber" }, "parameters": [ - "Object", - "PhysicsCharacter3D" + "max(0, JoystickForce - DeadZoneRadius) / (1 - DeadZoneRadius)" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -8833,124 +6514,45 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::Platformer3DMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "", - "type": "Behavior", - "label": "3D physics character", - "extraInformation": [ - "Physics3D::PhysicsCharacter3D" - ], - "choices": [], - "name": "PhysicsCharacter3D" }, - { - "value": "1", - "type": "Number", - "label": "Controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier" - }, - { - "value": "Primary", - "type": "Choice", - "label": "Walk joystick", - "group": "Controls", - "choices": [ - { - "label": "Primary", - "value": "Primary" - }, - { - "label": "Secondary", - "value": "Secondary" - } - ], - "name": "JoystickIdentifier" - }, - { - "value": "A", - "type": "String", - "label": "Jump button name", - "group": "Controls", - "name": "JumpButton" - } - ], - "sharedPropertyDescriptors": [] - }, - { - "description": "Control a 3D physics character with a multitouch controller.", - "fullName": "3D shooter multitouch controller mapper", - "name": "Shooter3DMultitouchMapper", - "objectType": "", - "quickCustomizationVisibility": "hidden", - "eventsFunctions": [ { "fullName": "", - "functionType": "Action", - "name": "doStepPreEvents", + "functionType": "ActionWithOperator", + "getterName": "JoystickForce", + "name": "SetJoystickForce", + "private": true, "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::StickForce" - }, - "parameters": [ - "", - ">", - "0", - "ControllerIdentifier", - "JoystickIdentifier", - "" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateStick" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickForce" }, "parameters": [ "Object", - "PhysicsCharacter3D", - "SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier)", - "SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier)" + "Behavior", + "=", + "Value" ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + }, { "type": { - "value": "SpriteMultitouchJoystick::IsButtonPressed" + "value": "SpriteMultitouchJoystick::SetJoystickForce" }, "parameters": [ "", "ControllerIdentifier", - "JumpButton", - "\"Down\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" - }, - "parameters": [ - "Object", - "PhysicsCharacter3D" + "JoystickIdentifier", + "JoystickForce", + "" ] } ] @@ -8965,151 +6567,37 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::Shooter3DMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "", - "type": "Behavior", - "label": "3D physics character", - "extraInformation": [ - "Physics3D::PhysicsCharacter3D" - ], - "choices": [], - "name": "PhysicsCharacter3D" - }, - { - "value": "1", - "type": "Number", - "label": "Controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier" - }, - { - "value": "Primary", - "type": "Choice", - "label": "Walk joystick", - "group": "Controls", - "choices": [ - { - "label": "Primary", - "value": "Primary" - }, - { - "label": "Secondary", - "value": "Secondary" - } - ], - "name": "JoystickIdentifier" }, { - "value": "A", - "type": "String", - "label": "Jump button name", - "group": "Controls", - "name": "JumpButton" - } - ], - "sharedPropertyDescriptors": [] - }, - { - "description": "Control camera rotations with a multitouch controller.", - "fullName": "First person camera multitouch controller mapper", - "name": "FirstPersonMultitouchMapper", - "objectType": "", - "quickCustomizationVisibility": "hidden", - "eventsFunctions": [ - { - "fullName": "", - "functionType": "Action", - "name": "doStepPreEvents", + "description": "Return the angle the joystick is pointing towards (Range: -180 to 180).", + "fullName": "Joystick angle", + "functionType": "Expression", + "name": "JoystickAngle", "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", - "=", - "SpriteMultitouchJoystick::AcceleratedSpeed(CurrentRotationSpeedZ, SpriteMultitouchJoystick::StickForceX(ControllerIdentifier, CameraStick) * HorizontalRotationSpeedMax, HorizontalRotationSpeedMax, HorizontalRotationAcceleration, HorizontalRotationDeceleration)" - ] - }, - { - "type": { - "value": "SetAngle" - }, - "parameters": [ - "Object", - "+", - "CurrentRotationSpeedZ * TimeDelta()" - ] - }, - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "CurrentRotationSpeedY", - "=", - "SpriteMultitouchJoystick::AcceleratedSpeed(CurrentRotationSpeedY, SpriteMultitouchJoystick::StickForceY(ControllerIdentifier, 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)" - ] - }, + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper::LookFromObjectEyes" + "value": "SetReturnNumber" }, "parameters": [ - "Object", - "Behavior", - "" + "JoystickAngle" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -9119,20 +6607,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "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", + "description": "Change the angle the joystick is pointing towards (Range: -180 to 180).", + "fullName": "Joystick angle", "functionType": "Action", - "group": "Layers and cameras", - "name": "LookFromObjectEyes", + "name": "SetJoystickAngle", "private": true, - "sentence": "Move the camera to look though _PARAM0_ eyes", + "sentence": "Change the joystick angle of _PARAM0_ to _PARAM2_", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -9140,61 +6627,24 @@ "actions": [ { "type": { - "value": "CentreCamera" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickAngle" }, "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": [ - "", + "Behavior", "=", - "Object.Object3D::RotationX()", - "GetArgumentAsString(\"Layer\")", - "" + "Value" ] }, { "type": { - "value": "SetCameraAngle" + "value": "SpriteMultitouchJoystick::SetJoystickAngle" }, "parameters": [ "", - "=", - "Object.Angle() + 90", - "Object.Layer()", + "ControllerIdentifier", + "JoystickIdentifier", + "JoystickAngle", "" ] } @@ -9210,19 +6660,23 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" + }, + { + "description": "Angle", + "name": "Value", + "type": "expression" } ], "objectGroups": [] }, { - "description": "the maximum horizontal rotation speed of the object.", - "fullName": "Maximum horizontal rotation speed", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper horizontal rotation configuration", - "name": "HorizontalRotationSpeedMax", - "sentence": "the maximum horizontal rotation speed", + "description": "Return the stick force on X axis (from -1 at the left to 1 at the right).", + "fullName": "Stick X force", + "functionType": "Expression", + "name": "StickForceX", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -9233,7 +6687,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "HorizontalRotationSpeedMax" + "Object.Behavior::JoystickForce() * cos(ToRad(Object.Behavior::JoystickAngle()))" ] } ] @@ -9251,17 +6705,17 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] }, { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "HorizontalRotationSpeedMax", - "name": "SetHorizontalRotationSpeedMax", + "description": "Return the stick force on Y axis (from -1 at the top to 1 at the bottom).", + "fullName": "Stick Y force", + "functionType": "Expression", + "name": "StickForceY", "sentence": "", "events": [ { @@ -9270,17 +6724,18 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SetReturnNumber" }, "parameters": [ - "HorizontalRotationSpeedMax", - "=", - "Value" + "Object.Behavior::JoystickForce() * sin(ToRad(Object.Behavior::JoystickAngle()))" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -9290,38 +6745,58 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the horizontal rotation acceleration of the object.", - "fullName": "Horizontal rotation acceleration", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper horizontal rotation configuration", - "name": "HorizontalRotationAcceleration", - "sentence": "the horizontal rotation acceleration", + "description": "Check if joystick is pushed in a given direction.", + "fullName": "Joystick pushed in a direction (4-way movement)", + "functionType": "Condition", + "name": "IsDirectionPushed4Way", + "sentence": "_PARAM0_ is pushed in direction _PARAM2_", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::JoystickForce" + }, + "parameters": [ + "Object", + "Behavior", + ">", + "0", + "" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::IsAngleIn4WayDirection" + }, + "parameters": [ + "", + "JoystickAngle", + "Direction", + "" + ] + } + ], "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "SetReturnBoolean" }, "parameters": [ - "HorizontalRotationAcceleration" + "True" ] } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -9331,31 +6806,59 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" + }, + { + "description": "Direction", + "name": "Direction", + "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\"]", + "type": "stringWithSelector" } ], "objectGroups": [] }, { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "HorizontalRotationAcceleration", - "name": "SetHorizontalRotationAcceleration", - "sentence": "", + "description": "Check if joystick is pushed in a given direction.", + "fullName": "Joystick pushed in a direction (8-way movement)", + "functionType": "Condition", + "name": "IsDirectionPushed8Way", + "sentence": "_PARAM0_ is pushed in direction _PARAM2_", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::JoystickForce" + }, + "parameters": [ + "Object", + "Behavior", + ">", + "0", + "" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::IsAngleIn8WayDirection" + }, + "parameters": [ + "", + "JoystickAngle", + "Direction", + "" + ] + } + ], "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SetReturnBoolean" }, "parameters": [ - "HorizontalRotationAcceleration", - "=", - "Value" + "True" ] } ] @@ -9370,38 +6873,52 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" + }, + { + "description": "Direction", + "name": "Direction", + "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\",\"UpLeft\",\"UpRight\",\"DownLeft\",\"DownRight\"]", + "type": "stringWithSelector" } ], "objectGroups": [] }, { - "description": "the horizontal rotation deceleration of the object.", - "fullName": "Horizontal rotation deceleration", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper horizontal rotation configuration", - "name": "HorizontalRotationDeceleration", - "sentence": "the horizontal rotation deceleration", + "description": "Check if a joystick is pressed.", + "fullName": "Joystick pressed", + "functionType": "Condition", + "name": "IsPressed", + "sentence": "Joystick _PARAM0_ is pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::PropertyTouchId" + }, + "parameters": [ + "Object", + "Behavior", + "!=", + "0" + ] + } + ], "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "SetReturnBoolean" }, "parameters": [ - "HorizontalRotationDeceleration" + "True" ] } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -9411,18 +6928,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] }, { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "HorizontalRotationDeceleration", - "name": "SetHorizontalRotationDeceleration", - "sentence": "", + "description": "Reset the joystick values (except for angle, which stays the same)", + "fullName": "Reset", + "functionType": "Action", + "name": "Reset", + "private": true, + "sentence": "Reset the joystick of _PARAM0_", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -9430,12 +6948,25 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" }, "parameters": [ - "HorizontalRotationDeceleration", + "Object", + "Behavior", "=", - "Value" + "0", + "" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyTouchId" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "0" ] } ] @@ -9450,19 +6981,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the maximum vertical rotation speed of the object.", - "fullName": "Maximum vertical rotation speed", + "description": "the multitouch controller identifier.", + "fullName": "Multitouch controller identifier", "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper vertical rotation configuration", - "name": "VerticalRotationSpeedMax", - "sentence": "the maximum vertical rotation speed", + "group": "Multitouch Joystick configuration", + "name": "ControllerIdentifier", + "sentence": "the multitouch controller identifier", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -9473,7 +7004,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "VerticalRotationSpeedMax" + "ControllerIdentifier" ] } ] @@ -9491,7 +7022,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], @@ -9500,8 +7031,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "VerticalRotationSpeedMax", - "name": "SetVerticalRotationSpeedMax", + "getterName": "ControllerIdentifier", + "name": "SetControllerIdentifier", "sentence": "", "events": [ { @@ -9510,10 +7041,11 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyControllerIdentifier" }, "parameters": [ - "VerticalRotationSpeedMax", + "Object", + "Behavior", "=", "Value" ] @@ -9530,19 +7062,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the vertical rotation acceleration of the object.", - "fullName": "Vertical rotation acceleration", + "description": "the joystick name.", + "fullName": "Joystick name", "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper vertical rotation configuration", - "name": "VerticalRotationAcceleration", - "sentence": "the vertical rotation acceleration", + "group": "Multitouch Joystick configuration", + "name": "JoystickIdentifier", + "sentence": "the joystick name", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -9550,17 +7082,17 @@ "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "SetReturnString" }, "parameters": [ - "VerticalRotationAcceleration" + "JoystickIdentifier" ] } ] } ], "expressionType": { - "type": "expression" + "type": "string" }, "parameters": [ { @@ -9571,7 +7103,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], @@ -9580,8 +7112,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "VerticalRotationAcceleration", - "name": "SetVerticalRotationAcceleration", + "getterName": "JoystickIdentifier", + "name": "SetJoystickIdentifier", "sentence": "", "events": [ { @@ -9590,10 +7122,11 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickIdentifier" }, "parameters": [ - "VerticalRotationAcceleration", + "Object", + "Behavior", "=", "Value" ] @@ -9610,19 +7143,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the vertical rotation deceleration of the object.", - "fullName": "Vertical rotation deceleration", + "description": "the dead zone radius (range: 0 to 1) of the joystick. 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).", + "fullName": "Dead zone radius", "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper vertical rotation configuration", - "name": "VerticalRotationDeceleration", - "sentence": "the vertical rotation deceleration", + "group": "Multitouch Joystick configuration", + "name": "DeadZoneRadius", + "sentence": "the dead zone radius", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -9633,7 +7166,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "VerticalRotationDeceleration" + "DeadZoneRadius" ] } ] @@ -9651,7 +7184,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], @@ -9660,8 +7193,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "VerticalRotationDeceleration", - "name": "SetVerticalRotationDeceleration", + "getterName": "DeadZoneRadius", + "name": "SetDeadZoneRadius", "sentence": "", "events": [ { @@ -9670,10 +7203,11 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyDeadZoneRadius" }, "parameters": [ - "VerticalRotationDeceleration", + "Object", + "Behavior", "=", "Value" ] @@ -9690,72 +7224,271 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] + } + ], + "propertyDescriptors": [ + { + "value": "1", + "type": "Number", + "label": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier" }, { - "description": "the minimum vertical camera angle of the object.", - "fullName": "Minimum vertical camera angle", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper vertical rotation configuration", - "name": "VerticalAngleMin", - "sentence": "the minimum vertical camera angle", + "value": "Primary", + "type": "String", + "label": "Joystick name", + "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": "0", + "type": "Number", + "label": "Joystick angle (range: -180 to 180)", + "hidden": true, + "name": "JoystickAngle" + }, + { + "value": "0", + "type": "Number", + "label": "Joystick force (range: 0 to 1)", + "hidden": true, + "name": "JoystickForce" + }, + { + "value": "0", + "type": "Number", + "label": "", + "hidden": true, + "name": "TouchId" + }, + { + "value": "", + "type": "Number", + "label": "", + "hidden": true, + "name": "TouchIndex" + } + ], + "sharedPropertyDescriptors": [] + }, + { + "description": "Detect button presses made on a touchscreen.", + "fullName": "Multitouch button", + "name": "MultitouchButton", + "objectType": "", + "eventsFunctions": [ + { + "fullName": "", + "functionType": "Action", + "name": "doStepPreEvents", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::IsReleased" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } + ], "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyIsReleased" + }, + "parameters": [ + "Object", + "Behavior", + "no" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" }, "parameters": [ - "VerticalAngleMin" + "Object", + "Behavior", + "\"Idle\"", + "" ] } ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" }, { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "VerticalAngleMin", - "name": "SetVerticalAngleMin", - "sentence": "", - "events": [ + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "SpriteMultitouchJoystick::MultitouchButton::IsPressed" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + }, + { + "type": { + "value": "HasAnyTouchOrMouseStarted" + }, + "parameters": [ + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchIndex" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "0" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "StartedTouchOrMouseCount()", + "conditions": [], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "CollisionPoint" + }, + "parameters": [ + "Object", + "TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)", + "TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchId" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "StartedTouchOrMouseId(TouchIndex)" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + }, + "parameters": [ + "Object", + "Behavior", + "\"Pressed\"", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchIndex" + }, + "parameters": [ + "Object", + "Behavior", + "+", + "1" + ] + } + ] + } + ] + } + ] + }, { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::IsPressed" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + }, + { + "type": { + "value": "HasTouchEnded" + }, + "parameters": [ + "", + "TouchId" + ] + } + ], "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + }, + "parameters": [ + "Object", + "Behavior", + "\"Released\"", + "" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyIsReleased" + }, + "parameters": [ + "Object", + "Behavior", + "yes" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchId" }, "parameters": [ - "VerticalAngleMin", + "Object", + "Behavior", "=", - "Value" + "0" ] } ] @@ -9770,72 +7503,39 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the maximum vertical camera angle of the object.", - "fullName": "Maximum vertical camera angle", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper vertical rotation configuration", - "name": "VerticalAngleMax", - "sentence": "the maximum vertical camera angle", + "description": "Check if button is released.", + "fullName": "Button released", + "functionType": "Condition", + "name": "IsReleased", + "sentence": "Button _PARAM0_ is released", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ + "conditions": [ { "type": { - "value": "SetReturnNumber" + "value": "SpriteMultitouchJoystick::MultitouchButton::PropertyIsReleased" }, "parameters": [ - "VerticalAngleMax" + "Object", + "Behavior" ] } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "VerticalAngleMax", - "name": "SetVerticalAngleMax", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + ], "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SetReturnBoolean" }, "parameters": [ - "VerticalAngleMax", - "=", - "Value" + "True" ] } ] @@ -9850,38 +7550,46 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the z position offset of the object.", - "fullName": "Z position offset", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper position configuration", - "name": "OffsetZ", - "sentence": "the z position offset", + "description": "Check if button is pressed.", + "fullName": "Button pressed", + "functionType": "Condition", + "name": "IsPressed", + "sentence": "Button _PARAM0_ is pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::PropertyTouchId" + }, + "parameters": [ + "Object", + "Behavior", + "!=", + "0" + ] + } + ], "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "SetReturnBoolean" }, "parameters": [ - "OffsetZ" + "True" ] } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -9891,18 +7599,18 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", "type": "behavior" } ], "objectGroups": [] }, { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "OffsetZ", - "name": "SetOffsetZ", - "sentence": "", + "fullName": "Button state", + "functionType": "Action", + "name": "SetButtonState", + "private": true, + "sentence": "Mark the button _PARAM0_ as _PARAM2_", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -9910,12 +7618,14 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::SetButtonState" }, "parameters": [ - "OffsetZ", - "=", - "Value" + "", + "ControllerIdentifier", + "ButtonIdentifier", + "ButtonState", + "" ] } ] @@ -9930,140 +7640,61 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", "type": "behavior" + }, + { + "description": "Button state", + "name": "ButtonState", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "type": "stringWithSelector" } ], "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...)", + "label": "Multitouch 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": "A", + "type": "String", + "label": "Button identifier", + "name": "ButtonIdentifier" }, { "value": "0", "type": "Number", - "unit": "Pixel", - "label": "Z position offset", - "group": "Position", - "name": "OffsetZ" + "label": "TouchID", + "hidden": true, + "name": "TouchId" }, { - "value": "0", + "value": "", "type": "Number", - "unit": "AngularSpeed", - "label": "Current rotation speed Z", + "label": "", "hidden": true, - "name": "CurrentRotationSpeedZ" + "name": "TouchIndex" }, { - "value": "0", - "type": "Number", - "unit": "AngularSpeed", - "label": "Current rotation speed Y", + "value": "", + "type": "Boolean", + "label": "Button released", "hidden": true, - "name": "CurrentRotationSpeedY" + "name": "IsReleased" } ], "sharedPropertyDescriptors": [] }, { - "description": "Control a 3D physics car with a multitouch controller.", - "fullName": "3D car multitouch controller mapper", - "name": "PhysicsCar3DMultitouchMapper", + "description": "Control a platformer character with a multitouch controller.", + "fullName": "Platformer multitouch controller mapper", + "name": "PlatformerMultitouchMapper", "objectType": "", - "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -10076,14 +7707,13 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::StickForce" + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" }, "parameters": [ "", - ">", - "0", "ControllerIdentifier", - "SteerJoystickIdentifier", + "JoystickIdentifier", + "\"Left\"", "" ] } @@ -10091,12 +7721,11 @@ "actions": [ { "type": { - "value": "Physics3D::PhysicsCar3D::SimulateSteeringStick" + "value": "PlatformBehavior::SimulateLeftKey" }, "parameters": [ "Object", - "PhysicsCar3D", - "SpriteMultitouchJoystick::StickForceX(ControllerIdentifier, \"Primary\")" + "Property" ] } ] @@ -10106,14 +7735,78 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::StickForce" + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JoystickIdentifier", + "\"Right\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "PlatformBehavior::SimulateRightKey" + }, + "parameters": [ + "Object", + "Property" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JoystickIdentifier", + "\"Up\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "PlatformBehavior::SimulateUpKey" + }, + "parameters": [ + "Object", + "Property" + ] + }, + { + "type": { + "value": "PlatformBehavior::SimulateLadderKey" + }, + "parameters": [ + "Object", + "Property" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" }, "parameters": [ "", - ">", - "0", "ControllerIdentifier", - "SpeedJoystickIdentifier", + "JoystickIdentifier", + "\"Down\"", "" ] } @@ -10121,12 +7814,11 @@ "actions": [ { "type": { - "value": "Physics3D::PhysicsCar3D::SimulateAcceleratorStick" + "value": "PlatformBehavior::SimulateDownKey" }, "parameters": [ "Object", - "PhysicsCar3D", - "-SpriteMultitouchJoystick::StickForceY(ControllerIdentifier, \"Secondary\")" + "Property" ] } ] @@ -10141,7 +7833,7 @@ "parameters": [ "", "ControllerIdentifier", - "HandBrakeButton", + "JumpButton", "\"Down\"" ] } @@ -10149,11 +7841,11 @@ "actions": [ { "type": { - "value": "Physics3D::PhysicsCar3D::SimulateHandBrakeKey" + "value": "PlatformBehavior::SimulateJumpKey" }, "parameters": [ "Object", - "PhysicsCar3D" + "Property" ] } ] @@ -10168,7 +7860,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::PhysicsCar3DMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::PlatformerMultitouchMapper", "type": "behavior" } ], @@ -10179,12 +7871,12 @@ { "value": "", "type": "Behavior", - "label": "3D physics car", + "label": "Platform character behavior", "extraInformation": [ - "Physics3D::PhysicsCar3D" + "PlatformBehavior::PlatformerObjectBehavior" ], "choices": [], - "name": "PhysicsCar3D" + "name": "Property" }, { "value": "1", @@ -10195,24 +7887,7 @@ { "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", + "label": "Joystick name", "group": "Controls", "choices": [ { @@ -10224,14 +7899,14 @@ "value": "Secondary" } ], - "name": "SpeedJoystickIdentifier" + "name": "JoystickIdentifier" }, { - "value": "B", + "value": "A", "type": "String", - "label": "Hand brake button name", + "label": "Jump button name", "group": "Controls", - "name": "HandBrakeButton" + "name": "JumpButton" } ], "sharedPropertyDescriptors": [] @@ -10241,7 +7916,6 @@ "fullName": "Top-down multitouch controller mapper", "name": "TopDownMultitouchMapper", "objectType": "", - "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -10254,10 +7928,11 @@ "conditions": [ { "type": { - "value": "StringVariable" + "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" }, "parameters": [ - "StickMode", + "Object", + "Behavior", "=", "\"Analog\"" ] @@ -10282,10 +7957,11 @@ "conditions": [ { "type": { - "value": "StringVariable" + "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" }, "parameters": [ - "StickMode", + "Object", + "Behavior", "=", "\"360°\"" ] @@ -10310,10 +7986,11 @@ "conditions": [ { "type": { - "value": "StringVariable" + "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" }, "parameters": [ - "StickMode", + "Object", + "Behavior", "=", "\"8 Directions\"" ] @@ -10922,6 +8599,7 @@ } ], "instances": [], + "editionSettings": {}, "eventsFunctions": [ { "fullName": "", @@ -11040,90 +8718,17 @@ "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "conditions": [], + "actions": [ { "type": { - "inverted": true, - "value": "SpriteMultitouchJoystick::IsInGameEdition" + "value": "MettreAutour" }, "parameters": [ - "", - "" - ] - } - ], - "actions": [], - "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" - }, - "parameters": [ - "Object", - "no", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "ShouldBeHiddenWhenReleased", - "False", - "" - ] - } + "Thumb", + "Border", + "Border.MultitouchJoystick::JoystickForce() * Border.Width() / 2", + "Border.MultitouchJoystick::JoystickAngle()" ] } ] @@ -11191,7 +8796,7 @@ "Border", "MultitouchJoystick", "=", - "ControllerIdentifier", + "Object.PropertyControllerIdentifier()", "" ] }, @@ -11203,7 +8808,7 @@ "Border", "MultitouchJoystick", "=", - "JoystickIdentifier", + "Object.PropertyJoystickIdentifier()", "" ] }, @@ -11215,92 +8820,7 @@ "Border", "MultitouchJoystick", "=", - "DeadZoneRadius", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "supplementaryInformation": "SpriteMultitouchJoystick::SpriteMultitouchJoystick", - "type": "object" - } - ], - "objectGroups": [] - }, - { - "description": "Show the joystick until it is released.", - "fullName": "Show and start pressing", - "functionType": "Action", - "name": "TeleportAndPress", - "sentence": "Show _PARAM0_ at the cursor position and start pressing", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "HasAnyTouchOrMouseStarted" - }, - "parameters": [ - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "MettreXY" - }, - "parameters": [ - "Object", - "=", - "Object.ParentTouchX(StartedTouchOrMouseId(0))", - "=", - "Object.ParentTouchY(StartedTouchOrMouseId(0))" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::ActivateControl" - }, - "parameters": [ - "Object", - "yes", - "" - ] - }, - { - "type": { - "value": "Montre" - }, - "parameters": [ - "Object", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "ShouldBeHiddenWhenReleased", - "True", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::ForceStartPressing" - }, - "parameters": [ - "Border", - "MultitouchJoystick", - "StartedTouchOrMouseId(0)", + "Object.PropertyDeadZoneRadius()", "" ] } @@ -11317,92 +8837,6 @@ ], "objectGroups": [] }, - { - "description": "Return the X position of a specified touch", - "fullName": "Touch X position (on parent)", - "functionType": "Expression", - "name": "ParentTouchX", - "private": true, - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [] - }, - { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "const object = objects[0];", - "const touchId = eventsFunctionContext.getArgument(\"TouchId\");", - "eventsFunctionContext.returnValue = gdjs.evtTools.input.getTouchX(object.getInstanceContainer(), touchId, object.getLayer());" - ], - "parameterObjects": "Object", - "useStrict": true, - "eventsSheetExpanded": false - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "supplementaryInformation": "SpriteMultitouchJoystick::SpriteMultitouchJoystick", - "type": "object" - }, - { - "description": "Touch identifier", - "name": "TouchId", - "type": "expression" - } - ], - "objectGroups": [] - }, - { - "description": "Return the X position of a specified touch", - "fullName": "Touch X position (on parent)", - "functionType": "Expression", - "name": "ParentTouchY", - "private": true, - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [] - }, - { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "const object = objects[0];", - "const touchId = eventsFunctionContext.getArgument(\"TouchId\");", - "eventsFunctionContext.returnValue = gdjs.evtTools.input.getTouchY(object.getInstanceContainer(), touchId, object.getLayer());" - ], - "parameterObjects": "Object", - "useStrict": true, - "eventsSheetExpanded": false - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "supplementaryInformation": "SpriteMultitouchJoystick::SpriteMultitouchJoystick", - "type": "object" - }, - { - "description": "Touch identifier", - "name": "TouchId", - "type": "expression" - } - ], - "objectGroups": [] - }, { "description": "De/activate control of the joystick.", "fullName": "De/activate control", @@ -11416,12 +8850,10 @@ { "type": { "inverted": true, - "value": "BooleanVariable" + "value": "GetArgumentAsBoolean" }, "parameters": [ - "ShouldActivate", - "True", - "" + "\"ShouldActivate\"" ] } ], @@ -11443,12 +8875,10 @@ "conditions": [ { "type": { - "value": "BooleanVariable" + "value": "GetArgumentAsBoolean" }, "parameters": [ - "ShouldActivate", - "True", - "" + "\"ShouldActivate\"" ] } ], @@ -12122,15 +9552,9 @@ "description": "Only used by the scene editor.", "hidden": true, "name": "ParentOrigin" - }, - { - "value": "", - "type": "Boolean", - "label": "", - "hidden": true, - "name": "ShouldBeHiddenWhenReleased" } - ] + ], + "variants": [] } ] }, diff --git a/examples/starting-top-down-pixel/starting-top-down-pixel.json b/examples/starting-top-down-pixel/starting-top-down-pixel.json index 27809483b..e7f790870 100644 --- a/examples/starting-top-down-pixel/starting-top-down-pixel.json +++ b/examples/starting-top-down-pixel/starting-top-down-pixel.json @@ -783,9 +783,7 @@ "type": { "value": "DepartScene" }, - "parameters": [ - "" - ] + "parameters": [""] } ], "actions": [ @@ -793,12 +791,7 @@ "type": { "value": "ZoomCamera" }, - "parameters": [ - "", - "2", - "", - "" - ] + "parameters": ["", "2", "", ""] } ] }, @@ -810,21 +803,13 @@ "type": { "value": "SeparateFromObjects" }, - "parameters": [ - "TopDown_Character", - "Wall", - "" - ] + "parameters": ["TopDown_Character", "Wall", ""] }, { "type": { "value": "SeparateFromObjects" }, - "parameters": [ - "TopDown_Character", - "Plant", - "" - ] + "parameters": ["TopDown_Character", "Plant", ""] } ] } @@ -923,19 +908,18 @@ "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", + "version": "1.4.0", "description": [ - "Multitouch joysticks are objects showing a joystick on the screen, useful for mobile. They work like a physical gamepad:", + "Multitouch joysticks can be used the same way as physical gamepads:", "- 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.", + "- 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)." ], @@ -1000,33 +984,104 @@ ], "eventsFunctions": [ { - "description": "Check if the events are running for the editor.", - "fullName": "Editor is running", + "description": "Check if a button is pressed on a gamepad.", + "fullName": "Multitouch controller button pressed", "functionType": "Condition", - "name": "IsInGameEdition", - "private": true, - "sentence": "Events are running for the editor", + "name": "IsButtonPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", "events": [ { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "const game = runtimeScene.getGame();\r", - "eventsFunctionContext.returnValue = game.isInGameEdition && game.isInGameEdition();" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"Pressed\"" + ] + } ], - "parameterObjects": "", - "useStrict": true, - "eventsSheetExpanded": false + "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" } ], - "parameters": [], "objectGroups": [] }, { - "fullName": "Accelerated speed", - "functionType": "Expression", - "name": "AcceleratedSpeed", + "description": "Check if a button is released on a gamepad.", + "fullName": "Multitouch controller button released", + "functionType": "Condition", + "name": "IsButtonReleased", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is released", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"Released\"" + ] + } + ], + "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": "Change a button state for a multitouch controller.", + "fullName": "Button state", + "functionType": "Action", + "name": "SetButtonState", "private": true, - "sentence": "", + "sentence": "Mark _PARAM2_ button as _PARAM3_ for multitouch controller _PARAM1_", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -1034,443 +1089,108 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SetStringVariable" }, "parameters": [ - "AcceleratedSpeed", + "Controllers[ControllerIdentifier].Buttons[Button].State", "=", - "CurrentSpeed" + "ButtonState" ] } - ], - "events": [ + ] + } + ], + "parameters": [ + { + "description": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier", + "type": "expression" + }, + { + "description": "Button name", + "name": "Button", + "type": "string" + }, + { + "description": "Button state", + "name": "ButtonState", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "type": "stringWithSelector" + } + ], + "objectGroups": [] + }, + { + "description": "Change the dead zone radius of a joystick. 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).", + "fullName": "Dead zone radius", + "functionType": "Action", + "name": "SetDeadZone", + "private": true, + "sentence": "Change the dead zone of multitouch joystick _PARAM2_ of multitouch controller _PARAM1_ to _PARAM3_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ { - "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", - "=", - "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": { + "value": "SetNumberVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].DeadZone", + "=", + "DeadZoneRadius" ] - }, - { - "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": "NumberVariable" - }, - "parameters": [ - "TargetedSpeed", - "=", - "0" - ] - } - ], - "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", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "clamp(AcceleratedSpeed, -SpeedMax, SpeedMax)" - ] - } - ] - } - ], - "variables": [ - { - "name": "AcceleratedSpeed", - "type": "number", - "value": 0 } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { - "description": "Current speed", - "name": "CurrentSpeed", - "type": "expression" - }, - { - "description": "Targeted speed", - "name": "TargetedSpeed", - "type": "expression" - }, - { - "description": "Max speed", - "name": "SpeedMax", + "description": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier", "type": "expression" }, { - "description": "Acceleration", - "name": "Acceleration", - "type": "expression" + "description": "Joystick name", + "name": "JoystickIdentifier", + "type": "string" }, { - "description": "Deceleration", - "name": "Deceleration", + "description": "Dead zone radius", + "name": "DeadZoneRadius", + "supplementaryInformation": "[]", "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", + "description": "Return the dead zone radius of a joystick. 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).", + "fullName": "Dead zone radius", + "functionType": "Expression", + "name": "DeadZone", + "private": true, + "sentence": "Change multitouch joystick _PARAM2_ of multitouch controller _PARAM1_ dead zone to _PARAM3_", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Buttons[Button].State", - "=", - "\"JustPressed\"" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "SetReturnBoolean" + "value": "SetReturnNumber" }, "parameters": [ - "True" + "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].DeadZone" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Multitouch controller identifier (1, 2, 3, 4...)", @@ -1478,277 +1198,30 @@ "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\"]", + "description": "Joystick name", + "name": "JoystickIdentifier", "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", + "description": "the direction index (left = 1, bottom = 1, right = 2, top = 3) for an angle (in degrees).", + "fullName": "Angle to 4-way index", + "functionType": "ExpressionAndCondition", + "name": "AngleTo4Way", + "private": true, + "sentence": "The angle _PARAM1_ 4-way index", "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\"" - ] - } - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "SetReturnBoolean" + "value": "SetReturnNumber" }, - "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", - "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is released", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Buttons[Button].State", - "=", - "\"Released\"" - ] - } - ], - "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": "Change a button state for a multitouch controller.", - "fullName": "Button state", - "functionType": "Action", - "name": "SetButtonState", - "private": true, - "sentence": "Mark _PARAM2_ button as _PARAM3_ for multitouch controller _PARAM1_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetStringVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Buttons[Button].State", - "=", - "ButtonState" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" - }, - { - "description": "Button name", - "name": "Button", - "type": "string" - }, - { - "description": "Button state", - "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"JustPressed\",\"Released\"]", - "type": "stringWithSelector" - } - ], - "objectGroups": [] - }, - { - "description": "Change the dead zone radius of a joystick. 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).", - "fullName": "Dead zone radius", - "functionType": "Action", - "name": "SetDeadZone", - "private": true, - "sentence": "Change the dead zone of multitouch joystick _PARAM2_ of multitouch controller _PARAM1_ to _PARAM3_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].DeadZone", - "=", - "DeadZoneRadius" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" - }, - { - "description": "Joystick name", - "name": "JoystickIdentifier", - "type": "string" - }, - { - "description": "Dead zone radius", - "name": "DeadZoneRadius", - "supplementaryInformation": "[]", - "type": "expression" - } - ], - "objectGroups": [] - }, - { - "description": "Return the dead zone radius of a joystick. 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).", - "fullName": "Dead zone radius", - "functionType": "Expression", - "name": "DeadZone", - "private": true, - "sentence": "Change multitouch joystick _PARAM2_ of multitouch controller _PARAM1_ dead zone to _PARAM3_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].DeadZone" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" - }, - { - "description": "Joystick name", - "name": "JoystickIdentifier", - "type": "string" - } - ], - "objectGroups": [] - }, - { - "description": "the direction index (left = 1, bottom = 1, right = 2, top = 3) for an angle (in degrees).", - "fullName": "Angle to 4-way index", - "functionType": "ExpressionAndCondition", - "name": "AngleTo4Way", - "private": true, - "sentence": "The angle _PARAM1_ 4-way index", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "mod(round(Angle * 4 / 360), 4)" - ] + "parameters": ["mod(round(Angle * 4 / 360), 4)"] } ] } @@ -1781,9 +1254,7 @@ "type": { "value": "SetReturnNumber" }, - "parameters": [ - "mod(round(Angle * 8 / 360), 8)" - ] + "parameters": ["mod(round(Angle * 8 / 360), 8)"] } ] } @@ -1815,23 +1286,13 @@ "type": { "value": "BuiltinCommonInstructions::CompareStrings" }, - "parameters": [ - "Direction", - "=", - "\"Right\"" - ] + "parameters": ["Direction", "=", "\"Right\""] }, { "type": { "value": "SpriteMultitouchJoystick::AngleTo4Way" }, - "parameters": [ - "", - "=", - "0", - "Angle", - "" - ] + "parameters": ["", "=", "0", "Angle", ""] } ], "actions": [ @@ -1839,9 +1300,7 @@ "type": { "value": "SetReturnBoolean" }, - "parameters": [ - "True" - ] + "parameters": ["True"] } ] }, @@ -1852,23 +1311,13 @@ "type": { "value": "BuiltinCommonInstructions::CompareStrings" }, - "parameters": [ - "Direction", - "=", - "\"Down\"" - ] + "parameters": ["Direction", "=", "\"Down\""] }, { "type": { "value": "SpriteMultitouchJoystick::AngleTo4Way" }, - "parameters": [ - "", - "=", - "1", - "Angle", - "" - ] + "parameters": ["", "=", "1", "Angle", ""] } ], "actions": [ @@ -1876,9 +1325,7 @@ "type": { "value": "SetReturnBoolean" }, - "parameters": [ - "True" - ] + "parameters": ["True"] } ] }, @@ -1889,23 +1336,13 @@ "type": { "value": "BuiltinCommonInstructions::CompareStrings" }, - "parameters": [ - "Direction", - "=", - "\"Left\"" - ] + "parameters": ["Direction", "=", "\"Left\""] }, { "type": { "value": "SpriteMultitouchJoystick::AngleTo4Way" }, - "parameters": [ - "", - "=", - "2", - "Angle", - "" - ] + "parameters": ["", "=", "2", "Angle", ""] } ], "actions": [ @@ -1913,9 +1350,7 @@ "type": { "value": "SetReturnBoolean" }, - "parameters": [ - "True" - ] + "parameters": ["True"] } ] }, @@ -1926,23 +1361,13 @@ "type": { "value": "BuiltinCommonInstructions::CompareStrings" }, - "parameters": [ - "Direction", - "=", - "\"Up\"" - ] + "parameters": ["Direction", "=", "\"Up\""] }, { "type": { "value": "SpriteMultitouchJoystick::AngleTo4Way" }, - "parameters": [ - "", - "=", - "3", - "Angle", - "" - ] + "parameters": ["", "=", "3", "Angle", ""] } ], "actions": [ @@ -1950,9 +1375,7 @@ "type": { "value": "SetReturnBoolean" }, - "parameters": [ - "True" - ] + "parameters": ["True"] } ] } @@ -1987,23 +1410,13 @@ "type": { "value": "BuiltinCommonInstructions::CompareStrings" }, - "parameters": [ - "Direction", - "=", - "\"Right\"" - ] + "parameters": ["Direction", "=", "\"Right\""] }, { "type": { "value": "SpriteMultitouchJoystick::AngleTo8Way" }, - "parameters": [ - "", - "=", - "0", - "Angle", - "" - ] + "parameters": ["", "=", "0", "Angle", ""] } ], "actions": [ @@ -2011,9 +1424,7 @@ "type": { "value": "SetReturnBoolean" }, - "parameters": [ - "True" - ] + "parameters": ["True"] } ] }, @@ -2024,23 +1435,13 @@ "type": { "value": "BuiltinCommonInstructions::CompareStrings" }, - "parameters": [ - "Direction", - "=", - "\"DownRight\"" - ] + "parameters": ["Direction", "=", "\"DownRight\""] }, { "type": { "value": "SpriteMultitouchJoystick::AngleTo8Way" }, - "parameters": [ - "", - "=", - "1", - "Angle", - "" - ] + "parameters": ["", "=", "1", "Angle", ""] } ], "actions": [ @@ -2048,9 +1449,7 @@ "type": { "value": "SetReturnBoolean" }, - "parameters": [ - "True" - ] + "parameters": ["True"] } ] }, @@ -2061,23 +1460,13 @@ "type": { "value": "BuiltinCommonInstructions::CompareStrings" }, - "parameters": [ - "Direction", - "=", - "\"Down\"" - ] + "parameters": ["Direction", "=", "\"Down\""] }, { "type": { "value": "SpriteMultitouchJoystick::AngleTo8Way" }, - "parameters": [ - "", - "=", - "2", - "Angle", - "" - ] + "parameters": ["", "=", "2", "Angle", ""] } ], "actions": [ @@ -2085,9 +1474,7 @@ "type": { "value": "SetReturnBoolean" }, - "parameters": [ - "True" - ] + "parameters": ["True"] } ] }, @@ -2098,23 +1485,13 @@ "type": { "value": "BuiltinCommonInstructions::CompareStrings" }, - "parameters": [ - "Direction", - "=", - "\"DownLeft\"" - ] + "parameters": ["Direction", "=", "\"DownLeft\""] }, { "type": { "value": "SpriteMultitouchJoystick::AngleTo8Way" }, - "parameters": [ - "", - "=", - "3", - "Angle", - "" - ] + "parameters": ["", "=", "3", "Angle", ""] } ], "actions": [ @@ -2122,9 +1499,7 @@ "type": { "value": "SetReturnBoolean" }, - "parameters": [ - "True" - ] + "parameters": ["True"] } ] }, @@ -2135,23 +1510,13 @@ "type": { "value": "BuiltinCommonInstructions::CompareStrings" }, - "parameters": [ - "Direction", - "=", - "\"Left\"" - ] + "parameters": ["Direction", "=", "\"Left\""] }, { "type": { "value": "SpriteMultitouchJoystick::AngleTo8Way" }, - "parameters": [ - "", - "=", - "4", - "Angle", - "" - ] + "parameters": ["", "=", "4", "Angle", ""] } ], "actions": [ @@ -2159,9 +1524,7 @@ "type": { "value": "SetReturnBoolean" }, - "parameters": [ - "True" - ] + "parameters": ["True"] } ] }, @@ -2172,23 +1535,13 @@ "type": { "value": "BuiltinCommonInstructions::CompareStrings" }, - "parameters": [ - "Direction", - "=", - "\"UpLeft\"" - ] + "parameters": ["Direction", "=", "\"UpLeft\""] }, { "type": { "value": "SpriteMultitouchJoystick::AngleTo8Way" }, - "parameters": [ - "", - "=", - "5", - "Angle", - "" - ] + "parameters": ["", "=", "5", "Angle", ""] } ], "actions": [ @@ -2196,9 +1549,7 @@ "type": { "value": "SetReturnBoolean" }, - "parameters": [ - "True" - ] + "parameters": ["True"] } ] }, @@ -2209,23 +1560,13 @@ "type": { "value": "BuiltinCommonInstructions::CompareStrings" }, - "parameters": [ - "Direction", - "=", - "\"Up\"" - ] + "parameters": ["Direction", "=", "\"Up\""] }, { "type": { "value": "SpriteMultitouchJoystick::AngleTo8Way" }, - "parameters": [ - "", - "=", - "6", - "Angle", - "" - ] + "parameters": ["", "=", "6", "Angle", ""] } ], "actions": [ @@ -2233,9 +1574,7 @@ "type": { "value": "SetReturnBoolean" }, - "parameters": [ - "True" - ] + "parameters": ["True"] } ] }, @@ -2246,23 +1585,13 @@ "type": { "value": "BuiltinCommonInstructions::CompareStrings" }, - "parameters": [ - "Direction", - "=", - "\"UpRight\"" - ] + "parameters": ["Direction", "=", "\"UpRight\""] }, { "type": { "value": "SpriteMultitouchJoystick::AngleTo8Way" }, - "parameters": [ - "", - "=", - "7", - "Angle", - "" - ] + "parameters": ["", "=", "7", "Angle", ""] } ], "actions": [ @@ -2270,9 +1599,7 @@ "type": { "value": "SetReturnBoolean" }, - "parameters": [ - "True" - ] + "parameters": ["True"] } ] } @@ -2344,9 +1671,7 @@ "type": { "value": "SetReturnBoolean" }, - "parameters": [ - "True" - ] + "parameters": ["True"] } ] } @@ -2424,9 +1749,7 @@ "type": { "value": "SetReturnBoolean" }, - "parameters": [ - "True" - ] + "parameters": ["True"] } ] } @@ -2489,11 +1812,6 @@ "name": "JoystickIdentifier", "supplementaryInformation": "[\"Primary\",\"Secondary\"]", "type": "stringWithSelector" - }, - { - "description": "", - "name": "Coucou", - "type": "expression" } ], "objectGroups": [] @@ -2723,7 +2041,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "XFromAngleAndDistance(SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier), SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier))" + "SpriteMultitouchJoystick::JoystickForce(ControllerIdentifier, JoystickIdentifier) * cos(ToRad(SpriteMultitouchJoystick::JoystickAngle(ControllerIdentifier, JoystickIdentifier)))" ] } ] @@ -2763,7 +2081,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "YFromAngleAndDistance(SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier), SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier))" + "SpriteMultitouchJoystick::JoystickForce(ControllerIdentifier, JoystickIdentifier) * sin(ToRad(SpriteMultitouchJoystick::JoystickAngle(ControllerIdentifier, JoystickIdentifier)))" ] } ] @@ -2786,123 +2104,6 @@ } ], "objectGroups": [] - }, - { - "description": "Check if a new touch has started on the right or left side of the screen.", - "fullName": "New touch on a screen side", - "functionType": "Condition", - "group": "Multitouch Joystick", - "name": "HasTouchStartedOnScreenSide", - "sentence": "A new touch has started on the _PARAM2_ side of the screen on _PARAM1_'s layer", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "HasAnyTouchOrMouseStarted" - }, - "parameters": [ - "" - ] - } - ], - "actions": [], - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "Side", - "=", - "\"Left\"" - ] - }, - { - "type": { - "value": "TouchX" - }, - "parameters": [ - "", - "StartedTouchOrMouseId(0)", - "<", - "CameraCenterX(Object.Layer())", - "Object.Layer()", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "Side", - "=", - "\"Right\"" - ] - }, - { - "type": { - "value": "TouchX" - }, - "parameters": [ - "", - "StartedTouchOrMouseId(0)", - ">=", - "CameraCenterX(Object.Layer())", - "Object.Layer()", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - } - ] - } - ], - "parameters": [ - { - "description": "Multitouch joystick", - "name": "Object", - "supplementaryInformation": "SpriteMultitouchJoystick::SpriteMultitouchJoystick", - "type": "objectList" - }, - { - "description": "Screen side", - "name": "Side", - "supplementaryInformation": "[\"Left\",\"Right\"]", - "type": "stringWithSelector" - } - ], - "objectGroups": [] } ], "eventsBasedBehaviors": [ @@ -2916,1626 +2117,30 @@ { "fullName": "", "functionType": "Action", - "name": "onCreated", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::SetDeadZone" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "DeadZoneRadius", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "Action", - "name": "onDeActivate", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "Action", - "name": "doStepPreEvents", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "inverted": true, - "value": "SpriteMultitouchJoystick::IsInGameEdition" - }, - "parameters": [ - "", - "" - ] - } - ], - "actions": [], - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "HasGameJustResumed" - }, - "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)" - }, - { - "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": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "the joystick force (from 0 to 1).", - "fullName": "Joystick force", - "functionType": "ExpressionAndCondition", - "name": "JoystickForce", - "sentence": "the joystick force", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "max(0, JoystickForce - DeadZoneRadius) / (1 - DeadZoneRadius)" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "JoystickForce", - "name": "SetJoystickForce", - "private": true, - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "JoystickForce", - "=", - "Value" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::SetJoystickForce" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "JoystickForce", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - }, - { - "description": "", - "name": "Parameter", - "type": "objectList" - } - ], - "objectGroups": [] - }, - { - "description": "Return the angle the joystick is pointing towards (Range: -180 to 180).", - "fullName": "Joystick angle", - "functionType": "Expression", - "name": "JoystickAngle", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "JoystickAngle" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "Change the angle the joystick is pointing towards (Range: -180 to 180).", - "fullName": "Joystick angle", - "functionType": "Action", - "name": "SetJoystickAngle", - "private": true, - "sentence": "Change the joystick angle of _PARAM0_ to _PARAM2_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "JoystickAngle", - "=", - "Value" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::SetJoystickAngle" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "JoystickAngle", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - }, - { - "description": "Angle", - "name": "Value", - "type": "expression" - } - ], - "objectGroups": [] - }, - { - "description": "Return the stick force on X axis (from -1 at the left to 1 at the right).", - "fullName": "Stick X force", - "functionType": "Expression", - "name": "StickForceX", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "Object.Behavior::JoystickForce() * cos(ToRad(Object.Behavior::JoystickAngle()))" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "Return the stick force on Y axis (from -1 at the top to 1 at the bottom).", - "fullName": "Stick Y force", - "functionType": "Expression", - "name": "StickForceY", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "Object.Behavior::JoystickForce() * sin(ToRad(Object.Behavior::JoystickAngle()))" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "Check if joystick is pushed in a given direction.", - "fullName": "Joystick pushed in a direction (4-way movement)", - "functionType": "Condition", - "name": "IsDirectionPushed4Way", - "sentence": "_PARAM0_ is pushed in direction _PARAM2_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::JoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - ">", - "0", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::IsAngleIn4WayDirection" - }, - "parameters": [ - "", - "JoystickAngle", - "Direction", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - }, - { - "description": "Direction", - "name": "Direction", - "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\"]", - "type": "stringWithSelector" - } - ], - "objectGroups": [] - }, - { - "description": "Check if joystick is pushed in a given direction.", - "fullName": "Joystick pushed in a direction (8-way movement)", - "functionType": "Condition", - "name": "IsDirectionPushed8Way", - "sentence": "_PARAM0_ is pushed in direction _PARAM2_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::JoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - ">", - "0", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::IsAngleIn8WayDirection" - }, - "parameters": [ - "", - "JoystickAngle", - "Direction", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - }, - { - "description": "Direction", - "name": "Direction", - "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\",\"UpLeft\",\"UpRight\",\"DownLeft\",\"DownRight\"]", - "type": "stringWithSelector" - } - ], - "objectGroups": [] - }, - { - "description": "Check if a joystick is pressed.", - "fullName": "Joystick pressed", - "functionType": "Condition", - "name": "IsPressed", - "sentence": "Joystick _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::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "Reset the joystick values (except for angle, which stays the same)", - "fullName": "Reset", - "functionType": "Action", - "name": "Reset", - "private": true, - "sentence": "Reset the joystick of _PARAM0_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "0", - "" - ] - }, - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "0" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "the multitouch controller identifier.", - "fullName": "Multitouch controller identifier", - "functionType": "ExpressionAndCondition", - "group": "Multitouch Joystick configuration", - "name": "ControllerIdentifier", - "sentence": "the multitouch controller identifier", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "ControllerIdentifier" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "ControllerIdentifier", - "name": "SetControllerIdentifier", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "ControllerIdentifier", - "=", - "Value" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "the joystick name.", - "fullName": "Joystick name", - "functionType": "ExpressionAndCondition", - "group": "Multitouch Joystick configuration", - "name": "JoystickIdentifier", - "sentence": "the joystick name", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnString" - }, - "parameters": [ - "JoystickIdentifier" - ] - } - ] - } - ], - "expressionType": { - "type": "string" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "JoystickIdentifier", - "name": "SetJoystickIdentifier", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetStringVariable" - }, - "parameters": [ - "JoystickIdentifier", - "=", - "Value" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "the dead zone radius (range: 0 to 1) of the joystick. 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).", - "fullName": "Dead zone radius", - "functionType": "ExpressionAndCondition", - "group": "Multitouch Joystick configuration", - "name": "DeadZoneRadius", - "sentence": "the dead zone radius", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "DeadZoneRadius" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "DeadZoneRadius", - "name": "SetDeadZoneRadius", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "DeadZoneRadius", - "=", - "Value" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::SetDeadZone" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "Value", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "Force the joystick into the pressing state.", - "fullName": "Force start pressing", - "functionType": "Action", - "name": "ForceStartPressing", - "sentence": "Force start pressing _PARAM0_ with touch identifier: _PARAM2_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "Value" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - }, - { - "description": "Touch identifier", - "name": "Value", - "type": "expression" - } - ], - "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "1", - "type": "Number", - "label": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier" - }, - { - "value": "Primary", - "type": "String", - "label": "Joystick name", - "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": "0", - "type": "Number", - "label": "Joystick angle (range: -180 to 180)", - "hidden": true, - "name": "JoystickAngle" - }, - { - "value": "0", - "type": "Number", - "label": "Joystick force (range: 0 to 1)", - "hidden": true, - "name": "JoystickForce" - }, - { - "value": "0", - "type": "Number", - "label": "", - "hidden": true, - "name": "TouchId" - }, - { - "value": "", - "type": "Number", - "label": "", - "hidden": true, - "name": "TouchIndex" - } - ], - "sharedPropertyDescriptors": [] - }, - { - "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": "", - "eventsFunctions": [ - { - "fullName": "", - "functionType": "Action", - "name": "doStepPreEvents", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "IsReleased", - "True", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsReleased", - "False", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" - }, - "parameters": [ - "Object", - "Behavior", - "\"Idle\"", - "" - ] - } - ] - }, - { - "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": [ - { - "type": { - "inverted": true, - "value": "SpriteMultitouchJoystick::MultitouchButton::IsPressed" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - }, - { - "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": "BuiltinCommonInstructions::Or" - }, - "parameters": [], - "subInstructions": [ - { - "type": { - "value": "CollisionPoint" - }, - "parameters": [ - "Object", - "TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer())", - "TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer())" - ] - }, - { - "type": { - "value": "NumberVariable" - }, - "parameters": [ - "Radius", - ">", - "DistanceBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer()), TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer()))" - ] - } - ] - } - ], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "StartedTouchOrMouseId(TouchIndex)" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" - }, - "parameters": [ - "Object", - "Behavior", - "\"JustPressed\"", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "True", - "" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchIndex", - "+", - "1" - ] - } - ] - } - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::IsPressed" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - }, - { - "type": { - "value": "HasTouchEnded" - }, - "parameters": [ - "", - "TouchId" - ] - } - ], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" - }, - "parameters": [ - "Object", - "Behavior", - "\"Released\"", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsReleased", - "True", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "False", - "" - ] - }, - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "0" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "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", - "sentence": "Button _PARAM0_ is released", + "name": "onCreated", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "conditions": [], + "actions": [ { "type": { - "value": "BooleanVariable" + "value": "SpriteMultitouchJoystick::SetDeadZone" }, "parameters": [ - "IsReleased", - "True", + "", + "ControllerIdentifier", + "JoystickIdentifier", + "DeadZoneRadius", "" ] - } - ], - "actions": [ + }, { "type": { - "value": "SetReturnBoolean" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" }, - "parameters": [ - "True" - ] + "parameters": ["Object", "Behavior", ""] } ] } @@ -4549,18 +2154,17 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] }, { - "fullName": "Button state", + "fullName": "", "functionType": "Action", - "name": "SetButtonState", - "private": true, - "sentence": "Mark the button _PARAM0_ as _PARAM2_", + "name": "onDeActivate", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -4568,15 +2172,9 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::SetButtonState" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" }, - "parameters": [ - "", - "ControllerIdentifier", - "ButtonIdentifier", - "ButtonState", - "" - ] + "parameters": ["Object", "Behavior", ""] } ] } @@ -4590,78 +2188,12 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" - }, - { - "description": "Button state", - "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"JustPressed\",\"Pressed\",\"Released\"]", - "type": "stringWithSelector" } ], "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "1", - "type": "Number", - "label": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier" - }, - { - "value": "A", - "type": "String", - "label": "Button identifier", - "name": "ButtonIdentifier" - }, - { - "value": "0", - "type": "Number", - "label": "TouchID", - "hidden": true, - "name": "TouchId" }, - { - "value": "", - "type": "Number", - "label": "", - "hidden": true, - "name": "TouchIndex" - }, - { - "value": "", - "type": "Boolean", - "label": "Button released", - "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.", - "name": "Radius" - } - ], - "sharedPropertyDescriptors": [] - }, - { - "description": "Control a platformer character with a multitouch controller.", - "fullName": "Platformer multitouch controller mapper", - "name": "PlatformerMultitouchMapper", - "objectType": "", - "quickCustomizationVisibility": "hidden", - "eventsFunctions": [ { "fullName": "", "functionType": "Action", @@ -4673,148 +2205,185 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "\"Left\"", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateLeftKey" - }, - "parameters": [ - "Object", - "Property" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" + "value": "HasGameJustResumed" }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "\"Right\"", - "" - ] + "parameters": [""] } ], "actions": [ { "type": { - "value": "PlatformBehavior::SimulateRightKey" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" }, - "parameters": [ - "Object", - "Property" - ] + "parameters": ["Object", "Behavior", ""] } ] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "\"Up\"", - "" - ] - } - ], - "actions": [ + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Manage touches", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ { - "type": { - "value": "PlatformBehavior::SimulateUpKey" - }, - "parameters": [ - "Object", - "Property" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "HasAnyTouchOrMouseStarted" + }, + "parameters": [""] + } + ], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyTouchIndex" + }, + "parameters": ["Object", "Behavior", "=", "0"] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "StartedTouchOrMouseCount()", + "conditions": [], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::PropertyTouchId" + }, + "parameters": ["Object", "Behavior", "=", "0"] + }, + { + "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": { - "value": "PlatformBehavior::SimulateLadderKey" - }, - "parameters": [ - "Object", - "Property" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "\"Down\"", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateDownKey" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 }, - "parameters": [ - "Object", - "Property" + "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" + }, + "parameters": ["Object", "Behavior", ""] + } ] } - ] + ], + "parameters": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Update joystick position", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::IsButtonPressed" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JumpButton", - "\"Down\"" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::PropertyTouchId" + }, + "parameters": ["Object", "Behavior", "!=", "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": "PlatformBehavior::SimulateJumpKey" - }, - "parameters": [ - "Object", - "Property" - ] - } - ] + "parameters": [] } ], "parameters": [ @@ -4826,140 +2395,37 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::PlatformerMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "", - "type": "Behavior", - "label": "Platform character behavior", - "extraInformation": [ - "PlatformBehavior::PlatformerObjectBehavior" - ], - "choices": [], - "name": "Property" - }, - { - "value": "1", - "type": "Number", - "label": "Controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier" - }, - { - "value": "Primary", - "type": "Choice", - "label": "Joystick name", - "group": "Controls", - "choices": [ - { - "label": "Primary", - "value": "Primary" - }, - { - "label": "Secondary", - "value": "Secondary" - } - ], - "name": "JoystickIdentifier" }, { - "value": "A", - "type": "String", - "label": "Jump button name", - "group": "Controls", - "name": "JumpButton" - } - ], - "sharedPropertyDescriptors": [] - }, - { - "description": "Control a 3D physics character with a multitouch controller.", - "fullName": "3D platformer multitouch controller mapper", - "name": "Platformer3DMultitouchMapper", - "objectType": "", - "quickCustomizationVisibility": "hidden", - "eventsFunctions": [ - { - "fullName": "", - "functionType": "Action", - "name": "doStepPreEvents", - "sentence": "", + "description": "the joystick force (from 0 to 1).", + "fullName": "Joystick force", + "functionType": "ExpressionAndCondition", + "name": "JoystickForce", + "sentence": "the joystick force", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::StickForce" - }, - "parameters": [ - "", - ">", - "0", - "ControllerIdentifier", - "JoystickIdentifier", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "Physics3D::PhysicsCharacter3D::SetForwardAngle" - }, - "parameters": [ - "Object", - "PhysicsCharacter3D", - "=", - "SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier) + CameraAngle(Object.Layer())" - ] - }, - { - "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateStick" - }, - "parameters": [ - "Object", - "PhysicsCharacter3D", - "-90", - "SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier)" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::IsButtonPressed" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JumpButton", - "\"Down\"" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" + "value": "SetReturnNumber" }, "parameters": [ - "Object", - "PhysicsCharacter3D" + "max(0, JoystickForce - DeadZoneRadius) / (1 - DeadZoneRadius)" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -4969,124 +2435,40 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::Platformer3DMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "", - "type": "Behavior", - "label": "3D physics character", - "extraInformation": [ - "Physics3D::PhysicsCharacter3D" - ], - "choices": [], - "name": "PhysicsCharacter3D" }, - { - "value": "1", - "type": "Number", - "label": "Controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier" - }, - { - "value": "Primary", - "type": "Choice", - "label": "Walk joystick", - "group": "Controls", - "choices": [ - { - "label": "Primary", - "value": "Primary" - }, - { - "label": "Secondary", - "value": "Secondary" - } - ], - "name": "JoystickIdentifier" - }, - { - "value": "A", - "type": "String", - "label": "Jump button name", - "group": "Controls", - "name": "JumpButton" - } - ], - "sharedPropertyDescriptors": [] - }, - { - "description": "Control a 3D physics character with a multitouch controller.", - "fullName": "3D shooter multitouch controller mapper", - "name": "Shooter3DMultitouchMapper", - "objectType": "", - "quickCustomizationVisibility": "hidden", - "eventsFunctions": [ { "fullName": "", - "functionType": "Action", - "name": "doStepPreEvents", + "functionType": "ActionWithOperator", + "getterName": "JoystickForce", + "name": "SetJoystickForce", + "private": true, "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::StickForce" - }, - "parameters": [ - "", - ">", - "0", - "ControllerIdentifier", - "JoystickIdentifier", - "" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateStick" - }, - "parameters": [ - "Object", - "PhysicsCharacter3D", - "SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier)", - "SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier)" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::IsButtonPressed" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickForce" }, - "parameters": [ - "", - "ControllerIdentifier", - "JumpButton", - "\"Down\"" - ] - } - ], - "actions": [ + "parameters": ["Object", "Behavior", "=", "Value"] + }, { "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" + "value": "SpriteMultitouchJoystick::SetJoystickForce" }, "parameters": [ - "Object", - "PhysicsCharacter3D" + "", + "ControllerIdentifier", + "JoystickIdentifier", + "JoystickForce", + "" ] } ] @@ -5101,151 +2483,35 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::Shooter3DMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "", - "type": "Behavior", - "label": "3D physics character", - "extraInformation": [ - "Physics3D::PhysicsCharacter3D" - ], - "choices": [], - "name": "PhysicsCharacter3D" - }, - { - "value": "1", - "type": "Number", - "label": "Controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier" - }, - { - "value": "Primary", - "type": "Choice", - "label": "Walk joystick", - "group": "Controls", - "choices": [ - { - "label": "Primary", - "value": "Primary" - }, - { - "label": "Secondary", - "value": "Secondary" - } - ], - "name": "JoystickIdentifier" }, { - "value": "A", - "type": "String", - "label": "Jump button name", - "group": "Controls", - "name": "JumpButton" - } - ], - "sharedPropertyDescriptors": [] - }, - { - "description": "Control camera rotations with a multitouch controller.", - "fullName": "First person camera multitouch controller mapper", - "name": "FirstPersonMultitouchMapper", - "objectType": "", - "quickCustomizationVisibility": "hidden", - "eventsFunctions": [ - { - "fullName": "", - "functionType": "Action", - "name": "doStepPreEvents", + "description": "Return the angle the joystick is pointing towards (Range: -180 to 180).", + "fullName": "Joystick angle", + "functionType": "Expression", + "name": "JoystickAngle", "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", - "=", - "SpriteMultitouchJoystick::AcceleratedSpeed(CurrentRotationSpeedZ, SpriteMultitouchJoystick::StickForceX(ControllerIdentifier, CameraStick) * HorizontalRotationSpeedMax, HorizontalRotationSpeedMax, HorizontalRotationAcceleration, HorizontalRotationDeceleration)" - ] - }, - { - "type": { - "value": "SetAngle" - }, - "parameters": [ - "Object", - "+", - "CurrentRotationSpeedZ * TimeDelta()" - ] - }, - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "CurrentRotationSpeedY", - "=", - "SpriteMultitouchJoystick::AcceleratedSpeed(CurrentRotationSpeedY, SpriteMultitouchJoystick::StickForceY(ControllerIdentifier, 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": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper::LookFromObjectEyes" + "value": "SetReturnNumber" }, - "parameters": [ - "Object", - "Behavior", - "" - ] + "parameters": ["JoystickAngle"] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -5255,20 +2521,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "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", + "description": "Change the angle the joystick is pointing towards (Range: -180 to 180).", + "fullName": "Joystick angle", "functionType": "Action", - "group": "Layers and cameras", - "name": "LookFromObjectEyes", + "name": "SetJoystickAngle", "private": true, - "sentence": "Move the camera to look though _PARAM0_ eyes", + "sentence": "Change the joystick angle of _PARAM0_ to _PARAM2_", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -5276,61 +2541,19 @@ "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" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickAngle" }, - "parameters": [ - "", - "=", - "Object.Object3D::RotationX()", - "GetArgumentAsString(\"Layer\")", - "" - ] + "parameters": ["Object", "Behavior", "=", "Value"] }, { "type": { - "value": "SetCameraAngle" + "value": "SpriteMultitouchJoystick::SetJoystickAngle" }, "parameters": [ "", - "=", - "Object.Angle() + 90", - "Object.Layer()", + "ControllerIdentifier", + "JoystickIdentifier", + "JoystickAngle", "" ] } @@ -5346,19 +2569,23 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" + }, + { + "description": "Angle", + "name": "Value", + "type": "expression" } ], "objectGroups": [] }, { - "description": "the maximum horizontal rotation speed of the object.", - "fullName": "Maximum horizontal rotation speed", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper horizontal rotation configuration", - "name": "HorizontalRotationSpeedMax", - "sentence": "the maximum horizontal rotation speed", + "description": "Return the stick force on X axis (from -1 at the left to 1 at the right).", + "fullName": "Stick X force", + "functionType": "Expression", + "name": "StickForceX", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -5369,7 +2596,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "HorizontalRotationSpeedMax" + "Object.Behavior::JoystickForce() * cos(ToRad(Object.Behavior::JoystickAngle()))" ] } ] @@ -5387,17 +2614,17 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] }, { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "HorizontalRotationSpeedMax", - "name": "SetHorizontalRotationSpeedMax", + "description": "Return the stick force on Y axis (from -1 at the top to 1 at the bottom).", + "fullName": "Stick Y force", + "functionType": "Expression", + "name": "StickForceY", "sentence": "", "events": [ { @@ -5406,17 +2633,18 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SetReturnNumber" }, "parameters": [ - "HorizontalRotationSpeedMax", - "=", - "Value" + "Object.Behavior::JoystickForce() * sin(ToRad(Object.Behavior::JoystickAngle()))" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -5426,38 +2654,45 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the horizontal rotation acceleration of the object.", - "fullName": "Horizontal rotation acceleration", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper horizontal rotation configuration", - "name": "HorizontalRotationAcceleration", - "sentence": "the horizontal rotation acceleration", + "description": "Check if joystick is pushed in a given direction.", + "fullName": "Joystick pushed in a direction (4-way movement)", + "functionType": "Condition", + "name": "IsDirectionPushed4Way", + "sentence": "_PARAM0_ is pushed in direction _PARAM2_", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::JoystickForce" + }, + "parameters": ["Object", "Behavior", ">", "0", ""] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::IsAngleIn4WayDirection" + }, + "parameters": ["", "JoystickAngle", "Direction", ""] + } + ], "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "SetReturnBoolean" }, - "parameters": [ - "HorizontalRotationAcceleration" - ] + "parameters": ["True"] } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -5467,32 +2702,47 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" + }, + { + "description": "Direction", + "name": "Direction", + "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\"]", + "type": "stringWithSelector" } ], "objectGroups": [] }, { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "HorizontalRotationAcceleration", - "name": "SetHorizontalRotationAcceleration", - "sentence": "", + "description": "Check if joystick is pushed in a given direction.", + "fullName": "Joystick pushed in a direction (8-way movement)", + "functionType": "Condition", + "name": "IsDirectionPushed8Way", + "sentence": "_PARAM0_ is pushed in direction _PARAM2_", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::JoystickForce" + }, + "parameters": ["Object", "Behavior", ">", "0", ""] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::IsAngleIn8WayDirection" + }, + "parameters": ["", "JoystickAngle", "Direction", ""] + } + ], "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SetReturnBoolean" }, - "parameters": [ - "HorizontalRotationAcceleration", - "=", - "Value" - ] + "parameters": ["True"] } ] } @@ -5506,38 +2756,45 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" + }, + { + "description": "Direction", + "name": "Direction", + "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\",\"UpLeft\",\"UpRight\",\"DownLeft\",\"DownRight\"]", + "type": "stringWithSelector" } ], "objectGroups": [] }, { - "description": "the horizontal rotation deceleration of the object.", - "fullName": "Horizontal rotation deceleration", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper horizontal rotation configuration", - "name": "HorizontalRotationDeceleration", - "sentence": "the horizontal rotation deceleration", + "description": "Check if a joystick is pressed.", + "fullName": "Joystick pressed", + "functionType": "Condition", + "name": "IsPressed", + "sentence": "Joystick _PARAM0_ is pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::PropertyTouchId" + }, + "parameters": ["Object", "Behavior", "!=", "0"] + } + ], "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "SetReturnBoolean" }, - "parameters": [ - "HorizontalRotationDeceleration" - ] + "parameters": ["True"] } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -5547,18 +2804,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] }, { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "HorizontalRotationDeceleration", - "name": "SetHorizontalRotationDeceleration", - "sentence": "", + "description": "Reset the joystick values (except for angle, which stays the same)", + "fullName": "Reset", + "functionType": "Action", + "name": "Reset", + "private": true, + "sentence": "Reset the joystick of _PARAM0_", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -5566,13 +2824,15 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" }, - "parameters": [ - "HorizontalRotationDeceleration", - "=", - "Value" - ] + "parameters": ["Object", "Behavior", "=", "0", ""] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyTouchId" + }, + "parameters": ["Object", "Behavior", "=", "0"] } ] } @@ -5586,19 +2846,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the maximum vertical rotation speed of the object.", - "fullName": "Maximum vertical rotation speed", + "description": "the multitouch controller identifier.", + "fullName": "Multitouch controller identifier", "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper vertical rotation configuration", - "name": "VerticalRotationSpeedMax", - "sentence": "the maximum vertical rotation speed", + "group": "Multitouch Joystick configuration", + "name": "ControllerIdentifier", + "sentence": "the multitouch controller identifier", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -5608,9 +2868,7 @@ "type": { "value": "SetReturnNumber" }, - "parameters": [ - "VerticalRotationSpeedMax" - ] + "parameters": ["ControllerIdentifier"] } ] } @@ -5627,7 +2885,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], @@ -5636,8 +2894,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "VerticalRotationSpeedMax", - "name": "SetVerticalRotationSpeedMax", + "getterName": "ControllerIdentifier", + "name": "SetControllerIdentifier", "sentence": "", "events": [ { @@ -5646,13 +2904,9 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyControllerIdentifier" }, - "parameters": [ - "VerticalRotationSpeedMax", - "=", - "Value" - ] + "parameters": ["Object", "Behavior", "=", "Value"] } ] } @@ -5666,19 +2920,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the vertical rotation acceleration of the object.", - "fullName": "Vertical rotation acceleration", + "description": "the joystick name.", + "fullName": "Joystick name", "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper vertical rotation configuration", - "name": "VerticalRotationAcceleration", - "sentence": "the vertical rotation acceleration", + "group": "Multitouch Joystick configuration", + "name": "JoystickIdentifier", + "sentence": "the joystick name", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -5686,17 +2940,15 @@ "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "SetReturnString" }, - "parameters": [ - "VerticalRotationAcceleration" - ] + "parameters": ["JoystickIdentifier"] } ] } ], "expressionType": { - "type": "expression" + "type": "string" }, "parameters": [ { @@ -5707,7 +2959,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], @@ -5716,8 +2968,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "VerticalRotationAcceleration", - "name": "SetVerticalRotationAcceleration", + "getterName": "JoystickIdentifier", + "name": "SetJoystickIdentifier", "sentence": "", "events": [ { @@ -5726,13 +2978,9 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickIdentifier" }, - "parameters": [ - "VerticalRotationAcceleration", - "=", - "Value" - ] + "parameters": ["Object", "Behavior", "=", "Value"] } ] } @@ -5746,19 +2994,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the vertical rotation deceleration of the object.", - "fullName": "Vertical rotation deceleration", + "description": "the dead zone radius (range: 0 to 1) of the joystick. 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).", + "fullName": "Dead zone radius", "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper vertical rotation configuration", - "name": "VerticalRotationDeceleration", - "sentence": "the vertical rotation deceleration", + "group": "Multitouch Joystick configuration", + "name": "DeadZoneRadius", + "sentence": "the dead zone radius", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -5768,9 +3016,7 @@ "type": { "value": "SetReturnNumber" }, - "parameters": [ - "VerticalRotationDeceleration" - ] + "parameters": ["DeadZoneRadius"] } ] } @@ -5787,7 +3033,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], @@ -5796,8 +3042,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "VerticalRotationDeceleration", - "name": "SetVerticalRotationDeceleration", + "getterName": "DeadZoneRadius", + "name": "SetDeadZoneRadius", "sentence": "", "events": [ { @@ -5806,13 +3052,9 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyDeadZoneRadius" }, - "parameters": [ - "VerticalRotationDeceleration", - "=", - "Value" - ] + "parameters": ["Object", "Behavior", "=", "Value"] } ] } @@ -5826,118 +3068,246 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] + } + ], + "propertyDescriptors": [ + { + "value": "1", + "type": "Number", + "label": "Multitouch controller identifier (1, 2, 3, 4...)", + "description": "", + "group": "", + "extraInformation": [], + "name": "ControllerIdentifier" }, { - "description": "the minimum vertical camera angle of the object.", - "fullName": "Minimum vertical camera angle", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper vertical rotation configuration", - "name": "VerticalAngleMin", - "sentence": "the minimum vertical camera angle", + "value": "Primary", + "type": "String", + "label": "Joystick name", + "description": "", + "group": "", + "extraInformation": [], + "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": "0", + "type": "Number", + "label": "Joystick angle (range: -180 to 180)", + "description": "", + "group": "", + "extraInformation": [], + "hidden": true, + "name": "JoystickAngle" + }, + { + "value": "0", + "type": "Number", + "label": "Joystick force (range: 0 to 1)", + "description": "", + "group": "", + "extraInformation": [], + "hidden": true, + "name": "JoystickForce" + }, + { + "value": "0", + "type": "Number", + "label": "", + "description": "", + "group": "", + "extraInformation": [], + "hidden": true, + "name": "TouchId" + }, + { + "value": "", + "type": "Number", + "label": "", + "description": "", + "group": "", + "extraInformation": [], + "hidden": true, + "name": "TouchIndex" + } + ], + "sharedPropertyDescriptors": [] + }, + { + "description": "Detect button presses made on a touchscreen.", + "fullName": "Multitouch button", + "name": "MultitouchButton", + "objectType": "", + "eventsFunctions": [ + { + "fullName": "", + "functionType": "Action", + "name": "doStepPreEvents", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::IsReleased" + }, + "parameters": ["Object", "Behavior", ""] + } + ], "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyIsReleased" }, - "parameters": [ - "VerticalAngleMin" + "parameters": ["Object", "Behavior", "no"] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + }, + "parameters": ["Object", "Behavior", "\"Idle\"", ""] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "SpriteMultitouchJoystick::MultitouchButton::IsPressed" + }, + "parameters": ["Object", "Behavior", ""] + }, + { + "type": { + "value": "HasAnyTouchOrMouseStarted" + }, + "parameters": [""] + } + ], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchIndex" + }, + "parameters": ["Object", "Behavior", "=", "0"] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "StartedTouchOrMouseCount()", + "conditions": [], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "CollisionPoint" + }, + "parameters": [ + "Object", + "TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)", + "TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchId" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "StartedTouchOrMouseId(TouchIndex)" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + }, + "parameters": [ + "Object", + "Behavior", + "\"Pressed\"", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchIndex" + }, + "parameters": ["Object", "Behavior", "+", "1"] + } + ] + } ] } ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "VerticalAngleMin", - "name": "SetVerticalAngleMin", - "sentence": "", - "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ + "conditions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchButton::IsPressed" }, - "parameters": [ - "VerticalAngleMin", - "=", - "Value" - ] + "parameters": ["Object", "Behavior", ""] + }, + { + "type": { + "value": "HasTouchEnded" + }, + "parameters": ["", "TouchId"] } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "the maximum vertical camera angle of the object.", - "fullName": "Maximum vertical camera angle", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper vertical rotation configuration", - "name": "VerticalAngleMax", - "sentence": "the maximum vertical camera angle", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + ], "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" }, - "parameters": [ - "VerticalAngleMax" - ] + "parameters": ["Object", "Behavior", "\"Released\"", ""] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyIsReleased" + }, + "parameters": ["Object", "Behavior", "yes"] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchId" + }, + "parameters": ["Object", "Behavior", "=", "0"] } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -5947,32 +3317,35 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", "type": "behavior" } ], "objectGroups": [] }, { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "VerticalAngleMax", - "name": "SetVerticalAngleMax", - "sentence": "", + "description": "Check if button is released.", + "fullName": "Button released", + "functionType": "Condition", + "name": "IsReleased", + "sentence": "Button _PARAM0_ is released", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::PropertyIsReleased" + }, + "parameters": ["Object", "Behavior"] + } + ], "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SetReturnBoolean" }, - "parameters": [ - "VerticalAngleMax", - "=", - "Value" - ] + "parameters": ["True"] } ] } @@ -5986,38 +3359,39 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the z position offset of the object.", - "fullName": "Z position offset", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper position configuration", - "name": "OffsetZ", - "sentence": "the z position offset", + "description": "Check if button is pressed.", + "fullName": "Button pressed", + "functionType": "Condition", + "name": "IsPressed", + "sentence": "Button _PARAM0_ is pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::PropertyTouchId" + }, + "parameters": ["Object", "Behavior", "!=", "0"] + } + ], "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "SetReturnBoolean" }, - "parameters": [ - "OffsetZ" - ] + "parameters": ["True"] } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -6027,18 +3401,18 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", "type": "behavior" } ], "objectGroups": [] }, { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "OffsetZ", - "name": "SetOffsetZ", - "sentence": "", + "fullName": "Button state", + "functionType": "Action", + "name": "SetButtonState", + "private": true, + "sentence": "Mark the button _PARAM0_ as _PARAM2_", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -6046,12 +3420,14 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::SetButtonState" }, "parameters": [ - "OffsetZ", - "=", - "Value" + "", + "ControllerIdentifier", + "ButtonIdentifier", + "ButtonState", + "" ] } ] @@ -6066,140 +3442,76 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", "type": "behavior" + }, + { + "description": "Button state", + "name": "ButtonState", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "type": "stringWithSelector" } ], "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...)", + "label": "Multitouch controller identifier (1, 2, 3, 4...)", + "description": "", + "group": "", + "extraInformation": [], "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": "A", + "type": "String", + "label": "Button identifier", + "description": "", + "group": "", + "extraInformation": [], + "name": "ButtonIdentifier" }, { "value": "0", "type": "Number", - "unit": "Pixel", - "label": "Z position offset", - "group": "Position", - "name": "OffsetZ" + "label": "TouchID", + "description": "", + "group": "", + "extraInformation": [], + "hidden": true, + "name": "TouchId" }, { - "value": "0", + "value": "", "type": "Number", - "unit": "AngularSpeed", - "label": "Current rotation speed Z", + "label": "", + "description": "", + "group": "", + "extraInformation": [], "hidden": true, - "name": "CurrentRotationSpeedZ" + "name": "TouchIndex" }, { - "value": "0", - "type": "Number", - "unit": "AngularSpeed", - "label": "Current rotation speed Y", + "value": "", + "type": "Boolean", + "label": "Button released", + "description": "", + "group": "", + "extraInformation": [], "hidden": true, - "name": "CurrentRotationSpeedY" + "name": "IsReleased" } ], "sharedPropertyDescriptors": [] }, { - "description": "Control a 3D physics car with a multitouch controller.", - "fullName": "3D car multitouch controller mapper", - "name": "PhysicsCar3DMultitouchMapper", + "description": "Control a platformer character with a multitouch controller.", + "fullName": "Platformer multitouch controller mapper", + "name": "PlatformerMultitouchMapper", "objectType": "", - "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -6212,14 +3524,63 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::StickForce" + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JoystickIdentifier", + "\"Left\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "PlatformBehavior::SimulateLeftKey" + }, + "parameters": ["Object", "Property"] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JoystickIdentifier", + "\"Right\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "PlatformBehavior::SimulateRightKey" + }, + "parameters": ["Object", "Property"] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" }, "parameters": [ "", - ">", - "0", "ControllerIdentifier", - "SteerJoystickIdentifier", + "JoystickIdentifier", + "\"Up\"", "" ] } @@ -6227,13 +3588,15 @@ "actions": [ { "type": { - "value": "Physics3D::PhysicsCar3D::SimulateSteeringStick" + "value": "PlatformBehavior::SimulateUpKey" + }, + "parameters": ["Object", "Property"] + }, + { + "type": { + "value": "PlatformBehavior::SimulateLadderKey" }, - "parameters": [ - "Object", - "PhysicsCar3D", - "SpriteMultitouchJoystick::StickForceX(ControllerIdentifier, \"Primary\")" - ] + "parameters": ["Object", "Property"] } ] }, @@ -6242,14 +3605,13 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::StickForce" + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" }, "parameters": [ "", - ">", - "0", "ControllerIdentifier", - "SpeedJoystickIdentifier", + "JoystickIdentifier", + "\"Down\"", "" ] } @@ -6257,13 +3619,9 @@ "actions": [ { "type": { - "value": "Physics3D::PhysicsCar3D::SimulateAcceleratorStick" + "value": "PlatformBehavior::SimulateDownKey" }, - "parameters": [ - "Object", - "PhysicsCar3D", - "-SpriteMultitouchJoystick::StickForceY(ControllerIdentifier, \"Secondary\")" - ] + "parameters": ["Object", "Property"] } ] }, @@ -6277,7 +3635,7 @@ "parameters": [ "", "ControllerIdentifier", - "HandBrakeButton", + "JumpButton", "\"Down\"" ] } @@ -6285,12 +3643,9 @@ "actions": [ { "type": { - "value": "Physics3D::PhysicsCar3D::SimulateHandBrakeKey" + "value": "PlatformBehavior::SimulateJumpKey" }, - "parameters": [ - "Object", - "PhysicsCar3D" - ] + "parameters": ["Object", "Property"] } ] } @@ -6304,7 +3659,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::PhysicsCar3DMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::PlatformerMultitouchMapper", "type": "behavior" } ], @@ -6315,59 +3670,40 @@ { "value": "", "type": "Behavior", - "label": "3D physics car", + "label": "Platform character behavior", + "description": "", + "group": "", "extraInformation": [ - "Physics3D::PhysicsCar3D" + "PlatformBehavior::PlatformerObjectBehavior" ], - "choices": [], - "name": "PhysicsCar3D" + "name": "Property" }, { "value": "1", "type": "Number", "label": "Controller identifier (1, 2, 3, 4...)", + "description": "", + "group": "", + "extraInformation": [], "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", + "label": "Joystick name", + "description": "", "group": "Controls", - "choices": [ - { - "label": "Primary", - "value": "Primary" - }, - { - "label": "Secondary", - "value": "Secondary" - } - ], - "name": "SpeedJoystickIdentifier" + "extraInformation": ["Primary", "Secondary"], + "name": "JoystickIdentifier" }, { - "value": "B", + "value": "A", "type": "String", - "label": "Hand brake button name", + "label": "Jump button name", + "description": "", "group": "Controls", - "name": "HandBrakeButton" + "extraInformation": [], + "name": "JumpButton" } ], "sharedPropertyDescriptors": [] @@ -6377,7 +3713,6 @@ "fullName": "Top-down multitouch controller mapper", "name": "TopDownMultitouchMapper", "objectType": "", - "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -6390,13 +3725,9 @@ "conditions": [ { "type": { - "value": "StringVariable" + "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" }, - "parameters": [ - "StickMode", - "=", - "\"Analog\"" - ] + "parameters": ["Object", "Behavior", "=", "\"Analog\""] } ], "actions": [ @@ -6418,13 +3749,9 @@ "conditions": [ { "type": { - "value": "StringVariable" + "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" }, - "parameters": [ - "StickMode", - "=", - "\"360°\"" - ] + "parameters": ["Object", "Behavior", "=", "\"360°\""] } ], "actions": [ @@ -6446,10 +3773,11 @@ "conditions": [ { "type": { - "value": "StringVariable" + "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" }, "parameters": [ - "StickMode", + "Object", + "Behavior", "=", "\"8 Directions\"" ] @@ -6465,10 +3793,7 @@ "inverted": true, "value": "TopDownMovementBehavior::DiagonalsAllowed" }, - "parameters": [ - "Object", - "TopDownMovement" - ] + "parameters": ["Object", "TopDownMovement"] } ], "actions": [], @@ -6494,10 +3819,7 @@ "type": { "value": "TopDownMovementBehavior::SimulateLeftKey" }, - "parameters": [ - "Object", - "TopDownMovement" - ] + "parameters": ["Object", "TopDownMovement"] } ] }, @@ -6522,10 +3844,7 @@ "type": { "value": "TopDownMovementBehavior::SimulateRightKey" }, - "parameters": [ - "Object", - "TopDownMovement" - ] + "parameters": ["Object", "TopDownMovement"] } ] }, @@ -6550,10 +3869,7 @@ "type": { "value": "TopDownMovementBehavior::SimulateUpKey" }, - "parameters": [ - "Object", - "TopDownMovement" - ] + "parameters": ["Object", "TopDownMovement"] } ] }, @@ -6578,10 +3894,7 @@ "type": { "value": "TopDownMovementBehavior::SimulateDownKey" }, - "parameters": [ - "Object", - "TopDownMovement" - ] + "parameters": ["Object", "TopDownMovement"] } ] } @@ -6594,10 +3907,7 @@ "type": { "value": "TopDownMovementBehavior::DiagonalsAllowed" }, - "parameters": [ - "Object", - "TopDownMovement" - ] + "parameters": ["Object", "TopDownMovement"] } ], "actions": [], @@ -6623,10 +3933,7 @@ "type": { "value": "TopDownMovementBehavior::SimulateLeftKey" }, - "parameters": [ - "Object", - "TopDownMovement" - ] + "parameters": ["Object", "TopDownMovement"] } ] }, @@ -6651,10 +3958,7 @@ "type": { "value": "TopDownMovementBehavior::SimulateRightKey" }, - "parameters": [ - "Object", - "TopDownMovement" - ] + "parameters": ["Object", "TopDownMovement"] } ] }, @@ -6679,10 +3983,7 @@ "type": { "value": "TopDownMovementBehavior::SimulateUpKey" }, - "parameters": [ - "Object", - "TopDownMovement" - ] + "parameters": ["Object", "TopDownMovement"] } ] }, @@ -6707,10 +4008,7 @@ "type": { "value": "TopDownMovementBehavior::SimulateDownKey" }, - "parameters": [ - "Object", - "TopDownMovement" - ] + "parameters": ["Object", "TopDownMovement"] } ] }, @@ -6735,19 +4033,13 @@ "type": { "value": "TopDownMovementBehavior::SimulateUpKey" }, - "parameters": [ - "Object", - "TopDownMovement" - ] + "parameters": ["Object", "TopDownMovement"] }, { "type": { "value": "TopDownMovementBehavior::SimulateLeftKey" }, - "parameters": [ - "Object", - "TopDownMovement" - ] + "parameters": ["Object", "TopDownMovement"] } ] }, @@ -6772,19 +4064,13 @@ "type": { "value": "TopDownMovementBehavior::SimulateUpKey" }, - "parameters": [ - "Object", - "TopDownMovement" - ] + "parameters": ["Object", "TopDownMovement"] }, { "type": { "value": "TopDownMovementBehavior::SimulateRightKey" }, - "parameters": [ - "Object", - "TopDownMovement" - ] + "parameters": ["Object", "TopDownMovement"] } ] }, @@ -6809,19 +4095,13 @@ "type": { "value": "TopDownMovementBehavior::SimulateDownKey" }, - "parameters": [ - "Object", - "TopDownMovement" - ] + "parameters": ["Object", "TopDownMovement"] }, { "type": { "value": "TopDownMovementBehavior::SimulateLeftKey" }, - "parameters": [ - "Object", - "TopDownMovement" - ] + "parameters": ["Object", "TopDownMovement"] } ] }, @@ -6846,19 +4126,13 @@ "type": { "value": "TopDownMovementBehavior::SimulateDownKey" }, - "parameters": [ - "Object", - "TopDownMovement" - ] + "parameters": ["Object", "TopDownMovement"] }, { "type": { "value": "TopDownMovementBehavior::SimulateRightKey" }, - "parameters": [ - "Object", - "TopDownMovement" - ] + "parameters": ["Object", "TopDownMovement"] } ] } @@ -6888,53 +4162,38 @@ "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", - "choices": [ - { - "label": "Primary", - "value": "Primary" - }, - { - "label": "Secondary", - "value": "Secondary" - } - ], + "description": "", + "group": "", + "extraInformation": ["Primary", "Secondary"], "name": "JoystickIdentifier" }, { "value": "Analog", "type": "Choice", "label": "Stick mode", + "description": "", "group": "Controls", - "choices": [ - { - "label": "Analog", - "value": "Analog" - }, - { - "label": "360°", - "value": "360°" - }, - { - "label": "8 Directions", - "value": "8 Directions" - } - ], + "extraInformation": ["Analog", "360°", "8 Directions"], "name": "StickMode" } ], @@ -6954,110 +4213,6 @@ "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": "", @@ -7073,87 +4228,49 @@ "type": { "value": "Create" }, - "parameters": [ - "", - "Border", - "0", - "0", - "" - ] + "parameters": ["", "Border", "0", "0", ""] }, { "type": { "value": "Create" - }, - "parameters": [ - "", - "Thumb", - "0", - "0", - "" - ] + }, + "parameters": ["", "Thumb", "0", "0", ""] }, { "type": { "value": "ChangePlan" }, - "parameters": [ - "Border", - "=", - "1" - ] + "parameters": ["Border", "=", "1"] }, { "type": { "value": "ChangePlan" }, - "parameters": [ - "Thumb", - "=", - "2" - ] + "parameters": ["Thumb", "=", "2"] }, { "type": { "value": "SetCenter" }, - "parameters": [ - "Border", - "=", - "0", - "=", - "0" - ] + "parameters": ["Border", "=", "0", "=", "0"] }, { "type": { "value": "SetCenter" }, - "parameters": [ - "Thumb", - "=", - "0", - "=", - "0" - ] + "parameters": ["Thumb", "=", "0", "=", "0"] }, { "type": { "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::UpdateConfiguration" }, - "parameters": [ - "Object", - "" - ] + "parameters": ["Object", ""] }, { "type": { "value": "SetIncludedInParentCollisionMask" }, - "parameters": [ - "Thumb", - "" - ] + "parameters": ["Thumb", ""] } ] } @@ -7176,90 +4293,17 @@ "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "conditions": [], + "actions": [ { "type": { - "inverted": true, - "value": "SpriteMultitouchJoystick::IsInGameEdition" + "value": "MettreAutour" }, "parameters": [ - "", - "" - ] - } - ], - "actions": [], - "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" - }, - "parameters": [ - "Object", - "no", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "ShouldBeHiddenWhenReleased", - "False", - "" - ] - } + "Thumb", + "Border", + "Border.MultitouchJoystick::JoystickForce() * Border.Width() / 2", + "Border.MultitouchJoystick::JoystickAngle()" ] } ] @@ -7289,10 +4333,7 @@ "type": { "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::UpdateConfiguration" }, - "parameters": [ - "Object", - "" - ] + "parameters": ["Object", ""] } ] } @@ -7324,217 +4365,46 @@ "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetControllerIdentifier" }, "parameters": [ - "Border", - "MultitouchJoystick", - "=", - "ControllerIdentifier", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickIdentifier" - }, - "parameters": [ - "Border", - "MultitouchJoystick", - "=", - "JoystickIdentifier", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetDeadZoneRadius" - }, - "parameters": [ - "Border", - "MultitouchJoystick", - "=", - "DeadZoneRadius", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "supplementaryInformation": "SpriteMultitouchJoystick::SpriteMultitouchJoystick", - "type": "object" - } - ], - "objectGroups": [] - }, - { - "description": "Show the joystick until it is released.", - "fullName": "Show and start pressing", - "functionType": "Action", - "name": "TeleportAndPress", - "sentence": "Show _PARAM0_ at the cursor position and start pressing", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "HasAnyTouchOrMouseStarted" - }, - "parameters": [ - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "MettreXY" - }, - "parameters": [ - "Object", - "=", - "Object.ParentTouchX(StartedTouchOrMouseId(0))", - "=", - "Object.ParentTouchY(StartedTouchOrMouseId(0))" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::ActivateControl" - }, - "parameters": [ - "Object", - "yes", - "" - ] - }, - { - "type": { - "value": "Montre" - }, - "parameters": [ - "Object", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "ShouldBeHiddenWhenReleased", - "True", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::ForceStartPressing" - }, - "parameters": [ - "Border", - "MultitouchJoystick", - "StartedTouchOrMouseId(0)", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "supplementaryInformation": "SpriteMultitouchJoystick::SpriteMultitouchJoystick", - "type": "object" - } - ], - "objectGroups": [] - }, - { - "description": "Return the X position of a specified touch", - "fullName": "Touch X position (on parent)", - "functionType": "Expression", - "name": "ParentTouchX", - "private": true, - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [] - }, - { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "const object = objects[0];", - "const touchId = eventsFunctionContext.getArgument(\"TouchId\");", - "eventsFunctionContext.returnValue = gdjs.evtTools.input.getTouchX(object.getInstanceContainer(), touchId, object.getLayer());" - ], - "parameterObjects": "Object", - "useStrict": true, - "eventsSheetExpanded": false - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "supplementaryInformation": "SpriteMultitouchJoystick::SpriteMultitouchJoystick", - "type": "object" - }, - { - "description": "Touch identifier", - "name": "TouchId", - "type": "expression" - } - ], - "objectGroups": [] - }, - { - "description": "Return the X position of a specified touch", - "fullName": "Touch X position (on parent)", - "functionType": "Expression", - "name": "ParentTouchY", - "private": true, - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [] - }, - { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "const object = objects[0];", - "const touchId = eventsFunctionContext.getArgument(\"TouchId\");", - "eventsFunctionContext.returnValue = gdjs.evtTools.input.getTouchY(object.getInstanceContainer(), touchId, object.getLayer());" - ], - "parameterObjects": "Object", - "useStrict": true, - "eventsSheetExpanded": false + "Border", + "MultitouchJoystick", + "=", + "Object.PropertyControllerIdentifier()", + "" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickIdentifier" + }, + "parameters": [ + "Border", + "MultitouchJoystick", + "=", + "Object.PropertyJoystickIdentifier()", + "" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetDeadZoneRadius" + }, + "parameters": [ + "Border", + "MultitouchJoystick", + "=", + "Object.PropertyDeadZoneRadius()", + "" + ] + } + ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", "name": "Object", "supplementaryInformation": "SpriteMultitouchJoystick::SpriteMultitouchJoystick", "type": "object" - }, - { - "description": "Touch identifier", - "name": "TouchId", - "type": "expression" } ], "objectGroups": [] @@ -7552,13 +4422,9 @@ { "type": { "inverted": true, - "value": "BooleanVariable" + "value": "GetArgumentAsBoolean" }, - "parameters": [ - "ShouldActivate", - "True", - "" - ] + "parameters": ["\"ShouldActivate\""] } ], "actions": [ @@ -7566,11 +4432,7 @@ "type": { "value": "ActivateBehavior" }, - "parameters": [ - "Border", - "MultitouchJoystick", - "no" - ] + "parameters": ["Border", "MultitouchJoystick", "no"] } ] }, @@ -7579,13 +4441,9 @@ "conditions": [ { "type": { - "value": "BooleanVariable" + "value": "GetArgumentAsBoolean" }, - "parameters": [ - "ShouldActivate", - "True", - "" - ] + "parameters": ["\"ShouldActivate\""] } ], "actions": [ @@ -7593,11 +4451,7 @@ "type": { "value": "ActivateBehavior" }, - "parameters": [ - "Border", - "MultitouchJoystick", - "yes" - ] + "parameters": ["Border", "MultitouchJoystick", "yes"] } ] } @@ -7631,11 +4485,7 @@ "type": { "value": "SpriteMultitouchJoystick::MultitouchJoystick::IsPressed" }, - "parameters": [ - "Border", - "MultitouchJoystick", - "!=" - ] + "parameters": ["Border", "MultitouchJoystick", "!="] } ], "actions": [ @@ -7643,9 +4493,7 @@ "type": { "value": "SetReturnBoolean" }, - "parameters": [ - "True" - ] + "parameters": ["True"] } ] } @@ -7746,9 +4594,7 @@ "type": { "value": "SetReturnNumber" }, - "parameters": [ - "Border.MultitouchJoystick::StickForceX()" - ] + "parameters": ["Border.MultitouchJoystick::StickForceX()"] } ] } @@ -7781,9 +4627,7 @@ "type": { "value": "SetReturnNumber" }, - "parameters": [ - "Border.MultitouchJoystick::StickForceY()" - ] + "parameters": ["Border.MultitouchJoystick::StickForceY()"] } ] } @@ -7899,9 +4743,7 @@ "type": { "value": "SetReturnBoolean" }, - "parameters": [ - "True" - ] + "parameters": ["True"] } ] } @@ -7949,9 +4791,7 @@ "type": { "value": "SetReturnBoolean" }, - "parameters": [ - "True" - ] + "parameters": ["True"] } ] } @@ -8194,22 +5034,18 @@ "value": "1", "type": "Number", "label": "Multitouch controller identifier (1, 2, 3, 4...)", + "description": "", + "group": "", + "extraInformation": [], "name": "ControllerIdentifier" }, { "value": "Primary", "type": "Choice", "label": "Joystick name", - "choices": [ - { - "label": "Primary", - "value": "Primary" - }, - { - "label": "Secondary", - "value": "Secondary" - } - ], + "description": "", + "group": "", + "extraInformation": ["Primary", "Secondary"], "name": "JoystickIdentifier" }, { @@ -8217,6 +5053,8 @@ "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" }, { @@ -8224,10 +5062,8 @@ "type": "String", "label": "", "description": "Only used by the scene editor.", - "extraInformation": [ - "Thumb" - ], - "choices": [], + "group": "", + "extraInformation": ["Thumb"], "hidden": true, "name": "ThumbAnchorOrigin" }, @@ -8236,6 +5072,8 @@ "type": "Number", "label": "", "description": "Only used by the scene editor.", + "group": "", + "extraInformation": [], "hidden": true, "name": "ThumbAnchorTarget" }, @@ -8244,10 +5082,8 @@ "type": "Boolean", "label": "", "description": "Only used by the scene editor.", - "extraInformation": [ - "Thumb" - ], - "choices": [], + "group": "", + "extraInformation": ["Thumb"], "hidden": true, "name": "ThumbIsScaledProportionally" }, @@ -8256,17 +5092,116 @@ "type": "String", "label": "", "description": "Only used by the scene editor.", + "group": "", + "extraInformation": [], "hidden": true, "name": "ParentOrigin" + } + ], + "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": [] + } + ] + } + ] }, { - "value": "", - "type": "Boolean", - "label": "", - "hidden": true, - "name": "ShouldBeHiddenWhenReleased" + "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": [] } ] }, @@ -8304,9 +5239,7 @@ "platformer", "platform" ], - "authorIds": [ - "IWykYNRvhCZBN3vEgKEbBPOR3Oc2" - ], + "authorIds": ["IWykYNRvhCZBN3vEgKEbBPOR3Oc2"], "dependencies": [], "globalVariables": [], "sceneVariables": [], @@ -8476,12 +5409,7 @@ "type": { "value": "SmoothCamera::SmoothCamera::SetPropertyCameraDelay" }, - "parameters": [ - "Object", - "Behavior", - "=", - "CameraDelay" - ] + "parameters": ["Object", "Behavior", "=", "CameraDelay"] } ] } @@ -8515,10 +5443,7 @@ "inverted": true, "value": "SmoothCamera::SmoothCamera::PropertyIsCalledManually" }, - "parameters": [ - "Object", - "Behavior" - ] + "parameters": ["Object", "Behavior"] } ], "actions": [ @@ -8526,11 +5451,7 @@ "type": { "value": "SmoothCamera::SmoothCamera::DoMoveCameraCloser" }, - "parameters": [ - "Object", - "Behavior", - "" - ] + "parameters": ["Object", "Behavior", ""] } ] } @@ -8577,21 +5498,13 @@ "type": { "value": "SmoothCamera::SmoothCamera::SetPropertyIsCalledManually" }, - "parameters": [ - "Object", - "Behavior", - "yes" - ] + "parameters": ["Object", "Behavior", "yes"] }, { "type": { "value": "SmoothCamera::SmoothCamera::DoMoveCameraCloser" }, - "parameters": [ - "Object", - "Behavior", - "" - ] + "parameters": ["Object", "Behavior", ""] } ] } @@ -8639,21 +5552,13 @@ "type": { "value": "SmoothCamera::SmoothCamera::UpdateDelayedPosition" }, - "parameters": [ - "Object", - "Behavior", - "" - ] + "parameters": ["Object", "Behavior", ""] }, { "type": { "value": "SmoothCamera::SmoothCamera::UpdateForecastedPosition" }, - "parameters": [ - "Object", - "Behavior", - "" - ] + "parameters": ["Object", "Behavior", ""] } ] }, @@ -8676,10 +5581,7 @@ "type": { "value": "SmoothCamera::SmoothCamera::PropertyFollowOnX" }, - "parameters": [ - "Object", - "Behavior" - ] + "parameters": ["Object", "Behavior"] } ], "actions": [ @@ -8833,10 +5735,7 @@ "type": { "value": "SmoothCamera::SmoothCamera::PropertyFollowOnY" }, - "parameters": [ - "Object", - "Behavior" - ] + "parameters": ["Object", "Behavior"] } ], "actions": [ @@ -9136,11 +6035,7 @@ "type": { "value": "PrimitiveDrawing::FillOpacity" }, - "parameters": [ - "ShapePainter", - "=", - "0" - ] + "parameters": ["ShapePainter", "=", "0"] } ] }, @@ -9172,21 +6067,13 @@ "type": { "value": "SmoothCamera::SmoothCamera::SetPropertyIndex" }, - "parameters": [ - "Object", - "Behavior", - "=", - "0" - ] + "parameters": ["Object", "Behavior", "=", "0"] }, { "type": { "value": "PrimitiveDrawing::OutlineColor" }, - "parameters": [ - "ShapePainter", - "\"245;166;35\"" - ] + "parameters": ["ShapePainter", "\"245;166;35\""] }, { "type": { @@ -9217,14 +6104,9 @@ }, { "type": { - "value": "SmoothCamera::SmoothCamera::SetPropertyIndex" - }, - "parameters": [ - "Object", - "Behavior", - "+", - "1" - ] + "value": "SmoothCamera::SmoothCamera::SetPropertyIndex" + }, + "parameters": ["Object", "Behavior", "+", "1"] } ] }, @@ -9236,9 +6118,7 @@ "type": { "value": "PrimitiveDrawing::EndFillPath" }, - "parameters": [ - "ShapePainter" - ] + "parameters": ["ShapePainter"] } ] } @@ -9269,45 +6149,25 @@ "type": { "value": "SmoothCamera::SmoothCamera::PropertyFollowFreeAreaLeft" }, - "parameters": [ - "Object", - "Behavior", - "!=", - "0" - ] + "parameters": ["Object", "Behavior", "!=", "0"] }, { "type": { "value": "SmoothCamera::SmoothCamera::PropertyFollowFreeAreaRight" }, - "parameters": [ - "Object", - "Behavior", - "!=", - "0" - ] + "parameters": ["Object", "Behavior", "!=", "0"] }, { "type": { "value": "SmoothCamera::SmoothCamera::PropertyFollowFreeAreaTop" }, - "parameters": [ - "Object", - "Behavior", - "!=", - "0" - ] + "parameters": ["Object", "Behavior", "!=", "0"] }, { "type": { "value": "SmoothCamera::SmoothCamera::PropertyFollowFreeAreaBottom" }, - "parameters": [ - "Object", - "Behavior", - "!=", - "0" - ] + "parameters": ["Object", "Behavior", "!=", "0"] } ] } @@ -9317,10 +6177,7 @@ "type": { "value": "PrimitiveDrawing::OutlineColor" }, - "parameters": [ - "ShapePainter", - "\"126;211;33\"" - ] + "parameters": ["ShapePainter", "\"126;211;33\""] }, { "type": { @@ -9356,10 +6213,7 @@ "type": { "value": "PrimitiveDrawing::OutlineColor" }, - "parameters": [ - "ShapePainter", - "\"208;2;27\"" - ] + "parameters": ["ShapePainter", "\"208;2;27\""] }, { "type": { @@ -9472,11 +6326,7 @@ "type": { "value": "SmoothCamera::SmoothCamera::SetPropertyFollowOnX" }, - "parameters": [ - "Object", - "Behavior", - "" - ] + "parameters": ["Object", "Behavior", ""] } ] }, @@ -9487,9 +6337,7 @@ "type": { "value": "GetArgumentAsBoolean" }, - "parameters": [ - "\"FollowOnX\"" - ] + "parameters": ["\"FollowOnX\""] } ], "actions": [ @@ -9497,11 +6345,7 @@ "type": { "value": "SmoothCamera::SmoothCamera::SetPropertyFollowOnX" }, - "parameters": [ - "Object", - "Behavior", - "yes" - ] + "parameters": ["Object", "Behavior", "yes"] } ] } @@ -9542,11 +6386,7 @@ "type": { "value": "SmoothCamera::SmoothCamera::SetPropertyFollowOnY" }, - "parameters": [ - "Object", - "Behavior", - "" - ] + "parameters": ["Object", "Behavior", ""] } ] }, @@ -9557,9 +6397,7 @@ "type": { "value": "GetArgumentAsBoolean" }, - "parameters": [ - "\"FollowOnY\"" - ] + "parameters": ["\"FollowOnY\""] } ], "actions": [ @@ -9567,11 +6405,7 @@ "type": { "value": "SmoothCamera::SmoothCamera::SetPropertyFollowOnY" }, - "parameters": [ - "Object", - "Behavior", - "yes" - ] + "parameters": ["Object", "Behavior", "yes"] } ] } @@ -9796,12 +6630,7 @@ "type": { "value": "SmoothCamera::SmoothCamera::SetPropertyLeftwardSpeedMax" }, - "parameters": [ - "Object", - "Behavior", - "=", - "max(0, Speed)" - ] + "parameters": ["Object", "Behavior", "=", "max(0, Speed)"] } ] } @@ -9842,12 +6671,7 @@ "type": { "value": "SmoothCamera::SmoothCamera::SetPropertyLeftwardSpeedMax" }, - "parameters": [ - "Object", - "Behavior", - "=", - "max(0, Speed)" - ] + "parameters": ["Object", "Behavior", "=", "max(0, Speed)"] } ] } @@ -9888,12 +6712,7 @@ "type": { "value": "SmoothCamera::SmoothCamera::SetPropertyUpwardSpeedMax" }, - "parameters": [ - "Object", - "Behavior", - "=", - "max(0, Speed)" - ] + "parameters": ["Object", "Behavior", "=", "max(0, Speed)"] } ] } @@ -9934,12 +6753,7 @@ "type": { "value": "SmoothCamera::SmoothCamera::SetPropertyDownwardSpeedMax" }, - "parameters": [ - "Object", - "Behavior", - "=", - "max(0, Speed)" - ] + "parameters": ["Object", "Behavior", "=", "max(0, Speed)"] } ] } @@ -10208,9 +7022,7 @@ "type": { "value": "SetReturnNumber" }, - "parameters": [ - "CameraOffsetX" - ] + "parameters": ["CameraOffsetX"] } ] } @@ -10248,12 +7060,7 @@ "type": { "value": "SmoothCamera::SmoothCamera::SetPropertyCameraOffsetX" }, - "parameters": [ - "Object", - "Behavior", - "=", - "Value" - ] + "parameters": ["Object", "Behavior", "=", "Value"] } ] } @@ -10349,9 +7156,7 @@ "type": { "value": "SetReturnNumber" }, - "parameters": [ - "CameraOffsetY" - ] + "parameters": ["CameraOffsetY"] } ] } @@ -10401,12 +7206,7 @@ "type": { "value": "SmoothCamera::SmoothCamera::SetPropertyCameraOffsetY" }, - "parameters": [ - "Object", - "Behavior", - "=", - "Value" - ] + "parameters": ["Object", "Behavior", "=", "Value"] } ] } @@ -10762,11 +7562,7 @@ "type": { "value": "SmoothCamera::SmoothCamera::IsWaiting" }, - "parameters": [ - "Object", - "Behavior", - "" - ] + "parameters": ["Object", "Behavior", ""] }, { "type": { @@ -10860,11 +7656,7 @@ "inverted": true, "value": "SmoothCamera::SmoothCamera::IsDelayed" }, - "parameters": [ - "Object", - "Behavior", - "" - ] + "parameters": ["Object", "Behavior", ""] } ], "actions": [ @@ -10896,21 +7688,13 @@ "type": { "value": "SmoothCamera::SmoothCamera::IsDelayed" }, - "parameters": [ - "Object", - "Behavior", - "" - ] + "parameters": ["Object", "Behavior", ""] }, { "type": { "value": "SmoothCamera::SmoothCamera::IsWaiting" }, - "parameters": [ - "Object", - "Behavior", - "" - ] + "parameters": ["Object", "Behavior", ""] } ] } @@ -11119,11 +7903,7 @@ "type": { "value": "SmoothCamera::SmoothCamera::IsWaiting" }, - "parameters": [ - "Object", - "Behavior", - "" - ] + "parameters": ["Object", "Behavior", ""] } ], "actions": [ @@ -11211,22 +7991,14 @@ "inverted": true, "value": "SmoothCamera::SmoothCamera::IsDelayed" }, - "parameters": [ - "Object", - "Behavior", - "" - ] + "parameters": ["Object", "Behavior", ""] }, { "type": { "inverted": true, "value": "SmoothCamera::SmoothCamera::IsWaiting" }, - "parameters": [ - "Object", - "Behavior", - "" - ] + "parameters": ["Object", "Behavior", ""] } ], "actions": [ @@ -11234,28 +8006,19 @@ "type": { "value": "ObjectVariableClearChildren" }, - "parameters": [ - "Object", - "__SmoothCamera.ObjectTime" - ] + "parameters": ["Object", "__SmoothCamera.ObjectTime"] }, { "type": { "value": "ObjectVariableClearChildren" }, - "parameters": [ - "Object", - "__SmoothCamera.ObjectX" - ] + "parameters": ["Object", "__SmoothCamera.ObjectX"] }, { "type": { "value": "ObjectVariableClearChildren" }, - "parameters": [ - "Object", - "__SmoothCamera.ObjectY" - ] + "parameters": ["Object", "__SmoothCamera.ObjectY"] } ] }, @@ -11267,11 +8030,7 @@ "inverted": true, "value": "SmoothCamera::SmoothCamera::IsWaiting" }, - "parameters": [ - "Object", - "Behavior", - "" - ] + "parameters": ["Object", "Behavior", ""] }, { "type": { @@ -11321,22 +8080,13 @@ "inverted": true, "value": "SmoothCamera::SmoothCamera::IsWaiting" }, - "parameters": [ - "Object", - "Behavior", - "" - ] + "parameters": ["Object", "Behavior", ""] }, { "type": { "value": "SmoothCamera::SmoothCamera::PropertyCameraExtraDelay" }, - "parameters": [ - "Object", - "Behavior", - ">", - "0" - ] + "parameters": ["Object", "Behavior", ">", "0"] } ], "actions": [ @@ -11415,9 +8165,7 @@ "type": { "value": "SetReturnBoolean" }, - "parameters": [ - "True" - ] + "parameters": ["True"] } ] } @@ -11453,9 +8201,7 @@ "type": { "value": "SetReturnNumber" }, - "parameters": [ - "CameraDelay + CameraExtraDelay" - ] + "parameters": ["CameraDelay + CameraExtraDelay"] } ] } @@ -11506,9 +8252,7 @@ "type": { "value": "SetReturnBoolean" }, - "parameters": [ - "True" - ] + "parameters": ["True"] } ] } @@ -11550,23 +8294,13 @@ "type": { "value": "SmoothCamera::SmoothCamera::PropertyForecastHistoryDuration" }, - "parameters": [ - "Object", - "Behavior", - ">", - "0" - ] + "parameters": ["Object", "Behavior", ">", "0"] }, { "type": { "value": "SmoothCamera::SmoothCamera::PropertyForecastTime" }, - "parameters": [ - "Object", - "Behavior", - ">", - "0" - ] + "parameters": ["Object", "Behavior", ">", "0"] } ] } @@ -11781,23 +8515,13 @@ "type": { "value": "SmoothCamera::SmoothCamera::PropertyForecastHistoryDuration" }, - "parameters": [ - "Object", - "Behavior", - ">", - "0" - ] + "parameters": ["Object", "Behavior", ">", "0"] }, { "type": { "value": "SmoothCamera::SmoothCamera::PropertyForecastTime" }, - "parameters": [ - "Object", - "Behavior", - ">", - "0" - ] + "parameters": ["Object", "Behavior", ">", "0"] } ] } @@ -11821,23 +8545,13 @@ "type": { "value": "SmoothCamera::SmoothCamera::SetPropertyForecastHistoryMeanX" }, - "parameters": [ - "Object", - "Behavior", - "=", - "0" - ] + "parameters": ["Object", "Behavior", "=", "0"] }, { "type": { "value": "SmoothCamera::SmoothCamera::SetPropertyIndex" }, - "parameters": [ - "Object", - "Behavior", - "=", - "0" - ] + "parameters": ["Object", "Behavior", "=", "0"] } ] }, @@ -11861,12 +8575,7 @@ "type": { "value": "SmoothCamera::SmoothCamera::SetPropertyIndex" }, - "parameters": [ - "Object", - "Behavior", - "+", - "1" - ] + "parameters": ["Object", "Behavior", "+", "1"] } ] }, @@ -11907,23 +8616,13 @@ "type": { "value": "SmoothCamera::SmoothCamera::SetPropertyForecastHistoryMeanY" }, - "parameters": [ - "Object", - "Behavior", - "=", - "0" - ] + "parameters": ["Object", "Behavior", "=", "0"] }, { "type": { "value": "SmoothCamera::SmoothCamera::SetPropertyIndex" }, - "parameters": [ - "Object", - "Behavior", - "=", - "0" - ] + "parameters": ["Object", "Behavior", "=", "0"] } ] }, @@ -11947,12 +8646,7 @@ "type": { "value": "SmoothCamera::SmoothCamera::SetPropertyIndex" }, - "parameters": [ - "Object", - "Behavior", - "+", - "1" - ] + "parameters": ["Object", "Behavior", "+", "1"] } ] }, @@ -12022,45 +8716,25 @@ "type": { "value": "SmoothCamera::SmoothCamera::SetPropertyForecastHistoryVarianceX" }, - "parameters": [ - "Object", - "Behavior", - "=", - "0" - ] + "parameters": ["Object", "Behavior", "=", "0"] }, { "type": { "value": "SmoothCamera::SmoothCamera::SetPropertyForecastHistoryVarianceY" }, - "parameters": [ - "Object", - "Behavior", - "=", - "0" - ] + "parameters": ["Object", "Behavior", "=", "0"] }, { "type": { "value": "SmoothCamera::SmoothCamera::SetPropertyForecastHistoryCovariance" }, - "parameters": [ - "Object", - "Behavior", - "=", - "0" - ] + "parameters": ["Object", "Behavior", "=", "0"] }, { "type": { "value": "SmoothCamera::SmoothCamera::SetPropertyIndex" }, - "parameters": [ - "Object", - "Behavior", - "=", - "0" - ] + "parameters": ["Object", "Behavior", "=", "0"] } ] }, @@ -12106,12 +8780,7 @@ "type": { "value": "SmoothCamera::SmoothCamera::SetPropertyIndex" }, - "parameters": [ - "Object", - "Behavior", - "+", - "1" - ] + "parameters": ["Object", "Behavior", "+", "1"] } ] }, @@ -13302,20 +9971,14 @@ "inverted": true, "value": "PlatformBehavior::IsJumping" }, - "parameters": [ - "Object", - "PlatformerCharacter" - ] + "parameters": ["Object", "PlatformerCharacter"] }, { "type": { "inverted": true, "value": "PlatformBehavior::IsFalling" }, - "parameters": [ - "Object", - "PlatformerCharacter" - ] + "parameters": ["Object", "PlatformerCharacter"] } ], "actions": [ @@ -13400,19 +10063,13 @@ "type": { "value": "PlatformBehavior::IsJumping" }, - "parameters": [ - "Object", - "PlatformerCharacter" - ] + "parameters": ["Object", "PlatformerCharacter"] }, { "type": { "value": "PlatformBehavior::IsFalling" }, - "parameters": [ - "Object", - "PlatformerCharacter" - ] + "parameters": ["Object", "PlatformerCharacter"] } ] } @@ -13521,9 +10178,7 @@ "label": "Smooth camera behavior", "description": "", "group": "", - "extraInformation": [ - "SmoothCamera::SmoothCamera" - ], + "extraInformation": ["SmoothCamera::SmoothCamera"], "name": "SmoothCamera" }, { @@ -13660,4 +10315,4 @@ } ], "externalLayouts": [] -} \ No newline at end of file +} diff --git a/examples/starting-top-down-rpg/starting-top-down-rpg.json b/examples/starting-top-down-rpg/starting-top-down-rpg.json index b437acee8..54f67baf4 100644 --- a/examples/starting-top-down-rpg/starting-top-down-rpg.json +++ b/examples/starting-top-down-rpg/starting-top-down-rpg.json @@ -1520,19 +1520,19 @@ "category": "Input", "extensionNamespace": "", "fullName": "Multitouch joystick and buttons (sprite)", - "gdevelopVersion": ">=5.5.222", + "gdevelopVersion": "", "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", + "version": "1.4.0", "description": [ - "Multitouch joysticks are objects showing a joystick on the screen, useful for mobile. They work like a physical gamepad:", + "Multitouch joysticks can be used the same way as physical gamepads:", "- 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.", + "- 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)." ], @@ -1597,33 +1597,153 @@ ], "eventsFunctions": [ { - "description": "Check if the events are running for the editor.", - "fullName": "Editor is running", + "description": "Check if a button is pressed on a gamepad.", + "fullName": "Multitouch controller button pressed", "functionType": "Condition", - "name": "IsInGameEdition", - "private": true, - "sentence": "Events are running for the editor", + "name": "IsButtonPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", "events": [ { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "const game = runtimeScene.getGame();\r", - "eventsFunctionContext.returnValue = game.isInGameEdition && game.isInGameEdition();" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"Pressed\"" + ] + } ], - "parameterObjects": "", - "useStrict": true, - "eventsSheetExpanded": false + "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" } ], - "parameters": [], "objectGroups": [] }, { - "fullName": "Accelerated speed", - "functionType": "Expression", - "name": "AcceleratedSpeed", + "description": "Check if a button is released on a gamepad.", + "fullName": "Multitouch controller button released", + "functionType": "Condition", + "name": "IsButtonReleased", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is released", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"Released\"" + ] + } + ], + "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": "Change a button state for a multitouch controller.", + "fullName": "Button state", + "functionType": "Action", + "name": "SetButtonState", "private": true, - "sentence": "", + "sentence": "Mark _PARAM2_ button as _PARAM3_ for multitouch controller _PARAM1_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "ButtonState" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier", + "type": "expression" + }, + { + "description": "Button name", + "name": "Button", + "type": "string" + }, + { + "description": "Button state", + "name": "ButtonState", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "type": "stringWithSelector" + } + ], + "objectGroups": [] + }, + { + "description": "Change the dead zone radius of a joystick. 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).", + "fullName": "Dead zone radius", + "functionType": "Action", + "name": "SetDeadZone", + "private": true, + "sentence": "Change the dead zone of multitouch joystick _PARAM2_ of multitouch controller _PARAM1_ to _PARAM3_", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -1634,3504 +1754,1165 @@ "value": "SetNumberVariable" }, "parameters": [ - "AcceleratedSpeed", + "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].DeadZone", "=", - "CurrentSpeed" + "DeadZoneRadius" ] } - ], - "events": [ + ] + } + ], + "parameters": [ + { + "description": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier", + "type": "expression" + }, + { + "description": "Joystick name", + "name": "JoystickIdentifier", + "type": "string" + }, + { + "description": "Dead zone radius", + "name": "DeadZoneRadius", + "supplementaryInformation": "[]", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Return the dead zone radius of a joystick. 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).", + "fullName": "Dead zone radius", + "functionType": "Expression", + "name": "DeadZone", + "private": true, + "sentence": "Change multitouch joystick _PARAM2_ of multitouch controller _PARAM1_ dead zone to _PARAM3_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ { - "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", - "=", - "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": "NumberVariable" - }, - "parameters": [ - "TargetedSpeed", - "=", - "0" - ] - } - ], - "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", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "clamp(AcceleratedSpeed, -SpeedMax, SpeedMax)" - ] - } - ] - } - ], - "variables": [ - { - "name": "AcceleratedSpeed", - "type": "number", - "value": 0 - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Current speed", - "name": "CurrentSpeed", - "type": "expression" - }, - { - "description": "Targeted speed", - "name": "TargetedSpeed", - "type": "expression" - }, - { - "description": "Max speed", - "name": "SpeedMax", - "type": "expression" - }, - { - "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": "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\"" - ] - } - ] - } - ], - "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", - "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is released", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Buttons[Button].State", - "=", - "\"Released\"" - ] - } - ], - "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": "Change a button state for a multitouch controller.", - "fullName": "Button state", - "functionType": "Action", - "name": "SetButtonState", - "private": true, - "sentence": "Mark _PARAM2_ button as _PARAM3_ for multitouch controller _PARAM1_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetStringVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Buttons[Button].State", - "=", - "ButtonState" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" - }, - { - "description": "Button name", - "name": "Button", - "type": "string" - }, - { - "description": "Button state", - "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"JustPressed\",\"Released\"]", - "type": "stringWithSelector" - } - ], - "objectGroups": [] - }, - { - "description": "Change the dead zone radius of a joystick. 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).", - "fullName": "Dead zone radius", - "functionType": "Action", - "name": "SetDeadZone", - "private": true, - "sentence": "Change the dead zone of multitouch joystick _PARAM2_ of multitouch controller _PARAM1_ to _PARAM3_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].DeadZone", - "=", - "DeadZoneRadius" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" - }, - { - "description": "Joystick name", - "name": "JoystickIdentifier", - "type": "string" - }, - { - "description": "Dead zone radius", - "name": "DeadZoneRadius", - "supplementaryInformation": "[]", - "type": "expression" - } - ], - "objectGroups": [] - }, - { - "description": "Return the dead zone radius of a joystick. 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).", - "fullName": "Dead zone radius", - "functionType": "Expression", - "name": "DeadZone", - "private": true, - "sentence": "Change multitouch joystick _PARAM2_ of multitouch controller _PARAM1_ dead zone to _PARAM3_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].DeadZone" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" - }, - { - "description": "Joystick name", - "name": "JoystickIdentifier", - "type": "string" - } - ], - "objectGroups": [] - }, - { - "description": "the direction index (left = 1, bottom = 1, right = 2, top = 3) for an angle (in degrees).", - "fullName": "Angle to 4-way index", - "functionType": "ExpressionAndCondition", - "name": "AngleTo4Way", - "private": true, - "sentence": "The angle _PARAM1_ 4-way index", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "mod(round(Angle * 4 / 360), 4)" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Angle", - "name": "Angle", - "type": "expression" - } - ], - "objectGroups": [] - }, - { - "description": "the direction index (left = 1, bottom-left = 1... top-left = 7) for an angle (in degrees).", - "fullName": "Angle to 8-way index", - "functionType": "ExpressionAndCondition", - "name": "AngleTo8Way", - "private": true, - "sentence": "The angle _PARAM1_ 8-way index", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "mod(round(Angle * 8 / 360), 8)" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Angle", - "name": "Angle", - "type": "expression" - } - ], - "objectGroups": [] - }, - { - "description": "Check if angle is in a given direction.", - "fullName": "Angle 4-way direction", - "functionType": "Condition", - "name": "IsAngleIn4WayDirection", - "private": true, - "sentence": "The angle _PARAM1_ is the 4-way direction _PARAM2_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Right\"" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo4Way" - }, - "parameters": [ - "", - "=", - "0", - "Angle", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Down\"" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo4Way" - }, - "parameters": [ - "", - "=", - "1", - "Angle", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Left\"" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo4Way" - }, - "parameters": [ - "", - "=", - "2", - "Angle", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Up\"" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo4Way" - }, - "parameters": [ - "", - "=", - "3", - "Angle", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Angle", - "name": "Angle", - "type": "expression" - }, - { - "description": "Direction", - "name": "Direction", - "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\"]", - "type": "stringWithSelector" - } - ], - "objectGroups": [] - }, - { - "description": "Check if angle is in a given direction.", - "fullName": "Angle 8-way direction", - "functionType": "Condition", - "name": "IsAngleIn8WayDirection", - "private": true, - "sentence": "The angle _PARAM1_ is the 8-way direction _PARAM2_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Right\"" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "0", - "Angle", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"DownRight\"" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "1", - "Angle", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Down\"" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "2", - "Angle", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"DownLeft\"" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "3", - "Angle", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Left\"" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "4", - "Angle", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"UpLeft\"" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "5", - "Angle", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Up\"" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "6", - "Angle", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"UpRight\"" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "7", - "Angle", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Angle", - "name": "Angle", - "type": "expression" - }, - { - "description": "Direction", - "name": "Direction", - "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\",\"UpLeft\",\"UpRight\",\"DownLeft\",\"DownRight\"]", - "type": "stringWithSelector" - } - ], - "objectGroups": [] - }, - { - "description": "Check if joystick is pushed in a given direction.", - "fullName": "Joystick pushed in a direction (4-way)", - "functionType": "Condition", - "name": "IsDirectionPushed4Way", - "sentence": "Joystick _PARAM2_ of multitouch controller _PARAM1_ is pushed in direction _PARAM3_", - "events": [ - { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 - }, - "comment": "Make sure the joystick has moved from center" - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::JoystickForce" - }, - "parameters": [ - "", - ">", - "0", - "ControllerIdentifier", - "JoystickIdentifier", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::IsAngleIn4WayDirection" - }, - "parameters": [ - "", - "SpriteMultitouchJoystick::JoystickAngle(ControllerIdentifier, JoystickIdentifier)", - "Direction", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" - }, - { - "description": "Joystick name", - "name": "JoystickIdentifier", - "supplementaryInformation": "[\"Primary\",\"Secondary\"]", - "type": "stringWithSelector" - }, - { - "description": "Direction", - "name": "Direction", - "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\"]", - "type": "stringWithSelector" - } - ], - "objectGroups": [] - }, - { - "description": "Check if joystick is pushed in a given direction.", - "fullName": "Joystick pushed in a direction (8-way)", - "functionType": "Condition", - "name": "IsDirectionPushed8Way", - "sentence": "Joystick _PARAM2_ of multitouch controller _PARAM1_ is pushed in direction _PARAM3_", - "events": [ - { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 - }, - "comment": "Make sure the joystick has moved from center" - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::JoystickForce" - }, - "parameters": [ - "", - ">", - "0", - "ControllerIdentifier", - "JoystickIdentifier", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::IsAngleIn8WayDirection" - }, - "parameters": [ - "", - "SpriteMultitouchJoystick::JoystickAngle(ControllerIdentifier, JoystickIdentifier)", - "Direction", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" - }, - { - "description": "Joystick name", - "name": "JoystickIdentifier", - "supplementaryInformation": "[\"Primary\",\"Secondary\"]", - "type": "stringWithSelector" - }, - { - "description": "Direction", - "name": "Direction", - "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\",\"UpLeft\",\"UpRight\",\"DownLeft\",\"DownRight\"]", - "type": "stringWithSelector" - } - ], - "objectGroups": [] - }, - { - "description": "the percentage the thumb has been pulled away from the joystick center (Range: 0 to 1).", - "fullName": "Joystick force (deprecated)", - "functionType": "ExpressionAndCondition", - "name": "JoystickForce", - "private": true, - "sentence": "Joystick _PARAM2_ of multitouch controller _PARAM1_ force", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier)" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" - }, - { - "description": "Joystick name", - "name": "JoystickIdentifier", - "supplementaryInformation": "[\"Primary\",\"Secondary\"]", - "type": "stringWithSelector" - }, - { - "description": "", - "name": "Coucou", - "type": "expression" - } - ], - "objectGroups": [] - }, - { - "description": "the force of multitouch contoller stick (from 0 to 1).", - "fullName": "Stick force", - "functionType": "ExpressionAndCondition", - "name": "StickForce", - "sentence": "multitouch controller _PARAM1_ _PARAM2_ stick force", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "max(0, Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].Force - SpriteMultitouchJoystick::DeadZone(ControllerIdentifier, JoystickIdentifier)) / (1 - SpriteMultitouchJoystick::DeadZone(ControllerIdentifier, JoystickIdentifier))" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" - }, - { - "description": "Stick name", - "name": "JoystickIdentifier", - "supplementaryInformation": "[\"Primary\",\"Secondary\"]", - "type": "stringWithSelector" - } - ], - "objectGroups": [] - }, - { - "description": "Change the percentage the thumb has been pulled away from the joystick center (Range: 0 to 1).", - "fullName": "Joystick force", - "functionType": "Action", - "name": "SetJoystickForce", - "private": true, - "sentence": "Change the force of the joystick _PARAM2_ of multitouch controller _PARAM1_ to _PARAM3_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].Force", - "=", - "Value" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" - }, - { - "description": "Joystick name", - "name": "JoystickIdentifier", - "type": "string" - }, - { - "description": "Value", - "name": "Value", - "type": "expression" - } - ], - "objectGroups": [] - }, - { - "description": "Return the angle the joystick is pointing towards (Range: -180 to 180).", - "fullName": "Joystick angle (deprecated)", - "functionType": "Expression", - "name": "JoystickAngle", - "private": true, - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier)" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" - }, - { - "description": "Joystick name", - "name": "JoystickIdentifier", - "supplementaryInformation": "[\"Primary\",\"Secondary\"]", - "type": "stringWithSelector" - } - ], - "objectGroups": [] - }, - { - "description": "Return the angle the multitouch controller stick is pointing towards (Range: -180 to 180).", - "fullName": "Stick angle", - "functionType": "Expression", - "name": "StickAngle", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].Angle" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" - }, - { - "description": "Joystick name", - "name": "JoystickIdentifier", - "supplementaryInformation": "[\"Primary\",\"Secondary\"]", - "type": "stringWithSelector" - } - ], - "objectGroups": [] - }, - { - "description": "Change the angle the joystick is pointing towards (Range: -180 to 180).", - "fullName": "Joystick angle", - "functionType": "Action", - "name": "SetJoystickAngle", - "private": true, - "sentence": "Change the angle of the joystick _PARAM2_ of multitouch controller _PARAM1_ to _PARAM3_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].Angle", - "=", - "Value" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" - }, - { - "description": "Joystick name", - "name": "JoystickIdentifier", - "type": "string" - }, - { - "description": "Value", - "name": "Value", - "type": "expression" - } - ], - "objectGroups": [] - }, - { - "description": "Return the multitouch contoller stick force on X axis (from -1 at the left to 1 at the right).", - "fullName": "Stick X force", - "functionType": "Expression", - "name": "StickForceX", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "XFromAngleAndDistance(SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier), SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier))" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" - }, - { - "description": "Joystick name", - "name": "JoystickIdentifier", - "supplementaryInformation": "[\"Primary\",\"Secondary\"]", - "type": "stringWithSelector" - } - ], - "objectGroups": [] - }, - { - "description": "Return the multitouch contoller stick force on Y axis (from -1 at the top to 1 at the bottom).", - "fullName": "Stick Y force", - "functionType": "Expression", - "name": "StickForceY", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "YFromAngleAndDistance(SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier), SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier))" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" - }, - { - "description": "Joystick name", - "name": "JoystickIdentifier", - "supplementaryInformation": "[\"Primary\",\"Secondary\"]", - "type": "stringWithSelector" - } - ], - "objectGroups": [] - }, - { - "description": "Check if a new touch has started on the right or left side of the screen.", - "fullName": "New touch on a screen side", - "functionType": "Condition", - "group": "Multitouch Joystick", - "name": "HasTouchStartedOnScreenSide", - "sentence": "A new touch has started on the _PARAM2_ side of the screen on _PARAM1_'s layer", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "HasAnyTouchOrMouseStarted" - }, - "parameters": [ - "" - ] - } - ], - "actions": [], - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "Side", - "=", - "\"Left\"" - ] - }, - { - "type": { - "value": "TouchX" - }, - "parameters": [ - "", - "StartedTouchOrMouseId(0)", - "<", - "CameraCenterX(Object.Layer())", - "Object.Layer()", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "Side", - "=", - "\"Right\"" - ] - }, - { - "type": { - "value": "TouchX" - }, - "parameters": [ - "", - "StartedTouchOrMouseId(0)", - ">=", - "CameraCenterX(Object.Layer())", - "Object.Layer()", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - } - ] - } - ], - "parameters": [ - { - "description": "Multitouch joystick", - "name": "Object", - "supplementaryInformation": "SpriteMultitouchJoystick::SpriteMultitouchJoystick", - "type": "objectList" - }, - { - "description": "Screen side", - "name": "Side", - "supplementaryInformation": "[\"Left\",\"Right\"]", - "type": "stringWithSelector" - } - ], - "objectGroups": [] - } - ], - "eventsBasedBehaviors": [ - { - "description": "Joystick that can be controlled by interacting with a touchscreen.", - "fullName": "Multitouch Joystick", - "name": "MultitouchJoystick", - "objectType": "", - "private": true, - "eventsFunctions": [ - { - "fullName": "", - "functionType": "Action", - "name": "onCreated", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::SetDeadZone" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "DeadZoneRadius", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "Action", - "name": "onDeActivate", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "Action", - "name": "doStepPreEvents", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "inverted": true, - "value": "SpriteMultitouchJoystick::IsInGameEdition" - }, - "parameters": [ - "", - "" - ] - } - ], - "actions": [], - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "HasGameJustResumed" - }, - "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)" - }, - { - "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": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "the joystick force (from 0 to 1).", - "fullName": "Joystick force", - "functionType": "ExpressionAndCondition", - "name": "JoystickForce", - "sentence": "the joystick force", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "max(0, JoystickForce - DeadZoneRadius) / (1 - DeadZoneRadius)" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "JoystickForce", - "name": "SetJoystickForce", - "private": true, - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "JoystickForce", - "=", - "Value" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::SetJoystickForce" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "JoystickForce", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - }, - { - "description": "", - "name": "Parameter", - "type": "objectList" - } - ], - "objectGroups": [] - }, - { - "description": "Return the angle the joystick is pointing towards (Range: -180 to 180).", - "fullName": "Joystick angle", - "functionType": "Expression", - "name": "JoystickAngle", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "JoystickAngle" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "Change the angle the joystick is pointing towards (Range: -180 to 180).", - "fullName": "Joystick angle", - "functionType": "Action", - "name": "SetJoystickAngle", - "private": true, - "sentence": "Change the joystick angle of _PARAM0_ to _PARAM2_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "JoystickAngle", - "=", - "Value" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::SetJoystickAngle" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "JoystickAngle", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - }, - { - "description": "Angle", - "name": "Value", - "type": "expression" + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].DeadZone" + ] } - ], - "objectGroups": [] + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier", + "type": "expression" }, { - "description": "Return the stick force on X axis (from -1 at the left to 1 at the right).", - "fullName": "Stick X force", - "functionType": "Expression", - "name": "StickForceX", - "sentence": "", - "events": [ + "description": "Joystick name", + "name": "JoystickIdentifier", + "type": "string" + } + ], + "objectGroups": [] + }, + { + "description": "the direction index (left = 1, bottom = 1, right = 2, top = 3) for an angle (in degrees).", + "fullName": "Angle to 4-way index", + "functionType": "ExpressionAndCondition", + "name": "AngleTo4Way", + "private": true, + "sentence": "The angle _PARAM1_ 4-way index", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "Object.Behavior::JoystickForce() * cos(ToRad(Object.Behavior::JoystickAngle()))" - ] - } + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "mod(round(Angle * 4 / 360), 4)" ] } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ { - "description": "Return the stick force on Y axis (from -1 at the top to 1 at the bottom).", - "fullName": "Stick Y force", - "functionType": "Expression", - "name": "StickForceY", - "sentence": "", - "events": [ + "description": "Angle", + "name": "Angle", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "the direction index (left = 1, bottom-left = 1... top-left = 7) for an angle (in degrees).", + "fullName": "Angle to 8-way index", + "functionType": "ExpressionAndCondition", + "name": "AngleTo8Way", + "private": true, + "sentence": "The angle _PARAM1_ 8-way index", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "Object.Behavior::JoystickForce() * sin(ToRad(Object.Behavior::JoystickAngle()))" - ] - } + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "mod(round(Angle * 8 / 360), 8)" ] } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Angle", + "name": "Angle", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Check if angle is in a given direction.", + "fullName": "Angle 4-way direction", + "functionType": "Condition", + "name": "IsAngleIn4WayDirection", + "private": true, + "sentence": "The angle _PARAM1_ is the 4-way direction _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { - "description": "Object", - "name": "Object", - "type": "object" + "type": { + "value": "BuiltinCommonInstructions::CompareStrings" + }, + "parameters": [ + "Direction", + "=", + "\"Right\"" + ] }, { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "Check if joystick is pushed in a given direction.", - "fullName": "Joystick pushed in a direction (4-way movement)", - "functionType": "Condition", - "name": "IsDirectionPushed4Way", - "sentence": "_PARAM0_ is pushed in direction _PARAM2_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::JoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - ">", - "0", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::IsAngleIn4WayDirection" - }, - "parameters": [ - "", - "JoystickAngle", - "Direction", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } + "type": { + "value": "SpriteMultitouchJoystick::AngleTo4Way" + }, + "parameters": [ + "", + "=", + "0", + "Angle", + "" ] } ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - }, + "actions": [ { - "description": "Direction", - "name": "Direction", - "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\"]", - "type": "stringWithSelector" + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] } - ], - "objectGroups": [] + ] }, { - "description": "Check if joystick is pushed in a given direction.", - "fullName": "Joystick pushed in a direction (8-way movement)", - "functionType": "Condition", - "name": "IsDirectionPushed8Way", - "sentence": "_PARAM0_ is pushed in direction _PARAM2_", - "events": [ + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::JoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - ">", - "0", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::IsAngleIn8WayDirection" - }, - "parameters": [ - "", - "JoystickAngle", - "Direction", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } + "type": { + "value": "BuiltinCommonInstructions::CompareStrings" + }, + "parameters": [ + "Direction", + "=", + "\"Down\"" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::AngleTo4Way" + }, + "parameters": [ + "", + "=", + "1", + "Angle", + "" ] } ], - "parameters": [ + "actions": [ { - "description": "Object", - "name": "Object", - "type": "object" - }, + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" + "type": { + "value": "BuiltinCommonInstructions::CompareStrings" + }, + "parameters": [ + "Direction", + "=", + "\"Left\"" + ] }, { - "description": "Direction", - "name": "Direction", - "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\",\"UpLeft\",\"UpRight\",\"DownLeft\",\"DownRight\"]", - "type": "stringWithSelector" + "type": { + "value": "SpriteMultitouchJoystick::AngleTo4Way" + }, + "parameters": [ + "", + "=", + "2", + "Angle", + "" + ] } ], - "objectGroups": [] - }, - { - "description": "Check if a joystick is pressed.", - "fullName": "Joystick pressed", - "functionType": "Condition", - "name": "IsPressed", - "sentence": "Joystick _PARAM0_ is pressed", - "events": [ + "actions": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "NumberVariable" - }, - "parameters": [ - "TouchId", - "!=", - "0" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" ] } - ], - "parameters": [ + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { - "description": "Object", - "name": "Object", - "type": "object" + "type": { + "value": "BuiltinCommonInstructions::CompareStrings" + }, + "parameters": [ + "Direction", + "=", + "\"Up\"" + ] }, { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" + "type": { + "value": "SpriteMultitouchJoystick::AngleTo4Way" + }, + "parameters": [ + "", + "=", + "3", + "Angle", + "" + ] } ], - "objectGroups": [] + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Angle", + "name": "Angle", + "type": "expression" }, { - "description": "Reset the joystick values (except for angle, which stays the same)", - "fullName": "Reset", - "functionType": "Action", - "name": "Reset", - "private": true, - "sentence": "Reset the joystick of _PARAM0_", - "events": [ + "description": "Direction", + "name": "Direction", + "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\"]", + "type": "stringWithSelector" + } + ], + "objectGroups": [] + }, + { + "description": "Check if angle is in a given direction.", + "fullName": "Angle 8-way direction", + "functionType": "Condition", + "name": "IsAngleIn8WayDirection", + "private": true, + "sentence": "The angle _PARAM1_ is the 8-way direction _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "0", - "" - ] - }, - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "0" - ] - } + "type": { + "value": "BuiltinCommonInstructions::CompareStrings" + }, + "parameters": [ + "Direction", + "=", + "\"Right\"" ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" }, { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" + "type": { + "value": "SpriteMultitouchJoystick::AngleTo8Way" + }, + "parameters": [ + "", + "=", + "0", + "Angle", + "" + ] } ], - "objectGroups": [] - }, - { - "description": "the multitouch controller identifier.", - "fullName": "Multitouch controller identifier", - "functionType": "ExpressionAndCondition", - "group": "Multitouch Joystick configuration", - "name": "ControllerIdentifier", - "sentence": "the multitouch controller identifier", - "events": [ + "actions": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "ControllerIdentifier" - ] - } + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" ] } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { - "description": "Object", - "name": "Object", - "type": "object" + "type": { + "value": "BuiltinCommonInstructions::CompareStrings" + }, + "parameters": [ + "Direction", + "=", + "\"DownRight\"" + ] }, { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" + "type": { + "value": "SpriteMultitouchJoystick::AngleTo8Way" + }, + "parameters": [ + "", + "=", + "1", + "Angle", + "" + ] } ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "ControllerIdentifier", - "name": "SetControllerIdentifier", - "sentence": "", - "events": [ + "actions": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "ControllerIdentifier", - "=", - "Value" - ] - } + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" ] } - ], - "parameters": [ + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { - "description": "Object", - "name": "Object", - "type": "object" + "type": { + "value": "BuiltinCommonInstructions::CompareStrings" + }, + "parameters": [ + "Direction", + "=", + "\"Down\"" + ] }, { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" + "type": { + "value": "SpriteMultitouchJoystick::AngleTo8Way" + }, + "parameters": [ + "", + "=", + "2", + "Angle", + "" + ] } ], - "objectGroups": [] - }, - { - "description": "the joystick name.", - "fullName": "Joystick name", - "functionType": "ExpressionAndCondition", - "group": "Multitouch Joystick configuration", - "name": "JoystickIdentifier", - "sentence": "the joystick name", - "events": [ + "actions": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnString" - }, - "parameters": [ - "JoystickIdentifier" - ] - } + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" ] } - ], - "expressionType": { - "type": "string" - }, - "parameters": [ + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { - "description": "Object", - "name": "Object", - "type": "object" + "type": { + "value": "BuiltinCommonInstructions::CompareStrings" + }, + "parameters": [ + "Direction", + "=", + "\"DownLeft\"" + ] }, { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" + "type": { + "value": "SpriteMultitouchJoystick::AngleTo8Way" + }, + "parameters": [ + "", + "=", + "3", + "Angle", + "" + ] } ], - "objectGroups": [] + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] }, { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "JoystickIdentifier", - "name": "SetJoystickIdentifier", - "sentence": "", - "events": [ + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetStringVariable" - }, - "parameters": [ - "JoystickIdentifier", - "=", - "Value" - ] - } + "type": { + "value": "BuiltinCommonInstructions::CompareStrings" + }, + "parameters": [ + "Direction", + "=", + "\"Left\"" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::AngleTo8Way" + }, + "parameters": [ + "", + "=", + "4", + "Angle", + "" ] } ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, + "actions": [ { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] } - ], - "objectGroups": [] + ] }, { - "description": "the dead zone radius (range: 0 to 1) of the joystick. 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).", - "fullName": "Dead zone radius", - "functionType": "ExpressionAndCondition", - "group": "Multitouch Joystick configuration", - "name": "DeadZoneRadius", - "sentence": "the dead zone radius", - "events": [ + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "DeadZoneRadius" - ] - } + "type": { + "value": "BuiltinCommonInstructions::CompareStrings" + }, + "parameters": [ + "Direction", + "=", + "\"UpLeft\"" ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" }, { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" + "type": { + "value": "SpriteMultitouchJoystick::AngleTo8Way" + }, + "parameters": [ + "", + "=", + "5", + "Angle", + "" + ] } ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "DeadZoneRadius", - "name": "SetDeadZoneRadius", - "sentence": "", - "events": [ + "actions": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "DeadZoneRadius", - "=", - "Value" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::SetDeadZone" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "Value", - "" - ] - } + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" ] } - ], - "parameters": [ + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { - "description": "Object", - "name": "Object", - "type": "object" + "type": { + "value": "BuiltinCommonInstructions::CompareStrings" + }, + "parameters": [ + "Direction", + "=", + "\"Up\"" + ] }, { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" + "type": { + "value": "SpriteMultitouchJoystick::AngleTo8Way" + }, + "parameters": [ + "", + "=", + "6", + "Angle", + "" + ] } ], - "objectGroups": [] - }, - { - "description": "Force the joystick into the pressing state.", - "fullName": "Force start pressing", - "functionType": "Action", - "name": "ForceStartPressing", - "sentence": "Force start pressing _PARAM0_ with touch identifier: _PARAM2_", - "events": [ + "actions": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "Value" - ] - } + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" ] } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" + "type": { + "value": "BuiltinCommonInstructions::CompareStrings" + }, + "parameters": [ + "Direction", + "=", + "\"UpRight\"" + ] }, { - "description": "Touch identifier", - "name": "Value", - "type": "expression" + "type": { + "value": "SpriteMultitouchJoystick::AngleTo8Way" + }, + "parameters": [ + "", + "=", + "7", + "Angle", + "" + ] } ], - "objectGroups": [] + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] } ], - "propertyDescriptors": [ - { - "value": "1", - "type": "Number", - "label": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier" - }, - { - "value": "Primary", - "type": "String", - "label": "Joystick name", - "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": "0", - "type": "Number", - "label": "Joystick angle (range: -180 to 180)", - "hidden": true, - "name": "JoystickAngle" - }, - { - "value": "0", - "type": "Number", - "label": "Joystick force (range: 0 to 1)", - "hidden": true, - "name": "JoystickForce" - }, + "parameters": [ { - "value": "0", - "type": "Number", - "label": "", - "hidden": true, - "name": "TouchId" + "description": "Angle", + "name": "Angle", + "type": "expression" }, { - "value": "", - "type": "Number", - "label": "", - "hidden": true, - "name": "TouchIndex" + "description": "Direction", + "name": "Direction", + "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\",\"UpLeft\",\"UpRight\",\"DownLeft\",\"DownRight\"]", + "type": "stringWithSelector" } ], - "sharedPropertyDescriptors": [] + "objectGroups": [] }, { - "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": "", - "eventsFunctions": [ + "description": "Check if joystick is pushed in a given direction.", + "fullName": "Joystick pushed in a direction (4-way)", + "functionType": "Condition", + "name": "IsDirectionPushed4Way", + "sentence": "Joystick _PARAM2_ of multitouch controller _PARAM1_ is pushed in direction _PARAM3_", + "events": [ { - "fullName": "", - "functionType": "Action", - "name": "doStepPreEvents", - "sentence": "", - "events": [ + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Make sure the joystick has moved from center" + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "IsReleased", - "True", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsReleased", - "False", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" - }, - "parameters": [ - "Object", - "Behavior", - "\"Idle\"", - "" - ] - } + "type": { + "value": "SpriteMultitouchJoystick::JoystickForce" + }, + "parameters": [ + "", + ">", + "0", + "ControllerIdentifier", + "JoystickIdentifier", + "" ] }, { - "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": { + "value": "SpriteMultitouchJoystick::IsAngleIn4WayDirection" + }, + "parameters": [ + "", + "SpriteMultitouchJoystick::JoystickAngle(ControllerIdentifier, JoystickIdentifier)", + "Direction", + "" ] - }, + } + ], + "actions": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "inverted": true, - "value": "SpriteMultitouchJoystick::MultitouchButton::IsPressed" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - }, - { - "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": "BuiltinCommonInstructions::Or" - }, - "parameters": [], - "subInstructions": [ - { - "type": { - "value": "CollisionPoint" - }, - "parameters": [ - "Object", - "TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer())", - "TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer())" - ] - }, - { - "type": { - "value": "NumberVariable" - }, - "parameters": [ - "Radius", - ">", - "DistanceBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer()), TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer()))" - ] - } - ] - } - ], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "StartedTouchOrMouseId(TouchIndex)" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" - }, - "parameters": [ - "Object", - "Behavior", - "\"JustPressed\"", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "True", - "" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchIndex", - "+", - "1" - ] - } - ] - } - ] - } + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier", + "type": "expression" + }, + { + "description": "Joystick name", + "name": "JoystickIdentifier", + "supplementaryInformation": "[\"Primary\",\"Secondary\"]", + "type": "stringWithSelector" + }, + { + "description": "Direction", + "name": "Direction", + "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\"]", + "type": "stringWithSelector" + } + ], + "objectGroups": [] + }, + { + "description": "Check if joystick is pushed in a given direction.", + "fullName": "Joystick pushed in a direction (8-way)", + "functionType": "Condition", + "name": "IsDirectionPushed8Way", + "sentence": "Joystick _PARAM2_ of multitouch controller _PARAM1_ is pushed in direction _PARAM3_", + "events": [ + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Make sure the joystick has moved from center" + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::JoystickForce" + }, + "parameters": [ + "", + ">", + "0", + "ControllerIdentifier", + "JoystickIdentifier", + "" ] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::IsPressed" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - }, - { - "type": { - "value": "HasTouchEnded" - }, - "parameters": [ - "", - "TouchId" - ] - } - ], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" - }, - "parameters": [ - "Object", - "Behavior", - "\"Released\"", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsReleased", - "True", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "False", - "" - ] - }, - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "0" - ] - } + "type": { + "value": "SpriteMultitouchJoystick::IsAngleIn8WayDirection" + }, + "parameters": [ + "", + "SpriteMultitouchJoystick::JoystickAngle(ControllerIdentifier, JoystickIdentifier)", + "Direction", + "" ] } ], - "parameters": [ + "actions": [ { - "description": "Object", - "name": "Object", - "type": "object" - }, + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier", + "type": "expression" + }, + { + "description": "Joystick name", + "name": "JoystickIdentifier", + "supplementaryInformation": "[\"Primary\",\"Secondary\"]", + "type": "stringWithSelector" + }, + { + "description": "Direction", + "name": "Direction", + "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\",\"UpLeft\",\"UpRight\",\"DownLeft\",\"DownRight\"]", + "type": "stringWithSelector" + } + ], + "objectGroups": [] + }, + { + "description": "the percentage the thumb has been pulled away from the joystick center (Range: 0 to 1).", + "fullName": "Joystick force (deprecated)", + "functionType": "ExpressionAndCondition", + "name": "JoystickForce", + "private": true, + "sentence": "Joystick _PARAM2_ of multitouch controller _PARAM1_ force", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", - "type": "behavior" + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier)" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier", + "type": "expression" + }, + { + "description": "Joystick name", + "name": "JoystickIdentifier", + "supplementaryInformation": "[\"Primary\",\"Secondary\"]", + "type": "stringWithSelector" + } + ], + "objectGroups": [] + }, + { + "description": "the force of multitouch contoller stick (from 0 to 1).", + "fullName": "Stick force", + "functionType": "ExpressionAndCondition", + "name": "StickForce", + "sentence": "multitouch controller _PARAM1_ _PARAM2_ stick force", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "max(0, Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].Force - SpriteMultitouchJoystick::DeadZone(ControllerIdentifier, JoystickIdentifier)) / (1 - SpriteMultitouchJoystick::DeadZone(ControllerIdentifier, JoystickIdentifier))" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier", + "type": "expression" + }, + { + "description": "Stick name", + "name": "JoystickIdentifier", + "supplementaryInformation": "[\"Primary\",\"Secondary\"]", + "type": "stringWithSelector" + } + ], + "objectGroups": [] + }, + { + "description": "Change the percentage the thumb has been pulled away from the joystick center (Range: 0 to 1).", + "fullName": "Joystick force", + "functionType": "Action", + "name": "SetJoystickForce", + "private": true, + "sentence": "Change the force of the joystick _PARAM2_ of multitouch controller _PARAM1_ to _PARAM3_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].Force", + "=", + "Value" + ] } - ], - "objectGroups": [] + ] + } + ], + "parameters": [ + { + "description": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier", + "type": "expression" }, { - "description": "Check if the button was just pressed.", - "fullName": "Button just pressed", - "functionType": "Condition", - "name": "IsJustPressed", - "sentence": "Button _PARAM0_ was just pressed", - "events": [ + "description": "Joystick name", + "name": "JoystickIdentifier", + "type": "string" + }, + { + "description": "Value", + "name": "Value", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Return the angle the joystick is pointing towards (Range: -180 to 180).", + "fullName": "Joystick angle (deprecated)", + "functionType": "Expression", + "name": "JoystickAngle", + "private": true, + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "True", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier)" ] } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier", + "type": "expression" + }, + { + "description": "Joystick name", + "name": "JoystickIdentifier", + "supplementaryInformation": "[\"Primary\",\"Secondary\"]", + "type": "stringWithSelector" + } + ], + "objectGroups": [] + }, + { + "description": "Return the angle the multitouch controller stick is pointing towards (Range: -180 to 180).", + "fullName": "Stick angle", + "functionType": "Expression", + "name": "StickAngle", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", - "type": "behavior" + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].Angle" + ] } - ], - "objectGroups": [] + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier", + "type": "expression" }, { - "description": "Check if the button is pressed.", - "fullName": "Button pressed", - "functionType": "Condition", - "name": "IsPressed", - "sentence": "Button _PARAM0_ is pressed", - "events": [ + "description": "Joystick name", + "name": "JoystickIdentifier", + "supplementaryInformation": "[\"Primary\",\"Secondary\"]", + "type": "stringWithSelector" + } + ], + "objectGroups": [] + }, + { + "description": "Change the angle the joystick is pointing towards (Range: -180 to 180).", + "fullName": "Joystick angle", + "functionType": "Action", + "name": "SetJoystickAngle", + "private": true, + "sentence": "Change the angle of the joystick _PARAM2_ of multitouch controller _PARAM1_ to _PARAM3_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "NumberVariable" - }, - "parameters": [ - "TouchId", - "!=", - "0" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].Angle", + "=", + "Value" ] } - ], - "parameters": [ + ] + } + ], + "parameters": [ + { + "description": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier", + "type": "expression" + }, + { + "description": "Joystick name", + "name": "JoystickIdentifier", + "type": "string" + }, + { + "description": "Value", + "name": "Value", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Return the multitouch contoller stick force on X axis (from -1 at the left to 1 at the right).", + "fullName": "Stick X force", + "functionType": "Expression", + "name": "StickForceX", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ { - "description": "Object", - "name": "Object", - "type": "object" - }, + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "SpriteMultitouchJoystick::JoystickForce(ControllerIdentifier, JoystickIdentifier) * cos(ToRad(SpriteMultitouchJoystick::JoystickAngle(ControllerIdentifier, JoystickIdentifier)))" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier", + "type": "expression" + }, + { + "description": "Joystick name", + "name": "JoystickIdentifier", + "supplementaryInformation": "[\"Primary\",\"Secondary\"]", + "type": "stringWithSelector" + } + ], + "objectGroups": [] + }, + { + "description": "Return the multitouch contoller stick force on Y axis (from -1 at the top to 1 at the bottom).", + "fullName": "Stick Y force", + "functionType": "Expression", + "name": "StickForceY", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", - "type": "behavior" + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "SpriteMultitouchJoystick::JoystickForce(ControllerIdentifier, JoystickIdentifier) * sin(ToRad(SpriteMultitouchJoystick::JoystickAngle(ControllerIdentifier, JoystickIdentifier)))" + ] } - ], - "objectGroups": [] + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier", + "type": "expression" }, { - "description": "Check if the button is released.", - "fullName": "Button released", - "functionType": "Condition", - "name": "IsReleased", - "sentence": "Button _PARAM0_ is released", + "description": "Joystick name", + "name": "JoystickIdentifier", + "supplementaryInformation": "[\"Primary\",\"Secondary\"]", + "type": "stringWithSelector" + } + ], + "objectGroups": [] + } + ], + "eventsBasedBehaviors": [ + { + "description": "Joystick that can be controlled by interacting with a touchscreen.", + "fullName": "Multitouch Joystick", + "name": "MultitouchJoystick", + "objectType": "", + "private": true, + "eventsFunctions": [ + { + "fullName": "", + "functionType": "Action", + "name": "onCreated", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "conditions": [], + "actions": [ { "type": { - "value": "BooleanVariable" + "value": "SpriteMultitouchJoystick::SetDeadZone" }, "parameters": [ - "IsReleased", - "True", + "", + "ControllerIdentifier", + "JoystickIdentifier", + "DeadZoneRadius", "" ] - } - ], - "actions": [ + }, { "type": { - "value": "SetReturnBoolean" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" }, "parameters": [ - "True" + "Object", + "Behavior", + "" ] } ] @@ -5146,18 +2927,17 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] }, { - "fullName": "Button state", + "fullName": "", "functionType": "Action", - "name": "SetButtonState", - "private": true, - "sentence": "Mark the button _PARAM0_ as _PARAM2_", + "name": "onDeActivate", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -5165,13 +2945,11 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::SetButtonState" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" }, "parameters": [ - "", - "ControllerIdentifier", - "ButtonIdentifier", - "ButtonState", + "Object", + "Behavior", "" ] } @@ -5187,189 +2965,26 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" - }, - { - "description": "Button state", - "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"JustPressed\",\"Pressed\",\"Released\"]", - "type": "stringWithSelector" } ], - "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "1", - "type": "Number", - "label": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier" - }, - { - "value": "A", - "type": "String", - "label": "Button identifier", - "name": "ButtonIdentifier" - }, - { - "value": "0", - "type": "Number", - "label": "TouchID", - "hidden": true, - "name": "TouchId" - }, - { - "value": "", - "type": "Number", - "label": "", - "hidden": true, - "name": "TouchIndex" - }, - { - "value": "", - "type": "Boolean", - "label": "Button released", - "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.", - "name": "Radius" - } - ], - "sharedPropertyDescriptors": [] - }, - { - "description": "Control a platformer character with a multitouch controller.", - "fullName": "Platformer multitouch controller mapper", - "name": "PlatformerMultitouchMapper", - "objectType": "", - "quickCustomizationVisibility": "hidden", - "eventsFunctions": [ - { - "fullName": "", - "functionType": "Action", - "name": "doStepPreEvents", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "\"Left\"", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateLeftKey" - }, - "parameters": [ - "Object", - "Property" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "\"Right\"", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateRightKey" - }, - "parameters": [ - "Object", - "Property" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "\"Up\"", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateUpKey" - }, - "parameters": [ - "Object", - "Property" - ] - }, - { - "type": { - "value": "PlatformBehavior::SimulateLadderKey" - }, - "parameters": [ - "Object", - "Property" - ] - } - ] - }, + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "Action", + "name": "doStepPreEvents", + "sentence": "", + "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" + "value": "HasGameJustResumed" }, "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "\"Down\"", "" ] } @@ -5377,41 +2992,210 @@ "actions": [ { "type": { - "value": "PlatformBehavior::SimulateDownKey" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" }, "parameters": [ "Object", - "Property" + "Behavior", + "" ] } ] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Manage touches", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::IsButtonPressed" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "HasAnyTouchOrMouseStarted" + }, + "parameters": [ + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyTouchIndex" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "0" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "StartedTouchOrMouseCount()", + "conditions": [], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::PropertyTouchId" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "0" + ] + }, + { + "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::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 }, - "parameters": [ - "", - "ControllerIdentifier", - "JumpButton", - "\"Down\"" + "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" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } ] } ], - "actions": [ + "parameters": [] + }, + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Update joystick position", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ { - "type": { - "value": "PlatformBehavior::SimulateJumpKey" - }, - "parameters": [ - "Object", - "Property" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::PropertyTouchId" + }, + "parameters": [ + "Object", + "Behavior", + "!=", + "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": [ @@ -5423,140 +3207,130 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::PlatformerMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "", - "type": "Behavior", - "label": "Platform character behavior", - "extraInformation": [ - "PlatformBehavior::PlatformerObjectBehavior" - ], - "choices": [], - "name": "Property" - }, - { - "value": "1", - "type": "Number", - "label": "Controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier" }, { - "value": "Primary", - "type": "Choice", - "label": "Joystick name", - "group": "Controls", - "choices": [ + "description": "the joystick force (from 0 to 1).", + "fullName": "Joystick force", + "functionType": "ExpressionAndCondition", + "name": "JoystickForce", + "sentence": "the joystick force", + "events": [ { - "label": "Primary", - "value": "Primary" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "max(0, JoystickForce - DeadZoneRadius) / (1 - DeadZoneRadius)" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" }, { - "label": "Secondary", - "value": "Secondary" + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } ], - "name": "JoystickIdentifier" + "objectGroups": [] }, - { - "value": "A", - "type": "String", - "label": "Jump button name", - "group": "Controls", - "name": "JumpButton" - } - ], - "sharedPropertyDescriptors": [] - }, - { - "description": "Control a 3D physics character with a multitouch controller.", - "fullName": "3D platformer multitouch controller mapper", - "name": "Platformer3DMultitouchMapper", - "objectType": "", - "quickCustomizationVisibility": "hidden", - "eventsFunctions": [ { "fullName": "", - "functionType": "Action", - "name": "doStepPreEvents", + "functionType": "ActionWithOperator", + "getterName": "JoystickForce", + "name": "SetJoystickForce", + "private": true, "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::StickForce" - }, - "parameters": [ - "", - ">", - "0", - "ControllerIdentifier", - "JoystickIdentifier", - "" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "Physics3D::PhysicsCharacter3D::SetForwardAngle" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickForce" }, "parameters": [ "Object", - "PhysicsCharacter3D", + "Behavior", "=", - "SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier) + CameraAngle(Object.Layer())" + "Value" ] }, { "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateStick" + "value": "SpriteMultitouchJoystick::SetJoystickForce" }, "parameters": [ - "Object", - "PhysicsCharacter3D", - "-90", - "SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier)" + "", + "ControllerIdentifier", + "JoystickIdentifier", + "JoystickForce", + "" ] } ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Return the angle the joystick is pointing towards (Range: -180 to 180).", + "fullName": "Joystick angle", + "functionType": "Expression", + "name": "JoystickAngle", + "sentence": "", + "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::IsButtonPressed" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JumpButton", - "\"Down\"" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" + "value": "SetReturnNumber" }, "parameters": [ - "Object", - "PhysicsCharacter3D" + "JoystickAngle" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -5566,124 +3340,45 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::Platformer3DMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "", - "type": "Behavior", - "label": "3D physics character", - "extraInformation": [ - "Physics3D::PhysicsCharacter3D" - ], - "choices": [], - "name": "PhysicsCharacter3D" - }, - { - "value": "1", - "type": "Number", - "label": "Controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier" - }, - { - "value": "Primary", - "type": "Choice", - "label": "Walk joystick", - "group": "Controls", - "choices": [ - { - "label": "Primary", - "value": "Primary" - }, - { - "label": "Secondary", - "value": "Secondary" - } - ], - "name": "JoystickIdentifier" }, { - "value": "A", - "type": "String", - "label": "Jump button name", - "group": "Controls", - "name": "JumpButton" - } - ], - "sharedPropertyDescriptors": [] - }, - { - "description": "Control a 3D physics character with a multitouch controller.", - "fullName": "3D shooter multitouch controller mapper", - "name": "Shooter3DMultitouchMapper", - "objectType": "", - "quickCustomizationVisibility": "hidden", - "eventsFunctions": [ - { - "fullName": "", + "description": "Change the angle the joystick is pointing towards (Range: -180 to 180).", + "fullName": "Joystick angle", "functionType": "Action", - "name": "doStepPreEvents", - "sentence": "", + "name": "SetJoystickAngle", + "private": true, + "sentence": "Change the joystick angle of _PARAM0_ to _PARAM2_", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::StickForce" - }, - "parameters": [ - "", - ">", - "0", - "ControllerIdentifier", - "JoystickIdentifier", - "" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateStick" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickAngle" }, "parameters": [ "Object", - "PhysicsCharacter3D", - "SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier)", - "SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier)" + "Behavior", + "=", + "Value" ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + }, { "type": { - "value": "SpriteMultitouchJoystick::IsButtonPressed" + "value": "SpriteMultitouchJoystick::SetJoystickAngle" }, "parameters": [ "", "ControllerIdentifier", - "JumpButton", - "\"Down\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" - }, - "parameters": [ - "Object", - "PhysicsCharacter3D" + "JoystickIdentifier", + "JoystickAngle", + "" ] } ] @@ -5698,146 +3393,138 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::Shooter3DMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" + }, + { + "description": "Angle", + "name": "Value", + "type": "expression" } ], "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "", - "type": "Behavior", - "label": "3D physics character", - "extraInformation": [ - "Physics3D::PhysicsCharacter3D" - ], - "choices": [], - "name": "PhysicsCharacter3D" - }, - { - "value": "1", - "type": "Number", - "label": "Controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier" }, { - "value": "Primary", - "type": "Choice", - "label": "Walk joystick", - "group": "Controls", - "choices": [ + "description": "Return the stick force on X axis (from -1 at the left to 1 at the right).", + "fullName": "Stick X force", + "functionType": "Expression", + "name": "StickForceX", + "sentence": "", + "events": [ { - "label": "Primary", - "value": "Primary" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "Object.Behavior::JoystickForce() * cos(ToRad(Object.Behavior::JoystickAngle()))" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" }, { - "label": "Secondary", - "value": "Secondary" + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } ], - "name": "JoystickIdentifier" + "objectGroups": [] }, { - "value": "A", - "type": "String", - "label": "Jump button name", - "group": "Controls", - "name": "JumpButton" - } - ], - "sharedPropertyDescriptors": [] - }, - { - "description": "Control camera rotations with a multitouch controller.", - "fullName": "First person camera multitouch controller mapper", - "name": "FirstPersonMultitouchMapper", - "objectType": "", - "quickCustomizationVisibility": "hidden", - "eventsFunctions": [ - { - "fullName": "", - "functionType": "Action", - "name": "doStepPreEvents", + "description": "Return the stick force on Y axis (from -1 at the top to 1 at the bottom).", + "fullName": "Stick Y force", + "functionType": "Expression", + "name": "StickForceY", "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", - "=", - "SpriteMultitouchJoystick::AcceleratedSpeed(CurrentRotationSpeedZ, SpriteMultitouchJoystick::StickForceX(ControllerIdentifier, CameraStick) * HorizontalRotationSpeedMax, HorizontalRotationSpeedMax, HorizontalRotationAcceleration, HorizontalRotationDeceleration)" - ] - }, - { - "type": { - "value": "SetAngle" - }, - "parameters": [ - "Object", - "+", - "CurrentRotationSpeedZ * TimeDelta()" - ] - }, - { - "type": { - "value": "SetNumberVariable" + "value": "SetReturnNumber" }, "parameters": [ - "CurrentRotationSpeedY", - "=", - "SpriteMultitouchJoystick::AcceleratedSpeed(CurrentRotationSpeedY, SpriteMultitouchJoystick::StickForceY(ControllerIdentifier, CameraStick) * VerticalRotationSpeedMax, VerticalRotationSpeedMax, VerticalRotationAcceleration, VerticalRotationDeceleration)" + "Object.Behavior::JoystickForce() * sin(ToRad(Object.Behavior::JoystickAngle()))" ] - }, + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Check if joystick is pushed in a given direction.", + "fullName": "Joystick pushed in a direction (4-way movement)", + "functionType": "Condition", + "name": "IsDirectionPushed4Way", + "sentence": "_PARAM0_ is pushed in direction _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { "type": { - "value": "Scene3D::Base3DBehavior::SetRotationY" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::JoystickForce" }, "parameters": [ "Object", - "Object3D", - "+", - "CurrentRotationSpeedY * TimeDelta()" + "Behavior", + ">", + "0", + "" ] }, { "type": { - "value": "Scene3D::Base3DBehavior::SetRotationY" + "value": "SpriteMultitouchJoystick::IsAngleIn4WayDirection" }, "parameters": [ - "Object", - "Object3D", - "=", - "clamp(Object.Object3D::RotationY(), VerticalAngleMin, VerticalAngleMax)" + "", + "JoystickAngle", + "Direction", + "" ] - }, + } + ], + "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper::LookFromObjectEyes" + "value": "SetReturnBoolean" }, "parameters": [ - "Object", - "Behavior", - "" + "True" ] } ] @@ -5852,83 +3539,59 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" + }, + { + "description": "Direction", + "name": "Direction", + "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\"]", + "type": "stringWithSelector" } ], "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", + "description": "Check if joystick is pushed in a given direction.", + "fullName": "Joystick pushed in a direction (8-way movement)", + "functionType": "Condition", + "name": "IsDirectionPushed8Way", + "sentence": "_PARAM0_ is pushed in direction _PARAM2_", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ + "conditions": [ { "type": { - "value": "CentreCamera" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::JoystickForce" }, "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\")", + "Behavior", + ">", + "0", "" ] }, { "type": { - "value": "Scene3D::SetCameraRotationY" + "value": "SpriteMultitouchJoystick::IsAngleIn8WayDirection" }, "parameters": [ "", - "=", - "Object.Object3D::RotationX()", - "GetArgumentAsString(\"Layer\")", + "JoystickAngle", + "Direction", "" ] - }, + } + ], + "actions": [ { "type": { - "value": "SetCameraAngle" + "value": "SetReturnBoolean" }, "parameters": [ - "", - "=", - "Object.Angle() + 90", - "Object.Layer()", - "" + "True" ] } ] @@ -5943,38 +3606,52 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" + }, + { + "description": "Direction", + "name": "Direction", + "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\",\"UpLeft\",\"UpRight\",\"DownLeft\",\"DownRight\"]", + "type": "stringWithSelector" } ], "objectGroups": [] }, { - "description": "the maximum horizontal rotation speed of the object.", - "fullName": "Maximum horizontal rotation speed", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper horizontal rotation configuration", - "name": "HorizontalRotationSpeedMax", - "sentence": "the maximum horizontal rotation speed", + "description": "Check if a joystick is pressed.", + "fullName": "Joystick pressed", + "functionType": "Condition", + "name": "IsPressed", + "sentence": "Joystick _PARAM0_ is pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::PropertyTouchId" + }, + "parameters": [ + "Object", + "Behavior", + "!=", + "0" + ] + } + ], "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "SetReturnBoolean" }, "parameters": [ - "HorizontalRotationSpeedMax" + "True" ] } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -5984,18 +3661,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] }, { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "HorizontalRotationSpeedMax", - "name": "SetHorizontalRotationSpeedMax", - "sentence": "", + "description": "Reset the joystick values (except for angle, which stays the same)", + "fullName": "Reset", + "functionType": "Action", + "name": "Reset", + "private": true, + "sentence": "Reset the joystick of _PARAM0_", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -6003,12 +3681,25 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "0", + "" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyTouchId" }, "parameters": [ - "HorizontalRotationSpeedMax", + "Object", + "Behavior", "=", - "Value" + "0" ] } ] @@ -6023,19 +3714,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the horizontal rotation acceleration of the object.", - "fullName": "Horizontal rotation acceleration", + "description": "the multitouch controller identifier.", + "fullName": "Multitouch controller identifier", "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper horizontal rotation configuration", - "name": "HorizontalRotationAcceleration", - "sentence": "the horizontal rotation acceleration", + "group": "Multitouch Joystick configuration", + "name": "ControllerIdentifier", + "sentence": "the multitouch controller identifier", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -6046,7 +3737,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "HorizontalRotationAcceleration" + "ControllerIdentifier" ] } ] @@ -6064,7 +3755,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], @@ -6073,8 +3764,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "HorizontalRotationAcceleration", - "name": "SetHorizontalRotationAcceleration", + "getterName": "ControllerIdentifier", + "name": "SetControllerIdentifier", "sentence": "", "events": [ { @@ -6083,10 +3774,11 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyControllerIdentifier" }, "parameters": [ - "HorizontalRotationAcceleration", + "Object", + "Behavior", "=", "Value" ] @@ -6103,19 +3795,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the horizontal rotation deceleration of the object.", - "fullName": "Horizontal rotation deceleration", + "description": "the joystick name.", + "fullName": "Joystick name", "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper horizontal rotation configuration", - "name": "HorizontalRotationDeceleration", - "sentence": "the horizontal rotation deceleration", + "group": "Multitouch Joystick configuration", + "name": "JoystickIdentifier", + "sentence": "the joystick name", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -6123,17 +3815,17 @@ "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "SetReturnString" }, "parameters": [ - "HorizontalRotationDeceleration" + "JoystickIdentifier" ] } ] } ], "expressionType": { - "type": "expression" + "type": "string" }, "parameters": [ { @@ -6144,7 +3836,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], @@ -6153,8 +3845,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "HorizontalRotationDeceleration", - "name": "SetHorizontalRotationDeceleration", + "getterName": "JoystickIdentifier", + "name": "SetJoystickIdentifier", "sentence": "", "events": [ { @@ -6163,10 +3855,11 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickIdentifier" }, "parameters": [ - "HorizontalRotationDeceleration", + "Object", + "Behavior", "=", "Value" ] @@ -6183,19 +3876,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the maximum vertical rotation speed of the object.", - "fullName": "Maximum vertical rotation speed", + "description": "the dead zone radius (range: 0 to 1) of the joystick. 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).", + "fullName": "Dead zone radius", "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper vertical rotation configuration", - "name": "VerticalRotationSpeedMax", - "sentence": "the maximum vertical rotation speed", + "group": "Multitouch Joystick configuration", + "name": "DeadZoneRadius", + "sentence": "the dead zone radius", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -6206,7 +3899,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "VerticalRotationSpeedMax" + "DeadZoneRadius" ] } ] @@ -6224,7 +3917,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], @@ -6233,8 +3926,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "VerticalRotationSpeedMax", - "name": "SetVerticalRotationSpeedMax", + "getterName": "DeadZoneRadius", + "name": "SetDeadZoneRadius", "sentence": "", "events": [ { @@ -6243,10 +3936,11 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyDeadZoneRadius" }, "parameters": [ - "VerticalRotationSpeedMax", + "Object", + "Behavior", "=", "Value" ] @@ -6263,232 +3957,271 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] + } + ], + "propertyDescriptors": [ + { + "value": "1", + "type": "Number", + "label": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier" }, { - "description": "the vertical rotation acceleration of the object.", - "fullName": "Vertical rotation acceleration", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper vertical rotation configuration", - "name": "VerticalRotationAcceleration", - "sentence": "the vertical rotation acceleration", + "value": "Primary", + "type": "String", + "label": "Joystick name", + "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": "0", + "type": "Number", + "label": "Joystick angle (range: -180 to 180)", + "hidden": true, + "name": "JoystickAngle" + }, + { + "value": "0", + "type": "Number", + "label": "Joystick force (range: 0 to 1)", + "hidden": true, + "name": "JoystickForce" + }, + { + "value": "0", + "type": "Number", + "label": "", + "hidden": true, + "name": "TouchId" + }, + { + "value": "", + "type": "Number", + "label": "", + "hidden": true, + "name": "TouchIndex" + } + ], + "sharedPropertyDescriptors": [] + }, + { + "description": "Detect button presses made on a touchscreen.", + "fullName": "Multitouch button", + "name": "MultitouchButton", + "objectType": "", + "eventsFunctions": [ + { + "fullName": "", + "functionType": "Action", + "name": "doStepPreEvents", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::IsReleased" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } + ], "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyIsReleased" }, "parameters": [ - "VerticalRotationAcceleration" + "Object", + "Behavior", + "no" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + }, + "parameters": [ + "Object", + "Behavior", + "\"Idle\"", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "SpriteMultitouchJoystick::MultitouchButton::IsPressed" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + }, + { + "type": { + "value": "HasAnyTouchOrMouseStarted" + }, + "parameters": [ + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchIndex" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "0" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "StartedTouchOrMouseCount()", + "conditions": [], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "CollisionPoint" + }, + "parameters": [ + "Object", + "TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)", + "TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchId" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "StartedTouchOrMouseId(TouchIndex)" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + }, + "parameters": [ + "Object", + "Behavior", + "\"Pressed\"", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchIndex" + }, + "parameters": [ + "Object", + "Behavior", + "+", + "1" + ] + } + ] + } ] } ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "VerticalRotationAcceleration", - "name": "SetVerticalRotationAcceleration", - "sentence": "", - "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ + "conditions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchButton::IsPressed" }, "parameters": [ - "VerticalRotationAcceleration", - "=", - "Value" + "Object", + "Behavior", + "" ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "the vertical rotation deceleration of the object.", - "fullName": "Vertical rotation deceleration", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper vertical rotation configuration", - "name": "VerticalRotationDeceleration", - "sentence": "the vertical rotation deceleration", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ + }, { "type": { - "value": "SetReturnNumber" + "value": "HasTouchEnded" }, "parameters": [ - "VerticalRotationDeceleration" + "", + "TouchId" ] } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "VerticalRotationDeceleration", - "name": "SetVerticalRotationDeceleration", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + ], "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" }, "parameters": [ - "VerticalRotationDeceleration", - "=", - "Value" + "Object", + "Behavior", + "\"Released\"", + "" ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "the minimum vertical camera angle of the object.", - "fullName": "Minimum vertical camera angle", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper vertical rotation configuration", - "name": "VerticalAngleMin", - "sentence": "the minimum vertical camera angle", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ + }, { "type": { - "value": "SetReturnNumber" + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyIsReleased" }, "parameters": [ - "VerticalAngleMin" + "Object", + "Behavior", + "yes" ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "VerticalAngleMin", - "name": "SetVerticalAngleMin", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ + }, { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchId" }, "parameters": [ - "VerticalAngleMin", + "Object", + "Behavior", "=", - "Value" + "0" ] } ] @@ -6503,72 +4236,39 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the maximum vertical camera angle of the object.", - "fullName": "Maximum vertical camera angle", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper vertical rotation configuration", - "name": "VerticalAngleMax", - "sentence": "the maximum vertical camera angle", + "description": "Check if button is released.", + "fullName": "Button released", + "functionType": "Condition", + "name": "IsReleased", + "sentence": "Button _PARAM0_ is released", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ + "conditions": [ { "type": { - "value": "SetReturnNumber" + "value": "SpriteMultitouchJoystick::MultitouchButton::PropertyIsReleased" }, "parameters": [ - "VerticalAngleMax" + "Object", + "Behavior" ] } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "VerticalAngleMax", - "name": "SetVerticalAngleMax", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + ], "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SetReturnBoolean" }, "parameters": [ - "VerticalAngleMax", - "=", - "Value" + "True" ] } ] @@ -6583,38 +4283,46 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", "type": "behavior" } ], - "objectGroups": [] - }, - { - "description": "the z position offset of the object.", - "fullName": "Z position offset", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper position configuration", - "name": "OffsetZ", - "sentence": "the z position offset", + "objectGroups": [] + }, + { + "description": "Check if button is pressed.", + "fullName": "Button pressed", + "functionType": "Condition", + "name": "IsPressed", + "sentence": "Button _PARAM0_ is pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::PropertyTouchId" + }, + "parameters": [ + "Object", + "Behavior", + "!=", + "0" + ] + } + ], "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "SetReturnBoolean" }, "parameters": [ - "OffsetZ" + "True" ] } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -6624,18 +4332,18 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", "type": "behavior" } ], "objectGroups": [] }, { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "OffsetZ", - "name": "SetOffsetZ", - "sentence": "", + "fullName": "Button state", + "functionType": "Action", + "name": "SetButtonState", + "private": true, + "sentence": "Mark the button _PARAM0_ as _PARAM2_", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -6643,12 +4351,14 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::SetButtonState" }, "parameters": [ - "OffsetZ", - "=", - "Value" + "", + "ControllerIdentifier", + "ButtonIdentifier", + "ButtonState", + "" ] } ] @@ -6663,140 +4373,61 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", "type": "behavior" + }, + { + "description": "Button state", + "name": "ButtonState", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "type": "stringWithSelector" } ], "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...)", + "label": "Multitouch 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": "A", + "type": "String", + "label": "Button identifier", + "name": "ButtonIdentifier" }, { "value": "0", "type": "Number", - "unit": "Pixel", - "label": "Z position offset", - "group": "Position", - "name": "OffsetZ" + "label": "TouchID", + "hidden": true, + "name": "TouchId" }, { - "value": "0", + "value": "", "type": "Number", - "unit": "AngularSpeed", - "label": "Current rotation speed Z", + "label": "", "hidden": true, - "name": "CurrentRotationSpeedZ" + "name": "TouchIndex" }, { - "value": "0", - "type": "Number", - "unit": "AngularSpeed", - "label": "Current rotation speed Y", + "value": "", + "type": "Boolean", + "label": "Button released", "hidden": true, - "name": "CurrentRotationSpeedY" + "name": "IsReleased" } ], "sharedPropertyDescriptors": [] }, { - "description": "Control a 3D physics car with a multitouch controller.", - "fullName": "3D car multitouch controller mapper", - "name": "PhysicsCar3DMultitouchMapper", + "description": "Control a platformer character with a multitouch controller.", + "fullName": "Platformer multitouch controller mapper", + "name": "PlatformerMultitouchMapper", "objectType": "", - "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -6809,14 +4440,13 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::StickForce" + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" }, "parameters": [ "", - ">", - "0", "ControllerIdentifier", - "SteerJoystickIdentifier", + "JoystickIdentifier", + "\"Left\"", "" ] } @@ -6824,12 +4454,11 @@ "actions": [ { "type": { - "value": "Physics3D::PhysicsCar3D::SimulateSteeringStick" + "value": "PlatformBehavior::SimulateLeftKey" }, "parameters": [ "Object", - "PhysicsCar3D", - "SpriteMultitouchJoystick::StickForceX(ControllerIdentifier, \"Primary\")" + "Property" ] } ] @@ -6839,14 +4468,78 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::StickForce" + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JoystickIdentifier", + "\"Right\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "PlatformBehavior::SimulateRightKey" + }, + "parameters": [ + "Object", + "Property" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JoystickIdentifier", + "\"Up\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "PlatformBehavior::SimulateUpKey" + }, + "parameters": [ + "Object", + "Property" + ] + }, + { + "type": { + "value": "PlatformBehavior::SimulateLadderKey" + }, + "parameters": [ + "Object", + "Property" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" }, "parameters": [ "", - ">", - "0", "ControllerIdentifier", - "SpeedJoystickIdentifier", + "JoystickIdentifier", + "\"Down\"", "" ] } @@ -6854,12 +4547,11 @@ "actions": [ { "type": { - "value": "Physics3D::PhysicsCar3D::SimulateAcceleratorStick" + "value": "PlatformBehavior::SimulateDownKey" }, "parameters": [ "Object", - "PhysicsCar3D", - "-SpriteMultitouchJoystick::StickForceY(ControllerIdentifier, \"Secondary\")" + "Property" ] } ] @@ -6874,7 +4566,7 @@ "parameters": [ "", "ControllerIdentifier", - "HandBrakeButton", + "JumpButton", "\"Down\"" ] } @@ -6882,11 +4574,11 @@ "actions": [ { "type": { - "value": "Physics3D::PhysicsCar3D::SimulateHandBrakeKey" + "value": "PlatformBehavior::SimulateJumpKey" }, "parameters": [ "Object", - "PhysicsCar3D" + "Property" ] } ] @@ -6901,7 +4593,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::PhysicsCar3DMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::PlatformerMultitouchMapper", "type": "behavior" } ], @@ -6912,12 +4604,12 @@ { "value": "", "type": "Behavior", - "label": "3D physics car", + "label": "Platform character behavior", "extraInformation": [ - "Physics3D::PhysicsCar3D" + "PlatformBehavior::PlatformerObjectBehavior" ], "choices": [], - "name": "PhysicsCar3D" + "name": "Property" }, { "value": "1", @@ -6928,24 +4620,7 @@ { "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", + "label": "Joystick name", "group": "Controls", "choices": [ { @@ -6957,14 +4632,14 @@ "value": "Secondary" } ], - "name": "SpeedJoystickIdentifier" + "name": "JoystickIdentifier" }, { - "value": "B", + "value": "A", "type": "String", - "label": "Hand brake button name", + "label": "Jump button name", "group": "Controls", - "name": "HandBrakeButton" + "name": "JumpButton" } ], "sharedPropertyDescriptors": [] @@ -6974,7 +4649,6 @@ "fullName": "Top-down multitouch controller mapper", "name": "TopDownMultitouchMapper", "objectType": "", - "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -6987,10 +4661,11 @@ "conditions": [ { "type": { - "value": "StringVariable" + "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" }, "parameters": [ - "StickMode", + "Object", + "Behavior", "=", "\"Analog\"" ] @@ -7015,10 +4690,11 @@ "conditions": [ { "type": { - "value": "StringVariable" + "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" }, "parameters": [ - "StickMode", + "Object", + "Behavior", "=", "\"360°\"" ] @@ -7043,10 +4719,11 @@ "conditions": [ { "type": { - "value": "StringVariable" + "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" }, "parameters": [ - "StickMode", + "Object", + "Behavior", "=", "\"8 Directions\"" ] @@ -7773,90 +5450,17 @@ "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "conditions": [], + "actions": [ { "type": { - "inverted": true, - "value": "SpriteMultitouchJoystick::IsInGameEdition" + "value": "MettreAutour" }, "parameters": [ - "", - "" - ] - } - ], - "actions": [], - "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" - }, - "parameters": [ - "Object", - "no", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "ShouldBeHiddenWhenReleased", - "False", - "" - ] - } + "Thumb", + "Border", + "Border.MultitouchJoystick::JoystickForce() * Border.Width() / 2", + "Border.MultitouchJoystick::JoystickAngle()" ] } ] @@ -7924,7 +5528,7 @@ "Border", "MultitouchJoystick", "=", - "ControllerIdentifier", + "Object.PropertyControllerIdentifier()", "" ] }, @@ -7936,7 +5540,7 @@ "Border", "MultitouchJoystick", "=", - "JoystickIdentifier", + "Object.PropertyJoystickIdentifier()", "" ] }, @@ -7948,92 +5552,7 @@ "Border", "MultitouchJoystick", "=", - "DeadZoneRadius", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "supplementaryInformation": "SpriteMultitouchJoystick::SpriteMultitouchJoystick", - "type": "object" - } - ], - "objectGroups": [] - }, - { - "description": "Show the joystick until it is released.", - "fullName": "Show and start pressing", - "functionType": "Action", - "name": "TeleportAndPress", - "sentence": "Show _PARAM0_ at the cursor position and start pressing", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "HasAnyTouchOrMouseStarted" - }, - "parameters": [ - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "MettreXY" - }, - "parameters": [ - "Object", - "=", - "Object.ParentTouchX(StartedTouchOrMouseId(0))", - "=", - "Object.ParentTouchY(StartedTouchOrMouseId(0))" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::ActivateControl" - }, - "parameters": [ - "Object", - "yes", - "" - ] - }, - { - "type": { - "value": "Montre" - }, - "parameters": [ - "Object", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "ShouldBeHiddenWhenReleased", - "True", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::ForceStartPressing" - }, - "parameters": [ - "Border", - "MultitouchJoystick", - "StartedTouchOrMouseId(0)", + "Object.PropertyDeadZoneRadius()", "" ] } @@ -8050,92 +5569,6 @@ ], "objectGroups": [] }, - { - "description": "Return the X position of a specified touch", - "fullName": "Touch X position (on parent)", - "functionType": "Expression", - "name": "ParentTouchX", - "private": true, - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [] - }, - { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "const object = objects[0];", - "const touchId = eventsFunctionContext.getArgument(\"TouchId\");", - "eventsFunctionContext.returnValue = gdjs.evtTools.input.getTouchX(object.getInstanceContainer(), touchId, object.getLayer());" - ], - "parameterObjects": "Object", - "useStrict": true, - "eventsSheetExpanded": false - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "supplementaryInformation": "SpriteMultitouchJoystick::SpriteMultitouchJoystick", - "type": "object" - }, - { - "description": "Touch identifier", - "name": "TouchId", - "type": "expression" - } - ], - "objectGroups": [] - }, - { - "description": "Return the X position of a specified touch", - "fullName": "Touch X position (on parent)", - "functionType": "Expression", - "name": "ParentTouchY", - "private": true, - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [] - }, - { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "const object = objects[0];", - "const touchId = eventsFunctionContext.getArgument(\"TouchId\");", - "eventsFunctionContext.returnValue = gdjs.evtTools.input.getTouchY(object.getInstanceContainer(), touchId, object.getLayer());" - ], - "parameterObjects": "Object", - "useStrict": true, - "eventsSheetExpanded": false - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "supplementaryInformation": "SpriteMultitouchJoystick::SpriteMultitouchJoystick", - "type": "object" - }, - { - "description": "Touch identifier", - "name": "TouchId", - "type": "expression" - } - ], - "objectGroups": [] - }, { "description": "De/activate control of the joystick.", "fullName": "De/activate control", @@ -8149,12 +5582,10 @@ { "type": { "inverted": true, - "value": "BooleanVariable" + "value": "GetArgumentAsBoolean" }, "parameters": [ - "ShouldActivate", - "True", - "" + "\"ShouldActivate\"" ] } ], @@ -8176,12 +5607,10 @@ "conditions": [ { "type": { - "value": "BooleanVariable" + "value": "GetArgumentAsBoolean" }, "parameters": [ - "ShouldActivate", - "True", - "" + "\"ShouldActivate\"" ] } ], @@ -8855,15 +6284,9 @@ "description": "Only used by the scene editor.", "hidden": true, "name": "ParentOrigin" - }, - { - "value": "", - "type": "Boolean", - "label": "", - "hidden": true, - "name": "ShouldBeHiddenWhenReleased" } - ] + ], + "variants": [] } ] }, diff --git a/examples/starting-top-down-survival-crafting/starting-top-down-survival-crafting.json b/examples/starting-top-down-survival-crafting/starting-top-down-survival-crafting.json index 763ed9f58..2719f407c 100644 --- a/examples/starting-top-down-survival-crafting/starting-top-down-survival-crafting.json +++ b/examples/starting-top-down-survival-crafting/starting-top-down-survival-crafting.json @@ -4025,19 +4025,19 @@ "category": "Input", "extensionNamespace": "", "fullName": "Multitouch joystick and buttons (sprite)", - "gdevelopVersion": ">=5.5.222", + "gdevelopVersion": "", "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", + "version": "1.4.0", "description": [ - "Multitouch joysticks are objects showing a joystick on the screen, useful for mobile. They work like a physical gamepad:", + "Multitouch joysticks can be used the same way as physical gamepads:", "- 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.", + "- 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)." ], @@ -4102,33 +4102,108 @@ ], "eventsFunctions": [ { - "description": "Check if the events are running for the editor.", - "fullName": "Editor is running", + "description": "Check if a button is pressed on a gamepad.", + "fullName": "Multitouch controller button pressed", "functionType": "Condition", - "name": "IsInGameEdition", - "private": true, - "sentence": "Events are running for the editor", + "name": "IsButtonPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", "events": [ { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "const game = runtimeScene.getGame();\r", - "eventsFunctionContext.returnValue = game.isInGameEdition && game.isInGameEdition();" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"Pressed\"" + ] + } ], - "parameterObjects": "", - "useStrict": true, - "eventsSheetExpanded": false + "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" } ], - "parameters": [], "objectGroups": [] }, { - "fullName": "Accelerated speed", - "functionType": "Expression", - "name": "AcceleratedSpeed", + "description": "Check if a button is released on a gamepad.", + "fullName": "Multitouch controller button released", + "functionType": "Condition", + "name": "IsButtonReleased", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is released", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"Released\"" + ] + } + ], + "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": "Change a button state for a multitouch controller.", + "fullName": "Button state", + "functionType": "Action", + "name": "SetButtonState", "private": true, - "sentence": "", + "sentence": "Mark _PARAM2_ button as _PARAM3_ for multitouch controller _PARAM1_", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -4136,443 +4211,108 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SetStringVariable" }, "parameters": [ - "AcceleratedSpeed", + "Controllers[ControllerIdentifier].Buttons[Button].State", "=", - "CurrentSpeed" + "ButtonState" ] } - ], - "events": [ + ] + } + ], + "parameters": [ + { + "description": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier", + "type": "expression" + }, + { + "description": "Button name", + "name": "Button", + "type": "string" + }, + { + "description": "Button state", + "name": "ButtonState", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "type": "stringWithSelector" + } + ], + "objectGroups": [] + }, + { + "description": "Change the dead zone radius of a joystick. 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).", + "fullName": "Dead zone radius", + "functionType": "Action", + "name": "SetDeadZone", + "private": true, + "sentence": "Change the dead zone of multitouch joystick _PARAM2_ of multitouch controller _PARAM1_ to _PARAM3_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ { - "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", - "=", - "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": "NumberVariable" - }, - "parameters": [ - "TargetedSpeed", - "=", - "0" - ] - } - ], - "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", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "clamp(AcceleratedSpeed, -SpeedMax, SpeedMax)" - ] - } + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].DeadZone", + "=", + "DeadZoneRadius" ] } - ], - "variables": [ - { - "name": "AcceleratedSpeed", - "type": "number", - "value": 0 - } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { - "description": "Current speed", - "name": "CurrentSpeed", - "type": "expression" - }, - { - "description": "Targeted speed", - "name": "TargetedSpeed", - "type": "expression" - }, - { - "description": "Max speed", - "name": "SpeedMax", + "description": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier", "type": "expression" }, { - "description": "Acceleration", - "name": "Acceleration", - "type": "expression" + "description": "Joystick name", + "name": "JoystickIdentifier", + "type": "string" }, { - "description": "Deceleration", - "name": "Deceleration", + "description": "Dead zone radius", + "name": "DeadZoneRadius", + "supplementaryInformation": "[]", "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", + "description": "Return the dead zone radius of a joystick. 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).", + "fullName": "Dead zone radius", + "functionType": "Expression", + "name": "DeadZone", + "private": true, + "sentence": "Change multitouch joystick _PARAM2_ of multitouch controller _PARAM1_ dead zone to _PARAM3_", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Buttons[Button].State", - "=", - "\"JustPressed\"" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "SetReturnBoolean" + "value": "SetReturnNumber" }, "parameters": [ - "True" + "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].DeadZone" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Multitouch controller identifier (1, 2, 3, 4...)", @@ -4580,273 +4320,28 @@ "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\"]", + "description": "Joystick name", + "name": "JoystickIdentifier", "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", + "description": "the direction index (left = 1, bottom = 1, right = 2, top = 3) for an angle (in degrees).", + "fullName": "Angle to 4-way index", + "functionType": "ExpressionAndCondition", + "name": "AngleTo4Way", + "private": true, + "sentence": "The angle _PARAM1_ 4-way index", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "conditions": [], + "actions": [ { "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", - "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is released", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Buttons[Button].State", - "=", - "\"Released\"" - ] - } - ], - "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": "Change a button state for a multitouch controller.", - "fullName": "Button state", - "functionType": "Action", - "name": "SetButtonState", - "private": true, - "sentence": "Mark _PARAM2_ button as _PARAM3_ for multitouch controller _PARAM1_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetStringVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Buttons[Button].State", - "=", - "ButtonState" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" - }, - { - "description": "Button name", - "name": "Button", - "type": "string" - }, - { - "description": "Button state", - "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"JustPressed\",\"Released\"]", - "type": "stringWithSelector" - } - ], - "objectGroups": [] - }, - { - "description": "Change the dead zone radius of a joystick. 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).", - "fullName": "Dead zone radius", - "functionType": "Action", - "name": "SetDeadZone", - "private": true, - "sentence": "Change the dead zone of multitouch joystick _PARAM2_ of multitouch controller _PARAM1_ to _PARAM3_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].DeadZone", - "=", - "DeadZoneRadius" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" - }, - { - "description": "Joystick name", - "name": "JoystickIdentifier", - "type": "string" - }, - { - "description": "Dead zone radius", - "name": "DeadZoneRadius", - "supplementaryInformation": "[]", - "type": "expression" - } - ], - "objectGroups": [] - }, - { - "description": "Return the dead zone radius of a joystick. 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).", - "fullName": "Dead zone radius", - "functionType": "Expression", - "name": "DeadZone", - "private": true, - "sentence": "Change multitouch joystick _PARAM2_ of multitouch controller _PARAM1_ dead zone to _PARAM3_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].DeadZone" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" - }, - { - "description": "Joystick name", - "name": "JoystickIdentifier", - "type": "string" - } - ], - "objectGroups": [] - }, - { - "description": "the direction index (left = 1, bottom = 1, right = 2, top = 3) for an angle (in degrees).", - "fullName": "Angle to 4-way index", - "functionType": "ExpressionAndCondition", - "name": "AngleTo4Way", - "private": true, - "sentence": "The angle _PARAM1_ 4-way index", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" + "value": "SetReturnNumber" }, "parameters": [ "mod(round(Angle * 4 / 360), 4)" @@ -5591,11 +5086,6 @@ "name": "JoystickIdentifier", "supplementaryInformation": "[\"Primary\",\"Secondary\"]", "type": "stringWithSelector" - }, - { - "description": "", - "name": "Coucou", - "type": "expression" } ], "objectGroups": [] @@ -5825,7 +5315,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "XFromAngleAndDistance(SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier), SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier))" + "SpriteMultitouchJoystick::JoystickForce(ControllerIdentifier, JoystickIdentifier) * cos(ToRad(SpriteMultitouchJoystick::JoystickAngle(ControllerIdentifier, JoystickIdentifier)))" ] } ] @@ -5865,7 +5355,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "YFromAngleAndDistance(SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier), SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier))" + "SpriteMultitouchJoystick::JoystickForce(ControllerIdentifier, JoystickIdentifier) * sin(ToRad(SpriteMultitouchJoystick::JoystickAngle(ControllerIdentifier, JoystickIdentifier)))" ] } ] @@ -5888,133 +5378,16 @@ } ], "objectGroups": [] - }, + } + ], + "eventsBasedBehaviors": [ { - "description": "Check if a new touch has started on the right or left side of the screen.", - "fullName": "New touch on a screen side", - "functionType": "Condition", - "group": "Multitouch Joystick", - "name": "HasTouchStartedOnScreenSide", - "sentence": "A new touch has started on the _PARAM2_ side of the screen on _PARAM1_'s layer", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "HasAnyTouchOrMouseStarted" - }, - "parameters": [ - "" - ] - } - ], - "actions": [], - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "Side", - "=", - "\"Left\"" - ] - }, - { - "type": { - "value": "TouchX" - }, - "parameters": [ - "", - "StartedTouchOrMouseId(0)", - "<", - "CameraCenterX(Object.Layer())", - "Object.Layer()", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "Side", - "=", - "\"Right\"" - ] - }, - { - "type": { - "value": "TouchX" - }, - "parameters": [ - "", - "StartedTouchOrMouseId(0)", - ">=", - "CameraCenterX(Object.Layer())", - "Object.Layer()", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - } - ] - } - ], - "parameters": [ - { - "description": "Multitouch joystick", - "name": "Object", - "supplementaryInformation": "SpriteMultitouchJoystick::SpriteMultitouchJoystick", - "type": "objectList" - }, - { - "description": "Screen side", - "name": "Side", - "supplementaryInformation": "[\"Left\",\"Right\"]", - "type": "stringWithSelector" - } - ], - "objectGroups": [] - } - ], - "eventsBasedBehaviors": [ - { - "description": "Joystick that can be controlled by interacting with a touchscreen.", - "fullName": "Multitouch Joystick", - "name": "MultitouchJoystick", - "objectType": "", - "private": true, - "eventsFunctions": [ + "description": "Joystick that can be controlled by interacting with a touchscreen.", + "fullName": "Multitouch Joystick", + "name": "MultitouchJoystick", + "objectType": "", + "private": true, + "eventsFunctions": [ { "fullName": "", "functionType": "Action", @@ -6033,1887 +5406,18 @@ "", "ControllerIdentifier", "JoystickIdentifier", - "DeadZoneRadius", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "Action", - "name": "onDeActivate", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "Action", - "name": "doStepPreEvents", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "inverted": true, - "value": "SpriteMultitouchJoystick::IsInGameEdition" - }, - "parameters": [ - "", - "" - ] - } - ], - "actions": [], - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "HasGameJustResumed" - }, - "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)" - }, - { - "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": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "the joystick force (from 0 to 1).", - "fullName": "Joystick force", - "functionType": "ExpressionAndCondition", - "name": "JoystickForce", - "sentence": "the joystick force", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "max(0, JoystickForce - DeadZoneRadius) / (1 - DeadZoneRadius)" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "JoystickForce", - "name": "SetJoystickForce", - "private": true, - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "JoystickForce", - "=", - "Value" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::SetJoystickForce" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "JoystickForce", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - }, - { - "description": "", - "name": "Parameter", - "type": "objectList" - } - ], - "objectGroups": [] - }, - { - "description": "Return the angle the joystick is pointing towards (Range: -180 to 180).", - "fullName": "Joystick angle", - "functionType": "Expression", - "name": "JoystickAngle", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "JoystickAngle" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "Change the angle the joystick is pointing towards (Range: -180 to 180).", - "fullName": "Joystick angle", - "functionType": "Action", - "name": "SetJoystickAngle", - "private": true, - "sentence": "Change the joystick angle of _PARAM0_ to _PARAM2_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "JoystickAngle", - "=", - "Value" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::SetJoystickAngle" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "JoystickAngle", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - }, - { - "description": "Angle", - "name": "Value", - "type": "expression" - } - ], - "objectGroups": [] - }, - { - "description": "Return the stick force on X axis (from -1 at the left to 1 at the right).", - "fullName": "Stick X force", - "functionType": "Expression", - "name": "StickForceX", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "Object.Behavior::JoystickForce() * cos(ToRad(Object.Behavior::JoystickAngle()))" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "Return the stick force on Y axis (from -1 at the top to 1 at the bottom).", - "fullName": "Stick Y force", - "functionType": "Expression", - "name": "StickForceY", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "Object.Behavior::JoystickForce() * sin(ToRad(Object.Behavior::JoystickAngle()))" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "Check if joystick is pushed in a given direction.", - "fullName": "Joystick pushed in a direction (4-way movement)", - "functionType": "Condition", - "name": "IsDirectionPushed4Way", - "sentence": "_PARAM0_ is pushed in direction _PARAM2_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::JoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - ">", - "0", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::IsAngleIn4WayDirection" - }, - "parameters": [ - "", - "JoystickAngle", - "Direction", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - }, - { - "description": "Direction", - "name": "Direction", - "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\"]", - "type": "stringWithSelector" - } - ], - "objectGroups": [] - }, - { - "description": "Check if joystick is pushed in a given direction.", - "fullName": "Joystick pushed in a direction (8-way movement)", - "functionType": "Condition", - "name": "IsDirectionPushed8Way", - "sentence": "_PARAM0_ is pushed in direction _PARAM2_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::JoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - ">", - "0", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::IsAngleIn8WayDirection" - }, - "parameters": [ - "", - "JoystickAngle", - "Direction", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - }, - { - "description": "Direction", - "name": "Direction", - "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\",\"UpLeft\",\"UpRight\",\"DownLeft\",\"DownRight\"]", - "type": "stringWithSelector" - } - ], - "objectGroups": [] - }, - { - "description": "Check if a joystick is pressed.", - "fullName": "Joystick pressed", - "functionType": "Condition", - "name": "IsPressed", - "sentence": "Joystick _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::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "Reset the joystick values (except for angle, which stays the same)", - "fullName": "Reset", - "functionType": "Action", - "name": "Reset", - "private": true, - "sentence": "Reset the joystick of _PARAM0_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "0", - "" - ] - }, - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "0" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "the multitouch controller identifier.", - "fullName": "Multitouch controller identifier", - "functionType": "ExpressionAndCondition", - "group": "Multitouch Joystick configuration", - "name": "ControllerIdentifier", - "sentence": "the multitouch controller identifier", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "ControllerIdentifier" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "ControllerIdentifier", - "name": "SetControllerIdentifier", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "ControllerIdentifier", - "=", - "Value" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "the joystick name.", - "fullName": "Joystick name", - "functionType": "ExpressionAndCondition", - "group": "Multitouch Joystick configuration", - "name": "JoystickIdentifier", - "sentence": "the joystick name", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnString" - }, - "parameters": [ - "JoystickIdentifier" - ] - } - ] - } - ], - "expressionType": { - "type": "string" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "JoystickIdentifier", - "name": "SetJoystickIdentifier", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetStringVariable" - }, - "parameters": [ - "JoystickIdentifier", - "=", - "Value" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "the dead zone radius (range: 0 to 1) of the joystick. 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).", - "fullName": "Dead zone radius", - "functionType": "ExpressionAndCondition", - "group": "Multitouch Joystick configuration", - "name": "DeadZoneRadius", - "sentence": "the dead zone radius", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "DeadZoneRadius" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "DeadZoneRadius", - "name": "SetDeadZoneRadius", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "DeadZoneRadius", - "=", - "Value" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::SetDeadZone" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "Value", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "Force the joystick into the pressing state.", - "fullName": "Force start pressing", - "functionType": "Action", - "name": "ForceStartPressing", - "sentence": "Force start pressing _PARAM0_ with touch identifier: _PARAM2_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "Value" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - }, - { - "description": "Touch identifier", - "name": "Value", - "type": "expression" - } - ], - "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "1", - "type": "Number", - "label": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier" - }, - { - "value": "Primary", - "type": "String", - "label": "Joystick name", - "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": "0", - "type": "Number", - "label": "Joystick angle (range: -180 to 180)", - "hidden": true, - "name": "JoystickAngle" - }, - { - "value": "0", - "type": "Number", - "label": "Joystick force (range: 0 to 1)", - "hidden": true, - "name": "JoystickForce" - }, - { - "value": "0", - "type": "Number", - "label": "", - "hidden": true, - "name": "TouchId" - }, - { - "value": "", - "type": "Number", - "label": "", - "hidden": true, - "name": "TouchIndex" - } - ], - "sharedPropertyDescriptors": [] - }, - { - "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": "", - "eventsFunctions": [ - { - "fullName": "", - "functionType": "Action", - "name": "doStepPreEvents", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "IsReleased", - "True", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsReleased", - "False", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" - }, - "parameters": [ - "Object", - "Behavior", - "\"Idle\"", - "" - ] - } - ] - }, - { - "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": [ - { - "type": { - "inverted": true, - "value": "SpriteMultitouchJoystick::MultitouchButton::IsPressed" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - }, - { - "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": "BuiltinCommonInstructions::Or" - }, - "parameters": [], - "subInstructions": [ - { - "type": { - "value": "CollisionPoint" - }, - "parameters": [ - "Object", - "TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer())", - "TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer())" - ] - }, - { - "type": { - "value": "NumberVariable" - }, - "parameters": [ - "Radius", - ">", - "DistanceBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer()), TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer()))" - ] - } - ] - } - ], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "StartedTouchOrMouseId(TouchIndex)" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" - }, - "parameters": [ - "Object", - "Behavior", - "\"JustPressed\"", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "True", - "" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchIndex", - "+", - "1" - ] - } - ] - } - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::IsPressed" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - }, - { - "type": { - "value": "HasTouchEnded" - }, - "parameters": [ - "", - "TouchId" - ] - } - ], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" - }, - "parameters": [ - "Object", - "Behavior", - "\"Released\"", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsReleased", - "True", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "False", - "" - ] - }, - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "0" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "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", - "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", - "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": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", - "type": "behavior" - }, - { - "description": "Button state", - "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"JustPressed\",\"Pressed\",\"Released\"]", - "type": "stringWithSelector" - } - ], - "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "1", - "type": "Number", - "label": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier" - }, - { - "value": "A", - "type": "String", - "label": "Button identifier", - "name": "ButtonIdentifier" - }, - { - "value": "0", - "type": "Number", - "label": "TouchID", - "hidden": true, - "name": "TouchId" - }, - { - "value": "", - "type": "Number", - "label": "", - "hidden": true, - "name": "TouchIndex" - }, - { - "value": "", - "type": "Boolean", - "label": "Button released", - "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.", - "name": "Radius" - } - ], - "sharedPropertyDescriptors": [] - }, - { - "description": "Control a platformer character with a multitouch controller.", - "fullName": "Platformer multitouch controller mapper", - "name": "PlatformerMultitouchMapper", - "objectType": "", - "quickCustomizationVisibility": "hidden", - "eventsFunctions": [ - { - "fullName": "", - "functionType": "Action", - "name": "doStepPreEvents", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "\"Left\"", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateLeftKey" - }, - "parameters": [ - "Object", - "Property" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "\"Right\"", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateRightKey" - }, - "parameters": [ - "Object", - "Property" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "\"Up\"", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateUpKey" - }, - "parameters": [ - "Object", - "Property" - ] - }, - { - "type": { - "value": "PlatformBehavior::SimulateLadderKey" - }, - "parameters": [ - "Object", - "Property" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "\"Down\"", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateDownKey" - }, - "parameters": [ - "Object", - "Property" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::IsButtonPressed" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JumpButton", - "\"Down\"" + "DeadZoneRadius", + "" ] - } - ], - "actions": [ + }, { "type": { - "value": "PlatformBehavior::SimulateJumpKey" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" }, "parameters": [ "Object", - "Property" + "Behavior", + "" ] } ] @@ -7928,64 +5432,50 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::PlatformerMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "", - "type": "Behavior", - "label": "Platform character behavior", - "extraInformation": [ - "PlatformBehavior::PlatformerObjectBehavior" - ], - "choices": [], - "name": "Property" - }, - { - "value": "1", - "type": "Number", - "label": "Controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier" }, { - "value": "Primary", - "type": "Choice", - "label": "Joystick name", - "group": "Controls", - "choices": [ + "fullName": "", + "functionType": "Action", + "name": "onDeActivate", + "sentence": "", + "events": [ { - "label": "Primary", - "value": "Primary" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" }, { - "label": "Secondary", - "value": "Secondary" + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } ], - "name": "JoystickIdentifier" + "objectGroups": [] }, - { - "value": "A", - "type": "String", - "label": "Jump button name", - "group": "Controls", - "name": "JumpButton" - } - ], - "sharedPropertyDescriptors": [] - }, - { - "description": "Control a 3D physics character with a multitouch controller.", - "fullName": "3D platformer multitouch controller mapper", - "name": "Platformer3DMultitouchMapper", - "objectType": "", - "quickCustomizationVisibility": "hidden", - "eventsFunctions": [ { "fullName": "", "functionType": "Action", @@ -7997,14 +5487,9 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::StickForce" + "value": "HasGameJustResumed" }, "parameters": [ - "", - ">", - "0", - "ControllerIdentifier", - "JoystickIdentifier", "" ] } @@ -8012,56 +5497,252 @@ "actions": [ { "type": { - "value": "Physics3D::PhysicsCharacter3D::SetForwardAngle" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" }, "parameters": [ "Object", - "PhysicsCharacter3D", - "=", - "SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier) + CameraAngle(Object.Layer())" + "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": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyTouchIndex" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "0" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "StartedTouchOrMouseCount()", + "conditions": [], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::PropertyTouchId" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "0" + ] + }, + { + "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": { - "value": "Physics3D::PhysicsCharacter3D::SimulateStick" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 }, - "parameters": [ - "Object", - "PhysicsCharacter3D", - "-90", - "SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier)" + "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" + }, + "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": "SpriteMultitouchJoystick::MultitouchJoystick::PropertyTouchId" + }, + "parameters": [ + "Object", + "Behavior", + "!=", + "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": [ + { + "description": "Object", + "name": "Object", + "type": "object" }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "the joystick force (from 0 to 1).", + "fullName": "Joystick force", + "functionType": "ExpressionAndCondition", + "name": "JoystickForce", + "sentence": "the joystick force", + "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::IsButtonPressed" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JumpButton", - "\"Down\"" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" + "value": "SetReturnNumber" }, "parameters": [ - "Object", - "PhysicsCharacter3D" + "max(0, JoystickForce - DeadZoneRadius) / (1 - DeadZoneRadius)" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -8071,124 +5752,45 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::Platformer3DMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "", - "type": "Behavior", - "label": "3D physics character", - "extraInformation": [ - "Physics3D::PhysicsCharacter3D" - ], - "choices": [], - "name": "PhysicsCharacter3D" }, - { - "value": "1", - "type": "Number", - "label": "Controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier" - }, - { - "value": "Primary", - "type": "Choice", - "label": "Walk joystick", - "group": "Controls", - "choices": [ - { - "label": "Primary", - "value": "Primary" - }, - { - "label": "Secondary", - "value": "Secondary" - } - ], - "name": "JoystickIdentifier" - }, - { - "value": "A", - "type": "String", - "label": "Jump button name", - "group": "Controls", - "name": "JumpButton" - } - ], - "sharedPropertyDescriptors": [] - }, - { - "description": "Control a 3D physics character with a multitouch controller.", - "fullName": "3D shooter multitouch controller mapper", - "name": "Shooter3DMultitouchMapper", - "objectType": "", - "quickCustomizationVisibility": "hidden", - "eventsFunctions": [ { "fullName": "", - "functionType": "Action", - "name": "doStepPreEvents", + "functionType": "ActionWithOperator", + "getterName": "JoystickForce", + "name": "SetJoystickForce", + "private": true, "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::StickForce" - }, - "parameters": [ - "", - ">", - "0", - "ControllerIdentifier", - "JoystickIdentifier", - "" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateStick" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickForce" }, "parameters": [ "Object", - "PhysicsCharacter3D", - "SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier)", - "SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier)" + "Behavior", + "=", + "Value" ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + }, { "type": { - "value": "SpriteMultitouchJoystick::IsButtonPressed" + "value": "SpriteMultitouchJoystick::SetJoystickForce" }, "parameters": [ "", "ControllerIdentifier", - "JumpButton", - "\"Down\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" - }, - "parameters": [ - "Object", - "PhysicsCharacter3D" + "JoystickIdentifier", + "JoystickForce", + "" ] } ] @@ -8203,151 +5805,37 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::Shooter3DMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "", - "type": "Behavior", - "label": "3D physics character", - "extraInformation": [ - "Physics3D::PhysicsCharacter3D" - ], - "choices": [], - "name": "PhysicsCharacter3D" - }, - { - "value": "1", - "type": "Number", - "label": "Controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier" - }, - { - "value": "Primary", - "type": "Choice", - "label": "Walk joystick", - "group": "Controls", - "choices": [ - { - "label": "Primary", - "value": "Primary" - }, - { - "label": "Secondary", - "value": "Secondary" - } - ], - "name": "JoystickIdentifier" }, { - "value": "A", - "type": "String", - "label": "Jump button name", - "group": "Controls", - "name": "JumpButton" - } - ], - "sharedPropertyDescriptors": [] - }, - { - "description": "Control camera rotations with a multitouch controller.", - "fullName": "First person camera multitouch controller mapper", - "name": "FirstPersonMultitouchMapper", - "objectType": "", - "quickCustomizationVisibility": "hidden", - "eventsFunctions": [ - { - "fullName": "", - "functionType": "Action", - "name": "doStepPreEvents", + "description": "Return the angle the joystick is pointing towards (Range: -180 to 180).", + "fullName": "Joystick angle", + "functionType": "Expression", + "name": "JoystickAngle", "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", - "=", - "SpriteMultitouchJoystick::AcceleratedSpeed(CurrentRotationSpeedZ, SpriteMultitouchJoystick::StickForceX(ControllerIdentifier, CameraStick) * HorizontalRotationSpeedMax, HorizontalRotationSpeedMax, HorizontalRotationAcceleration, HorizontalRotationDeceleration)" - ] - }, - { - "type": { - "value": "SetAngle" - }, - "parameters": [ - "Object", - "+", - "CurrentRotationSpeedZ * TimeDelta()" - ] - }, - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "CurrentRotationSpeedY", - "=", - "SpriteMultitouchJoystick::AcceleratedSpeed(CurrentRotationSpeedY, SpriteMultitouchJoystick::StickForceY(ControllerIdentifier, 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)" - ] - }, + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper::LookFromObjectEyes" + "value": "SetReturnNumber" }, "parameters": [ - "Object", - "Behavior", - "" + "JoystickAngle" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -8357,20 +5845,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "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", + "description": "Change the angle the joystick is pointing towards (Range: -180 to 180).", + "fullName": "Joystick angle", "functionType": "Action", - "group": "Layers and cameras", - "name": "LookFromObjectEyes", + "name": "SetJoystickAngle", "private": true, - "sentence": "Move the camera to look though _PARAM0_ eyes", + "sentence": "Change the joystick angle of _PARAM0_ to _PARAM2_", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -8378,61 +5865,24 @@ "actions": [ { "type": { - "value": "CentreCamera" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickAngle" }, "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": [ - "", + "Behavior", "=", - "Object.Object3D::RotationX()", - "GetArgumentAsString(\"Layer\")", - "" + "Value" ] }, { "type": { - "value": "SetCameraAngle" + "value": "SpriteMultitouchJoystick::SetJoystickAngle" }, "parameters": [ "", - "=", - "Object.Angle() + 90", - "Object.Layer()", + "ControllerIdentifier", + "JoystickIdentifier", + "JoystickAngle", "" ] } @@ -8448,19 +5898,23 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" + }, + { + "description": "Angle", + "name": "Value", + "type": "expression" } ], "objectGroups": [] }, { - "description": "the maximum horizontal rotation speed of the object.", - "fullName": "Maximum horizontal rotation speed", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper horizontal rotation configuration", - "name": "HorizontalRotationSpeedMax", - "sentence": "the maximum horizontal rotation speed", + "description": "Return the stick force on X axis (from -1 at the left to 1 at the right).", + "fullName": "Stick X force", + "functionType": "Expression", + "name": "StickForceX", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -8471,7 +5925,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "HorizontalRotationSpeedMax" + "Object.Behavior::JoystickForce() * cos(ToRad(Object.Behavior::JoystickAngle()))" ] } ] @@ -8489,17 +5943,17 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] }, { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "HorizontalRotationSpeedMax", - "name": "SetHorizontalRotationSpeedMax", + "description": "Return the stick force on Y axis (from -1 at the top to 1 at the bottom).", + "fullName": "Stick Y force", + "functionType": "Expression", + "name": "StickForceY", "sentence": "", "events": [ { @@ -8508,17 +5962,18 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SetReturnNumber" }, "parameters": [ - "HorizontalRotationSpeedMax", - "=", - "Value" + "Object.Behavior::JoystickForce() * sin(ToRad(Object.Behavior::JoystickAngle()))" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -8528,38 +5983,58 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the horizontal rotation acceleration of the object.", - "fullName": "Horizontal rotation acceleration", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper horizontal rotation configuration", - "name": "HorizontalRotationAcceleration", - "sentence": "the horizontal rotation acceleration", + "description": "Check if joystick is pushed in a given direction.", + "fullName": "Joystick pushed in a direction (4-way movement)", + "functionType": "Condition", + "name": "IsDirectionPushed4Way", + "sentence": "_PARAM0_ is pushed in direction _PARAM2_", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::JoystickForce" + }, + "parameters": [ + "Object", + "Behavior", + ">", + "0", + "" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::IsAngleIn4WayDirection" + }, + "parameters": [ + "", + "JoystickAngle", + "Direction", + "" + ] + } + ], "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "SetReturnBoolean" }, "parameters": [ - "HorizontalRotationAcceleration" + "True" ] } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -8569,31 +6044,59 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" + }, + { + "description": "Direction", + "name": "Direction", + "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\"]", + "type": "stringWithSelector" } ], "objectGroups": [] }, { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "HorizontalRotationAcceleration", - "name": "SetHorizontalRotationAcceleration", - "sentence": "", + "description": "Check if joystick is pushed in a given direction.", + "fullName": "Joystick pushed in a direction (8-way movement)", + "functionType": "Condition", + "name": "IsDirectionPushed8Way", + "sentence": "_PARAM0_ is pushed in direction _PARAM2_", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::JoystickForce" + }, + "parameters": [ + "Object", + "Behavior", + ">", + "0", + "" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::IsAngleIn8WayDirection" + }, + "parameters": [ + "", + "JoystickAngle", + "Direction", + "" + ] + } + ], "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SetReturnBoolean" }, "parameters": [ - "HorizontalRotationAcceleration", - "=", - "Value" + "True" ] } ] @@ -8608,38 +6111,52 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" + }, + { + "description": "Direction", + "name": "Direction", + "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\",\"UpLeft\",\"UpRight\",\"DownLeft\",\"DownRight\"]", + "type": "stringWithSelector" } ], "objectGroups": [] }, { - "description": "the horizontal rotation deceleration of the object.", - "fullName": "Horizontal rotation deceleration", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper horizontal rotation configuration", - "name": "HorizontalRotationDeceleration", - "sentence": "the horizontal rotation deceleration", + "description": "Check if a joystick is pressed.", + "fullName": "Joystick pressed", + "functionType": "Condition", + "name": "IsPressed", + "sentence": "Joystick _PARAM0_ is pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::PropertyTouchId" + }, + "parameters": [ + "Object", + "Behavior", + "!=", + "0" + ] + } + ], "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "SetReturnBoolean" }, "parameters": [ - "HorizontalRotationDeceleration" + "True" ] } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -8649,18 +6166,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] }, { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "HorizontalRotationDeceleration", - "name": "SetHorizontalRotationDeceleration", - "sentence": "", + "description": "Reset the joystick values (except for angle, which stays the same)", + "fullName": "Reset", + "functionType": "Action", + "name": "Reset", + "private": true, + "sentence": "Reset the joystick of _PARAM0_", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -8668,12 +6186,25 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" }, "parameters": [ - "HorizontalRotationDeceleration", + "Object", + "Behavior", "=", - "Value" + "0", + "" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyTouchId" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "0" ] } ] @@ -8688,19 +6219,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the maximum vertical rotation speed of the object.", - "fullName": "Maximum vertical rotation speed", + "description": "the multitouch controller identifier.", + "fullName": "Multitouch controller identifier", "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper vertical rotation configuration", - "name": "VerticalRotationSpeedMax", - "sentence": "the maximum vertical rotation speed", + "group": "Multitouch Joystick configuration", + "name": "ControllerIdentifier", + "sentence": "the multitouch controller identifier", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -8711,7 +6242,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "VerticalRotationSpeedMax" + "ControllerIdentifier" ] } ] @@ -8729,7 +6260,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], @@ -8738,8 +6269,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "VerticalRotationSpeedMax", - "name": "SetVerticalRotationSpeedMax", + "getterName": "ControllerIdentifier", + "name": "SetControllerIdentifier", "sentence": "", "events": [ { @@ -8748,10 +6279,11 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyControllerIdentifier" }, "parameters": [ - "VerticalRotationSpeedMax", + "Object", + "Behavior", "=", "Value" ] @@ -8768,19 +6300,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the vertical rotation acceleration of the object.", - "fullName": "Vertical rotation acceleration", + "description": "the joystick name.", + "fullName": "Joystick name", "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper vertical rotation configuration", - "name": "VerticalRotationAcceleration", - "sentence": "the vertical rotation acceleration", + "group": "Multitouch Joystick configuration", + "name": "JoystickIdentifier", + "sentence": "the joystick name", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -8788,17 +6320,17 @@ "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "SetReturnString" }, "parameters": [ - "VerticalRotationAcceleration" + "JoystickIdentifier" ] } ] } ], "expressionType": { - "type": "expression" + "type": "string" }, "parameters": [ { @@ -8809,7 +6341,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], @@ -8818,8 +6350,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "VerticalRotationAcceleration", - "name": "SetVerticalRotationAcceleration", + "getterName": "JoystickIdentifier", + "name": "SetJoystickIdentifier", "sentence": "", "events": [ { @@ -8828,10 +6360,11 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickIdentifier" }, "parameters": [ - "VerticalRotationAcceleration", + "Object", + "Behavior", "=", "Value" ] @@ -8848,19 +6381,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the vertical rotation deceleration of the object.", - "fullName": "Vertical rotation deceleration", + "description": "the dead zone radius (range: 0 to 1) of the joystick. 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).", + "fullName": "Dead zone radius", "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper vertical rotation configuration", - "name": "VerticalRotationDeceleration", - "sentence": "the vertical rotation deceleration", + "group": "Multitouch Joystick configuration", + "name": "DeadZoneRadius", + "sentence": "the dead zone radius", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -8871,7 +6404,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "VerticalRotationDeceleration" + "DeadZoneRadius" ] } ] @@ -8889,7 +6422,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], @@ -8898,8 +6431,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "VerticalRotationDeceleration", - "name": "SetVerticalRotationDeceleration", + "getterName": "DeadZoneRadius", + "name": "SetDeadZoneRadius", "sentence": "", "events": [ { @@ -8908,10 +6441,11 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyDeadZoneRadius" }, "parameters": [ - "VerticalRotationDeceleration", + "Object", + "Behavior", "=", "Value" ] @@ -8928,72 +6462,271 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] + } + ], + "propertyDescriptors": [ + { + "value": "1", + "type": "Number", + "label": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier" }, { - "description": "the minimum vertical camera angle of the object.", - "fullName": "Minimum vertical camera angle", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper vertical rotation configuration", - "name": "VerticalAngleMin", - "sentence": "the minimum vertical camera angle", + "value": "Primary", + "type": "String", + "label": "Joystick name", + "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": "0", + "type": "Number", + "label": "Joystick angle (range: -180 to 180)", + "hidden": true, + "name": "JoystickAngle" + }, + { + "value": "0", + "type": "Number", + "label": "Joystick force (range: 0 to 1)", + "hidden": true, + "name": "JoystickForce" + }, + { + "value": "0", + "type": "Number", + "label": "", + "hidden": true, + "name": "TouchId" + }, + { + "value": "", + "type": "Number", + "label": "", + "hidden": true, + "name": "TouchIndex" + } + ], + "sharedPropertyDescriptors": [] + }, + { + "description": "Detect button presses made on a touchscreen.", + "fullName": "Multitouch button", + "name": "MultitouchButton", + "objectType": "", + "eventsFunctions": [ + { + "fullName": "", + "functionType": "Action", + "name": "doStepPreEvents", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::IsReleased" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } + ], "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyIsReleased" + }, + "parameters": [ + "Object", + "Behavior", + "no" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" }, "parameters": [ - "VerticalAngleMin" + "Object", + "Behavior", + "\"Idle\"", + "" ] } ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" }, { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "VerticalAngleMin", - "name": "SetVerticalAngleMin", - "sentence": "", - "events": [ + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "SpriteMultitouchJoystick::MultitouchButton::IsPressed" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + }, + { + "type": { + "value": "HasAnyTouchOrMouseStarted" + }, + "parameters": [ + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchIndex" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "0" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "StartedTouchOrMouseCount()", + "conditions": [], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "CollisionPoint" + }, + "parameters": [ + "Object", + "TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)", + "TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchId" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "StartedTouchOrMouseId(TouchIndex)" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + }, + "parameters": [ + "Object", + "Behavior", + "\"Pressed\"", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchIndex" + }, + "parameters": [ + "Object", + "Behavior", + "+", + "1" + ] + } + ] + } + ] + } + ] + }, { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::IsPressed" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + }, + { + "type": { + "value": "HasTouchEnded" + }, + "parameters": [ + "", + "TouchId" + ] + } + ], "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + }, + "parameters": [ + "Object", + "Behavior", + "\"Released\"", + "" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyIsReleased" + }, + "parameters": [ + "Object", + "Behavior", + "yes" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchId" }, "parameters": [ - "VerticalAngleMin", + "Object", + "Behavior", "=", - "Value" + "0" ] } ] @@ -9008,72 +6741,39 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the maximum vertical camera angle of the object.", - "fullName": "Maximum vertical camera angle", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper vertical rotation configuration", - "name": "VerticalAngleMax", - "sentence": "the maximum vertical camera angle", + "description": "Check if button is released.", + "fullName": "Button released", + "functionType": "Condition", + "name": "IsReleased", + "sentence": "Button _PARAM0_ is released", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ + "conditions": [ { "type": { - "value": "SetReturnNumber" + "value": "SpriteMultitouchJoystick::MultitouchButton::PropertyIsReleased" }, "parameters": [ - "VerticalAngleMax" + "Object", + "Behavior" ] } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "VerticalAngleMax", - "name": "SetVerticalAngleMax", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + ], "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SetReturnBoolean" }, "parameters": [ - "VerticalAngleMax", - "=", - "Value" + "True" ] } ] @@ -9088,38 +6788,46 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the z position offset of the object.", - "fullName": "Z position offset", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper position configuration", - "name": "OffsetZ", - "sentence": "the z position offset", + "description": "Check if button is pressed.", + "fullName": "Button pressed", + "functionType": "Condition", + "name": "IsPressed", + "sentence": "Button _PARAM0_ is pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::PropertyTouchId" + }, + "parameters": [ + "Object", + "Behavior", + "!=", + "0" + ] + } + ], "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "SetReturnBoolean" }, "parameters": [ - "OffsetZ" + "True" ] } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -9129,18 +6837,18 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", "type": "behavior" } ], "objectGroups": [] }, { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "OffsetZ", - "name": "SetOffsetZ", - "sentence": "", + "fullName": "Button state", + "functionType": "Action", + "name": "SetButtonState", + "private": true, + "sentence": "Mark the button _PARAM0_ as _PARAM2_", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -9148,12 +6856,14 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::SetButtonState" }, "parameters": [ - "OffsetZ", - "=", - "Value" + "", + "ControllerIdentifier", + "ButtonIdentifier", + "ButtonState", + "" ] } ] @@ -9168,140 +6878,61 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", "type": "behavior" + }, + { + "description": "Button state", + "name": "ButtonState", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "type": "stringWithSelector" } ], "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...)", + "label": "Multitouch 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": "A", + "type": "String", + "label": "Button identifier", + "name": "ButtonIdentifier" }, { "value": "0", "type": "Number", - "unit": "Pixel", - "label": "Z position offset", - "group": "Position", - "name": "OffsetZ" + "label": "TouchID", + "hidden": true, + "name": "TouchId" }, { - "value": "0", + "value": "", "type": "Number", - "unit": "AngularSpeed", - "label": "Current rotation speed Z", + "label": "", "hidden": true, - "name": "CurrentRotationSpeedZ" + "name": "TouchIndex" }, { - "value": "0", - "type": "Number", - "unit": "AngularSpeed", - "label": "Current rotation speed Y", + "value": "", + "type": "Boolean", + "label": "Button released", "hidden": true, - "name": "CurrentRotationSpeedY" + "name": "IsReleased" } ], "sharedPropertyDescriptors": [] }, { - "description": "Control a 3D physics car with a multitouch controller.", - "fullName": "3D car multitouch controller mapper", - "name": "PhysicsCar3DMultitouchMapper", + "description": "Control a platformer character with a multitouch controller.", + "fullName": "Platformer multitouch controller mapper", + "name": "PlatformerMultitouchMapper", "objectType": "", - "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -9314,14 +6945,13 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::StickForce" + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" }, "parameters": [ "", - ">", - "0", "ControllerIdentifier", - "SteerJoystickIdentifier", + "JoystickIdentifier", + "\"Left\"", "" ] } @@ -9329,12 +6959,11 @@ "actions": [ { "type": { - "value": "Physics3D::PhysicsCar3D::SimulateSteeringStick" + "value": "PlatformBehavior::SimulateLeftKey" }, "parameters": [ "Object", - "PhysicsCar3D", - "SpriteMultitouchJoystick::StickForceX(ControllerIdentifier, \"Primary\")" + "Property" ] } ] @@ -9344,14 +6973,78 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::StickForce" + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JoystickIdentifier", + "\"Right\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "PlatformBehavior::SimulateRightKey" + }, + "parameters": [ + "Object", + "Property" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JoystickIdentifier", + "\"Up\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "PlatformBehavior::SimulateUpKey" + }, + "parameters": [ + "Object", + "Property" + ] + }, + { + "type": { + "value": "PlatformBehavior::SimulateLadderKey" + }, + "parameters": [ + "Object", + "Property" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" }, "parameters": [ "", - ">", - "0", "ControllerIdentifier", - "SpeedJoystickIdentifier", + "JoystickIdentifier", + "\"Down\"", "" ] } @@ -9359,12 +7052,11 @@ "actions": [ { "type": { - "value": "Physics3D::PhysicsCar3D::SimulateAcceleratorStick" + "value": "PlatformBehavior::SimulateDownKey" }, "parameters": [ "Object", - "PhysicsCar3D", - "-SpriteMultitouchJoystick::StickForceY(ControllerIdentifier, \"Secondary\")" + "Property" ] } ] @@ -9379,7 +7071,7 @@ "parameters": [ "", "ControllerIdentifier", - "HandBrakeButton", + "JumpButton", "\"Down\"" ] } @@ -9387,11 +7079,11 @@ "actions": [ { "type": { - "value": "Physics3D::PhysicsCar3D::SimulateHandBrakeKey" + "value": "PlatformBehavior::SimulateJumpKey" }, "parameters": [ "Object", - "PhysicsCar3D" + "Property" ] } ] @@ -9406,7 +7098,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::PhysicsCar3DMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::PlatformerMultitouchMapper", "type": "behavior" } ], @@ -9417,12 +7109,12 @@ { "value": "", "type": "Behavior", - "label": "3D physics car", + "label": "Platform character behavior", "extraInformation": [ - "Physics3D::PhysicsCar3D" + "PlatformBehavior::PlatformerObjectBehavior" ], "choices": [], - "name": "PhysicsCar3D" + "name": "Property" }, { "value": "1", @@ -9433,24 +7125,7 @@ { "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", + "label": "Joystick name", "group": "Controls", "choices": [ { @@ -9462,14 +7137,14 @@ "value": "Secondary" } ], - "name": "SpeedJoystickIdentifier" + "name": "JoystickIdentifier" }, { - "value": "B", + "value": "A", "type": "String", - "label": "Hand brake button name", + "label": "Jump button name", "group": "Controls", - "name": "HandBrakeButton" + "name": "JumpButton" } ], "sharedPropertyDescriptors": [] @@ -9479,7 +7154,6 @@ "fullName": "Top-down multitouch controller mapper", "name": "TopDownMultitouchMapper", "objectType": "", - "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -9492,10 +7166,11 @@ "conditions": [ { "type": { - "value": "StringVariable" + "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" }, "parameters": [ - "StickMode", + "Object", + "Behavior", "=", "\"Analog\"" ] @@ -9520,10 +7195,11 @@ "conditions": [ { "type": { - "value": "StringVariable" + "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" }, "parameters": [ - "StickMode", + "Object", + "Behavior", "=", "\"360°\"" ] @@ -9548,10 +7224,11 @@ "conditions": [ { "type": { - "value": "StringVariable" + "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" }, "parameters": [ - "StickMode", + "Object", + "Behavior", "=", "\"8 Directions\"" ] @@ -10160,6 +7837,7 @@ } ], "instances": [], + "editionSettings": {}, "eventsFunctions": [ { "fullName": "", @@ -10278,90 +7956,17 @@ "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "conditions": [], + "actions": [ { "type": { - "inverted": true, - "value": "SpriteMultitouchJoystick::IsInGameEdition" + "value": "MettreAutour" }, "parameters": [ - "", - "" - ] - } - ], - "actions": [], - "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" - }, - "parameters": [ - "Object", - "no", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "ShouldBeHiddenWhenReleased", - "False", - "" - ] - } + "Thumb", + "Border", + "Border.MultitouchJoystick::JoystickForce() * Border.Width() / 2", + "Border.MultitouchJoystick::JoystickAngle()" ] } ] @@ -10429,7 +8034,7 @@ "Border", "MultitouchJoystick", "=", - "ControllerIdentifier", + "Object.PropertyControllerIdentifier()", "" ] }, @@ -10441,7 +8046,7 @@ "Border", "MultitouchJoystick", "=", - "JoystickIdentifier", + "Object.PropertyJoystickIdentifier()", "" ] }, @@ -10453,92 +8058,7 @@ "Border", "MultitouchJoystick", "=", - "DeadZoneRadius", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "supplementaryInformation": "SpriteMultitouchJoystick::SpriteMultitouchJoystick", - "type": "object" - } - ], - "objectGroups": [] - }, - { - "description": "Show the joystick until it is released.", - "fullName": "Show and start pressing", - "functionType": "Action", - "name": "TeleportAndPress", - "sentence": "Show _PARAM0_ at the cursor position and start pressing", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "HasAnyTouchOrMouseStarted" - }, - "parameters": [ - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "MettreXY" - }, - "parameters": [ - "Object", - "=", - "Object.ParentTouchX(StartedTouchOrMouseId(0))", - "=", - "Object.ParentTouchY(StartedTouchOrMouseId(0))" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::ActivateControl" - }, - "parameters": [ - "Object", - "yes", - "" - ] - }, - { - "type": { - "value": "Montre" - }, - "parameters": [ - "Object", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "ShouldBeHiddenWhenReleased", - "True", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::ForceStartPressing" - }, - "parameters": [ - "Border", - "MultitouchJoystick", - "StartedTouchOrMouseId(0)", + "Object.PropertyDeadZoneRadius()", "" ] } @@ -10555,92 +8075,6 @@ ], "objectGroups": [] }, - { - "description": "Return the X position of a specified touch", - "fullName": "Touch X position (on parent)", - "functionType": "Expression", - "name": "ParentTouchX", - "private": true, - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [] - }, - { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "const object = objects[0];", - "const touchId = eventsFunctionContext.getArgument(\"TouchId\");", - "eventsFunctionContext.returnValue = gdjs.evtTools.input.getTouchX(object.getInstanceContainer(), touchId, object.getLayer());" - ], - "parameterObjects": "Object", - "useStrict": true, - "eventsSheetExpanded": false - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "supplementaryInformation": "SpriteMultitouchJoystick::SpriteMultitouchJoystick", - "type": "object" - }, - { - "description": "Touch identifier", - "name": "TouchId", - "type": "expression" - } - ], - "objectGroups": [] - }, - { - "description": "Return the X position of a specified touch", - "fullName": "Touch X position (on parent)", - "functionType": "Expression", - "name": "ParentTouchY", - "private": true, - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [] - }, - { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "const object = objects[0];", - "const touchId = eventsFunctionContext.getArgument(\"TouchId\");", - "eventsFunctionContext.returnValue = gdjs.evtTools.input.getTouchY(object.getInstanceContainer(), touchId, object.getLayer());" - ], - "parameterObjects": "Object", - "useStrict": true, - "eventsSheetExpanded": false - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "supplementaryInformation": "SpriteMultitouchJoystick::SpriteMultitouchJoystick", - "type": "object" - }, - { - "description": "Touch identifier", - "name": "TouchId", - "type": "expression" - } - ], - "objectGroups": [] - }, { "description": "De/activate control of the joystick.", "fullName": "De/activate control", @@ -10654,12 +8088,10 @@ { "type": { "inverted": true, - "value": "BooleanVariable" + "value": "GetArgumentAsBoolean" }, "parameters": [ - "ShouldActivate", - "True", - "" + "\"ShouldActivate\"" ] } ], @@ -10681,12 +8113,10 @@ "conditions": [ { "type": { - "value": "BooleanVariable" + "value": "GetArgumentAsBoolean" }, "parameters": [ - "ShouldActivate", - "True", - "" + "\"ShouldActivate\"" ] } ], @@ -11360,15 +8790,9 @@ "description": "Only used by the scene editor.", "hidden": true, "name": "ParentOrigin" - }, - { - "value": "", - "type": "Boolean", - "label": "", - "hidden": true, - "name": "ShouldBeHiddenWhenReleased" } - ] + ], + "variants": [] } ] }, diff --git a/examples/starting-top-down/starting-top-down.json b/examples/starting-top-down/starting-top-down.json index 49dfaf35d..04fc4045b 100644 --- a/examples/starting-top-down/starting-top-down.json +++ b/examples/starting-top-down/starting-top-down.json @@ -923,19 +923,18 @@ "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", + "version": "1.4.0", "description": [ - "Multitouch joysticks are objects showing a joystick on the screen, useful for mobile. They work like a physical gamepad:", + "Multitouch joysticks can be used the same way as physical gamepads:", "- 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.", + "- 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)." ], @@ -1000,33 +999,108 @@ ], "eventsFunctions": [ { - "description": "Check if the events are running for the editor.", - "fullName": "Editor is running", + "description": "Check if a button is pressed on a gamepad.", + "fullName": "Multitouch controller button pressed", "functionType": "Condition", - "name": "IsInGameEdition", - "private": true, - "sentence": "Events are running for the editor", + "name": "IsButtonPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", "events": [ { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "const game = runtimeScene.getGame();\r", - "eventsFunctionContext.returnValue = game.isInGameEdition && game.isInGameEdition();" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"Pressed\"" + ] + } ], - "parameterObjects": "", - "useStrict": true, - "eventsSheetExpanded": false + "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" } ], - "parameters": [], "objectGroups": [] }, { - "fullName": "Accelerated speed", - "functionType": "Expression", - "name": "AcceleratedSpeed", + "description": "Check if a button is released on a gamepad.", + "fullName": "Multitouch controller button released", + "functionType": "Condition", + "name": "IsButtonReleased", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is released", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"Released\"" + ] + } + ], + "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": "Change a button state for a multitouch controller.", + "fullName": "Button state", + "functionType": "Action", + "name": "SetButtonState", "private": true, - "sentence": "", + "sentence": "Mark _PARAM2_ button as _PARAM3_ for multitouch controller _PARAM1_", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -1034,443 +1108,108 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SetStringVariable" }, "parameters": [ - "AcceleratedSpeed", + "Controllers[ControllerIdentifier].Buttons[Button].State", "=", - "CurrentSpeed" + "ButtonState" ] } - ], - "events": [ + ] + } + ], + "parameters": [ + { + "description": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier", + "type": "expression" + }, + { + "description": "Button name", + "name": "Button", + "type": "string" + }, + { + "description": "Button state", + "name": "ButtonState", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "type": "stringWithSelector" + } + ], + "objectGroups": [] + }, + { + "description": "Change the dead zone radius of a joystick. 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).", + "fullName": "Dead zone radius", + "functionType": "Action", + "name": "SetDeadZone", + "private": true, + "sentence": "Change the dead zone of multitouch joystick _PARAM2_ of multitouch controller _PARAM1_ to _PARAM3_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ { - "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", - "=", - "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": { + "value": "SetNumberVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].DeadZone", + "=", + "DeadZoneRadius" ] - }, - { - "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": "NumberVariable" - }, - "parameters": [ - "TargetedSpeed", - "=", - "0" - ] - } - ], - "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", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "clamp(AcceleratedSpeed, -SpeedMax, SpeedMax)" - ] - } - ] - } - ], - "variables": [ - { - "name": "AcceleratedSpeed", - "type": "number", - "value": 0 } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { - "description": "Current speed", - "name": "CurrentSpeed", - "type": "expression" - }, - { - "description": "Targeted speed", - "name": "TargetedSpeed", - "type": "expression" - }, - { - "description": "Max speed", - "name": "SpeedMax", + "description": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier", "type": "expression" }, { - "description": "Acceleration", - "name": "Acceleration", - "type": "expression" + "description": "Joystick name", + "name": "JoystickIdentifier", + "type": "string" }, { - "description": "Deceleration", - "name": "Deceleration", + "description": "Dead zone radius", + "name": "DeadZoneRadius", + "supplementaryInformation": "[]", "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", + "description": "Return the dead zone radius of a joystick. 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).", + "fullName": "Dead zone radius", + "functionType": "Expression", + "name": "DeadZone", + "private": true, + "sentence": "Change multitouch joystick _PARAM2_ of multitouch controller _PARAM1_ dead zone to _PARAM3_", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Buttons[Button].State", - "=", - "\"JustPressed\"" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "SetReturnBoolean" + "value": "SetReturnNumber" }, "parameters": [ - "True" + "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].DeadZone" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Multitouch controller identifier (1, 2, 3, 4...)", @@ -1478,273 +1217,28 @@ "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\"]", + "description": "Joystick name", + "name": "JoystickIdentifier", "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", + "description": "the direction index (left = 1, bottom = 1, right = 2, top = 3) for an angle (in degrees).", + "fullName": "Angle to 4-way index", + "functionType": "ExpressionAndCondition", + "name": "AngleTo4Way", + "private": true, + "sentence": "The angle _PARAM1_ 4-way index", "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\"" - ] - } - ] - } - ], + "conditions": [], "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", - "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is released", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Buttons[Button].State", - "=", - "\"Released\"" - ] - } - ], - "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": "Change a button state for a multitouch controller.", - "fullName": "Button state", - "functionType": "Action", - "name": "SetButtonState", - "private": true, - "sentence": "Mark _PARAM2_ button as _PARAM3_ for multitouch controller _PARAM1_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetStringVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Buttons[Button].State", - "=", - "ButtonState" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" - }, - { - "description": "Button name", - "name": "Button", - "type": "string" - }, - { - "description": "Button state", - "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"JustPressed\",\"Released\"]", - "type": "stringWithSelector" - } - ], - "objectGroups": [] - }, - { - "description": "Change the dead zone radius of a joystick. 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).", - "fullName": "Dead zone radius", - "functionType": "Action", - "name": "SetDeadZone", - "private": true, - "sentence": "Change the dead zone of multitouch joystick _PARAM2_ of multitouch controller _PARAM1_ to _PARAM3_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].DeadZone", - "=", - "DeadZoneRadius" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" - }, - { - "description": "Joystick name", - "name": "JoystickIdentifier", - "type": "string" - }, - { - "description": "Dead zone radius", - "name": "DeadZoneRadius", - "supplementaryInformation": "[]", - "type": "expression" - } - ], - "objectGroups": [] - }, - { - "description": "Return the dead zone radius of a joystick. 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).", - "fullName": "Dead zone radius", - "functionType": "Expression", - "name": "DeadZone", - "private": true, - "sentence": "Change multitouch joystick _PARAM2_ of multitouch controller _PARAM1_ dead zone to _PARAM3_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].DeadZone" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" - }, - { - "description": "Joystick name", - "name": "JoystickIdentifier", - "type": "string" - } - ], - "objectGroups": [] - }, - { - "description": "the direction index (left = 1, bottom = 1, right = 2, top = 3) for an angle (in degrees).", - "fullName": "Angle to 4-way index", - "functionType": "ExpressionAndCondition", - "name": "AngleTo4Way", - "private": true, - "sentence": "The angle _PARAM1_ 4-way index", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" + "value": "SetReturnNumber" }, "parameters": [ "mod(round(Angle * 4 / 360), 4)" @@ -2489,11 +1983,6 @@ "name": "JoystickIdentifier", "supplementaryInformation": "[\"Primary\",\"Secondary\"]", "type": "stringWithSelector" - }, - { - "description": "", - "name": "Coucou", - "type": "expression" } ], "objectGroups": [] @@ -2723,7 +2212,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "XFromAngleAndDistance(SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier), SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier))" + "SpriteMultitouchJoystick::JoystickForce(ControllerIdentifier, JoystickIdentifier) * cos(ToRad(SpriteMultitouchJoystick::JoystickAngle(ControllerIdentifier, JoystickIdentifier)))" ] } ] @@ -2763,7 +2252,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "YFromAngleAndDistance(SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier), SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier))" + "SpriteMultitouchJoystick::JoystickForce(ControllerIdentifier, JoystickIdentifier) * sin(ToRad(SpriteMultitouchJoystick::JoystickAngle(ControllerIdentifier, JoystickIdentifier)))" ] } ] @@ -2786,158 +2275,41 @@ } ], "objectGroups": [] - }, + } + ], + "eventsBasedBehaviors": [ { - "description": "Check if a new touch has started on the right or left side of the screen.", - "fullName": "New touch on a screen side", - "functionType": "Condition", - "group": "Multitouch Joystick", - "name": "HasTouchStartedOnScreenSide", - "sentence": "A new touch has started on the _PARAM2_ side of the screen on _PARAM1_'s layer", - "events": [ + "description": "Joystick that can be controlled by interacting with a touchscreen.", + "fullName": "Multitouch Joystick", + "name": "MultitouchJoystick", + "objectType": "", + "private": true, + "eventsFunctions": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "HasAnyTouchOrMouseStarted" - }, - "parameters": [ - "" - ] - } - ], - "actions": [], + "fullName": "", + "functionType": "Action", + "name": "onCreated", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "conditions": [], + "actions": [ { "type": { - "value": "StringVariable" + "value": "SpriteMultitouchJoystick::SetDeadZone" }, "parameters": [ - "Side", - "=", - "\"Left\"" + "", + "ControllerIdentifier", + "JoystickIdentifier", + "DeadZoneRadius", + "" ] }, { "type": { - "value": "TouchX" - }, - "parameters": [ - "", - "StartedTouchOrMouseId(0)", - "<", - "CameraCenterX(Object.Layer())", - "Object.Layer()", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "Side", - "=", - "\"Right\"" - ] - }, - { - "type": { - "value": "TouchX" - }, - "parameters": [ - "", - "StartedTouchOrMouseId(0)", - ">=", - "CameraCenterX(Object.Layer())", - "Object.Layer()", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - } - ] - } - ], - "parameters": [ - { - "description": "Multitouch joystick", - "name": "Object", - "supplementaryInformation": "SpriteMultitouchJoystick::SpriteMultitouchJoystick", - "type": "objectList" - }, - { - "description": "Screen side", - "name": "Side", - "supplementaryInformation": "[\"Left\",\"Right\"]", - "type": "stringWithSelector" - } - ], - "objectGroups": [] - } - ], - "eventsBasedBehaviors": [ - { - "description": "Joystick that can be controlled by interacting with a touchscreen.", - "fullName": "Multitouch Joystick", - "name": "MultitouchJoystick", - "objectType": "", - "private": true, - "eventsFunctions": [ - { - "fullName": "", - "functionType": "Action", - "name": "onCreated", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::SetDeadZone" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "DeadZoneRadius", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" }, "parameters": [ "Object", @@ -3012,23 +2384,41 @@ "conditions": [ { "type": { - "inverted": true, - "value": "SpriteMultitouchJoystick::IsInGameEdition" + "value": "HasGameJustResumed" }, "parameters": [ - "", "" ] } ], - "actions": [], + "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": "HasGameJustResumed" + "value": "HasAnyTouchOrMouseStarted" }, "parameters": [ "" @@ -3038,207 +2428,176 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyTouchIndex" }, "parameters": [ "Object", "Behavior", - "" + "=", + "0" ] } - ] - }, - { - "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" - ] - } - ], + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "StartedTouchOrMouseCount()", + "conditions": [], + "actions": [], "events": [ { - "type": "BuiltinCommonInstructions::Repeat", - "repeatExpression": "StartedTouchOrMouseCount()", - "conditions": [], - "actions": [], - "events": [ + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { - "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": "SpriteMultitouchJoystick::MultitouchJoystick::PropertyTouchId" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "0" ] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchIndex", - "+", - "1" - ] - } + "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::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" - }, - "parameters": [ - "Object", - "Behavior", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyTouchIndex" + }, + "parameters": [ + "Object", + "Behavior", + "+", + "1" + ] + } ] } ] } - ], - "parameters": [] + ] }, { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Update joystick position", - "source": "", - "type": "BuiltinCommonInstructions::Group", - "events": [ + "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": "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)", - "" - ] - } + "type": { + "value": "HasTouchEnded" + }, + "parameters": [ + "", + "TouchId" ] } ], - "parameters": [] + "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": "SpriteMultitouchJoystick::MultitouchJoystick::PropertyTouchId" + }, + "parameters": [ + "Object", + "Behavior", + "!=", + "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": [ @@ -3310,10 +2669,11 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickForce" }, "parameters": [ - "JoystickForce", + "Object", + "Behavior", "=", "Value" ] @@ -3344,11 +2704,6 @@ "name": "Behavior", "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" - }, - { - "description": "", - "name": "Parameter", - "type": "objectList" } ], "objectGroups": [] @@ -3407,10 +2762,11 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickAngle" }, "parameters": [ - "JoystickAngle", + "Object", + "Behavior", "=", "Value" ] @@ -3676,10 +3032,11 @@ "conditions": [ { "type": { - "value": "NumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::PropertyTouchId" }, "parameters": [ - "TouchId", + "Object", + "Behavior", "!=", "0" ] @@ -3738,10 +3095,11 @@ }, { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyTouchId" }, "parameters": [ - "TouchId", + "Object", + "Behavior", "=", "0" ] @@ -3818,10 +3176,11 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyControllerIdentifier" }, "parameters": [ - "ControllerIdentifier", + "Object", + "Behavior", "=", "Value" ] @@ -3898,10 +3257,11 @@ "actions": [ { "type": { - "value": "SetStringVariable" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickIdentifier" }, "parameters": [ - "JoystickIdentifier", + "Object", + "Behavior", "=", "Value" ] @@ -3978,61 +3338,11 @@ "actions": [ { "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "DeadZoneRadius", - "=", - "Value" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::SetDeadZone" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "Value", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "Force the joystick into the pressing state.", - "fullName": "Force start pressing", - "functionType": "Action", - "name": "ForceStartPressing", - "sentence": "Force start pressing _PARAM0_ with touch identifier: _PARAM2_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyDeadZoneRadius" }, "parameters": [ - "TouchId", + "Object", + "Behavior", "=", "Value" ] @@ -4051,11 +3361,6 @@ "name": "Behavior", "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" - }, - { - "description": "Touch identifier", - "name": "Value", - "type": "expression" } ], "objectGroups": [] @@ -4066,12 +3371,18 @@ "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" }, { @@ -4079,12 +3390,17 @@ "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" }, @@ -4092,6 +3408,9 @@ "value": "0", "type": "Number", "label": "Joystick force (range: 0 to 1)", + "description": "", + "group": "", + "extraInformation": [], "hidden": true, "name": "JoystickForce" }, @@ -4099,6 +3418,9 @@ "value": "0", "type": "Number", "label": "", + "description": "", + "group": "", + "extraInformation": [], "hidden": true, "name": "TouchId" }, @@ -4106,6 +3428,9 @@ "value": "", "type": "Number", "label": "", + "description": "", + "group": "", + "extraInformation": [], "hidden": true, "name": "TouchIndex" } @@ -4113,7 +3438,7 @@ "sharedPropertyDescriptors": [] }, { - "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.", + "description": "Detect button presses made on a touchscreen.", "fullName": "Multitouch button", "name": "MultitouchButton", "objectType": "", @@ -4129,49 +3454,11 @@ "conditions": [ { "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "IsReleased", - "True", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsReleased", - "False", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + "value": "SpriteMultitouchJoystick::MultitouchButton::IsReleased" }, "parameters": [ "Object", "Behavior", - "\"Idle\"", - "" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "True", "" ] } @@ -4179,12 +3466,12 @@ "actions": [ { "type": { - "value": "SetBooleanVariable" + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyIsReleased" }, "parameters": [ - "IsJustPressed", - "False", - "" + "Object", + "Behavior", + "no" ] }, { @@ -4194,7 +3481,7 @@ "parameters": [ "Object", "Behavior", - "\"Pressed\"", + "\"Idle\"", "" ] } @@ -4226,10 +3513,11 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchIndex" }, "parameters": [ - "TouchIndex", + "Object", + "Behavior", "=", "0" ] @@ -4247,40 +3535,23 @@ "conditions": [ { "type": { - "value": "BuiltinCommonInstructions::Or" + "value": "CollisionPoint" }, - "parameters": [], - "subInstructions": [ - { - "type": { - "value": "CollisionPoint" - }, - "parameters": [ - "Object", - "TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer())", - "TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer())" - ] - }, - { - "type": { - "value": "NumberVariable" - }, - "parameters": [ - "Radius", - ">", - "DistanceBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer()), TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer()))" - ] - } + "parameters": [ + "Object", + "TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)", + "TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)" ] } ], "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchId" }, "parameters": [ - "TouchId", + "Object", + "Behavior", "=", "StartedTouchOrMouseId(TouchIndex)" ] @@ -4292,17 +3563,7 @@ "parameters": [ "Object", "Behavior", - "\"JustPressed\"", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "True", + "\"Pressed\"", "" ] } @@ -4314,10 +3575,11 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchIndex" }, "parameters": [ - "TouchIndex", + "Object", + "Behavior", "+", "1" ] @@ -4365,30 +3627,21 @@ }, { "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsReleased", - "True", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyIsReleased" }, "parameters": [ - "IsJustPressed", - "False", - "" + "Object", + "Behavior", + "yes" ] }, { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchId" }, "parameters": [ - "TouchId", + "Object", + "Behavior", "=", "0" ] @@ -4412,23 +3665,22 @@ "objectGroups": [] }, { - "description": "Check if the button was just pressed.", - "fullName": "Button just pressed", + "description": "Check if button is released.", + "fullName": "Button released", "functionType": "Condition", - "name": "IsJustPressed", - "sentence": "Button _PARAM0_ was just pressed", + "name": "IsReleased", + "sentence": "Button _PARAM0_ is released", "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "value": "BooleanVariable" + "value": "SpriteMultitouchJoystick::MultitouchButton::PropertyIsReleased" }, "parameters": [ - "IsJustPressed", - "True", - "" + "Object", + "Behavior" ] } ], @@ -4460,7 +3712,7 @@ "objectGroups": [] }, { - "description": "Check if the button is pressed.", + "description": "Check if button is pressed.", "fullName": "Button pressed", "functionType": "Condition", "name": "IsPressed", @@ -4471,10 +3723,11 @@ "conditions": [ { "type": { - "value": "NumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchButton::PropertyTouchId" }, "parameters": [ - "TouchId", + "Object", + "Behavior", "!=", "0" ] @@ -4507,54 +3760,6 @@ ], "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", @@ -4596,7 +3801,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"JustPressed\",\"Pressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -4608,18 +3813,27 @@ "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" }, @@ -4627,6 +3841,9 @@ "value": "", "type": "Number", "label": "", + "description": "", + "group": "", + "extraInformation": [], "hidden": true, "name": "TouchIndex" }, @@ -4634,23 +3851,11 @@ "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.", - "name": "Radius" } ], "sharedPropertyDescriptors": [] @@ -4660,7 +3865,6 @@ "fullName": "Platformer multitouch controller mapper", "name": "PlatformerMultitouchMapper", "objectType": "", - "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -4838,32 +4042,31 @@ "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", - "choices": [ - { - "label": "Primary", - "value": "Primary" - }, - { - "label": "Secondary", - "value": "Secondary" - } + "extraInformation": [ + "Primary", + "Secondary" ], "name": "JoystickIdentifier" }, @@ -4871,18 +4074,19 @@ "value": "A", "type": "String", "label": "Jump button name", + "description": "", "group": "Controls", + "extraInformation": [], "name": "JumpButton" } ], "sharedPropertyDescriptors": [] }, { - "description": "Control a 3D physics character with a multitouch controller.", - "fullName": "3D platformer multitouch controller mapper", - "name": "Platformer3DMultitouchMapper", + "description": "Control a top-down character with a multitouch controller.", + "fullName": "Top-down multitouch controller mapper", + "name": "TopDownMultitouchMapper", "objectType": "", - "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -4895,171 +4099,55 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::StickForce" - }, - "parameters": [ - "", - ">", - "0", - "ControllerIdentifier", - "JoystickIdentifier", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "Physics3D::PhysicsCharacter3D::SetForwardAngle" + "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" }, "parameters": [ "Object", - "PhysicsCharacter3D", + "Behavior", "=", - "SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier) + CameraAngle(Object.Layer())" - ] - }, - { - "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateStick" - }, - "parameters": [ - "Object", - "PhysicsCharacter3D", - "-90", - "SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier)" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::IsButtonPressed" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JumpButton", - "\"Down\"" + "\"Analog\"" ] } ], "actions": [ { "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" + "value": "TopDownMovementBehavior::SimulateStick" }, "parameters": [ "Object", - "PhysicsCharacter3D" + "TopDownMovement", + "SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier)", + "SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier)" ] } ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::Platformer3DMultitouchMapper", - "type": "behavior" - } - ], - "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "", - "type": "Behavior", - "label": "3D physics character", - "extraInformation": [ - "Physics3D::PhysicsCharacter3D" - ], - "choices": [], - "name": "PhysicsCharacter3D" - }, - { - "value": "1", - "type": "Number", - "label": "Controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier" - }, - { - "value": "Primary", - "type": "Choice", - "label": "Walk joystick", - "group": "Controls", - "choices": [ - { - "label": "Primary", - "value": "Primary" }, - { - "label": "Secondary", - "value": "Secondary" - } - ], - "name": "JoystickIdentifier" - }, - { - "value": "A", - "type": "String", - "label": "Jump button name", - "group": "Controls", - "name": "JumpButton" - } - ], - "sharedPropertyDescriptors": [] - }, - { - "description": "Control a 3D physics character with a multitouch controller.", - "fullName": "3D shooter multitouch controller mapper", - "name": "Shooter3DMultitouchMapper", - "objectType": "", - "quickCustomizationVisibility": "hidden", - "eventsFunctions": [ - { - "fullName": "", - "functionType": "Action", - "name": "doStepPreEvents", - "sentence": "", - "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::StickForce" + "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" }, "parameters": [ - "", - ">", - "0", - "ControllerIdentifier", - "JoystickIdentifier", - "" + "Object", + "Behavior", + "=", + "\"360°\"" ] } ], "actions": [ { "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateStick" + "value": "TopDownMovementBehavior::SimulateStick" }, "parameters": [ "Object", - "PhysicsCharacter3D", + "TopDownMovement", "SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier)", - "SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier)" + "sign(SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier))" ] } ] @@ -5069,2140 +4157,144 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::IsButtonPressed" + "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" }, "parameters": [ - "", - "ControllerIdentifier", - "JumpButton", - "\"Down\"" + "Object", + "Behavior", + "=", + "\"8 Directions\"" ] } ], - "actions": [ - { - "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" - }, - "parameters": [ - "Object", - "PhysicsCharacter3D" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::Shooter3DMultitouchMapper", - "type": "behavior" - } - ], - "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "", - "type": "Behavior", - "label": "3D physics character", - "extraInformation": [ - "Physics3D::PhysicsCharacter3D" - ], - "choices": [], - "name": "PhysicsCharacter3D" - }, - { - "value": "1", - "type": "Number", - "label": "Controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier" - }, - { - "value": "Primary", - "type": "Choice", - "label": "Walk joystick", - "group": "Controls", - "choices": [ - { - "label": "Primary", - "value": "Primary" - }, - { - "label": "Secondary", - "value": "Secondary" - } - ], - "name": "JoystickIdentifier" - }, - { - "value": "A", - "type": "String", - "label": "Jump button name", - "group": "Controls", - "name": "JumpButton" - } - ], - "sharedPropertyDescriptors": [] - }, - { - "description": "Control camera rotations with a multitouch controller.", - "fullName": "First person camera multitouch controller mapper", - "name": "FirstPersonMultitouchMapper", - "objectType": "", - "quickCustomizationVisibility": "hidden", - "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", - "=", - "SpriteMultitouchJoystick::AcceleratedSpeed(CurrentRotationSpeedZ, SpriteMultitouchJoystick::StickForceX(ControllerIdentifier, CameraStick) * HorizontalRotationSpeedMax, HorizontalRotationSpeedMax, HorizontalRotationAcceleration, HorizontalRotationDeceleration)" - ] - }, - { - "type": { - "value": "SetAngle" - }, - "parameters": [ - "Object", - "+", - "CurrentRotationSpeedZ * TimeDelta()" - ] - }, - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "CurrentRotationSpeedY", - "=", - "SpriteMultitouchJoystick::AcceleratedSpeed(CurrentRotationSpeedY, SpriteMultitouchJoystick::StickForceY(ControllerIdentifier, 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": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper::LookFromObjectEyes" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", - "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" - }, - "parameters": [ - "", - "=", - "Object.Angle() + 90", - "Object.Layer()", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "the maximum horizontal rotation speed of the object.", - "fullName": "Maximum horizontal rotation speed", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller 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": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "HorizontalRotationSpeedMax", - "name": "SetHorizontalRotationSpeedMax", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "HorizontalRotationSpeedMax", - "=", - "Value" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "the horizontal rotation acceleration of the object.", - "fullName": "Horizontal rotation acceleration", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller 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": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "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": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "the horizontal rotation deceleration of the object.", - "fullName": "Horizontal rotation deceleration", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller 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": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "HorizontalRotationDeceleration", - "name": "SetHorizontalRotationDeceleration", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "HorizontalRotationDeceleration", - "=", - "Value" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "the maximum vertical rotation speed of the object.", - "fullName": "Maximum vertical rotation speed", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller 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": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "VerticalRotationSpeedMax", - "name": "SetVerticalRotationSpeedMax", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "VerticalRotationSpeedMax", - "=", - "Value" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "the vertical rotation acceleration of the object.", - "fullName": "Vertical rotation acceleration", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller 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": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "VerticalRotationAcceleration", - "name": "SetVerticalRotationAcceleration", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "VerticalRotationAcceleration", - "=", - "Value" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "the vertical rotation deceleration of the object.", - "fullName": "Vertical rotation deceleration", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper vertical rotation configuration", - "name": "VerticalRotationDeceleration", - "sentence": "the vertical rotation deceleration", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "VerticalRotationDeceleration" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", - "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": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "the minimum vertical camera angle of the object.", - "fullName": "Minimum vertical camera angle", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper vertical rotation configuration", - "name": "VerticalAngleMin", - "sentence": "the minimum vertical camera angle", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "VerticalAngleMin" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "VerticalAngleMin", - "name": "SetVerticalAngleMin", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "VerticalAngleMin", - "=", - "Value" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "the maximum vertical camera angle of the object.", - "fullName": "Maximum vertical camera angle", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller 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": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", - "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": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "the z position offset of the object.", - "fullName": "Z position offset", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller 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": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", - "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": "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": "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": { - "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "\"Up\"", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "TopDownMovementBehavior::SimulateUpKey" - }, - "parameters": [ - "Object", - "TopDownMovement" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "\"Down\"", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "TopDownMovementBehavior::SimulateDownKey" - }, - "parameters": [ - "Object", - "TopDownMovement" - ] - } - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "TopDownMovementBehavior::DiagonalsAllowed" - }, - "parameters": [ - "Object", - "TopDownMovement" - ] - } - ], - "actions": [], - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::IsDirectionPushed8Way" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "\"Left\"", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "TopDownMovementBehavior::SimulateLeftKey" - }, - "parameters": [ - "Object", - "TopDownMovement" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::IsDirectionPushed8Way" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "\"Right\"", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "TopDownMovementBehavior::SimulateRightKey" - }, - "parameters": [ - "Object", - "TopDownMovement" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::IsDirectionPushed8Way" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "\"Up\"", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "TopDownMovementBehavior::SimulateUpKey" - }, - "parameters": [ - "Object", - "TopDownMovement" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::IsDirectionPushed8Way" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "\"Down\"", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "TopDownMovementBehavior::SimulateDownKey" - }, - "parameters": [ - "Object", - "TopDownMovement" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::IsDirectionPushed8Way" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "\"UpLeft\"", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "TopDownMovementBehavior::SimulateUpKey" - }, - "parameters": [ - "Object", - "TopDownMovement" - ] - }, - { - "type": { - "value": "TopDownMovementBehavior::SimulateLeftKey" - }, - "parameters": [ - "Object", - "TopDownMovement" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::IsDirectionPushed8Way" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "\"UpRight\"", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "TopDownMovementBehavior::SimulateUpKey" - }, - "parameters": [ - "Object", - "TopDownMovement" - ] - }, - { - "type": { - "value": "TopDownMovementBehavior::SimulateRightKey" - }, - "parameters": [ - "Object", - "TopDownMovement" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::IsDirectionPushed8Way" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "\"DownLeft\"", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "TopDownMovementBehavior::SimulateDownKey" - }, - "parameters": [ - "Object", - "TopDownMovement" - ] - }, - { - "type": { - "value": "TopDownMovementBehavior::SimulateLeftKey" - }, - "parameters": [ - "Object", - "TopDownMovement" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::IsDirectionPushed8Way" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "\"DownRight\"", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "TopDownMovementBehavior::SimulateDownKey" - }, - "parameters": [ - "Object", - "TopDownMovement" - ] - }, - { - "type": { - "value": "TopDownMovementBehavior::SimulateRightKey" - }, - "parameters": [ - "Object", - "TopDownMovement" - ] - } - ] - } - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::TopDownMultitouchMapper", - "type": "behavior" - } - ], - "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "", - "type": "Behavior", - "label": "Top-down movement behavior", - "extraInformation": [ - "TopDownMovementBehavior::TopDownMovementBehavior" - ], - "choices": [], - "name": "TopDownMovement" - }, - { - "value": "1", - "type": "Number", - "label": "Controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier" - }, - { - "value": "Primary", - "type": "Choice", - "label": "Joystick name", - "choices": [ - { - "label": "Primary", - "value": "Primary" - }, - { - "label": "Secondary", - "value": "Secondary" - } - ], - "name": "JoystickIdentifier" - }, - { - "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": [ - { - "areaMaxX": 64, - "areaMaxY": 64, - "areaMaxZ": 64, - "areaMinX": 0, - "areaMinY": 0, - "areaMinZ": 0, - "defaultName": "Joystick", - "description": "Joystick for touchscreens.", - "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": "", - "functionType": "Action", - "name": "onCreated", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "Create" - }, - "parameters": [ - "", - "Border", - "0", - "0", - "" - ] - }, - { - "type": { - "value": "Create" - }, - "parameters": [ - "", - "Thumb", - "0", - "0", - "" - ] - }, - { - "type": { - "value": "ChangePlan" - }, - "parameters": [ - "Border", - "=", - "1" - ] - }, - { - "type": { - "value": "ChangePlan" - }, - "parameters": [ - "Thumb", - "=", - "2" - ] - }, - { - "type": { - "value": "SetCenter" - }, - "parameters": [ - "Border", - "=", - "0", - "=", - "0" - ] - }, - { - "type": { - "value": "SetCenter" - }, - "parameters": [ - "Thumb", - "=", - "0", - "=", - "0" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::UpdateConfiguration" - }, - "parameters": [ - "Object", - "" - ] - }, - { - "type": { - "value": "SetIncludedInParentCollisionMask" - }, - "parameters": [ - "Thumb", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "supplementaryInformation": "SpriteMultitouchJoystick::SpriteMultitouchJoystick", - "type": "object" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "Action", - "name": "doStepPostEvents", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "inverted": true, - "value": "SpriteMultitouchJoystick::IsInGameEdition" - }, - "parameters": [ - "", - "" - ] - } - ], - "actions": [], - "events": [ + "actions": [], + "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ + "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": { - "value": "MettreAutour" - }, - "parameters": [ - "Thumb", - "Border", - "Border.MultitouchJoystick::JoystickForce() * Border.Width() / 2", - "Border.MultitouchJoystick::JoystickAngle()" + "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": { + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JoystickIdentifier", + "\"Up\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "TopDownMovementBehavior::SimulateUpKey" + }, + "parameters": [ + "Object", + "TopDownMovement" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JoystickIdentifier", + "\"Down\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "TopDownMovementBehavior::SimulateDownKey" + }, + "parameters": [ + "Object", + "TopDownMovement" + ] + } ] } ] @@ -7212,52 +4304,274 @@ "conditions": [ { "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "ShouldBeHiddenWhenReleased", - "True", - "" - ] - }, - { - "type": { - "inverted": true, - "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::IsPressed" + "value": "TopDownMovementBehavior::DiagonalsAllowed" }, "parameters": [ "Object", - "" + "TopDownMovement" ] } ], - "actions": [ + "actions": [], + "events": [ { - "type": { - "value": "Cache" - }, - "parameters": [ - "Object" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::IsDirectionPushed8Way" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JoystickIdentifier", + "\"Left\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "TopDownMovementBehavior::SimulateLeftKey" + }, + "parameters": [ + "Object", + "TopDownMovement" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::IsDirectionPushed8Way" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JoystickIdentifier", + "\"Right\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "TopDownMovementBehavior::SimulateRightKey" + }, + "parameters": [ + "Object", + "TopDownMovement" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::IsDirectionPushed8Way" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JoystickIdentifier", + "\"Up\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "TopDownMovementBehavior::SimulateUpKey" + }, + "parameters": [ + "Object", + "TopDownMovement" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::IsDirectionPushed8Way" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JoystickIdentifier", + "\"Down\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "TopDownMovementBehavior::SimulateDownKey" + }, + "parameters": [ + "Object", + "TopDownMovement" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::IsDirectionPushed8Way" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JoystickIdentifier", + "\"UpLeft\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "TopDownMovementBehavior::SimulateUpKey" + }, + "parameters": [ + "Object", + "TopDownMovement" + ] + }, + { + "type": { + "value": "TopDownMovementBehavior::SimulateLeftKey" + }, + "parameters": [ + "Object", + "TopDownMovement" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::IsDirectionPushed8Way" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JoystickIdentifier", + "\"UpRight\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "TopDownMovementBehavior::SimulateUpKey" + }, + "parameters": [ + "Object", + "TopDownMovement" + ] + }, + { + "type": { + "value": "TopDownMovementBehavior::SimulateRightKey" + }, + "parameters": [ + "Object", + "TopDownMovement" + ] + } ] }, { - "type": { - "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::ActivateControl" - }, - "parameters": [ - "Object", - "no", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::IsDirectionPushed8Way" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JoystickIdentifier", + "\"DownLeft\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "TopDownMovementBehavior::SimulateDownKey" + }, + "parameters": [ + "Object", + "TopDownMovement" + ] + }, + { + "type": { + "value": "TopDownMovementBehavior::SimulateLeftKey" + }, + "parameters": [ + "Object", + "TopDownMovement" + ] + } ] }, { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "ShouldBeHiddenWhenReleased", - "False", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::IsDirectionPushed8Way" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JoystickIdentifier", + "\"DownRight\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "TopDownMovementBehavior::SimulateDownKey" + }, + "parameters": [ + "Object", + "TopDownMovement" + ] + }, + { + "type": { + "value": "TopDownMovementBehavior::SimulateRightKey" + }, + "parameters": [ + "Object", + "TopDownMovement" + ] + } ] } ] @@ -7269,51 +4583,87 @@ { "description": "Object", "name": "Object", - "supplementaryInformation": "SpriteMultitouchJoystick::SpriteMultitouchJoystick", "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::TopDownMultitouchMapper", + "type": "behavior" } ], "objectGroups": [] - }, + } + ], + "propertyDescriptors": [ { - "fullName": "", - "functionType": "Action", - "name": "onHotReloading", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::UpdateConfiguration" - }, - "parameters": [ - "Object", - "" - ] - } - ] - } + "value": "", + "type": "Behavior", + "label": "Top-down movement behavior", + "description": "", + "group": "", + "extraInformation": [ + "TopDownMovementBehavior::TopDownMovementBehavior" ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "supplementaryInformation": "SpriteMultitouchJoystick::SpriteMultitouchJoystick", - "type": "object" - } + "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" ], - "objectGroups": [] + "name": "JoystickIdentifier" }, { - "description": "Pass the object property values to the behavior.", - "fullName": "Update configuration", + "value": "Analog", + "type": "Choice", + "label": "Stick mode", + "description": "", + "group": "Controls", + "extraInformation": [ + "Analog", + "360°", + "8 Directions" + ], + "name": "StickMode" + } + ], + "sharedPropertyDescriptors": [] + } + ], + "eventsBasedObjects": [ + { + "areaMaxX": 64, + "areaMaxY": 64, + "areaMaxZ": 64, + "areaMinX": 0, + "areaMinY": 0, + "areaMinZ": 0, + "defaultName": "Joystick", + "description": "Joystick for touchscreens.", + "fullName": "Multitouch Joystick", + "isUsingLegacyInstancesRenderer": true, + "name": "SpriteMultitouchJoystick", + "eventsFunctions": [ + { + "fullName": "", "functionType": "Action", - "name": "UpdateConfiguration", - "private": true, - "sentence": "Update the configuration of _PARAM0_", + "name": "onCreated", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -7321,98 +4671,75 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetControllerIdentifier" + "value": "Create" }, "parameters": [ + "", "Border", - "MultitouchJoystick", - "=", - "ControllerIdentifier", + "0", + "0", "" ] }, { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickIdentifier" + "value": "Create" }, "parameters": [ - "Border", - "MultitouchJoystick", - "=", - "JoystickIdentifier", + "", + "Thumb", + "0", + "0", "" ] }, { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetDeadZoneRadius" + "value": "ChangePlan" }, "parameters": [ "Border", - "MultitouchJoystick", "=", - "DeadZoneRadius", - "" + "1" ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "supplementaryInformation": "SpriteMultitouchJoystick::SpriteMultitouchJoystick", - "type": "object" - } - ], - "objectGroups": [] - }, - { - "description": "Show the joystick until it is released.", - "fullName": "Show and start pressing", - "functionType": "Action", - "name": "TeleportAndPress", - "sentence": "Show _PARAM0_ at the cursor position and start pressing", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + }, { "type": { - "value": "HasAnyTouchOrMouseStarted" + "value": "ChangePlan" }, "parameters": [ - "" + "Thumb", + "=", + "2" ] - } - ], - "actions": [ + }, { "type": { - "value": "MettreXY" + "value": "SetCenter" }, "parameters": [ - "Object", + "Border", "=", - "Object.ParentTouchX(StartedTouchOrMouseId(0))", + "0", "=", - "Object.ParentTouchY(StartedTouchOrMouseId(0))" + "0" ] }, { "type": { - "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::ActivateControl" + "value": "SetCenter" }, "parameters": [ - "Object", - "yes", - "" + "Thumb", + "=", + "0", + "=", + "0" ] }, { "type": { - "value": "Montre" + "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::UpdateConfiguration" }, "parameters": [ "Object", @@ -7421,23 +4748,45 @@ }, { "type": { - "value": "SetBooleanVariable" + "value": "SetIncludedInParentCollisionMask" }, "parameters": [ - "ShouldBeHiddenWhenReleased", - "True", + "Thumb", "" ] - }, + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "SpriteMultitouchJoystick::SpriteMultitouchJoystick", + "type": "object" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "Action", + "name": "doStepPostEvents", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::ForceStartPressing" + "value": "MettreAutour" }, "parameters": [ + "Thumb", "Border", - "MultitouchJoystick", - "StartedTouchOrMouseId(0)", - "" + "Border.MultitouchJoystick::JoystickForce() * Border.Width() / 2", + "Border.MultitouchJoystick::JoystickAngle()" ] } ] @@ -7454,87 +4803,94 @@ "objectGroups": [] }, { - "description": "Return the X position of a specified touch", - "fullName": "Touch X position (on parent)", - "functionType": "Expression", - "name": "ParentTouchX", - "private": true, + "fullName": "", + "functionType": "Action", + "name": "onHotReloading", "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [], - "actions": [] - }, - { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "const object = objects[0];", - "const touchId = eventsFunctionContext.getArgument(\"TouchId\");", - "eventsFunctionContext.returnValue = gdjs.evtTools.input.getTouchX(object.getInstanceContainer(), touchId, object.getLayer());" - ], - "parameterObjects": "Object", - "useStrict": true, - "eventsSheetExpanded": false + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::UpdateConfiguration" + }, + "parameters": [ + "Object", + "" + ] + } + ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", "name": "Object", "supplementaryInformation": "SpriteMultitouchJoystick::SpriteMultitouchJoystick", "type": "object" - }, - { - "description": "Touch identifier", - "name": "TouchId", - "type": "expression" } ], "objectGroups": [] }, { - "description": "Return the X position of a specified touch", - "fullName": "Touch X position (on parent)", - "functionType": "Expression", - "name": "ParentTouchY", + "description": "Pass the object property values to the behavior.", + "fullName": "Update configuration", + "functionType": "Action", + "name": "UpdateConfiguration", "private": true, - "sentence": "", + "sentence": "Update the configuration of _PARAM0_", "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [], - "actions": [] - }, - { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "const object = objects[0];", - "const touchId = eventsFunctionContext.getArgument(\"TouchId\");", - "eventsFunctionContext.returnValue = gdjs.evtTools.input.getTouchY(object.getInstanceContainer(), touchId, object.getLayer());" - ], - "parameterObjects": "Object", - "useStrict": true, - "eventsSheetExpanded": false + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetControllerIdentifier" + }, + "parameters": [ + "Border", + "MultitouchJoystick", + "=", + "Object.PropertyControllerIdentifier()", + "" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickIdentifier" + }, + "parameters": [ + "Border", + "MultitouchJoystick", + "=", + "Object.PropertyJoystickIdentifier()", + "" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetDeadZoneRadius" + }, + "parameters": [ + "Border", + "MultitouchJoystick", + "=", + "Object.PropertyDeadZoneRadius()", + "" + ] + } + ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", "name": "Object", "supplementaryInformation": "SpriteMultitouchJoystick::SpriteMultitouchJoystick", "type": "object" - }, - { - "description": "Touch identifier", - "name": "TouchId", - "type": "expression" } ], "objectGroups": [] @@ -7552,12 +4908,10 @@ { "type": { "inverted": true, - "value": "BooleanVariable" + "value": "GetArgumentAsBoolean" }, "parameters": [ - "ShouldActivate", - "True", - "" + "\"ShouldActivate\"" ] } ], @@ -7579,12 +4933,10 @@ "conditions": [ { "type": { - "value": "BooleanVariable" + "value": "GetArgumentAsBoolean" }, "parameters": [ - "ShouldActivate", - "True", - "" + "\"ShouldActivate\"" ] } ], @@ -8194,21 +5546,20 @@ "value": "1", "type": "Number", "label": "Multitouch controller identifier (1, 2, 3, 4...)", + "description": "", + "group": "", + "extraInformation": [], "name": "ControllerIdentifier" }, { "value": "Primary", "type": "Choice", "label": "Joystick name", - "choices": [ - { - "label": "Primary", - "value": "Primary" - }, - { - "label": "Secondary", - "value": "Secondary" - } + "description": "", + "group": "", + "extraInformation": [ + "Primary", + "Secondary" ], "name": "JoystickIdentifier" }, @@ -8217,6 +5568,8 @@ "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" }, { @@ -8224,10 +5577,10 @@ "type": "String", "label": "", "description": "Only used by the scene editor.", + "group": "", "extraInformation": [ "Thumb" ], - "choices": [], "hidden": true, "name": "ThumbAnchorOrigin" }, @@ -8236,6 +5589,8 @@ "type": "Number", "label": "", "description": "Only used by the scene editor.", + "group": "", + "extraInformation": [], "hidden": true, "name": "ThumbAnchorTarget" }, @@ -8244,10 +5599,10 @@ "type": "Boolean", "label": "", "description": "Only used by the scene editor.", + "group": "", "extraInformation": [ "Thumb" ], - "choices": [], "hidden": true, "name": "ThumbIsScaledProportionally" }, @@ -8256,17 +5611,116 @@ "type": "String", "label": "", "description": "Only used by the scene editor.", + "group": "", + "extraInformation": [], "hidden": true, "name": "ParentOrigin" + } + ], + "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": [] + } + ] + } + ] }, { - "value": "", - "type": "Boolean", - "label": "", - "hidden": true, - "name": "ShouldBeHiddenWhenReleased" + "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": [] } ] }, diff --git a/examples/starting-twin-stick-shooter/starting-twin-stick-shooter.json b/examples/starting-twin-stick-shooter/starting-twin-stick-shooter.json index 949222b34..29e4bce57 100644 --- a/examples/starting-twin-stick-shooter/starting-twin-stick-shooter.json +++ b/examples/starting-twin-stick-shooter/starting-twin-stick-shooter.json @@ -1206,19 +1206,19 @@ "category": "Input", "extensionNamespace": "", "fullName": "Multitouch joystick and buttons (sprite)", - "gdevelopVersion": ">=5.5.222", + "gdevelopVersion": "", "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", + "version": "1.4.0", "description": [ - "Multitouch joysticks are objects showing a joystick on the screen, useful for mobile. They work like a physical gamepad:", + "Multitouch joysticks can be used the same way as physical gamepads:", "- 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.", + "- 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)." ], @@ -1283,33 +1283,108 @@ ], "eventsFunctions": [ { - "description": "Check if the events are running for the editor.", - "fullName": "Editor is running", + "description": "Check if a button is pressed on a gamepad.", + "fullName": "Multitouch controller button pressed", "functionType": "Condition", - "name": "IsInGameEdition", - "private": true, - "sentence": "Events are running for the editor", + "name": "IsButtonPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", "events": [ { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "const game = runtimeScene.getGame();\r", - "eventsFunctionContext.returnValue = game.isInGameEdition && game.isInGameEdition();" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"Pressed\"" + ] + } ], - "parameterObjects": "", - "useStrict": true, - "eventsSheetExpanded": false + "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" } ], - "parameters": [], "objectGroups": [] }, { - "fullName": "Accelerated speed", - "functionType": "Expression", - "name": "AcceleratedSpeed", + "description": "Check if a button is released on a gamepad.", + "fullName": "Multitouch controller button released", + "functionType": "Condition", + "name": "IsButtonReleased", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is released", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"Released\"" + ] + } + ], + "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": "Change a button state for a multitouch controller.", + "fullName": "Button state", + "functionType": "Action", + "name": "SetButtonState", "private": true, - "sentence": "", + "sentence": "Mark _PARAM2_ button as _PARAM3_ for multitouch controller _PARAM1_", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -1317,443 +1392,108 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SetStringVariable" }, "parameters": [ - "AcceleratedSpeed", + "Controllers[ControllerIdentifier].Buttons[Button].State", "=", - "CurrentSpeed" + "ButtonState" ] } - ], - "events": [ + ] + } + ], + "parameters": [ + { + "description": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier", + "type": "expression" + }, + { + "description": "Button name", + "name": "Button", + "type": "string" + }, + { + "description": "Button state", + "name": "ButtonState", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "type": "stringWithSelector" + } + ], + "objectGroups": [] + }, + { + "description": "Change the dead zone radius of a joystick. 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).", + "fullName": "Dead zone radius", + "functionType": "Action", + "name": "SetDeadZone", + "private": true, + "sentence": "Change the dead zone of multitouch joystick _PARAM2_ of multitouch controller _PARAM1_ to _PARAM3_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ { - "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", - "=", - "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": { + "value": "SetNumberVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].DeadZone", + "=", + "DeadZoneRadius" ] - }, - { - "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": "NumberVariable" - }, - "parameters": [ - "TargetedSpeed", - "=", - "0" - ] - } - ], - "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", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "clamp(AcceleratedSpeed, -SpeedMax, SpeedMax)" - ] - } - ] - } - ], - "variables": [ - { - "name": "AcceleratedSpeed", - "type": "number", - "value": 0 } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { - "description": "Current speed", - "name": "CurrentSpeed", - "type": "expression" - }, - { - "description": "Targeted speed", - "name": "TargetedSpeed", - "type": "expression" - }, - { - "description": "Max speed", - "name": "SpeedMax", + "description": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier", "type": "expression" }, { - "description": "Acceleration", - "name": "Acceleration", - "type": "expression" + "description": "Joystick name", + "name": "JoystickIdentifier", + "type": "string" }, { - "description": "Deceleration", - "name": "Deceleration", + "description": "Dead zone radius", + "name": "DeadZoneRadius", + "supplementaryInformation": "[]", "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", + "description": "Return the dead zone radius of a joystick. 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).", + "fullName": "Dead zone radius", + "functionType": "Expression", + "name": "DeadZone", + "private": true, + "sentence": "Change multitouch joystick _PARAM2_ of multitouch controller _PARAM1_ dead zone to _PARAM3_", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Buttons[Button].State", - "=", - "\"JustPressed\"" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "SetReturnBoolean" + "value": "SetReturnNumber" }, "parameters": [ - "True" + "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].DeadZone" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Multitouch controller identifier (1, 2, 3, 4...)", @@ -1761,265 +1501,20 @@ "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\"]", + "description": "Joystick name", + "name": "JoystickIdentifier", "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\"" - ] - } - ] - } - ], - "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", - "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is released", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Buttons[Button].State", - "=", - "\"Released\"" - ] - } - ], - "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": "Change a button state for a multitouch controller.", - "fullName": "Button state", - "functionType": "Action", - "name": "SetButtonState", - "private": true, - "sentence": "Mark _PARAM2_ button as _PARAM3_ for multitouch controller _PARAM1_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetStringVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Buttons[Button].State", - "=", - "ButtonState" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" - }, - { - "description": "Button name", - "name": "Button", - "type": "string" - }, - { - "description": "Button state", - "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"JustPressed\",\"Released\"]", - "type": "stringWithSelector" - } - ], - "objectGroups": [] - }, - { - "description": "Change the dead zone radius of a joystick. 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).", - "fullName": "Dead zone radius", - "functionType": "Action", - "name": "SetDeadZone", - "private": true, - "sentence": "Change the dead zone of multitouch joystick _PARAM2_ of multitouch controller _PARAM1_ to _PARAM3_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].DeadZone", - "=", - "DeadZoneRadius" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" - }, - { - "description": "Joystick name", - "name": "JoystickIdentifier", - "type": "string" - }, - { - "description": "Dead zone radius", - "name": "DeadZoneRadius", - "supplementaryInformation": "[]", - "type": "expression" - } - ], - "objectGroups": [] - }, - { - "description": "Return the dead zone radius of a joystick. 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).", - "fullName": "Dead zone radius", - "functionType": "Expression", - "name": "DeadZone", - "private": true, - "sentence": "Change multitouch joystick _PARAM2_ of multitouch controller _PARAM1_ dead zone to _PARAM3_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].DeadZone" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" - }, - { - "description": "Joystick name", - "name": "JoystickIdentifier", - "type": "string" - } - ], - "objectGroups": [] - }, - { - "description": "the direction index (left = 1, bottom = 1, right = 2, top = 3) for an angle (in degrees).", - "fullName": "Angle to 4-way index", - "functionType": "ExpressionAndCondition", - "name": "AngleTo4Way", - "private": true, - "sentence": "The angle _PARAM1_ 4-way index", + "description": "the direction index (left = 1, bottom = 1, right = 2, top = 3) for an angle (in degrees).", + "fullName": "Angle to 4-way index", + "functionType": "ExpressionAndCondition", + "name": "AngleTo4Way", + "private": true, + "sentence": "The angle _PARAM1_ 4-way index", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -2772,11 +2267,6 @@ "name": "JoystickIdentifier", "supplementaryInformation": "[\"Primary\",\"Secondary\"]", "type": "stringWithSelector" - }, - { - "description": "", - "name": "Coucou", - "type": "expression" } ], "objectGroups": [] @@ -3006,7 +2496,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "XFromAngleAndDistance(SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier), SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier))" + "SpriteMultitouchJoystick::JoystickForce(ControllerIdentifier, JoystickIdentifier) * cos(ToRad(SpriteMultitouchJoystick::JoystickAngle(ControllerIdentifier, JoystickIdentifier)))" ] } ] @@ -3046,7 +2536,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "YFromAngleAndDistance(SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier), SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier))" + "SpriteMultitouchJoystick::JoystickForce(ControllerIdentifier, JoystickIdentifier) * sin(ToRad(SpriteMultitouchJoystick::JoystickAngle(ControllerIdentifier, JoystickIdentifier)))" ] } ] @@ -3069,2032 +2559,46 @@ } ], "objectGroups": [] - }, + } + ], + "eventsBasedBehaviors": [ { - "description": "Check if a new touch has started on the right or left side of the screen.", - "fullName": "New touch on a screen side", - "functionType": "Condition", - "group": "Multitouch Joystick", - "name": "HasTouchStartedOnScreenSide", - "sentence": "A new touch has started on the _PARAM2_ side of the screen on _PARAM1_'s layer", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "HasAnyTouchOrMouseStarted" - }, - "parameters": [ - "" - ] - } - ], - "actions": [], - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "Side", - "=", - "\"Left\"" - ] - }, - { - "type": { - "value": "TouchX" - }, - "parameters": [ - "", - "StartedTouchOrMouseId(0)", - "<", - "CameraCenterX(Object.Layer())", - "Object.Layer()", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "Side", - "=", - "\"Right\"" - ] - }, - { - "type": { - "value": "TouchX" - }, - "parameters": [ - "", - "StartedTouchOrMouseId(0)", - ">=", - "CameraCenterX(Object.Layer())", - "Object.Layer()", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - } - ] - } - ], - "parameters": [ - { - "description": "Multitouch joystick", - "name": "Object", - "supplementaryInformation": "SpriteMultitouchJoystick::SpriteMultitouchJoystick", - "type": "objectList" - }, - { - "description": "Screen side", - "name": "Side", - "supplementaryInformation": "[\"Left\",\"Right\"]", - "type": "stringWithSelector" - } - ], - "objectGroups": [] - } - ], - "eventsBasedBehaviors": [ - { - "description": "Joystick that can be controlled by interacting with a touchscreen.", - "fullName": "Multitouch Joystick", - "name": "MultitouchJoystick", - "objectType": "", - "private": true, - "eventsFunctions": [ + "description": "Joystick that can be controlled by interacting with a touchscreen.", + "fullName": "Multitouch Joystick", + "name": "MultitouchJoystick", + "objectType": "", + "private": true, + "eventsFunctions": [ { "fullName": "", "functionType": "Action", "name": "onCreated", "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::SetDeadZone" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "DeadZoneRadius", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "Action", - "name": "onDeActivate", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "Action", - "name": "doStepPreEvents", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "inverted": true, - "value": "SpriteMultitouchJoystick::IsInGameEdition" - }, - "parameters": [ - "", - "" - ] - } - ], - "actions": [], - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "HasGameJustResumed" - }, - "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)" - }, - { - "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": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "the joystick force (from 0 to 1).", - "fullName": "Joystick force", - "functionType": "ExpressionAndCondition", - "name": "JoystickForce", - "sentence": "the joystick force", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "max(0, JoystickForce - DeadZoneRadius) / (1 - DeadZoneRadius)" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "JoystickForce", - "name": "SetJoystickForce", - "private": true, - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "JoystickForce", - "=", - "Value" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::SetJoystickForce" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "JoystickForce", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - }, - { - "description": "", - "name": "Parameter", - "type": "objectList" - } - ], - "objectGroups": [] - }, - { - "description": "Return the angle the joystick is pointing towards (Range: -180 to 180).", - "fullName": "Joystick angle", - "functionType": "Expression", - "name": "JoystickAngle", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "JoystickAngle" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "Change the angle the joystick is pointing towards (Range: -180 to 180).", - "fullName": "Joystick angle", - "functionType": "Action", - "name": "SetJoystickAngle", - "private": true, - "sentence": "Change the joystick angle of _PARAM0_ to _PARAM2_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "JoystickAngle", - "=", - "Value" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::SetJoystickAngle" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "JoystickAngle", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - }, - { - "description": "Angle", - "name": "Value", - "type": "expression" - } - ], - "objectGroups": [] - }, - { - "description": "Return the stick force on X axis (from -1 at the left to 1 at the right).", - "fullName": "Stick X force", - "functionType": "Expression", - "name": "StickForceX", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "Object.Behavior::JoystickForce() * cos(ToRad(Object.Behavior::JoystickAngle()))" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "Return the stick force on Y axis (from -1 at the top to 1 at the bottom).", - "fullName": "Stick Y force", - "functionType": "Expression", - "name": "StickForceY", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "Object.Behavior::JoystickForce() * sin(ToRad(Object.Behavior::JoystickAngle()))" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "Check if joystick is pushed in a given direction.", - "fullName": "Joystick pushed in a direction (4-way movement)", - "functionType": "Condition", - "name": "IsDirectionPushed4Way", - "sentence": "_PARAM0_ is pushed in direction _PARAM2_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::JoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - ">", - "0", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::IsAngleIn4WayDirection" - }, - "parameters": [ - "", - "JoystickAngle", - "Direction", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - }, - { - "description": "Direction", - "name": "Direction", - "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\"]", - "type": "stringWithSelector" - } - ], - "objectGroups": [] - }, - { - "description": "Check if joystick is pushed in a given direction.", - "fullName": "Joystick pushed in a direction (8-way movement)", - "functionType": "Condition", - "name": "IsDirectionPushed8Way", - "sentence": "_PARAM0_ is pushed in direction _PARAM2_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::JoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - ">", - "0", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::IsAngleIn8WayDirection" - }, - "parameters": [ - "", - "JoystickAngle", - "Direction", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - }, - { - "description": "Direction", - "name": "Direction", - "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\",\"UpLeft\",\"UpRight\",\"DownLeft\",\"DownRight\"]", - "type": "stringWithSelector" - } - ], - "objectGroups": [] - }, - { - "description": "Check if a joystick is pressed.", - "fullName": "Joystick pressed", - "functionType": "Condition", - "name": "IsPressed", - "sentence": "Joystick _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::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "Reset the joystick values (except for angle, which stays the same)", - "fullName": "Reset", - "functionType": "Action", - "name": "Reset", - "private": true, - "sentence": "Reset the joystick of _PARAM0_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "0", - "" - ] - }, - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "0" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "the multitouch controller identifier.", - "fullName": "Multitouch controller identifier", - "functionType": "ExpressionAndCondition", - "group": "Multitouch Joystick configuration", - "name": "ControllerIdentifier", - "sentence": "the multitouch controller identifier", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "ControllerIdentifier" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "ControllerIdentifier", - "name": "SetControllerIdentifier", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "ControllerIdentifier", - "=", - "Value" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "the joystick name.", - "fullName": "Joystick name", - "functionType": "ExpressionAndCondition", - "group": "Multitouch Joystick configuration", - "name": "JoystickIdentifier", - "sentence": "the joystick name", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnString" - }, - "parameters": [ - "JoystickIdentifier" - ] - } - ] - } - ], - "expressionType": { - "type": "string" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "JoystickIdentifier", - "name": "SetJoystickIdentifier", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetStringVariable" - }, - "parameters": [ - "JoystickIdentifier", - "=", - "Value" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "the dead zone radius (range: 0 to 1) of the joystick. 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).", - "fullName": "Dead zone radius", - "functionType": "ExpressionAndCondition", - "group": "Multitouch Joystick configuration", - "name": "DeadZoneRadius", - "sentence": "the dead zone radius", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "DeadZoneRadius" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "DeadZoneRadius", - "name": "SetDeadZoneRadius", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "DeadZoneRadius", - "=", - "Value" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::SetDeadZone" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "Value", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "Force the joystick into the pressing state.", - "fullName": "Force start pressing", - "functionType": "Action", - "name": "ForceStartPressing", - "sentence": "Force start pressing _PARAM0_ with touch identifier: _PARAM2_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "Value" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - }, - { - "description": "Touch identifier", - "name": "Value", - "type": "expression" - } - ], - "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "1", - "type": "Number", - "label": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier" - }, - { - "value": "Primary", - "type": "String", - "label": "Joystick name", - "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": "0", - "type": "Number", - "label": "Joystick angle (range: -180 to 180)", - "hidden": true, - "name": "JoystickAngle" - }, - { - "value": "0", - "type": "Number", - "label": "Joystick force (range: 0 to 1)", - "hidden": true, - "name": "JoystickForce" - }, - { - "value": "0", - "type": "Number", - "label": "", - "hidden": true, - "name": "TouchId" - }, - { - "value": "", - "type": "Number", - "label": "", - "hidden": true, - "name": "TouchIndex" - } - ], - "sharedPropertyDescriptors": [] - }, - { - "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": "", - "eventsFunctions": [ - { - "fullName": "", - "functionType": "Action", - "name": "doStepPreEvents", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "IsReleased", - "True", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsReleased", - "False", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" - }, - "parameters": [ - "Object", - "Behavior", - "\"Idle\"", - "" - ] - } - ] - }, - { - "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": [ - { - "type": { - "inverted": true, - "value": "SpriteMultitouchJoystick::MultitouchButton::IsPressed" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - }, - { - "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": "BuiltinCommonInstructions::Or" - }, - "parameters": [], - "subInstructions": [ - { - "type": { - "value": "CollisionPoint" - }, - "parameters": [ - "Object", - "TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer())", - "TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer())" - ] - }, - { - "type": { - "value": "NumberVariable" - }, - "parameters": [ - "Radius", - ">", - "DistanceBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer()), TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer()))" - ] - } - ] - } - ], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "StartedTouchOrMouseId(TouchIndex)" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" - }, - "parameters": [ - "Object", - "Behavior", - "\"JustPressed\"", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "True", - "" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchIndex", - "+", - "1" - ] - } - ] - } - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::IsPressed" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - }, - { - "type": { - "value": "HasTouchEnded" - }, - "parameters": [ - "", - "TouchId" - ] - } - ], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" - }, - "parameters": [ - "Object", - "Behavior", - "\"Released\"", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsReleased", - "True", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "False", - "" - ] - }, - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "0" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "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", - "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", - "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": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", - "type": "behavior" - }, - { - "description": "Button state", - "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"JustPressed\",\"Pressed\",\"Released\"]", - "type": "stringWithSelector" - } - ], - "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "1", - "type": "Number", - "label": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier" - }, - { - "value": "A", - "type": "String", - "label": "Button identifier", - "name": "ButtonIdentifier" - }, - { - "value": "0", - "type": "Number", - "label": "TouchID", - "hidden": true, - "name": "TouchId" - }, - { - "value": "", - "type": "Number", - "label": "", - "hidden": true, - "name": "TouchIndex" - }, - { - "value": "", - "type": "Boolean", - "label": "Button released", - "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.", - "name": "Radius" - } - ], - "sharedPropertyDescriptors": [] - }, - { - "description": "Control a platformer character with a multitouch controller.", - "fullName": "Platformer multitouch controller mapper", - "name": "PlatformerMultitouchMapper", - "objectType": "", - "quickCustomizationVisibility": "hidden", - "eventsFunctions": [ - { - "fullName": "", - "functionType": "Action", - "name": "doStepPreEvents", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "\"Left\"", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateLeftKey" - }, - "parameters": [ - "Object", - "Property" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "\"Right\"", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateRightKey" - }, - "parameters": [ - "Object", - "Property" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "\"Up\"", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateUpKey" - }, - "parameters": [ - "Object", - "Property" - ] - }, - { - "type": { - "value": "PlatformBehavior::SimulateLadderKey" - }, - "parameters": [ - "Object", - "Property" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "\"Down\"", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateDownKey" - }, - "parameters": [ - "Object", - "Property" - ] - } - ] - }, + "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "conditions": [], + "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::IsButtonPressed" + "value": "SpriteMultitouchJoystick::SetDeadZone" }, "parameters": [ "", "ControllerIdentifier", - "JumpButton", - "\"Down\"" + "JoystickIdentifier", + "DeadZoneRadius", + "" ] - } - ], - "actions": [ + }, { "type": { - "value": "PlatformBehavior::SimulateJumpKey" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" }, "parameters": [ "Object", - "Property" + "Behavior", + "" ] } ] @@ -5109,64 +2613,50 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::PlatformerMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "", - "type": "Behavior", - "label": "Platform character behavior", - "extraInformation": [ - "PlatformBehavior::PlatformerObjectBehavior" - ], - "choices": [], - "name": "Property" - }, - { - "value": "1", - "type": "Number", - "label": "Controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier" }, { - "value": "Primary", - "type": "Choice", - "label": "Joystick name", - "group": "Controls", - "choices": [ + "fullName": "", + "functionType": "Action", + "name": "onDeActivate", + "sentence": "", + "events": [ { - "label": "Primary", - "value": "Primary" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" }, { - "label": "Secondary", - "value": "Secondary" + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } ], - "name": "JoystickIdentifier" + "objectGroups": [] }, - { - "value": "A", - "type": "String", - "label": "Jump button name", - "group": "Controls", - "name": "JumpButton" - } - ], - "sharedPropertyDescriptors": [] - }, - { - "description": "Control a 3D physics character with a multitouch controller.", - "fullName": "3D platformer multitouch controller mapper", - "name": "Platformer3DMultitouchMapper", - "objectType": "", - "quickCustomizationVisibility": "hidden", - "eventsFunctions": [ { "fullName": "", "functionType": "Action", @@ -5178,14 +2668,9 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::StickForce" + "value": "HasGameJustResumed" }, "parameters": [ - "", - ">", - "0", - "ControllerIdentifier", - "JoystickIdentifier", "" ] } @@ -5193,54 +2678,210 @@ "actions": [ { "type": { - "value": "Physics3D::PhysicsCharacter3D::SetForwardAngle" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" }, "parameters": [ "Object", - "PhysicsCharacter3D", - "=", - "SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier) + CameraAngle(Object.Layer())" + "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": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyTouchIndex" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "0" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "StartedTouchOrMouseCount()", + "conditions": [], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::PropertyTouchId" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "0" + ] + }, + { + "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": { - "value": "Physics3D::PhysicsCharacter3D::SimulateStick" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 }, - "parameters": [ - "Object", - "PhysicsCharacter3D", - "-90", - "SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier)" + "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" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } ] } - ] + ], + "parameters": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Update joystick position", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::IsButtonPressed" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JumpButton", - "\"Down\"" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::PropertyTouchId" + }, + "parameters": [ + "Object", + "Behavior", + "!=", + "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": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" - }, - "parameters": [ - "Object", - "PhysicsCharacter3D" - ] - } - ] + "parameters": [] } ], "parameters": [ @@ -5252,129 +2893,37 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::Platformer3DMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "", - "type": "Behavior", - "label": "3D physics character", - "extraInformation": [ - "Physics3D::PhysicsCharacter3D" - ], - "choices": [], - "name": "PhysicsCharacter3D" - }, - { - "value": "1", - "type": "Number", - "label": "Controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier" - }, - { - "value": "Primary", - "type": "Choice", - "label": "Walk joystick", - "group": "Controls", - "choices": [ - { - "label": "Primary", - "value": "Primary" - }, - { - "label": "Secondary", - "value": "Secondary" - } - ], - "name": "JoystickIdentifier" }, { - "value": "A", - "type": "String", - "label": "Jump button name", - "group": "Controls", - "name": "JumpButton" - } - ], - "sharedPropertyDescriptors": [] - }, - { - "description": "Control a 3D physics character with a multitouch controller.", - "fullName": "3D shooter multitouch controller mapper", - "name": "Shooter3DMultitouchMapper", - "objectType": "", - "quickCustomizationVisibility": "hidden", - "eventsFunctions": [ - { - "fullName": "", - "functionType": "Action", - "name": "doStepPreEvents", - "sentence": "", + "description": "the joystick force (from 0 to 1).", + "fullName": "Joystick force", + "functionType": "ExpressionAndCondition", + "name": "JoystickForce", + "sentence": "the joystick force", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::StickForce" - }, - "parameters": [ - "", - ">", - "0", - "ControllerIdentifier", - "JoystickIdentifier", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateStick" - }, - "parameters": [ - "Object", - "PhysicsCharacter3D", - "SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier)", - "SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier)" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::IsButtonPressed" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JumpButton", - "\"Down\"" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" + "value": "SetReturnNumber" }, "parameters": [ - "Object", - "PhysicsCharacter3D" + "max(0, JoystickForce - DeadZoneRadius) / (1 - DeadZoneRadius)" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -5384,151 +2933,90 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::Shooter3DMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "", - "type": "Behavior", - "label": "3D physics character", - "extraInformation": [ - "Physics3D::PhysicsCharacter3D" - ], - "choices": [], - "name": "PhysicsCharacter3D" - }, - { - "value": "1", - "type": "Number", - "label": "Controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier" - }, - { - "value": "Primary", - "type": "Choice", - "label": "Walk joystick", - "group": "Controls", - "choices": [ - { - "label": "Primary", - "value": "Primary" - }, - { - "label": "Secondary", - "value": "Secondary" - } - ], - "name": "JoystickIdentifier" }, - { - "value": "A", - "type": "String", - "label": "Jump button name", - "group": "Controls", - "name": "JumpButton" - } - ], - "sharedPropertyDescriptors": [] - }, - { - "description": "Control camera rotations with a multitouch controller.", - "fullName": "First person camera multitouch controller mapper", - "name": "FirstPersonMultitouchMapper", - "objectType": "", - "quickCustomizationVisibility": "hidden", - "eventsFunctions": [ { "fullName": "", - "functionType": "Action", - "name": "doStepPreEvents", + "functionType": "ActionWithOperator", + "getterName": "JoystickForce", + "name": "SetJoystickForce", + "private": true, "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", - "=", - "SpriteMultitouchJoystick::AcceleratedSpeed(CurrentRotationSpeedZ, SpriteMultitouchJoystick::StickForceX(ControllerIdentifier, CameraStick) * HorizontalRotationSpeedMax, HorizontalRotationSpeedMax, HorizontalRotationAcceleration, HorizontalRotationDeceleration)" - ] - }, - { - "type": { - "value": "SetAngle" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickForce" }, "parameters": [ "Object", - "+", - "CurrentRotationSpeedZ * TimeDelta()" - ] - }, - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "CurrentRotationSpeedY", + "Behavior", "=", - "SpriteMultitouchJoystick::AcceleratedSpeed(CurrentRotationSpeedY, SpriteMultitouchJoystick::StickForceY(ControllerIdentifier, CameraStick) * VerticalRotationSpeedMax, VerticalRotationSpeedMax, VerticalRotationAcceleration, VerticalRotationDeceleration)" - ] - }, - { - "type": { - "value": "Scene3D::Base3DBehavior::SetRotationY" - }, - "parameters": [ - "Object", - "Object3D", - "+", - "CurrentRotationSpeedY * TimeDelta()" + "Value" ] }, { "type": { - "value": "Scene3D::Base3DBehavior::SetRotationY" + "value": "SpriteMultitouchJoystick::SetJoystickForce" }, "parameters": [ - "Object", - "Object3D", - "=", - "clamp(Object.Object3D::RotationY(), VerticalAngleMin, VerticalAngleMax)" + "", + "ControllerIdentifier", + "JoystickIdentifier", + "JoystickForce", + "" ] - }, + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Return the angle the joystick is pointing towards (Range: -180 to 180).", + "fullName": "Joystick angle", + "functionType": "Expression", + "name": "JoystickAngle", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper::LookFromObjectEyes" + "value": "SetReturnNumber" }, "parameters": [ - "Object", - "Behavior", - "" + "JoystickAngle" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -5538,20 +3026,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "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", + "description": "Change the angle the joystick is pointing towards (Range: -180 to 180).", + "fullName": "Joystick angle", "functionType": "Action", - "group": "Layers and cameras", - "name": "LookFromObjectEyes", + "name": "SetJoystickAngle", "private": true, - "sentence": "Move the camera to look though _PARAM0_ eyes", + "sentence": "Change the joystick angle of _PARAM0_ to _PARAM2_", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -5559,61 +3046,24 @@ "actions": [ { "type": { - "value": "CentreCamera" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickAngle" }, "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": [ - "", + "Behavior", "=", - "Object.Object3D::RotationX()", - "GetArgumentAsString(\"Layer\")", - "" + "Value" ] }, { "type": { - "value": "SetCameraAngle" + "value": "SpriteMultitouchJoystick::SetJoystickAngle" }, "parameters": [ "", - "=", - "Object.Angle() + 90", - "Object.Layer()", + "ControllerIdentifier", + "JoystickIdentifier", + "JoystickAngle", "" ] } @@ -5629,19 +3079,23 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" + }, + { + "description": "Angle", + "name": "Value", + "type": "expression" } ], "objectGroups": [] }, { - "description": "the maximum horizontal rotation speed of the object.", - "fullName": "Maximum horizontal rotation speed", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper horizontal rotation configuration", - "name": "HorizontalRotationSpeedMax", - "sentence": "the maximum horizontal rotation speed", + "description": "Return the stick force on X axis (from -1 at the left to 1 at the right).", + "fullName": "Stick X force", + "functionType": "Expression", + "name": "StickForceX", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -5652,7 +3106,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "HorizontalRotationSpeedMax" + "Object.Behavior::JoystickForce() * cos(ToRad(Object.Behavior::JoystickAngle()))" ] } ] @@ -5670,17 +3124,17 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] }, { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "HorizontalRotationSpeedMax", - "name": "SetHorizontalRotationSpeedMax", + "description": "Return the stick force on Y axis (from -1 at the top to 1 at the bottom).", + "fullName": "Stick Y force", + "functionType": "Expression", + "name": "StickForceY", "sentence": "", "events": [ { @@ -5689,17 +3143,18 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SetReturnNumber" }, "parameters": [ - "HorizontalRotationSpeedMax", - "=", - "Value" + "Object.Behavior::JoystickForce() * sin(ToRad(Object.Behavior::JoystickAngle()))" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -5709,38 +3164,58 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the horizontal rotation acceleration of the object.", - "fullName": "Horizontal rotation acceleration", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper horizontal rotation configuration", - "name": "HorizontalRotationAcceleration", - "sentence": "the horizontal rotation acceleration", + "description": "Check if joystick is pushed in a given direction.", + "fullName": "Joystick pushed in a direction (4-way movement)", + "functionType": "Condition", + "name": "IsDirectionPushed4Way", + "sentence": "_PARAM0_ is pushed in direction _PARAM2_", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::JoystickForce" + }, + "parameters": [ + "Object", + "Behavior", + ">", + "0", + "" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::IsAngleIn4WayDirection" + }, + "parameters": [ + "", + "JoystickAngle", + "Direction", + "" + ] + } + ], "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "SetReturnBoolean" }, "parameters": [ - "HorizontalRotationAcceleration" + "True" ] } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -5750,31 +3225,59 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" + }, + { + "description": "Direction", + "name": "Direction", + "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\"]", + "type": "stringWithSelector" } ], "objectGroups": [] }, { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "HorizontalRotationAcceleration", - "name": "SetHorizontalRotationAcceleration", - "sentence": "", + "description": "Check if joystick is pushed in a given direction.", + "fullName": "Joystick pushed in a direction (8-way movement)", + "functionType": "Condition", + "name": "IsDirectionPushed8Way", + "sentence": "_PARAM0_ is pushed in direction _PARAM2_", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::JoystickForce" + }, + "parameters": [ + "Object", + "Behavior", + ">", + "0", + "" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::IsAngleIn8WayDirection" + }, + "parameters": [ + "", + "JoystickAngle", + "Direction", + "" + ] + } + ], "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SetReturnBoolean" }, "parameters": [ - "HorizontalRotationAcceleration", - "=", - "Value" + "True" ] } ] @@ -5789,38 +3292,52 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" + }, + { + "description": "Direction", + "name": "Direction", + "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\",\"UpLeft\",\"UpRight\",\"DownLeft\",\"DownRight\"]", + "type": "stringWithSelector" } ], "objectGroups": [] }, { - "description": "the horizontal rotation deceleration of the object.", - "fullName": "Horizontal rotation deceleration", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper horizontal rotation configuration", - "name": "HorizontalRotationDeceleration", - "sentence": "the horizontal rotation deceleration", + "description": "Check if a joystick is pressed.", + "fullName": "Joystick pressed", + "functionType": "Condition", + "name": "IsPressed", + "sentence": "Joystick _PARAM0_ is pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::PropertyTouchId" + }, + "parameters": [ + "Object", + "Behavior", + "!=", + "0" + ] + } + ], "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "SetReturnBoolean" }, "parameters": [ - "HorizontalRotationDeceleration" + "True" ] } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -5830,18 +3347,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] }, { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "HorizontalRotationDeceleration", - "name": "SetHorizontalRotationDeceleration", - "sentence": "", + "description": "Reset the joystick values (except for angle, which stays the same)", + "fullName": "Reset", + "functionType": "Action", + "name": "Reset", + "private": true, + "sentence": "Reset the joystick of _PARAM0_", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -5849,12 +3367,25 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" }, "parameters": [ - "HorizontalRotationDeceleration", + "Object", + "Behavior", "=", - "Value" + "0", + "" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyTouchId" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "0" ] } ] @@ -5869,19 +3400,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the maximum vertical rotation speed of the object.", - "fullName": "Maximum vertical rotation speed", + "description": "the multitouch controller identifier.", + "fullName": "Multitouch controller identifier", "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper vertical rotation configuration", - "name": "VerticalRotationSpeedMax", - "sentence": "the maximum vertical rotation speed", + "group": "Multitouch Joystick configuration", + "name": "ControllerIdentifier", + "sentence": "the multitouch controller identifier", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -5892,7 +3423,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "VerticalRotationSpeedMax" + "ControllerIdentifier" ] } ] @@ -5910,7 +3441,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], @@ -5919,8 +3450,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "VerticalRotationSpeedMax", - "name": "SetVerticalRotationSpeedMax", + "getterName": "ControllerIdentifier", + "name": "SetControllerIdentifier", "sentence": "", "events": [ { @@ -5929,10 +3460,11 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyControllerIdentifier" }, "parameters": [ - "VerticalRotationSpeedMax", + "Object", + "Behavior", "=", "Value" ] @@ -5949,19 +3481,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the vertical rotation acceleration of the object.", - "fullName": "Vertical rotation acceleration", + "description": "the joystick name.", + "fullName": "Joystick name", "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper vertical rotation configuration", - "name": "VerticalRotationAcceleration", - "sentence": "the vertical rotation acceleration", + "group": "Multitouch Joystick configuration", + "name": "JoystickIdentifier", + "sentence": "the joystick name", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -5969,17 +3501,17 @@ "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "SetReturnString" }, "parameters": [ - "VerticalRotationAcceleration" + "JoystickIdentifier" ] } ] } ], "expressionType": { - "type": "expression" + "type": "string" }, "parameters": [ { @@ -5990,7 +3522,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], @@ -5999,8 +3531,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "VerticalRotationAcceleration", - "name": "SetVerticalRotationAcceleration", + "getterName": "JoystickIdentifier", + "name": "SetJoystickIdentifier", "sentence": "", "events": [ { @@ -6009,10 +3541,11 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickIdentifier" }, "parameters": [ - "VerticalRotationAcceleration", + "Object", + "Behavior", "=", "Value" ] @@ -6029,19 +3562,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the vertical rotation deceleration of the object.", - "fullName": "Vertical rotation deceleration", + "description": "the dead zone radius (range: 0 to 1) of the joystick. 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).", + "fullName": "Dead zone radius", "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper vertical rotation configuration", - "name": "VerticalRotationDeceleration", - "sentence": "the vertical rotation deceleration", + "group": "Multitouch Joystick configuration", + "name": "DeadZoneRadius", + "sentence": "the dead zone radius", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -6052,7 +3585,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "VerticalRotationDeceleration" + "DeadZoneRadius" ] } ] @@ -6070,7 +3603,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], @@ -6079,8 +3612,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "VerticalRotationDeceleration", - "name": "SetVerticalRotationDeceleration", + "getterName": "DeadZoneRadius", + "name": "SetDeadZoneRadius", "sentence": "", "events": [ { @@ -6089,10 +3622,11 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyDeadZoneRadius" }, "parameters": [ - "VerticalRotationDeceleration", + "Object", + "Behavior", "=", "Value" ] @@ -6109,72 +3643,271 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] + } + ], + "propertyDescriptors": [ + { + "value": "1", + "type": "Number", + "label": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier" }, { - "description": "the minimum vertical camera angle of the object.", - "fullName": "Minimum vertical camera angle", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper vertical rotation configuration", - "name": "VerticalAngleMin", - "sentence": "the minimum vertical camera angle", + "value": "Primary", + "type": "String", + "label": "Joystick name", + "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": "0", + "type": "Number", + "label": "Joystick angle (range: -180 to 180)", + "hidden": true, + "name": "JoystickAngle" + }, + { + "value": "0", + "type": "Number", + "label": "Joystick force (range: 0 to 1)", + "hidden": true, + "name": "JoystickForce" + }, + { + "value": "0", + "type": "Number", + "label": "", + "hidden": true, + "name": "TouchId" + }, + { + "value": "", + "type": "Number", + "label": "", + "hidden": true, + "name": "TouchIndex" + } + ], + "sharedPropertyDescriptors": [] + }, + { + "description": "Detect button presses made on a touchscreen.", + "fullName": "Multitouch button", + "name": "MultitouchButton", + "objectType": "", + "eventsFunctions": [ + { + "fullName": "", + "functionType": "Action", + "name": "doStepPreEvents", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::IsReleased" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } + ], "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyIsReleased" + }, + "parameters": [ + "Object", + "Behavior", + "no" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" }, "parameters": [ - "VerticalAngleMin" + "Object", + "Behavior", + "\"Idle\"", + "" ] } ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" }, { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "VerticalAngleMin", - "name": "SetVerticalAngleMin", - "sentence": "", - "events": [ + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "SpriteMultitouchJoystick::MultitouchButton::IsPressed" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + }, + { + "type": { + "value": "HasAnyTouchOrMouseStarted" + }, + "parameters": [ + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchIndex" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "0" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "StartedTouchOrMouseCount()", + "conditions": [], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "CollisionPoint" + }, + "parameters": [ + "Object", + "TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)", + "TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchId" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "StartedTouchOrMouseId(TouchIndex)" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + }, + "parameters": [ + "Object", + "Behavior", + "\"Pressed\"", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchIndex" + }, + "parameters": [ + "Object", + "Behavior", + "+", + "1" + ] + } + ] + } + ] + } + ] + }, { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::IsPressed" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + }, + { + "type": { + "value": "HasTouchEnded" + }, + "parameters": [ + "", + "TouchId" + ] + } + ], "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + }, + "parameters": [ + "Object", + "Behavior", + "\"Released\"", + "" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyIsReleased" + }, + "parameters": [ + "Object", + "Behavior", + "yes" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchId" }, "parameters": [ - "VerticalAngleMin", + "Object", + "Behavior", "=", - "Value" + "0" ] } ] @@ -6189,72 +3922,39 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the maximum vertical camera angle of the object.", - "fullName": "Maximum vertical camera angle", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper vertical rotation configuration", - "name": "VerticalAngleMax", - "sentence": "the maximum vertical camera angle", + "description": "Check if button is released.", + "fullName": "Button released", + "functionType": "Condition", + "name": "IsReleased", + "sentence": "Button _PARAM0_ is released", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ + "conditions": [ { "type": { - "value": "SetReturnNumber" + "value": "SpriteMultitouchJoystick::MultitouchButton::PropertyIsReleased" }, "parameters": [ - "VerticalAngleMax" + "Object", + "Behavior" ] } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "VerticalAngleMax", - "name": "SetVerticalAngleMax", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + ], "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SetReturnBoolean" }, "parameters": [ - "VerticalAngleMax", - "=", - "Value" + "True" ] } ] @@ -6269,38 +3969,46 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the z position offset of the object.", - "fullName": "Z position offset", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper position configuration", - "name": "OffsetZ", - "sentence": "the z position offset", + "description": "Check if button is pressed.", + "fullName": "Button pressed", + "functionType": "Condition", + "name": "IsPressed", + "sentence": "Button _PARAM0_ is pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::PropertyTouchId" + }, + "parameters": [ + "Object", + "Behavior", + "!=", + "0" + ] + } + ], "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "SetReturnBoolean" }, "parameters": [ - "OffsetZ" + "True" ] } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -6310,18 +4018,18 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", "type": "behavior" } ], "objectGroups": [] }, { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "OffsetZ", - "name": "SetOffsetZ", - "sentence": "", + "fullName": "Button state", + "functionType": "Action", + "name": "SetButtonState", + "private": true, + "sentence": "Mark the button _PARAM0_ as _PARAM2_", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -6329,12 +4037,14 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::SetButtonState" }, "parameters": [ - "OffsetZ", - "=", - "Value" + "", + "ControllerIdentifier", + "ButtonIdentifier", + "ButtonState", + "" ] } ] @@ -6349,140 +4059,61 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", "type": "behavior" + }, + { + "description": "Button state", + "name": "ButtonState", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "type": "stringWithSelector" } ], "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...)", + "label": "Multitouch 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": "A", + "type": "String", + "label": "Button identifier", + "name": "ButtonIdentifier" }, { "value": "0", "type": "Number", - "unit": "Pixel", - "label": "Z position offset", - "group": "Position", - "name": "OffsetZ" + "label": "TouchID", + "hidden": true, + "name": "TouchId" }, { - "value": "0", + "value": "", "type": "Number", - "unit": "AngularSpeed", - "label": "Current rotation speed Z", + "label": "", "hidden": true, - "name": "CurrentRotationSpeedZ" + "name": "TouchIndex" }, { - "value": "0", - "type": "Number", - "unit": "AngularSpeed", - "label": "Current rotation speed Y", + "value": "", + "type": "Boolean", + "label": "Button released", "hidden": true, - "name": "CurrentRotationSpeedY" + "name": "IsReleased" } ], "sharedPropertyDescriptors": [] }, { - "description": "Control a 3D physics car with a multitouch controller.", - "fullName": "3D car multitouch controller mapper", - "name": "PhysicsCar3DMultitouchMapper", + "description": "Control a platformer character with a multitouch controller.", + "fullName": "Platformer multitouch controller mapper", + "name": "PlatformerMultitouchMapper", "objectType": "", - "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -6495,14 +4126,13 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::StickForce" + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" }, "parameters": [ "", - ">", - "0", "ControllerIdentifier", - "SteerJoystickIdentifier", + "JoystickIdentifier", + "\"Left\"", "" ] } @@ -6510,12 +4140,11 @@ "actions": [ { "type": { - "value": "Physics3D::PhysicsCar3D::SimulateSteeringStick" + "value": "PlatformBehavior::SimulateLeftKey" }, "parameters": [ "Object", - "PhysicsCar3D", - "SpriteMultitouchJoystick::StickForceX(ControllerIdentifier, \"Primary\")" + "Property" ] } ] @@ -6525,14 +4154,78 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::StickForce" + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JoystickIdentifier", + "\"Right\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "PlatformBehavior::SimulateRightKey" + }, + "parameters": [ + "Object", + "Property" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JoystickIdentifier", + "\"Up\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "PlatformBehavior::SimulateUpKey" + }, + "parameters": [ + "Object", + "Property" + ] + }, + { + "type": { + "value": "PlatformBehavior::SimulateLadderKey" + }, + "parameters": [ + "Object", + "Property" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" }, "parameters": [ "", - ">", - "0", "ControllerIdentifier", - "SpeedJoystickIdentifier", + "JoystickIdentifier", + "\"Down\"", "" ] } @@ -6540,12 +4233,11 @@ "actions": [ { "type": { - "value": "Physics3D::PhysicsCar3D::SimulateAcceleratorStick" + "value": "PlatformBehavior::SimulateDownKey" }, "parameters": [ "Object", - "PhysicsCar3D", - "-SpriteMultitouchJoystick::StickForceY(ControllerIdentifier, \"Secondary\")" + "Property" ] } ] @@ -6560,7 +4252,7 @@ "parameters": [ "", "ControllerIdentifier", - "HandBrakeButton", + "JumpButton", "\"Down\"" ] } @@ -6568,11 +4260,11 @@ "actions": [ { "type": { - "value": "Physics3D::PhysicsCar3D::SimulateHandBrakeKey" + "value": "PlatformBehavior::SimulateJumpKey" }, "parameters": [ "Object", - "PhysicsCar3D" + "Property" ] } ] @@ -6587,7 +4279,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::PhysicsCar3DMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::PlatformerMultitouchMapper", "type": "behavior" } ], @@ -6598,12 +4290,12 @@ { "value": "", "type": "Behavior", - "label": "3D physics car", + "label": "Platform character behavior", "extraInformation": [ - "Physics3D::PhysicsCar3D" + "PlatformBehavior::PlatformerObjectBehavior" ], "choices": [], - "name": "PhysicsCar3D" + "name": "Property" }, { "value": "1", @@ -6614,24 +4306,7 @@ { "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", + "label": "Joystick name", "group": "Controls", "choices": [ { @@ -6643,14 +4318,14 @@ "value": "Secondary" } ], - "name": "SpeedJoystickIdentifier" + "name": "JoystickIdentifier" }, { - "value": "B", + "value": "A", "type": "String", - "label": "Hand brake button name", + "label": "Jump button name", "group": "Controls", - "name": "HandBrakeButton" + "name": "JumpButton" } ], "sharedPropertyDescriptors": [] @@ -6660,7 +4335,6 @@ "fullName": "Top-down multitouch controller mapper", "name": "TopDownMultitouchMapper", "objectType": "", - "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -6673,10 +4347,11 @@ "conditions": [ { "type": { - "value": "StringVariable" + "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" }, "parameters": [ - "StickMode", + "Object", + "Behavior", "=", "\"Analog\"" ] @@ -6701,10 +4376,11 @@ "conditions": [ { "type": { - "value": "StringVariable" + "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" }, "parameters": [ - "StickMode", + "Object", + "Behavior", "=", "\"360°\"" ] @@ -6729,10 +4405,11 @@ "conditions": [ { "type": { - "value": "StringVariable" + "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" }, "parameters": [ - "StickMode", + "Object", + "Behavior", "=", "\"8 Directions\"" ] @@ -7341,6 +5018,7 @@ } ], "instances": [], + "editionSettings": {}, "eventsFunctions": [ { "fullName": "", @@ -7459,90 +5137,17 @@ "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "conditions": [], + "actions": [ { "type": { - "inverted": true, - "value": "SpriteMultitouchJoystick::IsInGameEdition" + "value": "MettreAutour" }, "parameters": [ - "", - "" - ] - } - ], - "actions": [], - "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" - }, - "parameters": [ - "Object", - "no", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "ShouldBeHiddenWhenReleased", - "False", - "" - ] - } + "Thumb", + "Border", + "Border.MultitouchJoystick::JoystickForce() * Border.Width() / 2", + "Border.MultitouchJoystick::JoystickAngle()" ] } ] @@ -7610,7 +5215,7 @@ "Border", "MultitouchJoystick", "=", - "ControllerIdentifier", + "Object.PropertyControllerIdentifier()", "" ] }, @@ -7622,7 +5227,7 @@ "Border", "MultitouchJoystick", "=", - "JoystickIdentifier", + "Object.PropertyJoystickIdentifier()", "" ] }, @@ -7634,92 +5239,7 @@ "Border", "MultitouchJoystick", "=", - "DeadZoneRadius", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "supplementaryInformation": "SpriteMultitouchJoystick::SpriteMultitouchJoystick", - "type": "object" - } - ], - "objectGroups": [] - }, - { - "description": "Show the joystick until it is released.", - "fullName": "Show and start pressing", - "functionType": "Action", - "name": "TeleportAndPress", - "sentence": "Show _PARAM0_ at the cursor position and start pressing", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "HasAnyTouchOrMouseStarted" - }, - "parameters": [ - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "MettreXY" - }, - "parameters": [ - "Object", - "=", - "Object.ParentTouchX(StartedTouchOrMouseId(0))", - "=", - "Object.ParentTouchY(StartedTouchOrMouseId(0))" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::ActivateControl" - }, - "parameters": [ - "Object", - "yes", - "" - ] - }, - { - "type": { - "value": "Montre" - }, - "parameters": [ - "Object", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "ShouldBeHiddenWhenReleased", - "True", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::ForceStartPressing" - }, - "parameters": [ - "Border", - "MultitouchJoystick", - "StartedTouchOrMouseId(0)", + "Object.PropertyDeadZoneRadius()", "" ] } @@ -7736,92 +5256,6 @@ ], "objectGroups": [] }, - { - "description": "Return the X position of a specified touch", - "fullName": "Touch X position (on parent)", - "functionType": "Expression", - "name": "ParentTouchX", - "private": true, - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [] - }, - { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "const object = objects[0];", - "const touchId = eventsFunctionContext.getArgument(\"TouchId\");", - "eventsFunctionContext.returnValue = gdjs.evtTools.input.getTouchX(object.getInstanceContainer(), touchId, object.getLayer());" - ], - "parameterObjects": "Object", - "useStrict": true, - "eventsSheetExpanded": false - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "supplementaryInformation": "SpriteMultitouchJoystick::SpriteMultitouchJoystick", - "type": "object" - }, - { - "description": "Touch identifier", - "name": "TouchId", - "type": "expression" - } - ], - "objectGroups": [] - }, - { - "description": "Return the X position of a specified touch", - "fullName": "Touch X position (on parent)", - "functionType": "Expression", - "name": "ParentTouchY", - "private": true, - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [] - }, - { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "const object = objects[0];", - "const touchId = eventsFunctionContext.getArgument(\"TouchId\");", - "eventsFunctionContext.returnValue = gdjs.evtTools.input.getTouchY(object.getInstanceContainer(), touchId, object.getLayer());" - ], - "parameterObjects": "Object", - "useStrict": true, - "eventsSheetExpanded": false - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "supplementaryInformation": "SpriteMultitouchJoystick::SpriteMultitouchJoystick", - "type": "object" - }, - { - "description": "Touch identifier", - "name": "TouchId", - "type": "expression" - } - ], - "objectGroups": [] - }, { "description": "De/activate control of the joystick.", "fullName": "De/activate control", @@ -7835,12 +5269,10 @@ { "type": { "inverted": true, - "value": "BooleanVariable" + "value": "GetArgumentAsBoolean" }, "parameters": [ - "ShouldActivate", - "True", - "" + "\"ShouldActivate\"" ] } ], @@ -7862,12 +5294,10 @@ "conditions": [ { "type": { - "value": "BooleanVariable" + "value": "GetArgumentAsBoolean" }, "parameters": [ - "ShouldActivate", - "True", - "" + "\"ShouldActivate\"" ] } ], @@ -8541,15 +5971,9 @@ "description": "Only used by the scene editor.", "hidden": true, "name": "ParentOrigin" - }, - { - "value": "", - "type": "Boolean", - "label": "", - "hidden": true, - "name": "ShouldBeHiddenWhenReleased" } - ] + ], + "variants": [] } ] }, diff --git a/examples/starting-vampire-survivor/starting-vampire-survivor.json b/examples/starting-vampire-survivor/starting-vampire-survivor.json index 43916c1e8..a0751e07b 100644 --- a/examples/starting-vampire-survivor/starting-vampire-survivor.json +++ b/examples/starting-vampire-survivor/starting-vampire-survivor.json @@ -1018,19 +1018,19 @@ "category": "Input", "extensionNamespace": "", "fullName": "Multitouch joystick and buttons (sprite)", - "gdevelopVersion": ">=5.5.222", + "gdevelopVersion": "", "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", + "version": "1.4.0", "description": [ - "Multitouch joysticks are objects showing a joystick on the screen, useful for mobile. They work like a physical gamepad:", + "Multitouch joysticks can be used the same way as physical gamepads:", "- 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.", + "- 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)." ], @@ -1095,33 +1095,108 @@ ], "eventsFunctions": [ { - "description": "Check if the events are running for the editor.", - "fullName": "Editor is running", + "description": "Check if a button is pressed on a gamepad.", + "fullName": "Multitouch controller button pressed", "functionType": "Condition", - "name": "IsInGameEdition", - "private": true, - "sentence": "Events are running for the editor", + "name": "IsButtonPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", "events": [ { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "const game = runtimeScene.getGame();\r", - "eventsFunctionContext.returnValue = game.isInGameEdition && game.isInGameEdition();" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"Pressed\"" + ] + } ], - "parameterObjects": "", - "useStrict": true, - "eventsSheetExpanded": false + "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" } ], - "parameters": [], "objectGroups": [] }, { - "fullName": "Accelerated speed", - "functionType": "Expression", - "name": "AcceleratedSpeed", + "description": "Check if a button is released on a gamepad.", + "fullName": "Multitouch controller button released", + "functionType": "Condition", + "name": "IsButtonReleased", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is released", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"Released\"" + ] + } + ], + "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": "Change a button state for a multitouch controller.", + "fullName": "Button state", + "functionType": "Action", + "name": "SetButtonState", "private": true, - "sentence": "", + "sentence": "Mark _PARAM2_ button as _PARAM3_ for multitouch controller _PARAM1_", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -1129,443 +1204,108 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SetStringVariable" }, "parameters": [ - "AcceleratedSpeed", + "Controllers[ControllerIdentifier].Buttons[Button].State", "=", - "CurrentSpeed" + "ButtonState" ] } - ], - "events": [ + ] + } + ], + "parameters": [ + { + "description": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier", + "type": "expression" + }, + { + "description": "Button name", + "name": "Button", + "type": "string" + }, + { + "description": "Button state", + "name": "ButtonState", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "type": "stringWithSelector" + } + ], + "objectGroups": [] + }, + { + "description": "Change the dead zone radius of a joystick. 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).", + "fullName": "Dead zone radius", + "functionType": "Action", + "name": "SetDeadZone", + "private": true, + "sentence": "Change the dead zone of multitouch joystick _PARAM2_ of multitouch controller _PARAM1_ to _PARAM3_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ { - "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", - "=", - "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": { + "value": "SetNumberVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].DeadZone", + "=", + "DeadZoneRadius" ] - }, - { - "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": "NumberVariable" - }, - "parameters": [ - "TargetedSpeed", - "=", - "0" - ] - } - ], - "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", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "clamp(AcceleratedSpeed, -SpeedMax, SpeedMax)" - ] - } - ] - } - ], - "variables": [ - { - "name": "AcceleratedSpeed", - "type": "number", - "value": 0 } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { - "description": "Current speed", - "name": "CurrentSpeed", - "type": "expression" - }, - { - "description": "Targeted speed", - "name": "TargetedSpeed", - "type": "expression" - }, - { - "description": "Max speed", - "name": "SpeedMax", + "description": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier", "type": "expression" }, { - "description": "Acceleration", - "name": "Acceleration", - "type": "expression" + "description": "Joystick name", + "name": "JoystickIdentifier", + "type": "string" }, { - "description": "Deceleration", - "name": "Deceleration", + "description": "Dead zone radius", + "name": "DeadZoneRadius", + "supplementaryInformation": "[]", "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", + "description": "Return the dead zone radius of a joystick. 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).", + "fullName": "Dead zone radius", + "functionType": "Expression", + "name": "DeadZone", + "private": true, + "sentence": "Change multitouch joystick _PARAM2_ of multitouch controller _PARAM1_ dead zone to _PARAM3_", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Buttons[Button].State", - "=", - "\"JustPressed\"" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "SetReturnBoolean" + "value": "SetReturnNumber" }, "parameters": [ - "True" + "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].DeadZone" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Multitouch controller identifier (1, 2, 3, 4...)", @@ -1573,265 +1313,20 @@ "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\"]", + "description": "Joystick name", + "name": "JoystickIdentifier", "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\"" - ] - } - ] - } - ], - "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", - "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is released", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Buttons[Button].State", - "=", - "\"Released\"" - ] - } - ], - "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": "Change a button state for a multitouch controller.", - "fullName": "Button state", - "functionType": "Action", - "name": "SetButtonState", - "private": true, - "sentence": "Mark _PARAM2_ button as _PARAM3_ for multitouch controller _PARAM1_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetStringVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Buttons[Button].State", - "=", - "ButtonState" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" - }, - { - "description": "Button name", - "name": "Button", - "type": "string" - }, - { - "description": "Button state", - "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"JustPressed\",\"Released\"]", - "type": "stringWithSelector" - } - ], - "objectGroups": [] - }, - { - "description": "Change the dead zone radius of a joystick. 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).", - "fullName": "Dead zone radius", - "functionType": "Action", - "name": "SetDeadZone", - "private": true, - "sentence": "Change the dead zone of multitouch joystick _PARAM2_ of multitouch controller _PARAM1_ to _PARAM3_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].DeadZone", - "=", - "DeadZoneRadius" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" - }, - { - "description": "Joystick name", - "name": "JoystickIdentifier", - "type": "string" - }, - { - "description": "Dead zone radius", - "name": "DeadZoneRadius", - "supplementaryInformation": "[]", - "type": "expression" - } - ], - "objectGroups": [] - }, - { - "description": "Return the dead zone radius of a joystick. 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).", - "fullName": "Dead zone radius", - "functionType": "Expression", - "name": "DeadZone", - "private": true, - "sentence": "Change multitouch joystick _PARAM2_ of multitouch controller _PARAM1_ dead zone to _PARAM3_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].DeadZone" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" - }, - { - "description": "Joystick name", - "name": "JoystickIdentifier", - "type": "string" - } - ], - "objectGroups": [] - }, - { - "description": "the direction index (left = 1, bottom = 1, right = 2, top = 3) for an angle (in degrees).", - "fullName": "Angle to 4-way index", - "functionType": "ExpressionAndCondition", - "name": "AngleTo4Way", - "private": true, - "sentence": "The angle _PARAM1_ 4-way index", + "description": "the direction index (left = 1, bottom = 1, right = 2, top = 3) for an angle (in degrees).", + "fullName": "Angle to 4-way index", + "functionType": "ExpressionAndCondition", + "name": "AngleTo4Way", + "private": true, + "sentence": "The angle _PARAM1_ 4-way index", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -2584,11 +2079,6 @@ "name": "JoystickIdentifier", "supplementaryInformation": "[\"Primary\",\"Secondary\"]", "type": "stringWithSelector" - }, - { - "description": "", - "name": "Coucou", - "type": "expression" } ], "objectGroups": [] @@ -2818,7 +2308,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "XFromAngleAndDistance(SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier), SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier))" + "SpriteMultitouchJoystick::JoystickForce(ControllerIdentifier, JoystickIdentifier) * cos(ToRad(SpriteMultitouchJoystick::JoystickAngle(ControllerIdentifier, JoystickIdentifier)))" ] } ] @@ -2858,7 +2348,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "YFromAngleAndDistance(SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier), SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier))" + "SpriteMultitouchJoystick::JoystickForce(ControllerIdentifier, JoystickIdentifier) * sin(ToRad(SpriteMultitouchJoystick::JoystickAngle(ControllerIdentifier, JoystickIdentifier)))" ] } ] @@ -2881,139 +2371,22 @@ } ], "objectGroups": [] - }, + } + ], + "eventsBasedBehaviors": [ { - "description": "Check if a new touch has started on the right or left side of the screen.", - "fullName": "New touch on a screen side", - "functionType": "Condition", - "group": "Multitouch Joystick", - "name": "HasTouchStartedOnScreenSide", - "sentence": "A new touch has started on the _PARAM2_ side of the screen on _PARAM1_'s layer", - "events": [ + "description": "Joystick that can be controlled by interacting with a touchscreen.", + "fullName": "Multitouch Joystick", + "name": "MultitouchJoystick", + "objectType": "", + "private": true, + "eventsFunctions": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "HasAnyTouchOrMouseStarted" - }, - "parameters": [ - "" - ] - } - ], - "actions": [], - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "Side", - "=", - "\"Left\"" - ] - }, - { - "type": { - "value": "TouchX" - }, - "parameters": [ - "", - "StartedTouchOrMouseId(0)", - "<", - "CameraCenterX(Object.Layer())", - "Object.Layer()", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "Side", - "=", - "\"Right\"" - ] - }, - { - "type": { - "value": "TouchX" - }, - "parameters": [ - "", - "StartedTouchOrMouseId(0)", - ">=", - "CameraCenterX(Object.Layer())", - "Object.Layer()", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - } - ] - } - ], - "parameters": [ - { - "description": "Multitouch joystick", - "name": "Object", - "supplementaryInformation": "SpriteMultitouchJoystick::SpriteMultitouchJoystick", - "type": "objectList" - }, - { - "description": "Screen side", - "name": "Side", - "supplementaryInformation": "[\"Left\",\"Right\"]", - "type": "stringWithSelector" - } - ], - "objectGroups": [] - } - ], - "eventsBasedBehaviors": [ - { - "description": "Joystick that can be controlled by interacting with a touchscreen.", - "fullName": "Multitouch Joystick", - "name": "MultitouchJoystick", - "objectType": "", - "private": true, - "eventsFunctions": [ - { - "fullName": "", - "functionType": "Action", - "name": "onCreated", - "sentence": "", - "events": [ + "fullName": "", + "functionType": "Action", + "name": "onCreated", + "sentence": "", + "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [], @@ -3059,1854 +2432,23 @@ "objectGroups": [] }, { - "fullName": "", - "functionType": "Action", - "name": "onDeActivate", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "Action", - "name": "doStepPreEvents", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "inverted": true, - "value": "SpriteMultitouchJoystick::IsInGameEdition" - }, - "parameters": [ - "", - "" - ] - } - ], - "actions": [], - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "HasGameJustResumed" - }, - "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)" - }, - { - "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": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "the joystick force (from 0 to 1).", - "fullName": "Joystick force", - "functionType": "ExpressionAndCondition", - "name": "JoystickForce", - "sentence": "the joystick force", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "max(0, JoystickForce - DeadZoneRadius) / (1 - DeadZoneRadius)" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "JoystickForce", - "name": "SetJoystickForce", - "private": true, - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "JoystickForce", - "=", - "Value" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::SetJoystickForce" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "JoystickForce", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - }, - { - "description": "", - "name": "Parameter", - "type": "objectList" - } - ], - "objectGroups": [] - }, - { - "description": "Return the angle the joystick is pointing towards (Range: -180 to 180).", - "fullName": "Joystick angle", - "functionType": "Expression", - "name": "JoystickAngle", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "JoystickAngle" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "Change the angle the joystick is pointing towards (Range: -180 to 180).", - "fullName": "Joystick angle", - "functionType": "Action", - "name": "SetJoystickAngle", - "private": true, - "sentence": "Change the joystick angle of _PARAM0_ to _PARAM2_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "JoystickAngle", - "=", - "Value" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::SetJoystickAngle" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "JoystickAngle", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - }, - { - "description": "Angle", - "name": "Value", - "type": "expression" - } - ], - "objectGroups": [] - }, - { - "description": "Return the stick force on X axis (from -1 at the left to 1 at the right).", - "fullName": "Stick X force", - "functionType": "Expression", - "name": "StickForceX", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "Object.Behavior::JoystickForce() * cos(ToRad(Object.Behavior::JoystickAngle()))" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "Return the stick force on Y axis (from -1 at the top to 1 at the bottom).", - "fullName": "Stick Y force", - "functionType": "Expression", - "name": "StickForceY", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "Object.Behavior::JoystickForce() * sin(ToRad(Object.Behavior::JoystickAngle()))" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "Check if joystick is pushed in a given direction.", - "fullName": "Joystick pushed in a direction (4-way movement)", - "functionType": "Condition", - "name": "IsDirectionPushed4Way", - "sentence": "_PARAM0_ is pushed in direction _PARAM2_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::JoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - ">", - "0", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::IsAngleIn4WayDirection" - }, - "parameters": [ - "", - "JoystickAngle", - "Direction", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - }, - { - "description": "Direction", - "name": "Direction", - "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\"]", - "type": "stringWithSelector" - } - ], - "objectGroups": [] - }, - { - "description": "Check if joystick is pushed in a given direction.", - "fullName": "Joystick pushed in a direction (8-way movement)", - "functionType": "Condition", - "name": "IsDirectionPushed8Way", - "sentence": "_PARAM0_ is pushed in direction _PARAM2_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::JoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - ">", - "0", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::IsAngleIn8WayDirection" - }, - "parameters": [ - "", - "JoystickAngle", - "Direction", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - }, - { - "description": "Direction", - "name": "Direction", - "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\",\"UpLeft\",\"UpRight\",\"DownLeft\",\"DownRight\"]", - "type": "stringWithSelector" - } - ], - "objectGroups": [] - }, - { - "description": "Check if a joystick is pressed.", - "fullName": "Joystick pressed", - "functionType": "Condition", - "name": "IsPressed", - "sentence": "Joystick _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::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "Reset the joystick values (except for angle, which stays the same)", - "fullName": "Reset", - "functionType": "Action", - "name": "Reset", - "private": true, - "sentence": "Reset the joystick of _PARAM0_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "0", - "" - ] - }, - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "0" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "the multitouch controller identifier.", - "fullName": "Multitouch controller identifier", - "functionType": "ExpressionAndCondition", - "group": "Multitouch Joystick configuration", - "name": "ControllerIdentifier", - "sentence": "the multitouch controller identifier", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "ControllerIdentifier" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "ControllerIdentifier", - "name": "SetControllerIdentifier", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "ControllerIdentifier", - "=", - "Value" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "the joystick name.", - "fullName": "Joystick name", - "functionType": "ExpressionAndCondition", - "group": "Multitouch Joystick configuration", - "name": "JoystickIdentifier", - "sentence": "the joystick name", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnString" - }, - "parameters": [ - "JoystickIdentifier" - ] - } - ] - } - ], - "expressionType": { - "type": "string" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "JoystickIdentifier", - "name": "SetJoystickIdentifier", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetStringVariable" - }, - "parameters": [ - "JoystickIdentifier", - "=", - "Value" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "the dead zone radius (range: 0 to 1) of the joystick. 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).", - "fullName": "Dead zone radius", - "functionType": "ExpressionAndCondition", - "group": "Multitouch Joystick configuration", - "name": "DeadZoneRadius", - "sentence": "the dead zone radius", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "DeadZoneRadius" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "DeadZoneRadius", - "name": "SetDeadZoneRadius", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "DeadZoneRadius", - "=", - "Value" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::SetDeadZone" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "Value", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "description": "Force the joystick into the pressing state.", - "fullName": "Force start pressing", - "functionType": "Action", - "name": "ForceStartPressing", - "sentence": "Force start pressing _PARAM0_ with touch identifier: _PARAM2_", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "Value" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - }, - { - "description": "Touch identifier", - "name": "Value", - "type": "expression" - } - ], - "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "1", - "type": "Number", - "label": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier" - }, - { - "value": "Primary", - "type": "String", - "label": "Joystick name", - "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": "0", - "type": "Number", - "label": "Joystick angle (range: -180 to 180)", - "hidden": true, - "name": "JoystickAngle" - }, - { - "value": "0", - "type": "Number", - "label": "Joystick force (range: 0 to 1)", - "hidden": true, - "name": "JoystickForce" - }, - { - "value": "0", - "type": "Number", - "label": "", - "hidden": true, - "name": "TouchId" - }, - { - "value": "", - "type": "Number", - "label": "", - "hidden": true, - "name": "TouchIndex" - } - ], - "sharedPropertyDescriptors": [] - }, - { - "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": "", - "eventsFunctions": [ - { - "fullName": "", - "functionType": "Action", - "name": "doStepPreEvents", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "IsReleased", - "True", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsReleased", - "False", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" - }, - "parameters": [ - "Object", - "Behavior", - "\"Idle\"", - "" - ] - } - ] - }, - { - "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": [ - { - "type": { - "inverted": true, - "value": "SpriteMultitouchJoystick::MultitouchButton::IsPressed" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - }, - { - "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": "BuiltinCommonInstructions::Or" - }, - "parameters": [], - "subInstructions": [ - { - "type": { - "value": "CollisionPoint" - }, - "parameters": [ - "Object", - "TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer())", - "TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer())" - ] - }, - { - "type": { - "value": "NumberVariable" - }, - "parameters": [ - "Radius", - ">", - "DistanceBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer()), TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer()))" - ] - } - ] - } - ], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "StartedTouchOrMouseId(TouchIndex)" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" - }, - "parameters": [ - "Object", - "Behavior", - "\"JustPressed\"", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "True", - "" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchIndex", - "+", - "1" - ] - } - ] - } - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::IsPressed" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - }, - { - "type": { - "value": "HasTouchEnded" - }, - "parameters": [ - "", - "TouchId" - ] - } - ], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" - }, - "parameters": [ - "Object", - "Behavior", - "\"Released\"", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsReleased", - "True", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "False", - "" - ] - }, - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "0" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "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", - "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", - "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": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", - "type": "behavior" - }, - { - "description": "Button state", - "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"JustPressed\",\"Pressed\",\"Released\"]", - "type": "stringWithSelector" - } - ], - "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "1", - "type": "Number", - "label": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier" - }, - { - "value": "A", - "type": "String", - "label": "Button identifier", - "name": "ButtonIdentifier" - }, - { - "value": "0", - "type": "Number", - "label": "TouchID", - "hidden": true, - "name": "TouchId" - }, - { - "value": "", - "type": "Number", - "label": "", - "hidden": true, - "name": "TouchIndex" - }, - { - "value": "", - "type": "Boolean", - "label": "Button released", - "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.", - "name": "Radius" - } - ], - "sharedPropertyDescriptors": [] - }, - { - "description": "Control a platformer character with a multitouch controller.", - "fullName": "Platformer multitouch controller mapper", - "name": "PlatformerMultitouchMapper", - "objectType": "", - "quickCustomizationVisibility": "hidden", - "eventsFunctions": [ - { - "fullName": "", - "functionType": "Action", - "name": "doStepPreEvents", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "\"Left\"", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateLeftKey" - }, - "parameters": [ - "Object", - "Property" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "\"Right\"", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateRightKey" - }, - "parameters": [ - "Object", - "Property" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "\"Up\"", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateUpKey" - }, - "parameters": [ - "Object", - "Property" - ] - }, - { - "type": { - "value": "PlatformBehavior::SimulateLadderKey" - }, - "parameters": [ - "Object", - "Property" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "\"Down\"", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateDownKey" - }, - "parameters": [ - "Object", - "Property" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::IsButtonPressed" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JumpButton", - "\"Down\"" - ] - } - ], + "fullName": "", + "functionType": "Action", + "name": "onDeActivate", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], "actions": [ { "type": { - "value": "PlatformBehavior::SimulateJumpKey" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" }, "parameters": [ "Object", - "Property" + "Behavior", + "" ] } ] @@ -4921,64 +2463,12 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::PlatformerMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "", - "type": "Behavior", - "label": "Platform character behavior", - "extraInformation": [ - "PlatformBehavior::PlatformerObjectBehavior" - ], - "choices": [], - "name": "Property" - }, - { - "value": "1", - "type": "Number", - "label": "Controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier" }, - { - "value": "Primary", - "type": "Choice", - "label": "Joystick name", - "group": "Controls", - "choices": [ - { - "label": "Primary", - "value": "Primary" - }, - { - "label": "Secondary", - "value": "Secondary" - } - ], - "name": "JoystickIdentifier" - }, - { - "value": "A", - "type": "String", - "label": "Jump button name", - "group": "Controls", - "name": "JumpButton" - } - ], - "sharedPropertyDescriptors": [] - }, - { - "description": "Control a 3D physics character with a multitouch controller.", - "fullName": "3D platformer multitouch controller mapper", - "name": "Platformer3DMultitouchMapper", - "objectType": "", - "quickCustomizationVisibility": "hidden", - "eventsFunctions": [ { "fullName": "", "functionType": "Action", @@ -4990,14 +2480,9 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::StickForce" + "value": "HasGameJustResumed" }, "parameters": [ - "", - ">", - "0", - "ControllerIdentifier", - "JoystickIdentifier", "" ] } @@ -5005,56 +2490,252 @@ "actions": [ { "type": { - "value": "Physics3D::PhysicsCharacter3D::SetForwardAngle" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" }, "parameters": [ "Object", - "PhysicsCharacter3D", - "=", - "SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier) + CameraAngle(Object.Layer())" + "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": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyTouchIndex" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "0" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "StartedTouchOrMouseCount()", + "conditions": [], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::PropertyTouchId" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "0" + ] + }, + { + "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": { - "value": "Physics3D::PhysicsCharacter3D::SimulateStick" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 }, - "parameters": [ - "Object", - "PhysicsCharacter3D", - "-90", - "SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier)" + "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" + }, + "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": "SpriteMultitouchJoystick::MultitouchJoystick::PropertyTouchId" + }, + "parameters": [ + "Object", + "Behavior", + "!=", + "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": [ + { + "description": "Object", + "name": "Object", + "type": "object" }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "the joystick force (from 0 to 1).", + "fullName": "Joystick force", + "functionType": "ExpressionAndCondition", + "name": "JoystickForce", + "sentence": "the joystick force", + "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::IsButtonPressed" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JumpButton", - "\"Down\"" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" + "value": "SetReturnNumber" }, "parameters": [ - "Object", - "PhysicsCharacter3D" + "max(0, JoystickForce - DeadZoneRadius) / (1 - DeadZoneRadius)" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -5064,124 +2745,45 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::Platformer3DMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "", - "type": "Behavior", - "label": "3D physics character", - "extraInformation": [ - "Physics3D::PhysicsCharacter3D" - ], - "choices": [], - "name": "PhysicsCharacter3D" - }, - { - "value": "1", - "type": "Number", - "label": "Controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier" - }, - { - "value": "Primary", - "type": "Choice", - "label": "Walk joystick", - "group": "Controls", - "choices": [ - { - "label": "Primary", - "value": "Primary" - }, - { - "label": "Secondary", - "value": "Secondary" - } - ], - "name": "JoystickIdentifier" }, - { - "value": "A", - "type": "String", - "label": "Jump button name", - "group": "Controls", - "name": "JumpButton" - } - ], - "sharedPropertyDescriptors": [] - }, - { - "description": "Control a 3D physics character with a multitouch controller.", - "fullName": "3D shooter multitouch controller mapper", - "name": "Shooter3DMultitouchMapper", - "objectType": "", - "quickCustomizationVisibility": "hidden", - "eventsFunctions": [ { "fullName": "", - "functionType": "Action", - "name": "doStepPreEvents", + "functionType": "ActionWithOperator", + "getterName": "JoystickForce", + "name": "SetJoystickForce", + "private": true, "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::StickForce" - }, - "parameters": [ - "", - ">", - "0", - "ControllerIdentifier", - "JoystickIdentifier", - "" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateStick" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickForce" }, "parameters": [ "Object", - "PhysicsCharacter3D", - "SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier)", - "SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier)" + "Behavior", + "=", + "Value" ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + }, { "type": { - "value": "SpriteMultitouchJoystick::IsButtonPressed" + "value": "SpriteMultitouchJoystick::SetJoystickForce" }, "parameters": [ "", "ControllerIdentifier", - "JumpButton", - "\"Down\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" - }, - "parameters": [ - "Object", - "PhysicsCharacter3D" + "JoystickIdentifier", + "JoystickForce", + "" ] } ] @@ -5196,151 +2798,37 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::Shooter3DMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "", - "type": "Behavior", - "label": "3D physics character", - "extraInformation": [ - "Physics3D::PhysicsCharacter3D" - ], - "choices": [], - "name": "PhysicsCharacter3D" - }, - { - "value": "1", - "type": "Number", - "label": "Controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier" - }, - { - "value": "Primary", - "type": "Choice", - "label": "Walk joystick", - "group": "Controls", - "choices": [ - { - "label": "Primary", - "value": "Primary" - }, - { - "label": "Secondary", - "value": "Secondary" - } - ], - "name": "JoystickIdentifier" }, { - "value": "A", - "type": "String", - "label": "Jump button name", - "group": "Controls", - "name": "JumpButton" - } - ], - "sharedPropertyDescriptors": [] - }, - { - "description": "Control camera rotations with a multitouch controller.", - "fullName": "First person camera multitouch controller mapper", - "name": "FirstPersonMultitouchMapper", - "objectType": "", - "quickCustomizationVisibility": "hidden", - "eventsFunctions": [ - { - "fullName": "", - "functionType": "Action", - "name": "doStepPreEvents", + "description": "Return the angle the joystick is pointing towards (Range: -180 to 180).", + "fullName": "Joystick angle", + "functionType": "Expression", + "name": "JoystickAngle", "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", - "=", - "SpriteMultitouchJoystick::AcceleratedSpeed(CurrentRotationSpeedZ, SpriteMultitouchJoystick::StickForceX(ControllerIdentifier, CameraStick) * HorizontalRotationSpeedMax, HorizontalRotationSpeedMax, HorizontalRotationAcceleration, HorizontalRotationDeceleration)" - ] - }, - { - "type": { - "value": "SetAngle" - }, - "parameters": [ - "Object", - "+", - "CurrentRotationSpeedZ * TimeDelta()" - ] - }, - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "CurrentRotationSpeedY", - "=", - "SpriteMultitouchJoystick::AcceleratedSpeed(CurrentRotationSpeedY, SpriteMultitouchJoystick::StickForceY(ControllerIdentifier, 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": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper::LookFromObjectEyes" + "value": "SetReturnNumber" }, "parameters": [ - "Object", - "Behavior", - "" + "JoystickAngle" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -5350,20 +2838,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "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", + "description": "Change the angle the joystick is pointing towards (Range: -180 to 180).", + "fullName": "Joystick angle", "functionType": "Action", - "group": "Layers and cameras", - "name": "LookFromObjectEyes", + "name": "SetJoystickAngle", "private": true, - "sentence": "Move the camera to look though _PARAM0_ eyes", + "sentence": "Change the joystick angle of _PARAM0_ to _PARAM2_", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -5371,61 +2858,24 @@ "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" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickAngle" }, "parameters": [ - "", + "Object", + "Behavior", "=", - "Object.Object3D::RotationX()", - "GetArgumentAsString(\"Layer\")", - "" + "Value" ] }, { "type": { - "value": "SetCameraAngle" + "value": "SpriteMultitouchJoystick::SetJoystickAngle" }, "parameters": [ "", - "=", - "Object.Angle() + 90", - "Object.Layer()", + "ControllerIdentifier", + "JoystickIdentifier", + "JoystickAngle", "" ] } @@ -5441,19 +2891,23 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" + }, + { + "description": "Angle", + "name": "Value", + "type": "expression" } ], "objectGroups": [] }, { - "description": "the maximum horizontal rotation speed of the object.", - "fullName": "Maximum horizontal rotation speed", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper horizontal rotation configuration", - "name": "HorizontalRotationSpeedMax", - "sentence": "the maximum horizontal rotation speed", + "description": "Return the stick force on X axis (from -1 at the left to 1 at the right).", + "fullName": "Stick X force", + "functionType": "Expression", + "name": "StickForceX", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -5464,7 +2918,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "HorizontalRotationSpeedMax" + "Object.Behavior::JoystickForce() * cos(ToRad(Object.Behavior::JoystickAngle()))" ] } ] @@ -5482,17 +2936,17 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] }, { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "HorizontalRotationSpeedMax", - "name": "SetHorizontalRotationSpeedMax", + "description": "Return the stick force on Y axis (from -1 at the top to 1 at the bottom).", + "fullName": "Stick Y force", + "functionType": "Expression", + "name": "StickForceY", "sentence": "", "events": [ { @@ -5501,17 +2955,18 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SetReturnNumber" }, "parameters": [ - "HorizontalRotationSpeedMax", - "=", - "Value" + "Object.Behavior::JoystickForce() * sin(ToRad(Object.Behavior::JoystickAngle()))" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -5521,38 +2976,58 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the horizontal rotation acceleration of the object.", - "fullName": "Horizontal rotation acceleration", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper horizontal rotation configuration", - "name": "HorizontalRotationAcceleration", - "sentence": "the horizontal rotation acceleration", + "description": "Check if joystick is pushed in a given direction.", + "fullName": "Joystick pushed in a direction (4-way movement)", + "functionType": "Condition", + "name": "IsDirectionPushed4Way", + "sentence": "_PARAM0_ is pushed in direction _PARAM2_", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::JoystickForce" + }, + "parameters": [ + "Object", + "Behavior", + ">", + "0", + "" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::IsAngleIn4WayDirection" + }, + "parameters": [ + "", + "JoystickAngle", + "Direction", + "" + ] + } + ], "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "SetReturnBoolean" }, "parameters": [ - "HorizontalRotationAcceleration" + "True" ] } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -5562,31 +3037,59 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" + }, + { + "description": "Direction", + "name": "Direction", + "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\"]", + "type": "stringWithSelector" } ], "objectGroups": [] }, { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "HorizontalRotationAcceleration", - "name": "SetHorizontalRotationAcceleration", - "sentence": "", + "description": "Check if joystick is pushed in a given direction.", + "fullName": "Joystick pushed in a direction (8-way movement)", + "functionType": "Condition", + "name": "IsDirectionPushed8Way", + "sentence": "_PARAM0_ is pushed in direction _PARAM2_", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::JoystickForce" + }, + "parameters": [ + "Object", + "Behavior", + ">", + "0", + "" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::IsAngleIn8WayDirection" + }, + "parameters": [ + "", + "JoystickAngle", + "Direction", + "" + ] + } + ], "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SetReturnBoolean" }, "parameters": [ - "HorizontalRotationAcceleration", - "=", - "Value" + "True" ] } ] @@ -5601,38 +3104,52 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" + }, + { + "description": "Direction", + "name": "Direction", + "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\",\"UpLeft\",\"UpRight\",\"DownLeft\",\"DownRight\"]", + "type": "stringWithSelector" } ], "objectGroups": [] }, { - "description": "the horizontal rotation deceleration of the object.", - "fullName": "Horizontal rotation deceleration", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper horizontal rotation configuration", - "name": "HorizontalRotationDeceleration", - "sentence": "the horizontal rotation deceleration", + "description": "Check if a joystick is pressed.", + "fullName": "Joystick pressed", + "functionType": "Condition", + "name": "IsPressed", + "sentence": "Joystick _PARAM0_ is pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::PropertyTouchId" + }, + "parameters": [ + "Object", + "Behavior", + "!=", + "0" + ] + } + ], "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "SetReturnBoolean" }, "parameters": [ - "HorizontalRotationDeceleration" + "True" ] } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -5642,18 +3159,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] }, { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "HorizontalRotationDeceleration", - "name": "SetHorizontalRotationDeceleration", - "sentence": "", + "description": "Reset the joystick values (except for angle, which stays the same)", + "fullName": "Reset", + "functionType": "Action", + "name": "Reset", + "private": true, + "sentence": "Reset the joystick of _PARAM0_", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -5661,12 +3179,25 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" }, "parameters": [ - "HorizontalRotationDeceleration", + "Object", + "Behavior", "=", - "Value" + "0", + "" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyTouchId" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "0" ] } ] @@ -5681,19 +3212,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the maximum vertical rotation speed of the object.", - "fullName": "Maximum vertical rotation speed", + "description": "the multitouch controller identifier.", + "fullName": "Multitouch controller identifier", "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper vertical rotation configuration", - "name": "VerticalRotationSpeedMax", - "sentence": "the maximum vertical rotation speed", + "group": "Multitouch Joystick configuration", + "name": "ControllerIdentifier", + "sentence": "the multitouch controller identifier", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -5704,7 +3235,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "VerticalRotationSpeedMax" + "ControllerIdentifier" ] } ] @@ -5722,7 +3253,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], @@ -5731,8 +3262,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "VerticalRotationSpeedMax", - "name": "SetVerticalRotationSpeedMax", + "getterName": "ControllerIdentifier", + "name": "SetControllerIdentifier", "sentence": "", "events": [ { @@ -5741,10 +3272,11 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyControllerIdentifier" }, "parameters": [ - "VerticalRotationSpeedMax", + "Object", + "Behavior", "=", "Value" ] @@ -5761,19 +3293,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the vertical rotation acceleration of the object.", - "fullName": "Vertical rotation acceleration", + "description": "the joystick name.", + "fullName": "Joystick name", "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper vertical rotation configuration", - "name": "VerticalRotationAcceleration", - "sentence": "the vertical rotation acceleration", + "group": "Multitouch Joystick configuration", + "name": "JoystickIdentifier", + "sentence": "the joystick name", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -5781,17 +3313,17 @@ "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "SetReturnString" }, "parameters": [ - "VerticalRotationAcceleration" + "JoystickIdentifier" ] } ] } ], "expressionType": { - "type": "expression" + "type": "string" }, "parameters": [ { @@ -5802,7 +3334,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], @@ -5811,8 +3343,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "VerticalRotationAcceleration", - "name": "SetVerticalRotationAcceleration", + "getterName": "JoystickIdentifier", + "name": "SetJoystickIdentifier", "sentence": "", "events": [ { @@ -5821,10 +3353,11 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickIdentifier" }, "parameters": [ - "VerticalRotationAcceleration", + "Object", + "Behavior", "=", "Value" ] @@ -5841,19 +3374,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the vertical rotation deceleration of the object.", - "fullName": "Vertical rotation deceleration", + "description": "the dead zone radius (range: 0 to 1) of the joystick. 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).", + "fullName": "Dead zone radius", "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper vertical rotation configuration", - "name": "VerticalRotationDeceleration", - "sentence": "the vertical rotation deceleration", + "group": "Multitouch Joystick configuration", + "name": "DeadZoneRadius", + "sentence": "the dead zone radius", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -5864,54 +3397,15 @@ "value": "SetReturnNumber" }, "parameters": [ - "VerticalRotationDeceleration" + "DeadZoneRadius" ] } ] } ], "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "VerticalRotationDeceleration", - "name": "SetVerticalRotationDeceleration", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "VerticalRotationDeceleration", - "=", - "Value" - ] - } - ] - } - ], + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -5921,19 +3415,18 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the minimum vertical camera angle of the object.", - "fullName": "Minimum vertical camera angle", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper vertical rotation configuration", - "name": "VerticalAngleMin", - "sentence": "the minimum vertical camera angle", + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "DeadZoneRadius", + "name": "SetDeadZoneRadius", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -5941,18 +3434,18 @@ "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyDeadZoneRadius" }, "parameters": [ - "VerticalAngleMin" + "Object", + "Behavior", + "=", + "Value" ] } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -5962,31 +3455,271 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" } ], "objectGroups": [] + } + ], + "propertyDescriptors": [ + { + "value": "1", + "type": "Number", + "label": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier" + }, + { + "value": "Primary", + "type": "String", + "label": "Joystick name", + "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": "0", + "type": "Number", + "label": "Joystick angle (range: -180 to 180)", + "hidden": true, + "name": "JoystickAngle" + }, + { + "value": "0", + "type": "Number", + "label": "Joystick force (range: 0 to 1)", + "hidden": true, + "name": "JoystickForce" + }, + { + "value": "0", + "type": "Number", + "label": "", + "hidden": true, + "name": "TouchId" + }, + { + "value": "", + "type": "Number", + "label": "", + "hidden": true, + "name": "TouchIndex" + } + ], + "sharedPropertyDescriptors": [] + }, + { + "description": "Detect button presses made on a touchscreen.", + "fullName": "Multitouch button", + "name": "MultitouchButton", + "objectType": "", + "eventsFunctions": [ { "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "VerticalAngleMin", - "name": "SetVerticalAngleMin", + "functionType": "Action", + "name": "doStepPreEvents", "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::IsReleased" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } + ], "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyIsReleased" + }, + "parameters": [ + "Object", + "Behavior", + "no" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + }, + "parameters": [ + "Object", + "Behavior", + "\"Idle\"", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "SpriteMultitouchJoystick::MultitouchButton::IsPressed" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + }, + { + "type": { + "value": "HasAnyTouchOrMouseStarted" }, "parameters": [ - "VerticalAngleMin", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchIndex" + }, + "parameters": [ + "Object", + "Behavior", "=", - "Value" + "0" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "StartedTouchOrMouseCount()", + "conditions": [], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "CollisionPoint" + }, + "parameters": [ + "Object", + "TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)", + "TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchId" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "StartedTouchOrMouseId(TouchIndex)" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + }, + "parameters": [ + "Object", + "Behavior", + "\"Pressed\"", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchIndex" + }, + "parameters": [ + "Object", + "Behavior", + "+", + "1" + ] + } + ] + } + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::IsPressed" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + }, + { + "type": { + "value": "HasTouchEnded" + }, + "parameters": [ + "", + "TouchId" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + }, + "parameters": [ + "Object", + "Behavior", + "\"Released\"", + "" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyIsReleased" + }, + "parameters": [ + "Object", + "Behavior", + "yes" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchId" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "0" ] } ] @@ -6001,72 +3734,39 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the maximum vertical camera angle of the object.", - "fullName": "Maximum vertical camera angle", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper vertical rotation configuration", - "name": "VerticalAngleMax", - "sentence": "the maximum vertical camera angle", + "description": "Check if button is released.", + "fullName": "Button released", + "functionType": "Condition", + "name": "IsReleased", + "sentence": "Button _PARAM0_ is released", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ + "conditions": [ { "type": { - "value": "SetReturnNumber" + "value": "SpriteMultitouchJoystick::MultitouchButton::PropertyIsReleased" }, "parameters": [ - "VerticalAngleMax" + "Object", + "Behavior" ] } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "VerticalAngleMax", - "name": "SetVerticalAngleMax", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + ], "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SetReturnBoolean" }, "parameters": [ - "VerticalAngleMax", - "=", - "Value" + "True" ] } ] @@ -6081,38 +3781,46 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the z position offset of the object.", - "fullName": "Z position offset", - "functionType": "ExpressionAndCondition", - "group": "First person camera multitouch controller mapper position configuration", - "name": "OffsetZ", - "sentence": "the z position offset", + "description": "Check if button is pressed.", + "fullName": "Button pressed", + "functionType": "Condition", + "name": "IsPressed", + "sentence": "Button _PARAM0_ is pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::PropertyTouchId" + }, + "parameters": [ + "Object", + "Behavior", + "!=", + "0" + ] + } + ], "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "SetReturnBoolean" }, "parameters": [ - "OffsetZ" + "True" ] } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -6122,18 +3830,18 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", "type": "behavior" } ], "objectGroups": [] }, { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "OffsetZ", - "name": "SetOffsetZ", - "sentence": "", + "fullName": "Button state", + "functionType": "Action", + "name": "SetButtonState", + "private": true, + "sentence": "Mark the button _PARAM0_ as _PARAM2_", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -6141,12 +3849,14 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::SetButtonState" }, "parameters": [ - "OffsetZ", - "=", - "Value" + "", + "ControllerIdentifier", + "ButtonIdentifier", + "ButtonState", + "" ] } ] @@ -6161,140 +3871,61 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", "type": "behavior" + }, + { + "description": "Button state", + "name": "ButtonState", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "type": "stringWithSelector" } ], "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...)", + "label": "Multitouch 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": "A", + "type": "String", + "label": "Button identifier", + "name": "ButtonIdentifier" }, { "value": "0", "type": "Number", - "unit": "Pixel", - "label": "Z position offset", - "group": "Position", - "name": "OffsetZ" + "label": "TouchID", + "hidden": true, + "name": "TouchId" }, { - "value": "0", + "value": "", "type": "Number", - "unit": "AngularSpeed", - "label": "Current rotation speed Z", + "label": "", "hidden": true, - "name": "CurrentRotationSpeedZ" + "name": "TouchIndex" }, { - "value": "0", - "type": "Number", - "unit": "AngularSpeed", - "label": "Current rotation speed Y", + "value": "", + "type": "Boolean", + "label": "Button released", "hidden": true, - "name": "CurrentRotationSpeedY" + "name": "IsReleased" } ], "sharedPropertyDescriptors": [] }, { - "description": "Control a 3D physics car with a multitouch controller.", - "fullName": "3D car multitouch controller mapper", - "name": "PhysicsCar3DMultitouchMapper", + "description": "Control a platformer character with a multitouch controller.", + "fullName": "Platformer multitouch controller mapper", + "name": "PlatformerMultitouchMapper", "objectType": "", - "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -6307,14 +3938,13 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::StickForce" + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" }, "parameters": [ "", - ">", - "0", "ControllerIdentifier", - "SteerJoystickIdentifier", + "JoystickIdentifier", + "\"Left\"", "" ] } @@ -6322,12 +3952,11 @@ "actions": [ { "type": { - "value": "Physics3D::PhysicsCar3D::SimulateSteeringStick" + "value": "PlatformBehavior::SimulateLeftKey" }, "parameters": [ "Object", - "PhysicsCar3D", - "SpriteMultitouchJoystick::StickForceX(ControllerIdentifier, \"Primary\")" + "Property" ] } ] @@ -6337,14 +3966,78 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::StickForce" + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JoystickIdentifier", + "\"Right\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "PlatformBehavior::SimulateRightKey" + }, + "parameters": [ + "Object", + "Property" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JoystickIdentifier", + "\"Up\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "PlatformBehavior::SimulateUpKey" + }, + "parameters": [ + "Object", + "Property" + ] + }, + { + "type": { + "value": "PlatformBehavior::SimulateLadderKey" + }, + "parameters": [ + "Object", + "Property" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" }, "parameters": [ "", - ">", - "0", "ControllerIdentifier", - "SpeedJoystickIdentifier", + "JoystickIdentifier", + "\"Down\"", "" ] } @@ -6352,12 +4045,11 @@ "actions": [ { "type": { - "value": "Physics3D::PhysicsCar3D::SimulateAcceleratorStick" + "value": "PlatformBehavior::SimulateDownKey" }, "parameters": [ "Object", - "PhysicsCar3D", - "-SpriteMultitouchJoystick::StickForceY(ControllerIdentifier, \"Secondary\")" + "Property" ] } ] @@ -6372,7 +4064,7 @@ "parameters": [ "", "ControllerIdentifier", - "HandBrakeButton", + "JumpButton", "\"Down\"" ] } @@ -6380,11 +4072,11 @@ "actions": [ { "type": { - "value": "Physics3D::PhysicsCar3D::SimulateHandBrakeKey" + "value": "PlatformBehavior::SimulateJumpKey" }, "parameters": [ "Object", - "PhysicsCar3D" + "Property" ] } ] @@ -6399,7 +4091,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::PhysicsCar3DMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::PlatformerMultitouchMapper", "type": "behavior" } ], @@ -6410,59 +4102,35 @@ { "value": "", "type": "Behavior", - "label": "3D physics car", + "label": "Platform character behavior", "extraInformation": [ - "Physics3D::PhysicsCar3D" + "PlatformBehavior::PlatformerObjectBehavior" ], - "choices": [], - "name": "PhysicsCar3D" + "name": "Property" }, { "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" + "name": "ControllerIdentifier" }, { - "value": "Secondary", + "value": "Primary", "type": "Choice", - "label": "Speed joystick", + "label": "Joystick name", "group": "Controls", - "choices": [ - { - "label": "Primary", - "value": "Primary" - }, - { - "label": "Secondary", - "value": "Secondary" - } + "extraInformation": [ + "Primary", + "Secondary" ], - "name": "SpeedJoystickIdentifier" + "name": "JoystickIdentifier" }, { - "value": "B", + "value": "A", "type": "String", - "label": "Hand brake button name", + "label": "Jump button name", "group": "Controls", - "name": "HandBrakeButton" + "name": "JumpButton" } ], "sharedPropertyDescriptors": [] @@ -6472,7 +4140,6 @@ "fullName": "Top-down multitouch controller mapper", "name": "TopDownMultitouchMapper", "objectType": "", - "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -6485,10 +4152,11 @@ "conditions": [ { "type": { - "value": "StringVariable" + "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" }, "parameters": [ - "StickMode", + "Object", + "Behavior", "=", "\"Analog\"" ] @@ -6513,10 +4181,11 @@ "conditions": [ { "type": { - "value": "StringVariable" + "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" }, "parameters": [ - "StickMode", + "Object", + "Behavior", "=", "\"360°\"" ] @@ -6541,10 +4210,11 @@ "conditions": [ { "type": { - "value": "StringVariable" + "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" }, "parameters": [ - "StickMode", + "Object", + "Behavior", "=", "\"8 Directions\"" ] @@ -6986,7 +4656,6 @@ "extraInformation": [ "TopDownMovementBehavior::TopDownMovementBehavior" ], - "choices": [], "name": "TopDownMovement" }, { @@ -6999,15 +4668,9 @@ "value": "Primary", "type": "Choice", "label": "Joystick name", - "choices": [ - { - "label": "Primary", - "value": "Primary" - }, - { - "label": "Secondary", - "value": "Secondary" - } + "extraInformation": [ + "Primary", + "Secondary" ], "name": "JoystickIdentifier" }, @@ -7016,19 +4679,10 @@ "type": "Choice", "label": "Stick mode", "group": "Controls", - "choices": [ - { - "label": "Analog", - "value": "Analog" - }, - { - "label": "360°", - "value": "360°" - }, - { - "label": "8 Directions", - "value": "8 Directions" - } + "extraInformation": [ + "Analog", + "360°", + "8 Directions" ], "name": "StickMode" } @@ -7271,90 +4925,17 @@ "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "conditions": [], + "actions": [ { "type": { - "inverted": true, - "value": "SpriteMultitouchJoystick::IsInGameEdition" + "value": "MettreAutour" }, "parameters": [ - "", - "" - ] - } - ], - "actions": [], - "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" - }, - "parameters": [ - "Object", - "no", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "ShouldBeHiddenWhenReleased", - "False", - "" - ] - } + "Thumb", + "Border", + "Border.MultitouchJoystick::JoystickForce() * Border.Width() / 2", + "Border.MultitouchJoystick::JoystickAngle()" ] } ] @@ -7422,7 +5003,7 @@ "Border", "MultitouchJoystick", "=", - "ControllerIdentifier", + "Object.PropertyControllerIdentifier()", "" ] }, @@ -7434,7 +5015,7 @@ "Border", "MultitouchJoystick", "=", - "JoystickIdentifier", + "Object.PropertyJoystickIdentifier()", "" ] }, @@ -7446,92 +5027,7 @@ "Border", "MultitouchJoystick", "=", - "DeadZoneRadius", - "" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "supplementaryInformation": "SpriteMultitouchJoystick::SpriteMultitouchJoystick", - "type": "object" - } - ], - "objectGroups": [] - }, - { - "description": "Show the joystick until it is released.", - "fullName": "Show and start pressing", - "functionType": "Action", - "name": "TeleportAndPress", - "sentence": "Show _PARAM0_ at the cursor position and start pressing", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "HasAnyTouchOrMouseStarted" - }, - "parameters": [ - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "MettreXY" - }, - "parameters": [ - "Object", - "=", - "Object.ParentTouchX(StartedTouchOrMouseId(0))", - "=", - "Object.ParentTouchY(StartedTouchOrMouseId(0))" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::ActivateControl" - }, - "parameters": [ - "Object", - "yes", - "" - ] - }, - { - "type": { - "value": "Montre" - }, - "parameters": [ - "Object", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "ShouldBeHiddenWhenReleased", - "True", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::ForceStartPressing" - }, - "parameters": [ - "Border", - "MultitouchJoystick", - "StartedTouchOrMouseId(0)", + "Object.PropertyDeadZoneRadius()", "" ] } @@ -7548,92 +5044,6 @@ ], "objectGroups": [] }, - { - "description": "Return the X position of a specified touch", - "fullName": "Touch X position (on parent)", - "functionType": "Expression", - "name": "ParentTouchX", - "private": true, - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [] - }, - { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "const object = objects[0];", - "const touchId = eventsFunctionContext.getArgument(\"TouchId\");", - "eventsFunctionContext.returnValue = gdjs.evtTools.input.getTouchX(object.getInstanceContainer(), touchId, object.getLayer());" - ], - "parameterObjects": "Object", - "useStrict": true, - "eventsSheetExpanded": false - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "supplementaryInformation": "SpriteMultitouchJoystick::SpriteMultitouchJoystick", - "type": "object" - }, - { - "description": "Touch identifier", - "name": "TouchId", - "type": "expression" - } - ], - "objectGroups": [] - }, - { - "description": "Return the X position of a specified touch", - "fullName": "Touch X position (on parent)", - "functionType": "Expression", - "name": "ParentTouchY", - "private": true, - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [] - }, - { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "const object = objects[0];", - "const touchId = eventsFunctionContext.getArgument(\"TouchId\");", - "eventsFunctionContext.returnValue = gdjs.evtTools.input.getTouchY(object.getInstanceContainer(), touchId, object.getLayer());" - ], - "parameterObjects": "Object", - "useStrict": true, - "eventsSheetExpanded": false - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Object", - "name": "Object", - "supplementaryInformation": "SpriteMultitouchJoystick::SpriteMultitouchJoystick", - "type": "object" - }, - { - "description": "Touch identifier", - "name": "TouchId", - "type": "expression" - } - ], - "objectGroups": [] - }, { "description": "De/activate control of the joystick.", "fullName": "De/activate control", @@ -7647,12 +5057,10 @@ { "type": { "inverted": true, - "value": "BooleanVariable" + "value": "GetArgumentAsBoolean" }, "parameters": [ - "ShouldActivate", - "True", - "" + "\"ShouldActivate\"" ] } ], @@ -7674,12 +5082,10 @@ "conditions": [ { "type": { - "value": "BooleanVariable" + "value": "GetArgumentAsBoolean" }, "parameters": [ - "ShouldActivate", - "True", - "" + "\"ShouldActivate\"" ] } ], @@ -8295,15 +5701,9 @@ "value": "Primary", "type": "Choice", "label": "Joystick name", - "choices": [ - { - "label": "Primary", - "value": "Primary" - }, - { - "label": "Secondary", - "value": "Secondary" - } + "extraInformation": [ + "Primary", + "Secondary" ], "name": "JoystickIdentifier" }, @@ -8322,7 +5722,6 @@ "extraInformation": [ "Thumb" ], - "choices": [], "hidden": true, "name": "ThumbAnchorOrigin" }, @@ -8342,7 +5741,6 @@ "extraInformation": [ "Thumb" ], - "choices": [], "hidden": true, "name": "ThumbIsScaledProportionally" }, @@ -8353,15 +5751,9 @@ "description": "Only used by the scene editor.", "hidden": true, "name": "ParentOrigin" - }, - { - "value": "", - "type": "Boolean", - "label": "", - "hidden": true, - "name": "ShouldBeHiddenWhenReleased" } - ] + ], + "variants": [] } ] }, diff --git a/examples/wave-defense-shooter/wave-defense-shooter.json b/examples/wave-defense-shooter/wave-defense-shooter.json index 276a1baaf..b6faa348a 100644 --- a/examples/wave-defense-shooter/wave-defense-shooter.json +++ b/examples/wave-defense-shooter/wave-defense-shooter.json @@ -7995,13 +7995,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.9.0", + "version": "1.8.3", "description": [ - "Multitouch joysticks are objects showing a joystick on the screen, useful for mobile. They work like a physical gamepad:", + "Multitouch joysticks can be used the same way as physical gamepads:", "- 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.", + "- 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)." ], @@ -8065,28 +8065,6 @@ } ], "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", @@ -8505,11 +8483,11 @@ "objectGroups": [] }, { - "description": "Check if a button was just pressed on a multitouch controller.", - "fullName": "Multitouch controller button just pressed", + "description": "Check if a button is pressed on a gamepad.", + "fullName": "Multitouch controller button pressed", "functionType": "Condition", - "name": "IsButtonJustPressed", - "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ was just pressed", + "name": "IsButtonPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -8521,73 +8499,7 @@ "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 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\"" - ] - } + "\"Pressed\"" ] } ], @@ -8619,7 +8531,7 @@ "objectGroups": [] }, { - "description": "Check if a button is released on a multitouch controller.", + "description": "Check if a button is released on a gamepad.", "fullName": "Multitouch controller button released", "functionType": "Condition", "name": "IsButtonReleased", @@ -8705,7 +8617,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"JustPressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -10078,23 +9990,41 @@ "conditions": [ { "type": { - "inverted": true, - "value": "SpriteMultitouchJoystick::IsInGameEdition" + "value": "HasGameJustResumed" }, "parameters": [ - "", "" ] } ], - "actions": [], + "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": "HasGameJustResumed" + "value": "HasAnyTouchOrMouseStarted" }, "parameters": [ "" @@ -10104,207 +10034,171 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", - "" + "TouchIndex", + "=", + "0" ] } - ] - }, - { - "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" - ] - } - ], + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "StartedTouchOrMouseCount()", + "conditions": [], + "actions": [], "events": [ { - "type": "BuiltinCommonInstructions::Repeat", - "repeatExpression": "StartedTouchOrMouseCount()", - "conditions": [], - "actions": [], - "events": [ + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { - "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": "NumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "0" ] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchIndex", - "+", - "1" - ] - } + "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)" + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 + "type": { + "value": "HasTouchEnded" }, - "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" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - } + "parameters": [ + "", + "TouchId" ] } ], - "parameters": [] - }, + "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": [ { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Update joystick position", - "source": "", - "type": "BuiltinCommonInstructions::Group", - "events": [ + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { - "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)", - "" - ] - } + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "!=", + "0" ] } ], - "parameters": [] + "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": [ @@ -11179,7 +11073,7 @@ "sharedPropertyDescriptors": [] }, { - "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.", + "description": "Detect button presses made on a touchscreen.", "fullName": "Multitouch button", "name": "MultitouchButton", "objectType": "", @@ -11195,49 +11089,11 @@ "conditions": [ { "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "IsReleased", - "True", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsReleased", - "False", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + "value": "SpriteMultitouchJoystick::MultitouchButton::IsReleased" }, "parameters": [ "Object", "Behavior", - "\"Idle\"", - "" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "True", "" ] } @@ -11248,7 +11104,7 @@ "value": "SetBooleanVariable" }, "parameters": [ - "IsJustPressed", + "IsReleased", "False", "" ] @@ -11260,7 +11116,7 @@ "parameters": [ "Object", "Behavior", - "\"Pressed\"", + "\"Idle\"", "" ] } @@ -11358,17 +11214,7 @@ "parameters": [ "Object", "Behavior", - "\"JustPressed\"", - "" - ] - }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "True", + "\"Pressed\"", "" ] } @@ -11439,16 +11285,6 @@ "" ] }, - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "IsJustPressed", - "False", - "" - ] - }, { "type": { "value": "SetNumberVariable" @@ -11478,11 +11314,11 @@ "objectGroups": [] }, { - "description": "Check if the button was just pressed.", - "fullName": "Button just pressed", + "description": "Check if button is released.", + "fullName": "Button released", "functionType": "Condition", - "name": "IsJustPressed", - "sentence": "Button _PARAM0_ was just pressed", + "name": "IsReleased", + "sentence": "Button _PARAM0_ is released", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -11492,7 +11328,7 @@ "value": "BooleanVariable" }, "parameters": [ - "IsJustPressed", + "IsReleased", "True", "" ] @@ -11526,7 +11362,7 @@ "objectGroups": [] }, { - "description": "Check if the button is pressed.", + "description": "Check if button is pressed.", "fullName": "Button pressed", "functionType": "Condition", "name": "IsPressed", @@ -11573,54 +11409,6 @@ ], "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", @@ -11662,7 +11450,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"JustPressed\",\"Pressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -11703,13 +11491,6 @@ "hidden": true, "name": "IsReleased" }, - { - "value": "", - "type": "Boolean", - "label": "Button just pressed", - "hidden": true, - "name": "IsJustPressed" - }, { "value": "0", "type": "Number", @@ -14098,6 +13879,7 @@ "ambientLightColorB": 200, "ambientLightColorG": 200, "ambientLightColorR": 200, + "camera2DPlaneMaxDrawingDistance": 5000, "camera3DFarPlaneDistance": 10000, "camera3DFieldOfView": 45, "camera3DNearPlaneDistance": 3, @@ -14124,6 +13906,7 @@ } ], "instances": [], + "editionSettings": {}, "eventsFunctions": [ { "fullName": "", @@ -14240,92 +14023,74 @@ "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::IsInGameEdition" + "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::IsPressed" }, "parameters": [ - "", + "Object", "" ] } ], - "actions": [], - "events": [ + "actions": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "MettreAutour" - }, - "parameters": [ - "Thumb", - "Border", - "Border.MultitouchJoystick::JoystickForce() * Border.Width() / 2", - "Border.MultitouchJoystick::JoystickAngle()" - ] - } + "type": { + "value": "Cache" + }, + "parameters": [ + "Object" ] }, { - "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", - "" - ] - } + "type": { + "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::ActivateControl" + }, + "parameters": [ + "Object", + "no", + "" + ] + }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "ShouldBeHiddenWhenReleased", + "False", + "" ] } ] @@ -15332,7 +15097,8 @@ "hidden": true, "name": "ShouldBeHiddenWhenReleased" } - ] + ], + "variants": [] } ] },