diff --git a/examples/crazygames-sdk-demo/crazygames-sdk-demo.json b/examples/crazygames-sdk-demo/crazygames-sdk-demo.json index 9959ecc79..9fd8303ef 100644 --- a/examples/crazygames-sdk-demo/crazygames-sdk-demo.json +++ b/examples/crazygames-sdk-demo/crazygames-sdk-demo.json @@ -6223,88 +6223,6 @@ "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 d267b41ab..07f2869b1 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": "", + "gdevelopVersion": ">=5.5.222", "helpPath": "/objects/multitouch-joystick", "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyMy4wLjMsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iSWNvbnMiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB2aWV3Qm94PSIwIDAgMzIgMzIiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDMyIDMyOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8c3R5bGUgdHlwZT0idGV4dC9jc3MiPg0KCS5zdDB7ZmlsbDpub25lO3N0cm9rZTojMDAwMDAwO3N0cm9rZS13aWR0aDoyO3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1saW5lam9pbjpyb3VuZDtzdHJva2UtbWl0ZXJsaW1pdDoxMDt9DQo8L3N0eWxlPg0KPGNpcmNsZSBjbGFzcz0ic3QwIiBjeD0iMTYiIGN5PSIxNiIgcj0iMTMiLz4NCjxwb2x5bGluZSBjbGFzcz0ic3QwIiBwb2ludHM9IjI4LjQsMTIgMjAsMTIgMjAsMy42ICIvPg0KPHBvbHlsaW5lIGNsYXNzPSJzdDAiIHBvaW50cz0iMjAsMjguNCAyMCwyMCAyOC40LDIwICIvPg0KPHBvbHlsaW5lIGNsYXNzPSJzdDAiIHBvaW50cz0iMy42LDIwIDEyLDIwIDEyLDI4LjQgIi8+DQo8cG9seWxpbmUgY2xhc3M9InN0MCIgcG9pbnRzPSIxMiwzLjYgMTIsMTIgMy42LDEyICIvPg0KPHBvbHlnb24gY2xhc3M9InN0MCIgcG9pbnRzPSIxNiw2IDE2LjcsNyAxNS4zLDcgIi8+DQo8cG9seWdvbiBjbGFzcz0ic3QwIiBwb2ludHM9IjE2LDI2IDE1LjMsMjUgMTYuNywyNSAiLz4NCjxwb2x5Z29uIGNsYXNzPSJzdDAiIHBvaW50cz0iNiwxNiA3LDE1LjMgNywxNi43ICIvPg0KPHBvbHlnb24gY2xhc3M9InN0MCIgcG9pbnRzPSIyNiwxNiAyNSwxNi43IDI1LDE1LjMgIi8+DQo8L3N2Zz4NCg==", "name": "SpriteMultitouchJoystick", "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/Line Hero Pack/Master/SVG/Videogames/Videogames_controller_joystick_arrows_direction.svg", "shortDescription": "Joysticks or buttons for touchscreens.", - "version": "1.6.1", + "version": "1.9.0", "description": [ - "Multitouch joysticks can be used the same way as physical gamepads:", + "Multitouch joysticks are objects showing a joystick on the screen, useful for mobile. They work like a physical gamepad:", "- 4 or 8 directions", "- Analogus pads", "- Player selection", - "- Controls mapping for top-down movement and platformer characters", + "- Automatic \"mapper\" behaviors for 2D and 3D movement behaviors (platformer characters, top-down movement, 3D character etc...). Add one of these to the object with the movement behavior (i.e: the player most of the time) and the behavior will then be controlled automatically by the virtual joystick (it works by reading the multitouch joystick state and simulating controls). No need for additional events to make it work once the behaviors are set up.", "", "There are ready-to-use joysticks in the asset-store [multitouch joysticks pack](https://editor.gdevelop.io/?initial-dialog=asset-store&asset-pack=multitouch-joysticks-multitouch-joysticks)." ], @@ -8811,6 +8811,28 @@ } ], "eventsFunctions": [ + { + "description": "Check if the events are running for the editor.", + "fullName": "Editor is running", + "functionType": "Condition", + "name": "IsInGameEdition", + "private": true, + "sentence": "Events are running for the editor", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const game = runtimeScene.getGame();\r", + "eventsFunctionContext.returnValue = game.isInGameEdition && game.isInGameEdition();" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [], + "objectGroups": [] + }, { "fullName": "Accelerated speed", "functionType": "Expression", @@ -8839,10 +8861,10 @@ "conditions": [ { "type": { - "value": "CompareArgumentAsNumber" + "value": "NumberVariable" }, "parameters": [ - "\"TargetedSpeed\"", + "TargetedSpeed", "<", "0" ] @@ -8867,10 +8889,10 @@ "conditions": [ { "type": { - "value": "CompareArgumentAsNumber" + "value": "NumberVariable" }, "parameters": [ - "\"CurrentSpeed\"", + "CurrentSpeed", "<", "TargetedSpeed" ] @@ -8894,20 +8916,20 @@ "conditions": [ { "type": { - "value": "CompareArgumentAsNumber" + "value": "NumberVariable" }, "parameters": [ - "\"CurrentSpeed\"", + "CurrentSpeed", ">", "TargetedSpeed" ] }, { "type": { - "value": "CompareArgumentAsNumber" + "value": "NumberVariable" }, "parameters": [ - "\"CurrentSpeed\"", + "CurrentSpeed", "<", "0" ] @@ -8943,10 +8965,10 @@ "conditions": [ { "type": { - "value": "CompareArgumentAsNumber" + "value": "NumberVariable" }, "parameters": [ - "\"CurrentSpeed\"", + "CurrentSpeed", ">=", "0" ] @@ -8972,10 +8994,10 @@ "conditions": [ { "type": { - "value": "CompareArgumentAsNumber" + "value": "NumberVariable" }, "parameters": [ - "\"TargetedSpeed\"", + "TargetedSpeed", ">", "0" ] @@ -9000,10 +9022,10 @@ "conditions": [ { "type": { - "value": "CompareArgumentAsNumber" + "value": "NumberVariable" }, "parameters": [ - "\"CurrentSpeed\"", + "CurrentSpeed", ">", "TargetedSpeed" ] @@ -9027,20 +9049,20 @@ "conditions": [ { "type": { - "value": "CompareArgumentAsNumber" + "value": "NumberVariable" }, "parameters": [ - "\"CurrentSpeed\"", + "CurrentSpeed", "<", "TargetedSpeed" ] }, { "type": { - "value": "CompareArgumentAsNumber" + "value": "NumberVariable" }, "parameters": [ - "\"CurrentSpeed\"", + "CurrentSpeed", ">", "0" ] @@ -9076,10 +9098,10 @@ "conditions": [ { "type": { - "value": "CompareArgumentAsNumber" + "value": "NumberVariable" }, "parameters": [ - "\"CurrentSpeed\"", + "CurrentSpeed", "<=", "0" ] @@ -9105,10 +9127,10 @@ "conditions": [ { "type": { - "value": "CompareArgumentAsNumber" + "value": "NumberVariable" }, "parameters": [ - "\"TargetedSpeed\"", + "TargetedSpeed", "=", "0" ] @@ -9121,10 +9143,10 @@ "conditions": [ { "type": { - "value": "CompareArgumentAsNumber" + "value": "NumberVariable" }, "parameters": [ - "\"CurrentSpeed\"", + "CurrentSpeed", "<", "0" ] @@ -9148,10 +9170,10 @@ "conditions": [ { "type": { - "value": "CompareArgumentAsNumber" + "value": "NumberVariable" }, "parameters": [ - "\"CurrentSpeed\"", + "CurrentSpeed", ">", "0" ] @@ -9229,11 +9251,11 @@ "objectGroups": [] }, { - "description": "Check if a button is pressed on a gamepad.", - "fullName": "Multitouch controller button pressed", + "description": "Check if a button was just pressed on a multitouch controller.", + "fullName": "Multitouch controller button just pressed", "functionType": "Condition", - "name": "IsButtonPressed", - "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", + "name": "IsButtonJustPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ was just pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -9245,7 +9267,73 @@ "parameters": [ "Controllers[ControllerIdentifier].Buttons[Button].State", "=", - "\"Pressed\"" + "\"JustPressed\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier", + "type": "expression" + }, + { + "description": "Button name", + "name": "Button", + "supplementaryInformation": "[\"A\",\"CROSS\",\"B\",\"CIRCLE\",\"X\",\"SQUARE\",\"Y\",\"TRIANGLE\",\"LB\",\"L1\",\"RB\",\"R1\",\"LT\",\"L2\",\"RT\",\"R2\",\"UP\",\"DOWN\",\"LEFT\",\"RIGHT\",\"BACK\",\"SHARE\",\"START\",\"OPTIONS\",\"CLICK_STICK_LEFT\",\"CLICK_STICK_RIGHT\",\"PS_BUTTON\",\"CLICK_TOUCHPAD\"]", + "type": "string" + } + ], + "objectGroups": [] + }, + { + "description": "Check if a button is pressed on a multitouch controller.", + "fullName": "Multitouch controller button pressed", + "functionType": "Condition", + "name": "IsButtonPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::Or" + }, + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"Pressed\"" + ] + }, + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"JustPressed\"" + ] + } ] } ], @@ -9277,7 +9365,7 @@ "objectGroups": [] }, { - "description": "Check if a button is released on a gamepad.", + "description": "Check if a button is released on a multitouch controller.", "fullName": "Multitouch controller button released", "functionType": "Condition", "name": "IsButtonReleased", @@ -9363,7 +9451,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"JustPressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -10538,10 +10626,10 @@ "conditions": [ { "type": { - "value": "CompareArgumentAsString" + "value": "StringVariable" }, "parameters": [ - "\"Side\"", + "Side", "=", "\"Left\"" ] @@ -10576,10 +10664,10 @@ "conditions": [ { "type": { - "value": "CompareArgumentAsString" + "value": "StringVariable" }, "parameters": [ - "\"Side\"", + "Side", "=", "\"Right\"" ] @@ -10736,41 +10824,23 @@ "conditions": [ { "type": { - "value": "HasGameJustResumed" + "inverted": true, + "value": "SpriteMultitouchJoystick::IsInGameEdition" }, "parameters": [ + "", "" ] } ], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - } - ] - }, - { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Manage touches", - "source": "", - "type": "BuiltinCommonInstructions::Group", + "actions": [], "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "value": "HasAnyTouchOrMouseStarted" + "value": "HasGameJustResumed" }, "parameters": [ "" @@ -10780,176 +10850,207 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyTouchIndex" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" }, "parameters": [ "Object", "Behavior", - "=", - "0" + "" ] } - ], + ] + }, + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Manage touches", + "source": "", + "type": "BuiltinCommonInstructions::Group", "events": [ { - "type": "BuiltinCommonInstructions::Repeat", - "repeatExpression": "StartedTouchOrMouseCount()", - "conditions": [], - "actions": [], + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "HasAnyTouchOrMouseStarted" + }, + "parameters": [ + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchIndex", + "=", + "0" + ] + } + ], "events": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "StartedTouchOrMouseCount()", + "conditions": [], + "actions": [], + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::PropertyTouchId" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "0" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "0" + ] + }, + { + "type": { + "value": "CollisionPoint" + }, + "parameters": [ + "Object", + "TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)", + "TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "StartedTouchOrMouseId(TouchIndex)" + ] + } ] }, { - "type": { - "value": "CollisionPoint" - }, - "parameters": [ - "Object", - "TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)", - "TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)" - ] - } - ], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyTouchId" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "StartedTouchOrMouseId(TouchIndex)" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyTouchIndex" - }, - "parameters": [ - "Object", - "Behavior", - "+", - "1" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchIndex", + "+", + "1" + ] + } ] } ] } ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 - }, - "comment": "Move thumb back to center when not being pressed (acts like a spring on a real controller)" - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + }, { - "type": { - "value": "HasTouchEnded" - }, - "parameters": [ - "", - "TouchId" - ] - } - ], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 }, - "parameters": [ - "Object", - "Behavior", - "" - ] - } - ] - } - ], - "parameters": [] - }, - { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Update joystick position", - "source": "", - "type": "BuiltinCommonInstructions::Group", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "comment": "Move thumb back to center when not being pressed (acts like a spring on a real controller)" + }, { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::PropertyTouchId" - }, - "parameters": [ - "Object", - "Behavior", - "!=", - "0" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "HasTouchEnded" + }, + "parameters": [ + "", + "TouchId" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } ] } ], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickAngle" - }, - "parameters": [ - "Object", - "Behavior", - "AngleBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0))", - "AngleBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0))" - ] - }, + "parameters": [] + }, + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Update joystick position", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "clamp(2 * DistanceBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0)) / Object.Width(), 0, 1)", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "!=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickAngle" + }, + "parameters": [ + "Object", + "Behavior", + "AngleBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0))", + "AngleBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0))" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "clamp(2 * DistanceBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0)) / Object.Width(), 0, 1)", + "" + ] + } ] } - ] + ], + "parameters": [] } - ], - "parameters": [] + ] } ], "parameters": [ @@ -11021,11 +11122,10 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickForce" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "JoystickForce", "=", "Value" ] @@ -11119,11 +11219,10 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickAngle" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "JoystickAngle", "=", "Value" ] @@ -11389,11 +11488,10 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::PropertyTouchId" + "value": "NumberVariable" }, "parameters": [ - "Object", - "Behavior", + "TouchId", "!=", "0" ] @@ -11452,11 +11550,10 @@ }, { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyTouchId" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "TouchId", "=", "0" ] @@ -11533,11 +11630,10 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyControllerIdentifier" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "ControllerIdentifier", "=", "Value" ] @@ -11614,11 +11710,10 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickIdentifier" + "value": "SetStringVariable" }, "parameters": [ - "Object", - "Behavior", + "JoystickIdentifier", "=", "Value" ] @@ -11695,11 +11790,10 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyDeadZoneRadius" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "DeadZoneRadius", "=", "Value" ] @@ -11747,11 +11841,10 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyTouchId" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "TouchId", "=", "Value" ] @@ -11832,7 +11925,7 @@ "sharedPropertyDescriptors": [] }, { - "description": "Detect button presses made on a touchscreen.", + "description": "Detect presses made on a touchscreen on the object so it acts like a button and automatically trigger the button having the same identifier for the mapper behaviors.", "fullName": "Multitouch button", "name": "MultitouchButton", "objectType": "", @@ -11848,11 +11941,11 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::IsReleased" + "value": "BooleanVariable" }, "parameters": [ - "Object", - "Behavior", + "IsReleased", + "True", "" ] } @@ -11860,12 +11953,50 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyIsReleased" + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsReleased", + "False", + "" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" }, "parameters": [ "Object", "Behavior", - "no" + "\"Idle\"", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "False", + "" ] }, { @@ -11875,7 +12006,7 @@ "parameters": [ "Object", "Behavior", - "\"Idle\"", + "\"Pressed\"", "" ] } @@ -11907,11 +12038,10 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchIndex" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "TouchIndex", "=", "0" ] @@ -11945,11 +12075,10 @@ }, { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::PropertyRadius" + "value": "NumberVariable" }, "parameters": [ - "Object", - "Behavior", + "Radius", ">", "DistanceBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer()), TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer()))" ] @@ -11960,11 +12089,10 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchId" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "TouchId", "=", "StartedTouchOrMouseId(TouchIndex)" ] @@ -11976,7 +12104,17 @@ "parameters": [ "Object", "Behavior", - "\"Pressed\"", + "\"JustPressed\"", + "" + ] + }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "True", "" ] } @@ -11988,11 +12126,10 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchIndex" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "TouchIndex", "+", "1" ] @@ -12040,21 +12177,30 @@ }, { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyIsReleased" + "value": "SetBooleanVariable" }, "parameters": [ - "Object", - "Behavior", - "yes" + "IsReleased", + "True", + "" ] }, { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchId" + "value": "SetBooleanVariable" }, "parameters": [ - "Object", - "Behavior", + "IsJustPressed", + "False", + "" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchId", "=", "0" ] @@ -12078,22 +12224,23 @@ "objectGroups": [] }, { - "description": "Check if button is released.", - "fullName": "Button released", + "description": "Check if the button was just pressed.", + "fullName": "Button just pressed", "functionType": "Condition", - "name": "IsReleased", - "sentence": "Button _PARAM0_ is released", + "name": "IsJustPressed", + "sentence": "Button _PARAM0_ was just pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::PropertyIsReleased" + "value": "BooleanVariable" }, "parameters": [ - "Object", - "Behavior" + "IsJustPressed", + "True", + "" ] } ], @@ -12125,7 +12272,7 @@ "objectGroups": [] }, { - "description": "Check if button is pressed.", + "description": "Check if the button is pressed.", "fullName": "Button pressed", "functionType": "Condition", "name": "IsPressed", @@ -12136,11 +12283,10 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::PropertyTouchId" + "value": "NumberVariable" }, "parameters": [ - "Object", - "Behavior", + "TouchId", "!=", "0" ] @@ -12173,6 +12319,54 @@ ], "objectGroups": [] }, + { + "description": "Check if the button is released.", + "fullName": "Button released", + "functionType": "Condition", + "name": "IsReleased", + "sentence": "Button _PARAM0_ is released", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsReleased", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "type": "behavior" + } + ], + "objectGroups": [] + }, { "fullName": "Button state", "functionType": "Action", @@ -12214,7 +12408,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"JustPressed\",\"Pressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -12255,6 +12449,13 @@ "hidden": true, "name": "IsReleased" }, + { + "value": "", + "type": "Boolean", + "label": "Button just pressed", + "hidden": true, + "name": "IsJustPressed" + }, { "value": "0", "type": "Number", @@ -12271,6 +12472,7 @@ "fullName": "Platformer multitouch controller mapper", "name": "PlatformerMultitouchMapper", "objectType": "", + "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -12451,6 +12653,7 @@ "extraInformation": [ "PlatformBehavior::PlatformerObjectBehavior" ], + "choices": [], "name": "Property" }, { @@ -12464,9 +12667,15 @@ "type": "Choice", "label": "Joystick name", "group": "Controls", - "extraInformation": [ - "Primary", - "Secondary" + "choices": [ + { + "label": "Primary", + "value": "Primary" + }, + { + "label": "Secondary", + "value": "Secondary" + } ], "name": "JoystickIdentifier" }, @@ -12485,6 +12694,7 @@ "fullName": "3D platformer multitouch controller mapper", "name": "Platformer3DMultitouchMapper", "objectType": "", + "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -12586,6 +12796,7 @@ "extraInformation": [ "Physics3D::PhysicsCharacter3D" ], + "choices": [], "name": "PhysicsCharacter3D" }, { @@ -12599,9 +12810,15 @@ "type": "Choice", "label": "Walk joystick", "group": "Controls", - "extraInformation": [ - "Primary", - "Secondary" + "choices": [ + { + "label": "Primary", + "value": "Primary" + }, + { + "label": "Secondary", + "value": "Secondary" + } ], "name": "JoystickIdentifier" }, @@ -12620,6 +12837,7 @@ "fullName": "3D shooter multitouch controller mapper", "name": "Shooter3DMultitouchMapper", "objectType": "", + "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -12710,6 +12928,7 @@ "extraInformation": [ "Physics3D::PhysicsCharacter3D" ], + "choices": [], "name": "PhysicsCharacter3D" }, { @@ -12723,9 +12942,15 @@ "type": "Choice", "label": "Walk joystick", "group": "Controls", - "extraInformation": [ - "Primary", - "Secondary" + "choices": [ + { + "label": "Primary", + "value": "Primary" + }, + { + "label": "Secondary", + "value": "Secondary" + } ], "name": "JoystickIdentifier" }, @@ -12744,6 +12969,7 @@ "fullName": "First person camera multitouch controller mapper", "name": "FirstPersonMultitouchMapper", "objectType": "", + "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -12769,11 +12995,10 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper::SetPropertyCurrentRotationSpeedZ" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "CurrentRotationSpeedZ", "=", "SpriteMultitouchJoystick::AcceleratedSpeed(CurrentRotationSpeedZ, SpriteMultitouchJoystick::StickForceX(ControllerIdentifier, CameraStick) * HorizontalRotationSpeedMax, HorizontalRotationSpeedMax, HorizontalRotationAcceleration, HorizontalRotationDeceleration)" ] @@ -12790,11 +13015,10 @@ }, { "type": { - "value": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper::SetPropertyCurrentRotationSpeedY" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "CurrentRotationSpeedY", "=", "SpriteMultitouchJoystick::AcceleratedSpeed(CurrentRotationSpeedY, SpriteMultitouchJoystick::StickForceY(ControllerIdentifier, CameraStick) * VerticalRotationSpeedMax, VerticalRotationSpeedMax, VerticalRotationAcceleration, VerticalRotationDeceleration)" ] @@ -12994,11 +13218,10 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper::SetPropertyHorizontalRotationSpeedMax" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "HorizontalRotationSpeedMax", "=", "Value" ] @@ -13075,11 +13298,10 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper::SetPropertyHorizontalRotationAcceleration" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "HorizontalRotationAcceleration", "=", "Value" ] @@ -13156,11 +13378,10 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper::SetPropertyHorizontalRotationDeceleration" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "HorizontalRotationDeceleration", "=", "Value" ] @@ -13237,11 +13458,10 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper::SetPropertyVerticalRotationSpeedMax" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "VerticalRotationSpeedMax", "=", "Value" ] @@ -13318,11 +13538,10 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper::SetPropertyVerticalRotationAcceleration" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "VerticalRotationAcceleration", "=", "Value" ] @@ -13399,11 +13618,10 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper::SetPropertyVerticalRotationDeceleration" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "VerticalRotationDeceleration", "=", "Value" ] @@ -13480,11 +13698,10 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper::SetPropertyVerticalAngleMin" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "VerticalAngleMin", "=", "Value" ] @@ -13561,11 +13778,10 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper::SetPropertyVerticalAngleMax" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "VerticalAngleMax", "=", "Value" ] @@ -13638,17 +13854,254 @@ "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "OffsetZ", + "=", + "Value" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "type": "behavior" + } + ], + "objectGroups": [] + } + ], + "propertyDescriptors": [ + { + "value": "", + "type": "Behavior", + "label": "3D capability", + "extraInformation": [ + "Scene3D::Base3DBehavior" + ], + "choices": [], + "name": "Object3D" + }, + { + "value": "1", + "type": "Number", + "label": "Controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier" + }, + { + "value": "Secondary", + "type": "Choice", + "label": "Camera joystick", + "group": "Controls", + "choices": [ + { + "label": "Primary", + "value": "Primary" + }, + { + "label": "Secondary", + "value": "Secondary" + } + ], + "name": "CameraStick" + }, + { + "value": "180", + "type": "Number", + "unit": "AngularSpeed", + "label": "Maximum rotation speed", + "group": "Horizontal rotation", + "name": "HorizontalRotationSpeedMax" + }, + { + "value": "360", + "type": "Number", + "label": "Rotation acceleration", + "group": "Horizontal rotation", + "name": "HorizontalRotationAcceleration" + }, + { + "value": "720", + "type": "Number", + "label": "Rotation deceleration", + "group": "Horizontal rotation", + "name": "HorizontalRotationDeceleration" + }, + { + "value": "120", + "type": "Number", + "unit": "AngularSpeed", + "label": "Maximum rotation speed", + "group": "Vertical rotation", + "name": "VerticalRotationSpeedMax" + }, + { + "value": "240", + "type": "Number", + "label": "Rotation acceleration", + "group": "Vertical rotation", + "name": "VerticalRotationAcceleration" + }, + { + "value": "480", + "type": "Number", + "label": "Rotation deceleration", + "group": "Vertical rotation", + "name": "VerticalRotationDeceleration" + }, + { + "value": "-90", + "type": "Number", + "unit": "DegreeAngle", + "label": "Minimum angle", + "group": "Vertical rotation", + "name": "VerticalAngleMin" + }, + { + "value": "90", + "type": "Number", + "unit": "DegreeAngle", + "label": "Maximum angle", + "group": "Vertical rotation", + "name": "VerticalAngleMax" + }, + { + "value": "0", + "type": "Number", + "unit": "Pixel", + "label": "Z position offset", + "group": "Position", + "name": "OffsetZ" + }, + { + "value": "0", + "type": "Number", + "unit": "AngularSpeed", + "label": "Current rotation speed Z", + "hidden": true, + "name": "CurrentRotationSpeedZ" + }, + { + "value": "0", + "type": "Number", + "unit": "AngularSpeed", + "label": "Current rotation speed Y", + "hidden": true, + "name": "CurrentRotationSpeedY" + } + ], + "sharedPropertyDescriptors": [] + }, + { + "description": "Control a 3D physics car with a multitouch controller.", + "fullName": "3D car multitouch controller mapper", + "name": "PhysicsCar3DMultitouchMapper", + "objectType": "", + "quickCustomizationVisibility": "hidden", + "eventsFunctions": [ + { + "fullName": "", + "functionType": "Action", + "name": "doStepPreEvents", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::StickForce" + }, + "parameters": [ + "", + ">", + "0", + "ControllerIdentifier", + "SteerJoystickIdentifier", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "Physics3D::PhysicsCar3D::SimulateSteeringStick" + }, + "parameters": [ + "Object", + "PhysicsCar3D", + "SpriteMultitouchJoystick::StickForceX(ControllerIdentifier, \"Primary\")" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::StickForce" + }, + "parameters": [ + "", + ">", + "0", + "ControllerIdentifier", + "SpeedJoystickIdentifier", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "Physics3D::PhysicsCar3D::SimulateAcceleratorStick" + }, + "parameters": [ + "Object", + "PhysicsCar3D", + "-SpriteMultitouchJoystick::StickForceY(ControllerIdentifier, \"Secondary\")" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::IsButtonPressed" + }, + "parameters": [ + "", + "ControllerIdentifier", + "HandBrakeButton", + "\"Down\"" + ] + } + ], "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper::SetPropertyOffsetZ" + "value": "Physics3D::PhysicsCar3D::SimulateHandBrakeKey" }, "parameters": [ "Object", - "Behavior", - "=", - "Value" + "PhysicsCar3D" ] } ] @@ -13663,7 +14116,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::PhysicsCar3DMultitouchMapper", "type": "behavior" } ], @@ -13674,11 +14127,12 @@ { "value": "", "type": "Behavior", - "label": "3D capability", + "label": "3D physics car", "extraInformation": [ - "Scene3D::Base3DBehavior" + "Physics3D::PhysicsCar3D" ], - "name": "Object3D" + "choices": [], + "name": "PhysicsCar3D" }, { "value": "1", @@ -13687,99 +14141,45 @@ "name": "ControllerIdentifier" }, { - "value": "Secondary", + "value": "Primary", "type": "Choice", - "label": "Camera joystick", + "label": "Steer joystick", "group": "Controls", - "extraInformation": [ - "Primary", - "Secondary" + "choices": [ + { + "label": "Primary", + "value": "Primary" + }, + { + "label": "Secondary", + "value": "Secondary" + } ], - "name": "CameraStick" - }, - { - "value": "180", - "type": "Number", - "unit": "AngularSpeed", - "label": "Maximum rotation speed", - "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" + "name": "SteerJoystickIdentifier" }, { - "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": "Secondary", + "type": "Choice", + "label": "Speed joystick", + "group": "Controls", + "choices": [ + { + "label": "Primary", + "value": "Primary" + }, + { + "label": "Secondary", + "value": "Secondary" + } + ], + "name": "SpeedJoystickIdentifier" }, { - "value": "0", - "type": "Number", - "unit": "AngularSpeed", - "label": "Current rotation speed Y", - "hidden": true, - "name": "CurrentRotationSpeedY" + "value": "B", + "type": "String", + "label": "Hand brake button name", + "group": "Controls", + "name": "HandBrakeButton" } ], "sharedPropertyDescriptors": [] @@ -13789,6 +14189,7 @@ "fullName": "Top-down multitouch controller mapper", "name": "TopDownMultitouchMapper", "objectType": "", + "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -13801,11 +14202,10 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "StickMode", "=", "\"Analog\"" ] @@ -13830,11 +14230,10 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "StickMode", "=", "\"360°\"" ] @@ -13859,11 +14258,10 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "StickMode", "=", "\"8 Directions\"" ] @@ -14305,6 +14703,7 @@ "extraInformation": [ "TopDownMovementBehavior::TopDownMovementBehavior" ], + "choices": [], "name": "TopDownMovement" }, { @@ -14317,9 +14716,15 @@ "value": "Primary", "type": "Choice", "label": "Joystick name", - "extraInformation": [ - "Primary", - "Secondary" + "choices": [ + { + "label": "Primary", + "value": "Primary" + }, + { + "label": "Secondary", + "value": "Secondary" + } ], "name": "JoystickIdentifier" }, @@ -14328,10 +14733,19 @@ "type": "Choice", "label": "Stick mode", "group": "Controls", - "extraInformation": [ - "Analog", - "360°", - "8 Directions" + "choices": [ + { + "label": "Analog", + "value": "Analog" + }, + { + "label": "360°", + "value": "360°" + }, + { + "label": "8 Directions", + "value": "8 Directions" + } ], "name": "StickMode" } @@ -14572,62 +14986,92 @@ "name": "doStepPostEvents", "sentence": "", "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "MettreAutour" - }, - "parameters": [ - "Thumb", - "Border", - "Border.MultitouchJoystick::JoystickForce() * Border.Width() / 2", - "Border.MultitouchJoystick::JoystickAngle()" - ] - } - ] - }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::PropertyShouldBeHiddenWhenReleased" - }, - "parameters": [ - "Object" - ] - }, { "type": { "inverted": true, - "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::IsPressed" + "value": "SpriteMultitouchJoystick::IsInGameEdition" }, "parameters": [ - "Object", + "", "" ] } ], - "actions": [ + "actions": [], + "events": [ { - "type": { - "value": "Cache" - }, - "parameters": [ - "Object" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "MettreAutour" + }, + "parameters": [ + "Thumb", + "Border", + "Border.MultitouchJoystick::JoystickForce() * Border.Width() / 2", + "Border.MultitouchJoystick::JoystickAngle()" + ] + } ] }, { - "type": { - "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::ActivateControl" - }, - "parameters": [ - "Object", - "no", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "ShouldBeHiddenWhenReleased", + "True", + "" + ] + }, + { + "type": { + "inverted": true, + "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::IsPressed" + }, + "parameters": [ + "Object", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "Cache" + }, + "parameters": [ + "Object" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::ActivateControl" + }, + "parameters": [ + "Object", + "no", + "" + ] + }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "ShouldBeHiddenWhenReleased", + "False", + "" + ] + } ] } ] @@ -14789,11 +15233,12 @@ }, { "type": { - "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::SetPropertyShouldBeHiddenWhenReleased" + "value": "SetBooleanVariable" }, "parameters": [ - "Object", - "yes" + "ShouldBeHiddenWhenReleased", + "True", + "" ] }, { @@ -14919,10 +15364,12 @@ { "type": { "inverted": true, - "value": "GetArgumentAsBoolean" + "value": "BooleanVariable" }, "parameters": [ - "\"ShouldActivate\"" + "ShouldActivate", + "True", + "" ] } ], @@ -14944,10 +15391,12 @@ "conditions": [ { "type": { - "value": "GetArgumentAsBoolean" + "value": "BooleanVariable" }, "parameters": [ - "\"ShouldActivate\"" + "ShouldActivate", + "True", + "" ] } ], @@ -15563,9 +16012,15 @@ "value": "Primary", "type": "Choice", "label": "Joystick name", - "extraInformation": [ - "Primary", - "Secondary" + "choices": [ + { + "label": "Primary", + "value": "Primary" + }, + { + "label": "Secondary", + "value": "Secondary" + } ], "name": "JoystickIdentifier" }, @@ -15584,6 +16039,7 @@ "extraInformation": [ "Thumb" ], + "choices": [], "hidden": true, "name": "ThumbAnchorOrigin" }, @@ -15603,6 +16059,7 @@ "extraInformation": [ "Thumb" ], + "choices": [], "hidden": true, "name": "ThumbIsScaledProportionally" }, @@ -15621,8 +16078,7 @@ "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 93cadd2a2..1d9045092 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.8.4", + "version": "1.9.0", "description": [ "Multitouch joysticks are objects showing a joystick on the screen, useful for mobile. They work like a physical gamepad:", "- 4 or 8 directions", @@ -2843,11 +2843,11 @@ "objectGroups": [] }, { - "description": "Check if a button is pressed on a gamepad.", - "fullName": "Multitouch controller button pressed", + "description": "Check if a button was just pressed on a multitouch controller.", + "fullName": "Multitouch controller button just pressed", "functionType": "Condition", - "name": "IsButtonPressed", - "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", + "name": "IsButtonJustPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ was just pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -2859,7 +2859,73 @@ "parameters": [ "Controllers[ControllerIdentifier].Buttons[Button].State", "=", - "\"Pressed\"" + "\"JustPressed\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier", + "type": "expression" + }, + { + "description": "Button name", + "name": "Button", + "supplementaryInformation": "[\"A\",\"CROSS\",\"B\",\"CIRCLE\",\"X\",\"SQUARE\",\"Y\",\"TRIANGLE\",\"LB\",\"L1\",\"RB\",\"R1\",\"LT\",\"L2\",\"RT\",\"R2\",\"UP\",\"DOWN\",\"LEFT\",\"RIGHT\",\"BACK\",\"SHARE\",\"START\",\"OPTIONS\",\"CLICK_STICK_LEFT\",\"CLICK_STICK_RIGHT\",\"PS_BUTTON\",\"CLICK_TOUCHPAD\"]", + "type": "string" + } + ], + "objectGroups": [] + }, + { + "description": "Check if a button is pressed on a multitouch controller.", + "fullName": "Multitouch controller button pressed", + "functionType": "Condition", + "name": "IsButtonPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::Or" + }, + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"Pressed\"" + ] + }, + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"JustPressed\"" + ] + } ] } ], @@ -2891,7 +2957,7 @@ "objectGroups": [] }, { - "description": "Check if a button is released on a gamepad.", + "description": "Check if a button is released on a multitouch controller.", "fullName": "Multitouch controller button released", "functionType": "Condition", "name": "IsButtonReleased", @@ -2977,7 +3043,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"JustPressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -5467,11 +5533,11 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::IsReleased" + "value": "BooleanVariable" }, "parameters": [ - "Object", - "Behavior", + "IsReleased", + "True", "" ] } @@ -5500,6 +5566,44 @@ } ] }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "False", + "" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + }, + "parameters": [ + "Object", + "Behavior", + "\"Pressed\"", + "" + ] + } + ] + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ @@ -5592,7 +5696,17 @@ "parameters": [ "Object", "Behavior", - "\"Pressed\"", + "\"JustPressed\"", + "" + ] + }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "True", "" ] } @@ -5663,6 +5777,16 @@ "" ] }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "False", + "" + ] + }, { "type": { "value": "SetNumberVariable" @@ -5692,11 +5816,11 @@ "objectGroups": [] }, { - "description": "Check if button is released.", - "fullName": "Button released", + "description": "Check if the button was just pressed.", + "fullName": "Button just pressed", "functionType": "Condition", - "name": "IsReleased", - "sentence": "Button _PARAM0_ is released", + "name": "IsJustPressed", + "sentence": "Button _PARAM0_ was just pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -5706,7 +5830,7 @@ "value": "BooleanVariable" }, "parameters": [ - "IsReleased", + "IsJustPressed", "True", "" ] @@ -5740,7 +5864,7 @@ "objectGroups": [] }, { - "description": "Check if button is pressed.", + "description": "Check if the button is pressed.", "fullName": "Button pressed", "functionType": "Condition", "name": "IsPressed", @@ -5787,6 +5911,54 @@ ], "objectGroups": [] }, + { + "description": "Check if the button is released.", + "fullName": "Button released", + "functionType": "Condition", + "name": "IsReleased", + "sentence": "Button _PARAM0_ is released", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsReleased", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "type": "behavior" + } + ], + "objectGroups": [] + }, { "fullName": "Button state", "functionType": "Action", @@ -5828,7 +6000,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"JustPressed\",\"Pressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -5869,6 +6041,13 @@ "hidden": true, "name": "IsReleased" }, + { + "value": "", + "type": "Boolean", + "label": "Button just pressed", + "hidden": true, + "name": "IsJustPressed" + }, { "value": "0", "type": "Number", @@ -8283,7 +8462,6 @@ } ], "instances": [], - "editionSettings": {}, "eventsFunctions": [ { "fullName": "", @@ -9492,8 +9670,7 @@ "hidden": true, "name": "ShouldBeHiddenWhenReleased" } - ], - "variants": [] + ] } ] }, diff --git a/examples/space-asteroids/space-asteroids.json b/examples/space-asteroids/space-asteroids.json index 7124c3df2..e8440bb1a 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.8.3", + "version": "1.9.0", "description": [ - "Multitouch joysticks can be used the same way as physical gamepads:", + "Multitouch joysticks are objects showing a joystick on the screen, useful for mobile. They work like a physical gamepad:", "- 4 or 8 directions", "- Analogus pads", "- Player selection", - "- Controls mapping for top-down movement and platformer characters", + "- Automatic \"mapper\" behaviors for 2D and 3D movement behaviors (platformer characters, top-down movement, 3D character etc...). Add one of these to the object with the movement behavior (i.e: the player most of the time) and the behavior will then be controlled automatically by the virtual joystick (it works by reading the multitouch joystick state and simulating controls). No need for additional events to make it work once the behaviors are set up.", "", "There are ready-to-use joysticks in the asset-store [multitouch joysticks pack](https://editor.gdevelop.io/?initial-dialog=asset-store&asset-pack=multitouch-joysticks-multitouch-joysticks)." ], @@ -11282,6 +11282,28 @@ } ], "eventsFunctions": [ + { + "description": "Check if the events are running for the editor.", + "fullName": "Editor is running", + "functionType": "Condition", + "name": "IsInGameEdition", + "private": true, + "sentence": "Events are running for the editor", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const game = runtimeScene.getGame();\r", + "eventsFunctionContext.returnValue = game.isInGameEdition && game.isInGameEdition();" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [], + "objectGroups": [] + }, { "fullName": "Accelerated speed", "functionType": "Expression", @@ -11700,11 +11722,11 @@ "objectGroups": [] }, { - "description": "Check if a button is pressed on a gamepad.", - "fullName": "Multitouch controller button pressed", + "description": "Check if a button was just pressed on a multitouch controller.", + "fullName": "Multitouch controller button just pressed", "functionType": "Condition", - "name": "IsButtonPressed", - "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", + "name": "IsButtonJustPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ was just pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -11716,7 +11738,7 @@ "parameters": [ "Controllers[ControllerIdentifier].Buttons[Button].State", "=", - "\"Pressed\"" + "\"JustPressed\"" ] } ], @@ -11748,7 +11770,73 @@ "objectGroups": [] }, { - "description": "Check if a button is released on a gamepad.", + "description": "Check if a button is pressed on a multitouch controller.", + "fullName": "Multitouch controller button pressed", + "functionType": "Condition", + "name": "IsButtonPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::Or" + }, + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"Pressed\"" + ] + }, + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"JustPressed\"" + ] + } + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier", + "type": "expression" + }, + { + "description": "Button name", + "name": "Button", + "supplementaryInformation": "[\"A\",\"CROSS\",\"B\",\"CIRCLE\",\"X\",\"SQUARE\",\"Y\",\"TRIANGLE\",\"LB\",\"L1\",\"RB\",\"R1\",\"LT\",\"L2\",\"RT\",\"R2\",\"UP\",\"DOWN\",\"LEFT\",\"RIGHT\",\"BACK\",\"SHARE\",\"START\",\"OPTIONS\",\"CLICK_STICK_LEFT\",\"CLICK_STICK_RIGHT\",\"PS_BUTTON\",\"CLICK_TOUCHPAD\"]", + "type": "string" + } + ], + "objectGroups": [] + }, + { + "description": "Check if a button is released on a multitouch controller.", "fullName": "Multitouch controller button released", "functionType": "Condition", "name": "IsButtonReleased", @@ -11834,7 +11922,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"JustPressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -13207,41 +13295,23 @@ "conditions": [ { "type": { - "value": "HasGameJustResumed" + "inverted": true, + "value": "SpriteMultitouchJoystick::IsInGameEdition" }, "parameters": [ + "", "" ] } ], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - } - ] - }, - { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Manage touches", - "source": "", - "type": "BuiltinCommonInstructions::Group", + "actions": [], "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "value": "HasAnyTouchOrMouseStarted" + "value": "HasGameJustResumed" }, "parameters": [ "" @@ -13251,171 +13321,207 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" }, "parameters": [ - "TouchIndex", - "=", - "0" + "Object", + "Behavior", + "" ] } - ], + ] + }, + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Manage touches", + "source": "", + "type": "BuiltinCommonInstructions::Group", "events": [ { - "type": "BuiltinCommonInstructions::Repeat", - "repeatExpression": "StartedTouchOrMouseCount()", - "conditions": [], - "actions": [], + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "HasAnyTouchOrMouseStarted" + }, + "parameters": [ + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchIndex", + "=", + "0" + ] + } + ], "events": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "StartedTouchOrMouseCount()", + "conditions": [], + "actions": [], + "events": [ { - "type": { - "value": "NumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "0" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "0" + ] + }, + { + "type": { + "value": "CollisionPoint" + }, + "parameters": [ + "Object", + "TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)", + "TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "StartedTouchOrMouseId(TouchIndex)" + ] + } ] }, { - "type": { - "value": "CollisionPoint" - }, - "parameters": [ - "Object", - "TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)", - "TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "StartedTouchOrMouseId(TouchIndex)" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchIndex", - "+", - "1" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchIndex", + "+", + "1" + ] + } ] } ] } ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 - }, - "comment": "Move thumb back to center when not being pressed (acts like a spring on a real controller)" - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + }, { - "type": { - "value": "HasTouchEnded" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 }, - "parameters": [ - "", - "TouchId" - ] - } - ], - "actions": [ + "comment": "Move thumb back to center when not being pressed (acts like a spring on a real controller)" + }, { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" - }, - "parameters": [ - "Object", - "Behavior", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "HasTouchEnded" + }, + "parameters": [ + "", + "TouchId" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } ] } - ] - } - ], - "parameters": [] - }, - { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Update joystick position", - "source": "", - "type": "BuiltinCommonInstructions::Group", - "events": [ + ], + "parameters": [] + }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Update joystick position", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ { - "type": { - "value": "NumberVariable" - }, - "parameters": [ - "TouchId", - "!=", - "0" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "!=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickAngle" + }, + "parameters": [ + "Object", + "Behavior", + "AngleBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0))", + "AngleBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0))" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "clamp(2 * DistanceBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0)) / Object.Width(), 0, 1)", + "" + ] + } ] } ], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickAngle" - }, - "parameters": [ - "Object", - "Behavior", - "AngleBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0))", - "AngleBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0))" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "clamp(2 * DistanceBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0)) / Object.Width(), 0, 1)", - "" - ] - } - ] + "parameters": [] } - ], - "parameters": [] + ] } ], "parameters": [ @@ -14290,7 +14396,7 @@ "sharedPropertyDescriptors": [] }, { - "description": "Detect button presses made on a touchscreen.", + "description": "Detect presses made on a touchscreen on the object so it acts like a button and automatically trigger the button having the same identifier for the mapper behaviors.", "fullName": "Multitouch button", "name": "MultitouchButton", "objectType": "", @@ -14306,11 +14412,49 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::IsReleased" + "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": [ - "Object", - "Behavior", + "IsJustPressed", + "True", "" ] } @@ -14321,7 +14465,7 @@ "value": "SetBooleanVariable" }, "parameters": [ - "IsReleased", + "IsJustPressed", "False", "" ] @@ -14333,7 +14477,7 @@ "parameters": [ "Object", "Behavior", - "\"Idle\"", + "\"Pressed\"", "" ] } @@ -14431,7 +14575,17 @@ "parameters": [ "Object", "Behavior", - "\"Pressed\"", + "\"JustPressed\"", + "" + ] + }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "True", "" ] } @@ -14502,6 +14656,16 @@ "" ] }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "False", + "" + ] + }, { "type": { "value": "SetNumberVariable" @@ -14531,11 +14695,11 @@ "objectGroups": [] }, { - "description": "Check if button is released.", - "fullName": "Button released", + "description": "Check if the button was just pressed.", + "fullName": "Button just pressed", "functionType": "Condition", - "name": "IsReleased", - "sentence": "Button _PARAM0_ is released", + "name": "IsJustPressed", + "sentence": "Button _PARAM0_ was just pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -14545,7 +14709,7 @@ "value": "BooleanVariable" }, "parameters": [ - "IsReleased", + "IsJustPressed", "True", "" ] @@ -14579,7 +14743,7 @@ "objectGroups": [] }, { - "description": "Check if button is pressed.", + "description": "Check if the button is pressed.", "fullName": "Button pressed", "functionType": "Condition", "name": "IsPressed", @@ -14626,6 +14790,54 @@ ], "objectGroups": [] }, + { + "description": "Check if the button is released.", + "fullName": "Button released", + "functionType": "Condition", + "name": "IsReleased", + "sentence": "Button _PARAM0_ is released", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsReleased", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "type": "behavior" + } + ], + "objectGroups": [] + }, { "fullName": "Button state", "functionType": "Action", @@ -14667,7 +14879,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"JustPressed\",\"Pressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -14708,6 +14920,13 @@ "hidden": true, "name": "IsReleased" }, + { + "value": "", + "type": "Boolean", + "label": "Button just pressed", + "hidden": true, + "name": "IsJustPressed" + }, { "value": "0", "type": "Number", @@ -14905,6 +15124,7 @@ "extraInformation": [ "PlatformBehavior::PlatformerObjectBehavior" ], + "choices": [], "name": "Property" }, { @@ -14918,9 +15138,15 @@ "type": "Choice", "label": "Joystick name", "group": "Controls", - "extraInformation": [ - "Primary", - "Secondary" + "choices": [ + { + "label": "Primary", + "value": "Primary" + }, + { + "label": "Secondary", + "value": "Secondary" + } ], "name": "JoystickIdentifier" }, @@ -15041,6 +15267,7 @@ "extraInformation": [ "Physics3D::PhysicsCharacter3D" ], + "choices": [], "name": "PhysicsCharacter3D" }, { @@ -15054,9 +15281,15 @@ "type": "Choice", "label": "Walk joystick", "group": "Controls", - "extraInformation": [ - "Primary", - "Secondary" + "choices": [ + { + "label": "Primary", + "value": "Primary" + }, + { + "label": "Secondary", + "value": "Secondary" + } ], "name": "JoystickIdentifier" }, @@ -15166,6 +15399,7 @@ "extraInformation": [ "Physics3D::PhysicsCharacter3D" ], + "choices": [], "name": "PhysicsCharacter3D" }, { @@ -15179,9 +15413,15 @@ "type": "Choice", "label": "Walk joystick", "group": "Controls", - "extraInformation": [ - "Primary", - "Secondary" + "choices": [ + { + "label": "Primary", + "value": "Primary" + }, + { + "label": "Secondary", + "value": "Secondary" + } ], "name": "JoystickIdentifier" }, @@ -16124,6 +16364,7 @@ "extraInformation": [ "Scene3D::Base3DBehavior" ], + "choices": [], "name": "Object3D" }, { @@ -16137,9 +16378,15 @@ "type": "Choice", "label": "Camera joystick", "group": "Controls", - "extraInformation": [ - "Primary", - "Secondary" + "choices": [ + { + "label": "Primary", + "value": "Primary" + }, + { + "label": "Secondary", + "value": "Secondary" + } ], "name": "CameraStick" }, @@ -16355,6 +16602,7 @@ "extraInformation": [ "Physics3D::PhysicsCar3D" ], + "choices": [], "name": "PhysicsCar3D" }, { @@ -16368,9 +16616,15 @@ "type": "Choice", "label": "Steer joystick", "group": "Controls", - "extraInformation": [ - "Primary", - "Secondary" + "choices": [ + { + "label": "Primary", + "value": "Primary" + }, + { + "label": "Secondary", + "value": "Secondary" + } ], "name": "SteerJoystickIdentifier" }, @@ -16379,9 +16633,15 @@ "type": "Choice", "label": "Speed joystick", "group": "Controls", - "extraInformation": [ - "Primary", - "Secondary" + "choices": [ + { + "label": "Primary", + "value": "Primary" + }, + { + "label": "Secondary", + "value": "Secondary" + } ], "name": "SpeedJoystickIdentifier" }, @@ -16914,6 +17174,7 @@ "extraInformation": [ "TopDownMovementBehavior::TopDownMovementBehavior" ], + "choices": [], "name": "TopDownMovement" }, { @@ -16926,9 +17187,15 @@ "value": "Primary", "type": "Choice", "label": "Joystick name", - "extraInformation": [ - "Primary", - "Secondary" + "choices": [ + { + "label": "Primary", + "value": "Primary" + }, + { + "label": "Secondary", + "value": "Secondary" + } ], "name": "JoystickIdentifier" }, @@ -16937,10 +17204,19 @@ "type": "Choice", "label": "Stick mode", "group": "Controls", - "extraInformation": [ - "Analog", - "360°", - "8 Directions" + "choices": [ + { + "label": "Analog", + "value": "Analog" + }, + { + "label": "360°", + "value": "360°" + }, + { + "label": "8 Directions", + "value": "8 Directions" + } ], "name": "StickMode" } @@ -17181,74 +17457,92 @@ "name": "doStepPostEvents", "sentence": "", "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "MettreAutour" - }, - "parameters": [ - "Thumb", - "Border", - "Border.MultitouchJoystick::JoystickForce() * Border.Width() / 2", - "Border.MultitouchJoystick::JoystickAngle()" - ] - } - ] - }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ - { - "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "ShouldBeHiddenWhenReleased", - "True", - "" - ] - }, { "type": { "inverted": true, - "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::IsPressed" + "value": "SpriteMultitouchJoystick::IsInGameEdition" }, "parameters": [ - "Object", + "", "" ] } ], - "actions": [ - { - "type": { - "value": "Cache" - }, - "parameters": [ - "Object" - ] - }, + "actions": [], + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::ActivateControl" - }, - "parameters": [ - "Object", - "no", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "MettreAutour" + }, + "parameters": [ + "Thumb", + "Border", + "Border.MultitouchJoystick::JoystickForce() * Border.Width() / 2", + "Border.MultitouchJoystick::JoystickAngle()" + ] + } ] }, { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "ShouldBeHiddenWhenReleased", - "False", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "ShouldBeHiddenWhenReleased", + "True", + "" + ] + }, + { + "type": { + "inverted": true, + "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::IsPressed" + }, + "parameters": [ + "Object", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "Cache" + }, + "parameters": [ + "Object" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::ActivateControl" + }, + "parameters": [ + "Object", + "no", + "" + ] + }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "ShouldBeHiddenWhenReleased", + "False", + "" + ] + } ] } ] @@ -18189,9 +18483,15 @@ "value": "Primary", "type": "Choice", "label": "Joystick name", - "extraInformation": [ - "Primary", - "Secondary" + "choices": [ + { + "label": "Primary", + "value": "Primary" + }, + { + "label": "Secondary", + "value": "Secondary" + } ], "name": "JoystickIdentifier" }, @@ -18210,6 +18510,7 @@ "extraInformation": [ "Thumb" ], + "choices": [], "hidden": true, "name": "ThumbAnchorOrigin" }, @@ -18229,6 +18530,7 @@ "extraInformation": [ "Thumb" ], + "choices": [], "hidden": true, "name": "ThumbIsScaledProportionally" }, @@ -18247,8 +18549,7 @@ "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 c8fd222ae..25327a419 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.8.4", + "version": "1.9.0", "description": [ "Multitouch joysticks are objects showing a joystick on the screen, useful for mobile. They work like a physical gamepad:", "- 4 or 8 directions", @@ -2473,11 +2473,11 @@ "objectGroups": [] }, { - "description": "Check if a button is pressed on a gamepad.", - "fullName": "Multitouch controller button pressed", + "description": "Check if a button was just pressed on a multitouch controller.", + "fullName": "Multitouch controller button just pressed", "functionType": "Condition", - "name": "IsButtonPressed", - "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", + "name": "IsButtonJustPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ was just pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -2489,7 +2489,73 @@ "parameters": [ "Controllers[ControllerIdentifier].Buttons[Button].State", "=", - "\"Pressed\"" + "\"JustPressed\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier", + "type": "expression" + }, + { + "description": "Button name", + "name": "Button", + "supplementaryInformation": "[\"A\",\"CROSS\",\"B\",\"CIRCLE\",\"X\",\"SQUARE\",\"Y\",\"TRIANGLE\",\"LB\",\"L1\",\"RB\",\"R1\",\"LT\",\"L2\",\"RT\",\"R2\",\"UP\",\"DOWN\",\"LEFT\",\"RIGHT\",\"BACK\",\"SHARE\",\"START\",\"OPTIONS\",\"CLICK_STICK_LEFT\",\"CLICK_STICK_RIGHT\",\"PS_BUTTON\",\"CLICK_TOUCHPAD\"]", + "type": "string" + } + ], + "objectGroups": [] + }, + { + "description": "Check if a button is pressed on a multitouch controller.", + "fullName": "Multitouch controller button pressed", + "functionType": "Condition", + "name": "IsButtonPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::Or" + }, + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"Pressed\"" + ] + }, + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"JustPressed\"" + ] + } ] } ], @@ -2521,7 +2587,7 @@ "objectGroups": [] }, { - "description": "Check if a button is released on a gamepad.", + "description": "Check if a button is released on a multitouch controller.", "fullName": "Multitouch controller button released", "functionType": "Condition", "name": "IsButtonReleased", @@ -2607,7 +2673,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"JustPressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -5097,11 +5163,11 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::IsReleased" + "value": "BooleanVariable" }, "parameters": [ - "Object", - "Behavior", + "IsReleased", + "True", "" ] } @@ -5130,6 +5196,44 @@ } ] }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "False", + "" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + }, + "parameters": [ + "Object", + "Behavior", + "\"Pressed\"", + "" + ] + } + ] + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ @@ -5222,7 +5326,17 @@ "parameters": [ "Object", "Behavior", - "\"Pressed\"", + "\"JustPressed\"", + "" + ] + }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "True", "" ] } @@ -5293,6 +5407,16 @@ "" ] }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "False", + "" + ] + }, { "type": { "value": "SetNumberVariable" @@ -5322,11 +5446,11 @@ "objectGroups": [] }, { - "description": "Check if button is released.", - "fullName": "Button released", + "description": "Check if the button was just pressed.", + "fullName": "Button just pressed", "functionType": "Condition", - "name": "IsReleased", - "sentence": "Button _PARAM0_ is released", + "name": "IsJustPressed", + "sentence": "Button _PARAM0_ was just pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -5336,7 +5460,7 @@ "value": "BooleanVariable" }, "parameters": [ - "IsReleased", + "IsJustPressed", "True", "" ] @@ -5370,7 +5494,7 @@ "objectGroups": [] }, { - "description": "Check if button is pressed.", + "description": "Check if the button is pressed.", "fullName": "Button pressed", "functionType": "Condition", "name": "IsPressed", @@ -5417,6 +5541,54 @@ ], "objectGroups": [] }, + { + "description": "Check if the button is released.", + "fullName": "Button released", + "functionType": "Condition", + "name": "IsReleased", + "sentence": "Button _PARAM0_ is released", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsReleased", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "type": "behavior" + } + ], + "objectGroups": [] + }, { "fullName": "Button state", "functionType": "Action", @@ -5458,7 +5630,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"JustPressed\",\"Pressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -5499,6 +5671,13 @@ "hidden": true, "name": "IsReleased" }, + { + "value": "", + "type": "Boolean", + "label": "Button just pressed", + "hidden": true, + "name": "IsJustPressed" + }, { "value": "0", "type": "Number", @@ -7913,7 +8092,6 @@ } ], "instances": [], - "editionSettings": {}, "eventsFunctions": [ { "fullName": "", @@ -9122,8 +9300,7 @@ "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 0d83ac72a..3877f9483 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.8.4", + "version": "1.9.0", "description": [ "Multitouch joysticks are objects showing a joystick on the screen, useful for mobile. They work like a physical gamepad:", "- 4 or 8 directions", @@ -1926,11 +1926,11 @@ "objectGroups": [] }, { - "description": "Check if a button is pressed on a gamepad.", - "fullName": "Multitouch controller button pressed", + "description": "Check if a button was just pressed on a multitouch controller.", + "fullName": "Multitouch controller button just pressed", "functionType": "Condition", - "name": "IsButtonPressed", - "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", + "name": "IsButtonJustPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ was just pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -1942,7 +1942,73 @@ "parameters": [ "Controllers[ControllerIdentifier].Buttons[Button].State", "=", - "\"Pressed\"" + "\"JustPressed\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier", + "type": "expression" + }, + { + "description": "Button name", + "name": "Button", + "supplementaryInformation": "[\"A\",\"CROSS\",\"B\",\"CIRCLE\",\"X\",\"SQUARE\",\"Y\",\"TRIANGLE\",\"LB\",\"L1\",\"RB\",\"R1\",\"LT\",\"L2\",\"RT\",\"R2\",\"UP\",\"DOWN\",\"LEFT\",\"RIGHT\",\"BACK\",\"SHARE\",\"START\",\"OPTIONS\",\"CLICK_STICK_LEFT\",\"CLICK_STICK_RIGHT\",\"PS_BUTTON\",\"CLICK_TOUCHPAD\"]", + "type": "string" + } + ], + "objectGroups": [] + }, + { + "description": "Check if a button is pressed on a multitouch controller.", + "fullName": "Multitouch controller button pressed", + "functionType": "Condition", + "name": "IsButtonPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::Or" + }, + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"Pressed\"" + ] + }, + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"JustPressed\"" + ] + } ] } ], @@ -1974,7 +2040,7 @@ "objectGroups": [] }, { - "description": "Check if a button is released on a gamepad.", + "description": "Check if a button is released on a multitouch controller.", "fullName": "Multitouch controller button released", "functionType": "Condition", "name": "IsButtonReleased", @@ -2060,7 +2126,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"JustPressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -4550,11 +4616,11 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::IsReleased" + "value": "BooleanVariable" }, "parameters": [ - "Object", - "Behavior", + "IsReleased", + "True", "" ] } @@ -4583,6 +4649,44 @@ } ] }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "False", + "" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + }, + "parameters": [ + "Object", + "Behavior", + "\"Pressed\"", + "" + ] + } + ] + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ @@ -4675,7 +4779,17 @@ "parameters": [ "Object", "Behavior", - "\"Pressed\"", + "\"JustPressed\"", + "" + ] + }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "True", "" ] } @@ -4746,6 +4860,16 @@ "" ] }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "False", + "" + ] + }, { "type": { "value": "SetNumberVariable" @@ -4775,11 +4899,11 @@ "objectGroups": [] }, { - "description": "Check if button is released.", - "fullName": "Button released", + "description": "Check if the button was just pressed.", + "fullName": "Button just pressed", "functionType": "Condition", - "name": "IsReleased", - "sentence": "Button _PARAM0_ is released", + "name": "IsJustPressed", + "sentence": "Button _PARAM0_ was just pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -4789,7 +4913,7 @@ "value": "BooleanVariable" }, "parameters": [ - "IsReleased", + "IsJustPressed", "True", "" ] @@ -4823,7 +4947,7 @@ "objectGroups": [] }, { - "description": "Check if button is pressed.", + "description": "Check if the button is pressed.", "fullName": "Button pressed", "functionType": "Condition", "name": "IsPressed", @@ -4870,6 +4994,54 @@ ], "objectGroups": [] }, + { + "description": "Check if the button is released.", + "fullName": "Button released", + "functionType": "Condition", + "name": "IsReleased", + "sentence": "Button _PARAM0_ is released", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsReleased", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "type": "behavior" + } + ], + "objectGroups": [] + }, { "fullName": "Button state", "functionType": "Action", @@ -4911,7 +5083,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"JustPressed\",\"Pressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -4952,6 +5124,13 @@ "hidden": true, "name": "IsReleased" }, + { + "value": "", + "type": "Boolean", + "label": "Button just pressed", + "hidden": true, + "name": "IsJustPressed" + }, { "value": "0", "type": "Number", @@ -7366,7 +7545,6 @@ } ], "instances": [], - "editionSettings": {}, "eventsFunctions": [ { "fullName": "", @@ -8575,8 +8753,7 @@ "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 829a17a3d..ca9694b7b 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": "", + "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.4.0", + "version": "1.9.0", "description": [ - "Multitouch joysticks can be used the same way as physical gamepads:", + "Multitouch joysticks are objects showing a joystick on the screen, useful for mobile. They work like a physical gamepad:", "- 4 or 8 directions", "- Analogus pads", "- Player selection", - "- Controls mapping for top-down movement and platformer characters", + "- Automatic \"mapper\" behaviors for 2D and 3D movement behaviors (platformer characters, top-down movement, 3D character etc...). Add one of these to the object with the movement behavior (i.e: the player most of the time) and the behavior will then be controlled automatically by the virtual joystick (it works by reading the multitouch joystick state and simulating controls). No need for additional events to make it work once the behaviors are set up.", "", "There are ready-to-use joysticks in the asset-store [multitouch joysticks pack](https://editor.gdevelop.io/?initial-dialog=asset-store&asset-pack=multitouch-joysticks-multitouch-joysticks)." ], @@ -8005,153 +8005,33 @@ ], "eventsFunctions": [ { - "description": "Check if a button is pressed on a gamepad.", - "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": "StringVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Buttons[Button].State", - "=", - "\"Pressed\"" - ] - } - ], - "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 gamepad.", - "fullName": "Multitouch controller button released", + "description": "Check if the events are running for the editor.", + "fullName": "Editor is running", "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", + "name": "IsInGameEdition", "private": true, - "sentence": "Mark _PARAM2_ button as _PARAM3_ for multitouch controller _PARAM1_", + "sentence": "Events are running for the editor", "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" + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const game = runtimeScene.getGame();\r", + "eventsFunctionContext.returnValue = game.isInGameEdition && game.isInGameEdition();" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false } ], + "parameters": [], "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", + "fullName": "Accelerated speed", + "functionType": "Expression", + "name": "AcceleratedSpeed", "private": true, - "sentence": "Change the dead zone of multitouch joystick _PARAM2_ of multitouch controller _PARAM1_ to _PARAM3_", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -8162,1203 +8042,3781 @@ "value": "SetNumberVariable" }, "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].DeadZone", + "AcceleratedSpeed", "=", - "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)" + "CurrentSpeed" ] } - ] - } - ], - "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": [ + ], + "events": [ { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ + "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": [ + ] + } + ], + "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": [] + }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "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": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Right\"" + "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" }, { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo4Way" - }, - "parameters": [ - "", - "=", - "0", - "Angle", - "" - ] + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" + }, + { + "description": "Angle", + "name": "Value", + "type": "expression" } ], - "actions": [ + "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": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" + "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": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "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": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Down\"" + "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" }, { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo4Way" - }, - "parameters": [ - "", - "=", - "1", - "Angle", - "" + "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" + ] + } ] } ], - "actions": [ + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" + }, { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "description": "Direction", + "name": "Direction", + "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\"]", + "type": "stringWithSelector" } - ] + ], + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Left\"" - ] - }, + "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": { - "value": "SpriteMultitouchJoystick::AngleTo4Way" - }, - "parameters": [ - "", - "=", - "2", - "Angle", - "" + "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" + ] + } ] } ], - "actions": [ + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - }, - { - "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", - "" - ] + "description": "Direction", + "name": "Direction", + "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\",\"UpLeft\",\"UpRight\",\"DownLeft\",\"DownRight\"]", + "type": "stringWithSelector" } ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Angle", - "name": "Angle", - "type": "expression" + "objectGroups": [] }, { - "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\"" - ] - }, + "description": "Check if a joystick is pressed.", + "fullName": "Joystick pressed", + "functionType": "Condition", + "name": "IsPressed", + "sentence": "Joystick _PARAM0_ is pressed", + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "0", - "Angle", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "!=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } ] } ], - "actions": [ + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } - ] + ], + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"DownRight\"" - ] - }, + "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": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "1", - "Angle", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "0", + "" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "0" + ] + } ] } ], - "actions": [ + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } - ] + ], + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Down\"" - ] - }, + "description": "the multitouch controller identifier.", + "fullName": "Multitouch controller identifier", + "functionType": "ExpressionAndCondition", + "group": "Multitouch Joystick configuration", + "name": "ControllerIdentifier", + "sentence": "the multitouch controller identifier", + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "2", - "Angle", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "ControllerIdentifier" + ] + } ] } ], - "actions": [ + "expressionType": { + "type": "expression" + }, + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } - ] + ], + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"DownLeft\"" - ] - }, + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "ControllerIdentifier", + "name": "SetControllerIdentifier", + "sentence": "", + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "3", - "Angle", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "ControllerIdentifier", + "=", + "Value" + ] + } ] } ], - "actions": [ + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } - ] + ], + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Left\"" - ] - }, + "description": "the joystick name.", + "fullName": "Joystick name", + "functionType": "ExpressionAndCondition", + "group": "Multitouch Joystick configuration", + "name": "JoystickIdentifier", + "sentence": "the joystick name", + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "4", - "Angle", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnString" + }, + "parameters": [ + "JoystickIdentifier" + ] + } ] } ], - "actions": [ + "expressionType": { + "type": "string" + }, + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } - ] + ], + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"UpLeft\"" - ] - }, + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "JoystickIdentifier", + "name": "SetJoystickIdentifier", + "sentence": "", + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "5", - "Angle", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "JoystickIdentifier", + "=", + "Value" + ] + } ] } ], - "actions": [ + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } - ] + ], + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Up\"" - ] - }, + "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": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "6", - "Angle", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "DeadZoneRadius" + ] + } ] } ], - "actions": [ + "expressionType": { + "type": "expression" + }, + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } - ] + ], + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"UpRight\"" - ] - }, + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "DeadZoneRadius", + "name": "SetDeadZoneRadius", + "sentence": "", + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "7", - "Angle", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "DeadZoneRadius", + "=", + "Value" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::SetDeadZone" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JoystickIdentifier", + "Value", + "" + ] + } ] } ], - "actions": [ + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } - ] - } - ], - "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" + ], + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::JoystickForce" - }, - "parameters": [ - "", - ">", - "0", - "ControllerIdentifier", - "JoystickIdentifier", - "" - ] - }, + "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": { - "value": "SpriteMultitouchJoystick::IsAngleIn4WayDirection" - }, - "parameters": [ - "", - "SpriteMultitouchJoystick::JoystickAngle(ControllerIdentifier, JoystickIdentifier)", - "Direction", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "Value" + ] + } ] } ], - "actions": [ + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" + }, + { + "description": "Touch identifier", + "name": "Value", + "type": "expression" } - ] + ], + "objectGroups": [] } ], - "parameters": [ + "propertyDescriptors": [ { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" + "value": "1", + "type": "Number", + "label": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier" }, { - "description": "Joystick name", - "name": "JoystickIdentifier", - "supplementaryInformation": "[\"Primary\",\"Secondary\"]", - "type": "stringWithSelector" + "value": "Primary", + "type": "String", + "label": "Joystick name", + "name": "JoystickIdentifier" }, { - "description": "Direction", - "name": "Direction", - "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\"]", - "type": "stringWithSelector" + "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" } ], - "objectGroups": [] + "sharedPropertyDescriptors": [] }, { - "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" - }, + "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": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "fullName": "", + "functionType": "Action", + "name": "doStepPreEvents", + "sentence": "", + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::JoystickForce" - }, - "parameters": [ - "", - ">", - "0", - "ControllerIdentifier", - "JoystickIdentifier", - "" + "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": { - "value": "SpriteMultitouchJoystick::IsAngleIn8WayDirection" - }, - "parameters": [ - "", - "SpriteMultitouchJoystick::JoystickAngle(ControllerIdentifier, JoystickIdentifier)", - "Direction", - "" + "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" + ] + } ] } ], - "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": [ + "parameters": [ { - "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": [ + "description": "Object", + "name": "Object", + "type": "object" + }, { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "max(0, Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].Force - SpriteMultitouchJoystick::DeadZone(ControllerIdentifier, JoystickIdentifier)) / (1 - SpriteMultitouchJoystick::DeadZone(ControllerIdentifier, JoystickIdentifier))" - ] + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "type": "behavior" } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" + ], + "objectGroups": [] }, { - "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": [ + "description": "Check if the button was just pressed.", + "fullName": "Button just pressed", + "functionType": "Condition", + "name": "IsJustPressed", + "sentence": "Button _PARAM0_ was just pressed", + "events": [ { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].Force", - "=", - "Value" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } ] } - ] - } - ], - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" - }, - { - "description": "Joystick name", - "name": "JoystickIdentifier", - "type": "string" + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "type": "behavior" + } + ], + "objectGroups": [] }, { - "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": [ + "description": "Check if the button is pressed.", + "fullName": "Button pressed", + "functionType": "Condition", + "name": "IsPressed", + "sentence": "Button _PARAM0_ is pressed", + "events": [ { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier)" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "!=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } ] } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "type": "behavior" + } + ], + "objectGroups": [] }, { - "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": "Check if the button is released.", + "fullName": "Button released", + "functionType": "Condition", + "name": "IsReleased", + "sentence": "Button _PARAM0_ is released", + "events": [ { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].Angle" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsReleased", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } ] } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "type": "behavior" + } + ], + "objectGroups": [] }, { - "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": [ + "fullName": "Button state", + "functionType": "Action", + "name": "SetButtonState", + "private": true, + "sentence": "Mark the button _PARAM0_ as _PARAM2_", + "events": [ { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].Angle", - "=", - "Value" + "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": [] } ], - "parameters": [ + "propertyDescriptors": [ { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" + "value": "1", + "type": "Number", + "label": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier" }, { - "description": "Joystick name", - "name": "JoystickIdentifier", - "type": "string" + "value": "A", + "type": "String", + "label": "Button identifier", + "name": "ButtonIdentifier" }, { - "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": [ - "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" + "value": "0", + "type": "Number", + "label": "TouchID", + "hidden": true, + "name": "TouchId" }, { - "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": [ + "value": "", + "type": "Number", + "label": "", + "hidden": true, + "name": "TouchIndex" + }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "SpriteMultitouchJoystick::JoystickForce(ControllerIdentifier, JoystickIdentifier) * sin(ToRad(SpriteMultitouchJoystick::JoystickAngle(ControllerIdentifier, JoystickIdentifier)))" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ + "value": "", + "type": "Boolean", + "label": "Button released", + "hidden": true, + "name": "IsReleased" + }, { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" + "value": "", + "type": "Boolean", + "label": "Button just pressed", + "hidden": true, + "name": "IsJustPressed" }, { - "description": "Joystick name", - "name": "JoystickIdentifier", - "supplementaryInformation": "[\"Primary\",\"Secondary\"]", - "type": "stringWithSelector" + "value": "0", + "type": "Number", + "unit": "Pixel", + "label": "Triggering circle radius", + "description": "This circle adds up to the object collision mask.", + "name": "Radius" } ], - "objectGroups": [] - } - ], - "eventsBasedBehaviors": [ + "sharedPropertyDescriptors": [] + }, { - "description": "Joystick that can be controlled by interacting with a touchscreen.", - "fullName": "Multitouch Joystick", - "name": "MultitouchJoystick", + "description": "Control a platformer character with a multitouch controller.", + "fullName": "Platformer multitouch controller mapper", + "name": "PlatformerMultitouchMapper", "objectType": "", - "private": true, + "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", "functionType": "Action", - "name": "onCreated", + "name": "doStepPreEvents", "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ + "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::SetDeadZone" + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" }, "parameters": [ "", "ControllerIdentifier", "JoystickIdentifier", - "DeadZoneRadius", + "\"Left\"", "" ] - }, + } + ], + "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" + "value": "PlatformBehavior::SimulateLeftKey" }, "parameters": [ "Object", - "Behavior", + "Property" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JoystickIdentifier", + "\"Right\"", "" ] } + ], + "actions": [ + { + "type": { + "value": "PlatformBehavior::SimulateRightKey" + }, + "parameters": [ + "Object", + "Property" + ] + } ] - } - ], - "parameters": [ + }, { - "description": "Object", - "name": "Object", - "type": "object" + "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" + ] + } + ] }, { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "Action", - "name": "onDeActivate", - "sentence": "", - "events": [ + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JoystickIdentifier", + "\"Down\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "PlatformBehavior::SimulateDownKey" + }, + "parameters": [ + "Object", + "Property" + ] + } + ] + }, { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::IsButtonPressed" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JumpButton", + "\"Down\"" + ] + } + ], "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" + "value": "PlatformBehavior::SimulateJumpKey" }, "parameters": [ "Object", - "Behavior", - "" + "Property" ] } ] @@ -9373,12 +11831,64 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::PlatformerMultitouchMapper", "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", @@ -9390,262 +11900,71 @@ "conditions": [ { "type": { - "value": "HasGameJustResumed" + "value": "SpriteMultitouchJoystick::StickForce" }, "parameters": [ + "", + ">", + "0", + "ControllerIdentifier", + "JoystickIdentifier", "" ] } ], "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": "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 - }, - "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)", - "" - ] - } + { + "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)" ] } - ], - "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": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::IsButtonPressed" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JumpButton", + "\"Down\"" + ] + } + ], "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" }, "parameters": [ - "max(0, JoystickForce - DeadZoneRadius) / (1 - DeadZoneRadius)" + "Object", + "PhysicsCharacter3D" ] } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -9655,45 +11974,124 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "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": "ActionWithOperator", - "getterName": "JoystickForce", - "name": "SetJoystickForce", - "private": true, + "functionType": "Action", + "name": "doStepPreEvents", "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::StickForce" + }, + "parameters": [ + "", + ">", + "0", + "ControllerIdentifier", + "JoystickIdentifier", + "" + ] + } + ], "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickForce" + "value": "Physics3D::PhysicsCharacter3D::SimulateStick" }, "parameters": [ "Object", - "Behavior", - "=", - "Value" + "PhysicsCharacter3D", + "SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier)", + "SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier)" ] - }, + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::SetJoystickForce" + "value": "SpriteMultitouchJoystick::IsButtonPressed" }, "parameters": [ "", "ControllerIdentifier", - "JoystickIdentifier", - "JoystickForce", - "" + "JumpButton", + "\"Down\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" + }, + "parameters": [ + "Object", + "PhysicsCharacter3D" ] } ] @@ -9708,37 +12106,151 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::Shooter3DMultitouchMapper", "type": "behavior" } ], "objectGroups": [] + } + ], + "propertyDescriptors": [ + { + "value": "", + "type": "Behavior", + "label": "3D physics character", + "extraInformation": [ + "Physics3D::PhysicsCharacter3D" + ], + "choices": [], + "name": "PhysicsCharacter3D" }, { - "description": "Return the angle the joystick is pointing towards (Range: -180 to 180).", - "fullName": "Joystick angle", - "functionType": "Expression", - "name": "JoystickAngle", + "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": "SetReturnNumber" + "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": [ - "JoystickAngle" + "Object", + "Behavior", + "" ] } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -9748,19 +12260,20 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], "objectGroups": [] }, { - "description": "Change the angle the joystick is pointing towards (Range: -180 to 180).", - "fullName": "Joystick angle", + "description": "Move the camera to look though _PARAM1_ eyes. The object must look to the right when all its angles are 0 and the top of its head be toward Z+.", + "fullName": "Look through object eyes", "functionType": "Action", - "name": "SetJoystickAngle", + "group": "Layers and cameras", + "name": "LookFromObjectEyes", "private": true, - "sentence": "Change the joystick angle of _PARAM0_ to _PARAM2_", + "sentence": "Move the camera to look though _PARAM0_ eyes", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -9768,24 +12281,61 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickAngle" + "value": "CentreCamera" }, "parameters": [ + "", "Object", - "Behavior", + "", + "Object.Layer()", + "" + ] + }, + { + "type": { + "value": "Scene3D::SetCameraZ" + }, + "parameters": [ + "", "=", - "Value" + "Object.Object3D::Z() + Object.Object3D::Depth() + OffsetZ", + "", + "" ] }, { "type": { - "value": "SpriteMultitouchJoystick::SetJoystickAngle" + "value": "Scene3D::SetCameraRotationX" }, "parameters": [ "", - "ControllerIdentifier", - "JoystickIdentifier", - "JoystickAngle", + "=", + "- 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()", "" ] } @@ -9801,23 +12351,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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": "", + "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", @@ -9828,7 +12374,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "Object.Behavior::JoystickForce() * cos(ToRad(Object.Behavior::JoystickAngle()))" + "HorizontalRotationSpeedMax" ] } ] @@ -9846,17 +12392,17 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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", + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "HorizontalRotationSpeedMax", + "name": "SetHorizontalRotationSpeedMax", "sentence": "", "events": [ { @@ -9865,18 +12411,17 @@ "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "SetNumberVariable" }, "parameters": [ - "Object.Behavior::JoystickForce() * sin(ToRad(Object.Behavior::JoystickAngle()))" + "HorizontalRotationSpeedMax", + "=", + "Value" ] } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -9886,58 +12431,38 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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_", + "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": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::JoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - ">", - "0", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::IsAngleIn4WayDirection" - }, - "parameters": [ - "", - "JoystickAngle", - "Direction", - "" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "SetReturnBoolean" + "value": "SetReturnNumber" }, "parameters": [ - "True" + "HorizontalRotationAcceleration" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -9947,59 +12472,31 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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_", + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "HorizontalRotationAcceleration", + "name": "SetHorizontalRotationAcceleration", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::JoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - ">", - "0", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::IsAngleIn8WayDirection" - }, - "parameters": [ - "", - "JoystickAngle", - "Direction", - "" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "SetReturnBoolean" + "value": "SetNumberVariable" }, "parameters": [ - "True" + "HorizontalRotationAcceleration", + "=", + "Value" ] } ] @@ -10014,52 +12511,38 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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", + "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": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::PropertyTouchId" - }, - "parameters": [ - "Object", - "Behavior", - "!=", - "0" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "SetReturnBoolean" + "value": "SetReturnNumber" }, "parameters": [ - "True" + "HorizontalRotationDeceleration" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -10069,19 +12552,18 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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_", + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "HorizontalRotationDeceleration", + "name": "SetHorizontalRotationDeceleration", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -10089,25 +12571,12 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "0", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyTouchId" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "HorizontalRotationDeceleration", "=", - "0" + "Value" ] } ] @@ -10122,19 +12591,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the multitouch controller identifier.", - "fullName": "Multitouch controller identifier", + "description": "the maximum vertical rotation speed of the object.", + "fullName": "Maximum vertical rotation speed", "functionType": "ExpressionAndCondition", - "group": "Multitouch Joystick configuration", - "name": "ControllerIdentifier", - "sentence": "the multitouch controller identifier", + "group": "First person camera multitouch controller mapper vertical rotation configuration", + "name": "VerticalRotationSpeedMax", + "sentence": "the maximum vertical rotation speed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -10145,7 +12614,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "ControllerIdentifier" + "VerticalRotationSpeedMax" ] } ] @@ -10163,7 +12632,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], @@ -10172,8 +12641,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "ControllerIdentifier", - "name": "SetControllerIdentifier", + "getterName": "VerticalRotationSpeedMax", + "name": "SetVerticalRotationSpeedMax", "sentence": "", "events": [ { @@ -10182,11 +12651,10 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyControllerIdentifier" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "VerticalRotationSpeedMax", "=", "Value" ] @@ -10203,19 +12671,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the joystick name.", - "fullName": "Joystick name", + "description": "the vertical rotation acceleration of the object.", + "fullName": "Vertical rotation acceleration", "functionType": "ExpressionAndCondition", - "group": "Multitouch Joystick configuration", - "name": "JoystickIdentifier", - "sentence": "the joystick name", + "group": "First person camera multitouch controller mapper vertical rotation configuration", + "name": "VerticalRotationAcceleration", + "sentence": "the vertical rotation acceleration", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -10223,17 +12691,17 @@ "actions": [ { "type": { - "value": "SetReturnString" + "value": "SetReturnNumber" }, "parameters": [ - "JoystickIdentifier" + "VerticalRotationAcceleration" ] } ] } ], "expressionType": { - "type": "string" + "type": "expression" }, "parameters": [ { @@ -10244,7 +12712,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], @@ -10253,8 +12721,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "JoystickIdentifier", - "name": "SetJoystickIdentifier", + "getterName": "VerticalRotationAcceleration", + "name": "SetVerticalRotationAcceleration", "sentence": "", "events": [ { @@ -10263,11 +12731,10 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickIdentifier" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "VerticalRotationAcceleration", "=", "Value" ] @@ -10284,19 +12751,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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", + "description": "the vertical rotation deceleration of the object.", + "fullName": "Vertical rotation deceleration", "functionType": "ExpressionAndCondition", - "group": "Multitouch Joystick configuration", - "name": "DeadZoneRadius", - "sentence": "the dead zone radius", + "group": "First person camera multitouch controller mapper vertical rotation configuration", + "name": "VerticalRotationDeceleration", + "sentence": "the vertical rotation deceleration", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -10307,7 +12774,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "DeadZoneRadius" + "VerticalRotationDeceleration" ] } ] @@ -10325,7 +12792,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], @@ -10334,8 +12801,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "DeadZoneRadius", - "name": "SetDeadZoneRadius", + "getterName": "VerticalRotationDeceleration", + "name": "SetVerticalRotationDeceleration", "sentence": "", "events": [ { @@ -10344,11 +12811,10 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyDeadZoneRadius" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "VerticalRotationDeceleration", "=", "Value" ] @@ -10365,271 +12831,72 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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": "Action", - "name": "doStepPreEvents", - "sentence": "", + "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": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::IsReleased" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyIsReleased" - }, - "parameters": [ - "Object", - "Behavior", - "no" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + "value": "SetReturnNumber" }, "parameters": [ - "Object", - "Behavior", - "\"Idle\"", - "" + "VerticalAngleMin" ] } ] - }, + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ { - "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" - ] - } - ] - } - ] - } - ] + "description": "Object", + "name": "Object", + "type": "object" }, { - "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" - ] - }, + "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": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchId" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "VerticalAngleMin", "=", - "0" + "Value" ] } ] @@ -10644,44 +12911,38 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], "objectGroups": [] }, { - "description": "Check if button is released.", - "fullName": "Button released", - "functionType": "Condition", - "name": "IsReleased", - "sentence": "Button _PARAM0_ is released", + "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": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::PropertyIsReleased" - }, - "parameters": [ - "Object", - "Behavior" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "SetReturnBoolean" + "value": "SetReturnNumber" }, "parameters": [ - "True" + "VerticalAngleMax" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -10691,46 +12952,77 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], "objectGroups": [] }, { - "description": "Check if button is pressed.", - "fullName": "Button pressed", - "functionType": "Condition", - "name": "IsPressed", - "sentence": "Button _PARAM0_ is pressed", + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "VerticalAngleMax", + "name": "SetVerticalAngleMax", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "conditions": [], + "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::PropertyTouchId" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", - "!=", - "0" + "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": "SetReturnBoolean" + "value": "SetReturnNumber" }, "parameters": [ - "True" + "OffsetZ" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -10740,18 +13032,18 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], "objectGroups": [] }, { - "fullName": "Button state", - "functionType": "Action", - "name": "SetButtonState", - "private": true, - "sentence": "Mark the button _PARAM0_ as _PARAM2_", + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "OffsetZ", + "name": "SetOffsetZ", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -10759,14 +13051,12 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::SetButtonState" + "value": "SetNumberVariable" }, "parameters": [ - "", - "ControllerIdentifier", - "ButtonIdentifier", - "ButtonState", - "" + "OffsetZ", + "=", + "Value" ] } ] @@ -10781,61 +13071,140 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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": "Multitouch controller identifier (1, 2, 3, 4...)", + "label": "Controller identifier (1, 2, 3, 4...)", "name": "ControllerIdentifier" }, { - "value": "A", - "type": "String", - "label": "Button identifier", - "name": "ButtonIdentifier" + "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", - "label": "TouchID", - "hidden": true, - "name": "TouchId" + "unit": "Pixel", + "label": "Z position offset", + "group": "Position", + "name": "OffsetZ" }, { - "value": "", + "value": "0", "type": "Number", - "label": "", + "unit": "AngularSpeed", + "label": "Current rotation speed Z", "hidden": true, - "name": "TouchIndex" + "name": "CurrentRotationSpeedZ" }, { - "value": "", - "type": "Boolean", - "label": "Button released", + "value": "0", + "type": "Number", + "unit": "AngularSpeed", + "label": "Current rotation speed Y", "hidden": true, - "name": "IsReleased" + "name": "CurrentRotationSpeedY" } ], "sharedPropertyDescriptors": [] }, { - "description": "Control a platformer character with a multitouch controller.", - "fullName": "Platformer multitouch controller mapper", - "name": "PlatformerMultitouchMapper", + "description": "Control a 3D physics car with a multitouch controller.", + "fullName": "3D car multitouch controller mapper", + "name": "PhysicsCar3DMultitouchMapper", "objectType": "", + "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -10848,69 +13217,14 @@ "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" + "value": "SpriteMultitouchJoystick::StickForce" }, "parameters": [ "", + ">", + "0", "ControllerIdentifier", - "JoystickIdentifier", - "\"Up\"", + "SteerJoystickIdentifier", "" ] } @@ -10918,20 +13232,12 @@ "actions": [ { "type": { - "value": "PlatformBehavior::SimulateUpKey" - }, - "parameters": [ - "Object", - "Property" - ] - }, - { - "type": { - "value": "PlatformBehavior::SimulateLadderKey" + "value": "Physics3D::PhysicsCar3D::SimulateSteeringStick" }, "parameters": [ "Object", - "Property" + "PhysicsCar3D", + "SpriteMultitouchJoystick::StickForceX(ControllerIdentifier, \"Primary\")" ] } ] @@ -10941,13 +13247,14 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" + "value": "SpriteMultitouchJoystick::StickForce" }, "parameters": [ "", + ">", + "0", "ControllerIdentifier", - "JoystickIdentifier", - "\"Down\"", + "SpeedJoystickIdentifier", "" ] } @@ -10955,11 +13262,12 @@ "actions": [ { "type": { - "value": "PlatformBehavior::SimulateDownKey" + "value": "Physics3D::PhysicsCar3D::SimulateAcceleratorStick" }, "parameters": [ "Object", - "Property" + "PhysicsCar3D", + "-SpriteMultitouchJoystick::StickForceY(ControllerIdentifier, \"Secondary\")" ] } ] @@ -10974,7 +13282,7 @@ "parameters": [ "", "ControllerIdentifier", - "JumpButton", + "HandBrakeButton", "\"Down\"" ] } @@ -10982,11 +13290,11 @@ "actions": [ { "type": { - "value": "PlatformBehavior::SimulateJumpKey" + "value": "Physics3D::PhysicsCar3D::SimulateHandBrakeKey" }, "parameters": [ "Object", - "Property" + "PhysicsCar3D" ] } ] @@ -11001,7 +13309,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::PlatformerMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::PhysicsCar3DMultitouchMapper", "type": "behavior" } ], @@ -11012,12 +13320,12 @@ { "value": "", "type": "Behavior", - "label": "Platform character behavior", + "label": "3D physics car", "extraInformation": [ - "PlatformBehavior::PlatformerObjectBehavior" + "Physics3D::PhysicsCar3D" ], "choices": [], - "name": "Property" + "name": "PhysicsCar3D" }, { "value": "1", @@ -11028,7 +13336,7 @@ { "value": "Primary", "type": "Choice", - "label": "Joystick name", + "label": "Steer joystick", "group": "Controls", "choices": [ { @@ -11040,14 +13348,31 @@ "value": "Secondary" } ], - "name": "JoystickIdentifier" + "name": "SteerJoystickIdentifier" }, { - "value": "A", + "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": "Jump button name", + "label": "Hand brake button name", "group": "Controls", - "name": "JumpButton" + "name": "HandBrakeButton" } ], "sharedPropertyDescriptors": [] @@ -11057,6 +13382,7 @@ "fullName": "Top-down multitouch controller mapper", "name": "TopDownMultitouchMapper", "objectType": "", + "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -11069,11 +13395,10 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "StickMode", "=", "\"Analog\"" ] @@ -11098,11 +13423,10 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "StickMode", "=", "\"360°\"" ] @@ -11127,11 +13451,10 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "StickMode", "=", "\"8 Directions\"" ] @@ -11740,7 +14063,6 @@ } ], "instances": [], - "editionSettings": {}, "eventsFunctions": [ { "fullName": "", @@ -11859,17 +14181,90 @@ "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ + "conditions": [ { "type": { - "value": "MettreAutour" + "inverted": true, + "value": "SpriteMultitouchJoystick::IsInGameEdition" }, "parameters": [ - "Thumb", - "Border", - "Border.MultitouchJoystick::JoystickForce() * Border.Width() / 2", - "Border.MultitouchJoystick::JoystickAngle()" + "", + "" + ] + } + ], + "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", + "" + ] + } ] } ] @@ -11937,7 +14332,7 @@ "Border", "MultitouchJoystick", "=", - "Object.PropertyControllerIdentifier()", + "ControllerIdentifier", "" ] }, @@ -11949,7 +14344,7 @@ "Border", "MultitouchJoystick", "=", - "Object.PropertyJoystickIdentifier()", + "JoystickIdentifier", "" ] }, @@ -11961,7 +14356,92 @@ "Border", "MultitouchJoystick", "=", - "Object.PropertyDeadZoneRadius()", + "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)", "" ] } @@ -11978,6 +14458,92 @@ ], "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", @@ -11991,10 +14557,12 @@ { "type": { "inverted": true, - "value": "GetArgumentAsBoolean" + "value": "BooleanVariable" }, "parameters": [ - "\"ShouldActivate\"" + "ShouldActivate", + "True", + "" ] } ], @@ -12016,10 +14584,12 @@ "conditions": [ { "type": { - "value": "GetArgumentAsBoolean" + "value": "BooleanVariable" }, "parameters": [ - "\"ShouldActivate\"" + "ShouldActivate", + "True", + "" ] } ], @@ -12693,9 +15263,15 @@ "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 377f673d6..3ac429239 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.8.3", + "version": "1.9.0", "description": [ - "Multitouch joysticks can be used the same way as physical gamepads:", + "Multitouch joysticks are objects showing a joystick on the screen, useful for mobile. They work like a physical gamepad:", "- 4 or 8 directions", "- Analogus pads", "- Player selection", - "- Controls mapping for top-down movement and platformer characters", + "- Automatic \"mapper\" behaviors for 2D and 3D movement behaviors (platformer characters, top-down movement, 3D character etc...). Add one of these to the object with the movement behavior (i.e: the player most of the time) and the behavior will then be controlled automatically by the virtual joystick (it works by reading the multitouch joystick state and simulating controls). No need for additional events to make it work once the behaviors are set up.", "", "There are ready-to-use joysticks in the asset-store [multitouch joysticks pack](https://editor.gdevelop.io/?initial-dialog=asset-store&asset-pack=multitouch-joysticks-multitouch-joysticks)." ], @@ -6534,6 +6534,28 @@ } ], "eventsFunctions": [ + { + "description": "Check if the events are running for the editor.", + "fullName": "Editor is running", + "functionType": "Condition", + "name": "IsInGameEdition", + "private": true, + "sentence": "Events are running for the editor", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const game = runtimeScene.getGame();\r", + "eventsFunctionContext.returnValue = game.isInGameEdition && game.isInGameEdition();" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [], + "objectGroups": [] + }, { "fullName": "Accelerated speed", "functionType": "Expression", @@ -6952,11 +6974,11 @@ "objectGroups": [] }, { - "description": "Check if a button is pressed on a gamepad.", - "fullName": "Multitouch controller button pressed", + "description": "Check if a button was just pressed on a multitouch controller.", + "fullName": "Multitouch controller button just pressed", "functionType": "Condition", - "name": "IsButtonPressed", - "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", + "name": "IsButtonJustPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ was just pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -6968,7 +6990,7 @@ "parameters": [ "Controllers[ControllerIdentifier].Buttons[Button].State", "=", - "\"Pressed\"" + "\"JustPressed\"" ] } ], @@ -7000,7 +7022,73 @@ "objectGroups": [] }, { - "description": "Check if a button is released on a gamepad.", + "description": "Check if a button is pressed on a multitouch controller.", + "fullName": "Multitouch controller button pressed", + "functionType": "Condition", + "name": "IsButtonPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::Or" + }, + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"Pressed\"" + ] + }, + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"JustPressed\"" + ] + } + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier", + "type": "expression" + }, + { + "description": "Button name", + "name": "Button", + "supplementaryInformation": "[\"A\",\"CROSS\",\"B\",\"CIRCLE\",\"X\",\"SQUARE\",\"Y\",\"TRIANGLE\",\"LB\",\"L1\",\"RB\",\"R1\",\"LT\",\"L2\",\"RT\",\"R2\",\"UP\",\"DOWN\",\"LEFT\",\"RIGHT\",\"BACK\",\"SHARE\",\"START\",\"OPTIONS\",\"CLICK_STICK_LEFT\",\"CLICK_STICK_RIGHT\",\"PS_BUTTON\",\"CLICK_TOUCHPAD\"]", + "type": "string" + } + ], + "objectGroups": [] + }, + { + "description": "Check if a button is released on a multitouch controller.", "fullName": "Multitouch controller button released", "functionType": "Condition", "name": "IsButtonReleased", @@ -7086,7 +7174,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"JustPressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -8459,41 +8547,23 @@ "conditions": [ { "type": { - "value": "HasGameJustResumed" + "inverted": true, + "value": "SpriteMultitouchJoystick::IsInGameEdition" }, "parameters": [ + "", "" ] } ], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - } - ] - }, - { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Manage touches", - "source": "", - "type": "BuiltinCommonInstructions::Group", + "actions": [], "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "value": "HasAnyTouchOrMouseStarted" + "value": "HasGameJustResumed" }, "parameters": [ "" @@ -8503,171 +8573,207 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" }, "parameters": [ - "TouchIndex", - "=", - "0" + "Object", + "Behavior", + "" ] } - ], + ] + }, + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Manage touches", + "source": "", + "type": "BuiltinCommonInstructions::Group", "events": [ { - "type": "BuiltinCommonInstructions::Repeat", - "repeatExpression": "StartedTouchOrMouseCount()", - "conditions": [], - "actions": [], + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "HasAnyTouchOrMouseStarted" + }, + "parameters": [ + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchIndex", + "=", + "0" + ] + } + ], "events": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "StartedTouchOrMouseCount()", + "conditions": [], + "actions": [], + "events": [ { - "type": { - "value": "NumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "0" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "0" + ] + }, + { + "type": { + "value": "CollisionPoint" + }, + "parameters": [ + "Object", + "TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)", + "TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "StartedTouchOrMouseId(TouchIndex)" + ] + } ] }, { - "type": { - "value": "CollisionPoint" - }, - "parameters": [ - "Object", - "TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)", - "TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "StartedTouchOrMouseId(TouchIndex)" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchIndex", - "+", - "1" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchIndex", + "+", + "1" + ] + } ] } ] } ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 - }, - "comment": "Move thumb back to center when not being pressed (acts like a spring on a real controller)" - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + }, { - "type": { - "value": "HasTouchEnded" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 }, - "parameters": [ - "", - "TouchId" - ] - } - ], - "actions": [ + "comment": "Move thumb back to center when not being pressed (acts like a spring on a real controller)" + }, { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" - }, - "parameters": [ - "Object", - "Behavior", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "HasTouchEnded" + }, + "parameters": [ + "", + "TouchId" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } ] } - ] - } - ], - "parameters": [] - }, - { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Update joystick position", - "source": "", - "type": "BuiltinCommonInstructions::Group", - "events": [ + ], + "parameters": [] + }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Update joystick position", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ { - "type": { - "value": "NumberVariable" - }, - "parameters": [ - "TouchId", - "!=", - "0" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "!=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickAngle" + }, + "parameters": [ + "Object", + "Behavior", + "AngleBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0))", + "AngleBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0))" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "clamp(2 * DistanceBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0)) / Object.Width(), 0, 1)", + "" + ] + } ] } ], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickAngle" - }, - "parameters": [ - "Object", - "Behavior", - "AngleBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0))", - "AngleBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0))" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "clamp(2 * DistanceBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0)) / Object.Width(), 0, 1)", - "" - ] - } - ] + "parameters": [] } - ], - "parameters": [] + ] } ], "parameters": [ @@ -9542,7 +9648,7 @@ "sharedPropertyDescriptors": [] }, { - "description": "Detect button presses made on a touchscreen.", + "description": "Detect presses made on a touchscreen on the object so it acts like a button and automatically trigger the button having the same identifier for the mapper behaviors.", "fullName": "Multitouch button", "name": "MultitouchButton", "objectType": "", @@ -9558,11 +9664,11 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::IsReleased" + "value": "BooleanVariable" }, "parameters": [ - "Object", - "Behavior", + "IsReleased", + "True", "" ] } @@ -9591,6 +9697,44 @@ } ] }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "False", + "" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + }, + "parameters": [ + "Object", + "Behavior", + "\"Pressed\"", + "" + ] + } + ] + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ @@ -9683,7 +9827,17 @@ "parameters": [ "Object", "Behavior", - "\"Pressed\"", + "\"JustPressed\"", + "" + ] + }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "True", "" ] } @@ -9754,6 +9908,16 @@ "" ] }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "False", + "" + ] + }, { "type": { "value": "SetNumberVariable" @@ -9783,11 +9947,11 @@ "objectGroups": [] }, { - "description": "Check if button is released.", - "fullName": "Button released", + "description": "Check if the button was just pressed.", + "fullName": "Button just pressed", "functionType": "Condition", - "name": "IsReleased", - "sentence": "Button _PARAM0_ is released", + "name": "IsJustPressed", + "sentence": "Button _PARAM0_ was just pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -9797,7 +9961,7 @@ "value": "BooleanVariable" }, "parameters": [ - "IsReleased", + "IsJustPressed", "True", "" ] @@ -9831,7 +9995,7 @@ "objectGroups": [] }, { - "description": "Check if button is pressed.", + "description": "Check if the button is pressed.", "fullName": "Button pressed", "functionType": "Condition", "name": "IsPressed", @@ -9878,6 +10042,54 @@ ], "objectGroups": [] }, + { + "description": "Check if the button is released.", + "fullName": "Button released", + "functionType": "Condition", + "name": "IsReleased", + "sentence": "Button _PARAM0_ is released", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsReleased", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "type": "behavior" + } + ], + "objectGroups": [] + }, { "fullName": "Button state", "functionType": "Action", @@ -9919,7 +10131,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"JustPressed\",\"Pressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -9960,6 +10172,13 @@ "hidden": true, "name": "IsReleased" }, + { + "value": "", + "type": "Boolean", + "label": "Button just pressed", + "hidden": true, + "name": "IsJustPressed" + }, { "value": "0", "type": "Number", @@ -12374,7 +12593,6 @@ } ], "instances": [], - "editionSettings": {}, "eventsFunctions": [ { "fullName": "", @@ -12491,74 +12709,92 @@ "name": "doStepPostEvents", "sentence": "", "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "MettreAutour" - }, - "parameters": [ - "Thumb", - "Border", - "Border.MultitouchJoystick::JoystickForce() * Border.Width() / 2", - "Border.MultitouchJoystick::JoystickAngle()" - ] - } - ] - }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ - { - "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "ShouldBeHiddenWhenReleased", - "True", - "" - ] - }, { "type": { "inverted": true, - "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::IsPressed" + "value": "SpriteMultitouchJoystick::IsInGameEdition" }, "parameters": [ - "Object", + "", "" ] } ], - "actions": [ - { - "type": { - "value": "Cache" - }, - "parameters": [ - "Object" - ] - }, + "actions": [], + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::ActivateControl" - }, - "parameters": [ - "Object", - "no", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "MettreAutour" + }, + "parameters": [ + "Thumb", + "Border", + "Border.MultitouchJoystick::JoystickForce() * Border.Width() / 2", + "Border.MultitouchJoystick::JoystickAngle()" + ] + } ] }, { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "ShouldBeHiddenWhenReleased", - "False", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "ShouldBeHiddenWhenReleased", + "True", + "" + ] + }, + { + "type": { + "inverted": true, + "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::IsPressed" + }, + "parameters": [ + "Object", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "Cache" + }, + "parameters": [ + "Object" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::ActivateControl" + }, + "parameters": [ + "Object", + "no", + "" + ] + }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "ShouldBeHiddenWhenReleased", + "False", + "" + ] + } ] } ] @@ -13565,8 +13801,7 @@ "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 26eecc443..5a3fae886 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.8.2", + "version": "1.9.0", "description": [ - "Multitouch joysticks can be used the same way as physical gamepads:", + "Multitouch joysticks are objects showing a joystick on the screen, useful for mobile. They work like a physical gamepad:", "- 4 or 8 directions", "- Analogus pads", "- Player selection", - "- Controls mapping for top-down movement and platformer characters", + "- Automatic \"mapper\" behaviors for 2D and 3D movement behaviors (platformer characters, top-down movement, 3D character etc...). Add one of these to the object with the movement behavior (i.e: the player most of the time) and the behavior will then be controlled automatically by the virtual joystick (it works by reading the multitouch joystick state and simulating controls). No need for additional events to make it work once the behaviors are set up.", "", "There are ready-to-use joysticks in the asset-store [multitouch joysticks pack](https://editor.gdevelop.io/?initial-dialog=asset-store&asset-pack=multitouch-joysticks-multitouch-joysticks)." ], @@ -4422,6 +4422,28 @@ } ], "eventsFunctions": [ + { + "description": "Check if the events are running for the editor.", + "fullName": "Editor is running", + "functionType": "Condition", + "name": "IsInGameEdition", + "private": true, + "sentence": "Events are running for the editor", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const game = runtimeScene.getGame();\r", + "eventsFunctionContext.returnValue = game.isInGameEdition && game.isInGameEdition();" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [], + "objectGroups": [] + }, { "fullName": "Accelerated speed", "functionType": "Expression", @@ -4840,11 +4862,11 @@ "objectGroups": [] }, { - "description": "Check if a button is pressed on a gamepad.", - "fullName": "Multitouch controller button pressed", + "description": "Check if a button was just pressed on a multitouch controller.", + "fullName": "Multitouch controller button just pressed", "functionType": "Condition", - "name": "IsButtonPressed", - "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", + "name": "IsButtonJustPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ was just pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -4856,7 +4878,7 @@ "parameters": [ "Controllers[ControllerIdentifier].Buttons[Button].State", "=", - "\"Pressed\"" + "\"JustPressed\"" ] } ], @@ -4888,7 +4910,73 @@ "objectGroups": [] }, { - "description": "Check if a button is released on a gamepad.", + "description": "Check if a button is pressed on a multitouch controller.", + "fullName": "Multitouch controller button pressed", + "functionType": "Condition", + "name": "IsButtonPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::Or" + }, + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"Pressed\"" + ] + }, + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"JustPressed\"" + ] + } + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier", + "type": "expression" + }, + { + "description": "Button name", + "name": "Button", + "supplementaryInformation": "[\"A\",\"CROSS\",\"B\",\"CIRCLE\",\"X\",\"SQUARE\",\"Y\",\"TRIANGLE\",\"LB\",\"L1\",\"RB\",\"R1\",\"LT\",\"L2\",\"RT\",\"R2\",\"UP\",\"DOWN\",\"LEFT\",\"RIGHT\",\"BACK\",\"SHARE\",\"START\",\"OPTIONS\",\"CLICK_STICK_LEFT\",\"CLICK_STICK_RIGHT\",\"PS_BUTTON\",\"CLICK_TOUCHPAD\"]", + "type": "string" + } + ], + "objectGroups": [] + }, + { + "description": "Check if a button is released on a multitouch controller.", "fullName": "Multitouch controller button released", "functionType": "Condition", "name": "IsButtonReleased", @@ -4974,7 +5062,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"JustPressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -6347,41 +6435,23 @@ "conditions": [ { "type": { - "value": "HasGameJustResumed" + "inverted": true, + "value": "SpriteMultitouchJoystick::IsInGameEdition" }, "parameters": [ + "", "" ] } ], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - } - ] - }, - { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Manage touches", - "source": "", - "type": "BuiltinCommonInstructions::Group", + "actions": [], "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "value": "HasAnyTouchOrMouseStarted" + "value": "HasGameJustResumed" }, "parameters": [ "" @@ -6391,171 +6461,207 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" }, "parameters": [ - "TouchIndex", - "=", - "0" + "Object", + "Behavior", + "" ] } - ], + ] + }, + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Manage touches", + "source": "", + "type": "BuiltinCommonInstructions::Group", "events": [ { - "type": "BuiltinCommonInstructions::Repeat", - "repeatExpression": "StartedTouchOrMouseCount()", - "conditions": [], - "actions": [], + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "HasAnyTouchOrMouseStarted" + }, + "parameters": [ + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchIndex", + "=", + "0" + ] + } + ], "events": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "StartedTouchOrMouseCount()", + "conditions": [], + "actions": [], + "events": [ { - "type": { - "value": "NumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "0" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "0" + ] + }, + { + "type": { + "value": "CollisionPoint" + }, + "parameters": [ + "Object", + "TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)", + "TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "StartedTouchOrMouseId(TouchIndex)" + ] + } ] }, { - "type": { - "value": "CollisionPoint" - }, - "parameters": [ - "Object", - "TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)", - "TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "StartedTouchOrMouseId(TouchIndex)" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchIndex", - "+", - "1" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchIndex", + "+", + "1" + ] + } ] } ] } ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 - }, - "comment": "Move thumb back to center when not being pressed (acts like a spring on a real controller)" - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + }, { - "type": { - "value": "HasTouchEnded" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 }, - "parameters": [ - "", - "TouchId" - ] - } - ], - "actions": [ + "comment": "Move thumb back to center when not being pressed (acts like a spring on a real controller)" + }, { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" - }, - "parameters": [ - "Object", - "Behavior", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "HasTouchEnded" + }, + "parameters": [ + "", + "TouchId" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } ] } - ] - } - ], - "parameters": [] - }, - { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Update joystick position", - "source": "", - "type": "BuiltinCommonInstructions::Group", - "events": [ + ], + "parameters": [] + }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Update joystick position", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ { - "type": { - "value": "NumberVariable" - }, - "parameters": [ - "TouchId", - "!=", - "0" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "!=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickAngle" + }, + "parameters": [ + "Object", + "Behavior", + "AngleBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0))", + "AngleBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0))" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "clamp(2 * DistanceBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0)) / Object.Width(), 0, 1)", + "" + ] + } ] } ], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickAngle" - }, - "parameters": [ - "Object", - "Behavior", - "AngleBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0))", - "AngleBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0))" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "clamp(2 * DistanceBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0)) / Object.Width(), 0, 1)", - "" - ] - } - ] + "parameters": [] } - ], - "parameters": [] + ] } ], "parameters": [ @@ -7430,7 +7536,7 @@ "sharedPropertyDescriptors": [] }, { - "description": "Detect button presses made on a touchscreen.", + "description": "Detect presses made on a touchscreen on the object so it acts like a button and automatically trigger the button having the same identifier for the mapper behaviors.", "fullName": "Multitouch button", "name": "MultitouchButton", "objectType": "", @@ -7446,11 +7552,11 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::IsReleased" + "value": "BooleanVariable" }, "parameters": [ - "Object", - "Behavior", + "IsReleased", + "True", "" ] } @@ -7479,6 +7585,44 @@ } ] }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "False", + "" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + }, + "parameters": [ + "Object", + "Behavior", + "\"Pressed\"", + "" + ] + } + ] + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ @@ -7542,11 +7686,10 @@ }, { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::PropertyRadius" + "value": "NumberVariable" }, "parameters": [ - "Object", - "Behavior", + "Radius", ">", "DistanceBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer()), TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer()))" ] @@ -7572,7 +7715,17 @@ "parameters": [ "Object", "Behavior", - "\"Pressed\"", + "\"JustPressed\"", + "" + ] + }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "True", "" ] } @@ -7643,6 +7796,16 @@ "" ] }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "False", + "" + ] + }, { "type": { "value": "SetNumberVariable" @@ -7672,11 +7835,11 @@ "objectGroups": [] }, { - "description": "Check if button is released.", - "fullName": "Button released", + "description": "Check if the button was just pressed.", + "fullName": "Button just pressed", "functionType": "Condition", - "name": "IsReleased", - "sentence": "Button _PARAM0_ is released", + "name": "IsJustPressed", + "sentence": "Button _PARAM0_ was just pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -7686,7 +7849,7 @@ "value": "BooleanVariable" }, "parameters": [ - "IsReleased", + "IsJustPressed", "True", "" ] @@ -7720,7 +7883,7 @@ "objectGroups": [] }, { - "description": "Check if button is pressed.", + "description": "Check if the button is pressed.", "fullName": "Button pressed", "functionType": "Condition", "name": "IsPressed", @@ -7767,6 +7930,54 @@ ], "objectGroups": [] }, + { + "description": "Check if the button is released.", + "fullName": "Button released", + "functionType": "Condition", + "name": "IsReleased", + "sentence": "Button _PARAM0_ is released", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsReleased", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "type": "behavior" + } + ], + "objectGroups": [] + }, { "fullName": "Button state", "functionType": "Action", @@ -7808,7 +8019,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"JustPressed\",\"Pressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -7849,6 +8060,13 @@ "hidden": true, "name": "IsReleased" }, + { + "value": "", + "type": "Boolean", + "label": "Button just pressed", + "hidden": true, + "name": "IsJustPressed" + }, { "value": "0", "type": "Number", @@ -10263,7 +10481,6 @@ } ], "instances": [], - "editionSettings": {}, "eventsFunctions": [ { "fullName": "", @@ -10380,74 +10597,92 @@ "name": "doStepPostEvents", "sentence": "", "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "MettreAutour" - }, - "parameters": [ - "Thumb", - "Border", - "Border.MultitouchJoystick::JoystickForce() * Border.Width() / 2", - "Border.MultitouchJoystick::JoystickAngle()" - ] - } - ] - }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ - { - "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "ShouldBeHiddenWhenReleased", - "True", - "" - ] - }, { "type": { "inverted": true, - "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::IsPressed" + "value": "SpriteMultitouchJoystick::IsInGameEdition" }, "parameters": [ - "Object", + "", "" ] } ], - "actions": [ - { - "type": { - "value": "Cache" - }, - "parameters": [ - "Object" - ] - }, + "actions": [], + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::ActivateControl" - }, - "parameters": [ - "Object", - "no", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "MettreAutour" + }, + "parameters": [ + "Thumb", + "Border", + "Border.MultitouchJoystick::JoystickForce() * Border.Width() / 2", + "Border.MultitouchJoystick::JoystickAngle()" + ] + } ] }, { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "ShouldBeHiddenWhenReleased", - "False", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "ShouldBeHiddenWhenReleased", + "True", + "" + ] + }, + { + "type": { + "inverted": true, + "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::IsPressed" + }, + "parameters": [ + "Object", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "Cache" + }, + "parameters": [ + "Object" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::ActivateControl" + }, + "parameters": [ + "Object", + "no", + "" + ] + }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "ShouldBeHiddenWhenReleased", + "False", + "" + ] + } ] } ] @@ -11454,8 +11689,7 @@ "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 b7c11659a..b90d6ae09 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": "", + "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.4.0", + "version": "1.9.0", "description": [ - "Multitouch joysticks can be used the same way as physical gamepads:", + "Multitouch joysticks are objects showing a joystick on the screen, useful for mobile. They work like a physical gamepad:", "- 4 or 8 directions", "- Analogus pads", "- Player selection", - "- Controls mapping for top-down movement and platformer characters", + "- Automatic \"mapper\" behaviors for 2D and 3D movement behaviors (platformer characters, top-down movement, 3D character etc...). Add one of these to the object with the movement behavior (i.e: the player most of the time) and the behavior will then be controlled automatically by the virtual joystick (it works by reading the multitouch joystick state and simulating controls). No need for additional events to make it work once the behaviors are set up.", "", "There are ready-to-use joysticks in the asset-store [multitouch joysticks pack](https://editor.gdevelop.io/?initial-dialog=asset-store&asset-pack=multitouch-joysticks-multitouch-joysticks)." ], @@ -1127,153 +1127,33 @@ ], "eventsFunctions": [ { - "description": "Check if a button is pressed on a gamepad.", - "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": "StringVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Buttons[Button].State", - "=", - "\"Pressed\"" - ] - } - ], - "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 gamepad.", - "fullName": "Multitouch controller button released", + "description": "Check if the events are running for the editor.", + "fullName": "Editor is running", "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", + "name": "IsInGameEdition", "private": true, - "sentence": "Mark _PARAM2_ button as _PARAM3_ for multitouch controller _PARAM1_", + "sentence": "Events are running for the editor", "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" + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const game = runtimeScene.getGame();\r", + "eventsFunctionContext.returnValue = game.isInGameEdition && game.isInGameEdition();" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false } ], + "parameters": [], "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", + "fullName": "Accelerated speed", + "functionType": "Expression", + "name": "AcceleratedSpeed", "private": true, - "sentence": "Change the dead zone of multitouch joystick _PARAM2_ of multitouch controller _PARAM1_ to _PARAM3_", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -1284,1203 +1164,3781 @@ "value": "SetNumberVariable" }, "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].DeadZone", + "AcceleratedSpeed", "=", - "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)" + "CurrentSpeed" ] } - ] - } - ], - "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": [ + ], + "events": [ { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "mod(round(Angle * 8 / 360), 8)" + "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": [] + } ] } - ] - } - ], - "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": [ + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" + } + ], + "objectGroups": [] + }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "description": "the joystick force (from 0 to 1).", + "fullName": "Joystick force", + "functionType": "ExpressionAndCondition", + "name": "JoystickForce", + "sentence": "the joystick force", + "events": [ { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Right\"" + "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" }, { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo4Way" - }, - "parameters": [ - "", - "=", - "0", - "Angle", - "" + "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", + "" + ] + } ] } ], - "actions": [ + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" + "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": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "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": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Down\"" + "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" }, { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo4Way" - }, - "parameters": [ - "", - "=", - "1", - "Angle", - "" + "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()))" + ] + } ] } ], - "actions": [ + "expressionType": { + "type": "expression" + }, + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } - ] + ], + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Left\"" - ] - }, + "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": { - "value": "SpriteMultitouchJoystick::AngleTo4Way" - }, - "parameters": [ - "", - "=", - "2", - "Angle", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "Object.Behavior::JoystickForce() * sin(ToRad(Object.Behavior::JoystickAngle()))" + ] + } ] } ], - "actions": [ + "expressionType": { + "type": "expression" + }, + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } - ] + ], + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Up\"" - ] - }, + "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": { - "value": "SpriteMultitouchJoystick::AngleTo4Way" - }, - "parameters": [ - "", - "=", - "3", - "Angle", - "" + "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" + ] + } ] } ], - "actions": [ + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "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" } - ] - } - ], - "parameters": [ - { - "description": "Angle", - "name": "Angle", - "type": "expression" + ], + "objectGroups": [] }, { - "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\"" - ] - }, + "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": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "0", - "Angle", - "" + "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" + ] + } ] } ], - "actions": [ + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - }, - { - "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", - "" - ] + "description": "Direction", + "name": "Direction", + "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\",\"UpLeft\",\"UpRight\",\"DownLeft\",\"DownRight\"]", + "type": "stringWithSelector" } ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Down\"" - ] - }, + "description": "Check if a joystick is pressed.", + "fullName": "Joystick pressed", + "functionType": "Condition", + "name": "IsPressed", + "sentence": "Joystick _PARAM0_ is pressed", + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "2", - "Angle", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "!=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } ] } ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "parameters": [ { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"DownLeft\"" - ] + "description": "Object", + "name": "Object", + "type": "object" }, { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "3", - "Angle", - "" - ] + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Left\"" - ] - }, + "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": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "4", - "Angle", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "0", + "" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "0" + ] + } ] } ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "parameters": [ { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"UpLeft\"" - ] + "description": "Object", + "name": "Object", + "type": "object" }, { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "5", - "Angle", - "" - ] + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Up\"" - ] - }, + "description": "the multitouch controller identifier.", + "fullName": "Multitouch controller identifier", + "functionType": "ExpressionAndCondition", + "group": "Multitouch Joystick configuration", + "name": "ControllerIdentifier", + "sentence": "the multitouch controller identifier", + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "6", - "Angle", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "ControllerIdentifier" + ] + } ] } ], - "actions": [ + "expressionType": { + "type": "expression" + }, + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } - ] + ], + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "ControllerIdentifier", + "name": "SetControllerIdentifier", + "sentence": "", + "events": [ { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"UpRight\"" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "ControllerIdentifier", + "=", + "Value" + ] + } ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" }, { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "7", - "Angle", - "" - ] + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } ], - "actions": [ + "objectGroups": [] + }, + { + "description": "the joystick name.", + "fullName": "Joystick name", + "functionType": "ExpressionAndCondition", + "group": "Multitouch Joystick configuration", + "name": "JoystickIdentifier", + "sentence": "the joystick name", + "events": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnString" + }, + "parameters": [ + "JoystickIdentifier" + ] + } ] } - ] - } - ], - "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 + ], + "expressionType": { + "type": "string" }, - "comment": "Make sure the joystick has moved from center" + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" + } + ], + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "JoystickIdentifier", + "name": "SetJoystickIdentifier", + "sentence": "", + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::JoystickForce" - }, - "parameters": [ - "", - ">", - "0", - "ControllerIdentifier", - "JoystickIdentifier", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "JoystickIdentifier", + "=", + "Value" + ] + } ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" }, { - "type": { - "value": "SpriteMultitouchJoystick::IsAngleIn4WayDirection" - }, - "parameters": [ - "", - "SpriteMultitouchJoystick::JoystickAngle(ControllerIdentifier, JoystickIdentifier)", - "Direction", - "" + "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" + ] + } ] } ], - "actions": [ + "expressionType": { + "type": "expression" + }, + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } - ] - } - ], - "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" + ], + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "DeadZoneRadius", + "name": "SetDeadZoneRadius", + "sentence": "", + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::JoystickForce" - }, - "parameters": [ - "", - ">", - "0", - "ControllerIdentifier", - "JoystickIdentifier", - "" + "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" }, { - "type": { - "value": "SpriteMultitouchJoystick::IsAngleIn8WayDirection" - }, - "parameters": [ - "", - "SpriteMultitouchJoystick::JoystickAngle(ControllerIdentifier, JoystickIdentifier)", - "Direction", - "" - ] + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } ], - "actions": [ + "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": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" + "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": [] } ], - "parameters": [ + "propertyDescriptors": [ { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" + "value": "1", + "type": "Number", + "label": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier" }, { - "description": "Joystick name", - "name": "JoystickIdentifier", - "supplementaryInformation": "[\"Primary\",\"Secondary\"]", - "type": "stringWithSelector" + "value": "Primary", + "type": "String", + "label": "Joystick name", + "name": "JoystickIdentifier" }, { - "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": [ + "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" + }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier)" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ + "value": "0", + "type": "Number", + "label": "Joystick angle (range: -180 to 180)", + "hidden": true, + "name": "JoystickAngle" + }, { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" + "value": "0", + "type": "Number", + "label": "Joystick force (range: 0 to 1)", + "hidden": true, + "name": "JoystickForce" }, { - "description": "Joystick name", - "name": "JoystickIdentifier", - "supplementaryInformation": "[\"Primary\",\"Secondary\"]", - "type": "stringWithSelector" + "value": "0", + "type": "Number", + "label": "", + "hidden": true, + "name": "TouchId" + }, + { + "value": "", + "type": "Number", + "label": "", + "hidden": true, + "name": "TouchIndex" } ], - "objectGroups": [] + "sharedPropertyDescriptors": [] }, { - "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": [ + "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": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ + "fullName": "", + "functionType": "Action", + "name": "doStepPreEvents", + "sentence": "", + "events": [ { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "max(0, Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].Force - SpriteMultitouchJoystick::DeadZone(ControllerIdentifier, JoystickIdentifier)) / (1 - SpriteMultitouchJoystick::DeadZone(ControllerIdentifier, JoystickIdentifier))" + "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" + ] + } ] } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "type": "behavior" + } + ], + "objectGroups": [] }, { - "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": [ + "description": "Check if the button was just pressed.", + "fullName": "Button just pressed", + "functionType": "Condition", + "name": "IsJustPressed", + "sentence": "Button _PARAM0_ was just pressed", + "events": [ { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].Force", - "=", - "Value" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } ] } - ] - } - ], - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" - }, - { - "description": "Joystick name", - "name": "JoystickIdentifier", - "type": "string" + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "type": "behavior" + } + ], + "objectGroups": [] }, { - "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": [ + "description": "Check if the button is pressed.", + "fullName": "Button pressed", + "functionType": "Condition", + "name": "IsPressed", + "sentence": "Button _PARAM0_ is pressed", + "events": [ { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier)" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "!=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } ] } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "type": "behavior" + } + ], + "objectGroups": [] }, { - "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": "Check if the button is released.", + "fullName": "Button released", + "functionType": "Condition", + "name": "IsReleased", + "sentence": "Button _PARAM0_ is released", + "events": [ { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].Angle" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsReleased", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } ] } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "type": "behavior" + } + ], + "objectGroups": [] }, { - "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": [ + "fullName": "Button state", + "functionType": "Action", + "name": "SetButtonState", + "private": true, + "sentence": "Mark the button _PARAM0_ as _PARAM2_", + "events": [ { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].Angle", - "=", - "Value" + "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": [] } ], - "parameters": [ + "propertyDescriptors": [ { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" + "value": "1", + "type": "Number", + "label": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier" }, { - "description": "Joystick name", - "name": "JoystickIdentifier", - "type": "string" + "value": "A", + "type": "String", + "label": "Button identifier", + "name": "ButtonIdentifier" }, { - "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": [ - "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" + "value": "0", + "type": "Number", + "label": "TouchID", + "hidden": true, + "name": "TouchId" }, { - "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": [ + "value": "", + "type": "Number", + "label": "", + "hidden": true, + "name": "TouchIndex" + }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "SpriteMultitouchJoystick::JoystickForce(ControllerIdentifier, JoystickIdentifier) * sin(ToRad(SpriteMultitouchJoystick::JoystickAngle(ControllerIdentifier, JoystickIdentifier)))" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ + "value": "", + "type": "Boolean", + "label": "Button released", + "hidden": true, + "name": "IsReleased" + }, { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" + "value": "", + "type": "Boolean", + "label": "Button just pressed", + "hidden": true, + "name": "IsJustPressed" }, { - "description": "Joystick name", - "name": "JoystickIdentifier", - "supplementaryInformation": "[\"Primary\",\"Secondary\"]", - "type": "stringWithSelector" + "value": "0", + "type": "Number", + "unit": "Pixel", + "label": "Triggering circle radius", + "description": "This circle adds up to the object collision mask.", + "name": "Radius" } ], - "objectGroups": [] - } - ], - "eventsBasedBehaviors": [ + "sharedPropertyDescriptors": [] + }, { - "description": "Joystick that can be controlled by interacting with a touchscreen.", - "fullName": "Multitouch Joystick", - "name": "MultitouchJoystick", + "description": "Control a platformer character with a multitouch controller.", + "fullName": "Platformer multitouch controller mapper", + "name": "PlatformerMultitouchMapper", "objectType": "", - "private": true, + "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", "functionType": "Action", - "name": "onCreated", + "name": "doStepPreEvents", "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ + "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::SetDeadZone" + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" }, "parameters": [ "", "ControllerIdentifier", "JoystickIdentifier", - "DeadZoneRadius", + "\"Up\"", "" ] + } + ], + "actions": [ + { + "type": { + "value": "PlatformBehavior::SimulateUpKey" + }, + "parameters": [ + "Object", + "Property" + ] }, { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" + "value": "PlatformBehavior::SimulateLadderKey" }, "parameters": [ "Object", - "Behavior", - "" + "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::IsDirectionPushed4Way" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JoystickIdentifier", + "\"Down\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "PlatformBehavior::SimulateDownKey" + }, + "parameters": [ + "Object", + "Property" + ] + } + ] + }, { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::IsButtonPressed" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JumpButton", + "\"Down\"" + ] + } + ], "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" + "value": "PlatformBehavior::SimulateJumpKey" }, "parameters": [ "Object", - "Behavior", - "" + "Property" ] } ] @@ -2495,12 +4953,64 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::PlatformerMultitouchMapper", "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", @@ -2512,9 +5022,14 @@ "conditions": [ { "type": { - "value": "HasGameJustResumed" + "value": "SpriteMultitouchJoystick::StickForce" }, "parameters": [ + "", + ">", + "0", + "ControllerIdentifier", + "JoystickIdentifier", "" ] } @@ -2522,252 +5037,56 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" + "value": "Physics3D::PhysicsCharacter3D::SetForwardAngle" }, "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": "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" - ] - } - ] - } - ] - } + "PhysicsCharacter3D", + "=", + "SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier) + CameraAngle(Object.Layer())" ] }, { - "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": { + "value": "Physics3D::PhysicsCharacter3D::SimulateStick" + }, + "parameters": [ + "Object", + "PhysicsCharacter3D", + "-90", + "SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier)" ] } - ], - "parameters": [] + ] }, { - "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": "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)", - "" - ] - } + "type": { + "value": "SpriteMultitouchJoystick::IsButtonPressed" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JumpButton", + "\"Down\"" ] } ], - "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" + "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" }, "parameters": [ - "max(0, JoystickForce - DeadZoneRadius) / (1 - DeadZoneRadius)" + "Object", + "PhysicsCharacter3D" ] } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -2777,45 +5096,124 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "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": "ActionWithOperator", - "getterName": "JoystickForce", - "name": "SetJoystickForce", - "private": true, + "functionType": "Action", + "name": "doStepPreEvents", "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::StickForce" + }, + "parameters": [ + "", + ">", + "0", + "ControllerIdentifier", + "JoystickIdentifier", + "" + ] + } + ], "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickForce" + "value": "Physics3D::PhysicsCharacter3D::SimulateStick" }, "parameters": [ "Object", - "Behavior", - "=", - "Value" + "PhysicsCharacter3D", + "SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier)", + "SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier)" ] - }, + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::SetJoystickForce" + "value": "SpriteMultitouchJoystick::IsButtonPressed" }, "parameters": [ "", "ControllerIdentifier", - "JoystickIdentifier", - "JoystickForce", - "" + "JumpButton", + "\"Down\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" + }, + "parameters": [ + "Object", + "PhysicsCharacter3D" ] } ] @@ -2830,37 +5228,151 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::Shooter3DMultitouchMapper", "type": "behavior" } ], "objectGroups": [] + } + ], + "propertyDescriptors": [ + { + "value": "", + "type": "Behavior", + "label": "3D physics character", + "extraInformation": [ + "Physics3D::PhysicsCharacter3D" + ], + "choices": [], + "name": "PhysicsCharacter3D" }, { - "description": "Return the angle the joystick is pointing towards (Range: -180 to 180).", - "fullName": "Joystick angle", - "functionType": "Expression", - "name": "JoystickAngle", + "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": "SetReturnNumber" + "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": [ - "JoystickAngle" + "Object", + "Object3D", + "=", + "clamp(Object.Object3D::RotationY(), VerticalAngleMin, VerticalAngleMax)" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper::LookFromObjectEyes" + }, + "parameters": [ + "Object", + "Behavior", + "" ] } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -2870,19 +5382,20 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], "objectGroups": [] }, { - "description": "Change the angle the joystick is pointing towards (Range: -180 to 180).", - "fullName": "Joystick angle", + "description": "Move the camera to look though _PARAM1_ eyes. The object must look to the right when all its angles are 0 and the top of its head be toward Z+.", + "fullName": "Look through object eyes", "functionType": "Action", - "name": "SetJoystickAngle", + "group": "Layers and cameras", + "name": "LookFromObjectEyes", "private": true, - "sentence": "Change the joystick angle of _PARAM0_ to _PARAM2_", + "sentence": "Move the camera to look though _PARAM0_ eyes", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -2890,24 +5403,61 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickAngle" + "value": "CentreCamera" }, "parameters": [ + "", "Object", - "Behavior", + "", + "Object.Layer()", + "" + ] + }, + { + "type": { + "value": "Scene3D::SetCameraZ" + }, + "parameters": [ + "", "=", - "Value" + "Object.Object3D::Z() + Object.Object3D::Depth() + OffsetZ", + "", + "" ] }, { "type": { - "value": "SpriteMultitouchJoystick::SetJoystickAngle" + "value": "Scene3D::SetCameraRotationX" }, "parameters": [ "", - "ControllerIdentifier", - "JoystickIdentifier", - "JoystickAngle", + "=", + "- 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()", "" ] } @@ -2923,23 +5473,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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": "", + "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", @@ -2950,7 +5496,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "Object.Behavior::JoystickForce() * cos(ToRad(Object.Behavior::JoystickAngle()))" + "HorizontalRotationSpeedMax" ] } ] @@ -2968,17 +5514,17 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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", + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "HorizontalRotationSpeedMax", + "name": "SetHorizontalRotationSpeedMax", "sentence": "", "events": [ { @@ -2987,18 +5533,17 @@ "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "SetNumberVariable" }, "parameters": [ - "Object.Behavior::JoystickForce() * sin(ToRad(Object.Behavior::JoystickAngle()))" + "HorizontalRotationSpeedMax", + "=", + "Value" ] } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -3008,58 +5553,38 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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_", + "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": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::JoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - ">", - "0", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::IsAngleIn4WayDirection" - }, - "parameters": [ - "", - "JoystickAngle", - "Direction", - "" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "SetReturnBoolean" + "value": "SetReturnNumber" }, "parameters": [ - "True" + "HorizontalRotationAcceleration" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -3069,59 +5594,31 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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_", + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "HorizontalRotationAcceleration", + "name": "SetHorizontalRotationAcceleration", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::JoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - ">", - "0", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::IsAngleIn8WayDirection" - }, - "parameters": [ - "", - "JoystickAngle", - "Direction", - "" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "SetReturnBoolean" + "value": "SetNumberVariable" }, "parameters": [ - "True" + "HorizontalRotationAcceleration", + "=", + "Value" ] } ] @@ -3136,52 +5633,38 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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", + "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": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::PropertyTouchId" - }, - "parameters": [ - "Object", - "Behavior", - "!=", - "0" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "SetReturnBoolean" + "value": "SetReturnNumber" }, "parameters": [ - "True" + "HorizontalRotationDeceleration" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -3191,19 +5674,18 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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_", + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "HorizontalRotationDeceleration", + "name": "SetHorizontalRotationDeceleration", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -3211,25 +5693,12 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "0", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyTouchId" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "HorizontalRotationDeceleration", "=", - "0" + "Value" ] } ] @@ -3244,19 +5713,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the multitouch controller identifier.", - "fullName": "Multitouch controller identifier", + "description": "the maximum vertical rotation speed of the object.", + "fullName": "Maximum vertical rotation speed", "functionType": "ExpressionAndCondition", - "group": "Multitouch Joystick configuration", - "name": "ControllerIdentifier", - "sentence": "the multitouch controller identifier", + "group": "First person camera multitouch controller mapper vertical rotation configuration", + "name": "VerticalRotationSpeedMax", + "sentence": "the maximum vertical rotation speed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -3267,7 +5736,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "ControllerIdentifier" + "VerticalRotationSpeedMax" ] } ] @@ -3285,7 +5754,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], @@ -3294,8 +5763,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "ControllerIdentifier", - "name": "SetControllerIdentifier", + "getterName": "VerticalRotationSpeedMax", + "name": "SetVerticalRotationSpeedMax", "sentence": "", "events": [ { @@ -3304,11 +5773,10 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyControllerIdentifier" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "VerticalRotationSpeedMax", "=", "Value" ] @@ -3325,19 +5793,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the joystick name.", - "fullName": "Joystick name", + "description": "the vertical rotation acceleration of the object.", + "fullName": "Vertical rotation acceleration", "functionType": "ExpressionAndCondition", - "group": "Multitouch Joystick configuration", - "name": "JoystickIdentifier", - "sentence": "the joystick name", + "group": "First person camera multitouch controller mapper vertical rotation configuration", + "name": "VerticalRotationAcceleration", + "sentence": "the vertical rotation acceleration", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -3345,17 +5813,17 @@ "actions": [ { "type": { - "value": "SetReturnString" + "value": "SetReturnNumber" }, "parameters": [ - "JoystickIdentifier" + "VerticalRotationAcceleration" ] } ] } ], "expressionType": { - "type": "string" + "type": "expression" }, "parameters": [ { @@ -3366,7 +5834,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], @@ -3375,8 +5843,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "JoystickIdentifier", - "name": "SetJoystickIdentifier", + "getterName": "VerticalRotationAcceleration", + "name": "SetVerticalRotationAcceleration", "sentence": "", "events": [ { @@ -3385,11 +5853,10 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickIdentifier" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "VerticalRotationAcceleration", "=", "Value" ] @@ -3406,19 +5873,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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", + "description": "the vertical rotation deceleration of the object.", + "fullName": "Vertical rotation deceleration", "functionType": "ExpressionAndCondition", - "group": "Multitouch Joystick configuration", - "name": "DeadZoneRadius", - "sentence": "the dead zone radius", + "group": "First person camera multitouch controller mapper vertical rotation configuration", + "name": "VerticalRotationDeceleration", + "sentence": "the vertical rotation deceleration", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -3429,7 +5896,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "DeadZoneRadius" + "VerticalRotationDeceleration" ] } ] @@ -3447,7 +5914,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], @@ -3456,8 +5923,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "DeadZoneRadius", - "name": "SetDeadZoneRadius", + "getterName": "VerticalRotationDeceleration", + "name": "SetVerticalRotationDeceleration", "sentence": "", "events": [ { @@ -3466,11 +5933,10 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyDeadZoneRadius" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "VerticalRotationDeceleration", "=", "Value" ] @@ -3487,276 +5953,38 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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": "Action", - "name": "doStepPreEvents", - "sentence": "", + "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": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::IsReleased" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - } - ], - "actions": [ - { - "type": { - "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" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" - }, - "parameters": [ - "Object", - "Behavior", - "\"Released\"", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyIsReleased" - }, - "parameters": [ - "Object", - "Behavior", - "yes" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchId" + "value": "SetReturnNumber" }, "parameters": [ - "Object", - "Behavior", - "=", - "0" + "VerticalAngleMin" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -3766,44 +5994,77 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], "objectGroups": [] }, { - "description": "Check if button is released.", - "fullName": "Button released", - "functionType": "Condition", - "name": "IsReleased", - "sentence": "Button _PARAM0_ is released", + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "VerticalAngleMin", + "name": "SetVerticalAngleMin", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "conditions": [], + "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::PropertyIsReleased" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior" + "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": "SetReturnBoolean" + "value": "SetReturnNumber" }, "parameters": [ - "True" + "VerticalAngleMax" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -3813,46 +6074,77 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], "objectGroups": [] }, { - "description": "Check if button is pressed.", - "fullName": "Button pressed", - "functionType": "Condition", - "name": "IsPressed", - "sentence": "Button _PARAM0_ is pressed", + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "VerticalAngleMax", + "name": "SetVerticalAngleMax", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "conditions": [], + "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::PropertyTouchId" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", - "!=", - "0" + "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": "SetReturnBoolean" + "value": "SetReturnNumber" }, "parameters": [ - "True" + "OffsetZ" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -3862,18 +6154,18 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], "objectGroups": [] }, { - "fullName": "Button state", - "functionType": "Action", - "name": "SetButtonState", - "private": true, - "sentence": "Mark the button _PARAM0_ as _PARAM2_", + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "OffsetZ", + "name": "SetOffsetZ", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -3881,14 +6173,12 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::SetButtonState" + "value": "SetNumberVariable" }, "parameters": [ - "", - "ControllerIdentifier", - "ButtonIdentifier", - "ButtonState", - "" + "OffsetZ", + "=", + "Value" ] } ] @@ -3903,61 +6193,140 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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": "Multitouch controller identifier (1, 2, 3, 4...)", + "label": "Controller identifier (1, 2, 3, 4...)", "name": "ControllerIdentifier" }, { - "value": "A", - "type": "String", - "label": "Button identifier", - "name": "ButtonIdentifier" + "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", - "label": "TouchID", - "hidden": true, - "name": "TouchId" + "unit": "Pixel", + "label": "Z position offset", + "group": "Position", + "name": "OffsetZ" }, { - "value": "", + "value": "0", "type": "Number", - "label": "", + "unit": "AngularSpeed", + "label": "Current rotation speed Z", "hidden": true, - "name": "TouchIndex" + "name": "CurrentRotationSpeedZ" }, { - "value": "", - "type": "Boolean", - "label": "Button released", + "value": "0", + "type": "Number", + "unit": "AngularSpeed", + "label": "Current rotation speed Y", "hidden": true, - "name": "IsReleased" + "name": "CurrentRotationSpeedY" } ], "sharedPropertyDescriptors": [] }, { - "description": "Control a platformer character with a multitouch controller.", - "fullName": "Platformer multitouch controller mapper", - "name": "PlatformerMultitouchMapper", + "description": "Control a 3D physics car with a multitouch controller.", + "fullName": "3D car multitouch controller mapper", + "name": "PhysicsCar3DMultitouchMapper", "objectType": "", + "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -3970,90 +6339,27 @@ "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" + "value": "SpriteMultitouchJoystick::StickForce" }, "parameters": [ "", - "ControllerIdentifier", - "JoystickIdentifier", - "\"Up\"", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateUpKey" - }, - "parameters": [ - "Object", - "Property" + ">", + "0", + "ControllerIdentifier", + "SteerJoystickIdentifier", + "" ] - }, + } + ], + "actions": [ { "type": { - "value": "PlatformBehavior::SimulateLadderKey" + "value": "Physics3D::PhysicsCar3D::SimulateSteeringStick" }, "parameters": [ "Object", - "Property" + "PhysicsCar3D", + "SpriteMultitouchJoystick::StickForceX(ControllerIdentifier, \"Primary\")" ] } ] @@ -4063,13 +6369,14 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" + "value": "SpriteMultitouchJoystick::StickForce" }, "parameters": [ "", + ">", + "0", "ControllerIdentifier", - "JoystickIdentifier", - "\"Down\"", + "SpeedJoystickIdentifier", "" ] } @@ -4077,11 +6384,12 @@ "actions": [ { "type": { - "value": "PlatformBehavior::SimulateDownKey" + "value": "Physics3D::PhysicsCar3D::SimulateAcceleratorStick" }, "parameters": [ "Object", - "Property" + "PhysicsCar3D", + "-SpriteMultitouchJoystick::StickForceY(ControllerIdentifier, \"Secondary\")" ] } ] @@ -4096,7 +6404,7 @@ "parameters": [ "", "ControllerIdentifier", - "JumpButton", + "HandBrakeButton", "\"Down\"" ] } @@ -4104,11 +6412,11 @@ "actions": [ { "type": { - "value": "PlatformBehavior::SimulateJumpKey" + "value": "Physics3D::PhysicsCar3D::SimulateHandBrakeKey" }, "parameters": [ "Object", - "Property" + "PhysicsCar3D" ] } ] @@ -4123,7 +6431,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::PlatformerMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::PhysicsCar3DMultitouchMapper", "type": "behavior" } ], @@ -4134,12 +6442,12 @@ { "value": "", "type": "Behavior", - "label": "Platform character behavior", + "label": "3D physics car", "extraInformation": [ - "PlatformBehavior::PlatformerObjectBehavior" + "Physics3D::PhysicsCar3D" ], "choices": [], - "name": "Property" + "name": "PhysicsCar3D" }, { "value": "1", @@ -4150,7 +6458,7 @@ { "value": "Primary", "type": "Choice", - "label": "Joystick name", + "label": "Steer joystick", "group": "Controls", "choices": [ { @@ -4162,14 +6470,31 @@ "value": "Secondary" } ], - "name": "JoystickIdentifier" + "name": "SteerJoystickIdentifier" }, { - "value": "A", + "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": "Jump button name", + "label": "Hand brake button name", "group": "Controls", - "name": "JumpButton" + "name": "HandBrakeButton" } ], "sharedPropertyDescriptors": [] @@ -4179,6 +6504,7 @@ "fullName": "Top-down multitouch controller mapper", "name": "TopDownMultitouchMapper", "objectType": "", + "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -4191,11 +6517,10 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "StickMode", "=", "\"Analog\"" ] @@ -4220,11 +6545,10 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "StickMode", "=", "\"360°\"" ] @@ -4249,11 +6573,10 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "StickMode", "=", "\"8 Directions\"" ] @@ -4862,7 +7185,6 @@ } ], "instances": [], - "editionSettings": {}, "eventsFunctions": [ { "fullName": "", @@ -4981,17 +7303,90 @@ "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ + "conditions": [ { "type": { - "value": "MettreAutour" + "inverted": true, + "value": "SpriteMultitouchJoystick::IsInGameEdition" }, "parameters": [ - "Thumb", - "Border", - "Border.MultitouchJoystick::JoystickForce() * Border.Width() / 2", - "Border.MultitouchJoystick::JoystickAngle()" + "", + "" + ] + } + ], + "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", + "" + ] + } ] } ] @@ -5059,7 +7454,7 @@ "Border", "MultitouchJoystick", "=", - "Object.PropertyControllerIdentifier()", + "ControllerIdentifier", "" ] }, @@ -5071,7 +7466,7 @@ "Border", "MultitouchJoystick", "=", - "Object.PropertyJoystickIdentifier()", + "JoystickIdentifier", "" ] }, @@ -5083,7 +7478,92 @@ "Border", "MultitouchJoystick", "=", - "Object.PropertyDeadZoneRadius()", + "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)", "" ] } @@ -5100,6 +7580,92 @@ ], "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", @@ -5113,10 +7679,12 @@ { "type": { "inverted": true, - "value": "GetArgumentAsBoolean" + "value": "BooleanVariable" }, "parameters": [ - "\"ShouldActivate\"" + "ShouldActivate", + "True", + "" ] } ], @@ -5138,10 +7706,12 @@ "conditions": [ { "type": { - "value": "GetArgumentAsBoolean" + "value": "BooleanVariable" }, "parameters": [ - "\"ShouldActivate\"" + "ShouldActivate", + "True", + "" ] } ], @@ -5815,9 +8385,15 @@ "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 3e51f978a..b88ba711b 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.8.2", + "version": "1.9.0", "description": [ - "Multitouch joysticks can be used the same way as physical gamepads:", + "Multitouch joysticks are objects showing a joystick on the screen, useful for mobile. They work like a physical gamepad:", "- 4 or 8 directions", "- Analogus pads", "- Player selection", - "- Controls mapping for top-down movement and platformer characters", + "- Automatic \"mapper\" behaviors for 2D and 3D movement behaviors (platformer characters, top-down movement, 3D character etc...). Add one of these to the object with the movement behavior (i.e: the player most of the time) and the behavior will then be controlled automatically by the virtual joystick (it works by reading the multitouch joystick state and simulating controls). No need for additional events to make it work once the behaviors are set up.", "", "There are ready-to-use joysticks in the asset-store [multitouch joysticks pack](https://editor.gdevelop.io/?initial-dialog=asset-store&asset-pack=multitouch-joysticks-multitouch-joysticks)." ], @@ -3891,6 +3891,28 @@ } ], "eventsFunctions": [ + { + "description": "Check if the events are running for the editor.", + "fullName": "Editor is running", + "functionType": "Condition", + "name": "IsInGameEdition", + "private": true, + "sentence": "Events are running for the editor", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const game = runtimeScene.getGame();\r", + "eventsFunctionContext.returnValue = game.isInGameEdition && game.isInGameEdition();" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [], + "objectGroups": [] + }, { "fullName": "Accelerated speed", "functionType": "Expression", @@ -4309,11 +4331,11 @@ "objectGroups": [] }, { - "description": "Check if a button is pressed on a gamepad.", - "fullName": "Multitouch controller button pressed", + "description": "Check if a button was just pressed on a multitouch controller.", + "fullName": "Multitouch controller button just pressed", "functionType": "Condition", - "name": "IsButtonPressed", - "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", + "name": "IsButtonJustPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ was just pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -4325,7 +4347,7 @@ "parameters": [ "Controllers[ControllerIdentifier].Buttons[Button].State", "=", - "\"Pressed\"" + "\"JustPressed\"" ] } ], @@ -4357,7 +4379,73 @@ "objectGroups": [] }, { - "description": "Check if a button is released on a gamepad.", + "description": "Check if a button is pressed on a multitouch controller.", + "fullName": "Multitouch controller button pressed", + "functionType": "Condition", + "name": "IsButtonPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::Or" + }, + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"Pressed\"" + ] + }, + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"JustPressed\"" + ] + } + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier", + "type": "expression" + }, + { + "description": "Button name", + "name": "Button", + "supplementaryInformation": "[\"A\",\"CROSS\",\"B\",\"CIRCLE\",\"X\",\"SQUARE\",\"Y\",\"TRIANGLE\",\"LB\",\"L1\",\"RB\",\"R1\",\"LT\",\"L2\",\"RT\",\"R2\",\"UP\",\"DOWN\",\"LEFT\",\"RIGHT\",\"BACK\",\"SHARE\",\"START\",\"OPTIONS\",\"CLICK_STICK_LEFT\",\"CLICK_STICK_RIGHT\",\"PS_BUTTON\",\"CLICK_TOUCHPAD\"]", + "type": "string" + } + ], + "objectGroups": [] + }, + { + "description": "Check if a button is released on a multitouch controller.", "fullName": "Multitouch controller button released", "functionType": "Condition", "name": "IsButtonReleased", @@ -4443,7 +4531,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"JustPressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -5816,41 +5904,23 @@ "conditions": [ { "type": { - "value": "HasGameJustResumed" + "inverted": true, + "value": "SpriteMultitouchJoystick::IsInGameEdition" }, "parameters": [ + "", "" ] } ], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - } - ] - }, - { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Manage touches", - "source": "", - "type": "BuiltinCommonInstructions::Group", + "actions": [], "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "value": "HasAnyTouchOrMouseStarted" + "value": "HasGameJustResumed" }, "parameters": [ "" @@ -5860,171 +5930,207 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" }, "parameters": [ - "TouchIndex", - "=", - "0" + "Object", + "Behavior", + "" ] } - ], + ] + }, + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Manage touches", + "source": "", + "type": "BuiltinCommonInstructions::Group", "events": [ { - "type": "BuiltinCommonInstructions::Repeat", - "repeatExpression": "StartedTouchOrMouseCount()", - "conditions": [], - "actions": [], + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "HasAnyTouchOrMouseStarted" + }, + "parameters": [ + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchIndex", + "=", + "0" + ] + } + ], "events": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "StartedTouchOrMouseCount()", + "conditions": [], + "actions": [], + "events": [ { - "type": { - "value": "NumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "0" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "0" + ] + }, + { + "type": { + "value": "CollisionPoint" + }, + "parameters": [ + "Object", + "TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)", + "TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "StartedTouchOrMouseId(TouchIndex)" + ] + } ] }, { - "type": { - "value": "CollisionPoint" - }, - "parameters": [ - "Object", - "TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)", - "TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "StartedTouchOrMouseId(TouchIndex)" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchIndex", - "+", - "1" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchIndex", + "+", + "1" + ] + } ] } ] } ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 - }, - "comment": "Move thumb back to center when not being pressed (acts like a spring on a real controller)" - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + }, { - "type": { - "value": "HasTouchEnded" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 }, - "parameters": [ - "", - "TouchId" - ] - } - ], - "actions": [ + "comment": "Move thumb back to center when not being pressed (acts like a spring on a real controller)" + }, { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" - }, - "parameters": [ - "Object", - "Behavior", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "HasTouchEnded" + }, + "parameters": [ + "", + "TouchId" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } ] } - ] - } - ], - "parameters": [] - }, - { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Update joystick position", - "source": "", - "type": "BuiltinCommonInstructions::Group", - "events": [ + ], + "parameters": [] + }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Update joystick position", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ { - "type": { - "value": "NumberVariable" - }, - "parameters": [ - "TouchId", - "!=", - "0" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "!=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickAngle" + }, + "parameters": [ + "Object", + "Behavior", + "AngleBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0))", + "AngleBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0))" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "clamp(2 * DistanceBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0)) / Object.Width(), 0, 1)", + "" + ] + } ] } ], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickAngle" - }, - "parameters": [ - "Object", - "Behavior", - "AngleBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0))", - "AngleBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0))" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "clamp(2 * DistanceBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0)) / Object.Width(), 0, 1)", - "" - ] - } - ] + "parameters": [] } - ], - "parameters": [] + ] } ], "parameters": [ @@ -6899,7 +7005,7 @@ "sharedPropertyDescriptors": [] }, { - "description": "Detect button presses made on a touchscreen.", + "description": "Detect presses made on a touchscreen on the object so it acts like a button and automatically trigger the button having the same identifier for the mapper behaviors.", "fullName": "Multitouch button", "name": "MultitouchButton", "objectType": "", @@ -6915,11 +7021,11 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::IsReleased" + "value": "BooleanVariable" }, "parameters": [ - "Object", - "Behavior", + "IsReleased", + "True", "" ] } @@ -6948,6 +7054,44 @@ } ] }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "False", + "" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + }, + "parameters": [ + "Object", + "Behavior", + "\"Pressed\"", + "" + ] + } + ] + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ @@ -7011,11 +7155,10 @@ }, { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::PropertyRadius" + "value": "NumberVariable" }, "parameters": [ - "Object", - "Behavior", + "Radius", ">", "DistanceBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer()), TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer()))" ] @@ -7041,7 +7184,17 @@ "parameters": [ "Object", "Behavior", - "\"Pressed\"", + "\"JustPressed\"", + "" + ] + }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "True", "" ] } @@ -7112,6 +7265,16 @@ "" ] }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "False", + "" + ] + }, { "type": { "value": "SetNumberVariable" @@ -7141,11 +7304,11 @@ "objectGroups": [] }, { - "description": "Check if button is released.", - "fullName": "Button released", + "description": "Check if the button was just pressed.", + "fullName": "Button just pressed", "functionType": "Condition", - "name": "IsReleased", - "sentence": "Button _PARAM0_ is released", + "name": "IsJustPressed", + "sentence": "Button _PARAM0_ was just pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -7155,7 +7318,7 @@ "value": "BooleanVariable" }, "parameters": [ - "IsReleased", + "IsJustPressed", "True", "" ] @@ -7189,7 +7352,7 @@ "objectGroups": [] }, { - "description": "Check if button is pressed.", + "description": "Check if the button is pressed.", "fullName": "Button pressed", "functionType": "Condition", "name": "IsPressed", @@ -7236,6 +7399,54 @@ ], "objectGroups": [] }, + { + "description": "Check if the button is released.", + "fullName": "Button released", + "functionType": "Condition", + "name": "IsReleased", + "sentence": "Button _PARAM0_ is released", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsReleased", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "type": "behavior" + } + ], + "objectGroups": [] + }, { "fullName": "Button state", "functionType": "Action", @@ -7277,7 +7488,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"JustPressed\",\"Pressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -7318,6 +7529,13 @@ "hidden": true, "name": "IsReleased" }, + { + "value": "", + "type": "Boolean", + "label": "Button just pressed", + "hidden": true, + "name": "IsJustPressed" + }, { "value": "0", "type": "Number", @@ -9732,7 +9950,6 @@ } ], "instances": [], - "editionSettings": {}, "eventsFunctions": [ { "fullName": "", @@ -9849,74 +10066,92 @@ "name": "doStepPostEvents", "sentence": "", "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "MettreAutour" - }, - "parameters": [ - "Thumb", - "Border", - "Border.MultitouchJoystick::JoystickForce() * Border.Width() / 2", - "Border.MultitouchJoystick::JoystickAngle()" - ] - } - ] - }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ - { - "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "ShouldBeHiddenWhenReleased", - "True", - "" - ] - }, { "type": { "inverted": true, - "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::IsPressed" + "value": "SpriteMultitouchJoystick::IsInGameEdition" }, "parameters": [ - "Object", + "", "" ] } ], - "actions": [ - { - "type": { - "value": "Cache" - }, - "parameters": [ - "Object" - ] - }, + "actions": [], + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::ActivateControl" - }, - "parameters": [ - "Object", - "no", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "MettreAutour" + }, + "parameters": [ + "Thumb", + "Border", + "Border.MultitouchJoystick::JoystickForce() * Border.Width() / 2", + "Border.MultitouchJoystick::JoystickAngle()" + ] + } ] }, { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "ShouldBeHiddenWhenReleased", - "False", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "ShouldBeHiddenWhenReleased", + "True", + "" + ] + }, + { + "type": { + "inverted": true, + "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::IsPressed" + }, + "parameters": [ + "Object", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "Cache" + }, + "parameters": [ + "Object" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::ActivateControl" + }, + "parameters": [ + "Object", + "no", + "" + ] + }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "ShouldBeHiddenWhenReleased", + "False", + "" + ] + } ] } ] @@ -10923,8 +11158,7 @@ "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 bc2fa03d0..66b1b1317 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": "", + "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.4.0", + "version": "1.9.0", "description": [ - "Multitouch joysticks can be used the same way as physical gamepads:", + "Multitouch joysticks are objects showing a joystick on the screen, useful for mobile. They work like a physical gamepad:", "- 4 or 8 directions", "- Analogus pads", "- Player selection", - "- Controls mapping for top-down movement and platformer characters", + "- Automatic \"mapper\" behaviors for 2D and 3D movement behaviors (platformer characters, top-down movement, 3D character etc...). Add one of these to the object with the movement behavior (i.e: the player most of the time) and the behavior will then be controlled automatically by the virtual joystick (it works by reading the multitouch joystick state and simulating controls). No need for additional events to make it work once the behaviors are set up.", "", "There are ready-to-use joysticks in the asset-store [multitouch joysticks pack](https://editor.gdevelop.io/?initial-dialog=asset-store&asset-pack=multitouch-joysticks-multitouch-joysticks)." ], @@ -1121,153 +1121,33 @@ ], "eventsFunctions": [ { - "description": "Check if a button is pressed on a gamepad.", - "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": "StringVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Buttons[Button].State", - "=", - "\"Pressed\"" - ] - } - ], - "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 gamepad.", - "fullName": "Multitouch controller button released", + "description": "Check if the events are running for the editor.", + "fullName": "Editor is running", "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", + "name": "IsInGameEdition", "private": true, - "sentence": "Mark _PARAM2_ button as _PARAM3_ for multitouch controller _PARAM1_", + "sentence": "Events are running for the editor", "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" + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const game = runtimeScene.getGame();\r", + "eventsFunctionContext.returnValue = game.isInGameEdition && game.isInGameEdition();" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false } ], + "parameters": [], "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", + "fullName": "Accelerated speed", + "functionType": "Expression", + "name": "AcceleratedSpeed", "private": true, - "sentence": "Change the dead zone of multitouch joystick _PARAM2_ of multitouch controller _PARAM1_ to _PARAM3_", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -1278,1165 +1158,3781 @@ "value": "SetNumberVariable" }, "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].DeadZone", + "AcceleratedSpeed", "=", - "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)" + "CurrentSpeed" ] } - ] - } - ], - "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": [ + ], + "events": [ { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "mod(round(Angle * 8 / 360), 8)" + "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": "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": [ + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" + } + ], + "objectGroups": [] + }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "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": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Right\"" + "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" }, { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo4Way" - }, - "parameters": [ - "", - "=", - "0", - "Angle", - "" - ] + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" + }, + { + "description": "Angle", + "name": "Value", + "type": "expression" } ], - "actions": [ + "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": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" + "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": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "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": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Down\"" + "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" }, { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo4Way" - }, - "parameters": [ - "", - "=", - "1", - "Angle", - "" + "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" + ] + } ] } ], - "actions": [ + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "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": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Left\"" - ] - }, + "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": { - "value": "SpriteMultitouchJoystick::AngleTo4Way" - }, - "parameters": [ - "", - "=", - "2", - "Angle", - "" + "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" + ] + } ] } ], - "actions": [ + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "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": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Up\"" - ] - }, + "description": "Check if a joystick is pressed.", + "fullName": "Joystick pressed", + "functionType": "Condition", + "name": "IsPressed", + "sentence": "Joystick _PARAM0_ is pressed", + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo4Way" - }, - "parameters": [ - "", - "=", - "3", - "Angle", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "!=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } ] } ], - "actions": [ + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } - ] - } - ], - "parameters": [ - { - "description": "Angle", - "name": "Angle", - "type": "expression" + ], + "objectGroups": [] }, { - "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\"" - ] - }, + "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": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "0", - "Angle", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "0", + "" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "0" + ] + } ] } ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "parameters": [ { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"DownRight\"" - ] + "description": "Object", + "name": "Object", + "type": "object" }, { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "1", - "Angle", - "" - ] + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Down\"" - ] - }, + "description": "the multitouch controller identifier.", + "fullName": "Multitouch controller identifier", + "functionType": "ExpressionAndCondition", + "group": "Multitouch Joystick configuration", + "name": "ControllerIdentifier", + "sentence": "the multitouch controller identifier", + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "2", - "Angle", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "ControllerIdentifier" + ] + } ] } ], - "actions": [ + "expressionType": { + "type": "expression" + }, + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } - ] + ], + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"DownLeft\"" - ] - }, + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "ControllerIdentifier", + "name": "SetControllerIdentifier", + "sentence": "", + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "3", - "Angle", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "ControllerIdentifier", + "=", + "Value" + ] + } ] } ], - "actions": [ + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } - ] + ], + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Left\"" - ] - }, + "description": "the joystick name.", + "fullName": "Joystick name", + "functionType": "ExpressionAndCondition", + "group": "Multitouch Joystick configuration", + "name": "JoystickIdentifier", + "sentence": "the joystick name", + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "4", - "Angle", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnString" + }, + "parameters": [ + "JoystickIdentifier" + ] + } ] } ], - "actions": [ + "expressionType": { + "type": "string" + }, + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } - ] + ], + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"UpLeft\"" - ] - }, + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "JoystickIdentifier", + "name": "SetJoystickIdentifier", + "sentence": "", + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "5", - "Angle", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "JoystickIdentifier", + "=", + "Value" + ] + } ] } ], - "actions": [ + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } - ] + ], + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Up\"" - ] - }, + "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": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "6", - "Angle", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "DeadZoneRadius" + ] + } ] } ], - "actions": [ + "expressionType": { + "type": "expression" + }, + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } - ] + ], + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"UpRight\"" - ] - }, + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "DeadZoneRadius", + "name": "SetDeadZoneRadius", + "sentence": "", + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "7", - "Angle", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "DeadZoneRadius", + "=", + "Value" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::SetDeadZone" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JoystickIdentifier", + "Value", + "" + ] + } ] } ], - "actions": [ + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } - ] - } - ], - "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" + ], + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::JoystickForce" - }, - "parameters": [ - "", - ">", - "0", - "ControllerIdentifier", - "JoystickIdentifier", - "" - ] - }, + "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": { - "value": "SpriteMultitouchJoystick::IsAngleIn4WayDirection" - }, - "parameters": [ - "", - "SpriteMultitouchJoystick::JoystickAngle(ControllerIdentifier, JoystickIdentifier)", - "Direction", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "Value" + ] + } ] } ], - "actions": [ + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" + }, { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "description": "Touch identifier", + "name": "Value", + "type": "expression" } - ] + ], + "objectGroups": [] } ], - "parameters": [ + "propertyDescriptors": [ { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" + "value": "1", + "type": "Number", + "label": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier" }, { - "description": "Joystick name", - "name": "JoystickIdentifier", - "supplementaryInformation": "[\"Primary\",\"Secondary\"]", - "type": "stringWithSelector" + "value": "Primary", + "type": "String", + "label": "Joystick name", + "name": "JoystickIdentifier" }, { - "description": "Direction", - "name": "Direction", - "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\"]", - "type": "stringWithSelector" + "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" } ], - "objectGroups": [] + "sharedPropertyDescriptors": [] }, { - "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" - }, + "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": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "fullName": "", + "functionType": "Action", + "name": "doStepPreEvents", + "sentence": "", + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::JoystickForce" - }, - "parameters": [ - "", - ">", - "0", - "ControllerIdentifier", - "JoystickIdentifier", - "" + "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": { - "value": "SpriteMultitouchJoystick::IsAngleIn8WayDirection" - }, - "parameters": [ - "", - "SpriteMultitouchJoystick::JoystickAngle(ControllerIdentifier, JoystickIdentifier)", - "Direction", - "" + "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" + ] + } ] } ], - "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": [ + "parameters": [ { - "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": [ + "description": "Object", + "name": "Object", + "type": "object" + }, { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "max(0, Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].Force - SpriteMultitouchJoystick::DeadZone(ControllerIdentifier, JoystickIdentifier)) / (1 - SpriteMultitouchJoystick::DeadZone(ControllerIdentifier, JoystickIdentifier))" - ] + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "type": "behavior" } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" + ], + "objectGroups": [] }, { - "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": [ + "description": "Check if the button was just pressed.", + "fullName": "Button just pressed", + "functionType": "Condition", + "name": "IsJustPressed", + "sentence": "Button _PARAM0_ was just pressed", + "events": [ { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].Force", - "=", - "Value" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } ] } - ] - } - ], - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" - }, - { - "description": "Joystick name", - "name": "JoystickIdentifier", - "type": "string" + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "type": "behavior" + } + ], + "objectGroups": [] }, { - "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": [ + "description": "Check if the button is pressed.", + "fullName": "Button pressed", + "functionType": "Condition", + "name": "IsPressed", + "sentence": "Button _PARAM0_ is pressed", + "events": [ { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier)" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "!=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } ] } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "type": "behavior" + } + ], + "objectGroups": [] }, { - "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": "Check if the button is released.", + "fullName": "Button released", + "functionType": "Condition", + "name": "IsReleased", + "sentence": "Button _PARAM0_ is released", + "events": [ { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].Angle" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsReleased", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } ] } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "type": "behavior" + } + ], + "objectGroups": [] }, { - "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": [ + "fullName": "Button state", + "functionType": "Action", + "name": "SetButtonState", + "private": true, + "sentence": "Mark the button _PARAM0_ as _PARAM2_", + "events": [ { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].Angle", - "=", - "Value" + "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": [] } ], - "parameters": [ + "propertyDescriptors": [ { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" + "value": "1", + "type": "Number", + "label": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier" }, { - "description": "Joystick name", - "name": "JoystickIdentifier", - "type": "string" + "value": "A", + "type": "String", + "label": "Button identifier", + "name": "ButtonIdentifier" }, { - "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": [ - "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" + "value": "0", + "type": "Number", + "label": "TouchID", + "hidden": true, + "name": "TouchId" }, { - "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": [ + "value": "", + "type": "Number", + "label": "", + "hidden": true, + "name": "TouchIndex" + }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "SpriteMultitouchJoystick::JoystickForce(ControllerIdentifier, JoystickIdentifier) * sin(ToRad(SpriteMultitouchJoystick::JoystickAngle(ControllerIdentifier, JoystickIdentifier)))" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ + "value": "", + "type": "Boolean", + "label": "Button released", + "hidden": true, + "name": "IsReleased" + }, { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" + "value": "", + "type": "Boolean", + "label": "Button just pressed", + "hidden": true, + "name": "IsJustPressed" }, { - "description": "Joystick name", - "name": "JoystickIdentifier", - "supplementaryInformation": "[\"Primary\",\"Secondary\"]", - "type": "stringWithSelector" + "value": "0", + "type": "Number", + "unit": "Pixel", + "label": "Triggering circle radius", + "description": "This circle adds up to the object collision mask.", + "name": "Radius" } ], - "objectGroups": [] - } - ], - "eventsBasedBehaviors": [ + "sharedPropertyDescriptors": [] + }, { - "description": "Joystick that can be controlled by interacting with a touchscreen.", - "fullName": "Multitouch Joystick", - "name": "MultitouchJoystick", + "description": "Control a platformer character with a multitouch controller.", + "fullName": "Platformer multitouch controller mapper", + "name": "PlatformerMultitouchMapper", "objectType": "", - "private": true, + "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", "functionType": "Action", - "name": "onCreated", + "name": "doStepPreEvents", "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JoystickIdentifier", + "\"Left\"", + "" + ] + } + ], "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::SetDeadZone" + "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", - "JoystickIdentifier", - "DeadZoneRadius", - "" + "JumpButton", + "\"Down\"" ] - }, + } + ], + "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" + "value": "PlatformBehavior::SimulateJumpKey" }, "parameters": [ "Object", - "Behavior", - "" + "Property" ] } ] @@ -2451,50 +4947,64 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::PlatformerMultitouchMapper", "type": "behavior" } ], "objectGroups": [] - }, + } + ], + "propertyDescriptors": [ { - "fullName": "", - "functionType": "Action", - "name": "onDeActivate", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - } - ] - } + "value": "", + "type": "Behavior", + "label": "Platform character behavior", + "extraInformation": [ + "PlatformBehavior::PlatformerObjectBehavior" ], - "parameters": [ + "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": "Object", - "name": "Object", - "type": "object" + "label": "Primary", + "value": "Primary" }, { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" + "label": "Secondary", + "value": "Secondary" } ], - "objectGroups": [] + "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", @@ -2506,9 +5016,14 @@ "conditions": [ { "type": { - "value": "HasGameJustResumed" + "value": "SpriteMultitouchJoystick::StickForce" }, "parameters": [ + "", + ">", + "0", + "ControllerIdentifier", + "JoystickIdentifier", "" ] } @@ -2516,252 +5031,56 @@ "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": "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 + "value": "Physics3D::PhysicsCharacter3D::SetForwardAngle" }, - "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": [ + "Object", + "PhysicsCharacter3D", + "=", + "SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier) + CameraAngle(Object.Layer())" + ] + }, + { + "type": { + "value": "Physics3D::PhysicsCharacter3D::SimulateStick" + }, + "parameters": [ + "Object", + "PhysicsCharacter3D", + "-90", + "SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier)" ] } - ], - "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": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::IsButtonPressed" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JumpButton", + "\"Down\"" + ] + } + ], "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" }, "parameters": [ - "max(0, JoystickForce - DeadZoneRadius) / (1 - DeadZoneRadius)" + "Object", + "PhysicsCharacter3D" ] } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -2771,45 +5090,124 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "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": "ActionWithOperator", - "getterName": "JoystickForce", - "name": "SetJoystickForce", - "private": true, + "functionType": "Action", + "name": "doStepPreEvents", "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::StickForce" + }, + "parameters": [ + "", + ">", + "0", + "ControllerIdentifier", + "JoystickIdentifier", + "" + ] + } + ], "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickForce" + "value": "Physics3D::PhysicsCharacter3D::SimulateStick" }, "parameters": [ "Object", - "Behavior", - "=", - "Value" + "PhysicsCharacter3D", + "SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier)", + "SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier)" ] - }, + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::SetJoystickForce" + "value": "SpriteMultitouchJoystick::IsButtonPressed" }, "parameters": [ "", "ControllerIdentifier", - "JoystickIdentifier", - "JoystickForce", - "" + "JumpButton", + "\"Down\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" + }, + "parameters": [ + "Object", + "PhysicsCharacter3D" ] } ] @@ -2824,37 +5222,151 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::Shooter3DMultitouchMapper", "type": "behavior" } ], "objectGroups": [] + } + ], + "propertyDescriptors": [ + { + "value": "", + "type": "Behavior", + "label": "3D physics character", + "extraInformation": [ + "Physics3D::PhysicsCharacter3D" + ], + "choices": [], + "name": "PhysicsCharacter3D" }, { - "description": "Return the angle the joystick is pointing towards (Range: -180 to 180).", - "fullName": "Joystick angle", - "functionType": "Expression", - "name": "JoystickAngle", + "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": "SetReturnNumber" + "value": "SetNumberVariable" }, "parameters": [ - "JoystickAngle" + "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", + "" ] } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -2864,19 +5376,20 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], "objectGroups": [] }, { - "description": "Change the angle the joystick is pointing towards (Range: -180 to 180).", - "fullName": "Joystick angle", + "description": "Move the camera to look though _PARAM1_ eyes. The object must look to the right when all its angles are 0 and the top of its head be toward Z+.", + "fullName": "Look through object eyes", "functionType": "Action", - "name": "SetJoystickAngle", + "group": "Layers and cameras", + "name": "LookFromObjectEyes", "private": true, - "sentence": "Change the joystick angle of _PARAM0_ to _PARAM2_", + "sentence": "Move the camera to look though _PARAM0_ eyes", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -2884,24 +5397,61 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickAngle" + "value": "CentreCamera" }, "parameters": [ + "", "Object", - "Behavior", + "", + "Object.Layer()", + "" + ] + }, + { + "type": { + "value": "Scene3D::SetCameraZ" + }, + "parameters": [ + "", "=", - "Value" + "Object.Object3D::Z() + Object.Object3D::Depth() + OffsetZ", + "", + "" ] }, { "type": { - "value": "SpriteMultitouchJoystick::SetJoystickAngle" + "value": "Scene3D::SetCameraRotationX" }, "parameters": [ "", - "ControllerIdentifier", - "JoystickIdentifier", - "JoystickAngle", + "=", + "- 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()", "" ] } @@ -2917,23 +5467,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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": "", + "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", @@ -2944,7 +5490,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "Object.Behavior::JoystickForce() * cos(ToRad(Object.Behavior::JoystickAngle()))" + "HorizontalRotationSpeedMax" ] } ] @@ -2962,17 +5508,17 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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", + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "HorizontalRotationSpeedMax", + "name": "SetHorizontalRotationSpeedMax", "sentence": "", "events": [ { @@ -2981,18 +5527,17 @@ "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "SetNumberVariable" }, "parameters": [ - "Object.Behavior::JoystickForce() * sin(ToRad(Object.Behavior::JoystickAngle()))" + "HorizontalRotationSpeedMax", + "=", + "Value" ] } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -3002,58 +5547,38 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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_", + "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": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::JoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - ">", - "0", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::IsAngleIn4WayDirection" - }, - "parameters": [ - "", - "JoystickAngle", - "Direction", - "" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "SetReturnBoolean" + "value": "SetReturnNumber" }, "parameters": [ - "True" + "HorizontalRotationAcceleration" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -3063,59 +5588,31 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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_", + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "HorizontalRotationAcceleration", + "name": "SetHorizontalRotationAcceleration", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::JoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - ">", - "0", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::IsAngleIn8WayDirection" - }, - "parameters": [ - "", - "JoystickAngle", - "Direction", - "" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "SetReturnBoolean" + "value": "SetNumberVariable" }, "parameters": [ - "True" + "HorizontalRotationAcceleration", + "=", + "Value" ] } ] @@ -3130,52 +5627,38 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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", + "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": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::PropertyTouchId" - }, - "parameters": [ - "Object", - "Behavior", - "!=", - "0" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "SetReturnBoolean" + "value": "SetReturnNumber" }, "parameters": [ - "True" + "HorizontalRotationDeceleration" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -3185,19 +5668,18 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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_", + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "HorizontalRotationDeceleration", + "name": "SetHorizontalRotationDeceleration", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -3205,25 +5687,12 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "0", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyTouchId" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "HorizontalRotationDeceleration", "=", - "0" + "Value" ] } ] @@ -3238,19 +5707,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the multitouch controller identifier.", - "fullName": "Multitouch controller identifier", + "description": "the maximum vertical rotation speed of the object.", + "fullName": "Maximum vertical rotation speed", "functionType": "ExpressionAndCondition", - "group": "Multitouch Joystick configuration", - "name": "ControllerIdentifier", - "sentence": "the multitouch controller identifier", + "group": "First person camera multitouch controller mapper vertical rotation configuration", + "name": "VerticalRotationSpeedMax", + "sentence": "the maximum vertical rotation speed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -3261,7 +5730,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "ControllerIdentifier" + "VerticalRotationSpeedMax" ] } ] @@ -3279,7 +5748,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], @@ -3288,8 +5757,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "ControllerIdentifier", - "name": "SetControllerIdentifier", + "getterName": "VerticalRotationSpeedMax", + "name": "SetVerticalRotationSpeedMax", "sentence": "", "events": [ { @@ -3298,11 +5767,10 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyControllerIdentifier" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "VerticalRotationSpeedMax", "=", "Value" ] @@ -3319,19 +5787,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the joystick name.", - "fullName": "Joystick name", + "description": "the vertical rotation acceleration of the object.", + "fullName": "Vertical rotation acceleration", "functionType": "ExpressionAndCondition", - "group": "Multitouch Joystick configuration", - "name": "JoystickIdentifier", - "sentence": "the joystick name", + "group": "First person camera multitouch controller mapper vertical rotation configuration", + "name": "VerticalRotationAcceleration", + "sentence": "the vertical rotation acceleration", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -3339,17 +5807,17 @@ "actions": [ { "type": { - "value": "SetReturnString" + "value": "SetReturnNumber" }, "parameters": [ - "JoystickIdentifier" + "VerticalRotationAcceleration" ] } ] } ], "expressionType": { - "type": "string" + "type": "expression" }, "parameters": [ { @@ -3360,7 +5828,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], @@ -3369,8 +5837,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "JoystickIdentifier", - "name": "SetJoystickIdentifier", + "getterName": "VerticalRotationAcceleration", + "name": "SetVerticalRotationAcceleration", "sentence": "", "events": [ { @@ -3379,11 +5847,10 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickIdentifier" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "VerticalRotationAcceleration", "=", "Value" ] @@ -3400,19 +5867,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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", + "description": "the vertical rotation deceleration of the object.", + "fullName": "Vertical rotation deceleration", "functionType": "ExpressionAndCondition", - "group": "Multitouch Joystick configuration", - "name": "DeadZoneRadius", - "sentence": "the dead zone radius", + "group": "First person camera multitouch controller mapper vertical rotation configuration", + "name": "VerticalRotationDeceleration", + "sentence": "the vertical rotation deceleration", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -3423,7 +5890,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "DeadZoneRadius" + "VerticalRotationDeceleration" ] } ] @@ -3441,7 +5908,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], @@ -3450,8 +5917,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "DeadZoneRadius", - "name": "SetDeadZoneRadius", + "getterName": "VerticalRotationDeceleration", + "name": "SetVerticalRotationDeceleration", "sentence": "", "events": [ { @@ -3460,11 +5927,10 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyDeadZoneRadius" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "VerticalRotationDeceleration", "=", "Value" ] @@ -3481,271 +5947,72 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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": "Action", - "name": "doStepPreEvents", - "sentence": "", + "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": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::IsReleased" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyIsReleased" - }, - "parameters": [ - "Object", - "Behavior", - "no" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + "value": "SetReturnNumber" }, "parameters": [ - "Object", - "Behavior", - "\"Idle\"", - "" + "VerticalAngleMin" ] } ] - }, + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ { - "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" - ] - } - ] - } - ] - } - ] + "description": "Object", + "name": "Object", + "type": "object" }, { - "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" - ] - }, + "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": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchId" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "VerticalAngleMin", "=", - "0" + "Value" ] } ] @@ -3760,44 +6027,38 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], "objectGroups": [] }, { - "description": "Check if button is released.", - "fullName": "Button released", - "functionType": "Condition", - "name": "IsReleased", - "sentence": "Button _PARAM0_ is released", + "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": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::PropertyIsReleased" - }, - "parameters": [ - "Object", - "Behavior" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "SetReturnBoolean" + "value": "SetReturnNumber" }, "parameters": [ - "True" + "VerticalAngleMax" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -3807,46 +6068,77 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], "objectGroups": [] }, { - "description": "Check if button is pressed.", - "fullName": "Button pressed", - "functionType": "Condition", - "name": "IsPressed", - "sentence": "Button _PARAM0_ is pressed", + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "VerticalAngleMax", + "name": "SetVerticalAngleMax", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "conditions": [], + "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::PropertyTouchId" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", - "!=", - "0" + "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": "SetReturnBoolean" + "value": "SetReturnNumber" }, "parameters": [ - "True" + "OffsetZ" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -3856,18 +6148,18 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], "objectGroups": [] }, { - "fullName": "Button state", - "functionType": "Action", - "name": "SetButtonState", - "private": true, - "sentence": "Mark the button _PARAM0_ as _PARAM2_", + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "OffsetZ", + "name": "SetOffsetZ", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -3875,14 +6167,12 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::SetButtonState" + "value": "SetNumberVariable" }, "parameters": [ - "", - "ControllerIdentifier", - "ButtonIdentifier", - "ButtonState", - "" + "OffsetZ", + "=", + "Value" ] } ] @@ -3897,61 +6187,140 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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": "Multitouch controller identifier (1, 2, 3, 4...)", + "label": "Controller identifier (1, 2, 3, 4...)", "name": "ControllerIdentifier" }, { - "value": "A", - "type": "String", - "label": "Button identifier", - "name": "ButtonIdentifier" + "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", - "label": "TouchID", - "hidden": true, - "name": "TouchId" + "unit": "Pixel", + "label": "Z position offset", + "group": "Position", + "name": "OffsetZ" }, { - "value": "", + "value": "0", "type": "Number", - "label": "", + "unit": "AngularSpeed", + "label": "Current rotation speed Z", "hidden": true, - "name": "TouchIndex" + "name": "CurrentRotationSpeedZ" }, { - "value": "", - "type": "Boolean", - "label": "Button released", + "value": "0", + "type": "Number", + "unit": "AngularSpeed", + "label": "Current rotation speed Y", "hidden": true, - "name": "IsReleased" + "name": "CurrentRotationSpeedY" } ], "sharedPropertyDescriptors": [] }, { - "description": "Control a platformer character with a multitouch controller.", - "fullName": "Platformer multitouch controller mapper", - "name": "PlatformerMultitouchMapper", + "description": "Control a 3D physics car with a multitouch controller.", + "fullName": "3D car multitouch controller mapper", + "name": "PhysicsCar3DMultitouchMapper", "objectType": "", + "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -3964,69 +6333,14 @@ "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" + "value": "SpriteMultitouchJoystick::StickForce" }, "parameters": [ "", + ">", + "0", "ControllerIdentifier", - "JoystickIdentifier", - "\"Up\"", + "SteerJoystickIdentifier", "" ] } @@ -4034,20 +6348,12 @@ "actions": [ { "type": { - "value": "PlatformBehavior::SimulateUpKey" - }, - "parameters": [ - "Object", - "Property" - ] - }, - { - "type": { - "value": "PlatformBehavior::SimulateLadderKey" + "value": "Physics3D::PhysicsCar3D::SimulateSteeringStick" }, "parameters": [ "Object", - "Property" + "PhysicsCar3D", + "SpriteMultitouchJoystick::StickForceX(ControllerIdentifier, \"Primary\")" ] } ] @@ -4057,13 +6363,14 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" + "value": "SpriteMultitouchJoystick::StickForce" }, "parameters": [ "", + ">", + "0", "ControllerIdentifier", - "JoystickIdentifier", - "\"Down\"", + "SpeedJoystickIdentifier", "" ] } @@ -4071,11 +6378,12 @@ "actions": [ { "type": { - "value": "PlatformBehavior::SimulateDownKey" + "value": "Physics3D::PhysicsCar3D::SimulateAcceleratorStick" }, "parameters": [ "Object", - "Property" + "PhysicsCar3D", + "-SpriteMultitouchJoystick::StickForceY(ControllerIdentifier, \"Secondary\")" ] } ] @@ -4090,7 +6398,7 @@ "parameters": [ "", "ControllerIdentifier", - "JumpButton", + "HandBrakeButton", "\"Down\"" ] } @@ -4098,11 +6406,11 @@ "actions": [ { "type": { - "value": "PlatformBehavior::SimulateJumpKey" + "value": "Physics3D::PhysicsCar3D::SimulateHandBrakeKey" }, "parameters": [ "Object", - "Property" + "PhysicsCar3D" ] } ] @@ -4117,7 +6425,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::PlatformerMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::PhysicsCar3DMultitouchMapper", "type": "behavior" } ], @@ -4128,12 +6436,12 @@ { "value": "", "type": "Behavior", - "label": "Platform character behavior", + "label": "3D physics car", "extraInformation": [ - "PlatformBehavior::PlatformerObjectBehavior" + "Physics3D::PhysicsCar3D" ], "choices": [], - "name": "Property" + "name": "PhysicsCar3D" }, { "value": "1", @@ -4144,7 +6452,7 @@ { "value": "Primary", "type": "Choice", - "label": "Joystick name", + "label": "Steer joystick", "group": "Controls", "choices": [ { @@ -4156,14 +6464,31 @@ "value": "Secondary" } ], - "name": "JoystickIdentifier" + "name": "SteerJoystickIdentifier" }, { - "value": "A", + "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": "Jump button name", + "label": "Hand brake button name", "group": "Controls", - "name": "JumpButton" + "name": "HandBrakeButton" } ], "sharedPropertyDescriptors": [] @@ -4173,6 +6498,7 @@ "fullName": "Top-down multitouch controller mapper", "name": "TopDownMultitouchMapper", "objectType": "", + "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -4185,11 +6511,10 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "StickMode", "=", "\"Analog\"" ] @@ -4214,11 +6539,10 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "StickMode", "=", "\"360°\"" ] @@ -4243,11 +6567,10 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "StickMode", "=", "\"8 Directions\"" ] @@ -4856,7 +7179,6 @@ } ], "instances": [], - "editionSettings": {}, "eventsFunctions": [ { "fullName": "", @@ -4975,17 +7297,90 @@ "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ + "conditions": [ { "type": { - "value": "MettreAutour" + "inverted": true, + "value": "SpriteMultitouchJoystick::IsInGameEdition" }, "parameters": [ - "Thumb", - "Border", - "Border.MultitouchJoystick::JoystickForce() * Border.Width() / 2", - "Border.MultitouchJoystick::JoystickAngle()" + "", + "" + ] + } + ], + "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", + "" + ] + } ] } ] @@ -5053,7 +7448,7 @@ "Border", "MultitouchJoystick", "=", - "Object.PropertyControllerIdentifier()", + "ControllerIdentifier", "" ] }, @@ -5065,7 +7460,7 @@ "Border", "MultitouchJoystick", "=", - "Object.PropertyJoystickIdentifier()", + "JoystickIdentifier", "" ] }, @@ -5077,7 +7472,92 @@ "Border", "MultitouchJoystick", "=", - "Object.PropertyDeadZoneRadius()", + "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)", "" ] } @@ -5094,6 +7574,92 @@ ], "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", @@ -5107,10 +7673,12 @@ { "type": { "inverted": true, - "value": "GetArgumentAsBoolean" + "value": "BooleanVariable" }, "parameters": [ - "\"ShouldActivate\"" + "ShouldActivate", + "True", + "" ] } ], @@ -5132,10 +7700,12 @@ "conditions": [ { "type": { - "value": "GetArgumentAsBoolean" + "value": "BooleanVariable" }, "parameters": [ - "\"ShouldActivate\"" + "ShouldActivate", + "True", + "" ] } ], @@ -5809,9 +8379,15 @@ "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 f13b5865f..fae1edaab 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.8.4", + "version": "1.9.0", "description": [ "Multitouch joysticks are objects showing a joystick on the screen, useful for mobile. They work like a physical gamepad:", "- 4 or 8 directions", @@ -2009,11 +2009,11 @@ "objectGroups": [] }, { - "description": "Check if a button is pressed on a gamepad.", - "fullName": "Multitouch controller button pressed", + "description": "Check if a button was just pressed on a multitouch controller.", + "fullName": "Multitouch controller button just pressed", "functionType": "Condition", - "name": "IsButtonPressed", - "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", + "name": "IsButtonJustPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ was just pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -2025,7 +2025,7 @@ "parameters": [ "Controllers[ControllerIdentifier].Buttons[Button].State", "=", - "\"Pressed\"" + "\"JustPressed\"" ] } ], @@ -2057,7 +2057,73 @@ "objectGroups": [] }, { - "description": "Check if a button is released on a gamepad.", + "description": "Check if a button is pressed on a multitouch controller.", + "fullName": "Multitouch controller button pressed", + "functionType": "Condition", + "name": "IsButtonPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::Or" + }, + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"Pressed\"" + ] + }, + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"JustPressed\"" + ] + } + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier", + "type": "expression" + }, + { + "description": "Button name", + "name": "Button", + "supplementaryInformation": "[\"A\",\"CROSS\",\"B\",\"CIRCLE\",\"X\",\"SQUARE\",\"Y\",\"TRIANGLE\",\"LB\",\"L1\",\"RB\",\"R1\",\"LT\",\"L2\",\"RT\",\"R2\",\"UP\",\"DOWN\",\"LEFT\",\"RIGHT\",\"BACK\",\"SHARE\",\"START\",\"OPTIONS\",\"CLICK_STICK_LEFT\",\"CLICK_STICK_RIGHT\",\"PS_BUTTON\",\"CLICK_TOUCHPAD\"]", + "type": "string" + } + ], + "objectGroups": [] + }, + { + "description": "Check if a button is released on a multitouch controller.", "fullName": "Multitouch controller button released", "functionType": "Condition", "name": "IsButtonReleased", @@ -2143,7 +2209,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"JustPressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -4633,11 +4699,11 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::IsReleased" + "value": "BooleanVariable" }, "parameters": [ - "Object", - "Behavior", + "IsReleased", + "True", "" ] } @@ -4666,6 +4732,44 @@ } ] }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "False", + "" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + }, + "parameters": [ + "Object", + "Behavior", + "\"Pressed\"", + "" + ] + } + ] + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ @@ -4758,7 +4862,17 @@ "parameters": [ "Object", "Behavior", - "\"Pressed\"", + "\"JustPressed\"", + "" + ] + }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "True", "" ] } @@ -4829,6 +4943,16 @@ "" ] }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "False", + "" + ] + }, { "type": { "value": "SetNumberVariable" @@ -4858,11 +4982,11 @@ "objectGroups": [] }, { - "description": "Check if button is released.", - "fullName": "Button released", + "description": "Check if the button was just pressed.", + "fullName": "Button just pressed", "functionType": "Condition", - "name": "IsReleased", - "sentence": "Button _PARAM0_ is released", + "name": "IsJustPressed", + "sentence": "Button _PARAM0_ was just pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -4872,7 +4996,7 @@ "value": "BooleanVariable" }, "parameters": [ - "IsReleased", + "IsJustPressed", "True", "" ] @@ -4906,7 +5030,7 @@ "objectGroups": [] }, { - "description": "Check if button is pressed.", + "description": "Check if the button is pressed.", "fullName": "Button pressed", "functionType": "Condition", "name": "IsPressed", @@ -4953,6 +5077,54 @@ ], "objectGroups": [] }, + { + "description": "Check if the button is released.", + "fullName": "Button released", + "functionType": "Condition", + "name": "IsReleased", + "sentence": "Button _PARAM0_ is released", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsReleased", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "type": "behavior" + } + ], + "objectGroups": [] + }, { "fullName": "Button state", "functionType": "Action", @@ -4994,7 +5166,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"JustPressed\",\"Pressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -5035,6 +5207,13 @@ "hidden": true, "name": "IsReleased" }, + { + "value": "", + "type": "Boolean", + "label": "Button just pressed", + "hidden": true, + "name": "IsJustPressed" + }, { "value": "0", "type": "Number", @@ -7449,7 +7628,6 @@ } ], "instances": [], - "editionSettings": {}, "eventsFunctions": [ { "fullName": "", @@ -8658,8 +8836,7 @@ "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 53dc9269c..b08abdb82 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.8.4", + "version": "1.9.0", "description": [ "Multitouch joysticks are objects showing a joystick on the screen, useful for mobile. They work like a physical gamepad:", "- 4 or 8 directions", @@ -1710,11 +1710,11 @@ "objectGroups": [] }, { - "description": "Check if a button is pressed on a gamepad.", - "fullName": "Multitouch controller button pressed", + "description": "Check if a button was just pressed on a multitouch controller.", + "fullName": "Multitouch controller button just pressed", "functionType": "Condition", - "name": "IsButtonPressed", - "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", + "name": "IsButtonJustPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ was just pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -1726,7 +1726,73 @@ "parameters": [ "Controllers[ControllerIdentifier].Buttons[Button].State", "=", - "\"Pressed\"" + "\"JustPressed\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier", + "type": "expression" + }, + { + "description": "Button name", + "name": "Button", + "supplementaryInformation": "[\"A\",\"CROSS\",\"B\",\"CIRCLE\",\"X\",\"SQUARE\",\"Y\",\"TRIANGLE\",\"LB\",\"L1\",\"RB\",\"R1\",\"LT\",\"L2\",\"RT\",\"R2\",\"UP\",\"DOWN\",\"LEFT\",\"RIGHT\",\"BACK\",\"SHARE\",\"START\",\"OPTIONS\",\"CLICK_STICK_LEFT\",\"CLICK_STICK_RIGHT\",\"PS_BUTTON\",\"CLICK_TOUCHPAD\"]", + "type": "string" + } + ], + "objectGroups": [] + }, + { + "description": "Check if a button is pressed on a multitouch controller.", + "fullName": "Multitouch controller button pressed", + "functionType": "Condition", + "name": "IsButtonPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::Or" + }, + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"Pressed\"" + ] + }, + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"JustPressed\"" + ] + } ] } ], @@ -1758,7 +1824,7 @@ "objectGroups": [] }, { - "description": "Check if a button is released on a gamepad.", + "description": "Check if a button is released on a multitouch controller.", "fullName": "Multitouch controller button released", "functionType": "Condition", "name": "IsButtonReleased", @@ -1844,7 +1910,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"JustPressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -4334,11 +4400,11 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::IsReleased" + "value": "BooleanVariable" }, "parameters": [ - "Object", - "Behavior", + "IsReleased", + "True", "" ] } @@ -4367,6 +4433,44 @@ } ] }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "False", + "" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + }, + "parameters": [ + "Object", + "Behavior", + "\"Pressed\"", + "" + ] + } + ] + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ @@ -4459,7 +4563,17 @@ "parameters": [ "Object", "Behavior", - "\"Pressed\"", + "\"JustPressed\"", + "" + ] + }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "True", "" ] } @@ -4530,6 +4644,16 @@ "" ] }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "False", + "" + ] + }, { "type": { "value": "SetNumberVariable" @@ -4559,11 +4683,11 @@ "objectGroups": [] }, { - "description": "Check if button is released.", - "fullName": "Button released", + "description": "Check if the button was just pressed.", + "fullName": "Button just pressed", "functionType": "Condition", - "name": "IsReleased", - "sentence": "Button _PARAM0_ is released", + "name": "IsJustPressed", + "sentence": "Button _PARAM0_ was just pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -4573,7 +4697,7 @@ "value": "BooleanVariable" }, "parameters": [ - "IsReleased", + "IsJustPressed", "True", "" ] @@ -4607,7 +4731,7 @@ "objectGroups": [] }, { - "description": "Check if button is pressed.", + "description": "Check if the button is pressed.", "fullName": "Button pressed", "functionType": "Condition", "name": "IsPressed", @@ -4654,6 +4778,54 @@ ], "objectGroups": [] }, + { + "description": "Check if the button is released.", + "fullName": "Button released", + "functionType": "Condition", + "name": "IsReleased", + "sentence": "Button _PARAM0_ is released", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsReleased", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "type": "behavior" + } + ], + "objectGroups": [] + }, { "fullName": "Button state", "functionType": "Action", @@ -4695,7 +4867,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"JustPressed\",\"Pressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -4736,6 +4908,13 @@ "hidden": true, "name": "IsReleased" }, + { + "value": "", + "type": "Boolean", + "label": "Button just pressed", + "hidden": true, + "name": "IsJustPressed" + }, { "value": "0", "type": "Number", @@ -7150,7 +7329,6 @@ } ], "instances": [], - "editionSettings": {}, "eventsFunctions": [ { "fullName": "", @@ -8359,8 +8537,7 @@ "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 6ecb306dc..fdd417e73 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.8.2", + "version": "1.9.0", "description": [ - "Multitouch joysticks can be used the same way as physical gamepads:", + "Multitouch joysticks are objects showing a joystick on the screen, useful for mobile. They work like a physical gamepad:", "- 4 or 8 directions", "- Analogus pads", "- Player selection", - "- Controls mapping for top-down movement and platformer characters", + "- Automatic \"mapper\" behaviors for 2D and 3D movement behaviors (platformer characters, top-down movement, 3D character etc...). Add one of these to the object with the movement behavior (i.e: the player most of the time) and the behavior will then be controlled automatically by the virtual joystick (it works by reading the multitouch joystick state and simulating controls). No need for additional events to make it work once the behaviors are set up.", "", "There are ready-to-use joysticks in the asset-store [multitouch joysticks pack](https://editor.gdevelop.io/?initial-dialog=asset-store&asset-pack=multitouch-joysticks-multitouch-joysticks)." ], @@ -5335,6 +5335,28 @@ } ], "eventsFunctions": [ + { + "description": "Check if the events are running for the editor.", + "fullName": "Editor is running", + "functionType": "Condition", + "name": "IsInGameEdition", + "private": true, + "sentence": "Events are running for the editor", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const game = runtimeScene.getGame();\r", + "eventsFunctionContext.returnValue = game.isInGameEdition && game.isInGameEdition();" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [], + "objectGroups": [] + }, { "fullName": "Accelerated speed", "functionType": "Expression", @@ -5753,11 +5775,11 @@ "objectGroups": [] }, { - "description": "Check if a button is pressed on a gamepad.", - "fullName": "Multitouch controller button pressed", + "description": "Check if a button was just pressed on a multitouch controller.", + "fullName": "Multitouch controller button just pressed", "functionType": "Condition", - "name": "IsButtonPressed", - "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", + "name": "IsButtonJustPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ was just pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -5769,7 +5791,73 @@ "parameters": [ "Controllers[ControllerIdentifier].Buttons[Button].State", "=", - "\"Pressed\"" + "\"JustPressed\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier", + "type": "expression" + }, + { + "description": "Button name", + "name": "Button", + "supplementaryInformation": "[\"A\",\"CROSS\",\"B\",\"CIRCLE\",\"X\",\"SQUARE\",\"Y\",\"TRIANGLE\",\"LB\",\"L1\",\"RB\",\"R1\",\"LT\",\"L2\",\"RT\",\"R2\",\"UP\",\"DOWN\",\"LEFT\",\"RIGHT\",\"BACK\",\"SHARE\",\"START\",\"OPTIONS\",\"CLICK_STICK_LEFT\",\"CLICK_STICK_RIGHT\",\"PS_BUTTON\",\"CLICK_TOUCHPAD\"]", + "type": "string" + } + ], + "objectGroups": [] + }, + { + "description": "Check if a button is pressed on a multitouch controller.", + "fullName": "Multitouch controller button pressed", + "functionType": "Condition", + "name": "IsButtonPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::Or" + }, + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"Pressed\"" + ] + }, + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"JustPressed\"" + ] + } ] } ], @@ -5801,7 +5889,7 @@ "objectGroups": [] }, { - "description": "Check if a button is released on a gamepad.", + "description": "Check if a button is released on a multitouch controller.", "fullName": "Multitouch controller button released", "functionType": "Condition", "name": "IsButtonReleased", @@ -5887,7 +5975,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"JustPressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -7260,41 +7348,23 @@ "conditions": [ { "type": { - "value": "HasGameJustResumed" + "inverted": true, + "value": "SpriteMultitouchJoystick::IsInGameEdition" }, "parameters": [ + "", "" ] } ], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - } - ] - }, - { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Manage touches", - "source": "", - "type": "BuiltinCommonInstructions::Group", + "actions": [], "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "value": "HasAnyTouchOrMouseStarted" + "value": "HasGameJustResumed" }, "parameters": [ "" @@ -7304,171 +7374,207 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" }, "parameters": [ - "TouchIndex", - "=", - "0" + "Object", + "Behavior", + "" ] } - ], + ] + }, + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Manage touches", + "source": "", + "type": "BuiltinCommonInstructions::Group", "events": [ { - "type": "BuiltinCommonInstructions::Repeat", - "repeatExpression": "StartedTouchOrMouseCount()", - "conditions": [], - "actions": [], + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "HasAnyTouchOrMouseStarted" + }, + "parameters": [ + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchIndex", + "=", + "0" + ] + } + ], "events": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "StartedTouchOrMouseCount()", + "conditions": [], + "actions": [], + "events": [ { - "type": { - "value": "NumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "0" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "0" + ] + }, + { + "type": { + "value": "CollisionPoint" + }, + "parameters": [ + "Object", + "TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)", + "TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "StartedTouchOrMouseId(TouchIndex)" + ] + } ] }, { - "type": { - "value": "CollisionPoint" - }, - "parameters": [ - "Object", - "TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)", - "TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "StartedTouchOrMouseId(TouchIndex)" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchIndex", - "+", - "1" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchIndex", + "+", + "1" + ] + } ] } ] } ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 - }, - "comment": "Move thumb back to center when not being pressed (acts like a spring on a real controller)" - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + }, { - "type": { - "value": "HasTouchEnded" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 }, - "parameters": [ - "", - "TouchId" - ] - } - ], - "actions": [ + "comment": "Move thumb back to center when not being pressed (acts like a spring on a real controller)" + }, { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" - }, - "parameters": [ - "Object", - "Behavior", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "HasTouchEnded" + }, + "parameters": [ + "", + "TouchId" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } ] } - ] - } - ], - "parameters": [] - }, - { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Update joystick position", - "source": "", - "type": "BuiltinCommonInstructions::Group", - "events": [ + ], + "parameters": [] + }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Update joystick position", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ { - "type": { - "value": "NumberVariable" - }, - "parameters": [ - "TouchId", - "!=", - "0" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "!=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickAngle" + }, + "parameters": [ + "Object", + "Behavior", + "AngleBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0))", + "AngleBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0))" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "clamp(2 * DistanceBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0)) / Object.Width(), 0, 1)", + "" + ] + } ] } ], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickAngle" - }, - "parameters": [ - "Object", - "Behavior", - "AngleBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0))", - "AngleBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0))" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "clamp(2 * DistanceBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0)) / Object.Width(), 0, 1)", - "" - ] - } - ] + "parameters": [] } - ], - "parameters": [] + ] } ], "parameters": [ @@ -8343,7 +8449,7 @@ "sharedPropertyDescriptors": [] }, { - "description": "Detect button presses made on a touchscreen.", + "description": "Detect presses made on a touchscreen on the object so it acts like a button and automatically trigger the button having the same identifier for the mapper behaviors.", "fullName": "Multitouch button", "name": "MultitouchButton", "objectType": "", @@ -8359,11 +8465,11 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::IsReleased" + "value": "BooleanVariable" }, "parameters": [ - "Object", - "Behavior", + "IsReleased", + "True", "" ] } @@ -8392,6 +8498,44 @@ } ] }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "False", + "" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + }, + "parameters": [ + "Object", + "Behavior", + "\"Pressed\"", + "" + ] + } + ] + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ @@ -8455,11 +8599,10 @@ }, { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::PropertyRadius" + "value": "NumberVariable" }, "parameters": [ - "Object", - "Behavior", + "Radius", ">", "DistanceBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer()), TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer()))" ] @@ -8485,7 +8628,17 @@ "parameters": [ "Object", "Behavior", - "\"Pressed\"", + "\"JustPressed\"", + "" + ] + }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "True", "" ] } @@ -8556,6 +8709,16 @@ "" ] }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "False", + "" + ] + }, { "type": { "value": "SetNumberVariable" @@ -8585,11 +8748,11 @@ "objectGroups": [] }, { - "description": "Check if button is released.", - "fullName": "Button released", + "description": "Check if the button was just pressed.", + "fullName": "Button just pressed", "functionType": "Condition", - "name": "IsReleased", - "sentence": "Button _PARAM0_ is released", + "name": "IsJustPressed", + "sentence": "Button _PARAM0_ was just pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -8599,7 +8762,7 @@ "value": "BooleanVariable" }, "parameters": [ - "IsReleased", + "IsJustPressed", "True", "" ] @@ -8633,7 +8796,7 @@ "objectGroups": [] }, { - "description": "Check if button is pressed.", + "description": "Check if the button is pressed.", "fullName": "Button pressed", "functionType": "Condition", "name": "IsPressed", @@ -8680,6 +8843,54 @@ ], "objectGroups": [] }, + { + "description": "Check if the button is released.", + "fullName": "Button released", + "functionType": "Condition", + "name": "IsReleased", + "sentence": "Button _PARAM0_ is released", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsReleased", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "type": "behavior" + } + ], + "objectGroups": [] + }, { "fullName": "Button state", "functionType": "Action", @@ -8721,7 +8932,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"JustPressed\",\"Pressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -8762,6 +8973,13 @@ "hidden": true, "name": "IsReleased" }, + { + "value": "", + "type": "Boolean", + "label": "Button just pressed", + "hidden": true, + "name": "IsJustPressed" + }, { "value": "0", "type": "Number", @@ -11176,7 +11394,6 @@ } ], "instances": [], - "editionSettings": [], "eventsFunctions": [ { "fullName": "", @@ -11293,74 +11510,92 @@ "name": "doStepPostEvents", "sentence": "", "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "MettreAutour" - }, - "parameters": [ - "Thumb", - "Border", - "Border.MultitouchJoystick::JoystickForce() * Border.Width() / 2", - "Border.MultitouchJoystick::JoystickAngle()" - ] - } - ] - }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ - { - "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "ShouldBeHiddenWhenReleased", - "True", - "" - ] - }, { "type": { "inverted": true, - "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::IsPressed" + "value": "SpriteMultitouchJoystick::IsInGameEdition" }, "parameters": [ - "Object", + "", "" ] } ], - "actions": [ - { - "type": { - "value": "Cache" - }, - "parameters": [ - "Object" - ] - }, + "actions": [], + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::ActivateControl" - }, - "parameters": [ - "Object", - "no", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "MettreAutour" + }, + "parameters": [ + "Thumb", + "Border", + "Border.MultitouchJoystick::JoystickForce() * Border.Width() / 2", + "Border.MultitouchJoystick::JoystickAngle()" + ] + } ] }, { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "ShouldBeHiddenWhenReleased", - "False", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "ShouldBeHiddenWhenReleased", + "True", + "" + ] + }, + { + "type": { + "inverted": true, + "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::IsPressed" + }, + "parameters": [ + "Object", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "Cache" + }, + "parameters": [ + "Object" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::ActivateControl" + }, + "parameters": [ + "Object", + "no", + "" + ] + }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "ShouldBeHiddenWhenReleased", + "False", + "" + ] + } ] } ] @@ -12367,8 +12602,7 @@ "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 978e72a36..ffcd80e1f 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.8.4", + "version": "1.9.0", "description": [ "Multitouch joysticks are objects showing a joystick on the screen, useful for mobile. They work like a physical gamepad:", "- 4 or 8 directions", @@ -2005,11 +2005,11 @@ "objectGroups": [] }, { - "description": "Check if a button is pressed on a gamepad.", - "fullName": "Multitouch controller button pressed", + "description": "Check if a button was just pressed on a multitouch controller.", + "fullName": "Multitouch controller button just pressed", "functionType": "Condition", - "name": "IsButtonPressed", - "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", + "name": "IsButtonJustPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ was just pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -2021,7 +2021,7 @@ "parameters": [ "Controllers[ControllerIdentifier].Buttons[Button].State", "=", - "\"Pressed\"" + "\"JustPressed\"" ] } ], @@ -2053,7 +2053,73 @@ "objectGroups": [] }, { - "description": "Check if a button is released on a gamepad.", + "description": "Check if a button is pressed on a multitouch controller.", + "fullName": "Multitouch controller button pressed", + "functionType": "Condition", + "name": "IsButtonPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::Or" + }, + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"Pressed\"" + ] + }, + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"JustPressed\"" + ] + } + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier", + "type": "expression" + }, + { + "description": "Button name", + "name": "Button", + "supplementaryInformation": "[\"A\",\"CROSS\",\"B\",\"CIRCLE\",\"X\",\"SQUARE\",\"Y\",\"TRIANGLE\",\"LB\",\"L1\",\"RB\",\"R1\",\"LT\",\"L2\",\"RT\",\"R2\",\"UP\",\"DOWN\",\"LEFT\",\"RIGHT\",\"BACK\",\"SHARE\",\"START\",\"OPTIONS\",\"CLICK_STICK_LEFT\",\"CLICK_STICK_RIGHT\",\"PS_BUTTON\",\"CLICK_TOUCHPAD\"]", + "type": "string" + } + ], + "objectGroups": [] + }, + { + "description": "Check if a button is released on a multitouch controller.", "fullName": "Multitouch controller button released", "functionType": "Condition", "name": "IsButtonReleased", @@ -2139,7 +2205,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"JustPressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -4629,11 +4695,11 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::IsReleased" + "value": "BooleanVariable" }, "parameters": [ - "Object", - "Behavior", + "IsReleased", + "True", "" ] } @@ -4662,6 +4728,44 @@ } ] }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "False", + "" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + }, + "parameters": [ + "Object", + "Behavior", + "\"Pressed\"", + "" + ] + } + ] + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ @@ -4754,7 +4858,17 @@ "parameters": [ "Object", "Behavior", - "\"Pressed\"", + "\"JustPressed\"", + "" + ] + }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "True", "" ] } @@ -4825,6 +4939,16 @@ "" ] }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "False", + "" + ] + }, { "type": { "value": "SetNumberVariable" @@ -4854,11 +4978,11 @@ "objectGroups": [] }, { - "description": "Check if button is released.", - "fullName": "Button released", + "description": "Check if the button was just pressed.", + "fullName": "Button just pressed", "functionType": "Condition", - "name": "IsReleased", - "sentence": "Button _PARAM0_ is released", + "name": "IsJustPressed", + "sentence": "Button _PARAM0_ was just pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -4868,7 +4992,7 @@ "value": "BooleanVariable" }, "parameters": [ - "IsReleased", + "IsJustPressed", "True", "" ] @@ -4902,7 +5026,7 @@ "objectGroups": [] }, { - "description": "Check if button is pressed.", + "description": "Check if the button is pressed.", "fullName": "Button pressed", "functionType": "Condition", "name": "IsPressed", @@ -4949,6 +5073,54 @@ ], "objectGroups": [] }, + { + "description": "Check if the button is released.", + "fullName": "Button released", + "functionType": "Condition", + "name": "IsReleased", + "sentence": "Button _PARAM0_ is released", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsReleased", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "type": "behavior" + } + ], + "objectGroups": [] + }, { "fullName": "Button state", "functionType": "Action", @@ -4990,7 +5162,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"JustPressed\",\"Pressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -5031,6 +5203,13 @@ "hidden": true, "name": "IsReleased" }, + { + "value": "", + "type": "Boolean", + "label": "Button just pressed", + "hidden": true, + "name": "IsJustPressed" + }, { "value": "0", "type": "Number", @@ -7445,7 +7624,6 @@ } ], "instances": [], - "editionSettings": {}, "eventsFunctions": [ { "fullName": "", @@ -8654,8 +8832,7 @@ "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 d4a9f0c81..62afafbad 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": "", + "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.4.0", + "version": "1.9.0", "description": [ - "Multitouch joysticks can be used the same way as physical gamepads:", + "Multitouch joysticks are objects showing a joystick on the screen, useful for mobile. They work like a physical gamepad:", "- 4 or 8 directions", "- Analogus pads", "- Player selection", - "- Controls mapping for top-down movement and platformer characters", + "- Automatic \"mapper\" behaviors for 2D and 3D movement behaviors (platformer characters, top-down movement, 3D character etc...). Add one of these to the object with the movement behavior (i.e: the player most of the time) and the behavior will then be controlled automatically by the virtual joystick (it works by reading the multitouch joystick state and simulating controls). No need for additional events to make it work once the behaviors are set up.", "", "There are ready-to-use joysticks in the asset-store [multitouch joysticks pack](https://editor.gdevelop.io/?initial-dialog=asset-store&asset-pack=multitouch-joysticks-multitouch-joysticks)." ], @@ -1362,153 +1362,33 @@ ], "eventsFunctions": [ { - "description": "Check if a button is pressed on a gamepad.", - "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": "StringVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Buttons[Button].State", - "=", - "\"Pressed\"" - ] - } - ], - "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 gamepad.", - "fullName": "Multitouch controller button released", + "description": "Check if the events are running for the editor.", + "fullName": "Editor is running", "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", + "name": "IsInGameEdition", "private": true, - "sentence": "Mark _PARAM2_ button as _PARAM3_ for multitouch controller _PARAM1_", + "sentence": "Events are running for the editor", "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" + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const game = runtimeScene.getGame();\r", + "eventsFunctionContext.returnValue = game.isInGameEdition && game.isInGameEdition();" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false } ], + "parameters": [], "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", + "fullName": "Accelerated speed", + "functionType": "Expression", + "name": "AcceleratedSpeed", "private": true, - "sentence": "Change the dead zone of multitouch joystick _PARAM2_ of multitouch controller _PARAM1_ to _PARAM3_", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -1519,1203 +1399,3781 @@ "value": "SetNumberVariable" }, "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].DeadZone", + "AcceleratedSpeed", "=", - "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)" + "CurrentSpeed" ] } - ] - } - ], - "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": [ + ], + "events": [ { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ + "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": [ + ] + } + ], + "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": "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": [ + "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": [] + }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "JoystickForce", + "name": "SetJoystickForce", + "private": true, + "sentence": "", + "events": [ { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Right\"" + "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" }, { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo4Way" - }, - "parameters": [ - "", - "=", - "0", - "Angle", - "" - ] + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" + }, + { + "description": "", + "name": "Parameter", + "type": "objectList" } ], - "actions": [ + "objectGroups": [] + }, + { + "description": "Return the angle the joystick is pointing towards (Range: -180 to 180).", + "fullName": "Joystick angle", + "functionType": "Expression", + "name": "JoystickAngle", + "sentence": "", + "events": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" + "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": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "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": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Down\"" + "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" }, { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo4Way" - }, - "parameters": [ - "", - "=", - "1", - "Angle", - "" - ] + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" + }, + { + "description": "Angle", + "name": "Value", + "type": "expression" } ], - "actions": [ + "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": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" + "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": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "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": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Left\"" + "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" }, { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo4Way" - }, - "parameters": [ - "", - "=", - "2", - "Angle", - "" + "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" + ] + } ] } ], - "actions": [ + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - }, - { - "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", - "" - ] + "description": "Direction", + "name": "Direction", + "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\"]", + "type": "stringWithSelector" } ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Angle", - "name": "Angle", - "type": "expression" + "objectGroups": [] }, { - "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\"" - ] - }, + "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": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "0", - "Angle", - "" + "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" + ] + } ] } ], - "actions": [ + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - }, - { - "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", - "" - ] + "description": "Direction", + "name": "Direction", + "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\",\"UpLeft\",\"UpRight\",\"DownLeft\",\"DownRight\"]", + "type": "stringWithSelector" } ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Down\"" - ] - }, + "description": "Check if a joystick is pressed.", + "fullName": "Joystick pressed", + "functionType": "Condition", + "name": "IsPressed", + "sentence": "Joystick _PARAM0_ is pressed", + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "2", - "Angle", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "!=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } ] } ], - "actions": [ + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } - ] + ], + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"DownLeft\"" - ] - }, + "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": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "3", - "Angle", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "0", + "" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "0" + ] + } ] } ], - "actions": [ + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } - ] + ], + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Left\"" - ] - }, + "description": "the multitouch controller identifier.", + "fullName": "Multitouch controller identifier", + "functionType": "ExpressionAndCondition", + "group": "Multitouch Joystick configuration", + "name": "ControllerIdentifier", + "sentence": "the multitouch controller identifier", + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "4", - "Angle", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "ControllerIdentifier" + ] + } ] } ], - "actions": [ + "expressionType": { + "type": "expression" + }, + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } - ] + ], + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"UpLeft\"" - ] - }, + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "ControllerIdentifier", + "name": "SetControllerIdentifier", + "sentence": "", + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "5", - "Angle", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "ControllerIdentifier", + "=", + "Value" + ] + } ] } ], - "actions": [ + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } - ] + ], + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Up\"" - ] - }, + "description": "the joystick name.", + "fullName": "Joystick name", + "functionType": "ExpressionAndCondition", + "group": "Multitouch Joystick configuration", + "name": "JoystickIdentifier", + "sentence": "the joystick name", + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "6", - "Angle", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnString" + }, + "parameters": [ + "JoystickIdentifier" + ] + } ] } ], - "actions": [ + "expressionType": { + "type": "string" + }, + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } - ] + ], + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "JoystickIdentifier", + "name": "SetJoystickIdentifier", + "sentence": "", + "events": [ { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"UpRight\"" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "JoystickIdentifier", + "=", + "Value" + ] + } ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" }, { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "7", - "Angle", - "" - ] + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } ], - "actions": [ + "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": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "DeadZoneRadius" + ] + } ] } - ] - } - ], - "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 + ], + "expressionType": { + "type": "expression" }, - "comment": "Make sure the joystick has moved from center" - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "parameters": [ { - "type": { - "value": "SpriteMultitouchJoystick::JoystickForce" - }, - "parameters": [ - "", - ">", - "0", - "ControllerIdentifier", - "JoystickIdentifier", - "" - ] + "description": "Object", + "name": "Object", + "type": "object" }, { - "type": { - "value": "SpriteMultitouchJoystick::IsAngleIn4WayDirection" - }, - "parameters": [ - "", - "SpriteMultitouchJoystick::JoystickAngle(ControllerIdentifier, JoystickIdentifier)", - "Direction", - "" - ] + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } ], - "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" + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "DeadZoneRadius", + "name": "SetDeadZoneRadius", + "sentence": "", + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::JoystickForce" - }, - "parameters": [ - "", - ">", - "0", - "ControllerIdentifier", - "JoystickIdentifier", - "" + "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" }, { - "type": { - "value": "SpriteMultitouchJoystick::IsAngleIn8WayDirection" - }, - "parameters": [ - "", - "SpriteMultitouchJoystick::JoystickAngle(ControllerIdentifier, JoystickIdentifier)", - "Direction", - "" - ] + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } ], - "actions": [ + "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": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" + "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": [] } ], - "parameters": [ + "propertyDescriptors": [ { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" + "value": "1", + "type": "Number", + "label": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier" }, { - "description": "Joystick name", - "name": "JoystickIdentifier", - "supplementaryInformation": "[\"Primary\",\"Secondary\"]", - "type": "stringWithSelector" + "value": "Primary", + "type": "String", + "label": "Joystick name", + "name": "JoystickIdentifier" }, { - "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" + "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" }, { - "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": [ + "value": "0", + "type": "Number", + "label": "Joystick angle (range: -180 to 180)", + "hidden": true, + "name": "JoystickAngle" + }, { - "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": [ + "value": "0", + "type": "Number", + "label": "Joystick force (range: 0 to 1)", + "hidden": true, + "name": "JoystickForce" + }, { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" + "value": "0", + "type": "Number", + "label": "", + "hidden": true, + "name": "TouchId" }, { - "description": "Stick name", - "name": "JoystickIdentifier", - "supplementaryInformation": "[\"Primary\",\"Secondary\"]", - "type": "stringWithSelector" + "value": "", + "type": "Number", + "label": "", + "hidden": true, + "name": "TouchIndex" } ], - "objectGroups": [] + "sharedPropertyDescriptors": [] }, { - "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": [ + "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": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ + "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": { - "value": "SetNumberVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].Force", - "=", - "Value" + "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" + ] + } + ] + } + ] + } ] - } - ] - } - ], - "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)" + "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" + ] + } ] } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "type": "behavior" + } + ], + "objectGroups": [] }, { - "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": "Check if the button was just pressed.", + "fullName": "Button just pressed", + "functionType": "Condition", + "name": "IsJustPressed", + "sentence": "Button _PARAM0_ was just pressed", + "events": [ { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].Angle" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } ] } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "type": "behavior" + } + ], + "objectGroups": [] }, { - "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": [ + "description": "Check if the button is pressed.", + "fullName": "Button pressed", + "functionType": "Condition", + "name": "IsPressed", + "sentence": "Button _PARAM0_ is pressed", + "events": [ { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].Angle", - "=", - "Value" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "!=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } ] } - ] - } - ], - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "type": "behavior" + } + ], + "objectGroups": [] }, { - "description": "Joystick name", - "name": "JoystickIdentifier", - "type": "string" + "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": [] }, { - "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": [ + "fullName": "Button state", + "functionType": "Action", + "name": "SetButtonState", + "private": true, + "sentence": "Mark the button _PARAM0_ as _PARAM2_", + "events": [ { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "SpriteMultitouchJoystick::JoystickForce(ControllerIdentifier, JoystickIdentifier) * cos(ToRad(SpriteMultitouchJoystick::JoystickAngle(ControllerIdentifier, JoystickIdentifier)))" + "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": [] } ], - "expressionType": { - "type": "expression" - }, - "parameters": [ + "propertyDescriptors": [ { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" + "value": "1", + "type": "Number", + "label": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier" }, { - "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": [ + "value": "A", + "type": "String", + "label": "Button identifier", + "name": "ButtonIdentifier" + }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "SpriteMultitouchJoystick::JoystickForce(ControllerIdentifier, JoystickIdentifier) * sin(ToRad(SpriteMultitouchJoystick::JoystickAngle(ControllerIdentifier, JoystickIdentifier)))" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ + "value": "0", + "type": "Number", + "label": "TouchID", + "hidden": true, + "name": "TouchId" + }, { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" + "value": "", + "type": "Number", + "label": "", + "hidden": true, + "name": "TouchIndex" }, { - "description": "Joystick name", - "name": "JoystickIdentifier", - "supplementaryInformation": "[\"Primary\",\"Secondary\"]", - "type": "stringWithSelector" + "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" } ], - "objectGroups": [] - } - ], - "eventsBasedBehaviors": [ + "sharedPropertyDescriptors": [] + }, { - "description": "Joystick that can be controlled by interacting with a touchscreen.", - "fullName": "Multitouch Joystick", - "name": "MultitouchJoystick", + "description": "Control a platformer character with a multitouch controller.", + "fullName": "Platformer multitouch controller mapper", + "name": "PlatformerMultitouchMapper", "objectType": "", - "private": true, + "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", "functionType": "Action", - "name": "onCreated", + "name": "doStepPreEvents", "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ + "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::SetDeadZone" + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" }, "parameters": [ "", "ControllerIdentifier", "JoystickIdentifier", - "DeadZoneRadius", + "\"Left\"", "" ] - }, + } + ], + "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" + "value": "PlatformBehavior::SimulateLeftKey" }, "parameters": [ "Object", - "Behavior", + "Property" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JoystickIdentifier", + "\"Right\"", "" ] } + ], + "actions": [ + { + "type": { + "value": "PlatformBehavior::SimulateRightKey" + }, + "parameters": [ + "Object", + "Property" + ] + } ] - } - ], - "parameters": [ + }, { - "description": "Object", - "name": "Object", - "type": "object" + "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" + ] + } + ] }, { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "Action", - "name": "onDeActivate", - "sentence": "", - "events": [ + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JoystickIdentifier", + "\"Down\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "PlatformBehavior::SimulateDownKey" + }, + "parameters": [ + "Object", + "Property" + ] + } + ] + }, { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::IsButtonPressed" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JumpButton", + "\"Down\"" + ] + } + ], "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" + "value": "PlatformBehavior::SimulateJumpKey" }, "parameters": [ "Object", - "Behavior", - "" + "Property" ] } ] @@ -2730,12 +5188,64 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::PlatformerMultitouchMapper", "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", @@ -2747,262 +5257,71 @@ "conditions": [ { "type": { - "value": "HasGameJustResumed" - }, - "parameters": [ - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" + "value": "SpriteMultitouchJoystick::StickForce" }, "parameters": [ - "Object", - "Behavior", + "", + ">", + "0", + "ControllerIdentifier", + "JoystickIdentifier", "" ] } - ] - }, - { - "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": "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": "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" + "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)" + ] + } + ] }, - { - "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": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::IsButtonPressed" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JumpButton", + "\"Down\"" + ] + } + ], "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" }, "parameters": [ - "max(0, JoystickForce - DeadZoneRadius) / (1 - DeadZoneRadius)" + "Object", + "PhysicsCharacter3D" ] } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -3012,45 +5331,124 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "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": "ActionWithOperator", - "getterName": "JoystickForce", - "name": "SetJoystickForce", - "private": true, + "functionType": "Action", + "name": "doStepPreEvents", "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::StickForce" + }, + "parameters": [ + "", + ">", + "0", + "ControllerIdentifier", + "JoystickIdentifier", + "" + ] + } + ], "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickForce" + "value": "Physics3D::PhysicsCharacter3D::SimulateStick" }, "parameters": [ "Object", - "Behavior", - "=", - "Value" + "PhysicsCharacter3D", + "SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier)", + "SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier)" ] - }, + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::SetJoystickForce" + "value": "SpriteMultitouchJoystick::IsButtonPressed" }, "parameters": [ "", "ControllerIdentifier", - "JoystickIdentifier", - "JoystickForce", - "" + "JumpButton", + "\"Down\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" + }, + "parameters": [ + "Object", + "PhysicsCharacter3D" ] } ] @@ -3065,37 +5463,151 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::Shooter3DMultitouchMapper", "type": "behavior" } ], "objectGroups": [] + } + ], + "propertyDescriptors": [ + { + "value": "", + "type": "Behavior", + "label": "3D physics character", + "extraInformation": [ + "Physics3D::PhysicsCharacter3D" + ], + "choices": [], + "name": "PhysicsCharacter3D" }, { - "description": "Return the angle the joystick is pointing towards (Range: -180 to 180).", - "fullName": "Joystick angle", - "functionType": "Expression", - "name": "JoystickAngle", + "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": "SetReturnNumber" + "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": [ - "JoystickAngle" + "Object", + "Behavior", + "" ] } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -3105,19 +5617,20 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], "objectGroups": [] }, { - "description": "Change the angle the joystick is pointing towards (Range: -180 to 180).", - "fullName": "Joystick angle", + "description": "Move the camera to look though _PARAM1_ eyes. The object must look to the right when all its angles are 0 and the top of its head be toward Z+.", + "fullName": "Look through object eyes", "functionType": "Action", - "name": "SetJoystickAngle", + "group": "Layers and cameras", + "name": "LookFromObjectEyes", "private": true, - "sentence": "Change the joystick angle of _PARAM0_ to _PARAM2_", + "sentence": "Move the camera to look though _PARAM0_ eyes", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -3125,24 +5638,61 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickAngle" + "value": "CentreCamera" }, "parameters": [ + "", "Object", - "Behavior", + "", + "Object.Layer()", + "" + ] + }, + { + "type": { + "value": "Scene3D::SetCameraZ" + }, + "parameters": [ + "", "=", - "Value" + "Object.Object3D::Z() + Object.Object3D::Depth() + OffsetZ", + "", + "" ] }, { "type": { - "value": "SpriteMultitouchJoystick::SetJoystickAngle" + "value": "Scene3D::SetCameraRotationX" }, "parameters": [ "", - "ControllerIdentifier", - "JoystickIdentifier", - "JoystickAngle", + "=", + "- 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()", "" ] } @@ -3158,23 +5708,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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": "", + "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", @@ -3185,7 +5731,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "Object.Behavior::JoystickForce() * cos(ToRad(Object.Behavior::JoystickAngle()))" + "HorizontalRotationSpeedMax" ] } ] @@ -3203,17 +5749,17 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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", + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "HorizontalRotationSpeedMax", + "name": "SetHorizontalRotationSpeedMax", "sentence": "", "events": [ { @@ -3222,18 +5768,17 @@ "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "SetNumberVariable" }, "parameters": [ - "Object.Behavior::JoystickForce() * sin(ToRad(Object.Behavior::JoystickAngle()))" + "HorizontalRotationSpeedMax", + "=", + "Value" ] } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -3243,58 +5788,38 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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_", + "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": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::JoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - ">", - "0", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::IsAngleIn4WayDirection" - }, - "parameters": [ - "", - "JoystickAngle", - "Direction", - "" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "SetReturnBoolean" + "value": "SetReturnNumber" }, "parameters": [ - "True" + "HorizontalRotationAcceleration" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -3304,59 +5829,31 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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_", + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "HorizontalRotationAcceleration", + "name": "SetHorizontalRotationAcceleration", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::JoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - ">", - "0", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::IsAngleIn8WayDirection" - }, - "parameters": [ - "", - "JoystickAngle", - "Direction", - "" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "SetReturnBoolean" + "value": "SetNumberVariable" }, "parameters": [ - "True" + "HorizontalRotationAcceleration", + "=", + "Value" ] } ] @@ -3371,52 +5868,38 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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", + "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": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::PropertyTouchId" - }, - "parameters": [ - "Object", - "Behavior", - "!=", - "0" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "SetReturnBoolean" + "value": "SetReturnNumber" }, "parameters": [ - "True" + "HorizontalRotationDeceleration" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -3426,19 +5909,18 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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_", + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "HorizontalRotationDeceleration", + "name": "SetHorizontalRotationDeceleration", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -3446,25 +5928,12 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "0", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyTouchId" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "HorizontalRotationDeceleration", "=", - "0" + "Value" ] } ] @@ -3479,19 +5948,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the multitouch controller identifier.", - "fullName": "Multitouch controller identifier", + "description": "the maximum vertical rotation speed of the object.", + "fullName": "Maximum vertical rotation speed", "functionType": "ExpressionAndCondition", - "group": "Multitouch Joystick configuration", - "name": "ControllerIdentifier", - "sentence": "the multitouch controller identifier", + "group": "First person camera multitouch controller mapper vertical rotation configuration", + "name": "VerticalRotationSpeedMax", + "sentence": "the maximum vertical rotation speed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -3502,7 +5971,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "ControllerIdentifier" + "VerticalRotationSpeedMax" ] } ] @@ -3520,7 +5989,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], @@ -3529,8 +5998,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "ControllerIdentifier", - "name": "SetControllerIdentifier", + "getterName": "VerticalRotationSpeedMax", + "name": "SetVerticalRotationSpeedMax", "sentence": "", "events": [ { @@ -3539,11 +6008,10 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyControllerIdentifier" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "VerticalRotationSpeedMax", "=", "Value" ] @@ -3560,19 +6028,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the joystick name.", - "fullName": "Joystick name", + "description": "the vertical rotation acceleration of the object.", + "fullName": "Vertical rotation acceleration", "functionType": "ExpressionAndCondition", - "group": "Multitouch Joystick configuration", - "name": "JoystickIdentifier", - "sentence": "the joystick name", + "group": "First person camera multitouch controller mapper vertical rotation configuration", + "name": "VerticalRotationAcceleration", + "sentence": "the vertical rotation acceleration", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -3580,17 +6048,17 @@ "actions": [ { "type": { - "value": "SetReturnString" + "value": "SetReturnNumber" }, "parameters": [ - "JoystickIdentifier" + "VerticalRotationAcceleration" ] } ] } ], "expressionType": { - "type": "string" + "type": "expression" }, "parameters": [ { @@ -3601,7 +6069,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], @@ -3610,8 +6078,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "JoystickIdentifier", - "name": "SetJoystickIdentifier", + "getterName": "VerticalRotationAcceleration", + "name": "SetVerticalRotationAcceleration", "sentence": "", "events": [ { @@ -3620,11 +6088,10 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickIdentifier" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "VerticalRotationAcceleration", "=", "Value" ] @@ -3641,19 +6108,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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", + "description": "the vertical rotation deceleration of the object.", + "fullName": "Vertical rotation deceleration", "functionType": "ExpressionAndCondition", - "group": "Multitouch Joystick configuration", - "name": "DeadZoneRadius", - "sentence": "the dead zone radius", + "group": "First person camera multitouch controller mapper vertical rotation configuration", + "name": "VerticalRotationDeceleration", + "sentence": "the vertical rotation deceleration", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -3664,7 +6131,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "DeadZoneRadius" + "VerticalRotationDeceleration" ] } ] @@ -3682,7 +6149,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], @@ -3691,8 +6158,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "DeadZoneRadius", - "name": "SetDeadZoneRadius", + "getterName": "VerticalRotationDeceleration", + "name": "SetVerticalRotationDeceleration", "sentence": "", "events": [ { @@ -3701,11 +6168,10 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyDeadZoneRadius" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "VerticalRotationDeceleration", "=", "Value" ] @@ -3722,271 +6188,72 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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": "Action", - "name": "doStepPreEvents", - "sentence": "", + "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": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::IsReleased" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyIsReleased" - }, - "parameters": [ - "Object", - "Behavior", - "no" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + "value": "SetReturnNumber" }, "parameters": [ - "Object", - "Behavior", - "\"Idle\"", - "" + "VerticalAngleMin" ] } ] - }, + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ { - "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" - ] - } - ] - } - ] - } - ] + "description": "Object", + "name": "Object", + "type": "object" }, { - "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" - ] - }, + "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": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchId" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "VerticalAngleMin", "=", - "0" + "Value" ] } ] @@ -4001,44 +6268,38 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], "objectGroups": [] }, { - "description": "Check if button is released.", - "fullName": "Button released", - "functionType": "Condition", - "name": "IsReleased", - "sentence": "Button _PARAM0_ is released", + "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": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::PropertyIsReleased" - }, - "parameters": [ - "Object", - "Behavior" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "SetReturnBoolean" + "value": "SetReturnNumber" }, "parameters": [ - "True" + "VerticalAngleMax" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -4048,46 +6309,77 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], "objectGroups": [] }, { - "description": "Check if button is pressed.", - "fullName": "Button pressed", - "functionType": "Condition", - "name": "IsPressed", - "sentence": "Button _PARAM0_ is pressed", + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "VerticalAngleMax", + "name": "SetVerticalAngleMax", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "conditions": [], + "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::PropertyTouchId" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", - "!=", - "0" + "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": "SetReturnBoolean" + "value": "SetReturnNumber" }, "parameters": [ - "True" + "OffsetZ" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -4097,18 +6389,18 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], "objectGroups": [] }, { - "fullName": "Button state", - "functionType": "Action", - "name": "SetButtonState", - "private": true, - "sentence": "Mark the button _PARAM0_ as _PARAM2_", + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "OffsetZ", + "name": "SetOffsetZ", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -4116,14 +6408,12 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::SetButtonState" + "value": "SetNumberVariable" }, "parameters": [ - "", - "ControllerIdentifier", - "ButtonIdentifier", - "ButtonState", - "" + "OffsetZ", + "=", + "Value" ] } ] @@ -4138,61 +6428,140 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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": "Multitouch controller identifier (1, 2, 3, 4...)", + "label": "Controller identifier (1, 2, 3, 4...)", "name": "ControllerIdentifier" }, { - "value": "A", - "type": "String", - "label": "Button identifier", - "name": "ButtonIdentifier" + "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", - "label": "TouchID", - "hidden": true, - "name": "TouchId" + "unit": "Pixel", + "label": "Z position offset", + "group": "Position", + "name": "OffsetZ" }, { - "value": "", + "value": "0", "type": "Number", - "label": "", + "unit": "AngularSpeed", + "label": "Current rotation speed Z", "hidden": true, - "name": "TouchIndex" + "name": "CurrentRotationSpeedZ" }, { - "value": "", - "type": "Boolean", - "label": "Button released", + "value": "0", + "type": "Number", + "unit": "AngularSpeed", + "label": "Current rotation speed Y", "hidden": true, - "name": "IsReleased" + "name": "CurrentRotationSpeedY" } ], "sharedPropertyDescriptors": [] }, { - "description": "Control a platformer character with a multitouch controller.", - "fullName": "Platformer multitouch controller mapper", - "name": "PlatformerMultitouchMapper", + "description": "Control a 3D physics car with a multitouch controller.", + "fullName": "3D car multitouch controller mapper", + "name": "PhysicsCar3DMultitouchMapper", "objectType": "", + "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -4205,69 +6574,14 @@ "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" + "value": "SpriteMultitouchJoystick::StickForce" }, "parameters": [ "", + ">", + "0", "ControllerIdentifier", - "JoystickIdentifier", - "\"Up\"", + "SteerJoystickIdentifier", "" ] } @@ -4275,20 +6589,12 @@ "actions": [ { "type": { - "value": "PlatformBehavior::SimulateUpKey" - }, - "parameters": [ - "Object", - "Property" - ] - }, - { - "type": { - "value": "PlatformBehavior::SimulateLadderKey" + "value": "Physics3D::PhysicsCar3D::SimulateSteeringStick" }, "parameters": [ "Object", - "Property" + "PhysicsCar3D", + "SpriteMultitouchJoystick::StickForceX(ControllerIdentifier, \"Primary\")" ] } ] @@ -4298,13 +6604,14 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" + "value": "SpriteMultitouchJoystick::StickForce" }, "parameters": [ "", - "ControllerIdentifier", - "JoystickIdentifier", - "\"Down\"", + ">", + "0", + "ControllerIdentifier", + "SpeedJoystickIdentifier", "" ] } @@ -4312,11 +6619,12 @@ "actions": [ { "type": { - "value": "PlatformBehavior::SimulateDownKey" + "value": "Physics3D::PhysicsCar3D::SimulateAcceleratorStick" }, "parameters": [ "Object", - "Property" + "PhysicsCar3D", + "-SpriteMultitouchJoystick::StickForceY(ControllerIdentifier, \"Secondary\")" ] } ] @@ -4331,7 +6639,7 @@ "parameters": [ "", "ControllerIdentifier", - "JumpButton", + "HandBrakeButton", "\"Down\"" ] } @@ -4339,11 +6647,11 @@ "actions": [ { "type": { - "value": "PlatformBehavior::SimulateJumpKey" + "value": "Physics3D::PhysicsCar3D::SimulateHandBrakeKey" }, "parameters": [ "Object", - "Property" + "PhysicsCar3D" ] } ] @@ -4358,7 +6666,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::PlatformerMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::PhysicsCar3DMultitouchMapper", "type": "behavior" } ], @@ -4369,12 +6677,12 @@ { "value": "", "type": "Behavior", - "label": "Platform character behavior", + "label": "3D physics car", "extraInformation": [ - "PlatformBehavior::PlatformerObjectBehavior" + "Physics3D::PhysicsCar3D" ], "choices": [], - "name": "Property" + "name": "PhysicsCar3D" }, { "value": "1", @@ -4385,7 +6693,7 @@ { "value": "Primary", "type": "Choice", - "label": "Joystick name", + "label": "Steer joystick", "group": "Controls", "choices": [ { @@ -4397,14 +6705,31 @@ "value": "Secondary" } ], - "name": "JoystickIdentifier" + "name": "SteerJoystickIdentifier" }, { - "value": "A", + "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": "Jump button name", + "label": "Hand brake button name", "group": "Controls", - "name": "JumpButton" + "name": "HandBrakeButton" } ], "sharedPropertyDescriptors": [] @@ -4414,6 +6739,7 @@ "fullName": "Top-down multitouch controller mapper", "name": "TopDownMultitouchMapper", "objectType": "", + "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -4426,11 +6752,10 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "StickMode", "=", "\"Analog\"" ] @@ -4455,11 +6780,10 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "StickMode", "=", "\"360°\"" ] @@ -4484,11 +6808,10 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "StickMode", "=", "\"8 Directions\"" ] @@ -5097,7 +7420,6 @@ } ], "instances": [], - "editionSettings": {}, "eventsFunctions": [ { "fullName": "", @@ -5216,17 +7538,90 @@ "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ + "conditions": [ { "type": { - "value": "MettreAutour" + "inverted": true, + "value": "SpriteMultitouchJoystick::IsInGameEdition" }, "parameters": [ - "Thumb", - "Border", - "Border.MultitouchJoystick::JoystickForce() * Border.Width() / 2", - "Border.MultitouchJoystick::JoystickAngle()" + "", + "" + ] + } + ], + "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", + "" + ] + } ] } ] @@ -5294,7 +7689,7 @@ "Border", "MultitouchJoystick", "=", - "Object.PropertyControllerIdentifier()", + "ControllerIdentifier", "" ] }, @@ -5306,7 +7701,7 @@ "Border", "MultitouchJoystick", "=", - "Object.PropertyJoystickIdentifier()", + "JoystickIdentifier", "" ] }, @@ -5318,7 +7713,92 @@ "Border", "MultitouchJoystick", "=", - "Object.PropertyDeadZoneRadius()", + "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)", "" ] } @@ -5335,6 +7815,92 @@ ], "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", @@ -5348,10 +7914,12 @@ { "type": { "inverted": true, - "value": "GetArgumentAsBoolean" + "value": "BooleanVariable" }, "parameters": [ - "\"ShouldActivate\"" + "ShouldActivate", + "True", + "" ] } ], @@ -5373,10 +7941,12 @@ "conditions": [ { "type": { - "value": "GetArgumentAsBoolean" + "value": "BooleanVariable" }, "parameters": [ - "\"ShouldActivate\"" + "ShouldActivate", + "True", + "" ] } ], @@ -6050,9 +8620,15 @@ "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 bd1aabd54..f875fb759 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": "", + "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.4.0", + "version": "1.9.0", "description": [ - "Multitouch joysticks can be used the same way as physical gamepads:", + "Multitouch joysticks are objects showing a joystick on the screen, useful for mobile. They work like a physical gamepad:", "- 4 or 8 directions", "- Analogus pads", "- Player selection", - "- Controls mapping for top-down movement and platformer characters", + "- Automatic \"mapper\" behaviors for 2D and 3D movement behaviors (platformer characters, top-down movement, 3D character etc...). Add one of these to the object with the movement behavior (i.e: the player most of the time) and the behavior will then be controlled automatically by the virtual joystick (it works by reading the multitouch joystick state and simulating controls). No need for additional events to make it work once the behaviors are set up.", "", "There are ready-to-use joysticks in the asset-store [multitouch joysticks pack](https://editor.gdevelop.io/?initial-dialog=asset-store&asset-pack=multitouch-joysticks-multitouch-joysticks)." ], @@ -1185,153 +1185,33 @@ ], "eventsFunctions": [ { - "description": "Check if a button is pressed on a gamepad.", - "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": "StringVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Buttons[Button].State", - "=", - "\"Pressed\"" - ] - } - ], - "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 gamepad.", - "fullName": "Multitouch controller button released", + "description": "Check if the events are running for the editor.", + "fullName": "Editor is running", "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", + "name": "IsInGameEdition", "private": true, - "sentence": "Mark _PARAM2_ button as _PARAM3_ for multitouch controller _PARAM1_", + "sentence": "Events are running for the editor", "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" + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const game = runtimeScene.getGame();\r", + "eventsFunctionContext.returnValue = game.isInGameEdition && game.isInGameEdition();" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false } ], + "parameters": [], "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", + "fullName": "Accelerated speed", + "functionType": "Expression", + "name": "AcceleratedSpeed", "private": true, - "sentence": "Change the dead zone of multitouch joystick _PARAM2_ of multitouch controller _PARAM1_ to _PARAM3_", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -1342,1203 +1222,3781 @@ "value": "SetNumberVariable" }, "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].DeadZone", + "AcceleratedSpeed", "=", - "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)" + "CurrentSpeed" ] } - ] - } - ], - "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": [ + ], + "events": [ { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ + "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": [ + ] + } + ], + "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": "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": [ + "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": [] + }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "JoystickForce", + "name": "SetJoystickForce", + "private": true, + "sentence": "", + "events": [ { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Right\"" + "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" }, { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo4Way" - }, - "parameters": [ - "", - "=", - "0", - "Angle", - "" - ] + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" + }, + { + "description": "", + "name": "Parameter", + "type": "objectList" } ], - "actions": [ + "objectGroups": [] + }, + { + "description": "Return the angle the joystick is pointing towards (Range: -180 to 180).", + "fullName": "Joystick angle", + "functionType": "Expression", + "name": "JoystickAngle", + "sentence": "", + "events": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" + "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": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "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": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Down\"" + "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" }, { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo4Way" - }, - "parameters": [ - "", - "=", - "1", - "Angle", - "" - ] + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" + }, + { + "description": "Angle", + "name": "Value", + "type": "expression" } ], - "actions": [ + "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": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" + "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": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "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": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Left\"" + "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" }, { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo4Way" - }, - "parameters": [ - "", - "=", - "2", - "Angle", - "" + "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" + ] + } ] } ], - "actions": [ + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - }, - { - "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", - "" - ] + "description": "Direction", + "name": "Direction", + "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\"]", + "type": "stringWithSelector" } ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Angle", - "name": "Angle", - "type": "expression" + "objectGroups": [] }, { - "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\"" - ] - }, + "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": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "0", - "Angle", - "" + "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" + ] + } ] } ], - "actions": [ + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - }, - { - "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", - "" - ] + "description": "Direction", + "name": "Direction", + "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\",\"UpLeft\",\"UpRight\",\"DownLeft\",\"DownRight\"]", + "type": "stringWithSelector" } ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Down\"" - ] - }, + "description": "Check if a joystick is pressed.", + "fullName": "Joystick pressed", + "functionType": "Condition", + "name": "IsPressed", + "sentence": "Joystick _PARAM0_ is pressed", + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "2", - "Angle", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "!=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } ] } ], - "actions": [ + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } - ] + ], + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"DownLeft\"" - ] - }, + "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": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "3", - "Angle", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "0", + "" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "0" + ] + } ] } ], - "actions": [ + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } - ] + ], + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Left\"" - ] - }, + "description": "the multitouch controller identifier.", + "fullName": "Multitouch controller identifier", + "functionType": "ExpressionAndCondition", + "group": "Multitouch Joystick configuration", + "name": "ControllerIdentifier", + "sentence": "the multitouch controller identifier", + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "4", - "Angle", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "ControllerIdentifier" + ] + } ] } ], - "actions": [ + "expressionType": { + "type": "expression" + }, + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } - ] + ], + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"UpLeft\"" - ] - }, + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "ControllerIdentifier", + "name": "SetControllerIdentifier", + "sentence": "", + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "5", - "Angle", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "ControllerIdentifier", + "=", + "Value" + ] + } ] } ], - "actions": [ + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } - ] + ], + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Up\"" - ] - }, + "description": "the joystick name.", + "fullName": "Joystick name", + "functionType": "ExpressionAndCondition", + "group": "Multitouch Joystick configuration", + "name": "JoystickIdentifier", + "sentence": "the joystick name", + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "6", - "Angle", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnString" + }, + "parameters": [ + "JoystickIdentifier" + ] + } ] } ], - "actions": [ + "expressionType": { + "type": "string" + }, + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } - ] + ], + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "JoystickIdentifier", + "name": "SetJoystickIdentifier", + "sentence": "", + "events": [ { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"UpRight\"" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "JoystickIdentifier", + "=", + "Value" + ] + } ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" }, { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "7", - "Angle", - "" - ] + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } ], - "actions": [ + "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": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "DeadZoneRadius" + ] + } ] } - ] - } - ], - "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 + ], + "expressionType": { + "type": "expression" }, - "comment": "Make sure the joystick has moved from center" - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "parameters": [ { - "type": { - "value": "SpriteMultitouchJoystick::JoystickForce" - }, - "parameters": [ - "", - ">", - "0", - "ControllerIdentifier", - "JoystickIdentifier", - "" - ] + "description": "Object", + "name": "Object", + "type": "object" }, { - "type": { - "value": "SpriteMultitouchJoystick::IsAngleIn4WayDirection" - }, - "parameters": [ - "", - "SpriteMultitouchJoystick::JoystickAngle(ControllerIdentifier, JoystickIdentifier)", - "Direction", - "" - ] + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } ], - "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" + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "DeadZoneRadius", + "name": "SetDeadZoneRadius", + "sentence": "", + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::JoystickForce" - }, - "parameters": [ - "", - ">", - "0", - "ControllerIdentifier", - "JoystickIdentifier", - "" + "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" }, { - "type": { - "value": "SpriteMultitouchJoystick::IsAngleIn8WayDirection" - }, - "parameters": [ - "", - "SpriteMultitouchJoystick::JoystickAngle(ControllerIdentifier, JoystickIdentifier)", - "Direction", - "" - ] + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } ], - "actions": [ + "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": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" + "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": [] } ], - "parameters": [ + "propertyDescriptors": [ { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" + "value": "1", + "type": "Number", + "label": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier" }, { - "description": "Joystick name", - "name": "JoystickIdentifier", - "supplementaryInformation": "[\"Primary\",\"Secondary\"]", - "type": "stringWithSelector" + "value": "Primary", + "type": "String", + "label": "Joystick name", + "name": "JoystickIdentifier" }, { - "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" + "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" }, { - "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": [ + "value": "0", + "type": "Number", + "label": "Joystick angle (range: -180 to 180)", + "hidden": true, + "name": "JoystickAngle" + }, { - "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": [ + "value": "0", + "type": "Number", + "label": "Joystick force (range: 0 to 1)", + "hidden": true, + "name": "JoystickForce" + }, { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" + "value": "0", + "type": "Number", + "label": "", + "hidden": true, + "name": "TouchId" }, { - "description": "Stick name", - "name": "JoystickIdentifier", - "supplementaryInformation": "[\"Primary\",\"Secondary\"]", - "type": "stringWithSelector" + "value": "", + "type": "Number", + "label": "", + "hidden": true, + "name": "TouchIndex" } ], - "objectGroups": [] + "sharedPropertyDescriptors": [] }, { - "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": [ + "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": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ + "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": { - "value": "SetNumberVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].Force", - "=", - "Value" + "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" + ] + } + ] + } + ] + } ] - } - ] - } - ], - "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)" + "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" + ] + } ] } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "type": "behavior" + } + ], + "objectGroups": [] }, { - "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": "Check if the button was just pressed.", + "fullName": "Button just pressed", + "functionType": "Condition", + "name": "IsJustPressed", + "sentence": "Button _PARAM0_ was just pressed", + "events": [ { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].Angle" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } ] } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "type": "behavior" + } + ], + "objectGroups": [] }, { - "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": [ + "description": "Check if the button is pressed.", + "fullName": "Button pressed", + "functionType": "Condition", + "name": "IsPressed", + "sentence": "Button _PARAM0_ is pressed", + "events": [ { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].Angle", - "=", - "Value" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "!=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } ] } - ] - } - ], - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "type": "behavior" + } + ], + "objectGroups": [] }, { - "description": "Joystick name", - "name": "JoystickIdentifier", - "type": "string" + "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": [] }, { - "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": [ + "fullName": "Button state", + "functionType": "Action", + "name": "SetButtonState", + "private": true, + "sentence": "Mark the button _PARAM0_ as _PARAM2_", + "events": [ { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "SpriteMultitouchJoystick::JoystickForce(ControllerIdentifier, JoystickIdentifier) * cos(ToRad(SpriteMultitouchJoystick::JoystickAngle(ControllerIdentifier, JoystickIdentifier)))" + "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": [] } ], - "expressionType": { - "type": "expression" - }, - "parameters": [ + "propertyDescriptors": [ { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" + "value": "1", + "type": "Number", + "label": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier" }, { - "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": [ + "value": "A", + "type": "String", + "label": "Button identifier", + "name": "ButtonIdentifier" + }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "SpriteMultitouchJoystick::JoystickForce(ControllerIdentifier, JoystickIdentifier) * sin(ToRad(SpriteMultitouchJoystick::JoystickAngle(ControllerIdentifier, JoystickIdentifier)))" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ + "value": "0", + "type": "Number", + "label": "TouchID", + "hidden": true, + "name": "TouchId" + }, { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" + "value": "", + "type": "Number", + "label": "", + "hidden": true, + "name": "TouchIndex" }, { - "description": "Joystick name", - "name": "JoystickIdentifier", - "supplementaryInformation": "[\"Primary\",\"Secondary\"]", - "type": "stringWithSelector" + "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" } ], - "objectGroups": [] - } - ], - "eventsBasedBehaviors": [ + "sharedPropertyDescriptors": [] + }, { - "description": "Joystick that can be controlled by interacting with a touchscreen.", - "fullName": "Multitouch Joystick", - "name": "MultitouchJoystick", + "description": "Control a platformer character with a multitouch controller.", + "fullName": "Platformer multitouch controller mapper", + "name": "PlatformerMultitouchMapper", "objectType": "", - "private": true, + "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", "functionType": "Action", - "name": "onCreated", + "name": "doStepPreEvents", "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ + "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::SetDeadZone" + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" }, "parameters": [ "", "ControllerIdentifier", "JoystickIdentifier", - "DeadZoneRadius", + "\"Left\"", "" ] - }, + } + ], + "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" + "value": "PlatformBehavior::SimulateLeftKey" }, "parameters": [ "Object", - "Behavior", + "Property" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JoystickIdentifier", + "\"Right\"", "" ] } + ], + "actions": [ + { + "type": { + "value": "PlatformBehavior::SimulateRightKey" + }, + "parameters": [ + "Object", + "Property" + ] + } ] - } - ], - "parameters": [ + }, { - "description": "Object", - "name": "Object", - "type": "object" + "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" + ] + } + ] }, { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "Action", - "name": "onDeActivate", - "sentence": "", - "events": [ + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JoystickIdentifier", + "\"Down\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "PlatformBehavior::SimulateDownKey" + }, + "parameters": [ + "Object", + "Property" + ] + } + ] + }, { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::IsButtonPressed" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JumpButton", + "\"Down\"" + ] + } + ], "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" + "value": "PlatformBehavior::SimulateJumpKey" }, "parameters": [ "Object", - "Behavior", - "" + "Property" ] } ] @@ -2553,12 +5011,64 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::PlatformerMultitouchMapper", "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", @@ -2570,262 +5080,71 @@ "conditions": [ { "type": { - "value": "HasGameJustResumed" - }, - "parameters": [ - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" + "value": "SpriteMultitouchJoystick::StickForce" }, "parameters": [ - "Object", - "Behavior", + "", + ">", + "0", + "ControllerIdentifier", + "JoystickIdentifier", "" ] } - ] - }, - { - "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": "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": "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" + "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)" + ] + } + ] }, - { - "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": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::IsButtonPressed" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JumpButton", + "\"Down\"" + ] + } + ], "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" }, "parameters": [ - "max(0, JoystickForce - DeadZoneRadius) / (1 - DeadZoneRadius)" + "Object", + "PhysicsCharacter3D" ] } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -2835,45 +5154,124 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "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": "ActionWithOperator", - "getterName": "JoystickForce", - "name": "SetJoystickForce", - "private": true, + "functionType": "Action", + "name": "doStepPreEvents", "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::StickForce" + }, + "parameters": [ + "", + ">", + "0", + "ControllerIdentifier", + "JoystickIdentifier", + "" + ] + } + ], "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickForce" + "value": "Physics3D::PhysicsCharacter3D::SimulateStick" }, "parameters": [ "Object", - "Behavior", - "=", - "Value" + "PhysicsCharacter3D", + "SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier)", + "SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier)" ] - }, + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::SetJoystickForce" + "value": "SpriteMultitouchJoystick::IsButtonPressed" }, "parameters": [ "", "ControllerIdentifier", - "JoystickIdentifier", - "JoystickForce", - "" + "JumpButton", + "\"Down\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" + }, + "parameters": [ + "Object", + "PhysicsCharacter3D" ] } ] @@ -2888,37 +5286,151 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::Shooter3DMultitouchMapper", "type": "behavior" } ], "objectGroups": [] + } + ], + "propertyDescriptors": [ + { + "value": "", + "type": "Behavior", + "label": "3D physics character", + "extraInformation": [ + "Physics3D::PhysicsCharacter3D" + ], + "choices": [], + "name": "PhysicsCharacter3D" }, { - "description": "Return the angle the joystick is pointing towards (Range: -180 to 180).", - "fullName": "Joystick angle", - "functionType": "Expression", - "name": "JoystickAngle", + "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": "SetReturnNumber" + "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": [ - "JoystickAngle" + "Object", + "Behavior", + "" ] } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -2928,19 +5440,20 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], "objectGroups": [] }, { - "description": "Change the angle the joystick is pointing towards (Range: -180 to 180).", - "fullName": "Joystick angle", + "description": "Move the camera to look though _PARAM1_ eyes. The object must look to the right when all its angles are 0 and the top of its head be toward Z+.", + "fullName": "Look through object eyes", "functionType": "Action", - "name": "SetJoystickAngle", + "group": "Layers and cameras", + "name": "LookFromObjectEyes", "private": true, - "sentence": "Change the joystick angle of _PARAM0_ to _PARAM2_", + "sentence": "Move the camera to look though _PARAM0_ eyes", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -2948,24 +5461,61 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickAngle" + "value": "CentreCamera" }, "parameters": [ + "", "Object", - "Behavior", + "", + "Object.Layer()", + "" + ] + }, + { + "type": { + "value": "Scene3D::SetCameraZ" + }, + "parameters": [ + "", "=", - "Value" + "Object.Object3D::Z() + Object.Object3D::Depth() + OffsetZ", + "", + "" ] }, { "type": { - "value": "SpriteMultitouchJoystick::SetJoystickAngle" + "value": "Scene3D::SetCameraRotationX" }, "parameters": [ "", - "ControllerIdentifier", - "JoystickIdentifier", - "JoystickAngle", + "=", + "- 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()", "" ] } @@ -2981,23 +5531,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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": "", + "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", @@ -3008,7 +5554,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "Object.Behavior::JoystickForce() * cos(ToRad(Object.Behavior::JoystickAngle()))" + "HorizontalRotationSpeedMax" ] } ] @@ -3026,17 +5572,17 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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", + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "HorizontalRotationSpeedMax", + "name": "SetHorizontalRotationSpeedMax", "sentence": "", "events": [ { @@ -3045,18 +5591,17 @@ "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "SetNumberVariable" }, "parameters": [ - "Object.Behavior::JoystickForce() * sin(ToRad(Object.Behavior::JoystickAngle()))" + "HorizontalRotationSpeedMax", + "=", + "Value" ] } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -3066,58 +5611,38 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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_", + "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": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::JoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - ">", - "0", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::IsAngleIn4WayDirection" - }, - "parameters": [ - "", - "JoystickAngle", - "Direction", - "" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "SetReturnBoolean" + "value": "SetReturnNumber" }, "parameters": [ - "True" + "HorizontalRotationAcceleration" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -3127,59 +5652,31 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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_", + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "HorizontalRotationAcceleration", + "name": "SetHorizontalRotationAcceleration", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::JoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - ">", - "0", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::IsAngleIn8WayDirection" - }, - "parameters": [ - "", - "JoystickAngle", - "Direction", - "" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "SetReturnBoolean" + "value": "SetNumberVariable" }, "parameters": [ - "True" + "HorizontalRotationAcceleration", + "=", + "Value" ] } ] @@ -3194,52 +5691,38 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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", + "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": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::PropertyTouchId" - }, - "parameters": [ - "Object", - "Behavior", - "!=", - "0" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "SetReturnBoolean" + "value": "SetReturnNumber" }, "parameters": [ - "True" + "HorizontalRotationDeceleration" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -3249,19 +5732,18 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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_", + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "HorizontalRotationDeceleration", + "name": "SetHorizontalRotationDeceleration", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -3269,25 +5751,12 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "0", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyTouchId" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "HorizontalRotationDeceleration", "=", - "0" + "Value" ] } ] @@ -3302,19 +5771,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the multitouch controller identifier.", - "fullName": "Multitouch controller identifier", + "description": "the maximum vertical rotation speed of the object.", + "fullName": "Maximum vertical rotation speed", "functionType": "ExpressionAndCondition", - "group": "Multitouch Joystick configuration", - "name": "ControllerIdentifier", - "sentence": "the multitouch controller identifier", + "group": "First person camera multitouch controller mapper vertical rotation configuration", + "name": "VerticalRotationSpeedMax", + "sentence": "the maximum vertical rotation speed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -3325,7 +5794,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "ControllerIdentifier" + "VerticalRotationSpeedMax" ] } ] @@ -3343,7 +5812,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], @@ -3352,8 +5821,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "ControllerIdentifier", - "name": "SetControllerIdentifier", + "getterName": "VerticalRotationSpeedMax", + "name": "SetVerticalRotationSpeedMax", "sentence": "", "events": [ { @@ -3362,11 +5831,10 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyControllerIdentifier" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "VerticalRotationSpeedMax", "=", "Value" ] @@ -3383,19 +5851,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the joystick name.", - "fullName": "Joystick name", + "description": "the vertical rotation acceleration of the object.", + "fullName": "Vertical rotation acceleration", "functionType": "ExpressionAndCondition", - "group": "Multitouch Joystick configuration", - "name": "JoystickIdentifier", - "sentence": "the joystick name", + "group": "First person camera multitouch controller mapper vertical rotation configuration", + "name": "VerticalRotationAcceleration", + "sentence": "the vertical rotation acceleration", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -3403,17 +5871,17 @@ "actions": [ { "type": { - "value": "SetReturnString" + "value": "SetReturnNumber" }, "parameters": [ - "JoystickIdentifier" + "VerticalRotationAcceleration" ] } ] } ], "expressionType": { - "type": "string" + "type": "expression" }, "parameters": [ { @@ -3424,7 +5892,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], @@ -3433,8 +5901,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "JoystickIdentifier", - "name": "SetJoystickIdentifier", + "getterName": "VerticalRotationAcceleration", + "name": "SetVerticalRotationAcceleration", "sentence": "", "events": [ { @@ -3443,11 +5911,10 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickIdentifier" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "VerticalRotationAcceleration", "=", "Value" ] @@ -3464,19 +5931,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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", + "description": "the vertical rotation deceleration of the object.", + "fullName": "Vertical rotation deceleration", "functionType": "ExpressionAndCondition", - "group": "Multitouch Joystick configuration", - "name": "DeadZoneRadius", - "sentence": "the dead zone radius", + "group": "First person camera multitouch controller mapper vertical rotation configuration", + "name": "VerticalRotationDeceleration", + "sentence": "the vertical rotation deceleration", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -3487,7 +5954,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "DeadZoneRadius" + "VerticalRotationDeceleration" ] } ] @@ -3505,7 +5972,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], @@ -3514,8 +5981,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "DeadZoneRadius", - "name": "SetDeadZoneRadius", + "getterName": "VerticalRotationDeceleration", + "name": "SetVerticalRotationDeceleration", "sentence": "", "events": [ { @@ -3524,11 +5991,10 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyDeadZoneRadius" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "VerticalRotationDeceleration", "=", "Value" ] @@ -3545,271 +6011,72 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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": "Action", - "name": "doStepPreEvents", - "sentence": "", + "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": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::IsReleased" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyIsReleased" - }, - "parameters": [ - "Object", - "Behavior", - "no" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + "value": "SetReturnNumber" }, "parameters": [ - "Object", - "Behavior", - "\"Idle\"", - "" + "VerticalAngleMin" ] } ] - }, + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ { - "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" - ] - } - ] - } - ] - } - ] + "description": "Object", + "name": "Object", + "type": "object" }, { - "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" - ] - }, + "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": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchId" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "VerticalAngleMin", "=", - "0" + "Value" ] } ] @@ -3824,44 +6091,38 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], "objectGroups": [] }, { - "description": "Check if button is released.", - "fullName": "Button released", - "functionType": "Condition", - "name": "IsReleased", - "sentence": "Button _PARAM0_ is released", + "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": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::PropertyIsReleased" - }, - "parameters": [ - "Object", - "Behavior" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "SetReturnBoolean" + "value": "SetReturnNumber" }, "parameters": [ - "True" + "VerticalAngleMax" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -3871,46 +6132,77 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], "objectGroups": [] }, { - "description": "Check if button is pressed.", - "fullName": "Button pressed", - "functionType": "Condition", - "name": "IsPressed", - "sentence": "Button _PARAM0_ is pressed", + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "VerticalAngleMax", + "name": "SetVerticalAngleMax", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "conditions": [], + "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::PropertyTouchId" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", - "!=", - "0" + "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": "SetReturnBoolean" + "value": "SetReturnNumber" }, "parameters": [ - "True" + "OffsetZ" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -3920,18 +6212,18 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], "objectGroups": [] }, { - "fullName": "Button state", - "functionType": "Action", - "name": "SetButtonState", - "private": true, - "sentence": "Mark the button _PARAM0_ as _PARAM2_", + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "OffsetZ", + "name": "SetOffsetZ", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -3939,14 +6231,12 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::SetButtonState" + "value": "SetNumberVariable" }, "parameters": [ - "", - "ControllerIdentifier", - "ButtonIdentifier", - "ButtonState", - "" + "OffsetZ", + "=", + "Value" ] } ] @@ -3961,61 +6251,140 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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": "Multitouch controller identifier (1, 2, 3, 4...)", + "label": "Controller identifier (1, 2, 3, 4...)", "name": "ControllerIdentifier" }, { - "value": "A", - "type": "String", - "label": "Button identifier", - "name": "ButtonIdentifier" + "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", - "label": "TouchID", - "hidden": true, - "name": "TouchId" + "unit": "Pixel", + "label": "Z position offset", + "group": "Position", + "name": "OffsetZ" }, { - "value": "", + "value": "0", "type": "Number", - "label": "", + "unit": "AngularSpeed", + "label": "Current rotation speed Z", "hidden": true, - "name": "TouchIndex" + "name": "CurrentRotationSpeedZ" }, { - "value": "", - "type": "Boolean", - "label": "Button released", + "value": "0", + "type": "Number", + "unit": "AngularSpeed", + "label": "Current rotation speed Y", "hidden": true, - "name": "IsReleased" + "name": "CurrentRotationSpeedY" } ], "sharedPropertyDescriptors": [] }, { - "description": "Control a platformer character with a multitouch controller.", - "fullName": "Platformer multitouch controller mapper", - "name": "PlatformerMultitouchMapper", + "description": "Control a 3D physics car with a multitouch controller.", + "fullName": "3D car multitouch controller mapper", + "name": "PhysicsCar3DMultitouchMapper", "objectType": "", + "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -4028,69 +6397,14 @@ "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" + "value": "SpriteMultitouchJoystick::StickForce" }, "parameters": [ "", + ">", + "0", "ControllerIdentifier", - "JoystickIdentifier", - "\"Up\"", + "SteerJoystickIdentifier", "" ] } @@ -4098,20 +6412,12 @@ "actions": [ { "type": { - "value": "PlatformBehavior::SimulateUpKey" - }, - "parameters": [ - "Object", - "Property" - ] - }, - { - "type": { - "value": "PlatformBehavior::SimulateLadderKey" + "value": "Physics3D::PhysicsCar3D::SimulateSteeringStick" }, "parameters": [ "Object", - "Property" + "PhysicsCar3D", + "SpriteMultitouchJoystick::StickForceX(ControllerIdentifier, \"Primary\")" ] } ] @@ -4121,13 +6427,14 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" + "value": "SpriteMultitouchJoystick::StickForce" }, "parameters": [ "", - "ControllerIdentifier", - "JoystickIdentifier", - "\"Down\"", + ">", + "0", + "ControllerIdentifier", + "SpeedJoystickIdentifier", "" ] } @@ -4135,11 +6442,12 @@ "actions": [ { "type": { - "value": "PlatformBehavior::SimulateDownKey" + "value": "Physics3D::PhysicsCar3D::SimulateAcceleratorStick" }, "parameters": [ "Object", - "Property" + "PhysicsCar3D", + "-SpriteMultitouchJoystick::StickForceY(ControllerIdentifier, \"Secondary\")" ] } ] @@ -4154,7 +6462,7 @@ "parameters": [ "", "ControllerIdentifier", - "JumpButton", + "HandBrakeButton", "\"Down\"" ] } @@ -4162,11 +6470,11 @@ "actions": [ { "type": { - "value": "PlatformBehavior::SimulateJumpKey" + "value": "Physics3D::PhysicsCar3D::SimulateHandBrakeKey" }, "parameters": [ "Object", - "Property" + "PhysicsCar3D" ] } ] @@ -4181,7 +6489,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::PlatformerMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::PhysicsCar3DMultitouchMapper", "type": "behavior" } ], @@ -4192,12 +6500,12 @@ { "value": "", "type": "Behavior", - "label": "Platform character behavior", + "label": "3D physics car", "extraInformation": [ - "PlatformBehavior::PlatformerObjectBehavior" + "Physics3D::PhysicsCar3D" ], "choices": [], - "name": "Property" + "name": "PhysicsCar3D" }, { "value": "1", @@ -4208,7 +6516,7 @@ { "value": "Primary", "type": "Choice", - "label": "Joystick name", + "label": "Steer joystick", "group": "Controls", "choices": [ { @@ -4220,14 +6528,31 @@ "value": "Secondary" } ], - "name": "JoystickIdentifier" + "name": "SteerJoystickIdentifier" }, { - "value": "A", + "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": "Jump button name", + "label": "Hand brake button name", "group": "Controls", - "name": "JumpButton" + "name": "HandBrakeButton" } ], "sharedPropertyDescriptors": [] @@ -4237,6 +6562,7 @@ "fullName": "Top-down multitouch controller mapper", "name": "TopDownMultitouchMapper", "objectType": "", + "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -4249,11 +6575,10 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "StickMode", "=", "\"Analog\"" ] @@ -4278,11 +6603,10 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "StickMode", "=", "\"360°\"" ] @@ -4307,11 +6631,10 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "StickMode", "=", "\"8 Directions\"" ] @@ -4920,7 +7243,6 @@ } ], "instances": [], - "editionSettings": {}, "eventsFunctions": [ { "fullName": "", @@ -5039,17 +7361,90 @@ "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ + "conditions": [ { "type": { - "value": "MettreAutour" + "inverted": true, + "value": "SpriteMultitouchJoystick::IsInGameEdition" }, "parameters": [ - "Thumb", - "Border", - "Border.MultitouchJoystick::JoystickForce() * Border.Width() / 2", - "Border.MultitouchJoystick::JoystickAngle()" + "", + "" + ] + } + ], + "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", + "" + ] + } ] } ] @@ -5117,7 +7512,7 @@ "Border", "MultitouchJoystick", "=", - "Object.PropertyControllerIdentifier()", + "ControllerIdentifier", "" ] }, @@ -5129,7 +7524,7 @@ "Border", "MultitouchJoystick", "=", - "Object.PropertyJoystickIdentifier()", + "JoystickIdentifier", "" ] }, @@ -5141,7 +7536,92 @@ "Border", "MultitouchJoystick", "=", - "Object.PropertyDeadZoneRadius()", + "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)", "" ] } @@ -5158,6 +7638,92 @@ ], "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", @@ -5171,10 +7737,12 @@ { "type": { "inverted": true, - "value": "GetArgumentAsBoolean" + "value": "BooleanVariable" }, "parameters": [ - "\"ShouldActivate\"" + "ShouldActivate", + "True", + "" ] } ], @@ -5196,10 +7764,12 @@ "conditions": [ { "type": { - "value": "GetArgumentAsBoolean" + "value": "BooleanVariable" }, "parameters": [ - "\"ShouldActivate\"" + "ShouldActivate", + "True", + "" ] } ], @@ -5873,9 +8443,15 @@ "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 a766dc984..c534ec43b 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.8.4", + "version": "1.9.0", "description": [ "Multitouch joysticks are objects showing a joystick on the screen, useful for mobile. They work like a physical gamepad:", "- 4 or 8 directions", @@ -2584,11 +2584,11 @@ "objectGroups": [] }, { - "description": "Check if a button is pressed on a gamepad.", - "fullName": "Multitouch controller button pressed", + "description": "Check if a button was just pressed on a multitouch controller.", + "fullName": "Multitouch controller button just pressed", "functionType": "Condition", - "name": "IsButtonPressed", - "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", + "name": "IsButtonJustPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ was just pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -2600,7 +2600,73 @@ "parameters": [ "Controllers[ControllerIdentifier].Buttons[Button].State", "=", - "\"Pressed\"" + "\"JustPressed\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier", + "type": "expression" + }, + { + "description": "Button name", + "name": "Button", + "supplementaryInformation": "[\"A\",\"CROSS\",\"B\",\"CIRCLE\",\"X\",\"SQUARE\",\"Y\",\"TRIANGLE\",\"LB\",\"L1\",\"RB\",\"R1\",\"LT\",\"L2\",\"RT\",\"R2\",\"UP\",\"DOWN\",\"LEFT\",\"RIGHT\",\"BACK\",\"SHARE\",\"START\",\"OPTIONS\",\"CLICK_STICK_LEFT\",\"CLICK_STICK_RIGHT\",\"PS_BUTTON\",\"CLICK_TOUCHPAD\"]", + "type": "string" + } + ], + "objectGroups": [] + }, + { + "description": "Check if a button is pressed on a multitouch controller.", + "fullName": "Multitouch controller button pressed", + "functionType": "Condition", + "name": "IsButtonPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::Or" + }, + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"Pressed\"" + ] + }, + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"JustPressed\"" + ] + } ] } ], @@ -2632,7 +2698,7 @@ "objectGroups": [] }, { - "description": "Check if a button is released on a gamepad.", + "description": "Check if a button is released on a multitouch controller.", "fullName": "Multitouch controller button released", "functionType": "Condition", "name": "IsButtonReleased", @@ -2718,7 +2784,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"JustPressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -5208,11 +5274,11 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::IsReleased" + "value": "BooleanVariable" }, "parameters": [ - "Object", - "Behavior", + "IsReleased", + "True", "" ] } @@ -5241,6 +5307,44 @@ } ] }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "False", + "" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + }, + "parameters": [ + "Object", + "Behavior", + "\"Pressed\"", + "" + ] + } + ] + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ @@ -5333,7 +5437,17 @@ "parameters": [ "Object", "Behavior", - "\"Pressed\"", + "\"JustPressed\"", + "" + ] + }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "True", "" ] } @@ -5404,6 +5518,16 @@ "" ] }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "False", + "" + ] + }, { "type": { "value": "SetNumberVariable" @@ -5433,11 +5557,11 @@ "objectGroups": [] }, { - "description": "Check if button is released.", - "fullName": "Button released", + "description": "Check if the button was just pressed.", + "fullName": "Button just pressed", "functionType": "Condition", - "name": "IsReleased", - "sentence": "Button _PARAM0_ is released", + "name": "IsJustPressed", + "sentence": "Button _PARAM0_ was just pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -5447,7 +5571,7 @@ "value": "BooleanVariable" }, "parameters": [ - "IsReleased", + "IsJustPressed", "True", "" ] @@ -5481,7 +5605,7 @@ "objectGroups": [] }, { - "description": "Check if button is pressed.", + "description": "Check if the button is pressed.", "fullName": "Button pressed", "functionType": "Condition", "name": "IsPressed", @@ -5528,6 +5652,54 @@ ], "objectGroups": [] }, + { + "description": "Check if the button is released.", + "fullName": "Button released", + "functionType": "Condition", + "name": "IsReleased", + "sentence": "Button _PARAM0_ is released", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsReleased", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "type": "behavior" + } + ], + "objectGroups": [] + }, { "fullName": "Button state", "functionType": "Action", @@ -5569,7 +5741,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"JustPressed\",\"Pressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -5610,6 +5782,13 @@ "hidden": true, "name": "IsReleased" }, + { + "value": "", + "type": "Boolean", + "label": "Button just pressed", + "hidden": true, + "name": "IsJustPressed" + }, { "value": "0", "type": "Number", @@ -8024,7 +8203,6 @@ } ], "instances": [], - "editionSettings": {}, "eventsFunctions": [ { "fullName": "", @@ -9233,8 +9411,7 @@ "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 84cb70245..a2b300d21 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.8.3", + "version": "1.9.0", "description": [ - "Multitouch joysticks can be used the same way as physical gamepads:", + "Multitouch joysticks are objects showing a joystick on the screen, useful for mobile. They work like a physical gamepad:", "- 4 or 8 directions", "- Analogus pads", "- Player selection", - "- Controls mapping for top-down movement and platformer characters", + "- Automatic \"mapper\" behaviors for 2D and 3D movement behaviors (platformer characters, top-down movement, 3D character etc...). Add one of these to the object with the movement behavior (i.e: the player most of the time) and the behavior will then be controlled automatically by the virtual joystick (it works by reading the multitouch joystick state and simulating controls). No need for additional events to make it work once the behaviors are set up.", "", "There are ready-to-use joysticks in the asset-store [multitouch joysticks pack](https://editor.gdevelop.io/?initial-dialog=asset-store&asset-pack=multitouch-joysticks-multitouch-joysticks)." ], @@ -7094,6 +7094,28 @@ } ], "eventsFunctions": [ + { + "description": "Check if the events are running for the editor.", + "fullName": "Editor is running", + "functionType": "Condition", + "name": "IsInGameEdition", + "private": true, + "sentence": "Events are running for the editor", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const game = runtimeScene.getGame();\r", + "eventsFunctionContext.returnValue = game.isInGameEdition && game.isInGameEdition();" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [], + "objectGroups": [] + }, { "fullName": "Accelerated speed", "functionType": "Expression", @@ -7512,11 +7534,11 @@ "objectGroups": [] }, { - "description": "Check if a button is pressed on a gamepad.", - "fullName": "Multitouch controller button pressed", + "description": "Check if a button was just pressed on a multitouch controller.", + "fullName": "Multitouch controller button just pressed", "functionType": "Condition", - "name": "IsButtonPressed", - "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", + "name": "IsButtonJustPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ was just pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -7528,7 +7550,73 @@ "parameters": [ "Controllers[ControllerIdentifier].Buttons[Button].State", "=", - "\"Pressed\"" + "\"JustPressed\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier", + "type": "expression" + }, + { + "description": "Button name", + "name": "Button", + "supplementaryInformation": "[\"A\",\"CROSS\",\"B\",\"CIRCLE\",\"X\",\"SQUARE\",\"Y\",\"TRIANGLE\",\"LB\",\"L1\",\"RB\",\"R1\",\"LT\",\"L2\",\"RT\",\"R2\",\"UP\",\"DOWN\",\"LEFT\",\"RIGHT\",\"BACK\",\"SHARE\",\"START\",\"OPTIONS\",\"CLICK_STICK_LEFT\",\"CLICK_STICK_RIGHT\",\"PS_BUTTON\",\"CLICK_TOUCHPAD\"]", + "type": "string" + } + ], + "objectGroups": [] + }, + { + "description": "Check if a button is pressed on a multitouch controller.", + "fullName": "Multitouch controller button pressed", + "functionType": "Condition", + "name": "IsButtonPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::Or" + }, + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"Pressed\"" + ] + }, + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"JustPressed\"" + ] + } ] } ], @@ -7560,7 +7648,7 @@ "objectGroups": [] }, { - "description": "Check if a button is released on a gamepad.", + "description": "Check if a button is released on a multitouch controller.", "fullName": "Multitouch controller button released", "functionType": "Condition", "name": "IsButtonReleased", @@ -7646,7 +7734,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"JustPressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -9019,41 +9107,23 @@ "conditions": [ { "type": { - "value": "HasGameJustResumed" + "inverted": true, + "value": "SpriteMultitouchJoystick::IsInGameEdition" }, "parameters": [ + "", "" ] } ], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - } - ] - }, - { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Manage touches", - "source": "", - "type": "BuiltinCommonInstructions::Group", + "actions": [], "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "value": "HasAnyTouchOrMouseStarted" + "value": "HasGameJustResumed" }, "parameters": [ "" @@ -9063,171 +9133,207 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" }, "parameters": [ - "TouchIndex", - "=", - "0" + "Object", + "Behavior", + "" ] } - ], + ] + }, + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Manage touches", + "source": "", + "type": "BuiltinCommonInstructions::Group", "events": [ { - "type": "BuiltinCommonInstructions::Repeat", - "repeatExpression": "StartedTouchOrMouseCount()", - "conditions": [], - "actions": [], + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "HasAnyTouchOrMouseStarted" + }, + "parameters": [ + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchIndex", + "=", + "0" + ] + } + ], "events": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "StartedTouchOrMouseCount()", + "conditions": [], + "actions": [], + "events": [ { - "type": { - "value": "NumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "0" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "0" + ] + }, + { + "type": { + "value": "CollisionPoint" + }, + "parameters": [ + "Object", + "TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)", + "TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "StartedTouchOrMouseId(TouchIndex)" + ] + } ] }, { - "type": { - "value": "CollisionPoint" - }, - "parameters": [ - "Object", - "TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)", - "TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "StartedTouchOrMouseId(TouchIndex)" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchIndex", - "+", - "1" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchIndex", + "+", + "1" + ] + } ] } ] } ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 - }, - "comment": "Move thumb back to center when not being pressed (acts like a spring on a real controller)" - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + }, { - "type": { - "value": "HasTouchEnded" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 }, - "parameters": [ - "", - "TouchId" - ] - } - ], - "actions": [ + "comment": "Move thumb back to center when not being pressed (acts like a spring on a real controller)" + }, { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" - }, - "parameters": [ - "Object", - "Behavior", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "HasTouchEnded" + }, + "parameters": [ + "", + "TouchId" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } ] } - ] - } - ], - "parameters": [] - }, - { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Update joystick position", - "source": "", - "type": "BuiltinCommonInstructions::Group", - "events": [ + ], + "parameters": [] + }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Update joystick position", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ { - "type": { - "value": "NumberVariable" - }, - "parameters": [ - "TouchId", - "!=", - "0" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "!=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickAngle" + }, + "parameters": [ + "Object", + "Behavior", + "AngleBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0))", + "AngleBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0))" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "clamp(2 * DistanceBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0)) / Object.Width(), 0, 1)", + "" + ] + } ] } ], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickAngle" - }, - "parameters": [ - "Object", - "Behavior", - "AngleBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0))", - "AngleBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0))" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "clamp(2 * DistanceBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0)) / Object.Width(), 0, 1)", - "" - ] - } - ] + "parameters": [] } - ], - "parameters": [] + ] } ], "parameters": [ @@ -10102,7 +10208,7 @@ "sharedPropertyDescriptors": [] }, { - "description": "Detect button presses made on a touchscreen.", + "description": "Detect presses made on a touchscreen on the object so it acts like a button and automatically trigger the button having the same identifier for the mapper behaviors.", "fullName": "Multitouch button", "name": "MultitouchButton", "objectType": "", @@ -10118,11 +10224,11 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::IsReleased" + "value": "BooleanVariable" }, "parameters": [ - "Object", - "Behavior", + "IsReleased", + "True", "" ] } @@ -10151,6 +10257,44 @@ } ] }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "False", + "" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + }, + "parameters": [ + "Object", + "Behavior", + "\"Pressed\"", + "" + ] + } + ] + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ @@ -10243,7 +10387,17 @@ "parameters": [ "Object", "Behavior", - "\"Pressed\"", + "\"JustPressed\"", + "" + ] + }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "True", "" ] } @@ -10314,6 +10468,16 @@ "" ] }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "False", + "" + ] + }, { "type": { "value": "SetNumberVariable" @@ -10343,11 +10507,11 @@ "objectGroups": [] }, { - "description": "Check if button is released.", - "fullName": "Button released", + "description": "Check if the button was just pressed.", + "fullName": "Button just pressed", "functionType": "Condition", - "name": "IsReleased", - "sentence": "Button _PARAM0_ is released", + "name": "IsJustPressed", + "sentence": "Button _PARAM0_ was just pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -10357,7 +10521,7 @@ "value": "BooleanVariable" }, "parameters": [ - "IsReleased", + "IsJustPressed", "True", "" ] @@ -10391,7 +10555,7 @@ "objectGroups": [] }, { - "description": "Check if button is pressed.", + "description": "Check if the button is pressed.", "fullName": "Button pressed", "functionType": "Condition", "name": "IsPressed", @@ -10438,6 +10602,54 @@ ], "objectGroups": [] }, + { + "description": "Check if the button is released.", + "fullName": "Button released", + "functionType": "Condition", + "name": "IsReleased", + "sentence": "Button _PARAM0_ is released", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsReleased", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "type": "behavior" + } + ], + "objectGroups": [] + }, { "fullName": "Button state", "functionType": "Action", @@ -10479,7 +10691,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"JustPressed\",\"Pressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -10520,6 +10732,13 @@ "hidden": true, "name": "IsReleased" }, + { + "value": "", + "type": "Boolean", + "label": "Button just pressed", + "hidden": true, + "name": "IsJustPressed" + }, { "value": "0", "type": "Number", @@ -12934,7 +13153,6 @@ } ], "instances": [], - "editionSettings": [], "eventsFunctions": [ { "fullName": "", @@ -13051,74 +13269,92 @@ "name": "doStepPostEvents", "sentence": "", "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "MettreAutour" - }, - "parameters": [ - "Thumb", - "Border", - "Border.MultitouchJoystick::JoystickForce() * Border.Width() / 2", - "Border.MultitouchJoystick::JoystickAngle()" - ] - } - ] - }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ - { - "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "ShouldBeHiddenWhenReleased", - "True", - "" - ] - }, { "type": { "inverted": true, - "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::IsPressed" + "value": "SpriteMultitouchJoystick::IsInGameEdition" }, "parameters": [ - "Object", + "", "" ] } ], - "actions": [ - { - "type": { - "value": "Cache" - }, - "parameters": [ - "Object" - ] - }, + "actions": [], + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::ActivateControl" - }, - "parameters": [ - "Object", - "no", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "MettreAutour" + }, + "parameters": [ + "Thumb", + "Border", + "Border.MultitouchJoystick::JoystickForce() * Border.Width() / 2", + "Border.MultitouchJoystick::JoystickAngle()" + ] + } ] }, { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "ShouldBeHiddenWhenReleased", - "False", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "ShouldBeHiddenWhenReleased", + "True", + "" + ] + }, + { + "type": { + "inverted": true, + "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::IsPressed" + }, + "parameters": [ + "Object", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "Cache" + }, + "parameters": [ + "Object" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::ActivateControl" + }, + "parameters": [ + "Object", + "no", + "" + ] + }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "ShouldBeHiddenWhenReleased", + "False", + "" + ] + } ] } ] @@ -14125,8 +14361,7 @@ "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 9150b3494..00137cc4f 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.8.3", + "version": "1.9.0", "description": [ - "Multitouch joysticks can be used the same way as physical gamepads:", + "Multitouch joysticks are objects showing a joystick on the screen, useful for mobile. They work like a physical gamepad:", "- 4 or 8 directions", "- Analogus pads", "- Player selection", - "- Controls mapping for top-down movement and platformer characters", + "- Automatic \"mapper\" behaviors for 2D and 3D movement behaviors (platformer characters, top-down movement, 3D character etc...). Add one of these to the object with the movement behavior (i.e: the player most of the time) and the behavior will then be controlled automatically by the virtual joystick (it works by reading the multitouch joystick state and simulating controls). No need for additional events to make it work once the behaviors are set up.", "", "There are ready-to-use joysticks in the asset-store [multitouch joysticks pack](https://editor.gdevelop.io/?initial-dialog=asset-store&asset-pack=multitouch-joysticks-multitouch-joysticks)." ], @@ -3433,6 +3433,28 @@ } ], "eventsFunctions": [ + { + "description": "Check if the events are running for the editor.", + "fullName": "Editor is running", + "functionType": "Condition", + "name": "IsInGameEdition", + "private": true, + "sentence": "Events are running for the editor", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const game = runtimeScene.getGame();\r", + "eventsFunctionContext.returnValue = game.isInGameEdition && game.isInGameEdition();" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [], + "objectGroups": [] + }, { "fullName": "Accelerated speed", "functionType": "Expression", @@ -3851,11 +3873,11 @@ "objectGroups": [] }, { - "description": "Check if a button is pressed on a gamepad.", - "fullName": "Multitouch controller button pressed", + "description": "Check if a button was just pressed on a multitouch controller.", + "fullName": "Multitouch controller button just pressed", "functionType": "Condition", - "name": "IsButtonPressed", - "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", + "name": "IsButtonJustPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ was just pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -3867,7 +3889,73 @@ "parameters": [ "Controllers[ControllerIdentifier].Buttons[Button].State", "=", - "\"Pressed\"" + "\"JustPressed\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier", + "type": "expression" + }, + { + "description": "Button name", + "name": "Button", + "supplementaryInformation": "[\"A\",\"CROSS\",\"B\",\"CIRCLE\",\"X\",\"SQUARE\",\"Y\",\"TRIANGLE\",\"LB\",\"L1\",\"RB\",\"R1\",\"LT\",\"L2\",\"RT\",\"R2\",\"UP\",\"DOWN\",\"LEFT\",\"RIGHT\",\"BACK\",\"SHARE\",\"START\",\"OPTIONS\",\"CLICK_STICK_LEFT\",\"CLICK_STICK_RIGHT\",\"PS_BUTTON\",\"CLICK_TOUCHPAD\"]", + "type": "string" + } + ], + "objectGroups": [] + }, + { + "description": "Check if a button is pressed on a multitouch controller.", + "fullName": "Multitouch controller button pressed", + "functionType": "Condition", + "name": "IsButtonPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::Or" + }, + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"Pressed\"" + ] + }, + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"JustPressed\"" + ] + } ] } ], @@ -3899,7 +3987,7 @@ "objectGroups": [] }, { - "description": "Check if a button is released on a gamepad.", + "description": "Check if a button is released on a multitouch controller.", "fullName": "Multitouch controller button released", "functionType": "Condition", "name": "IsButtonReleased", @@ -3985,7 +4073,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"JustPressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -5358,41 +5446,23 @@ "conditions": [ { "type": { - "value": "HasGameJustResumed" + "inverted": true, + "value": "SpriteMultitouchJoystick::IsInGameEdition" }, "parameters": [ + "", "" ] } ], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - } - ] - }, - { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Manage touches", - "source": "", - "type": "BuiltinCommonInstructions::Group", + "actions": [], "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "value": "HasAnyTouchOrMouseStarted" + "value": "HasGameJustResumed" }, "parameters": [ "" @@ -5402,171 +5472,207 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" }, "parameters": [ - "TouchIndex", - "=", - "0" + "Object", + "Behavior", + "" ] } - ], + ] + }, + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Manage touches", + "source": "", + "type": "BuiltinCommonInstructions::Group", "events": [ { - "type": "BuiltinCommonInstructions::Repeat", - "repeatExpression": "StartedTouchOrMouseCount()", - "conditions": [], - "actions": [], + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "HasAnyTouchOrMouseStarted" + }, + "parameters": [ + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchIndex", + "=", + "0" + ] + } + ], "events": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "StartedTouchOrMouseCount()", + "conditions": [], + "actions": [], + "events": [ { - "type": { - "value": "NumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "0" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "0" + ] + }, + { + "type": { + "value": "CollisionPoint" + }, + "parameters": [ + "Object", + "TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)", + "TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "StartedTouchOrMouseId(TouchIndex)" + ] + } ] }, { - "type": { - "value": "CollisionPoint" - }, - "parameters": [ - "Object", - "TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)", - "TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "StartedTouchOrMouseId(TouchIndex)" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchIndex", - "+", - "1" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchIndex", + "+", + "1" + ] + } ] } ] } ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 - }, - "comment": "Move thumb back to center when not being pressed (acts like a spring on a real controller)" - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + }, { - "type": { - "value": "HasTouchEnded" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 }, - "parameters": [ - "", - "TouchId" - ] - } - ], - "actions": [ + "comment": "Move thumb back to center when not being pressed (acts like a spring on a real controller)" + }, { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" - }, - "parameters": [ - "Object", - "Behavior", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "HasTouchEnded" + }, + "parameters": [ + "", + "TouchId" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } ] } - ] - } - ], - "parameters": [] - }, - { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Update joystick position", - "source": "", - "type": "BuiltinCommonInstructions::Group", - "events": [ + ], + "parameters": [] + }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Update joystick position", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ { - "type": { - "value": "NumberVariable" - }, - "parameters": [ - "TouchId", - "!=", - "0" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "!=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickAngle" + }, + "parameters": [ + "Object", + "Behavior", + "AngleBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0))", + "AngleBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0))" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "clamp(2 * DistanceBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0)) / Object.Width(), 0, 1)", + "" + ] + } ] } ], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickAngle" - }, - "parameters": [ - "Object", - "Behavior", - "AngleBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0))", - "AngleBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0))" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "clamp(2 * DistanceBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0)) / Object.Width(), 0, 1)", - "" - ] - } - ] + "parameters": [] } - ], - "parameters": [] + ] } ], "parameters": [ @@ -6441,7 +6547,7 @@ "sharedPropertyDescriptors": [] }, { - "description": "Detect button presses made on a touchscreen.", + "description": "Detect presses made on a touchscreen on the object so it acts like a button and automatically trigger the button having the same identifier for the mapper behaviors.", "fullName": "Multitouch button", "name": "MultitouchButton", "objectType": "", @@ -6457,11 +6563,11 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::IsReleased" + "value": "BooleanVariable" }, "parameters": [ - "Object", - "Behavior", + "IsReleased", + "True", "" ] } @@ -6490,6 +6596,44 @@ } ] }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "False", + "" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + }, + "parameters": [ + "Object", + "Behavior", + "\"Pressed\"", + "" + ] + } + ] + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ @@ -6582,7 +6726,17 @@ "parameters": [ "Object", "Behavior", - "\"Pressed\"", + "\"JustPressed\"", + "" + ] + }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "True", "" ] } @@ -6653,6 +6807,16 @@ "" ] }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "False", + "" + ] + }, { "type": { "value": "SetNumberVariable" @@ -6682,11 +6846,11 @@ "objectGroups": [] }, { - "description": "Check if button is released.", - "fullName": "Button released", + "description": "Check if the button was just pressed.", + "fullName": "Button just pressed", "functionType": "Condition", - "name": "IsReleased", - "sentence": "Button _PARAM0_ is released", + "name": "IsJustPressed", + "sentence": "Button _PARAM0_ was just pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -6696,7 +6860,7 @@ "value": "BooleanVariable" }, "parameters": [ - "IsReleased", + "IsJustPressed", "True", "" ] @@ -6730,7 +6894,7 @@ "objectGroups": [] }, { - "description": "Check if button is pressed.", + "description": "Check if the button is pressed.", "fullName": "Button pressed", "functionType": "Condition", "name": "IsPressed", @@ -6777,6 +6941,54 @@ ], "objectGroups": [] }, + { + "description": "Check if the button is released.", + "fullName": "Button released", + "functionType": "Condition", + "name": "IsReleased", + "sentence": "Button _PARAM0_ is released", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsReleased", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "type": "behavior" + } + ], + "objectGroups": [] + }, { "fullName": "Button state", "functionType": "Action", @@ -6818,7 +7030,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"JustPressed\",\"Pressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -6859,6 +7071,13 @@ "hidden": true, "name": "IsReleased" }, + { + "value": "", + "type": "Boolean", + "label": "Button just pressed", + "hidden": true, + "name": "IsJustPressed" + }, { "value": "0", "type": "Number", @@ -9273,7 +9492,6 @@ } ], "instances": [], - "editionSettings": {}, "eventsFunctions": [ { "fullName": "", @@ -9390,74 +9608,92 @@ "name": "doStepPostEvents", "sentence": "", "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "MettreAutour" - }, - "parameters": [ - "Thumb", - "Border", - "Border.MultitouchJoystick::JoystickForce() * Border.Width() / 2", - "Border.MultitouchJoystick::JoystickAngle()" - ] - } - ] - }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ - { - "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "ShouldBeHiddenWhenReleased", - "True", - "" - ] - }, { "type": { "inverted": true, - "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::IsPressed" + "value": "SpriteMultitouchJoystick::IsInGameEdition" }, "parameters": [ - "Object", + "", "" ] } ], - "actions": [ - { - "type": { - "value": "Cache" - }, - "parameters": [ - "Object" - ] - }, + "actions": [], + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::ActivateControl" - }, - "parameters": [ - "Object", - "no", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "MettreAutour" + }, + "parameters": [ + "Thumb", + "Border", + "Border.MultitouchJoystick::JoystickForce() * Border.Width() / 2", + "Border.MultitouchJoystick::JoystickAngle()" + ] + } ] }, { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "ShouldBeHiddenWhenReleased", - "False", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "ShouldBeHiddenWhenReleased", + "True", + "" + ] + }, + { + "type": { + "inverted": true, + "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::IsPressed" + }, + "parameters": [ + "Object", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "Cache" + }, + "parameters": [ + "Object" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::ActivateControl" + }, + "parameters": [ + "Object", + "no", + "" + ] + }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "ShouldBeHiddenWhenReleased", + "False", + "" + ] + } ] } ] @@ -10464,8 +10700,7 @@ "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 3593817a2..37ab5cc3f 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.8.3", + "version": "1.9.0", "description": [ - "Multitouch joysticks can be used the same way as physical gamepads:", + "Multitouch joysticks are objects showing a joystick on the screen, useful for mobile. They work like a physical gamepad:", "- 4 or 8 directions", "- Analogus pads", "- Player selection", - "- Controls mapping for top-down movement and platformer characters", + "- Automatic \"mapper\" behaviors for 2D and 3D movement behaviors (platformer characters, top-down movement, 3D character etc...). Add one of these to the object with the movement behavior (i.e: the player most of the time) and the behavior will then be controlled automatically by the virtual joystick (it works by reading the multitouch joystick state and simulating controls). No need for additional events to make it work once the behaviors are set up.", "", "There are ready-to-use joysticks in the asset-store [multitouch joysticks pack](https://editor.gdevelop.io/?initial-dialog=asset-store&asset-pack=multitouch-joysticks-multitouch-joysticks)." ], @@ -4352,6 +4352,28 @@ } ], "eventsFunctions": [ + { + "description": "Check if the events are running for the editor.", + "fullName": "Editor is running", + "functionType": "Condition", + "name": "IsInGameEdition", + "private": true, + "sentence": "Events are running for the editor", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const game = runtimeScene.getGame();\r", + "eventsFunctionContext.returnValue = game.isInGameEdition && game.isInGameEdition();" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [], + "objectGroups": [] + }, { "fullName": "Accelerated speed", "functionType": "Expression", @@ -4770,11 +4792,11 @@ "objectGroups": [] }, { - "description": "Check if a button is pressed on a gamepad.", - "fullName": "Multitouch controller button pressed", + "description": "Check if a button was just pressed on a multitouch controller.", + "fullName": "Multitouch controller button just pressed", "functionType": "Condition", - "name": "IsButtonPressed", - "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", + "name": "IsButtonJustPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ was just pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -4786,7 +4808,73 @@ "parameters": [ "Controllers[ControllerIdentifier].Buttons[Button].State", "=", - "\"Pressed\"" + "\"JustPressed\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier", + "type": "expression" + }, + { + "description": "Button name", + "name": "Button", + "supplementaryInformation": "[\"A\",\"CROSS\",\"B\",\"CIRCLE\",\"X\",\"SQUARE\",\"Y\",\"TRIANGLE\",\"LB\",\"L1\",\"RB\",\"R1\",\"LT\",\"L2\",\"RT\",\"R2\",\"UP\",\"DOWN\",\"LEFT\",\"RIGHT\",\"BACK\",\"SHARE\",\"START\",\"OPTIONS\",\"CLICK_STICK_LEFT\",\"CLICK_STICK_RIGHT\",\"PS_BUTTON\",\"CLICK_TOUCHPAD\"]", + "type": "string" + } + ], + "objectGroups": [] + }, + { + "description": "Check if a button is pressed on a multitouch controller.", + "fullName": "Multitouch controller button pressed", + "functionType": "Condition", + "name": "IsButtonPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::Or" + }, + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"Pressed\"" + ] + }, + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"JustPressed\"" + ] + } ] } ], @@ -4818,7 +4906,7 @@ "objectGroups": [] }, { - "description": "Check if a button is released on a gamepad.", + "description": "Check if a button is released on a multitouch controller.", "fullName": "Multitouch controller button released", "functionType": "Condition", "name": "IsButtonReleased", @@ -4904,7 +4992,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"JustPressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -6277,41 +6365,23 @@ "conditions": [ { "type": { - "value": "HasGameJustResumed" + "inverted": true, + "value": "SpriteMultitouchJoystick::IsInGameEdition" }, "parameters": [ + "", "" ] } ], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - } - ] - }, - { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Manage touches", - "source": "", - "type": "BuiltinCommonInstructions::Group", + "actions": [], "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "value": "HasAnyTouchOrMouseStarted" + "value": "HasGameJustResumed" }, "parameters": [ "" @@ -6321,171 +6391,207 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" }, "parameters": [ - "TouchIndex", - "=", - "0" + "Object", + "Behavior", + "" ] } - ], + ] + }, + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Manage touches", + "source": "", + "type": "BuiltinCommonInstructions::Group", "events": [ { - "type": "BuiltinCommonInstructions::Repeat", - "repeatExpression": "StartedTouchOrMouseCount()", - "conditions": [], - "actions": [], + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "HasAnyTouchOrMouseStarted" + }, + "parameters": [ + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchIndex", + "=", + "0" + ] + } + ], "events": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "StartedTouchOrMouseCount()", + "conditions": [], + "actions": [], + "events": [ { - "type": { - "value": "NumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "0" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "0" + ] + }, + { + "type": { + "value": "CollisionPoint" + }, + "parameters": [ + "Object", + "TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)", + "TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "StartedTouchOrMouseId(TouchIndex)" + ] + } ] }, { - "type": { - "value": "CollisionPoint" - }, - "parameters": [ - "Object", - "TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)", - "TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "StartedTouchOrMouseId(TouchIndex)" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchIndex", - "+", - "1" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchIndex", + "+", + "1" + ] + } ] } ] } ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 - }, - "comment": "Move thumb back to center when not being pressed (acts like a spring on a real controller)" - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + }, { - "type": { - "value": "HasTouchEnded" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 }, - "parameters": [ - "", - "TouchId" - ] - } - ], - "actions": [ + "comment": "Move thumb back to center when not being pressed (acts like a spring on a real controller)" + }, { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" - }, - "parameters": [ - "Object", - "Behavior", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "HasTouchEnded" + }, + "parameters": [ + "", + "TouchId" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } ] } - ] - } - ], - "parameters": [] - }, - { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Update joystick position", - "source": "", - "type": "BuiltinCommonInstructions::Group", - "events": [ + ], + "parameters": [] + }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Update joystick position", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ { - "type": { - "value": "NumberVariable" - }, - "parameters": [ - "TouchId", - "!=", - "0" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "!=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickAngle" + }, + "parameters": [ + "Object", + "Behavior", + "AngleBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0))", + "AngleBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0))" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "clamp(2 * DistanceBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0)) / Object.Width(), 0, 1)", + "" + ] + } ] } ], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickAngle" - }, - "parameters": [ - "Object", - "Behavior", - "AngleBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0))", - "AngleBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0))" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "clamp(2 * DistanceBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0)) / Object.Width(), 0, 1)", - "" - ] - } - ] + "parameters": [] } - ], - "parameters": [] + ] } ], "parameters": [ @@ -7360,7 +7466,7 @@ "sharedPropertyDescriptors": [] }, { - "description": "Detect button presses made on a touchscreen.", + "description": "Detect presses made on a touchscreen on the object so it acts like a button and automatically trigger the button having the same identifier for the mapper behaviors.", "fullName": "Multitouch button", "name": "MultitouchButton", "objectType": "", @@ -7376,11 +7482,11 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::IsReleased" + "value": "BooleanVariable" }, "parameters": [ - "Object", - "Behavior", + "IsReleased", + "True", "" ] } @@ -7409,6 +7515,44 @@ } ] }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "False", + "" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + }, + "parameters": [ + "Object", + "Behavior", + "\"Pressed\"", + "" + ] + } + ] + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ @@ -7501,7 +7645,17 @@ "parameters": [ "Object", "Behavior", - "\"Pressed\"", + "\"JustPressed\"", + "" + ] + }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "True", "" ] } @@ -7572,6 +7726,16 @@ "" ] }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "False", + "" + ] + }, { "type": { "value": "SetNumberVariable" @@ -7601,11 +7765,11 @@ "objectGroups": [] }, { - "description": "Check if button is released.", - "fullName": "Button released", + "description": "Check if the button was just pressed.", + "fullName": "Button just pressed", "functionType": "Condition", - "name": "IsReleased", - "sentence": "Button _PARAM0_ is released", + "name": "IsJustPressed", + "sentence": "Button _PARAM0_ was just pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -7615,7 +7779,7 @@ "value": "BooleanVariable" }, "parameters": [ - "IsReleased", + "IsJustPressed", "True", "" ] @@ -7649,7 +7813,7 @@ "objectGroups": [] }, { - "description": "Check if button is pressed.", + "description": "Check if the button is pressed.", "fullName": "Button pressed", "functionType": "Condition", "name": "IsPressed", @@ -7696,6 +7860,54 @@ ], "objectGroups": [] }, + { + "description": "Check if the button is released.", + "fullName": "Button released", + "functionType": "Condition", + "name": "IsReleased", + "sentence": "Button _PARAM0_ is released", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsReleased", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "type": "behavior" + } + ], + "objectGroups": [] + }, { "fullName": "Button state", "functionType": "Action", @@ -7737,7 +7949,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"JustPressed\",\"Pressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -7778,6 +7990,13 @@ "hidden": true, "name": "IsReleased" }, + { + "value": "", + "type": "Boolean", + "label": "Button just pressed", + "hidden": true, + "name": "IsJustPressed" + }, { "value": "0", "type": "Number", @@ -10192,7 +10411,6 @@ } ], "instances": [], - "editionSettings": {}, "eventsFunctions": [ { "fullName": "", @@ -10309,74 +10527,92 @@ "name": "doStepPostEvents", "sentence": "", "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "MettreAutour" - }, - "parameters": [ - "Thumb", - "Border", - "Border.MultitouchJoystick::JoystickForce() * Border.Width() / 2", - "Border.MultitouchJoystick::JoystickAngle()" - ] - } - ] - }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ - { - "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "ShouldBeHiddenWhenReleased", - "True", - "" - ] - }, { "type": { "inverted": true, - "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::IsPressed" + "value": "SpriteMultitouchJoystick::IsInGameEdition" }, "parameters": [ - "Object", + "", "" ] } ], - "actions": [ - { - "type": { - "value": "Cache" - }, - "parameters": [ - "Object" - ] - }, + "actions": [], + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::ActivateControl" - }, - "parameters": [ - "Object", - "no", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "MettreAutour" + }, + "parameters": [ + "Thumb", + "Border", + "Border.MultitouchJoystick::JoystickForce() * Border.Width() / 2", + "Border.MultitouchJoystick::JoystickAngle()" + ] + } ] }, { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "ShouldBeHiddenWhenReleased", - "False", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "ShouldBeHiddenWhenReleased", + "True", + "" + ] + }, + { + "type": { + "inverted": true, + "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::IsPressed" + }, + "parameters": [ + "Object", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "Cache" + }, + "parameters": [ + "Object" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::ActivateControl" + }, + "parameters": [ + "Object", + "no", + "" + ] + }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "ShouldBeHiddenWhenReleased", + "False", + "" + ] + } ] } ] @@ -11383,8 +11619,7 @@ "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 f3b4506fc..ee3977cf6 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.8.3", + "version": "1.9.0", "description": [ - "Multitouch joysticks can be used the same way as physical gamepads:", + "Multitouch joysticks are objects showing a joystick on the screen, useful for mobile. They work like a physical gamepad:", "- 4 or 8 directions", "- Analogus pads", "- Player selection", - "- Controls mapping for top-down movement and platformer characters", + "- Automatic \"mapper\" behaviors for 2D and 3D movement behaviors (platformer characters, top-down movement, 3D character etc...). Add one of these to the object with the movement behavior (i.e: the player most of the time) and the behavior will then be controlled automatically by the virtual joystick (it works by reading the multitouch joystick state and simulating controls). No need for additional events to make it work once the behaviors are set up.", "", "There are ready-to-use joysticks in the asset-store [multitouch joysticks pack](https://editor.gdevelop.io/?initial-dialog=asset-store&asset-pack=multitouch-joysticks-multitouch-joysticks)." ], @@ -3475,6 +3475,28 @@ } ], "eventsFunctions": [ + { + "description": "Check if the events are running for the editor.", + "fullName": "Editor is running", + "functionType": "Condition", + "name": "IsInGameEdition", + "private": true, + "sentence": "Events are running for the editor", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const game = runtimeScene.getGame();\r", + "eventsFunctionContext.returnValue = game.isInGameEdition && game.isInGameEdition();" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [], + "objectGroups": [] + }, { "fullName": "Accelerated speed", "functionType": "Expression", @@ -3893,11 +3915,11 @@ "objectGroups": [] }, { - "description": "Check if a button is pressed on a gamepad.", - "fullName": "Multitouch controller button pressed", + "description": "Check if a button was just pressed on a multitouch controller.", + "fullName": "Multitouch controller button just pressed", "functionType": "Condition", - "name": "IsButtonPressed", - "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", + "name": "IsButtonJustPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ was just pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -3909,7 +3931,73 @@ "parameters": [ "Controllers[ControllerIdentifier].Buttons[Button].State", "=", - "\"Pressed\"" + "\"JustPressed\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier", + "type": "expression" + }, + { + "description": "Button name", + "name": "Button", + "supplementaryInformation": "[\"A\",\"CROSS\",\"B\",\"CIRCLE\",\"X\",\"SQUARE\",\"Y\",\"TRIANGLE\",\"LB\",\"L1\",\"RB\",\"R1\",\"LT\",\"L2\",\"RT\",\"R2\",\"UP\",\"DOWN\",\"LEFT\",\"RIGHT\",\"BACK\",\"SHARE\",\"START\",\"OPTIONS\",\"CLICK_STICK_LEFT\",\"CLICK_STICK_RIGHT\",\"PS_BUTTON\",\"CLICK_TOUCHPAD\"]", + "type": "string" + } + ], + "objectGroups": [] + }, + { + "description": "Check if a button is pressed on a multitouch controller.", + "fullName": "Multitouch controller button pressed", + "functionType": "Condition", + "name": "IsButtonPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::Or" + }, + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"Pressed\"" + ] + }, + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"JustPressed\"" + ] + } ] } ], @@ -3941,7 +4029,7 @@ "objectGroups": [] }, { - "description": "Check if a button is released on a gamepad.", + "description": "Check if a button is released on a multitouch controller.", "fullName": "Multitouch controller button released", "functionType": "Condition", "name": "IsButtonReleased", @@ -4027,7 +4115,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"JustPressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -5400,41 +5488,23 @@ "conditions": [ { "type": { - "value": "HasGameJustResumed" + "inverted": true, + "value": "SpriteMultitouchJoystick::IsInGameEdition" }, "parameters": [ + "", "" ] } ], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - } - ] - }, - { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Manage touches", - "source": "", - "type": "BuiltinCommonInstructions::Group", + "actions": [], "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "value": "HasAnyTouchOrMouseStarted" + "value": "HasGameJustResumed" }, "parameters": [ "" @@ -5444,171 +5514,207 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" }, "parameters": [ - "TouchIndex", - "=", - "0" + "Object", + "Behavior", + "" ] } - ], + ] + }, + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Manage touches", + "source": "", + "type": "BuiltinCommonInstructions::Group", "events": [ { - "type": "BuiltinCommonInstructions::Repeat", - "repeatExpression": "StartedTouchOrMouseCount()", - "conditions": [], - "actions": [], + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "HasAnyTouchOrMouseStarted" + }, + "parameters": [ + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchIndex", + "=", + "0" + ] + } + ], "events": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "StartedTouchOrMouseCount()", + "conditions": [], + "actions": [], + "events": [ { - "type": { - "value": "NumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "0" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "0" + ] + }, + { + "type": { + "value": "CollisionPoint" + }, + "parameters": [ + "Object", + "TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)", + "TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "StartedTouchOrMouseId(TouchIndex)" + ] + } ] }, { - "type": { - "value": "CollisionPoint" - }, - "parameters": [ - "Object", - "TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)", - "TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "StartedTouchOrMouseId(TouchIndex)" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchIndex", - "+", - "1" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchIndex", + "+", + "1" + ] + } ] } ] } ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 - }, - "comment": "Move thumb back to center when not being pressed (acts like a spring on a real controller)" - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + }, { - "type": { - "value": "HasTouchEnded" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 }, - "parameters": [ - "", - "TouchId" - ] - } - ], - "actions": [ + "comment": "Move thumb back to center when not being pressed (acts like a spring on a real controller)" + }, { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" - }, - "parameters": [ - "Object", - "Behavior", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "HasTouchEnded" + }, + "parameters": [ + "", + "TouchId" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } ] } - ] - } - ], - "parameters": [] - }, - { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Update joystick position", - "source": "", - "type": "BuiltinCommonInstructions::Group", - "events": [ + ], + "parameters": [] + }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Update joystick position", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ { - "type": { - "value": "NumberVariable" - }, - "parameters": [ - "TouchId", - "!=", - "0" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "!=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickAngle" + }, + "parameters": [ + "Object", + "Behavior", + "AngleBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0))", + "AngleBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0))" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "clamp(2 * DistanceBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0)) / Object.Width(), 0, 1)", + "" + ] + } ] } ], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickAngle" - }, - "parameters": [ - "Object", - "Behavior", - "AngleBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0))", - "AngleBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0))" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "clamp(2 * DistanceBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0)) / Object.Width(), 0, 1)", - "" - ] - } - ] + "parameters": [] } - ], - "parameters": [] + ] } ], "parameters": [ @@ -6483,7 +6589,7 @@ "sharedPropertyDescriptors": [] }, { - "description": "Detect button presses made on a touchscreen.", + "description": "Detect presses made on a touchscreen on the object so it acts like a button and automatically trigger the button having the same identifier for the mapper behaviors.", "fullName": "Multitouch button", "name": "MultitouchButton", "objectType": "", @@ -6499,11 +6605,11 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::IsReleased" + "value": "BooleanVariable" }, "parameters": [ - "Object", - "Behavior", + "IsReleased", + "True", "" ] } @@ -6532,6 +6638,44 @@ } ] }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "False", + "" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + }, + "parameters": [ + "Object", + "Behavior", + "\"Pressed\"", + "" + ] + } + ] + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ @@ -6624,7 +6768,17 @@ "parameters": [ "Object", "Behavior", - "\"Pressed\"", + "\"JustPressed\"", + "" + ] + }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "True", "" ] } @@ -6695,6 +6849,16 @@ "" ] }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "False", + "" + ] + }, { "type": { "value": "SetNumberVariable" @@ -6724,11 +6888,11 @@ "objectGroups": [] }, { - "description": "Check if button is released.", - "fullName": "Button released", + "description": "Check if the button was just pressed.", + "fullName": "Button just pressed", "functionType": "Condition", - "name": "IsReleased", - "sentence": "Button _PARAM0_ is released", + "name": "IsJustPressed", + "sentence": "Button _PARAM0_ was just pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -6738,7 +6902,7 @@ "value": "BooleanVariable" }, "parameters": [ - "IsReleased", + "IsJustPressed", "True", "" ] @@ -6772,7 +6936,7 @@ "objectGroups": [] }, { - "description": "Check if button is pressed.", + "description": "Check if the button is pressed.", "fullName": "Button pressed", "functionType": "Condition", "name": "IsPressed", @@ -6819,6 +6983,54 @@ ], "objectGroups": [] }, + { + "description": "Check if the button is released.", + "fullName": "Button released", + "functionType": "Condition", + "name": "IsReleased", + "sentence": "Button _PARAM0_ is released", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsReleased", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "type": "behavior" + } + ], + "objectGroups": [] + }, { "fullName": "Button state", "functionType": "Action", @@ -6860,7 +7072,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"JustPressed\",\"Pressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -6901,6 +7113,13 @@ "hidden": true, "name": "IsReleased" }, + { + "value": "", + "type": "Boolean", + "label": "Button just pressed", + "hidden": true, + "name": "IsJustPressed" + }, { "value": "0", "type": "Number", @@ -9315,7 +9534,6 @@ } ], "instances": [], - "editionSettings": {}, "eventsFunctions": [ { "fullName": "", @@ -9432,74 +9650,92 @@ "name": "doStepPostEvents", "sentence": "", "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "MettreAutour" - }, - "parameters": [ - "Thumb", - "Border", - "Border.MultitouchJoystick::JoystickForce() * Border.Width() / 2", - "Border.MultitouchJoystick::JoystickAngle()" - ] - } - ] - }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ - { - "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "ShouldBeHiddenWhenReleased", - "True", - "" - ] - }, { "type": { "inverted": true, - "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::IsPressed" + "value": "SpriteMultitouchJoystick::IsInGameEdition" }, "parameters": [ - "Object", + "", "" ] } ], - "actions": [ - { - "type": { - "value": "Cache" - }, - "parameters": [ - "Object" - ] - }, + "actions": [], + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::ActivateControl" - }, - "parameters": [ - "Object", - "no", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "MettreAutour" + }, + "parameters": [ + "Thumb", + "Border", + "Border.MultitouchJoystick::JoystickForce() * Border.Width() / 2", + "Border.MultitouchJoystick::JoystickAngle()" + ] + } ] }, { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "ShouldBeHiddenWhenReleased", - "False", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "ShouldBeHiddenWhenReleased", + "True", + "" + ] + }, + { + "type": { + "inverted": true, + "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::IsPressed" + }, + "parameters": [ + "Object", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "Cache" + }, + "parameters": [ + "Object" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::ActivateControl" + }, + "parameters": [ + "Object", + "no", + "" + ] + }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "ShouldBeHiddenWhenReleased", + "False", + "" + ] + } ] } ] @@ -10506,8 +10742,7 @@ "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 a010975a8..02b9b3615 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.8.3", + "version": "1.9.0", "description": [ - "Multitouch joysticks can be used the same way as physical gamepads:", + "Multitouch joysticks are objects showing a joystick on the screen, useful for mobile. They work like a physical gamepad:", "- 4 or 8 directions", "- Analogus pads", "- Player selection", - "- Controls mapping for top-down movement and platformer characters", + "- Automatic \"mapper\" behaviors for 2D and 3D movement behaviors (platformer characters, top-down movement, 3D character etc...). Add one of these to the object with the movement behavior (i.e: the player most of the time) and the behavior will then be controlled automatically by the virtual joystick (it works by reading the multitouch joystick state and simulating controls). No need for additional events to make it work once the behaviors are set up.", "", "There are ready-to-use joysticks in the asset-store [multitouch joysticks pack](https://editor.gdevelop.io/?initial-dialog=asset-store&asset-pack=multitouch-joysticks-multitouch-joysticks)." ], @@ -5532,6 +5532,28 @@ } ], "eventsFunctions": [ + { + "description": "Check if the events are running for the editor.", + "fullName": "Editor is running", + "functionType": "Condition", + "name": "IsInGameEdition", + "private": true, + "sentence": "Events are running for the editor", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const game = runtimeScene.getGame();\r", + "eventsFunctionContext.returnValue = game.isInGameEdition && game.isInGameEdition();" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [], + "objectGroups": [] + }, { "fullName": "Accelerated speed", "functionType": "Expression", @@ -5950,11 +5972,11 @@ "objectGroups": [] }, { - "description": "Check if a button is pressed on a gamepad.", - "fullName": "Multitouch controller button pressed", + "description": "Check if a button was just pressed on a multitouch controller.", + "fullName": "Multitouch controller button just pressed", "functionType": "Condition", - "name": "IsButtonPressed", - "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", + "name": "IsButtonJustPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ was just pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -5966,7 +5988,7 @@ "parameters": [ "Controllers[ControllerIdentifier].Buttons[Button].State", "=", - "\"Pressed\"" + "\"JustPressed\"" ] } ], @@ -5998,7 +6020,73 @@ "objectGroups": [] }, { - "description": "Check if a button is released on a gamepad.", + "description": "Check if a button is pressed on a multitouch controller.", + "fullName": "Multitouch controller button pressed", + "functionType": "Condition", + "name": "IsButtonPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::Or" + }, + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"Pressed\"" + ] + }, + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"JustPressed\"" + ] + } + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier", + "type": "expression" + }, + { + "description": "Button name", + "name": "Button", + "supplementaryInformation": "[\"A\",\"CROSS\",\"B\",\"CIRCLE\",\"X\",\"SQUARE\",\"Y\",\"TRIANGLE\",\"LB\",\"L1\",\"RB\",\"R1\",\"LT\",\"L2\",\"RT\",\"R2\",\"UP\",\"DOWN\",\"LEFT\",\"RIGHT\",\"BACK\",\"SHARE\",\"START\",\"OPTIONS\",\"CLICK_STICK_LEFT\",\"CLICK_STICK_RIGHT\",\"PS_BUTTON\",\"CLICK_TOUCHPAD\"]", + "type": "string" + } + ], + "objectGroups": [] + }, + { + "description": "Check if a button is released on a multitouch controller.", "fullName": "Multitouch controller button released", "functionType": "Condition", "name": "IsButtonReleased", @@ -6084,7 +6172,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"JustPressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -7457,41 +7545,23 @@ "conditions": [ { "type": { - "value": "HasGameJustResumed" + "inverted": true, + "value": "SpriteMultitouchJoystick::IsInGameEdition" }, "parameters": [ + "", "" ] } ], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - } - ] - }, - { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Manage touches", - "source": "", - "type": "BuiltinCommonInstructions::Group", + "actions": [], "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "value": "HasAnyTouchOrMouseStarted" + "value": "HasGameJustResumed" }, "parameters": [ "" @@ -7501,171 +7571,207 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" }, "parameters": [ - "TouchIndex", - "=", - "0" + "Object", + "Behavior", + "" ] } - ], + ] + }, + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Manage touches", + "source": "", + "type": "BuiltinCommonInstructions::Group", "events": [ { - "type": "BuiltinCommonInstructions::Repeat", - "repeatExpression": "StartedTouchOrMouseCount()", - "conditions": [], - "actions": [], + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "HasAnyTouchOrMouseStarted" + }, + "parameters": [ + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchIndex", + "=", + "0" + ] + } + ], "events": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "StartedTouchOrMouseCount()", + "conditions": [], + "actions": [], + "events": [ { - "type": { - "value": "NumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "0" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "0" + ] + }, + { + "type": { + "value": "CollisionPoint" + }, + "parameters": [ + "Object", + "TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)", + "TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "StartedTouchOrMouseId(TouchIndex)" + ] + } ] }, { - "type": { - "value": "CollisionPoint" - }, - "parameters": [ - "Object", - "TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)", - "TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "StartedTouchOrMouseId(TouchIndex)" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchIndex", - "+", - "1" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchIndex", + "+", + "1" + ] + } ] } ] } ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 - }, - "comment": "Move thumb back to center when not being pressed (acts like a spring on a real controller)" - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + }, { - "type": { - "value": "HasTouchEnded" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 }, - "parameters": [ - "", - "TouchId" - ] - } - ], - "actions": [ + "comment": "Move thumb back to center when not being pressed (acts like a spring on a real controller)" + }, { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" - }, - "parameters": [ - "Object", - "Behavior", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "HasTouchEnded" + }, + "parameters": [ + "", + "TouchId" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } ] } - ] - } - ], - "parameters": [] - }, - { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Update joystick position", - "source": "", - "type": "BuiltinCommonInstructions::Group", - "events": [ + ], + "parameters": [] + }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Update joystick position", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ { - "type": { - "value": "NumberVariable" - }, - "parameters": [ - "TouchId", - "!=", - "0" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "!=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickAngle" + }, + "parameters": [ + "Object", + "Behavior", + "AngleBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0))", + "AngleBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0))" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "clamp(2 * DistanceBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0)) / Object.Width(), 0, 1)", + "" + ] + } ] } ], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickAngle" - }, - "parameters": [ - "Object", - "Behavior", - "AngleBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0))", - "AngleBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0))" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "clamp(2 * DistanceBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0)) / Object.Width(), 0, 1)", - "" - ] - } - ] + "parameters": [] } - ], - "parameters": [] + ] } ], "parameters": [ @@ -8540,7 +8646,7 @@ "sharedPropertyDescriptors": [] }, { - "description": "Detect button presses made on a touchscreen.", + "description": "Detect presses made on a touchscreen on the object so it acts like a button and automatically trigger the button having the same identifier for the mapper behaviors.", "fullName": "Multitouch button", "name": "MultitouchButton", "objectType": "", @@ -8556,11 +8662,11 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::IsReleased" + "value": "BooleanVariable" }, "parameters": [ - "Object", - "Behavior", + "IsReleased", + "True", "" ] } @@ -8589,6 +8695,44 @@ } ] }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "False", + "" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + }, + "parameters": [ + "Object", + "Behavior", + "\"Pressed\"", + "" + ] + } + ] + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ @@ -8681,7 +8825,17 @@ "parameters": [ "Object", "Behavior", - "\"Pressed\"", + "\"JustPressed\"", + "" + ] + }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "True", "" ] } @@ -8752,6 +8906,16 @@ "" ] }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "False", + "" + ] + }, { "type": { "value": "SetNumberVariable" @@ -8781,11 +8945,11 @@ "objectGroups": [] }, { - "description": "Check if button is released.", - "fullName": "Button released", + "description": "Check if the button was just pressed.", + "fullName": "Button just pressed", "functionType": "Condition", - "name": "IsReleased", - "sentence": "Button _PARAM0_ is released", + "name": "IsJustPressed", + "sentence": "Button _PARAM0_ was just pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -8795,7 +8959,7 @@ "value": "BooleanVariable" }, "parameters": [ - "IsReleased", + "IsJustPressed", "True", "" ] @@ -8829,7 +8993,7 @@ "objectGroups": [] }, { - "description": "Check if button is pressed.", + "description": "Check if the button is pressed.", "fullName": "Button pressed", "functionType": "Condition", "name": "IsPressed", @@ -8876,6 +9040,54 @@ ], "objectGroups": [] }, + { + "description": "Check if the button is released.", + "fullName": "Button released", + "functionType": "Condition", + "name": "IsReleased", + "sentence": "Button _PARAM0_ is released", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsReleased", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "type": "behavior" + } + ], + "objectGroups": [] + }, { "fullName": "Button state", "functionType": "Action", @@ -8917,7 +9129,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"JustPressed\",\"Pressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -8958,6 +9170,13 @@ "hidden": true, "name": "IsReleased" }, + { + "value": "", + "type": "Boolean", + "label": "Button just pressed", + "hidden": true, + "name": "IsJustPressed" + }, { "value": "0", "type": "Number", @@ -11372,7 +11591,6 @@ } ], "instances": [], - "editionSettings": [], "eventsFunctions": [ { "fullName": "", @@ -11489,74 +11707,92 @@ "name": "doStepPostEvents", "sentence": "", "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "MettreAutour" - }, - "parameters": [ - "Thumb", - "Border", - "Border.MultitouchJoystick::JoystickForce() * Border.Width() / 2", - "Border.MultitouchJoystick::JoystickAngle()" - ] - } - ] - }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ - { - "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "ShouldBeHiddenWhenReleased", - "True", - "" - ] - }, { "type": { "inverted": true, - "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::IsPressed" + "value": "SpriteMultitouchJoystick::IsInGameEdition" }, "parameters": [ - "Object", + "", "" ] } ], - "actions": [ - { - "type": { - "value": "Cache" - }, - "parameters": [ - "Object" - ] - }, + "actions": [], + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::ActivateControl" - }, - "parameters": [ - "Object", - "no", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "MettreAutour" + }, + "parameters": [ + "Thumb", + "Border", + "Border.MultitouchJoystick::JoystickForce() * Border.Width() / 2", + "Border.MultitouchJoystick::JoystickAngle()" + ] + } ] }, { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "ShouldBeHiddenWhenReleased", - "False", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "ShouldBeHiddenWhenReleased", + "True", + "" + ] + }, + { + "type": { + "inverted": true, + "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::IsPressed" + }, + "parameters": [ + "Object", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "Cache" + }, + "parameters": [ + "Object" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::ActivateControl" + }, + "parameters": [ + "Object", + "no", + "" + ] + }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "ShouldBeHiddenWhenReleased", + "False", + "" + ] + } ] } ] @@ -12563,8 +12799,7 @@ "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 69c47f305..741047b5f 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.8.3", + "version": "1.9.0", "description": [ - "Multitouch joysticks can be used the same way as physical gamepads:", + "Multitouch joysticks are objects showing a joystick on the screen, useful for mobile. They work like a physical gamepad:", "- 4 or 8 directions", "- Analogus pads", "- Player selection", - "- Controls mapping for top-down movement and platformer characters", + "- Automatic \"mapper\" behaviors for 2D and 3D movement behaviors (platformer characters, top-down movement, 3D character etc...). Add one of these to the object with the movement behavior (i.e: the player most of the time) and the behavior will then be controlled automatically by the virtual joystick (it works by reading the multitouch joystick state and simulating controls). No need for additional events to make it work once the behaviors are set up.", "", "There are ready-to-use joysticks in the asset-store [multitouch joysticks pack](https://editor.gdevelop.io/?initial-dialog=asset-store&asset-pack=multitouch-joysticks-multitouch-joysticks)." ], @@ -2574,6 +2574,28 @@ } ], "eventsFunctions": [ + { + "description": "Check if the events are running for the editor.", + "fullName": "Editor is running", + "functionType": "Condition", + "name": "IsInGameEdition", + "private": true, + "sentence": "Events are running for the editor", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const game = runtimeScene.getGame();\r", + "eventsFunctionContext.returnValue = game.isInGameEdition && game.isInGameEdition();" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [], + "objectGroups": [] + }, { "fullName": "Accelerated speed", "functionType": "Expression", @@ -2992,11 +3014,11 @@ "objectGroups": [] }, { - "description": "Check if a button is pressed on a gamepad.", - "fullName": "Multitouch controller button pressed", + "description": "Check if a button was just pressed on a multitouch controller.", + "fullName": "Multitouch controller button just pressed", "functionType": "Condition", - "name": "IsButtonPressed", - "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", + "name": "IsButtonJustPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ was just pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -3008,7 +3030,73 @@ "parameters": [ "Controllers[ControllerIdentifier].Buttons[Button].State", "=", - "\"Pressed\"" + "\"JustPressed\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier", + "type": "expression" + }, + { + "description": "Button name", + "name": "Button", + "supplementaryInformation": "[\"A\",\"CROSS\",\"B\",\"CIRCLE\",\"X\",\"SQUARE\",\"Y\",\"TRIANGLE\",\"LB\",\"L1\",\"RB\",\"R1\",\"LT\",\"L2\",\"RT\",\"R2\",\"UP\",\"DOWN\",\"LEFT\",\"RIGHT\",\"BACK\",\"SHARE\",\"START\",\"OPTIONS\",\"CLICK_STICK_LEFT\",\"CLICK_STICK_RIGHT\",\"PS_BUTTON\",\"CLICK_TOUCHPAD\"]", + "type": "string" + } + ], + "objectGroups": [] + }, + { + "description": "Check if a button is pressed on a multitouch controller.", + "fullName": "Multitouch controller button pressed", + "functionType": "Condition", + "name": "IsButtonPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::Or" + }, + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"Pressed\"" + ] + }, + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"JustPressed\"" + ] + } ] } ], @@ -3040,7 +3128,7 @@ "objectGroups": [] }, { - "description": "Check if a button is released on a gamepad.", + "description": "Check if a button is released on a multitouch controller.", "fullName": "Multitouch controller button released", "functionType": "Condition", "name": "IsButtonReleased", @@ -3126,7 +3214,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"JustPressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -4499,41 +4587,23 @@ "conditions": [ { "type": { - "value": "HasGameJustResumed" + "inverted": true, + "value": "SpriteMultitouchJoystick::IsInGameEdition" }, "parameters": [ + "", "" ] } ], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - } - ] - }, - { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Manage touches", - "source": "", - "type": "BuiltinCommonInstructions::Group", + "actions": [], "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "value": "HasAnyTouchOrMouseStarted" + "value": "HasGameJustResumed" }, "parameters": [ "" @@ -4543,171 +4613,207 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" }, "parameters": [ - "TouchIndex", - "=", - "0" + "Object", + "Behavior", + "" ] } - ], + ] + }, + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Manage touches", + "source": "", + "type": "BuiltinCommonInstructions::Group", "events": [ { - "type": "BuiltinCommonInstructions::Repeat", - "repeatExpression": "StartedTouchOrMouseCount()", - "conditions": [], - "actions": [], + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "HasAnyTouchOrMouseStarted" + }, + "parameters": [ + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchIndex", + "=", + "0" + ] + } + ], "events": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "StartedTouchOrMouseCount()", + "conditions": [], + "actions": [], + "events": [ { - "type": { - "value": "NumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "0" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "0" + ] + }, + { + "type": { + "value": "CollisionPoint" + }, + "parameters": [ + "Object", + "TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)", + "TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "StartedTouchOrMouseId(TouchIndex)" + ] + } ] }, { - "type": { - "value": "CollisionPoint" - }, - "parameters": [ - "Object", - "TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)", - "TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "StartedTouchOrMouseId(TouchIndex)" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchIndex", - "+", - "1" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchIndex", + "+", + "1" + ] + } ] } ] } ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 - }, - "comment": "Move thumb back to center when not being pressed (acts like a spring on a real controller)" - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + }, { - "type": { - "value": "HasTouchEnded" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 }, - "parameters": [ - "", - "TouchId" - ] - } - ], - "actions": [ + "comment": "Move thumb back to center when not being pressed (acts like a spring on a real controller)" + }, { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" - }, - "parameters": [ - "Object", - "Behavior", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "HasTouchEnded" + }, + "parameters": [ + "", + "TouchId" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } ] } - ] - } - ], - "parameters": [] - }, - { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Update joystick position", - "source": "", - "type": "BuiltinCommonInstructions::Group", - "events": [ + ], + "parameters": [] + }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Update joystick position", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ { - "type": { - "value": "NumberVariable" - }, - "parameters": [ - "TouchId", - "!=", - "0" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "!=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickAngle" + }, + "parameters": [ + "Object", + "Behavior", + "AngleBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0))", + "AngleBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0))" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "clamp(2 * DistanceBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0)) / Object.Width(), 0, 1)", + "" + ] + } ] } ], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickAngle" - }, - "parameters": [ - "Object", - "Behavior", - "AngleBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0))", - "AngleBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0))" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "clamp(2 * DistanceBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0)) / Object.Width(), 0, 1)", - "" - ] - } - ] + "parameters": [] } - ], - "parameters": [] + ] } ], "parameters": [ @@ -5582,7 +5688,7 @@ "sharedPropertyDescriptors": [] }, { - "description": "Detect button presses made on a touchscreen.", + "description": "Detect presses made on a touchscreen on the object so it acts like a button and automatically trigger the button having the same identifier for the mapper behaviors.", "fullName": "Multitouch button", "name": "MultitouchButton", "objectType": "", @@ -5598,11 +5704,11 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::IsReleased" + "value": "BooleanVariable" }, "parameters": [ - "Object", - "Behavior", + "IsReleased", + "True", "" ] } @@ -5631,6 +5737,44 @@ } ] }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "False", + "" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + }, + "parameters": [ + "Object", + "Behavior", + "\"Pressed\"", + "" + ] + } + ] + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ @@ -5723,7 +5867,17 @@ "parameters": [ "Object", "Behavior", - "\"Pressed\"", + "\"JustPressed\"", + "" + ] + }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "True", "" ] } @@ -5794,6 +5948,16 @@ "" ] }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "False", + "" + ] + }, { "type": { "value": "SetNumberVariable" @@ -5823,11 +5987,11 @@ "objectGroups": [] }, { - "description": "Check if button is released.", - "fullName": "Button released", + "description": "Check if the button was just pressed.", + "fullName": "Button just pressed", "functionType": "Condition", - "name": "IsReleased", - "sentence": "Button _PARAM0_ is released", + "name": "IsJustPressed", + "sentence": "Button _PARAM0_ was just pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -5837,7 +6001,7 @@ "value": "BooleanVariable" }, "parameters": [ - "IsReleased", + "IsJustPressed", "True", "" ] @@ -5871,7 +6035,7 @@ "objectGroups": [] }, { - "description": "Check if button is pressed.", + "description": "Check if the button is pressed.", "fullName": "Button pressed", "functionType": "Condition", "name": "IsPressed", @@ -5918,6 +6082,54 @@ ], "objectGroups": [] }, + { + "description": "Check if the button is released.", + "fullName": "Button released", + "functionType": "Condition", + "name": "IsReleased", + "sentence": "Button _PARAM0_ is released", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsReleased", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "type": "behavior" + } + ], + "objectGroups": [] + }, { "fullName": "Button state", "functionType": "Action", @@ -5959,7 +6171,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"JustPressed\",\"Pressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -6000,6 +6212,13 @@ "hidden": true, "name": "IsReleased" }, + { + "value": "", + "type": "Boolean", + "label": "Button just pressed", + "hidden": true, + "name": "IsJustPressed" + }, { "value": "0", "type": "Number", @@ -8414,7 +8633,6 @@ } ], "instances": [], - "editionSettings": {}, "eventsFunctions": [ { "fullName": "", @@ -8531,74 +8749,92 @@ "name": "doStepPostEvents", "sentence": "", "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "MettreAutour" - }, - "parameters": [ - "Thumb", - "Border", - "Border.MultitouchJoystick::JoystickForce() * Border.Width() / 2", - "Border.MultitouchJoystick::JoystickAngle()" - ] - } - ] - }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ - { - "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "ShouldBeHiddenWhenReleased", - "True", - "" - ] - }, { "type": { "inverted": true, - "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::IsPressed" + "value": "SpriteMultitouchJoystick::IsInGameEdition" }, "parameters": [ - "Object", + "", "" ] } ], - "actions": [ - { - "type": { - "value": "Cache" - }, - "parameters": [ - "Object" - ] - }, + "actions": [], + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::ActivateControl" - }, - "parameters": [ - "Object", - "no", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "MettreAutour" + }, + "parameters": [ + "Thumb", + "Border", + "Border.MultitouchJoystick::JoystickForce() * Border.Width() / 2", + "Border.MultitouchJoystick::JoystickAngle()" + ] + } ] }, { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "ShouldBeHiddenWhenReleased", - "False", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "ShouldBeHiddenWhenReleased", + "True", + "" + ] + }, + { + "type": { + "inverted": true, + "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::IsPressed" + }, + "parameters": [ + "Object", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "Cache" + }, + "parameters": [ + "Object" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::ActivateControl" + }, + "parameters": [ + "Object", + "no", + "" + ] + }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "ShouldBeHiddenWhenReleased", + "False", + "" + ] + } ] } ] @@ -9605,8 +9841,7 @@ "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 f31d91c9e..ee7088a69 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": "", + "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.4.0", + "version": "1.9.0", "description": [ - "Multitouch joysticks can be used the same way as physical gamepads:", + "Multitouch joysticks are objects showing a joystick on the screen, useful for mobile. They work like a physical gamepad:", "- 4 or 8 directions", "- Analogus pads", "- Player selection", - "- Controls mapping for top-down movement and platformer characters", + "- Automatic \"mapper\" behaviors for 2D and 3D movement behaviors (platformer characters, top-down movement, 3D character etc...). Add one of these to the object with the movement behavior (i.e: the player most of the time) and the behavior will then be controlled automatically by the virtual joystick (it works by reading the multitouch joystick state and simulating controls). No need for additional events to make it work once the behaviors are set up.", "", "There are ready-to-use joysticks in the asset-store [multitouch joysticks pack](https://editor.gdevelop.io/?initial-dialog=asset-store&asset-pack=multitouch-joysticks-multitouch-joysticks)." ], @@ -7808,153 +7808,33 @@ ], "eventsFunctions": [ { - "description": "Check if a button is pressed on a gamepad.", - "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": "StringVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Buttons[Button].State", - "=", - "\"Pressed\"" - ] - } - ], - "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 gamepad.", - "fullName": "Multitouch controller button released", + "description": "Check if the events are running for the editor.", + "fullName": "Editor is running", "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", + "name": "IsInGameEdition", "private": true, - "sentence": "Mark _PARAM2_ button as _PARAM3_ for multitouch controller _PARAM1_", + "sentence": "Events are running for the editor", "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" + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const game = runtimeScene.getGame();\r", + "eventsFunctionContext.returnValue = game.isInGameEdition && game.isInGameEdition();" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false } ], + "parameters": [], "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", + "fullName": "Accelerated speed", + "functionType": "Expression", + "name": "AcceleratedSpeed", "private": true, - "sentence": "Change the dead zone of multitouch joystick _PARAM2_ of multitouch controller _PARAM1_ to _PARAM3_", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -7965,1237 +7845,3742 @@ "value": "SetNumberVariable" }, "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].DeadZone", + "AcceleratedSpeed", "=", - "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)" + "CurrentSpeed" ] } - ] - } - ], - "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": [ + ], + "events": [ { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "mod(round(Angle * 8 / 360), 8)" + "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", + "" + ] + } ] } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" + }, + { + "description": "", + "name": "Parameter", + "type": "objectList" + } + ], + "objectGroups": [] + }, { - "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": [ + "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": [] + }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "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": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Right\"" + "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" }, { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo4Way" - }, - "parameters": [ - "", - "=", - "0", - "Angle", - "" + "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" + ] + } ] } ], - "actions": [ + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - }, - { - "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::AngleTo4Way" - }, - "parameters": [ - "", - "=", - "1", - "Angle", - "" - ] + "description": "Direction", + "name": "Direction", + "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\"]", + "type": "stringWithSelector" } ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Left\"" - ] - }, + "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": { - "value": "SpriteMultitouchJoystick::AngleTo4Way" - }, - "parameters": [ - "", - "=", - "2", - "Angle", - "" + "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" + ] + } ] } ], - "actions": [ + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - }, - { - "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", - "" - ] + "description": "Direction", + "name": "Direction", + "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\",\"UpLeft\",\"UpRight\",\"DownLeft\",\"DownRight\"]", + "type": "stringWithSelector" } ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Angle", - "name": "Angle", - "type": "expression" + "objectGroups": [] }, { - "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\"" - ] - }, + "description": "Check if a joystick is pressed.", + "fullName": "Joystick pressed", + "functionType": "Condition", + "name": "IsPressed", + "sentence": "Joystick _PARAM0_ is pressed", + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "0", - "Angle", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "!=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } ] } ], - "actions": [ + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } - ] + ], + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"DownRight\"" - ] - }, + "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": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "1", - "Angle", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "0", + "" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "0" + ] + } ] } ], - "actions": [ + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } - ] + ], + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Down\"" - ] - }, + "description": "the multitouch controller identifier.", + "fullName": "Multitouch controller identifier", + "functionType": "ExpressionAndCondition", + "group": "Multitouch Joystick configuration", + "name": "ControllerIdentifier", + "sentence": "the multitouch controller identifier", + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "2", - "Angle", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "ControllerIdentifier" + ] + } ] } ], - "actions": [ + "expressionType": { + "type": "expression" + }, + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } - ] + ], + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "ControllerIdentifier", + "name": "SetControllerIdentifier", + "sentence": "", + "events": [ { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"DownLeft\"" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "ControllerIdentifier", + "=", + "Value" + ] + } ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" }, { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "3", - "Angle", - "" - ] + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } ], - "actions": [ + "objectGroups": [] + }, + { + "description": "the joystick name.", + "fullName": "Joystick name", + "functionType": "ExpressionAndCondition", + "group": "Multitouch Joystick configuration", + "name": "JoystickIdentifier", + "sentence": "the joystick name", + "events": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" + "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": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Left\"" - ] - }, + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "JoystickIdentifier", + "name": "SetJoystickIdentifier", + "sentence": "", + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "4", - "Angle", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "JoystickIdentifier", + "=", + "Value" + ] + } ] } ], - "actions": [ + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } - ] + ], + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"UpLeft\"" - ] - }, + "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": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "5", - "Angle", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "DeadZoneRadius" + ] + } ] } ], - "actions": [ + "expressionType": { + "type": "expression" + }, + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } - ] + ], + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Up\"" - ] - }, + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "DeadZoneRadius", + "name": "SetDeadZoneRadius", + "sentence": "", + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "6", - "Angle", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "DeadZoneRadius", + "=", + "Value" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::SetDeadZone" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JoystickIdentifier", + "Value", + "" + ] + } ] } ], - "actions": [ + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } - ] + ], + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"UpRight\"" - ] - }, + "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": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "7", - "Angle", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "Value" + ] + } ] } ], - "actions": [ + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" + }, + { + "description": "Touch identifier", + "name": "Value", + "type": "expression" } - ] + ], + "objectGroups": [] } ], - "parameters": [ + "propertyDescriptors": [ + { + "value": "1", + "type": "Number", + "label": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier" + }, { - "description": "Angle", - "name": "Angle", - "type": "expression" + "value": "Primary", + "type": "String", + "label": "Joystick name", + "name": "JoystickIdentifier" }, { - "description": "Direction", - "name": "Direction", - "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\",\"UpLeft\",\"UpRight\",\"DownLeft\",\"DownRight\"]", - "type": "stringWithSelector" + "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" } ], - "objectGroups": [] + "sharedPropertyDescriptors": [] }, { - "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" - }, + "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": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "fullName": "", + "functionType": "Action", + "name": "doStepPreEvents", + "sentence": "", + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::JoystickForce" - }, - "parameters": [ - "", - ">", - "0", - "ControllerIdentifier", - "JoystickIdentifier", - "" + "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": { - "value": "SpriteMultitouchJoystick::IsAngleIn4WayDirection" - }, - "parameters": [ - "", - "SpriteMultitouchJoystick::JoystickAngle(ControllerIdentifier, JoystickIdentifier)", - "Direction", - "" + "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" + ] + } ] } ], - "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": [ + "parameters": [ { - "type": { - "value": "SpriteMultitouchJoystick::JoystickForce" - }, - "parameters": [ - "", - ">", - "0", - "ControllerIdentifier", - "JoystickIdentifier", - "" - ] + "description": "Object", + "name": "Object", + "type": "object" }, { - "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" - } - ], - "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": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "type": "behavior" + } + ], + "objectGroups": [] }, { - "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": [ + "description": "Check if the button was just pressed.", + "fullName": "Button just pressed", + "functionType": "Condition", + "name": "IsJustPressed", + "sentence": "Button _PARAM0_ was just pressed", + "events": [ { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].Force", - "=", - "Value" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } ] } - ] - } - ], - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" - }, - { - "description": "Joystick name", - "name": "JoystickIdentifier", - "type": "string" + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "type": "behavior" + } + ], + "objectGroups": [] }, { - "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": [ + "description": "Check if the button is pressed.", + "fullName": "Button pressed", + "functionType": "Condition", + "name": "IsPressed", + "sentence": "Button _PARAM0_ is pressed", + "events": [ { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier)" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "!=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } ] } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "type": "behavior" + } + ], + "objectGroups": [] }, { - "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": "Check if the button is released.", + "fullName": "Button released", + "functionType": "Condition", + "name": "IsReleased", + "sentence": "Button _PARAM0_ is released", + "events": [ { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].Angle" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsReleased", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } ] } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "type": "behavior" + } + ], + "objectGroups": [] }, { - "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": [ + "fullName": "Button state", + "functionType": "Action", + "name": "SetButtonState", + "private": true, + "sentence": "Mark the button _PARAM0_ as _PARAM2_", + "events": [ { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].Angle", - "=", - "Value" + "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": [] } ], - "parameters": [ + "propertyDescriptors": [ { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" + "value": "1", + "type": "Number", + "label": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier" }, { - "description": "Joystick name", - "name": "JoystickIdentifier", - "type": "string" + "value": "A", + "type": "String", + "label": "Button identifier", + "name": "ButtonIdentifier" }, { - "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": [ - "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" + "value": "0", + "type": "Number", + "label": "TouchID", + "hidden": true, + "name": "TouchId" }, { - "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": [ + "value": "", + "type": "Number", + "label": "", + "hidden": true, + "name": "TouchIndex" + }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "SpriteMultitouchJoystick::JoystickForce(ControllerIdentifier, JoystickIdentifier) * sin(ToRad(SpriteMultitouchJoystick::JoystickAngle(ControllerIdentifier, JoystickIdentifier)))" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ + "value": "", + "type": "Boolean", + "label": "Button released", + "hidden": true, + "name": "IsReleased" + }, { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" + "value": "", + "type": "Boolean", + "label": "Button just pressed", + "hidden": true, + "name": "IsJustPressed" }, { - "description": "Joystick name", - "name": "JoystickIdentifier", - "supplementaryInformation": "[\"Primary\",\"Secondary\"]", - "type": "stringWithSelector" + "value": "0", + "type": "Number", + "unit": "Pixel", + "label": "Triggering circle radius", + "description": "This circle adds up to the object collision mask.", + "name": "Radius" } ], - "objectGroups": [] - } - ], - "eventsBasedBehaviors": [ + "sharedPropertyDescriptors": [] + }, { - "description": "Joystick that can be controlled by interacting with a touchscreen.", - "fullName": "Multitouch Joystick", - "name": "MultitouchJoystick", + "description": "Control a platformer character with a multitouch controller.", + "fullName": "Platformer multitouch controller mapper", + "name": "PlatformerMultitouchMapper", "objectType": "", - "private": true, + "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", "functionType": "Action", - "name": "onCreated", + "name": "doStepPreEvents", "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ + "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::SetDeadZone" + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" }, "parameters": [ "", "ControllerIdentifier", "JoystickIdentifier", - "DeadZoneRadius", + "\"Left\"", "" ] - }, + } + ], + "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" + "value": "PlatformBehavior::SimulateLeftKey" }, "parameters": [ "Object", - "Behavior", - "" + "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::IsDirectionPushed4Way" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JoystickIdentifier", + "\"Right\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "PlatformBehavior::SimulateRightKey" + }, + "parameters": [ + "Object", + "Property" + ] + } + ] + }, { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JoystickIdentifier", + "\"Up\"", + "" + ] + } + ], "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" + "value": "PlatformBehavior::SimulateUpKey" + }, + "parameters": [ + "Object", + "Property" + ] + }, + { + "type": { + "value": "PlatformBehavior::SimulateLadderKey" }, "parameters": [ "Object", - "Behavior", - "" + "Property" ] } ] - } - ], - "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": { - "value": "HasGameJustResumed" + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" }, "parameters": [ + "", + "ControllerIdentifier", + "JoystickIdentifier", + "\"Down\"", "" ] } @@ -9203,210 +11588,41 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" + "value": "PlatformBehavior::SimulateDownKey" }, "parameters": [ "Object", - "Behavior", - "" + "Property" ] } ] }, { - "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": "BuiltinCommonInstructions::Standard", + "conditions": [ { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 + "type": { + "value": "SpriteMultitouchJoystick::IsButtonPressed" }, - "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": [ + "", + "ControllerIdentifier", + "JumpButton", + "\"Down\"" ] } ], - "parameters": [] - }, - { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Update joystick position", - "source": "", - "type": "BuiltinCommonInstructions::Group", - "events": [ + "actions": [ { - "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)", - "" - ] - } + "type": { + "value": "PlatformBehavior::SimulateJumpKey" + }, + "parameters": [ + "Object", + "Property" ] } - ], - "parameters": [] + ] } ], "parameters": [ @@ -9418,37 +11634,140 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::PlatformerMultitouchMapper", "type": "behavior" } ], - "objectGroups": [] + "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" }, { - "description": "the joystick force (from 0 to 1).", - "fullName": "Joystick force", - "functionType": "ExpressionAndCondition", - "name": "JoystickForce", - "sentence": "the joystick force", + "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": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::StickForce" + }, + "parameters": [ + "", + ">", + "0", + "ControllerIdentifier", + "JoystickIdentifier", + "" + ] + } + ], "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "Physics3D::PhysicsCharacter3D::SetForwardAngle" }, "parameters": [ - "max(0, JoystickForce - DeadZoneRadius) / (1 - DeadZoneRadius)" + "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\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" + }, + "parameters": [ + "Object", + "PhysicsCharacter3D" ] } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -9458,45 +11777,124 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "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": "ActionWithOperator", - "getterName": "JoystickForce", - "name": "SetJoystickForce", - "private": true, + "functionType": "Action", + "name": "doStepPreEvents", "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::StickForce" + }, + "parameters": [ + "", + ">", + "0", + "ControllerIdentifier", + "JoystickIdentifier", + "" + ] + } + ], "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickForce" + "value": "Physics3D::PhysicsCharacter3D::SimulateStick" }, "parameters": [ "Object", - "Behavior", - "=", - "Value" + "PhysicsCharacter3D", + "SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier)", + "SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier)" ] - }, + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::SetJoystickForce" + "value": "SpriteMultitouchJoystick::IsButtonPressed" }, "parameters": [ "", "ControllerIdentifier", - "JoystickIdentifier", - "JoystickForce", - "" + "JumpButton", + "\"Down\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" + }, + "parameters": [ + "Object", + "PhysicsCharacter3D" ] } ] @@ -9511,37 +11909,151 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::Shooter3DMultitouchMapper", "type": "behavior" } ], "objectGroups": [] + } + ], + "propertyDescriptors": [ + { + "value": "", + "type": "Behavior", + "label": "3D physics character", + "extraInformation": [ + "Physics3D::PhysicsCharacter3D" + ], + "choices": [], + "name": "PhysicsCharacter3D" }, { - "description": "Return the angle the joystick is pointing towards (Range: -180 to 180).", - "fullName": "Joystick angle", - "functionType": "Expression", - "name": "JoystickAngle", + "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": "SetReturnNumber" + "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": [ - "JoystickAngle" + "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", + "" ] } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -9551,19 +12063,20 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], "objectGroups": [] }, { - "description": "Change the angle the joystick is pointing towards (Range: -180 to 180).", - "fullName": "Joystick angle", + "description": "Move the camera to look though _PARAM1_ eyes. The object must look to the right when all its angles are 0 and the top of its head be toward Z+.", + "fullName": "Look through object eyes", "functionType": "Action", - "name": "SetJoystickAngle", + "group": "Layers and cameras", + "name": "LookFromObjectEyes", "private": true, - "sentence": "Change the joystick angle of _PARAM0_ to _PARAM2_", + "sentence": "Move the camera to look though _PARAM0_ eyes", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -9571,24 +12084,61 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickAngle" + "value": "CentreCamera" }, "parameters": [ + "", "Object", - "Behavior", + "", + "Object.Layer()", + "" + ] + }, + { + "type": { + "value": "Scene3D::SetCameraZ" + }, + "parameters": [ + "", "=", - "Value" + "Object.Object3D::Z() + Object.Object3D::Depth() + OffsetZ", + "", + "" ] }, { "type": { - "value": "SpriteMultitouchJoystick::SetJoystickAngle" + "value": "Scene3D::SetCameraRotationX" }, "parameters": [ "", - "ControllerIdentifier", - "JoystickIdentifier", - "JoystickAngle", + "=", + "- 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()", "" ] } @@ -9604,23 +12154,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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": "", + "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", @@ -9631,7 +12177,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "Object.Behavior::JoystickForce() * cos(ToRad(Object.Behavior::JoystickAngle()))" + "HorizontalRotationSpeedMax" ] } ] @@ -9649,17 +12195,17 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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", + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "HorizontalRotationSpeedMax", + "name": "SetHorizontalRotationSpeedMax", "sentence": "", "events": [ { @@ -9668,18 +12214,17 @@ "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "SetNumberVariable" }, "parameters": [ - "Object.Behavior::JoystickForce() * sin(ToRad(Object.Behavior::JoystickAngle()))" + "HorizontalRotationSpeedMax", + "=", + "Value" ] } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -9689,58 +12234,38 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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_", + "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": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::JoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - ">", - "0", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::IsAngleIn4WayDirection" - }, - "parameters": [ - "", - "JoystickAngle", - "Direction", - "" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "SetReturnBoolean" + "value": "SetReturnNumber" }, "parameters": [ - "True" + "HorizontalRotationAcceleration" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -9750,59 +12275,31 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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_", + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "HorizontalRotationAcceleration", + "name": "SetHorizontalRotationAcceleration", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::JoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - ">", - "0", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::IsAngleIn8WayDirection" - }, - "parameters": [ - "", - "JoystickAngle", - "Direction", - "" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "SetReturnBoolean" + "value": "SetNumberVariable" }, "parameters": [ - "True" + "HorizontalRotationAcceleration", + "=", + "Value" ] } ] @@ -9817,52 +12314,38 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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", + "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": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::PropertyTouchId" - }, - "parameters": [ - "Object", - "Behavior", - "!=", - "0" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "SetReturnBoolean" + "value": "SetReturnNumber" }, "parameters": [ - "True" + "HorizontalRotationDeceleration" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -9872,19 +12355,18 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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_", + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "HorizontalRotationDeceleration", + "name": "SetHorizontalRotationDeceleration", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -9892,25 +12374,12 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "0", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyTouchId" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "HorizontalRotationDeceleration", "=", - "0" + "Value" ] } ] @@ -9925,19 +12394,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the multitouch controller identifier.", - "fullName": "Multitouch controller identifier", + "description": "the maximum vertical rotation speed of the object.", + "fullName": "Maximum vertical rotation speed", "functionType": "ExpressionAndCondition", - "group": "Multitouch Joystick configuration", - "name": "ControllerIdentifier", - "sentence": "the multitouch controller identifier", + "group": "First person camera multitouch controller mapper vertical rotation configuration", + "name": "VerticalRotationSpeedMax", + "sentence": "the maximum vertical rotation speed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -9948,7 +12417,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "ControllerIdentifier" + "VerticalRotationSpeedMax" ] } ] @@ -9966,7 +12435,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], @@ -9975,8 +12444,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "ControllerIdentifier", - "name": "SetControllerIdentifier", + "getterName": "VerticalRotationSpeedMax", + "name": "SetVerticalRotationSpeedMax", "sentence": "", "events": [ { @@ -9985,11 +12454,10 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyControllerIdentifier" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "VerticalRotationSpeedMax", "=", "Value" ] @@ -10006,19 +12474,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], "objectGroups": [] }, - { - "description": "the joystick name.", - "fullName": "Joystick name", + { + "description": "the vertical rotation acceleration of the object.", + "fullName": "Vertical rotation acceleration", "functionType": "ExpressionAndCondition", - "group": "Multitouch Joystick configuration", - "name": "JoystickIdentifier", - "sentence": "the joystick name", + "group": "First person camera multitouch controller mapper vertical rotation configuration", + "name": "VerticalRotationAcceleration", + "sentence": "the vertical rotation acceleration", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -10026,17 +12494,17 @@ "actions": [ { "type": { - "value": "SetReturnString" + "value": "SetReturnNumber" }, "parameters": [ - "JoystickIdentifier" + "VerticalRotationAcceleration" ] } ] } ], "expressionType": { - "type": "string" + "type": "expression" }, "parameters": [ { @@ -10047,7 +12515,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], @@ -10056,8 +12524,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "JoystickIdentifier", - "name": "SetJoystickIdentifier", + "getterName": "VerticalRotationAcceleration", + "name": "SetVerticalRotationAcceleration", "sentence": "", "events": [ { @@ -10066,11 +12534,10 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickIdentifier" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "VerticalRotationAcceleration", "=", "Value" ] @@ -10087,19 +12554,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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", + "description": "the vertical rotation deceleration of the object.", + "fullName": "Vertical rotation deceleration", "functionType": "ExpressionAndCondition", - "group": "Multitouch Joystick configuration", - "name": "DeadZoneRadius", - "sentence": "the dead zone radius", + "group": "First person camera multitouch controller mapper vertical rotation configuration", + "name": "VerticalRotationDeceleration", + "sentence": "the vertical rotation deceleration", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -10110,7 +12577,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "DeadZoneRadius" + "VerticalRotationDeceleration" ] } ] @@ -10128,7 +12595,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], @@ -10137,8 +12604,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "DeadZoneRadius", - "name": "SetDeadZoneRadius", + "getterName": "VerticalRotationDeceleration", + "name": "SetVerticalRotationDeceleration", "sentence": "", "events": [ { @@ -10147,11 +12614,10 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyDeadZoneRadius" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "VerticalRotationDeceleration", "=", "Value" ] @@ -10168,271 +12634,72 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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": "Action", - "name": "doStepPreEvents", - "sentence": "", + "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": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::IsReleased" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyIsReleased" - }, - "parameters": [ - "Object", - "Behavior", - "no" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + "value": "SetReturnNumber" }, "parameters": [ - "Object", - "Behavior", - "\"Idle\"", - "" + "VerticalAngleMin" ] } ] - }, + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ { - "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" - ] - } - ] - } - ] - } - ] + "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": { - "value": "SpriteMultitouchJoystick::MultitouchButton::IsPressed" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - }, - { - "type": { - "value": "HasTouchEnded" - }, - "parameters": [ - "", - "TouchId" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" - }, - "parameters": [ - "Object", - "Behavior", - "\"Released\"", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyIsReleased" - }, - "parameters": [ - "Object", - "Behavior", - "yes" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchId" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "VerticalAngleMin", "=", - "0" + "Value" ] } ] @@ -10447,44 +12714,38 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], "objectGroups": [] }, { - "description": "Check if button is released.", - "fullName": "Button released", - "functionType": "Condition", - "name": "IsReleased", - "sentence": "Button _PARAM0_ is released", + "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": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::PropertyIsReleased" - }, - "parameters": [ - "Object", - "Behavior" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "SetReturnBoolean" + "value": "SetReturnNumber" }, "parameters": [ - "True" + "VerticalAngleMax" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -10494,46 +12755,77 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], "objectGroups": [] }, { - "description": "Check if button is pressed.", - "fullName": "Button pressed", - "functionType": "Condition", - "name": "IsPressed", - "sentence": "Button _PARAM0_ is pressed", + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "VerticalAngleMax", + "name": "SetVerticalAngleMax", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "conditions": [], + "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::PropertyTouchId" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", - "!=", - "0" + "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": "SetReturnBoolean" + "value": "SetReturnNumber" }, "parameters": [ - "True" + "OffsetZ" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -10543,18 +12835,18 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], "objectGroups": [] }, { - "fullName": "Button state", - "functionType": "Action", - "name": "SetButtonState", - "private": true, - "sentence": "Mark the button _PARAM0_ as _PARAM2_", + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "OffsetZ", + "name": "SetOffsetZ", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -10562,14 +12854,12 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::SetButtonState" + "value": "SetNumberVariable" }, "parameters": [ - "", - "ControllerIdentifier", - "ButtonIdentifier", - "ButtonState", - "" + "OffsetZ", + "=", + "Value" ] } ] @@ -10584,61 +12874,140 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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": "Multitouch controller identifier (1, 2, 3, 4...)", + "label": "Controller identifier (1, 2, 3, 4...)", "name": "ControllerIdentifier" }, { - "value": "A", - "type": "String", - "label": "Button identifier", - "name": "ButtonIdentifier" + "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", - "label": "TouchID", - "hidden": true, - "name": "TouchId" + "unit": "Pixel", + "label": "Z position offset", + "group": "Position", + "name": "OffsetZ" }, { - "value": "", + "value": "0", "type": "Number", - "label": "", + "unit": "AngularSpeed", + "label": "Current rotation speed Z", "hidden": true, - "name": "TouchIndex" + "name": "CurrentRotationSpeedZ" }, { - "value": "", - "type": "Boolean", - "label": "Button released", + "value": "0", + "type": "Number", + "unit": "AngularSpeed", + "label": "Current rotation speed Y", "hidden": true, - "name": "IsReleased" + "name": "CurrentRotationSpeedY" } ], "sharedPropertyDescriptors": [] }, { - "description": "Control a platformer character with a multitouch controller.", - "fullName": "Platformer multitouch controller mapper", - "name": "PlatformerMultitouchMapper", + "description": "Control a 3D physics car with a multitouch controller.", + "fullName": "3D car multitouch controller mapper", + "name": "PhysicsCar3DMultitouchMapper", "objectType": "", + "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -10651,90 +13020,27 @@ "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" + "value": "SpriteMultitouchJoystick::StickForce" }, "parameters": [ "", + ">", + "0", "ControllerIdentifier", - "JoystickIdentifier", - "\"Up\"", + "SteerJoystickIdentifier", "" ] - } - ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateUpKey" - }, - "parameters": [ - "Object", - "Property" - ] - }, + } + ], + "actions": [ { "type": { - "value": "PlatformBehavior::SimulateLadderKey" + "value": "Physics3D::PhysicsCar3D::SimulateSteeringStick" }, "parameters": [ "Object", - "Property" + "PhysicsCar3D", + "SpriteMultitouchJoystick::StickForceX(ControllerIdentifier, \"Primary\")" ] } ] @@ -10744,13 +13050,14 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" + "value": "SpriteMultitouchJoystick::StickForce" }, "parameters": [ "", + ">", + "0", "ControllerIdentifier", - "JoystickIdentifier", - "\"Down\"", + "SpeedJoystickIdentifier", "" ] } @@ -10758,11 +13065,12 @@ "actions": [ { "type": { - "value": "PlatformBehavior::SimulateDownKey" + "value": "Physics3D::PhysicsCar3D::SimulateAcceleratorStick" }, "parameters": [ "Object", - "Property" + "PhysicsCar3D", + "-SpriteMultitouchJoystick::StickForceY(ControllerIdentifier, \"Secondary\")" ] } ] @@ -10777,7 +13085,7 @@ "parameters": [ "", "ControllerIdentifier", - "JumpButton", + "HandBrakeButton", "\"Down\"" ] } @@ -10785,11 +13093,11 @@ "actions": [ { "type": { - "value": "PlatformBehavior::SimulateJumpKey" + "value": "Physics3D::PhysicsCar3D::SimulateHandBrakeKey" }, "parameters": [ "Object", - "Property" + "PhysicsCar3D" ] } ] @@ -10804,7 +13112,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::PlatformerMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::PhysicsCar3DMultitouchMapper", "type": "behavior" } ], @@ -10815,12 +13123,12 @@ { "value": "", "type": "Behavior", - "label": "Platform character behavior", + "label": "3D physics car", "extraInformation": [ - "PlatformBehavior::PlatformerObjectBehavior" + "Physics3D::PhysicsCar3D" ], "choices": [], - "name": "Property" + "name": "PhysicsCar3D" }, { "value": "1", @@ -10831,7 +13139,7 @@ { "value": "Primary", "type": "Choice", - "label": "Joystick name", + "label": "Steer joystick", "group": "Controls", "choices": [ { @@ -10843,14 +13151,31 @@ "value": "Secondary" } ], - "name": "JoystickIdentifier" + "name": "SteerJoystickIdentifier" }, { - "value": "A", + "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": "Jump button name", + "label": "Hand brake button name", "group": "Controls", - "name": "JumpButton" + "name": "HandBrakeButton" } ], "sharedPropertyDescriptors": [] @@ -10860,6 +13185,7 @@ "fullName": "Top-down multitouch controller mapper", "name": "TopDownMultitouchMapper", "objectType": "", + "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -10872,11 +13198,10 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "StickMode", "=", "\"Analog\"" ] @@ -10901,11 +13226,10 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "StickMode", "=", "\"360°\"" ] @@ -10930,11 +13254,10 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "StickMode", "=", "\"8 Directions\"" ] @@ -11543,7 +13866,6 @@ } ], "instances": [], - "editionSettings": {}, "eventsFunctions": [ { "fullName": "", @@ -11662,17 +13984,90 @@ "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ + "conditions": [ { "type": { - "value": "MettreAutour" + "inverted": true, + "value": "SpriteMultitouchJoystick::IsInGameEdition" }, "parameters": [ - "Thumb", - "Border", - "Border.MultitouchJoystick::JoystickForce() * Border.Width() / 2", - "Border.MultitouchJoystick::JoystickAngle()" + "", + "" + ] + } + ], + "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", + "" + ] + } ] } ] @@ -11740,7 +14135,7 @@ "Border", "MultitouchJoystick", "=", - "Object.PropertyControllerIdentifier()", + "ControllerIdentifier", "" ] }, @@ -11752,7 +14147,7 @@ "Border", "MultitouchJoystick", "=", - "Object.PropertyJoystickIdentifier()", + "JoystickIdentifier", "" ] }, @@ -11764,7 +14159,92 @@ "Border", "MultitouchJoystick", "=", - "Object.PropertyDeadZoneRadius()", + "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)", "" ] } @@ -11781,6 +14261,92 @@ ], "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", @@ -11794,10 +14360,12 @@ { "type": { "inverted": true, - "value": "GetArgumentAsBoolean" + "value": "BooleanVariable" }, "parameters": [ - "\"ShouldActivate\"" + "ShouldActivate", + "True", + "" ] } ], @@ -11819,10 +14387,12 @@ "conditions": [ { "type": { - "value": "GetArgumentAsBoolean" + "value": "BooleanVariable" }, "parameters": [ - "\"ShouldActivate\"" + "ShouldActivate", + "True", + "" ] } ], @@ -12496,9 +15066,15 @@ "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 99cc4900d..b67b3a0dd 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": "", + "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.4.0", + "version": "1.9.0", "description": [ - "Multitouch joysticks can be used the same way as physical gamepads:", + "Multitouch joysticks are objects showing a joystick on the screen, useful for mobile. They work like a physical gamepad:", "- 4 or 8 directions", "- Analogus pads", "- Player selection", - "- Controls mapping for top-down movement and platformer characters", + "- Automatic \"mapper\" behaviors for 2D and 3D movement behaviors (platformer characters, top-down movement, 3D character etc...). Add one of these to the object with the movement behavior (i.e: the player most of the time) and the behavior will then be controlled automatically by the virtual joystick (it works by reading the multitouch joystick state and simulating controls). No need for additional events to make it work once the behaviors are set up.", "", "There are ready-to-use joysticks in the asset-store [multitouch joysticks pack](https://editor.gdevelop.io/?initial-dialog=asset-store&asset-pack=multitouch-joysticks-multitouch-joysticks)." ], @@ -7775,153 +7775,33 @@ ], "eventsFunctions": [ { - "description": "Check if a button is pressed on a gamepad.", - "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": "StringVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Buttons[Button].State", - "=", - "\"Pressed\"" - ] - } - ], - "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 gamepad.", - "fullName": "Multitouch controller button released", + "description": "Check if the events are running for the editor.", + "fullName": "Editor is running", "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", + "name": "IsInGameEdition", "private": true, - "sentence": "Mark _PARAM2_ button as _PARAM3_ for multitouch controller _PARAM1_", + "sentence": "Events are running for the editor", "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" + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const game = runtimeScene.getGame();\r", + "eventsFunctionContext.returnValue = game.isInGameEdition && game.isInGameEdition();" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false } ], + "parameters": [], "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", + "fullName": "Accelerated speed", + "functionType": "Expression", + "name": "AcceleratedSpeed", "private": true, - "sentence": "Change the dead zone of multitouch joystick _PARAM2_ of multitouch controller _PARAM1_ to _PARAM3_", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -7932,1237 +7812,3742 @@ "value": "SetNumberVariable" }, "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].DeadZone", + "AcceleratedSpeed", "=", - "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)" + "CurrentSpeed" ] } - ] - } - ], - "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": [ + ], + "events": [ { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "mod(round(Angle * 8 / 360), 8)" + "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", + "" + ] + } ] } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" + }, + { + "description": "", + "name": "Parameter", + "type": "objectList" + } + ], + "objectGroups": [] + }, { - "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": [ + "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": [] + }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "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": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Right\"" + "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" }, { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo4Way" - }, - "parameters": [ - "", - "=", - "0", - "Angle", - "" + "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" + ] + } ] } ], - "actions": [ + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - }, - { - "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::AngleTo4Way" - }, - "parameters": [ - "", - "=", - "1", - "Angle", - "" - ] + "description": "Direction", + "name": "Direction", + "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\"]", + "type": "stringWithSelector" } ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Left\"" - ] - }, + "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": { - "value": "SpriteMultitouchJoystick::AngleTo4Way" - }, - "parameters": [ - "", - "=", - "2", - "Angle", - "" + "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" + ] + } ] } ], - "actions": [ + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - }, - { - "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", - "" - ] + "description": "Direction", + "name": "Direction", + "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\",\"UpLeft\",\"UpRight\",\"DownLeft\",\"DownRight\"]", + "type": "stringWithSelector" } ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Angle", - "name": "Angle", - "type": "expression" + "objectGroups": [] }, { - "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\"" - ] - }, + "description": "Check if a joystick is pressed.", + "fullName": "Joystick pressed", + "functionType": "Condition", + "name": "IsPressed", + "sentence": "Joystick _PARAM0_ is pressed", + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "0", - "Angle", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "!=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } ] } ], - "actions": [ + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } - ] + ], + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"DownRight\"" - ] - }, + "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": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "1", - "Angle", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "0", + "" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "0" + ] + } ] } ], - "actions": [ + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } - ] + ], + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Down\"" - ] - }, + "description": "the multitouch controller identifier.", + "fullName": "Multitouch controller identifier", + "functionType": "ExpressionAndCondition", + "group": "Multitouch Joystick configuration", + "name": "ControllerIdentifier", + "sentence": "the multitouch controller identifier", + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "2", - "Angle", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "ControllerIdentifier" + ] + } ] } ], - "actions": [ + "expressionType": { + "type": "expression" + }, + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } - ] + ], + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "ControllerIdentifier", + "name": "SetControllerIdentifier", + "sentence": "", + "events": [ { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"DownLeft\"" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "ControllerIdentifier", + "=", + "Value" + ] + } ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" }, { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "3", - "Angle", - "" - ] + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } ], - "actions": [ + "objectGroups": [] + }, + { + "description": "the joystick name.", + "fullName": "Joystick name", + "functionType": "ExpressionAndCondition", + "group": "Multitouch Joystick configuration", + "name": "JoystickIdentifier", + "sentence": "the joystick name", + "events": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" + "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": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Left\"" - ] - }, + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "JoystickIdentifier", + "name": "SetJoystickIdentifier", + "sentence": "", + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "4", - "Angle", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "JoystickIdentifier", + "=", + "Value" + ] + } ] } ], - "actions": [ + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } - ] + ], + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"UpLeft\"" - ] - }, + "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": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "5", - "Angle", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "DeadZoneRadius" + ] + } ] } ], - "actions": [ + "expressionType": { + "type": "expression" + }, + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } - ] + ], + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Up\"" - ] - }, + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "DeadZoneRadius", + "name": "SetDeadZoneRadius", + "sentence": "", + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "6", - "Angle", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "DeadZoneRadius", + "=", + "Value" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::SetDeadZone" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JoystickIdentifier", + "Value", + "" + ] + } ] } ], - "actions": [ + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } - ] + ], + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"UpRight\"" - ] - }, + "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": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "7", - "Angle", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "Value" + ] + } ] } ], - "actions": [ + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" + }, + { + "description": "Touch identifier", + "name": "Value", + "type": "expression" } - ] + ], + "objectGroups": [] } ], - "parameters": [ + "propertyDescriptors": [ + { + "value": "1", + "type": "Number", + "label": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier" + }, { - "description": "Angle", - "name": "Angle", - "type": "expression" + "value": "Primary", + "type": "String", + "label": "Joystick name", + "name": "JoystickIdentifier" }, { - "description": "Direction", - "name": "Direction", - "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\",\"UpLeft\",\"UpRight\",\"DownLeft\",\"DownRight\"]", - "type": "stringWithSelector" + "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" } ], - "objectGroups": [] + "sharedPropertyDescriptors": [] }, { - "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" - }, + "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": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "fullName": "", + "functionType": "Action", + "name": "doStepPreEvents", + "sentence": "", + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::JoystickForce" - }, - "parameters": [ - "", - ">", - "0", - "ControllerIdentifier", - "JoystickIdentifier", - "" + "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": { - "value": "SpriteMultitouchJoystick::IsAngleIn4WayDirection" - }, - "parameters": [ - "", - "SpriteMultitouchJoystick::JoystickAngle(ControllerIdentifier, JoystickIdentifier)", - "Direction", - "" + "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" + ] + } ] } ], - "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": [ + "parameters": [ { - "type": { - "value": "SpriteMultitouchJoystick::JoystickForce" - }, - "parameters": [ - "", - ">", - "0", - "ControllerIdentifier", - "JoystickIdentifier", - "" - ] + "description": "Object", + "name": "Object", + "type": "object" }, { - "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" - } - ], - "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": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "type": "behavior" + } + ], + "objectGroups": [] }, { - "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": [ + "description": "Check if the button was just pressed.", + "fullName": "Button just pressed", + "functionType": "Condition", + "name": "IsJustPressed", + "sentence": "Button _PARAM0_ was just pressed", + "events": [ { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].Force", - "=", - "Value" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } ] } - ] - } - ], - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" - }, - { - "description": "Joystick name", - "name": "JoystickIdentifier", - "type": "string" + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "type": "behavior" + } + ], + "objectGroups": [] }, { - "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": [ + "description": "Check if the button is pressed.", + "fullName": "Button pressed", + "functionType": "Condition", + "name": "IsPressed", + "sentence": "Button _PARAM0_ is pressed", + "events": [ { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier)" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "!=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } ] } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "type": "behavior" + } + ], + "objectGroups": [] }, { - "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": "Check if the button is released.", + "fullName": "Button released", + "functionType": "Condition", + "name": "IsReleased", + "sentence": "Button _PARAM0_ is released", + "events": [ { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].Angle" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsReleased", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } ] } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "type": "behavior" + } + ], + "objectGroups": [] }, { - "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": [ + "fullName": "Button state", + "functionType": "Action", + "name": "SetButtonState", + "private": true, + "sentence": "Mark the button _PARAM0_ as _PARAM2_", + "events": [ { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].Angle", - "=", - "Value" + "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": [] } ], - "parameters": [ + "propertyDescriptors": [ { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" + "value": "1", + "type": "Number", + "label": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier" }, { - "description": "Joystick name", - "name": "JoystickIdentifier", - "type": "string" + "value": "A", + "type": "String", + "label": "Button identifier", + "name": "ButtonIdentifier" }, { - "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": [ - "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" + "value": "0", + "type": "Number", + "label": "TouchID", + "hidden": true, + "name": "TouchId" }, { - "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": [ + "value": "", + "type": "Number", + "label": "", + "hidden": true, + "name": "TouchIndex" + }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "SpriteMultitouchJoystick::JoystickForce(ControllerIdentifier, JoystickIdentifier) * sin(ToRad(SpriteMultitouchJoystick::JoystickAngle(ControllerIdentifier, JoystickIdentifier)))" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ + "value": "", + "type": "Boolean", + "label": "Button released", + "hidden": true, + "name": "IsReleased" + }, { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" + "value": "", + "type": "Boolean", + "label": "Button just pressed", + "hidden": true, + "name": "IsJustPressed" }, { - "description": "Joystick name", - "name": "JoystickIdentifier", - "supplementaryInformation": "[\"Primary\",\"Secondary\"]", - "type": "stringWithSelector" + "value": "0", + "type": "Number", + "unit": "Pixel", + "label": "Triggering circle radius", + "description": "This circle adds up to the object collision mask.", + "name": "Radius" } ], - "objectGroups": [] - } - ], - "eventsBasedBehaviors": [ + "sharedPropertyDescriptors": [] + }, { - "description": "Joystick that can be controlled by interacting with a touchscreen.", - "fullName": "Multitouch Joystick", - "name": "MultitouchJoystick", + "description": "Control a platformer character with a multitouch controller.", + "fullName": "Platformer multitouch controller mapper", + "name": "PlatformerMultitouchMapper", "objectType": "", - "private": true, + "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", "functionType": "Action", - "name": "onCreated", + "name": "doStepPreEvents", "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ + "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::SetDeadZone" + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" }, "parameters": [ "", "ControllerIdentifier", "JoystickIdentifier", - "DeadZoneRadius", + "\"Left\"", "" ] - }, + } + ], + "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" + "value": "PlatformBehavior::SimulateLeftKey" }, "parameters": [ "Object", - "Behavior", - "" + "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::IsDirectionPushed4Way" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JoystickIdentifier", + "\"Right\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "PlatformBehavior::SimulateRightKey" + }, + "parameters": [ + "Object", + "Property" + ] + } + ] + }, { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JoystickIdentifier", + "\"Up\"", + "" + ] + } + ], "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" + "value": "PlatformBehavior::SimulateUpKey" + }, + "parameters": [ + "Object", + "Property" + ] + }, + { + "type": { + "value": "PlatformBehavior::SimulateLadderKey" }, "parameters": [ "Object", - "Behavior", - "" + "Property" ] } ] - } - ], - "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": { - "value": "HasGameJustResumed" + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" }, "parameters": [ + "", + "ControllerIdentifier", + "JoystickIdentifier", + "\"Down\"", "" ] } @@ -9170,210 +11555,41 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" + "value": "PlatformBehavior::SimulateDownKey" }, "parameters": [ "Object", - "Behavior", - "" + "Property" ] } ] }, { - "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": "BuiltinCommonInstructions::Standard", + "conditions": [ { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 + "type": { + "value": "SpriteMultitouchJoystick::IsButtonPressed" }, - "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": [ + "", + "ControllerIdentifier", + "JumpButton", + "\"Down\"" ] } ], - "parameters": [] - }, - { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Update joystick position", - "source": "", - "type": "BuiltinCommonInstructions::Group", - "events": [ + "actions": [ { - "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)", - "" - ] - } + "type": { + "value": "PlatformBehavior::SimulateJumpKey" + }, + "parameters": [ + "Object", + "Property" ] } - ], - "parameters": [] + ] } ], "parameters": [ @@ -9385,37 +11601,140 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::PlatformerMultitouchMapper", "type": "behavior" } ], - "objectGroups": [] + "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" }, { - "description": "the joystick force (from 0 to 1).", - "fullName": "Joystick force", - "functionType": "ExpressionAndCondition", - "name": "JoystickForce", - "sentence": "the joystick force", + "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": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::StickForce" + }, + "parameters": [ + "", + ">", + "0", + "ControllerIdentifier", + "JoystickIdentifier", + "" + ] + } + ], "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "Physics3D::PhysicsCharacter3D::SetForwardAngle" }, "parameters": [ - "max(0, JoystickForce - DeadZoneRadius) / (1 - DeadZoneRadius)" + "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\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" + }, + "parameters": [ + "Object", + "PhysicsCharacter3D" ] } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -9425,45 +11744,124 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "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": "ActionWithOperator", - "getterName": "JoystickForce", - "name": "SetJoystickForce", - "private": true, + "functionType": "Action", + "name": "doStepPreEvents", "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::StickForce" + }, + "parameters": [ + "", + ">", + "0", + "ControllerIdentifier", + "JoystickIdentifier", + "" + ] + } + ], "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickForce" + "value": "Physics3D::PhysicsCharacter3D::SimulateStick" }, "parameters": [ "Object", - "Behavior", - "=", - "Value" + "PhysicsCharacter3D", + "SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier)", + "SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier)" ] - }, + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::SetJoystickForce" + "value": "SpriteMultitouchJoystick::IsButtonPressed" }, "parameters": [ "", "ControllerIdentifier", - "JoystickIdentifier", - "JoystickForce", - "" + "JumpButton", + "\"Down\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" + }, + "parameters": [ + "Object", + "PhysicsCharacter3D" ] } ] @@ -9478,37 +11876,151 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::Shooter3DMultitouchMapper", "type": "behavior" } ], "objectGroups": [] + } + ], + "propertyDescriptors": [ + { + "value": "", + "type": "Behavior", + "label": "3D physics character", + "extraInformation": [ + "Physics3D::PhysicsCharacter3D" + ], + "choices": [], + "name": "PhysicsCharacter3D" }, { - "description": "Return the angle the joystick is pointing towards (Range: -180 to 180).", - "fullName": "Joystick angle", - "functionType": "Expression", - "name": "JoystickAngle", + "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": "SetReturnNumber" + "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": [ - "JoystickAngle" + "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", + "" ] } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -9518,19 +12030,20 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], "objectGroups": [] }, { - "description": "Change the angle the joystick is pointing towards (Range: -180 to 180).", - "fullName": "Joystick angle", + "description": "Move the camera to look though _PARAM1_ eyes. The object must look to the right when all its angles are 0 and the top of its head be toward Z+.", + "fullName": "Look through object eyes", "functionType": "Action", - "name": "SetJoystickAngle", + "group": "Layers and cameras", + "name": "LookFromObjectEyes", "private": true, - "sentence": "Change the joystick angle of _PARAM0_ to _PARAM2_", + "sentence": "Move the camera to look though _PARAM0_ eyes", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -9538,24 +12051,61 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickAngle" + "value": "CentreCamera" }, "parameters": [ + "", "Object", - "Behavior", + "", + "Object.Layer()", + "" + ] + }, + { + "type": { + "value": "Scene3D::SetCameraZ" + }, + "parameters": [ + "", "=", - "Value" + "Object.Object3D::Z() + Object.Object3D::Depth() + OffsetZ", + "", + "" ] }, { "type": { - "value": "SpriteMultitouchJoystick::SetJoystickAngle" + "value": "Scene3D::SetCameraRotationX" }, "parameters": [ "", - "ControllerIdentifier", - "JoystickIdentifier", - "JoystickAngle", + "=", + "- 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()", "" ] } @@ -9571,23 +12121,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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": "", + "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", @@ -9598,7 +12144,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "Object.Behavior::JoystickForce() * cos(ToRad(Object.Behavior::JoystickAngle()))" + "HorizontalRotationSpeedMax" ] } ] @@ -9616,17 +12162,17 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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", + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "HorizontalRotationSpeedMax", + "name": "SetHorizontalRotationSpeedMax", "sentence": "", "events": [ { @@ -9635,18 +12181,17 @@ "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "SetNumberVariable" }, "parameters": [ - "Object.Behavior::JoystickForce() * sin(ToRad(Object.Behavior::JoystickAngle()))" + "HorizontalRotationSpeedMax", + "=", + "Value" ] } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -9656,58 +12201,38 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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_", + "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": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::JoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - ">", - "0", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::IsAngleIn4WayDirection" - }, - "parameters": [ - "", - "JoystickAngle", - "Direction", - "" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "SetReturnBoolean" + "value": "SetReturnNumber" }, "parameters": [ - "True" + "HorizontalRotationAcceleration" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -9717,59 +12242,31 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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_", + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "HorizontalRotationAcceleration", + "name": "SetHorizontalRotationAcceleration", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::JoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - ">", - "0", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::IsAngleIn8WayDirection" - }, - "parameters": [ - "", - "JoystickAngle", - "Direction", - "" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "SetReturnBoolean" + "value": "SetNumberVariable" }, "parameters": [ - "True" + "HorizontalRotationAcceleration", + "=", + "Value" ] } ] @@ -9784,52 +12281,38 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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", + "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": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::PropertyTouchId" - }, - "parameters": [ - "Object", - "Behavior", - "!=", - "0" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "SetReturnBoolean" + "value": "SetReturnNumber" }, "parameters": [ - "True" + "HorizontalRotationDeceleration" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -9839,19 +12322,18 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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_", + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "HorizontalRotationDeceleration", + "name": "SetHorizontalRotationDeceleration", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -9859,25 +12341,12 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "0", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyTouchId" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "HorizontalRotationDeceleration", "=", - "0" + "Value" ] } ] @@ -9892,19 +12361,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the multitouch controller identifier.", - "fullName": "Multitouch controller identifier", + "description": "the maximum vertical rotation speed of the object.", + "fullName": "Maximum vertical rotation speed", "functionType": "ExpressionAndCondition", - "group": "Multitouch Joystick configuration", - "name": "ControllerIdentifier", - "sentence": "the multitouch controller identifier", + "group": "First person camera multitouch controller mapper vertical rotation configuration", + "name": "VerticalRotationSpeedMax", + "sentence": "the maximum vertical rotation speed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -9915,7 +12384,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "ControllerIdentifier" + "VerticalRotationSpeedMax" ] } ] @@ -9933,7 +12402,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], @@ -9942,8 +12411,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "ControllerIdentifier", - "name": "SetControllerIdentifier", + "getterName": "VerticalRotationSpeedMax", + "name": "SetVerticalRotationSpeedMax", "sentence": "", "events": [ { @@ -9952,11 +12421,10 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyControllerIdentifier" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "VerticalRotationSpeedMax", "=", "Value" ] @@ -9973,19 +12441,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], "objectGroups": [] }, - { - "description": "the joystick name.", - "fullName": "Joystick name", + { + "description": "the vertical rotation acceleration of the object.", + "fullName": "Vertical rotation acceleration", "functionType": "ExpressionAndCondition", - "group": "Multitouch Joystick configuration", - "name": "JoystickIdentifier", - "sentence": "the joystick name", + "group": "First person camera multitouch controller mapper vertical rotation configuration", + "name": "VerticalRotationAcceleration", + "sentence": "the vertical rotation acceleration", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -9993,17 +12461,17 @@ "actions": [ { "type": { - "value": "SetReturnString" + "value": "SetReturnNumber" }, "parameters": [ - "JoystickIdentifier" + "VerticalRotationAcceleration" ] } ] } ], "expressionType": { - "type": "string" + "type": "expression" }, "parameters": [ { @@ -10014,7 +12482,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], @@ -10023,8 +12491,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "JoystickIdentifier", - "name": "SetJoystickIdentifier", + "getterName": "VerticalRotationAcceleration", + "name": "SetVerticalRotationAcceleration", "sentence": "", "events": [ { @@ -10033,11 +12501,10 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickIdentifier" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "VerticalRotationAcceleration", "=", "Value" ] @@ -10054,19 +12521,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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", + "description": "the vertical rotation deceleration of the object.", + "fullName": "Vertical rotation deceleration", "functionType": "ExpressionAndCondition", - "group": "Multitouch Joystick configuration", - "name": "DeadZoneRadius", - "sentence": "the dead zone radius", + "group": "First person camera multitouch controller mapper vertical rotation configuration", + "name": "VerticalRotationDeceleration", + "sentence": "the vertical rotation deceleration", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -10077,7 +12544,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "DeadZoneRadius" + "VerticalRotationDeceleration" ] } ] @@ -10095,7 +12562,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], @@ -10104,8 +12571,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "DeadZoneRadius", - "name": "SetDeadZoneRadius", + "getterName": "VerticalRotationDeceleration", + "name": "SetVerticalRotationDeceleration", "sentence": "", "events": [ { @@ -10114,11 +12581,10 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyDeadZoneRadius" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "VerticalRotationDeceleration", "=", "Value" ] @@ -10135,271 +12601,72 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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": "Action", - "name": "doStepPreEvents", - "sentence": "", + "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": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::IsReleased" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyIsReleased" - }, - "parameters": [ - "Object", - "Behavior", - "no" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + "value": "SetReturnNumber" }, "parameters": [ - "Object", - "Behavior", - "\"Idle\"", - "" + "VerticalAngleMin" ] } ] - }, + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ { - "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" - ] - } - ] - } - ] - } - ] + "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": { - "value": "SpriteMultitouchJoystick::MultitouchButton::IsPressed" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - }, - { - "type": { - "value": "HasTouchEnded" - }, - "parameters": [ - "", - "TouchId" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" - }, - "parameters": [ - "Object", - "Behavior", - "\"Released\"", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyIsReleased" - }, - "parameters": [ - "Object", - "Behavior", - "yes" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchId" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "VerticalAngleMin", "=", - "0" + "Value" ] } ] @@ -10414,44 +12681,38 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], "objectGroups": [] }, { - "description": "Check if button is released.", - "fullName": "Button released", - "functionType": "Condition", - "name": "IsReleased", - "sentence": "Button _PARAM0_ is released", + "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": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::PropertyIsReleased" - }, - "parameters": [ - "Object", - "Behavior" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "SetReturnBoolean" + "value": "SetReturnNumber" }, "parameters": [ - "True" + "VerticalAngleMax" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -10461,46 +12722,77 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], "objectGroups": [] }, { - "description": "Check if button is pressed.", - "fullName": "Button pressed", - "functionType": "Condition", - "name": "IsPressed", - "sentence": "Button _PARAM0_ is pressed", + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "VerticalAngleMax", + "name": "SetVerticalAngleMax", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "conditions": [], + "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::PropertyTouchId" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", - "!=", - "0" + "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": "SetReturnBoolean" + "value": "SetReturnNumber" }, "parameters": [ - "True" + "OffsetZ" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -10510,18 +12802,18 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], "objectGroups": [] }, { - "fullName": "Button state", - "functionType": "Action", - "name": "SetButtonState", - "private": true, - "sentence": "Mark the button _PARAM0_ as _PARAM2_", + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "OffsetZ", + "name": "SetOffsetZ", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -10529,14 +12821,12 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::SetButtonState" + "value": "SetNumberVariable" }, "parameters": [ - "", - "ControllerIdentifier", - "ButtonIdentifier", - "ButtonState", - "" + "OffsetZ", + "=", + "Value" ] } ] @@ -10551,61 +12841,140 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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": "Multitouch controller identifier (1, 2, 3, 4...)", + "label": "Controller identifier (1, 2, 3, 4...)", "name": "ControllerIdentifier" }, { - "value": "A", - "type": "String", - "label": "Button identifier", - "name": "ButtonIdentifier" + "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", - "label": "TouchID", - "hidden": true, - "name": "TouchId" + "unit": "Pixel", + "label": "Z position offset", + "group": "Position", + "name": "OffsetZ" }, { - "value": "", + "value": "0", "type": "Number", - "label": "", + "unit": "AngularSpeed", + "label": "Current rotation speed Z", "hidden": true, - "name": "TouchIndex" + "name": "CurrentRotationSpeedZ" }, { - "value": "", - "type": "Boolean", - "label": "Button released", + "value": "0", + "type": "Number", + "unit": "AngularSpeed", + "label": "Current rotation speed Y", "hidden": true, - "name": "IsReleased" + "name": "CurrentRotationSpeedY" } ], "sharedPropertyDescriptors": [] }, { - "description": "Control a platformer character with a multitouch controller.", - "fullName": "Platformer multitouch controller mapper", - "name": "PlatformerMultitouchMapper", + "description": "Control a 3D physics car with a multitouch controller.", + "fullName": "3D car multitouch controller mapper", + "name": "PhysicsCar3DMultitouchMapper", "objectType": "", + "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -10618,90 +12987,27 @@ "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" + "value": "SpriteMultitouchJoystick::StickForce" }, "parameters": [ "", + ">", + "0", "ControllerIdentifier", - "JoystickIdentifier", - "\"Up\"", + "SteerJoystickIdentifier", "" ] - } - ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateUpKey" - }, - "parameters": [ - "Object", - "Property" - ] - }, + } + ], + "actions": [ { "type": { - "value": "PlatformBehavior::SimulateLadderKey" + "value": "Physics3D::PhysicsCar3D::SimulateSteeringStick" }, "parameters": [ "Object", - "Property" + "PhysicsCar3D", + "SpriteMultitouchJoystick::StickForceX(ControllerIdentifier, \"Primary\")" ] } ] @@ -10711,13 +13017,14 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" + "value": "SpriteMultitouchJoystick::StickForce" }, "parameters": [ "", + ">", + "0", "ControllerIdentifier", - "JoystickIdentifier", - "\"Down\"", + "SpeedJoystickIdentifier", "" ] } @@ -10725,11 +13032,12 @@ "actions": [ { "type": { - "value": "PlatformBehavior::SimulateDownKey" + "value": "Physics3D::PhysicsCar3D::SimulateAcceleratorStick" }, "parameters": [ "Object", - "Property" + "PhysicsCar3D", + "-SpriteMultitouchJoystick::StickForceY(ControllerIdentifier, \"Secondary\")" ] } ] @@ -10744,7 +13052,7 @@ "parameters": [ "", "ControllerIdentifier", - "JumpButton", + "HandBrakeButton", "\"Down\"" ] } @@ -10752,11 +13060,11 @@ "actions": [ { "type": { - "value": "PlatformBehavior::SimulateJumpKey" + "value": "Physics3D::PhysicsCar3D::SimulateHandBrakeKey" }, "parameters": [ "Object", - "Property" + "PhysicsCar3D" ] } ] @@ -10771,7 +13079,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::PlatformerMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::PhysicsCar3DMultitouchMapper", "type": "behavior" } ], @@ -10782,12 +13090,12 @@ { "value": "", "type": "Behavior", - "label": "Platform character behavior", + "label": "3D physics car", "extraInformation": [ - "PlatformBehavior::PlatformerObjectBehavior" + "Physics3D::PhysicsCar3D" ], "choices": [], - "name": "Property" + "name": "PhysicsCar3D" }, { "value": "1", @@ -10798,7 +13106,7 @@ { "value": "Primary", "type": "Choice", - "label": "Joystick name", + "label": "Steer joystick", "group": "Controls", "choices": [ { @@ -10810,14 +13118,31 @@ "value": "Secondary" } ], - "name": "JoystickIdentifier" + "name": "SteerJoystickIdentifier" }, { - "value": "A", + "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": "Jump button name", + "label": "Hand brake button name", "group": "Controls", - "name": "JumpButton" + "name": "HandBrakeButton" } ], "sharedPropertyDescriptors": [] @@ -10827,6 +13152,7 @@ "fullName": "Top-down multitouch controller mapper", "name": "TopDownMultitouchMapper", "objectType": "", + "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -10839,11 +13165,10 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "StickMode", "=", "\"Analog\"" ] @@ -10868,11 +13193,10 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "StickMode", "=", "\"360°\"" ] @@ -10897,11 +13221,10 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "StickMode", "=", "\"8 Directions\"" ] @@ -11510,7 +13833,6 @@ } ], "instances": [], - "editionSettings": {}, "eventsFunctions": [ { "fullName": "", @@ -11629,17 +13951,90 @@ "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ + "conditions": [ { "type": { - "value": "MettreAutour" + "inverted": true, + "value": "SpriteMultitouchJoystick::IsInGameEdition" }, "parameters": [ - "Thumb", - "Border", - "Border.MultitouchJoystick::JoystickForce() * Border.Width() / 2", - "Border.MultitouchJoystick::JoystickAngle()" + "", + "" + ] + } + ], + "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", + "" + ] + } ] } ] @@ -11707,7 +14102,7 @@ "Border", "MultitouchJoystick", "=", - "Object.PropertyControllerIdentifier()", + "ControllerIdentifier", "" ] }, @@ -11719,7 +14114,7 @@ "Border", "MultitouchJoystick", "=", - "Object.PropertyJoystickIdentifier()", + "JoystickIdentifier", "" ] }, @@ -11731,7 +14126,92 @@ "Border", "MultitouchJoystick", "=", - "Object.PropertyDeadZoneRadius()", + "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)", "" ] } @@ -11748,6 +14228,92 @@ ], "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", @@ -11761,10 +14327,12 @@ { "type": { "inverted": true, - "value": "GetArgumentAsBoolean" + "value": "BooleanVariable" }, "parameters": [ - "\"ShouldActivate\"" + "ShouldActivate", + "True", + "" ] } ], @@ -11786,10 +14354,12 @@ "conditions": [ { "type": { - "value": "GetArgumentAsBoolean" + "value": "BooleanVariable" }, "parameters": [ - "\"ShouldActivate\"" + "ShouldActivate", + "True", + "" ] } ], @@ -12463,9 +15033,15 @@ "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 e55402317..0137d7a4b 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.8.4", + "version": "1.9.0", "description": [ "Multitouch joysticks are objects showing a joystick on the screen, useful for mobile. They work like a physical gamepad:", "- 4 or 8 directions", @@ -1828,11 +1828,11 @@ "objectGroups": [] }, { - "description": "Check if a button is pressed on a gamepad.", - "fullName": "Multitouch controller button pressed", + "description": "Check if a button was just pressed on a multitouch controller.", + "fullName": "Multitouch controller button just pressed", "functionType": "Condition", - "name": "IsButtonPressed", - "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", + "name": "IsButtonJustPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ was just pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -1844,7 +1844,7 @@ "parameters": [ "Controllers[ControllerIdentifier].Buttons[Button].State", "=", - "\"Pressed\"" + "\"JustPressed\"" ] } ], @@ -1876,7 +1876,73 @@ "objectGroups": [] }, { - "description": "Check if a button is released on a gamepad.", + "description": "Check if a button is pressed on a multitouch controller.", + "fullName": "Multitouch controller button pressed", + "functionType": "Condition", + "name": "IsButtonPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::Or" + }, + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"Pressed\"" + ] + }, + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"JustPressed\"" + ] + } + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier", + "type": "expression" + }, + { + "description": "Button name", + "name": "Button", + "supplementaryInformation": "[\"A\",\"CROSS\",\"B\",\"CIRCLE\",\"X\",\"SQUARE\",\"Y\",\"TRIANGLE\",\"LB\",\"L1\",\"RB\",\"R1\",\"LT\",\"L2\",\"RT\",\"R2\",\"UP\",\"DOWN\",\"LEFT\",\"RIGHT\",\"BACK\",\"SHARE\",\"START\",\"OPTIONS\",\"CLICK_STICK_LEFT\",\"CLICK_STICK_RIGHT\",\"PS_BUTTON\",\"CLICK_TOUCHPAD\"]", + "type": "string" + } + ], + "objectGroups": [] + }, + { + "description": "Check if a button is released on a multitouch controller.", "fullName": "Multitouch controller button released", "functionType": "Condition", "name": "IsButtonReleased", @@ -1962,7 +2028,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"JustPressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -4452,11 +4518,11 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::IsReleased" + "value": "BooleanVariable" }, "parameters": [ - "Object", - "Behavior", + "IsReleased", + "True", "" ] } @@ -4485,6 +4551,44 @@ } ] }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "False", + "" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + }, + "parameters": [ + "Object", + "Behavior", + "\"Pressed\"", + "" + ] + } + ] + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ @@ -4577,7 +4681,17 @@ "parameters": [ "Object", "Behavior", - "\"Pressed\"", + "\"JustPressed\"", + "" + ] + }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "True", "" ] } @@ -4648,6 +4762,16 @@ "" ] }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "False", + "" + ] + }, { "type": { "value": "SetNumberVariable" @@ -4677,11 +4801,11 @@ "objectGroups": [] }, { - "description": "Check if button is released.", - "fullName": "Button released", + "description": "Check if the button was just pressed.", + "fullName": "Button just pressed", "functionType": "Condition", - "name": "IsReleased", - "sentence": "Button _PARAM0_ is released", + "name": "IsJustPressed", + "sentence": "Button _PARAM0_ was just pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -4691,7 +4815,7 @@ "value": "BooleanVariable" }, "parameters": [ - "IsReleased", + "IsJustPressed", "True", "" ] @@ -4725,7 +4849,7 @@ "objectGroups": [] }, { - "description": "Check if button is pressed.", + "description": "Check if the button is pressed.", "fullName": "Button pressed", "functionType": "Condition", "name": "IsPressed", @@ -4772,6 +4896,54 @@ ], "objectGroups": [] }, + { + "description": "Check if the button is released.", + "fullName": "Button released", + "functionType": "Condition", + "name": "IsReleased", + "sentence": "Button _PARAM0_ is released", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsReleased", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "type": "behavior" + } + ], + "objectGroups": [] + }, { "fullName": "Button state", "functionType": "Action", @@ -4813,7 +4985,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"JustPressed\",\"Pressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -4854,6 +5026,13 @@ "hidden": true, "name": "IsReleased" }, + { + "value": "", + "type": "Boolean", + "label": "Button just pressed", + "hidden": true, + "name": "IsJustPressed" + }, { "value": "0", "type": "Number", @@ -7268,7 +7447,6 @@ } ], "instances": [], - "editionSettings": {}, "eventsFunctions": [ { "fullName": "", @@ -8477,8 +8655,7 @@ "hidden": true, "name": "ShouldBeHiddenWhenReleased" } - ], - "variants": [] + ] } ] }, diff --git a/examples/starting-shootemup/starting-shootemup.json b/examples/starting-shootemup/starting-shootemup.json index d098f31c0..1b0feac82 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.8.4", + "version": "1.9.0", "description": [ "Multitouch joysticks are objects showing a joystick on the screen, useful for mobile. They work like a physical gamepad:", "- 4 or 8 directions", @@ -1679,11 +1679,11 @@ "objectGroups": [] }, { - "description": "Check if a button is pressed on a gamepad.", - "fullName": "Multitouch controller button pressed", + "description": "Check if a button was just pressed on a multitouch controller.", + "fullName": "Multitouch controller button just pressed", "functionType": "Condition", - "name": "IsButtonPressed", - "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", + "name": "IsButtonJustPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ was just pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -1695,7 +1695,73 @@ "parameters": [ "Controllers[ControllerIdentifier].Buttons[Button].State", "=", - "\"Pressed\"" + "\"JustPressed\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier", + "type": "expression" + }, + { + "description": "Button name", + "name": "Button", + "supplementaryInformation": "[\"A\",\"CROSS\",\"B\",\"CIRCLE\",\"X\",\"SQUARE\",\"Y\",\"TRIANGLE\",\"LB\",\"L1\",\"RB\",\"R1\",\"LT\",\"L2\",\"RT\",\"R2\",\"UP\",\"DOWN\",\"LEFT\",\"RIGHT\",\"BACK\",\"SHARE\",\"START\",\"OPTIONS\",\"CLICK_STICK_LEFT\",\"CLICK_STICK_RIGHT\",\"PS_BUTTON\",\"CLICK_TOUCHPAD\"]", + "type": "string" + } + ], + "objectGroups": [] + }, + { + "description": "Check if a button is pressed on a multitouch controller.", + "fullName": "Multitouch controller button pressed", + "functionType": "Condition", + "name": "IsButtonPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::Or" + }, + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"Pressed\"" + ] + }, + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"JustPressed\"" + ] + } ] } ], @@ -1727,7 +1793,7 @@ "objectGroups": [] }, { - "description": "Check if a button is released on a gamepad.", + "description": "Check if a button is released on a multitouch controller.", "fullName": "Multitouch controller button released", "functionType": "Condition", "name": "IsButtonReleased", @@ -1813,7 +1879,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"JustPressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -4303,11 +4369,11 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::IsReleased" + "value": "BooleanVariable" }, "parameters": [ - "Object", - "Behavior", + "IsReleased", + "True", "" ] } @@ -4336,6 +4402,44 @@ } ] }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "False", + "" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + }, + "parameters": [ + "Object", + "Behavior", + "\"Pressed\"", + "" + ] + } + ] + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ @@ -4428,7 +4532,17 @@ "parameters": [ "Object", "Behavior", - "\"Pressed\"", + "\"JustPressed\"", + "" + ] + }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "True", "" ] } @@ -4499,6 +4613,16 @@ "" ] }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "False", + "" + ] + }, { "type": { "value": "SetNumberVariable" @@ -4528,11 +4652,11 @@ "objectGroups": [] }, { - "description": "Check if button is released.", - "fullName": "Button released", + "description": "Check if the button was just pressed.", + "fullName": "Button just pressed", "functionType": "Condition", - "name": "IsReleased", - "sentence": "Button _PARAM0_ is released", + "name": "IsJustPressed", + "sentence": "Button _PARAM0_ was just pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -4542,7 +4666,7 @@ "value": "BooleanVariable" }, "parameters": [ - "IsReleased", + "IsJustPressed", "True", "" ] @@ -4576,7 +4700,7 @@ "objectGroups": [] }, { - "description": "Check if button is pressed.", + "description": "Check if the button is pressed.", "fullName": "Button pressed", "functionType": "Condition", "name": "IsPressed", @@ -4623,6 +4747,54 @@ ], "objectGroups": [] }, + { + "description": "Check if the button is released.", + "fullName": "Button released", + "functionType": "Condition", + "name": "IsReleased", + "sentence": "Button _PARAM0_ is released", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsReleased", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "type": "behavior" + } + ], + "objectGroups": [] + }, { "fullName": "Button state", "functionType": "Action", @@ -4664,7 +4836,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"JustPressed\",\"Pressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -4705,6 +4877,13 @@ "hidden": true, "name": "IsReleased" }, + { + "value": "", + "type": "Boolean", + "label": "Button just pressed", + "hidden": true, + "name": "IsJustPressed" + }, { "value": "0", "type": "Number", @@ -7119,7 +7298,6 @@ } ], "instances": [], - "editionSettings": {}, "eventsFunctions": [ { "fullName": "", @@ -8328,8 +8506,7 @@ "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 bb493c3ef..f23300973 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": "", + "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.4.0", + "version": "1.9.0", "description": [ - "Multitouch joysticks can be used the same way as physical gamepads:", + "Multitouch joysticks are objects showing a joystick on the screen, useful for mobile. They work like a physical gamepad:", "- 4 or 8 directions", "- Analogus pads", "- Player selection", - "- Controls mapping for top-down movement and platformer characters", + "- Automatic \"mapper\" behaviors for 2D and 3D movement behaviors (platformer characters, top-down movement, 3D character etc...). Add one of these to the object with the movement behavior (i.e: the player most of the time) and the behavior will then be controlled automatically by the virtual joystick (it works by reading the multitouch joystick state and simulating controls). No need for additional events to make it work once the behaviors are set up.", "", "There are ready-to-use joysticks in the asset-store [multitouch joysticks pack](https://editor.gdevelop.io/?initial-dialog=asset-store&asset-pack=multitouch-joysticks-multitouch-joysticks)." ], @@ -4864,153 +4864,33 @@ ], "eventsFunctions": [ { - "description": "Check if a button is pressed on a gamepad.", - "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": "StringVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Buttons[Button].State", - "=", - "\"Pressed\"" - ] - } - ], - "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 gamepad.", - "fullName": "Multitouch controller button released", + "description": "Check if the events are running for the editor.", + "fullName": "Editor is running", "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", + "name": "IsInGameEdition", "private": true, - "sentence": "Mark _PARAM2_ button as _PARAM3_ for multitouch controller _PARAM1_", + "sentence": "Events are running for the editor", "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" + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const game = runtimeScene.getGame();\r", + "eventsFunctionContext.returnValue = game.isInGameEdition && game.isInGameEdition();" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false } ], + "parameters": [], "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", + "fullName": "Accelerated speed", + "functionType": "Expression", + "name": "AcceleratedSpeed", "private": true, - "sentence": "Change the dead zone of multitouch joystick _PARAM2_ of multitouch controller _PARAM1_ to _PARAM3_", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -5021,1203 +4901,3781 @@ "value": "SetNumberVariable" }, "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].DeadZone", + "AcceleratedSpeed", "=", - "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)" + "CurrentSpeed" ] } - ] - } - ], - "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": [ + ], + "events": [ { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ + "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": [ + ] + } + ], + "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": "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": [ + "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": [] + }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "description": "Return the angle the joystick is pointing towards (Range: -180 to 180).", + "fullName": "Joystick angle", + "functionType": "Expression", + "name": "JoystickAngle", + "sentence": "", + "events": [ { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Right\"" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "JoystickAngle" + ] + } ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" }, { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo4Way" - }, - "parameters": [ - "", - "=", - "0", - "Angle", - "" + "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", + "" + ] + } ] } ], - "actions": [ + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" + "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": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "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": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Down\"" + "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" }, { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo4Way" - }, - "parameters": [ - "", - "=", - "1", - "Angle", - "" + "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" + ] + } ] } ], - "actions": [ + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" + }, { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "description": "Direction", + "name": "Direction", + "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\"]", + "type": "stringWithSelector" } - ] + ], + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Left\"" - ] - }, + "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": { - "value": "SpriteMultitouchJoystick::AngleTo4Way" - }, - "parameters": [ - "", - "=", - "2", - "Angle", - "" + "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" + ] + } ] } ], - "actions": [ + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - }, - { - "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", - "" - ] + "description": "Direction", + "name": "Direction", + "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\",\"UpLeft\",\"UpRight\",\"DownLeft\",\"DownRight\"]", + "type": "stringWithSelector" } ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Angle", - "name": "Angle", - "type": "expression" + "objectGroups": [] }, { - "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": [ + "description": "Check if a joystick is pressed.", + "fullName": "Joystick pressed", + "functionType": "Condition", + "name": "IsPressed", + "sentence": "Joystick _PARAM0_ is pressed", + "events": [ { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Right\"" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "!=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" }, { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "0", - "Angle", - "" - ] + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } ], - "actions": [ + "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": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "0", + "" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "0" + ] + } ] } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + ], + "parameters": [ { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"DownRight\"" - ] + "description": "Object", + "name": "Object", + "type": "object" }, { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "1", - "Angle", - "" - ] + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Down\"" - ] - }, + "description": "the multitouch controller identifier.", + "fullName": "Multitouch controller identifier", + "functionType": "ExpressionAndCondition", + "group": "Multitouch Joystick configuration", + "name": "ControllerIdentifier", + "sentence": "the multitouch controller identifier", + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "2", - "Angle", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "ControllerIdentifier" + ] + } ] } ], - "actions": [ + "expressionType": { + "type": "expression" + }, + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } - ] + ], + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"DownLeft\"" - ] - }, + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "ControllerIdentifier", + "name": "SetControllerIdentifier", + "sentence": "", + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "3", - "Angle", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "ControllerIdentifier", + "=", + "Value" + ] + } ] } ], - "actions": [ + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } - ] + ], + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Left\"" - ] - }, + "description": "the joystick name.", + "fullName": "Joystick name", + "functionType": "ExpressionAndCondition", + "group": "Multitouch Joystick configuration", + "name": "JoystickIdentifier", + "sentence": "the joystick name", + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "4", - "Angle", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnString" + }, + "parameters": [ + "JoystickIdentifier" + ] + } ] } ], - "actions": [ + "expressionType": { + "type": "string" + }, + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } - ] + ], + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"UpLeft\"" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "5", - "Angle", - "" + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "JoystickIdentifier", + "name": "SetJoystickIdentifier", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "JoystickIdentifier", + "=", + "Value" + ] + } ] } ], - "actions": [ + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } - ] + ], + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Up\"" - ] - }, + "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": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "6", - "Angle", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "DeadZoneRadius" + ] + } ] } ], - "actions": [ + "expressionType": { + "type": "expression" + }, + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } - ] + ], + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"UpRight\"" - ] - }, + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "DeadZoneRadius", + "name": "SetDeadZoneRadius", + "sentence": "", + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "7", - "Angle", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "DeadZoneRadius", + "=", + "Value" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::SetDeadZone" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JoystickIdentifier", + "Value", + "" + ] + } ] } ], - "actions": [ + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } - ] - } - ], - "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" + ], + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::JoystickForce" - }, - "parameters": [ - "", - ">", - "0", - "ControllerIdentifier", - "JoystickIdentifier", - "" - ] - }, + "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": { - "value": "SpriteMultitouchJoystick::IsAngleIn4WayDirection" - }, - "parameters": [ - "", - "SpriteMultitouchJoystick::JoystickAngle(ControllerIdentifier, JoystickIdentifier)", - "Direction", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "Value" + ] + } ] } ], - "actions": [ + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" + }, + { + "description": "Touch identifier", + "name": "Value", + "type": "expression" } - ] + ], + "objectGroups": [] } ], - "parameters": [ + "propertyDescriptors": [ { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" + "value": "1", + "type": "Number", + "label": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier" }, { - "description": "Joystick name", - "name": "JoystickIdentifier", - "supplementaryInformation": "[\"Primary\",\"Secondary\"]", - "type": "stringWithSelector" + "value": "Primary", + "type": "String", + "label": "Joystick name", + "name": "JoystickIdentifier" }, { - "description": "Direction", - "name": "Direction", - "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\"]", - "type": "stringWithSelector" + "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" } ], - "objectGroups": [] + "sharedPropertyDescriptors": [] }, { - "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" - }, + "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": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "fullName": "", + "functionType": "Action", + "name": "doStepPreEvents", + "sentence": "", + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::JoystickForce" - }, - "parameters": [ - "", - ">", - "0", - "ControllerIdentifier", - "JoystickIdentifier", - "" + "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": { - "value": "SpriteMultitouchJoystick::IsAngleIn8WayDirection" - }, - "parameters": [ - "", - "SpriteMultitouchJoystick::JoystickAngle(ControllerIdentifier, JoystickIdentifier)", - "Direction", - "" + "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" + ] + } ] } ], - "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": [ + "parameters": [ { - "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": [ + "description": "Object", + "name": "Object", + "type": "object" + }, { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "max(0, Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].Force - SpriteMultitouchJoystick::DeadZone(ControllerIdentifier, JoystickIdentifier)) / (1 - SpriteMultitouchJoystick::DeadZone(ControllerIdentifier, JoystickIdentifier))" - ] + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "type": "behavior" } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" + ], + "objectGroups": [] }, { - "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": [ + "description": "Check if the button was just pressed.", + "fullName": "Button just pressed", + "functionType": "Condition", + "name": "IsJustPressed", + "sentence": "Button _PARAM0_ was just pressed", + "events": [ { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].Force", - "=", - "Value" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } ] } - ] - } - ], - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" - }, - { - "description": "Joystick name", - "name": "JoystickIdentifier", - "type": "string" + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "type": "behavior" + } + ], + "objectGroups": [] }, { - "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": [ + "description": "Check if the button is pressed.", + "fullName": "Button pressed", + "functionType": "Condition", + "name": "IsPressed", + "sentence": "Button _PARAM0_ is pressed", + "events": [ { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier)" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "!=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } ] } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "type": "behavior" + } + ], + "objectGroups": [] }, { - "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": "Check if the button is released.", + "fullName": "Button released", + "functionType": "Condition", + "name": "IsReleased", + "sentence": "Button _PARAM0_ is released", + "events": [ { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].Angle" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsReleased", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } ] } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "type": "behavior" + } + ], + "objectGroups": [] }, { - "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": [ + "fullName": "Button state", + "functionType": "Action", + "name": "SetButtonState", + "private": true, + "sentence": "Mark the button _PARAM0_ as _PARAM2_", + "events": [ { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].Angle", - "=", - "Value" + "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": [] } ], - "parameters": [ + "propertyDescriptors": [ { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" + "value": "1", + "type": "Number", + "label": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier" }, { - "description": "Joystick name", - "name": "JoystickIdentifier", - "type": "string" + "value": "A", + "type": "String", + "label": "Button identifier", + "name": "ButtonIdentifier" }, { - "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": [ - "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" + "value": "0", + "type": "Number", + "label": "TouchID", + "hidden": true, + "name": "TouchId" }, { - "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": [ + "value": "", + "type": "Number", + "label": "", + "hidden": true, + "name": "TouchIndex" + }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "SpriteMultitouchJoystick::JoystickForce(ControllerIdentifier, JoystickIdentifier) * sin(ToRad(SpriteMultitouchJoystick::JoystickAngle(ControllerIdentifier, JoystickIdentifier)))" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ + "value": "", + "type": "Boolean", + "label": "Button released", + "hidden": true, + "name": "IsReleased" + }, { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" + "value": "", + "type": "Boolean", + "label": "Button just pressed", + "hidden": true, + "name": "IsJustPressed" }, { - "description": "Joystick name", - "name": "JoystickIdentifier", - "supplementaryInformation": "[\"Primary\",\"Secondary\"]", - "type": "stringWithSelector" + "value": "0", + "type": "Number", + "unit": "Pixel", + "label": "Triggering circle radius", + "description": "This circle adds up to the object collision mask.", + "name": "Radius" } ], - "objectGroups": [] - } - ], - "eventsBasedBehaviors": [ + "sharedPropertyDescriptors": [] + }, { - "description": "Joystick that can be controlled by interacting with a touchscreen.", - "fullName": "Multitouch Joystick", - "name": "MultitouchJoystick", + "description": "Control a platformer character with a multitouch controller.", + "fullName": "Platformer multitouch controller mapper", + "name": "PlatformerMultitouchMapper", "objectType": "", - "private": true, + "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", "functionType": "Action", - "name": "onCreated", + "name": "doStepPreEvents", "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ + "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::SetDeadZone" + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" }, "parameters": [ "", "ControllerIdentifier", "JoystickIdentifier", - "DeadZoneRadius", + "\"Left\"", "" ] - }, + } + ], + "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" + "value": "PlatformBehavior::SimulateLeftKey" }, "parameters": [ "Object", - "Behavior", + "Property" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JoystickIdentifier", + "\"Right\"", "" ] } + ], + "actions": [ + { + "type": { + "value": "PlatformBehavior::SimulateRightKey" + }, + "parameters": [ + "Object", + "Property" + ] + } ] - } - ], - "parameters": [ + }, { - "description": "Object", - "name": "Object", - "type": "object" + "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" + ] + } + ] }, { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "Action", - "name": "onDeActivate", - "sentence": "", - "events": [ + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JoystickIdentifier", + "\"Down\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "PlatformBehavior::SimulateDownKey" + }, + "parameters": [ + "Object", + "Property" + ] + } + ] + }, { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::IsButtonPressed" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JumpButton", + "\"Down\"" + ] + } + ], "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" + "value": "PlatformBehavior::SimulateJumpKey" }, "parameters": [ "Object", - "Behavior", - "" + "Property" ] } ] @@ -6232,12 +8690,64 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::PlatformerMultitouchMapper", "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", @@ -6249,262 +8759,71 @@ "conditions": [ { "type": { - "value": "HasGameJustResumed" + "value": "SpriteMultitouchJoystick::StickForce" }, "parameters": [ + "", + ">", + "0", + "ControllerIdentifier", + "JoystickIdentifier", "" ] } ], "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": "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 - }, - "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)", - "" - ] - } + { + "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)" ] } - ], - "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": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::IsButtonPressed" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JumpButton", + "\"Down\"" + ] + } + ], "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" }, "parameters": [ - "max(0, JoystickForce - DeadZoneRadius) / (1 - DeadZoneRadius)" + "Object", + "PhysicsCharacter3D" ] } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -6514,45 +8833,124 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "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": "ActionWithOperator", - "getterName": "JoystickForce", - "name": "SetJoystickForce", - "private": true, + "functionType": "Action", + "name": "doStepPreEvents", "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::StickForce" + }, + "parameters": [ + "", + ">", + "0", + "ControllerIdentifier", + "JoystickIdentifier", + "" + ] + } + ], "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickForce" + "value": "Physics3D::PhysicsCharacter3D::SimulateStick" }, "parameters": [ "Object", - "Behavior", - "=", - "Value" + "PhysicsCharacter3D", + "SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier)", + "SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier)" ] - }, + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::SetJoystickForce" + "value": "SpriteMultitouchJoystick::IsButtonPressed" }, "parameters": [ "", "ControllerIdentifier", - "JoystickIdentifier", - "JoystickForce", - "" + "JumpButton", + "\"Down\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" + }, + "parameters": [ + "Object", + "PhysicsCharacter3D" ] } ] @@ -6567,37 +8965,151 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::Shooter3DMultitouchMapper", "type": "behavior" } ], "objectGroups": [] + } + ], + "propertyDescriptors": [ + { + "value": "", + "type": "Behavior", + "label": "3D physics character", + "extraInformation": [ + "Physics3D::PhysicsCharacter3D" + ], + "choices": [], + "name": "PhysicsCharacter3D" }, { - "description": "Return the angle the joystick is pointing towards (Range: -180 to 180).", - "fullName": "Joystick angle", - "functionType": "Expression", - "name": "JoystickAngle", + "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": "SetReturnNumber" + "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": [ - "JoystickAngle" + "Object", + "Behavior", + "" ] } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -6607,19 +9119,20 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], "objectGroups": [] }, { - "description": "Change the angle the joystick is pointing towards (Range: -180 to 180).", - "fullName": "Joystick angle", + "description": "Move the camera to look though _PARAM1_ eyes. The object must look to the right when all its angles are 0 and the top of its head be toward Z+.", + "fullName": "Look through object eyes", "functionType": "Action", - "name": "SetJoystickAngle", + "group": "Layers and cameras", + "name": "LookFromObjectEyes", "private": true, - "sentence": "Change the joystick angle of _PARAM0_ to _PARAM2_", + "sentence": "Move the camera to look though _PARAM0_ eyes", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -6627,24 +9140,61 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickAngle" + "value": "CentreCamera" }, "parameters": [ + "", "Object", - "Behavior", + "", + "Object.Layer()", + "" + ] + }, + { + "type": { + "value": "Scene3D::SetCameraZ" + }, + "parameters": [ + "", "=", - "Value" + "Object.Object3D::Z() + Object.Object3D::Depth() + OffsetZ", + "", + "" ] }, { "type": { - "value": "SpriteMultitouchJoystick::SetJoystickAngle" + "value": "Scene3D::SetCameraRotationX" }, "parameters": [ "", - "ControllerIdentifier", - "JoystickIdentifier", - "JoystickAngle", + "=", + "- 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()", "" ] } @@ -6660,23 +9210,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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": "", + "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", @@ -6687,7 +9233,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "Object.Behavior::JoystickForce() * cos(ToRad(Object.Behavior::JoystickAngle()))" + "HorizontalRotationSpeedMax" ] } ] @@ -6705,17 +9251,17 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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", + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "HorizontalRotationSpeedMax", + "name": "SetHorizontalRotationSpeedMax", "sentence": "", "events": [ { @@ -6724,18 +9270,17 @@ "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "SetNumberVariable" }, "parameters": [ - "Object.Behavior::JoystickForce() * sin(ToRad(Object.Behavior::JoystickAngle()))" + "HorizontalRotationSpeedMax", + "=", + "Value" ] } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -6745,58 +9290,38 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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_", + "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": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::JoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - ">", - "0", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::IsAngleIn4WayDirection" - }, - "parameters": [ - "", - "JoystickAngle", - "Direction", - "" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "SetReturnBoolean" + "value": "SetReturnNumber" }, "parameters": [ - "True" + "HorizontalRotationAcceleration" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -6806,59 +9331,31 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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_", + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "HorizontalRotationAcceleration", + "name": "SetHorizontalRotationAcceleration", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::JoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - ">", - "0", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::IsAngleIn8WayDirection" - }, - "parameters": [ - "", - "JoystickAngle", - "Direction", - "" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "SetReturnBoolean" + "value": "SetNumberVariable" }, "parameters": [ - "True" + "HorizontalRotationAcceleration", + "=", + "Value" ] } ] @@ -6873,52 +9370,38 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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", + "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": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::PropertyTouchId" - }, - "parameters": [ - "Object", - "Behavior", - "!=", - "0" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "SetReturnBoolean" + "value": "SetReturnNumber" }, "parameters": [ - "True" + "HorizontalRotationDeceleration" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -6928,19 +9411,18 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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_", + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "HorizontalRotationDeceleration", + "name": "SetHorizontalRotationDeceleration", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -6948,25 +9430,12 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "0", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyTouchId" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "HorizontalRotationDeceleration", "=", - "0" + "Value" ] } ] @@ -6981,19 +9450,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the multitouch controller identifier.", - "fullName": "Multitouch controller identifier", + "description": "the maximum vertical rotation speed of the object.", + "fullName": "Maximum vertical rotation speed", "functionType": "ExpressionAndCondition", - "group": "Multitouch Joystick configuration", - "name": "ControllerIdentifier", - "sentence": "the multitouch controller identifier", + "group": "First person camera multitouch controller mapper vertical rotation configuration", + "name": "VerticalRotationSpeedMax", + "sentence": "the maximum vertical rotation speed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -7004,7 +9473,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "ControllerIdentifier" + "VerticalRotationSpeedMax" ] } ] @@ -7022,7 +9491,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], @@ -7031,8 +9500,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "ControllerIdentifier", - "name": "SetControllerIdentifier", + "getterName": "VerticalRotationSpeedMax", + "name": "SetVerticalRotationSpeedMax", "sentence": "", "events": [ { @@ -7041,11 +9510,10 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyControllerIdentifier" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "VerticalRotationSpeedMax", "=", "Value" ] @@ -7062,19 +9530,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the joystick name.", - "fullName": "Joystick name", + "description": "the vertical rotation acceleration of the object.", + "fullName": "Vertical rotation acceleration", "functionType": "ExpressionAndCondition", - "group": "Multitouch Joystick configuration", - "name": "JoystickIdentifier", - "sentence": "the joystick name", + "group": "First person camera multitouch controller mapper vertical rotation configuration", + "name": "VerticalRotationAcceleration", + "sentence": "the vertical rotation acceleration", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -7082,17 +9550,17 @@ "actions": [ { "type": { - "value": "SetReturnString" + "value": "SetReturnNumber" }, "parameters": [ - "JoystickIdentifier" + "VerticalRotationAcceleration" ] } ] } ], "expressionType": { - "type": "string" + "type": "expression" }, "parameters": [ { @@ -7103,7 +9571,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], @@ -7112,8 +9580,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "JoystickIdentifier", - "name": "SetJoystickIdentifier", + "getterName": "VerticalRotationAcceleration", + "name": "SetVerticalRotationAcceleration", "sentence": "", "events": [ { @@ -7122,11 +9590,10 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickIdentifier" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "VerticalRotationAcceleration", "=", "Value" ] @@ -7143,19 +9610,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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", + "description": "the vertical rotation deceleration of the object.", + "fullName": "Vertical rotation deceleration", "functionType": "ExpressionAndCondition", - "group": "Multitouch Joystick configuration", - "name": "DeadZoneRadius", - "sentence": "the dead zone radius", + "group": "First person camera multitouch controller mapper vertical rotation configuration", + "name": "VerticalRotationDeceleration", + "sentence": "the vertical rotation deceleration", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -7166,7 +9633,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "DeadZoneRadius" + "VerticalRotationDeceleration" ] } ] @@ -7184,7 +9651,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], @@ -7193,8 +9660,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "DeadZoneRadius", - "name": "SetDeadZoneRadius", + "getterName": "VerticalRotationDeceleration", + "name": "SetVerticalRotationDeceleration", "sentence": "", "events": [ { @@ -7203,11 +9670,10 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyDeadZoneRadius" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "VerticalRotationDeceleration", "=", "Value" ] @@ -7224,271 +9690,72 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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": "Action", - "name": "doStepPreEvents", - "sentence": "", + "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": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::IsReleased" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyIsReleased" - }, - "parameters": [ - "Object", - "Behavior", - "no" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + "value": "SetReturnNumber" }, "parameters": [ - "Object", - "Behavior", - "\"Idle\"", - "" + "VerticalAngleMin" ] } ] - }, + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ { - "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" - ] - } - ] - } - ] - } - ] + "description": "Object", + "name": "Object", + "type": "object" }, { - "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" - ] - }, + "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": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchId" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "VerticalAngleMin", "=", - "0" + "Value" ] } ] @@ -7503,44 +9770,38 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], "objectGroups": [] }, { - "description": "Check if button is released.", - "fullName": "Button released", - "functionType": "Condition", - "name": "IsReleased", - "sentence": "Button _PARAM0_ is released", + "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": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::PropertyIsReleased" - }, - "parameters": [ - "Object", - "Behavior" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "SetReturnBoolean" + "value": "SetReturnNumber" }, "parameters": [ - "True" + "VerticalAngleMax" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -7550,46 +9811,77 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], "objectGroups": [] }, { - "description": "Check if button is pressed.", - "fullName": "Button pressed", - "functionType": "Condition", - "name": "IsPressed", - "sentence": "Button _PARAM0_ is pressed", + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "VerticalAngleMax", + "name": "SetVerticalAngleMax", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "conditions": [], + "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::PropertyTouchId" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", - "!=", - "0" + "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": "SetReturnBoolean" + "value": "SetReturnNumber" }, "parameters": [ - "True" + "OffsetZ" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -7599,18 +9891,18 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], "objectGroups": [] }, { - "fullName": "Button state", - "functionType": "Action", - "name": "SetButtonState", - "private": true, - "sentence": "Mark the button _PARAM0_ as _PARAM2_", + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "OffsetZ", + "name": "SetOffsetZ", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -7618,14 +9910,12 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::SetButtonState" + "value": "SetNumberVariable" }, "parameters": [ - "", - "ControllerIdentifier", - "ButtonIdentifier", - "ButtonState", - "" + "OffsetZ", + "=", + "Value" ] } ] @@ -7640,61 +9930,140 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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": "Multitouch controller identifier (1, 2, 3, 4...)", + "label": "Controller identifier (1, 2, 3, 4...)", "name": "ControllerIdentifier" }, { - "value": "A", - "type": "String", - "label": "Button identifier", - "name": "ButtonIdentifier" + "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", - "label": "TouchID", - "hidden": true, - "name": "TouchId" + "unit": "Pixel", + "label": "Z position offset", + "group": "Position", + "name": "OffsetZ" }, { - "value": "", + "value": "0", "type": "Number", - "label": "", + "unit": "AngularSpeed", + "label": "Current rotation speed Z", "hidden": true, - "name": "TouchIndex" + "name": "CurrentRotationSpeedZ" }, { - "value": "", - "type": "Boolean", - "label": "Button released", + "value": "0", + "type": "Number", + "unit": "AngularSpeed", + "label": "Current rotation speed Y", "hidden": true, - "name": "IsReleased" + "name": "CurrentRotationSpeedY" } ], "sharedPropertyDescriptors": [] }, { - "description": "Control a platformer character with a multitouch controller.", - "fullName": "Platformer multitouch controller mapper", - "name": "PlatformerMultitouchMapper", + "description": "Control a 3D physics car with a multitouch controller.", + "fullName": "3D car multitouch controller mapper", + "name": "PhysicsCar3DMultitouchMapper", "objectType": "", + "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -7707,69 +10076,14 @@ "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" + "value": "SpriteMultitouchJoystick::StickForce" }, "parameters": [ "", + ">", + "0", "ControllerIdentifier", - "JoystickIdentifier", - "\"Up\"", + "SteerJoystickIdentifier", "" ] } @@ -7777,20 +10091,12 @@ "actions": [ { "type": { - "value": "PlatformBehavior::SimulateUpKey" - }, - "parameters": [ - "Object", - "Property" - ] - }, - { - "type": { - "value": "PlatformBehavior::SimulateLadderKey" + "value": "Physics3D::PhysicsCar3D::SimulateSteeringStick" }, "parameters": [ "Object", - "Property" + "PhysicsCar3D", + "SpriteMultitouchJoystick::StickForceX(ControllerIdentifier, \"Primary\")" ] } ] @@ -7800,13 +10106,14 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" + "value": "SpriteMultitouchJoystick::StickForce" }, "parameters": [ "", + ">", + "0", "ControllerIdentifier", - "JoystickIdentifier", - "\"Down\"", + "SpeedJoystickIdentifier", "" ] } @@ -7814,11 +10121,12 @@ "actions": [ { "type": { - "value": "PlatformBehavior::SimulateDownKey" + "value": "Physics3D::PhysicsCar3D::SimulateAcceleratorStick" }, "parameters": [ "Object", - "Property" + "PhysicsCar3D", + "-SpriteMultitouchJoystick::StickForceY(ControllerIdentifier, \"Secondary\")" ] } ] @@ -7833,7 +10141,7 @@ "parameters": [ "", "ControllerIdentifier", - "JumpButton", + "HandBrakeButton", "\"Down\"" ] } @@ -7841,11 +10149,11 @@ "actions": [ { "type": { - "value": "PlatformBehavior::SimulateJumpKey" + "value": "Physics3D::PhysicsCar3D::SimulateHandBrakeKey" }, "parameters": [ "Object", - "Property" + "PhysicsCar3D" ] } ] @@ -7860,7 +10168,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::PlatformerMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::PhysicsCar3DMultitouchMapper", "type": "behavior" } ], @@ -7871,12 +10179,12 @@ { "value": "", "type": "Behavior", - "label": "Platform character behavior", + "label": "3D physics car", "extraInformation": [ - "PlatformBehavior::PlatformerObjectBehavior" + "Physics3D::PhysicsCar3D" ], "choices": [], - "name": "Property" + "name": "PhysicsCar3D" }, { "value": "1", @@ -7887,7 +10195,7 @@ { "value": "Primary", "type": "Choice", - "label": "Joystick name", + "label": "Steer joystick", "group": "Controls", "choices": [ { @@ -7899,14 +10207,31 @@ "value": "Secondary" } ], - "name": "JoystickIdentifier" + "name": "SteerJoystickIdentifier" }, { - "value": "A", + "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": "Jump button name", + "label": "Hand brake button name", "group": "Controls", - "name": "JumpButton" + "name": "HandBrakeButton" } ], "sharedPropertyDescriptors": [] @@ -7916,6 +10241,7 @@ "fullName": "Top-down multitouch controller mapper", "name": "TopDownMultitouchMapper", "objectType": "", + "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -7928,11 +10254,10 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "StickMode", "=", "\"Analog\"" ] @@ -7957,11 +10282,10 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "StickMode", "=", "\"360°\"" ] @@ -7986,11 +10310,10 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "StickMode", "=", "\"8 Directions\"" ] @@ -8599,7 +10922,6 @@ } ], "instances": [], - "editionSettings": {}, "eventsFunctions": [ { "fullName": "", @@ -8718,17 +11040,90 @@ "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ + "conditions": [ { "type": { - "value": "MettreAutour" + "inverted": true, + "value": "SpriteMultitouchJoystick::IsInGameEdition" }, "parameters": [ - "Thumb", - "Border", - "Border.MultitouchJoystick::JoystickForce() * Border.Width() / 2", - "Border.MultitouchJoystick::JoystickAngle()" + "", + "" + ] + } + ], + "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", + "" + ] + } ] } ] @@ -8796,7 +11191,7 @@ "Border", "MultitouchJoystick", "=", - "Object.PropertyControllerIdentifier()", + "ControllerIdentifier", "" ] }, @@ -8808,7 +11203,7 @@ "Border", "MultitouchJoystick", "=", - "Object.PropertyJoystickIdentifier()", + "JoystickIdentifier", "" ] }, @@ -8820,7 +11215,92 @@ "Border", "MultitouchJoystick", "=", - "Object.PropertyDeadZoneRadius()", + "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)", "" ] } @@ -8837,6 +11317,92 @@ ], "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", @@ -8850,10 +11416,12 @@ { "type": { "inverted": true, - "value": "GetArgumentAsBoolean" + "value": "BooleanVariable" }, "parameters": [ - "\"ShouldActivate\"" + "ShouldActivate", + "True", + "" ] } ], @@ -8875,10 +11443,12 @@ "conditions": [ { "type": { - "value": "GetArgumentAsBoolean" + "value": "BooleanVariable" }, "parameters": [ - "\"ShouldActivate\"" + "ShouldActivate", + "True", + "" ] } ], @@ -9552,9 +12122,15 @@ "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 e7f790870..27809483b 100644 --- a/examples/starting-top-down-pixel/starting-top-down-pixel.json +++ b/examples/starting-top-down-pixel/starting-top-down-pixel.json @@ -783,7 +783,9 @@ "type": { "value": "DepartScene" }, - "parameters": [""] + "parameters": [ + "" + ] } ], "actions": [ @@ -791,7 +793,12 @@ "type": { "value": "ZoomCamera" }, - "parameters": ["", "2", "", ""] + "parameters": [ + "", + "2", + "", + "" + ] } ] }, @@ -803,13 +810,21 @@ "type": { "value": "SeparateFromObjects" }, - "parameters": ["TopDown_Character", "Wall", ""] + "parameters": [ + "TopDown_Character", + "Wall", + "" + ] }, { "type": { "value": "SeparateFromObjects" }, - "parameters": ["TopDown_Character", "Plant", ""] + "parameters": [ + "TopDown_Character", + "Plant", + "" + ] } ] } @@ -908,18 +923,19 @@ "category": "Input", "extensionNamespace": "", "fullName": "Multitouch joystick and buttons (sprite)", + "gdevelopVersion": ">=5.5.222", "helpPath": "/objects/multitouch-joystick", "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyMy4wLjMsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iSWNvbnMiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB2aWV3Qm94PSIwIDAgMzIgMzIiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDMyIDMyOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8c3R5bGUgdHlwZT0idGV4dC9jc3MiPg0KCS5zdDB7ZmlsbDpub25lO3N0cm9rZTojMDAwMDAwO3N0cm9rZS13aWR0aDoyO3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1saW5lam9pbjpyb3VuZDtzdHJva2UtbWl0ZXJsaW1pdDoxMDt9DQo8L3N0eWxlPg0KPGNpcmNsZSBjbGFzcz0ic3QwIiBjeD0iMTYiIGN5PSIxNiIgcj0iMTMiLz4NCjxwb2x5bGluZSBjbGFzcz0ic3QwIiBwb2ludHM9IjI4LjQsMTIgMjAsMTIgMjAsMy42ICIvPg0KPHBvbHlsaW5lIGNsYXNzPSJzdDAiIHBvaW50cz0iMjAsMjguNCAyMCwyMCAyOC40LDIwICIvPg0KPHBvbHlsaW5lIGNsYXNzPSJzdDAiIHBvaW50cz0iMy42LDIwIDEyLDIwIDEyLDI4LjQgIi8+DQo8cG9seWxpbmUgY2xhc3M9InN0MCIgcG9pbnRzPSIxMiwzLjYgMTIsMTIgMy42LDEyICIvPg0KPHBvbHlnb24gY2xhc3M9InN0MCIgcG9pbnRzPSIxNiw2IDE2LjcsNyAxNS4zLDcgIi8+DQo8cG9seWdvbiBjbGFzcz0ic3QwIiBwb2ludHM9IjE2LDI2IDE1LjMsMjUgMTYuNywyNSAiLz4NCjxwb2x5Z29uIGNsYXNzPSJzdDAiIHBvaW50cz0iNiwxNiA3LDE1LjMgNywxNi43ICIvPg0KPHBvbHlnb24gY2xhc3M9InN0MCIgcG9pbnRzPSIyNiwxNiAyNSwxNi43IDI1LDE1LjMgIi8+DQo8L3N2Zz4NCg==", "name": "SpriteMultitouchJoystick", "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/Line Hero Pack/Master/SVG/Videogames/Videogames_controller_joystick_arrows_direction.svg", "shortDescription": "Joysticks or buttons for touchscreens.", - "version": "1.4.0", + "version": "1.9.0", "description": [ - "Multitouch joysticks can be used the same way as physical gamepads:", + "Multitouch joysticks are objects showing a joystick on the screen, useful for mobile. They work like a physical gamepad:", "- 4 or 8 directions", "- Analogus pads", "- Player selection", - "- Controls mapping for top-down movement and platformer characters", + "- Automatic \"mapper\" behaviors for 2D and 3D movement behaviors (platformer characters, top-down movement, 3D character etc...). Add one of these to the object with the movement behavior (i.e: the player most of the time) and the behavior will then be controlled automatically by the virtual joystick (it works by reading the multitouch joystick state and simulating controls). No need for additional events to make it work once the behaviors are set up.", "", "There are ready-to-use joysticks in the asset-store [multitouch joysticks pack](https://editor.gdevelop.io/?initial-dialog=asset-store&asset-pack=multitouch-joysticks-multitouch-joysticks)." ], @@ -984,149 +1000,33 @@ ], "eventsFunctions": [ { - "description": "Check if a button is pressed on a gamepad.", - "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": "StringVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Buttons[Button].State", - "=", - "\"Pressed\"" - ] - } - ], - "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 gamepad.", - "fullName": "Multitouch controller button released", + "description": "Check if the events are running for the editor.", + "fullName": "Editor is running", "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", + "name": "IsInGameEdition", "private": true, - "sentence": "Mark _PARAM2_ button as _PARAM3_ for multitouch controller _PARAM1_", + "sentence": "Events are running for the editor", "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" + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const game = runtimeScene.getGame();\r", + "eventsFunctionContext.returnValue = game.isInGameEdition && game.isInGameEdition();" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false } ], + "parameters": [], "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", + "fullName": "Accelerated speed", + "functionType": "Expression", + "name": "AcceleratedSpeed", "private": true, - "sentence": "Change the dead zone of multitouch joystick _PARAM2_ of multitouch controller _PARAM1_ to _PARAM3_", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -1137,1295 +1037,3786 @@ "value": "SetNumberVariable" }, "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].DeadZone", + "AcceleratedSpeed", "=", - "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" + "CurrentSpeed" ] } - ] - } - ], - "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": [ + ], + "events": [ { - "type": { - "value": "SetReturnNumber" - }, - "parameters": ["mod(round(Angle * 8 / 360), 8)"] - } - ] - } - ], + "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": "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": [ + "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": [] + }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "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": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": ["Direction", "=", "\"Right\""] + "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" }, { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo4Way" - }, - "parameters": ["", "=", "0", "Angle", ""] + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" + }, + { + "description": "Direction", + "name": "Direction", + "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\"]", + "type": "stringWithSelector" } ], - "actions": [ + "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": { - "value": "SetReturnBoolean" - }, - "parameters": ["True"] + "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": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "description": "Check if a joystick is pressed.", + "fullName": "Joystick pressed", + "functionType": "Condition", + "name": "IsPressed", + "sentence": "Joystick _PARAM0_ is pressed", + "events": [ { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": ["Direction", "=", "\"Down\""] + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "!=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" }, { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo4Way" - }, - "parameters": ["", "=", "1", "Angle", ""] + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } ], - "actions": [ + "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": { - "value": "SetReturnBoolean" - }, - "parameters": ["True"] + "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": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "description": "the multitouch controller identifier.", + "fullName": "Multitouch controller identifier", + "functionType": "ExpressionAndCondition", + "group": "Multitouch Joystick configuration", + "name": "ControllerIdentifier", + "sentence": "the multitouch controller identifier", + "events": [ { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": ["Direction", "=", "\"Left\""] + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "ControllerIdentifier" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" }, { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo4Way" - }, - "parameters": ["", "=", "2", "Angle", ""] + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": ["True"] - } - ] + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": ["Direction", "=", "\"Up\""] - }, + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "ControllerIdentifier", + "name": "SetControllerIdentifier", + "sentence": "", + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo4Way" - }, - "parameters": ["", "=", "3", "Angle", ""] + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "ControllerIdentifier", + "=", + "Value" + ] + } + ] } ], - "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": [ + "parameters": [ { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": ["Direction", "=", "\"Right\""] + "description": "Object", + "name": "Object", + "type": "object" }, { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": ["", "=", "0", "Angle", ""] + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": ["True"] - } - ] + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": ["Direction", "=", "\"DownRight\""] - }, + "description": "the joystick name.", + "fullName": "Joystick name", + "functionType": "ExpressionAndCondition", + "group": "Multitouch Joystick configuration", + "name": "JoystickIdentifier", + "sentence": "the joystick name", + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": ["", "=", "1", "Angle", ""] + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnString" + }, + "parameters": [ + "JoystickIdentifier" + ] + } + ] } ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": ["True"] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "expressionType": { + "type": "string" + }, + "parameters": [ { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": ["Direction", "=", "\"Down\""] + "description": "Object", + "name": "Object", + "type": "object" }, { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": ["", "=", "2", "Angle", ""] + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": ["True"] - } - ] + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": ["Direction", "=", "\"DownLeft\""] - }, + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "JoystickIdentifier", + "name": "SetJoystickIdentifier", + "sentence": "", + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": ["", "=", "3", "Angle", ""] + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "JoystickIdentifier", + "=", + "Value" + ] + } + ] } ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": ["True"] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "parameters": [ { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": ["Direction", "=", "\"Left\""] + "description": "Object", + "name": "Object", + "type": "object" }, { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": ["", "=", "4", "Angle", ""] + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": ["True"] - } - ] + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "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": [ { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": ["Direction", "=", "\"UpLeft\""] + "description": "Object", + "name": "Object", + "type": "object" }, { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": ["", "=", "5", "Angle", ""] + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": ["True"] - } - ] + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": ["Direction", "=", "\"Up\""] - }, + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "DeadZoneRadius", + "name": "SetDeadZoneRadius", + "sentence": "", + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": ["", "=", "6", "Angle", ""] + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "DeadZoneRadius", + "=", + "Value" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::SetDeadZone" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JoystickIdentifier", + "Value", + "" + ] + } + ] } ], - "actions": [ + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": ["True"] + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } - ] + ], + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": ["Direction", "=", "\"UpRight\""] - }, + "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": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": ["", "=", "7", "Angle", ""] + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "Value" + ] + } + ] } ], - "actions": [ + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": ["True"] + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" + }, + { + "description": "Touch identifier", + "name": "Value", + "type": "expression" } - ] + ], + "objectGroups": [] } ], - "parameters": [ + "propertyDescriptors": [ { - "description": "Angle", - "name": "Angle", - "type": "expression" + "value": "1", + "type": "Number", + "label": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier" }, { - "description": "Direction", - "name": "Direction", - "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\",\"UpLeft\",\"UpRight\",\"DownLeft\",\"DownRight\"]", - "type": "stringWithSelector" + "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" } ], - "objectGroups": [] + "sharedPropertyDescriptors": [] }, { - "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" - }, + "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": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "fullName": "", + "functionType": "Action", + "name": "doStepPreEvents", + "sentence": "", + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::JoystickForce" - }, - "parameters": [ - "", - ">", - "0", - "ControllerIdentifier", - "JoystickIdentifier", - "" + "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": { - "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": "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": "SpriteMultitouchJoystick::IsAngleIn8WayDirection" - }, - "parameters": [ - "", - "SpriteMultitouchJoystick::JoystickAngle(ControllerIdentifier, JoystickIdentifier)", - "Direction", - "" + "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" + ] + } ] } ], - "actions": [ + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": ["True"] + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "type": "behavior" } - ] - } - ], - "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": "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": "Check if the button was just pressed.", + "fullName": "Button just pressed", + "functionType": "Condition", + "name": "IsJustPressed", + "sentence": "Button _PARAM0_ was just pressed", + "events": [ { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier)" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } ] } - ] - } - ], - "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": [ + ], + "parameters": [ { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "max(0, Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].Force - SpriteMultitouchJoystick::DeadZone(ControllerIdentifier, JoystickIdentifier)) / (1 - SpriteMultitouchJoystick::DeadZone(ControllerIdentifier, JoystickIdentifier))" - ] + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "type": "behavior" } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" + ], + "objectGroups": [] }, { - "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": [ + "description": "Check if the button is pressed.", + "fullName": "Button pressed", + "functionType": "Condition", + "name": "IsPressed", + "sentence": "Button _PARAM0_ is pressed", + "events": [ { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].Force", - "=", - "Value" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "!=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } ] } - ] - } - ], - "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": [ + ], + "parameters": [ { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier)" - ] + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "type": "behavior" } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" + ], + "objectGroups": [] }, { - "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": "Check if the button is released.", + "fullName": "Button released", + "functionType": "Condition", + "name": "IsReleased", + "sentence": "Button _PARAM0_ is released", + "events": [ { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].Angle" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsReleased", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } ] } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "type": "behavior" + } + ], + "objectGroups": [] }, { - "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": [ + "fullName": "Button state", + "functionType": "Action", + "name": "SetButtonState", + "private": true, + "sentence": "Mark the button _PARAM0_ as _PARAM2_", + "events": [ { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].Angle", - "=", - "Value" + "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": [] } ], - "parameters": [ + "propertyDescriptors": [ { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" + "value": "1", + "type": "Number", + "label": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier" }, { - "description": "Joystick name", - "name": "JoystickIdentifier", - "type": "string" + "value": "A", + "type": "String", + "label": "Button identifier", + "name": "ButtonIdentifier" }, { - "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": [ - "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" + "value": "0", + "type": "Number", + "label": "TouchID", + "hidden": true, + "name": "TouchId" }, { - "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": [ + "value": "", + "type": "Number", + "label": "", + "hidden": true, + "name": "TouchIndex" + }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "SpriteMultitouchJoystick::JoystickForce(ControllerIdentifier, JoystickIdentifier) * sin(ToRad(SpriteMultitouchJoystick::JoystickAngle(ControllerIdentifier, JoystickIdentifier)))" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ + "value": "", + "type": "Boolean", + "label": "Button released", + "hidden": true, + "name": "IsReleased" + }, { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" + "value": "", + "type": "Boolean", + "label": "Button just pressed", + "hidden": true, + "name": "IsJustPressed" }, { - "description": "Joystick name", - "name": "JoystickIdentifier", - "supplementaryInformation": "[\"Primary\",\"Secondary\"]", - "type": "stringWithSelector" + "value": "0", + "type": "Number", + "unit": "Pixel", + "label": "Triggering circle radius", + "description": "This circle adds up to the object collision mask.", + "name": "Radius" } ], - "objectGroups": [] - } - ], - "eventsBasedBehaviors": [ + "sharedPropertyDescriptors": [] + }, { - "description": "Joystick that can be controlled by interacting with a touchscreen.", - "fullName": "Multitouch Joystick", - "name": "MultitouchJoystick", + "description": "Control a platformer character with a multitouch controller.", + "fullName": "Platformer multitouch controller mapper", + "name": "PlatformerMultitouchMapper", "objectType": "", - "private": true, + "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", "functionType": "Action", - "name": "onCreated", + "name": "doStepPreEvents", "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ + "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::SetDeadZone" + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" }, "parameters": [ "", "ControllerIdentifier", "JoystickIdentifier", - "DeadZoneRadius", + "\"Left\"", "" ] - }, + } + ], + "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" + "value": "PlatformBehavior::SimulateLeftKey" }, - "parameters": ["Object", "Behavior", ""] + "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": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JoystickIdentifier", + "\"Right\"", + "" + ] + } + ], "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" + "value": "PlatformBehavior::SimulateRightKey" }, - "parameters": ["Object", "Behavior", ""] + "parameters": [ + "Object", + "Property" + ] } ] - } - ], - "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": { - "value": "HasGameJustResumed" + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" }, - "parameters": [""] + "parameters": [ + "", + "ControllerIdentifier", + "JoystickIdentifier", + "\"Up\"", + "" + ] } ], "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" + "value": "PlatformBehavior::SimulateUpKey" + }, + "parameters": [ + "Object", + "Property" + ] + }, + { + "type": { + "value": "PlatformBehavior::SimulateLadderKey" }, - "parameters": ["Object", "Behavior", ""] + "parameters": [ + "Object", + "Property" + ] } ] }, { - "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": "BuiltinCommonInstructions::Standard", + "conditions": [ { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 + "type": { + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" }, - "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": [ + "", + "ControllerIdentifier", + "JoystickIdentifier", + "\"Down\"", + "" ] } ], - "parameters": [] - }, - { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Update joystick position", - "source": "", - "type": "BuiltinCommonInstructions::Group", - "events": [ + "actions": [ { - "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)", - "" - ] - } + "type": { + "value": "PlatformBehavior::SimulateDownKey" + }, + "parameters": [ + "Object", + "Property" ] } - ], - "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": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::IsButtonPressed" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JumpButton", + "\"Down\"" + ] + } + ], "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "PlatformBehavior::SimulateJumpKey" }, "parameters": [ - "max(0, JoystickForce - DeadZoneRadius) / (1 - DeadZoneRadius)" + "Object", + "Property" ] } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -2435,83 +4826,140 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::PlatformerMultitouchMapper", "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": "ActionWithOperator", - "getterName": "JoystickForce", - "name": "SetJoystickForce", - "private": true, + "functionType": "Action", + "name": "doStepPreEvents", "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::StickForce" + }, + "parameters": [ + "", + ">", + "0", + "ControllerIdentifier", + "JoystickIdentifier", + "" + ] + } + ], "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickForce" + "value": "Physics3D::PhysicsCharacter3D::SetForwardAngle" }, - "parameters": ["Object", "Behavior", "=", "Value"] + "parameters": [ + "Object", + "PhysicsCharacter3D", + "=", + "SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier) + CameraAngle(Object.Layer())" + ] }, { "type": { - "value": "SpriteMultitouchJoystick::SetJoystickForce" + "value": "Physics3D::PhysicsCharacter3D::SimulateStick" }, "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "JoystickForce", - "" + "Object", + "PhysicsCharacter3D", + "-90", + "SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier)" ] } ] - } - ], - "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": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::IsButtonPressed" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JumpButton", + "\"Down\"" + ] + } + ], "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" }, - "parameters": ["JoystickAngle"] + "parameters": [ + "Object", + "PhysicsCharacter3D" + ] } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -2521,40 +4969,124 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::Platformer3DMultitouchMapper", "type": "behavior" } ], "objectGroups": [] + } + ], + "propertyDescriptors": [ + { + "value": "", + "type": "Behavior", + "label": "3D physics character", + "extraInformation": [ + "Physics3D::PhysicsCharacter3D" + ], + "choices": [], + "name": "PhysicsCharacter3D" }, { - "description": "Change the angle the joystick is pointing towards (Range: -180 to 180).", - "fullName": "Joystick angle", + "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": "SetJoystickAngle", - "private": true, - "sentence": "Change the joystick angle of _PARAM0_ to _PARAM2_", + "name": "doStepPreEvents", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::StickForce" + }, + "parameters": [ + "", + ">", + "0", + "ControllerIdentifier", + "JoystickIdentifier", + "" + ] + } + ], "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickAngle" + "value": "Physics3D::PhysicsCharacter3D::SimulateStick" }, - "parameters": ["Object", "Behavior", "=", "Value"] - }, + "parameters": [ + "Object", + "PhysicsCharacter3D", + "SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier)", + "SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier)" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::SetJoystickAngle" + "value": "SpriteMultitouchJoystick::IsButtonPressed" }, "parameters": [ "", "ControllerIdentifier", - "JoystickIdentifier", - "JoystickAngle", - "" + "JumpButton", + "\"Down\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" + }, + "parameters": [ + "Object", + "PhysicsCharacter3D" ] } ] @@ -2569,42 +5101,151 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "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" }, { - "description": "Angle", - "name": "Value", - "type": "expression" + "label": "Secondary", + "value": "Secondary" } ], - "objectGroups": [] + "name": "JoystickIdentifier" }, { - "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", + "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": "SetReturnNumber" + "value": "SetNumberVariable" }, "parameters": [ - "Object.Behavior::JoystickForce() * cos(ToRad(Object.Behavior::JoystickAngle()))" + "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", + "" ] } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -2614,18 +5255,20 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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": "", + "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", @@ -2633,18 +5276,67 @@ "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "CentreCamera" }, "parameters": [ - "Object.Behavior::JoystickForce() * sin(ToRad(Object.Behavior::JoystickAngle()))" + "", + "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()", + "" ] } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -2654,45 +5346,38 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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_", + "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": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::JoystickForce" - }, - "parameters": ["Object", "Behavior", ">", "0", ""] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::IsAngleIn4WayDirection" - }, - "parameters": ["", "JoystickAngle", "Direction", ""] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "SetReturnBoolean" + "value": "SetReturnNumber" }, - "parameters": ["True"] + "parameters": [ + "HorizontalRotationSpeedMax" + ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -2702,47 +5387,32 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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_", + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "HorizontalRotationSpeedMax", + "name": "SetHorizontalRotationSpeedMax", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::JoystickForce" - }, - "parameters": ["Object", "Behavior", ">", "0", ""] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::IsAngleIn8WayDirection" - }, - "parameters": ["", "JoystickAngle", "Direction", ""] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "SetReturnBoolean" + "value": "SetNumberVariable" }, - "parameters": ["True"] + "parameters": [ + "HorizontalRotationSpeedMax", + "=", + "Value" + ] } ] } @@ -2756,45 +5426,38 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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", + "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": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::PropertyTouchId" - }, - "parameters": ["Object", "Behavior", "!=", "0"] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "SetReturnBoolean" + "value": "SetReturnNumber" }, - "parameters": ["True"] + "parameters": [ + "HorizontalRotationAcceleration" + ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -2804,19 +5467,18 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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_", + }, + { + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "HorizontalRotationAcceleration", + "name": "SetHorizontalRotationAcceleration", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -2824,15 +5486,13 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" - }, - "parameters": ["Object", "Behavior", "=", "0", ""] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyTouchId" + "value": "SetNumberVariable" }, - "parameters": ["Object", "Behavior", "=", "0"] + "parameters": [ + "HorizontalRotationAcceleration", + "=", + "Value" + ] } ] } @@ -2846,19 +5506,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the multitouch controller identifier.", - "fullName": "Multitouch controller identifier", + "description": "the horizontal rotation deceleration of the object.", + "fullName": "Horizontal rotation deceleration", "functionType": "ExpressionAndCondition", - "group": "Multitouch Joystick configuration", - "name": "ControllerIdentifier", - "sentence": "the multitouch controller identifier", + "group": "First person camera multitouch controller mapper horizontal rotation configuration", + "name": "HorizontalRotationDeceleration", + "sentence": "the horizontal rotation deceleration", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -2868,7 +5528,9 @@ "type": { "value": "SetReturnNumber" }, - "parameters": ["ControllerIdentifier"] + "parameters": [ + "HorizontalRotationDeceleration" + ] } ] } @@ -2885,7 +5547,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], @@ -2894,8 +5556,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "ControllerIdentifier", - "name": "SetControllerIdentifier", + "getterName": "HorizontalRotationDeceleration", + "name": "SetHorizontalRotationDeceleration", "sentence": "", "events": [ { @@ -2904,9 +5566,13 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyControllerIdentifier" + "value": "SetNumberVariable" }, - "parameters": ["Object", "Behavior", "=", "Value"] + "parameters": [ + "HorizontalRotationDeceleration", + "=", + "Value" + ] } ] } @@ -2920,19 +5586,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the joystick name.", - "fullName": "Joystick name", + "description": "the maximum vertical rotation speed of the object.", + "fullName": "Maximum vertical rotation speed", "functionType": "ExpressionAndCondition", - "group": "Multitouch Joystick configuration", - "name": "JoystickIdentifier", - "sentence": "the joystick name", + "group": "First person camera multitouch controller mapper vertical rotation configuration", + "name": "VerticalRotationSpeedMax", + "sentence": "the maximum vertical rotation speed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -2940,15 +5606,17 @@ "actions": [ { "type": { - "value": "SetReturnString" + "value": "SetReturnNumber" }, - "parameters": ["JoystickIdentifier"] + "parameters": [ + "VerticalRotationSpeedMax" + ] } ] } ], "expressionType": { - "type": "string" + "type": "expression" }, "parameters": [ { @@ -2959,7 +5627,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], @@ -2968,8 +5636,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "JoystickIdentifier", - "name": "SetJoystickIdentifier", + "getterName": "VerticalRotationSpeedMax", + "name": "SetVerticalRotationSpeedMax", "sentence": "", "events": [ { @@ -2978,9 +5646,13 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickIdentifier" + "value": "SetNumberVariable" }, - "parameters": ["Object", "Behavior", "=", "Value"] + "parameters": [ + "VerticalRotationSpeedMax", + "=", + "Value" + ] } ] } @@ -2994,19 +5666,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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", + "description": "the vertical rotation acceleration of the object.", + "fullName": "Vertical rotation acceleration", "functionType": "ExpressionAndCondition", - "group": "Multitouch Joystick configuration", - "name": "DeadZoneRadius", - "sentence": "the dead zone radius", + "group": "First person camera multitouch controller mapper vertical rotation configuration", + "name": "VerticalRotationAcceleration", + "sentence": "the vertical rotation acceleration", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -3016,7 +5688,9 @@ "type": { "value": "SetReturnNumber" }, - "parameters": ["DeadZoneRadius"] + "parameters": [ + "VerticalRotationAcceleration" + ] } ] } @@ -3033,7 +5707,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], @@ -3042,8 +5716,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "DeadZoneRadius", - "name": "SetDeadZoneRadius", + "getterName": "VerticalRotationAcceleration", + "name": "SetVerticalRotationAcceleration", "sentence": "", "events": [ { @@ -3052,9 +5726,13 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyDeadZoneRadius" + "value": "SetNumberVariable" }, - "parameters": ["Object", "Behavior", "=", "Value"] + "parameters": [ + "VerticalRotationAcceleration", + "=", + "Value" + ] } ] } @@ -3068,246 +5746,118 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "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" - }, - { - "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": "", + "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": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::IsReleased" - }, - "parameters": ["Object", "Behavior", ""] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyIsReleased" - }, - "parameters": ["Object", "Behavior", "no"] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + "value": "SetReturnNumber" }, - "parameters": ["Object", "Behavior", "\"Idle\"", ""] + "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": [ - { - "type": { - "inverted": true, - "value": "SpriteMultitouchJoystick::MultitouchButton::IsPressed" - }, - "parameters": ["Object", "Behavior", ""] - }, - { - "type": { - "value": "HasAnyTouchOrMouseStarted" - }, - "parameters": [""] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchIndex" + "value": "SetNumberVariable" }, - "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"] - } - ] - } + "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": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::IsPressed" - }, - "parameters": ["Object", "Behavior", ""] - }, - { - "type": { - "value": "HasTouchEnded" - }, - "parameters": ["", "TouchId"] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" - }, - "parameters": ["Object", "Behavior", "\"Released\"", ""] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyIsReleased" - }, - "parameters": ["Object", "Behavior", "yes"] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchId" + "value": "SetReturnNumber" }, - "parameters": ["Object", "Behavior", "=", "0"] + "parameters": [ + "VerticalAngleMin" + ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -3317,39 +5867,77 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], "objectGroups": [] }, { - "description": "Check if button is released.", - "fullName": "Button released", - "functionType": "Condition", - "name": "IsReleased", - "sentence": "Button _PARAM0_ is released", + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "VerticalAngleMin", + "name": "SetVerticalAngleMin", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "conditions": [], + "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::PropertyIsReleased" + "value": "SetNumberVariable" }, - "parameters": ["Object", "Behavior"] + "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": "SetReturnBoolean" + "value": "SetReturnNumber" }, - "parameters": ["True"] + "parameters": [ + "VerticalAngleMax" + ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -3359,39 +5947,77 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], "objectGroups": [] }, { - "description": "Check if button is pressed.", - "fullName": "Button pressed", - "functionType": "Condition", - "name": "IsPressed", - "sentence": "Button _PARAM0_ is pressed", + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "VerticalAngleMax", + "name": "SetVerticalAngleMax", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "conditions": [], + "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::PropertyTouchId" + "value": "SetNumberVariable" }, - "parameters": ["Object", "Behavior", "!=", "0"] + "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": "SetReturnBoolean" + "value": "SetReturnNumber" }, - "parameters": ["True"] + "parameters": [ + "OffsetZ" + ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -3401,18 +6027,18 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], "objectGroups": [] }, { - "fullName": "Button state", - "functionType": "Action", - "name": "SetButtonState", - "private": true, - "sentence": "Mark the button _PARAM0_ as _PARAM2_", + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "OffsetZ", + "name": "SetOffsetZ", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -3420,14 +6046,12 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::SetButtonState" + "value": "SetNumberVariable" }, "parameters": [ - "", - "ControllerIdentifier", - "ButtonIdentifier", - "ButtonState", - "" + "OffsetZ", + "=", + "Value" ] } ] @@ -3442,120 +6066,160 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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": "Multitouch controller identifier (1, 2, 3, 4...)", - "description": "", - "group": "", - "extraInformation": [], + "label": "Controller identifier (1, 2, 3, 4...)", "name": "ControllerIdentifier" }, { - "value": "A", - "type": "String", - "label": "Button identifier", - "description": "", - "group": "", - "extraInformation": [], - "name": "ButtonIdentifier" + "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", - "label": "TouchID", - "description": "", - "group": "", - "extraInformation": [], - "hidden": true, - "name": "TouchId" + "unit": "Pixel", + "label": "Z position offset", + "group": "Position", + "name": "OffsetZ" }, { - "value": "", + "value": "0", "type": "Number", - "label": "", - "description": "", - "group": "", - "extraInformation": [], + "unit": "AngularSpeed", + "label": "Current rotation speed Z", "hidden": true, - "name": "TouchIndex" + "name": "CurrentRotationSpeedZ" }, { - "value": "", - "type": "Boolean", - "label": "Button released", - "description": "", - "group": "", - "extraInformation": [], + "value": "0", + "type": "Number", + "unit": "AngularSpeed", + "label": "Current rotation speed Y", "hidden": true, - "name": "IsReleased" + "name": "CurrentRotationSpeedY" } ], "sharedPropertyDescriptors": [] }, { - "description": "Control a platformer character with a multitouch controller.", - "fullName": "Platformer multitouch controller mapper", - "name": "PlatformerMultitouchMapper", + "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::IsDirectionPushed4Way" - }, - "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "\"Left\"", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateLeftKey" - }, - "parameters": ["Object", "Property"] - } - ] - }, + "fullName": "", + "functionType": "Action", + "name": "doStepPreEvents", + "sentence": "", + "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" + "value": "SpriteMultitouchJoystick::StickForce" }, "parameters": [ "", + ">", + "0", "ControllerIdentifier", - "JoystickIdentifier", - "\"Right\"", + "SteerJoystickIdentifier", "" ] } @@ -3563,41 +6227,14 @@ "actions": [ { "type": { - "value": "PlatformBehavior::SimulateRightKey" - }, - "parameters": ["Object", "Property"] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" + "value": "Physics3D::PhysicsCar3D::SimulateSteeringStick" }, "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "\"Up\"", - "" + "Object", + "PhysicsCar3D", + "SpriteMultitouchJoystick::StickForceX(ControllerIdentifier, \"Primary\")" ] } - ], - "actions": [ - { - "type": { - "value": "PlatformBehavior::SimulateUpKey" - }, - "parameters": ["Object", "Property"] - }, - { - "type": { - "value": "PlatformBehavior::SimulateLadderKey" - }, - "parameters": ["Object", "Property"] - } ] }, { @@ -3605,13 +6242,14 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" + "value": "SpriteMultitouchJoystick::StickForce" }, "parameters": [ "", + ">", + "0", "ControllerIdentifier", - "JoystickIdentifier", - "\"Down\"", + "SpeedJoystickIdentifier", "" ] } @@ -3619,9 +6257,13 @@ "actions": [ { "type": { - "value": "PlatformBehavior::SimulateDownKey" + "value": "Physics3D::PhysicsCar3D::SimulateAcceleratorStick" }, - "parameters": ["Object", "Property"] + "parameters": [ + "Object", + "PhysicsCar3D", + "-SpriteMultitouchJoystick::StickForceY(ControllerIdentifier, \"Secondary\")" + ] } ] }, @@ -3635,7 +6277,7 @@ "parameters": [ "", "ControllerIdentifier", - "JumpButton", + "HandBrakeButton", "\"Down\"" ] } @@ -3643,9 +6285,12 @@ "actions": [ { "type": { - "value": "PlatformBehavior::SimulateJumpKey" + "value": "Physics3D::PhysicsCar3D::SimulateHandBrakeKey" }, - "parameters": ["Object", "Property"] + "parameters": [ + "Object", + "PhysicsCar3D" + ] } ] } @@ -3659,7 +6304,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::PlatformerMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::PhysicsCar3DMultitouchMapper", "type": "behavior" } ], @@ -3670,40 +6315,59 @@ { "value": "", "type": "Behavior", - "label": "Platform character behavior", - "description": "", - "group": "", + "label": "3D physics car", "extraInformation": [ - "PlatformBehavior::PlatformerObjectBehavior" + "Physics3D::PhysicsCar3D" ], - "name": "Property" + "choices": [], + "name": "PhysicsCar3D" }, { "value": "1", "type": "Number", "label": "Controller identifier (1, 2, 3, 4...)", - "description": "", - "group": "", - "extraInformation": [], "name": "ControllerIdentifier" }, { "value": "Primary", "type": "Choice", - "label": "Joystick name", - "description": "", + "label": "Steer joystick", "group": "Controls", - "extraInformation": ["Primary", "Secondary"], - "name": "JoystickIdentifier" + "choices": [ + { + "label": "Primary", + "value": "Primary" + }, + { + "label": "Secondary", + "value": "Secondary" + } + ], + "name": "SteerJoystickIdentifier" }, { - "value": "A", + "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": "Jump button name", - "description": "", + "label": "Hand brake button name", "group": "Controls", - "extraInformation": [], - "name": "JumpButton" + "name": "HandBrakeButton" } ], "sharedPropertyDescriptors": [] @@ -3713,6 +6377,7 @@ "fullName": "Top-down multitouch controller mapper", "name": "TopDownMultitouchMapper", "objectType": "", + "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -3725,9 +6390,13 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" + "value": "StringVariable" }, - "parameters": ["Object", "Behavior", "=", "\"Analog\""] + "parameters": [ + "StickMode", + "=", + "\"Analog\"" + ] } ], "actions": [ @@ -3749,9 +6418,13 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" + "value": "StringVariable" }, - "parameters": ["Object", "Behavior", "=", "\"360°\""] + "parameters": [ + "StickMode", + "=", + "\"360°\"" + ] } ], "actions": [ @@ -3773,11 +6446,10 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "StickMode", "=", "\"8 Directions\"" ] @@ -3793,7 +6465,10 @@ "inverted": true, "value": "TopDownMovementBehavior::DiagonalsAllowed" }, - "parameters": ["Object", "TopDownMovement"] + "parameters": [ + "Object", + "TopDownMovement" + ] } ], "actions": [], @@ -3819,7 +6494,10 @@ "type": { "value": "TopDownMovementBehavior::SimulateLeftKey" }, - "parameters": ["Object", "TopDownMovement"] + "parameters": [ + "Object", + "TopDownMovement" + ] } ] }, @@ -3844,7 +6522,10 @@ "type": { "value": "TopDownMovementBehavior::SimulateRightKey" }, - "parameters": ["Object", "TopDownMovement"] + "parameters": [ + "Object", + "TopDownMovement" + ] } ] }, @@ -3869,7 +6550,10 @@ "type": { "value": "TopDownMovementBehavior::SimulateUpKey" }, - "parameters": ["Object", "TopDownMovement"] + "parameters": [ + "Object", + "TopDownMovement" + ] } ] }, @@ -3894,7 +6578,10 @@ "type": { "value": "TopDownMovementBehavior::SimulateDownKey" }, - "parameters": ["Object", "TopDownMovement"] + "parameters": [ + "Object", + "TopDownMovement" + ] } ] } @@ -3907,7 +6594,10 @@ "type": { "value": "TopDownMovementBehavior::DiagonalsAllowed" }, - "parameters": ["Object", "TopDownMovement"] + "parameters": [ + "Object", + "TopDownMovement" + ] } ], "actions": [], @@ -3933,7 +6623,10 @@ "type": { "value": "TopDownMovementBehavior::SimulateLeftKey" }, - "parameters": ["Object", "TopDownMovement"] + "parameters": [ + "Object", + "TopDownMovement" + ] } ] }, @@ -3958,7 +6651,10 @@ "type": { "value": "TopDownMovementBehavior::SimulateRightKey" }, - "parameters": ["Object", "TopDownMovement"] + "parameters": [ + "Object", + "TopDownMovement" + ] } ] }, @@ -3983,7 +6679,10 @@ "type": { "value": "TopDownMovementBehavior::SimulateUpKey" }, - "parameters": ["Object", "TopDownMovement"] + "parameters": [ + "Object", + "TopDownMovement" + ] } ] }, @@ -4008,7 +6707,10 @@ "type": { "value": "TopDownMovementBehavior::SimulateDownKey" }, - "parameters": ["Object", "TopDownMovement"] + "parameters": [ + "Object", + "TopDownMovement" + ] } ] }, @@ -4033,13 +6735,19 @@ "type": { "value": "TopDownMovementBehavior::SimulateUpKey" }, - "parameters": ["Object", "TopDownMovement"] + "parameters": [ + "Object", + "TopDownMovement" + ] }, { "type": { "value": "TopDownMovementBehavior::SimulateLeftKey" }, - "parameters": ["Object", "TopDownMovement"] + "parameters": [ + "Object", + "TopDownMovement" + ] } ] }, @@ -4064,13 +6772,19 @@ "type": { "value": "TopDownMovementBehavior::SimulateUpKey" }, - "parameters": ["Object", "TopDownMovement"] + "parameters": [ + "Object", + "TopDownMovement" + ] }, { "type": { "value": "TopDownMovementBehavior::SimulateRightKey" }, - "parameters": ["Object", "TopDownMovement"] + "parameters": [ + "Object", + "TopDownMovement" + ] } ] }, @@ -4095,13 +6809,19 @@ "type": { "value": "TopDownMovementBehavior::SimulateDownKey" }, - "parameters": ["Object", "TopDownMovement"] + "parameters": [ + "Object", + "TopDownMovement" + ] }, { "type": { "value": "TopDownMovementBehavior::SimulateLeftKey" }, - "parameters": ["Object", "TopDownMovement"] + "parameters": [ + "Object", + "TopDownMovement" + ] } ] }, @@ -4126,13 +6846,19 @@ "type": { "value": "TopDownMovementBehavior::SimulateDownKey" }, - "parameters": ["Object", "TopDownMovement"] + "parameters": [ + "Object", + "TopDownMovement" + ] }, { "type": { "value": "TopDownMovementBehavior::SimulateRightKey" }, - "parameters": ["Object", "TopDownMovement"] + "parameters": [ + "Object", + "TopDownMovement" + ] } ] } @@ -4162,57 +6888,176 @@ "value": "", "type": "Behavior", "label": "Top-down movement behavior", - "description": "", - "group": "", "extraInformation": [ "TopDownMovementBehavior::TopDownMovementBehavior" ], + "choices": [], "name": "TopDownMovement" }, { "value": "1", "type": "Number", "label": "Controller identifier (1, 2, 3, 4...)", - "description": "", - "group": "", - "extraInformation": [], "name": "ControllerIdentifier" }, { "value": "Primary", "type": "Choice", "label": "Joystick name", - "description": "", - "group": "", - "extraInformation": ["Primary", "Secondary"], + "choices": [ + { + "label": "Primary", + "value": "Primary" + }, + { + "label": "Secondary", + "value": "Secondary" + } + ], "name": "JoystickIdentifier" }, { - "value": "Analog", - "type": "Choice", - "label": "Stick mode", - "description": "", - "group": "Controls", - "extraInformation": ["Analog", "360°", "8 Directions"], - "name": "StickMode" + "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": [] } ], - "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", + "instances": [], "eventsFunctions": [ { "fullName": "", @@ -4228,49 +7073,87 @@ "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", + "" + ] } ] } @@ -4293,17 +7176,90 @@ "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ + "conditions": [ { "type": { - "value": "MettreAutour" + "inverted": true, + "value": "SpriteMultitouchJoystick::IsInGameEdition" }, "parameters": [ - "Thumb", - "Border", - "Border.MultitouchJoystick::JoystickForce() * Border.Width() / 2", - "Border.MultitouchJoystick::JoystickAngle()" + "", + "" + ] + } + ], + "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", + "" + ] + } ] } ] @@ -4333,7 +7289,10 @@ "type": { "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::UpdateConfiguration" }, - "parameters": ["Object", ""] + "parameters": [ + "Object", + "" + ] } ] } @@ -4368,7 +7327,7 @@ "Border", "MultitouchJoystick", "=", - "Object.PropertyControllerIdentifier()", + "ControllerIdentifier", "" ] }, @@ -4380,7 +7339,7 @@ "Border", "MultitouchJoystick", "=", - "Object.PropertyJoystickIdentifier()", + "JoystickIdentifier", "" ] }, @@ -4392,7 +7351,92 @@ "Border", "MultitouchJoystick", "=", - "Object.PropertyDeadZoneRadius()", + "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)", "" ] } @@ -4409,6 +7453,92 @@ ], "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", @@ -4422,9 +7552,13 @@ { "type": { "inverted": true, - "value": "GetArgumentAsBoolean" + "value": "BooleanVariable" }, - "parameters": ["\"ShouldActivate\""] + "parameters": [ + "ShouldActivate", + "True", + "" + ] } ], "actions": [ @@ -4432,7 +7566,11 @@ "type": { "value": "ActivateBehavior" }, - "parameters": ["Border", "MultitouchJoystick", "no"] + "parameters": [ + "Border", + "MultitouchJoystick", + "no" + ] } ] }, @@ -4441,9 +7579,13 @@ "conditions": [ { "type": { - "value": "GetArgumentAsBoolean" + "value": "BooleanVariable" }, - "parameters": ["\"ShouldActivate\""] + "parameters": [ + "ShouldActivate", + "True", + "" + ] } ], "actions": [ @@ -4451,7 +7593,11 @@ "type": { "value": "ActivateBehavior" }, - "parameters": ["Border", "MultitouchJoystick", "yes"] + "parameters": [ + "Border", + "MultitouchJoystick", + "yes" + ] } ] } @@ -4485,7 +7631,11 @@ "type": { "value": "SpriteMultitouchJoystick::MultitouchJoystick::IsPressed" }, - "parameters": ["Border", "MultitouchJoystick", "!="] + "parameters": [ + "Border", + "MultitouchJoystick", + "!=" + ] } ], "actions": [ @@ -4493,7 +7643,9 @@ "type": { "value": "SetReturnBoolean" }, - "parameters": ["True"] + "parameters": [ + "True" + ] } ] } @@ -4594,7 +7746,9 @@ "type": { "value": "SetReturnNumber" }, - "parameters": ["Border.MultitouchJoystick::StickForceX()"] + "parameters": [ + "Border.MultitouchJoystick::StickForceX()" + ] } ] } @@ -4627,7 +7781,9 @@ "type": { "value": "SetReturnNumber" }, - "parameters": ["Border.MultitouchJoystick::StickForceY()"] + "parameters": [ + "Border.MultitouchJoystick::StickForceY()" + ] } ] } @@ -4743,7 +7899,9 @@ "type": { "value": "SetReturnBoolean" }, - "parameters": ["True"] + "parameters": [ + "True" + ] } ] } @@ -4791,7 +7949,9 @@ "type": { "value": "SetReturnBoolean" }, - "parameters": ["True"] + "parameters": [ + "True" + ] } ] } @@ -5034,18 +8194,22 @@ "value": "1", "type": "Number", "label": "Multitouch controller identifier (1, 2, 3, 4...)", - "description": "", - "group": "", - "extraInformation": [], "name": "ControllerIdentifier" }, { "value": "Primary", "type": "Choice", "label": "Joystick name", - "description": "", - "group": "", - "extraInformation": ["Primary", "Secondary"], + "choices": [ + { + "label": "Primary", + "value": "Primary" + }, + { + "label": "Secondary", + "value": "Secondary" + } + ], "name": "JoystickIdentifier" }, { @@ -5053,8 +8217,6 @@ "type": "Number", "label": "Dead zone radius (range: 0 to 1)", "description": "The deadzone is an area for which movement on sticks won't be taken into account (instead, the stick will be considered as not moved)", - "group": "", - "extraInformation": [], "name": "DeadZoneRadius" }, { @@ -5062,8 +8224,10 @@ "type": "String", "label": "", "description": "Only used by the scene editor.", - "group": "", - "extraInformation": ["Thumb"], + "extraInformation": [ + "Thumb" + ], + "choices": [], "hidden": true, "name": "ThumbAnchorOrigin" }, @@ -5072,8 +8236,6 @@ "type": "Number", "label": "", "description": "Only used by the scene editor.", - "group": "", - "extraInformation": [], "hidden": true, "name": "ThumbAnchorTarget" }, @@ -5082,8 +8244,10 @@ "type": "Boolean", "label": "", "description": "Only used by the scene editor.", - "group": "", - "extraInformation": ["Thumb"], + "extraInformation": [ + "Thumb" + ], + "choices": [], "hidden": true, "name": "ThumbIsScaledProportionally" }, @@ -5092,116 +8256,17 @@ "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": [] - } - ] - } - ] }, { - "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": [] + "value": "", + "type": "Boolean", + "label": "", + "hidden": true, + "name": "ShouldBeHiddenWhenReleased" } - ], - "instances": [] + ] } ] }, @@ -5239,7 +8304,9 @@ "platformer", "platform" ], - "authorIds": ["IWykYNRvhCZBN3vEgKEbBPOR3Oc2"], + "authorIds": [ + "IWykYNRvhCZBN3vEgKEbBPOR3Oc2" + ], "dependencies": [], "globalVariables": [], "sceneVariables": [], @@ -5409,7 +8476,12 @@ "type": { "value": "SmoothCamera::SmoothCamera::SetPropertyCameraDelay" }, - "parameters": ["Object", "Behavior", "=", "CameraDelay"] + "parameters": [ + "Object", + "Behavior", + "=", + "CameraDelay" + ] } ] } @@ -5443,7 +8515,10 @@ "inverted": true, "value": "SmoothCamera::SmoothCamera::PropertyIsCalledManually" }, - "parameters": ["Object", "Behavior"] + "parameters": [ + "Object", + "Behavior" + ] } ], "actions": [ @@ -5451,7 +8526,11 @@ "type": { "value": "SmoothCamera::SmoothCamera::DoMoveCameraCloser" }, - "parameters": ["Object", "Behavior", ""] + "parameters": [ + "Object", + "Behavior", + "" + ] } ] } @@ -5498,13 +8577,21 @@ "type": { "value": "SmoothCamera::SmoothCamera::SetPropertyIsCalledManually" }, - "parameters": ["Object", "Behavior", "yes"] + "parameters": [ + "Object", + "Behavior", + "yes" + ] }, { "type": { "value": "SmoothCamera::SmoothCamera::DoMoveCameraCloser" }, - "parameters": ["Object", "Behavior", ""] + "parameters": [ + "Object", + "Behavior", + "" + ] } ] } @@ -5552,13 +8639,21 @@ "type": { "value": "SmoothCamera::SmoothCamera::UpdateDelayedPosition" }, - "parameters": ["Object", "Behavior", ""] + "parameters": [ + "Object", + "Behavior", + "" + ] }, { "type": { "value": "SmoothCamera::SmoothCamera::UpdateForecastedPosition" }, - "parameters": ["Object", "Behavior", ""] + "parameters": [ + "Object", + "Behavior", + "" + ] } ] }, @@ -5581,7 +8676,10 @@ "type": { "value": "SmoothCamera::SmoothCamera::PropertyFollowOnX" }, - "parameters": ["Object", "Behavior"] + "parameters": [ + "Object", + "Behavior" + ] } ], "actions": [ @@ -5735,7 +8833,10 @@ "type": { "value": "SmoothCamera::SmoothCamera::PropertyFollowOnY" }, - "parameters": ["Object", "Behavior"] + "parameters": [ + "Object", + "Behavior" + ] } ], "actions": [ @@ -6035,7 +9136,11 @@ "type": { "value": "PrimitiveDrawing::FillOpacity" }, - "parameters": ["ShapePainter", "=", "0"] + "parameters": [ + "ShapePainter", + "=", + "0" + ] } ] }, @@ -6067,13 +9172,21 @@ "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": { @@ -6106,7 +9219,12 @@ "type": { "value": "SmoothCamera::SmoothCamera::SetPropertyIndex" }, - "parameters": ["Object", "Behavior", "+", "1"] + "parameters": [ + "Object", + "Behavior", + "+", + "1" + ] } ] }, @@ -6118,7 +9236,9 @@ "type": { "value": "PrimitiveDrawing::EndFillPath" }, - "parameters": ["ShapePainter"] + "parameters": [ + "ShapePainter" + ] } ] } @@ -6149,25 +9269,45 @@ "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" + ] } ] } @@ -6177,7 +9317,10 @@ "type": { "value": "PrimitiveDrawing::OutlineColor" }, - "parameters": ["ShapePainter", "\"126;211;33\""] + "parameters": [ + "ShapePainter", + "\"126;211;33\"" + ] }, { "type": { @@ -6213,7 +9356,10 @@ "type": { "value": "PrimitiveDrawing::OutlineColor" }, - "parameters": ["ShapePainter", "\"208;2;27\""] + "parameters": [ + "ShapePainter", + "\"208;2;27\"" + ] }, { "type": { @@ -6326,7 +9472,11 @@ "type": { "value": "SmoothCamera::SmoothCamera::SetPropertyFollowOnX" }, - "parameters": ["Object", "Behavior", ""] + "parameters": [ + "Object", + "Behavior", + "" + ] } ] }, @@ -6337,7 +9487,9 @@ "type": { "value": "GetArgumentAsBoolean" }, - "parameters": ["\"FollowOnX\""] + "parameters": [ + "\"FollowOnX\"" + ] } ], "actions": [ @@ -6345,7 +9497,11 @@ "type": { "value": "SmoothCamera::SmoothCamera::SetPropertyFollowOnX" }, - "parameters": ["Object", "Behavior", "yes"] + "parameters": [ + "Object", + "Behavior", + "yes" + ] } ] } @@ -6386,7 +9542,11 @@ "type": { "value": "SmoothCamera::SmoothCamera::SetPropertyFollowOnY" }, - "parameters": ["Object", "Behavior", ""] + "parameters": [ + "Object", + "Behavior", + "" + ] } ] }, @@ -6397,7 +9557,9 @@ "type": { "value": "GetArgumentAsBoolean" }, - "parameters": ["\"FollowOnY\""] + "parameters": [ + "\"FollowOnY\"" + ] } ], "actions": [ @@ -6405,7 +9567,11 @@ "type": { "value": "SmoothCamera::SmoothCamera::SetPropertyFollowOnY" }, - "parameters": ["Object", "Behavior", "yes"] + "parameters": [ + "Object", + "Behavior", + "yes" + ] } ] } @@ -6630,7 +9796,12 @@ "type": { "value": "SmoothCamera::SmoothCamera::SetPropertyLeftwardSpeedMax" }, - "parameters": ["Object", "Behavior", "=", "max(0, Speed)"] + "parameters": [ + "Object", + "Behavior", + "=", + "max(0, Speed)" + ] } ] } @@ -6671,7 +9842,12 @@ "type": { "value": "SmoothCamera::SmoothCamera::SetPropertyLeftwardSpeedMax" }, - "parameters": ["Object", "Behavior", "=", "max(0, Speed)"] + "parameters": [ + "Object", + "Behavior", + "=", + "max(0, Speed)" + ] } ] } @@ -6712,7 +9888,12 @@ "type": { "value": "SmoothCamera::SmoothCamera::SetPropertyUpwardSpeedMax" }, - "parameters": ["Object", "Behavior", "=", "max(0, Speed)"] + "parameters": [ + "Object", + "Behavior", + "=", + "max(0, Speed)" + ] } ] } @@ -6753,7 +9934,12 @@ "type": { "value": "SmoothCamera::SmoothCamera::SetPropertyDownwardSpeedMax" }, - "parameters": ["Object", "Behavior", "=", "max(0, Speed)"] + "parameters": [ + "Object", + "Behavior", + "=", + "max(0, Speed)" + ] } ] } @@ -7022,7 +10208,9 @@ "type": { "value": "SetReturnNumber" }, - "parameters": ["CameraOffsetX"] + "parameters": [ + "CameraOffsetX" + ] } ] } @@ -7060,7 +10248,12 @@ "type": { "value": "SmoothCamera::SmoothCamera::SetPropertyCameraOffsetX" }, - "parameters": ["Object", "Behavior", "=", "Value"] + "parameters": [ + "Object", + "Behavior", + "=", + "Value" + ] } ] } @@ -7156,7 +10349,9 @@ "type": { "value": "SetReturnNumber" }, - "parameters": ["CameraOffsetY"] + "parameters": [ + "CameraOffsetY" + ] } ] } @@ -7206,7 +10401,12 @@ "type": { "value": "SmoothCamera::SmoothCamera::SetPropertyCameraOffsetY" }, - "parameters": ["Object", "Behavior", "=", "Value"] + "parameters": [ + "Object", + "Behavior", + "=", + "Value" + ] } ] } @@ -7562,7 +10762,11 @@ "type": { "value": "SmoothCamera::SmoothCamera::IsWaiting" }, - "parameters": ["Object", "Behavior", ""] + "parameters": [ + "Object", + "Behavior", + "" + ] }, { "type": { @@ -7656,7 +10860,11 @@ "inverted": true, "value": "SmoothCamera::SmoothCamera::IsDelayed" }, - "parameters": ["Object", "Behavior", ""] + "parameters": [ + "Object", + "Behavior", + "" + ] } ], "actions": [ @@ -7688,13 +10896,21 @@ "type": { "value": "SmoothCamera::SmoothCamera::IsDelayed" }, - "parameters": ["Object", "Behavior", ""] + "parameters": [ + "Object", + "Behavior", + "" + ] }, { "type": { "value": "SmoothCamera::SmoothCamera::IsWaiting" }, - "parameters": ["Object", "Behavior", ""] + "parameters": [ + "Object", + "Behavior", + "" + ] } ] } @@ -7903,7 +11119,11 @@ "type": { "value": "SmoothCamera::SmoothCamera::IsWaiting" }, - "parameters": ["Object", "Behavior", ""] + "parameters": [ + "Object", + "Behavior", + "" + ] } ], "actions": [ @@ -7991,14 +11211,22 @@ "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": [ @@ -8006,19 +11234,28 @@ "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" + ] } ] }, @@ -8030,7 +11267,11 @@ "inverted": true, "value": "SmoothCamera::SmoothCamera::IsWaiting" }, - "parameters": ["Object", "Behavior", ""] + "parameters": [ + "Object", + "Behavior", + "" + ] }, { "type": { @@ -8080,13 +11321,22 @@ "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": [ @@ -8165,7 +11415,9 @@ "type": { "value": "SetReturnBoolean" }, - "parameters": ["True"] + "parameters": [ + "True" + ] } ] } @@ -8201,7 +11453,9 @@ "type": { "value": "SetReturnNumber" }, - "parameters": ["CameraDelay + CameraExtraDelay"] + "parameters": [ + "CameraDelay + CameraExtraDelay" + ] } ] } @@ -8252,7 +11506,9 @@ "type": { "value": "SetReturnBoolean" }, - "parameters": ["True"] + "parameters": [ + "True" + ] } ] } @@ -8294,13 +11550,23 @@ "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" + ] } ] } @@ -8515,13 +11781,23 @@ "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" + ] } ] } @@ -8545,13 +11821,23 @@ "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" + ] } ] }, @@ -8575,7 +11861,12 @@ "type": { "value": "SmoothCamera::SmoothCamera::SetPropertyIndex" }, - "parameters": ["Object", "Behavior", "+", "1"] + "parameters": [ + "Object", + "Behavior", + "+", + "1" + ] } ] }, @@ -8616,13 +11907,23 @@ "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" + ] } ] }, @@ -8646,7 +11947,12 @@ "type": { "value": "SmoothCamera::SmoothCamera::SetPropertyIndex" }, - "parameters": ["Object", "Behavior", "+", "1"] + "parameters": [ + "Object", + "Behavior", + "+", + "1" + ] } ] }, @@ -8716,25 +12022,45 @@ "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" + ] } ] }, @@ -8780,7 +12106,12 @@ "type": { "value": "SmoothCamera::SmoothCamera::SetPropertyIndex" }, - "parameters": ["Object", "Behavior", "+", "1"] + "parameters": [ + "Object", + "Behavior", + "+", + "1" + ] } ] }, @@ -9971,14 +13302,20 @@ "inverted": true, "value": "PlatformBehavior::IsJumping" }, - "parameters": ["Object", "PlatformerCharacter"] + "parameters": [ + "Object", + "PlatformerCharacter" + ] }, { "type": { "inverted": true, "value": "PlatformBehavior::IsFalling" }, - "parameters": ["Object", "PlatformerCharacter"] + "parameters": [ + "Object", + "PlatformerCharacter" + ] } ], "actions": [ @@ -10063,13 +13400,19 @@ "type": { "value": "PlatformBehavior::IsJumping" }, - "parameters": ["Object", "PlatformerCharacter"] + "parameters": [ + "Object", + "PlatformerCharacter" + ] }, { "type": { "value": "PlatformBehavior::IsFalling" }, - "parameters": ["Object", "PlatformerCharacter"] + "parameters": [ + "Object", + "PlatformerCharacter" + ] } ] } @@ -10178,7 +13521,9 @@ "label": "Smooth camera behavior", "description": "", "group": "", - "extraInformation": ["SmoothCamera::SmoothCamera"], + "extraInformation": [ + "SmoothCamera::SmoothCamera" + ], "name": "SmoothCamera" }, { @@ -10315,4 +13660,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 54f67baf4..b437acee8 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": "", + "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.4.0", + "version": "1.9.0", "description": [ - "Multitouch joysticks can be used the same way as physical gamepads:", + "Multitouch joysticks are objects showing a joystick on the screen, useful for mobile. They work like a physical gamepad:", "- 4 or 8 directions", "- Analogus pads", "- Player selection", - "- Controls mapping for top-down movement and platformer characters", + "- Automatic \"mapper\" behaviors for 2D and 3D movement behaviors (platformer characters, top-down movement, 3D character etc...). Add one of these to the object with the movement behavior (i.e: the player most of the time) and the behavior will then be controlled automatically by the virtual joystick (it works by reading the multitouch joystick state and simulating controls). No need for additional events to make it work once the behaviors are set up.", "", "There are ready-to-use joysticks in the asset-store [multitouch joysticks pack](https://editor.gdevelop.io/?initial-dialog=asset-store&asset-pack=multitouch-joysticks-multitouch-joysticks)." ], @@ -1597,153 +1597,33 @@ ], "eventsFunctions": [ { - "description": "Check if a button is pressed on a gamepad.", - "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": "StringVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Buttons[Button].State", - "=", - "\"Pressed\"" - ] - } - ], - "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 gamepad.", - "fullName": "Multitouch controller button released", + "description": "Check if the events are running for the editor.", + "fullName": "Editor is running", "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", + "name": "IsInGameEdition", "private": true, - "sentence": "Mark _PARAM2_ button as _PARAM3_ for multitouch controller _PARAM1_", + "sentence": "Events are running for the editor", "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" + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const game = runtimeScene.getGame();\r", + "eventsFunctionContext.returnValue = game.isInGameEdition && game.isInGameEdition();" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false } ], + "parameters": [], "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", + "fullName": "Accelerated speed", + "functionType": "Expression", + "name": "AcceleratedSpeed", "private": true, - "sentence": "Change the dead zone of multitouch joystick _PARAM2_ of multitouch controller _PARAM1_ to _PARAM3_", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -1754,1165 +1634,3504 @@ "value": "SetNumberVariable" }, "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].DeadZone", + "AcceleratedSpeed", "=", - "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" + "CurrentSpeed" ] } - ] - } - ], - "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": [ + ], + "events": [ { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "mod(round(Angle * 4 / 360), 4)" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Angle", - "name": "Angle", - "type": "expression" - } - ], - "objectGroups": [] - }, - { + "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", + "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, - "sentence": "The angle _PARAM1_ 8-way index", - "events": [ + "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": [] + }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ + "description": "the joystick force (from 0 to 1).", + "fullName": "Joystick force", + "functionType": "ExpressionAndCondition", + "name": "JoystickForce", + "sentence": "the joystick force", + "events": [ { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "mod(round(Angle * 8 / 360), 8)" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "max(0, JoystickForce - DeadZoneRadius) / (1 - DeadZoneRadius)" + ] + } ] } - ] - } - ], - "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": [ + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" + } + ], + "objectGroups": [] + }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "JoystickForce", + "name": "SetJoystickForce", + "private": true, + "sentence": "", + "events": [ { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Right\"" + "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" }, { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo4Way" - }, - "parameters": [ - "", - "=", - "0", - "Angle", - "" - ] + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" + }, + { + "description": "", + "name": "Parameter", + "type": "objectList" } ], - "actions": [ + "objectGroups": [] + }, + { + "description": "Return the angle the joystick is pointing towards (Range: -180 to 180).", + "fullName": "Joystick angle", + "functionType": "Expression", + "name": "JoystickAngle", + "sentence": "", + "events": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" + "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": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "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": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Down\"" + "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" }, { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo4Way" - }, - "parameters": [ - "", - "=", - "1", - "Angle", - "" - ] + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" + }, + { + "description": "Angle", + "name": "Value", + "type": "expression" } ], - "actions": [ + "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": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" + "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": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "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": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Left\"" + "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" }, { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo4Way" - }, - "parameters": [ - "", - "=", - "2", - "Angle", - "" + "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" + ] + } ] } ], - "actions": [ + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - }, - { - "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", - "" - ] + "description": "Direction", + "name": "Direction", + "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\"]", + "type": "stringWithSelector" } ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Angle", - "name": "Angle", - "type": "expression" + "objectGroups": [] }, { - "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\"" - ] - }, + "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": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "0", - "Angle", - "" + "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" + ] + } ] } ], - "actions": [ + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - }, - { - "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", - "" - ] + "description": "Direction", + "name": "Direction", + "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\",\"UpLeft\",\"UpRight\",\"DownLeft\",\"DownRight\"]", + "type": "stringWithSelector" } ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Down\"" - ] - }, + "description": "Check if a joystick is pressed.", + "fullName": "Joystick pressed", + "functionType": "Condition", + "name": "IsPressed", + "sentence": "Joystick _PARAM0_ is pressed", + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "2", - "Angle", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "!=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } ] } ], - "actions": [ + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } - ] + ], + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"DownLeft\"" - ] - }, + "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": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "3", - "Angle", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "0", + "" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "0" + ] + } ] } ], - "actions": [ + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } - ] + ], + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Left\"" - ] - }, + "description": "the multitouch controller identifier.", + "fullName": "Multitouch controller identifier", + "functionType": "ExpressionAndCondition", + "group": "Multitouch Joystick configuration", + "name": "ControllerIdentifier", + "sentence": "the multitouch controller identifier", + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "4", - "Angle", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "ControllerIdentifier" + ] + } ] } ], - "actions": [ + "expressionType": { + "type": "expression" + }, + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } - ] + ], + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"UpLeft\"" - ] - }, + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "ControllerIdentifier", + "name": "SetControllerIdentifier", + "sentence": "", + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "5", - "Angle", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "ControllerIdentifier", + "=", + "Value" + ] + } ] } ], - "actions": [ + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } - ] + ], + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Up\"" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "6", - "Angle", - "" + "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" + ] + } ] } ], - "actions": [ + "expressionType": { + "type": "string" + }, + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } - ] + ], + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "JoystickIdentifier", + "name": "SetJoystickIdentifier", + "sentence": "", + "events": [ { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"UpRight\"" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "JoystickIdentifier", + "=", + "Value" + ] + } ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" }, { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "7", - "Angle", - "" - ] + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } ], - "actions": [ + "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": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "DeadZoneRadius" + ] + } ] } - ] - } - ], - "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 + ], + "expressionType": { + "type": "expression" }, - "comment": "Make sure the joystick has moved from center" - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "parameters": [ { - "type": { - "value": "SpriteMultitouchJoystick::JoystickForce" - }, - "parameters": [ - "", - ">", - "0", - "ControllerIdentifier", - "JoystickIdentifier", - "" - ] + "description": "Object", + "name": "Object", + "type": "object" }, { - "type": { - "value": "SpriteMultitouchJoystick::IsAngleIn4WayDirection" - }, - "parameters": [ - "", - "SpriteMultitouchJoystick::JoystickAngle(ControllerIdentifier, JoystickIdentifier)", - "Direction", - "" - ] + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } ], - "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" + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "DeadZoneRadius", + "name": "SetDeadZoneRadius", + "sentence": "", + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::JoystickForce" - }, - "parameters": [ - "", - ">", - "0", - "ControllerIdentifier", - "JoystickIdentifier", - "" + "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" }, { - "type": { - "value": "SpriteMultitouchJoystick::IsAngleIn8WayDirection" - }, - "parameters": [ - "", - "SpriteMultitouchJoystick::JoystickAngle(ControllerIdentifier, JoystickIdentifier)", - "Direction", - "" - ] + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } ], - "actions": [ + "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": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" + "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": [] } ], - "parameters": [ + "propertyDescriptors": [ { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" + "value": "1", + "type": "Number", + "label": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier" }, { - "description": "Joystick name", - "name": "JoystickIdentifier", - "supplementaryInformation": "[\"Primary\",\"Secondary\"]", - "type": "stringWithSelector" + "value": "Primary", + "type": "String", + "label": "Joystick name", + "name": "JoystickIdentifier" }, { - "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": [ + "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" + }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier)" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ + "value": "0", + "type": "Number", + "label": "Joystick angle (range: -180 to 180)", + "hidden": true, + "name": "JoystickAngle" + }, { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" + "value": "0", + "type": "Number", + "label": "Joystick force (range: 0 to 1)", + "hidden": true, + "name": "JoystickForce" }, { - "description": "Joystick name", - "name": "JoystickIdentifier", - "supplementaryInformation": "[\"Primary\",\"Secondary\"]", - "type": "stringWithSelector" + "value": "0", + "type": "Number", + "label": "", + "hidden": true, + "name": "TouchId" + }, + { + "value": "", + "type": "Number", + "label": "", + "hidden": true, + "name": "TouchIndex" } ], - "objectGroups": [] + "sharedPropertyDescriptors": [] }, { - "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": [ + "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": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ + "fullName": "", + "functionType": "Action", + "name": "doStepPreEvents", + "sentence": "", + "events": [ { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "max(0, Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].Force - SpriteMultitouchJoystick::DeadZone(ControllerIdentifier, JoystickIdentifier)) / (1 - SpriteMultitouchJoystick::DeadZone(ControllerIdentifier, JoystickIdentifier))" + "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\"", + "" + ] + } ] - } - ] - } - ], - "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" + "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" + ] + } + ] + } + ] + } ] - } - ] - } - ], - "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)" + "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" + ] + } ] } - ] - } - ], - "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": [ + ], + "parameters": [ { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].Angle" - ] + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "type": "behavior" } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" + ], + "objectGroups": [] }, { - "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": [ + "description": "Check if the button was just pressed.", + "fullName": "Button just pressed", + "functionType": "Condition", + "name": "IsJustPressed", + "sentence": "Button _PARAM0_ was just pressed", + "events": [ { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].Angle", - "=", - "Value" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } ] } - ] - } - ], - "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": [ + ], + "parameters": [ { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "SpriteMultitouchJoystick::JoystickForce(ControllerIdentifier, JoystickIdentifier) * cos(ToRad(SpriteMultitouchJoystick::JoystickAngle(ControllerIdentifier, JoystickIdentifier)))" - ] + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "type": "behavior" } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" + ], + "objectGroups": [] }, { - "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": "Check if the button is pressed.", + "fullName": "Button pressed", + "functionType": "Condition", + "name": "IsPressed", + "sentence": "Button _PARAM0_ is pressed", + "events": [ { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "SpriteMultitouchJoystick::JoystickForce(ControllerIdentifier, JoystickIdentifier) * sin(ToRad(SpriteMultitouchJoystick::JoystickAngle(ControllerIdentifier, JoystickIdentifier)))" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "!=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } ] } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "type": "behavior" + } + ], + "objectGroups": [] }, { - "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": "", + "description": "Check if the button is released.", + "fullName": "Button released", + "functionType": "Condition", + "name": "IsReleased", + "sentence": "Button _PARAM0_ is released", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ + "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::SetDeadZone" + "value": "BooleanVariable" }, "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "DeadZoneRadius", + "IsReleased", + "True", "" ] - }, + } + ], + "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" + "value": "SetReturnBoolean" }, "parameters": [ - "Object", - "Behavior", - "" + "True" ] } ] @@ -2927,17 +5146,18 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", "type": "behavior" } ], "objectGroups": [] }, { - "fullName": "", + "fullName": "Button state", "functionType": "Action", - "name": "onDeActivate", - "sentence": "", + "name": "SetButtonState", + "private": true, + "sentence": "Mark the button _PARAM0_ as _PARAM2_", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -2945,11 +5165,13 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" + "value": "SpriteMultitouchJoystick::SetButtonState" }, "parameters": [ - "Object", - "Behavior", + "", + "ControllerIdentifier", + "ButtonIdentifier", + "ButtonState", "" ] } @@ -2965,12 +5187,78 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "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", @@ -2982,220 +5270,148 @@ "conditions": [ { "type": { - "value": "HasGameJustResumed" + "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": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" + "value": "PlatformBehavior::SimulateJumpKey" }, "parameters": [ "Object", - "Behavior", - "" + "Property" ] } ] - }, - { - "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": "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": "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": [ @@ -3207,130 +5423,140 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::PlatformerMultitouchMapper", "type": "behavior" } ], "objectGroups": [] - }, + } + ], + "propertyDescriptors": [ { - "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)" - ] - } - ] - } + "value": "", + "type": "Behavior", + "label": "Platform character behavior", + "extraInformation": [ + "PlatformBehavior::PlatformerObjectBehavior" ], - "expressionType": { - "type": "expression" - }, - "parameters": [ + "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": "Object", - "name": "Object", - "type": "object" + "label": "Primary", + "value": "Primary" }, { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" + "label": "Secondary", + "value": "Secondary" } ], - "objectGroups": [] + "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": "ActionWithOperator", - "getterName": "JoystickForce", - "name": "SetJoystickForce", - "private": true, + "functionType": "Action", + "name": "doStepPreEvents", "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::StickForce" + }, + "parameters": [ + "", + ">", + "0", + "ControllerIdentifier", + "JoystickIdentifier", + "" + ] + } + ], "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickForce" + "value": "Physics3D::PhysicsCharacter3D::SetForwardAngle" }, "parameters": [ "Object", - "Behavior", + "PhysicsCharacter3D", "=", - "Value" + "SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier) + CameraAngle(Object.Layer())" ] }, { "type": { - "value": "SpriteMultitouchJoystick::SetJoystickForce" + "value": "Physics3D::PhysicsCharacter3D::SimulateStick" }, "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "JoystickForce", - "" + "Object", + "PhysicsCharacter3D", + "-90", + "SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier)" ] } ] - } - ], - "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": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::IsButtonPressed" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JumpButton", + "\"Down\"" + ] + } + ], "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" }, "parameters": [ - "JoystickAngle" + "Object", + "PhysicsCharacter3D" ] } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -3340,95 +5566,129 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::Platformer3DMultitouchMapper", "type": "behavior" } ], "objectGroups": [] + } + ], + "propertyDescriptors": [ + { + "value": "", + "type": "Behavior", + "label": "3D physics character", + "extraInformation": [ + "Physics3D::PhysicsCharacter3D" + ], + "choices": [], + "name": "PhysicsCharacter3D" }, { - "description": "Change the angle the joystick is pointing towards (Range: -180 to 180).", - "fullName": "Joystick angle", + "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": "SetJoystickAngle", - "private": true, - "sentence": "Change the joystick angle of _PARAM0_ to _PARAM2_", + "name": "doStepPreEvents", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ + "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickAngle" + "value": "SpriteMultitouchJoystick::StickForce" }, "parameters": [ - "Object", - "Behavior", - "=", - "Value" + "", + ">", + "0", + "ControllerIdentifier", + "JoystickIdentifier", + "" ] - }, + } + ], + "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::SetJoystickAngle" + "value": "Physics3D::PhysicsCharacter3D::SimulateStick" }, "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "JoystickAngle", - "" + "Object", + "PhysicsCharacter3D", + "SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier)", + "SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier)" ] } ] - } - ], - "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": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::IsButtonPressed" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JumpButton", + "\"Down\"" + ] + } + ], "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" }, "parameters": [ - "Object.Behavior::JoystickForce() * cos(ToRad(Object.Behavior::JoystickAngle()))" + "Object", + "PhysicsCharacter3D" ] } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -3438,93 +5698,146 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "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" }, { - "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", + "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": "SetReturnNumber" + "value": "SetNumberVariable" }, "parameters": [ - "Object.Behavior::JoystickForce() * sin(ToRad(Object.Behavior::JoystickAngle()))" + "CurrentRotationSpeedZ", + "=", + "SpriteMultitouchJoystick::AcceleratedSpeed(CurrentRotationSpeedZ, SpriteMultitouchJoystick::StickForceX(ControllerIdentifier, CameraStick) * HorizontalRotationSpeedMax, HorizontalRotationSpeedMax, HorizontalRotationAcceleration, HorizontalRotationDeceleration)" ] - } - ] - } - ], - "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" + "value": "SetAngle" }, "parameters": [ "Object", - "Behavior", - ">", - "0", - "" + "+", + "CurrentRotationSpeedZ * TimeDelta()" ] }, { "type": { - "value": "SpriteMultitouchJoystick::IsAngleIn4WayDirection" + "value": "SetNumberVariable" }, "parameters": [ - "", - "JoystickAngle", - "Direction", - "" + "CurrentRotationSpeedY", + "=", + "SpriteMultitouchJoystick::AcceleratedSpeed(CurrentRotationSpeedY, SpriteMultitouchJoystick::StickForceY(ControllerIdentifier, CameraStick) * VerticalRotationSpeedMax, VerticalRotationSpeedMax, VerticalRotationAcceleration, VerticalRotationDeceleration)" ] - } - ], - "actions": [ + }, { "type": { - "value": "SetReturnBoolean" + "value": "Scene3D::Base3DBehavior::SetRotationY" }, "parameters": [ - "True" + "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", + "" ] } ] @@ -3539,59 +5852,83 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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_", + "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": [ + "conditions": [], + "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::JoystickForce" + "value": "CentreCamera" }, "parameters": [ + "", "Object", - "Behavior", - ">", - "0", + "", + "Object.Layer()", "" ] }, { "type": { - "value": "SpriteMultitouchJoystick::IsAngleIn8WayDirection" + "value": "Scene3D::SetCameraZ" }, "parameters": [ "", - "JoystickAngle", - "Direction", + "=", + "Object.Object3D::Z() + Object.Object3D::Depth() + OffsetZ", + "", "" ] - } - ], - "actions": [ + }, { "type": { - "value": "SetReturnBoolean" + "value": "Scene3D::SetCameraRotationX" }, "parameters": [ - "True" + "", + "=", + "- 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()", + "" ] } ] @@ -3606,52 +5943,38 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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", + "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": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::PropertyTouchId" - }, - "parameters": [ - "Object", - "Behavior", - "!=", - "0" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "SetReturnBoolean" + "value": "SetReturnNumber" }, "parameters": [ - "True" + "HorizontalRotationSpeedMax" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -3661,19 +5984,18 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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_", + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "HorizontalRotationSpeedMax", + "name": "SetHorizontalRotationSpeedMax", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -3681,25 +6003,12 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "0", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyTouchId" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "HorizontalRotationSpeedMax", "=", - "0" + "Value" ] } ] @@ -3714,19 +6023,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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", + "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", @@ -3737,7 +6046,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "ControllerIdentifier" + "HorizontalRotationAcceleration" ] } ] @@ -3755,7 +6064,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], @@ -3764,8 +6073,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "ControllerIdentifier", - "name": "SetControllerIdentifier", + "getterName": "HorizontalRotationAcceleration", + "name": "SetHorizontalRotationAcceleration", "sentence": "", "events": [ { @@ -3774,11 +6083,10 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyControllerIdentifier" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "HorizontalRotationAcceleration", "=", "Value" ] @@ -3795,19 +6103,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the joystick name.", - "fullName": "Joystick name", + "description": "the horizontal rotation deceleration of the object.", + "fullName": "Horizontal rotation deceleration", "functionType": "ExpressionAndCondition", - "group": "Multitouch Joystick configuration", - "name": "JoystickIdentifier", - "sentence": "the joystick name", + "group": "First person camera multitouch controller mapper horizontal rotation configuration", + "name": "HorizontalRotationDeceleration", + "sentence": "the horizontal rotation deceleration", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -3815,17 +6123,17 @@ "actions": [ { "type": { - "value": "SetReturnString" + "value": "SetReturnNumber" }, "parameters": [ - "JoystickIdentifier" + "HorizontalRotationDeceleration" ] } ] } ], "expressionType": { - "type": "string" + "type": "expression" }, "parameters": [ { @@ -3836,7 +6144,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], @@ -3845,8 +6153,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "JoystickIdentifier", - "name": "SetJoystickIdentifier", + "getterName": "HorizontalRotationDeceleration", + "name": "SetHorizontalRotationDeceleration", "sentence": "", "events": [ { @@ -3855,11 +6163,10 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickIdentifier" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "HorizontalRotationDeceleration", "=", "Value" ] @@ -3876,19 +6183,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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", + "description": "the maximum vertical rotation speed of the object.", + "fullName": "Maximum vertical rotation speed", "functionType": "ExpressionAndCondition", - "group": "Multitouch Joystick configuration", - "name": "DeadZoneRadius", - "sentence": "the dead zone radius", + "group": "First person camera multitouch controller mapper vertical rotation configuration", + "name": "VerticalRotationSpeedMax", + "sentence": "the maximum vertical rotation speed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -3899,7 +6206,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "DeadZoneRadius" + "VerticalRotationSpeedMax" ] } ] @@ -3917,7 +6224,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], @@ -3926,8 +6233,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "DeadZoneRadius", - "name": "SetDeadZoneRadius", + "getterName": "VerticalRotationSpeedMax", + "name": "SetVerticalRotationSpeedMax", "sentence": "", "events": [ { @@ -3936,11 +6243,10 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyDeadZoneRadius" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "VerticalRotationSpeedMax", "=", "Value" ] @@ -3957,271 +6263,232 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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": "Action", - "name": "doStepPreEvents", - "sentence": "", + "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": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::IsReleased" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - } - ], - "actions": [ - { - "type": { - "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": [], + "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": [ + "conditions": [], + "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::IsPressed" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", - "" + "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": "HasTouchEnded" + "value": "SetReturnNumber" }, "parameters": [ - "", - "TouchId" + "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": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", - "\"Released\"", - "" + "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": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyIsReleased" + "value": "SetReturnNumber" }, "parameters": [ - "Object", - "Behavior", - "yes" + "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": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchId" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "VerticalAngleMin", "=", - "0" + "Value" ] } ] @@ -4236,39 +6503,72 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], "objectGroups": [] }, { - "description": "Check if button is released.", - "fullName": "Button released", - "functionType": "Condition", - "name": "IsReleased", - "sentence": "Button _PARAM0_ is released", + "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": [ + "conditions": [], + "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::PropertyIsReleased" + "value": "SetReturnNumber" }, "parameters": [ - "Object", - "Behavior" + "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": "SetReturnBoolean" + "value": "SetNumberVariable" }, "parameters": [ - "True" + "VerticalAngleMax", + "=", + "Value" ] } ] @@ -4283,46 +6583,38 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], "objectGroups": [] - }, - { - "description": "Check if button is pressed.", - "fullName": "Button pressed", - "functionType": "Condition", - "name": "IsPressed", - "sentence": "Button _PARAM0_ is pressed", + }, + { + "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": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::PropertyTouchId" - }, - "parameters": [ - "Object", - "Behavior", - "!=", - "0" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "SetReturnBoolean" + "value": "SetReturnNumber" }, "parameters": [ - "True" + "OffsetZ" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -4332,18 +6624,18 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], "objectGroups": [] }, { - "fullName": "Button state", - "functionType": "Action", - "name": "SetButtonState", - "private": true, - "sentence": "Mark the button _PARAM0_ as _PARAM2_", + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "OffsetZ", + "name": "SetOffsetZ", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -4351,14 +6643,12 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::SetButtonState" + "value": "SetNumberVariable" }, "parameters": [ - "", - "ControllerIdentifier", - "ButtonIdentifier", - "ButtonState", - "" + "OffsetZ", + "=", + "Value" ] } ] @@ -4373,61 +6663,140 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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": "Multitouch controller identifier (1, 2, 3, 4...)", + "label": "Controller identifier (1, 2, 3, 4...)", "name": "ControllerIdentifier" }, { - "value": "A", - "type": "String", - "label": "Button identifier", - "name": "ButtonIdentifier" + "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", - "label": "TouchID", - "hidden": true, - "name": "TouchId" + "unit": "Pixel", + "label": "Z position offset", + "group": "Position", + "name": "OffsetZ" }, { - "value": "", + "value": "0", "type": "Number", - "label": "", + "unit": "AngularSpeed", + "label": "Current rotation speed Z", "hidden": true, - "name": "TouchIndex" + "name": "CurrentRotationSpeedZ" }, { - "value": "", - "type": "Boolean", - "label": "Button released", + "value": "0", + "type": "Number", + "unit": "AngularSpeed", + "label": "Current rotation speed Y", "hidden": true, - "name": "IsReleased" + "name": "CurrentRotationSpeedY" } ], "sharedPropertyDescriptors": [] }, { - "description": "Control a platformer character with a multitouch controller.", - "fullName": "Platformer multitouch controller mapper", - "name": "PlatformerMultitouchMapper", + "description": "Control a 3D physics car with a multitouch controller.", + "fullName": "3D car multitouch controller mapper", + "name": "PhysicsCar3DMultitouchMapper", "objectType": "", + "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -4440,69 +6809,14 @@ "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" + "value": "SpriteMultitouchJoystick::StickForce" }, "parameters": [ "", + ">", + "0", "ControllerIdentifier", - "JoystickIdentifier", - "\"Up\"", + "SteerJoystickIdentifier", "" ] } @@ -4510,20 +6824,12 @@ "actions": [ { "type": { - "value": "PlatformBehavior::SimulateUpKey" - }, - "parameters": [ - "Object", - "Property" - ] - }, - { - "type": { - "value": "PlatformBehavior::SimulateLadderKey" + "value": "Physics3D::PhysicsCar3D::SimulateSteeringStick" }, "parameters": [ "Object", - "Property" + "PhysicsCar3D", + "SpriteMultitouchJoystick::StickForceX(ControllerIdentifier, \"Primary\")" ] } ] @@ -4533,13 +6839,14 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" + "value": "SpriteMultitouchJoystick::StickForce" }, "parameters": [ "", + ">", + "0", "ControllerIdentifier", - "JoystickIdentifier", - "\"Down\"", + "SpeedJoystickIdentifier", "" ] } @@ -4547,11 +6854,12 @@ "actions": [ { "type": { - "value": "PlatformBehavior::SimulateDownKey" + "value": "Physics3D::PhysicsCar3D::SimulateAcceleratorStick" }, "parameters": [ "Object", - "Property" + "PhysicsCar3D", + "-SpriteMultitouchJoystick::StickForceY(ControllerIdentifier, \"Secondary\")" ] } ] @@ -4566,7 +6874,7 @@ "parameters": [ "", "ControllerIdentifier", - "JumpButton", + "HandBrakeButton", "\"Down\"" ] } @@ -4574,11 +6882,11 @@ "actions": [ { "type": { - "value": "PlatformBehavior::SimulateJumpKey" + "value": "Physics3D::PhysicsCar3D::SimulateHandBrakeKey" }, "parameters": [ "Object", - "Property" + "PhysicsCar3D" ] } ] @@ -4593,7 +6901,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::PlatformerMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::PhysicsCar3DMultitouchMapper", "type": "behavior" } ], @@ -4604,12 +6912,12 @@ { "value": "", "type": "Behavior", - "label": "Platform character behavior", + "label": "3D physics car", "extraInformation": [ - "PlatformBehavior::PlatformerObjectBehavior" + "Physics3D::PhysicsCar3D" ], "choices": [], - "name": "Property" + "name": "PhysicsCar3D" }, { "value": "1", @@ -4620,7 +6928,7 @@ { "value": "Primary", "type": "Choice", - "label": "Joystick name", + "label": "Steer joystick", "group": "Controls", "choices": [ { @@ -4632,14 +6940,31 @@ "value": "Secondary" } ], - "name": "JoystickIdentifier" + "name": "SteerJoystickIdentifier" }, { - "value": "A", + "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": "Jump button name", + "label": "Hand brake button name", "group": "Controls", - "name": "JumpButton" + "name": "HandBrakeButton" } ], "sharedPropertyDescriptors": [] @@ -4649,6 +6974,7 @@ "fullName": "Top-down multitouch controller mapper", "name": "TopDownMultitouchMapper", "objectType": "", + "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -4661,11 +6987,10 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "StickMode", "=", "\"Analog\"" ] @@ -4690,11 +7015,10 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "StickMode", "=", "\"360°\"" ] @@ -4719,11 +7043,10 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "StickMode", "=", "\"8 Directions\"" ] @@ -5450,17 +7773,90 @@ "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ + "conditions": [ { "type": { - "value": "MettreAutour" + "inverted": true, + "value": "SpriteMultitouchJoystick::IsInGameEdition" }, "parameters": [ - "Thumb", - "Border", - "Border.MultitouchJoystick::JoystickForce() * Border.Width() / 2", - "Border.MultitouchJoystick::JoystickAngle()" + "", + "" + ] + } + ], + "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", + "" + ] + } ] } ] @@ -5528,7 +7924,7 @@ "Border", "MultitouchJoystick", "=", - "Object.PropertyControllerIdentifier()", + "ControllerIdentifier", "" ] }, @@ -5540,7 +7936,7 @@ "Border", "MultitouchJoystick", "=", - "Object.PropertyJoystickIdentifier()", + "JoystickIdentifier", "" ] }, @@ -5552,7 +7948,92 @@ "Border", "MultitouchJoystick", "=", - "Object.PropertyDeadZoneRadius()", + "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)", "" ] } @@ -5569,6 +8050,92 @@ ], "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", @@ -5582,10 +8149,12 @@ { "type": { "inverted": true, - "value": "GetArgumentAsBoolean" + "value": "BooleanVariable" }, "parameters": [ - "\"ShouldActivate\"" + "ShouldActivate", + "True", + "" ] } ], @@ -5607,10 +8176,12 @@ "conditions": [ { "type": { - "value": "GetArgumentAsBoolean" + "value": "BooleanVariable" }, "parameters": [ - "\"ShouldActivate\"" + "ShouldActivate", + "True", + "" ] } ], @@ -6284,9 +8855,15 @@ "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 2719f407c..763ed9f58 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": "", + "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.4.0", + "version": "1.9.0", "description": [ - "Multitouch joysticks can be used the same way as physical gamepads:", + "Multitouch joysticks are objects showing a joystick on the screen, useful for mobile. They work like a physical gamepad:", "- 4 or 8 directions", "- Analogus pads", "- Player selection", - "- Controls mapping for top-down movement and platformer characters", + "- Automatic \"mapper\" behaviors for 2D and 3D movement behaviors (platformer characters, top-down movement, 3D character etc...). Add one of these to the object with the movement behavior (i.e: the player most of the time) and the behavior will then be controlled automatically by the virtual joystick (it works by reading the multitouch joystick state and simulating controls). No need for additional events to make it work once the behaviors are set up.", "", "There are ready-to-use joysticks in the asset-store [multitouch joysticks pack](https://editor.gdevelop.io/?initial-dialog=asset-store&asset-pack=multitouch-joysticks-multitouch-joysticks)." ], @@ -4102,153 +4102,33 @@ ], "eventsFunctions": [ { - "description": "Check if a button is pressed on a gamepad.", - "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": "StringVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Buttons[Button].State", - "=", - "\"Pressed\"" - ] - } - ], - "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 gamepad.", - "fullName": "Multitouch controller button released", + "description": "Check if the events are running for the editor.", + "fullName": "Editor is running", "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", + "name": "IsInGameEdition", "private": true, - "sentence": "Mark _PARAM2_ button as _PARAM3_ for multitouch controller _PARAM1_", + "sentence": "Events are running for the editor", "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" + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const game = runtimeScene.getGame();\r", + "eventsFunctionContext.returnValue = game.isInGameEdition && game.isInGameEdition();" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false } ], + "parameters": [], "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", + "fullName": "Accelerated speed", + "functionType": "Expression", + "name": "AcceleratedSpeed", "private": true, - "sentence": "Change the dead zone of multitouch joystick _PARAM2_ of multitouch controller _PARAM1_ to _PARAM3_", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -4259,1203 +4139,3781 @@ "value": "SetNumberVariable" }, "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].DeadZone", + "AcceleratedSpeed", "=", - "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)" + "CurrentSpeed" ] } - ] - } - ], - "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": [ + ], + "events": [ { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ + "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": [ + ] + } + ], + "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": "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": [ + "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": [] + }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "description": "Return the angle the joystick is pointing towards (Range: -180 to 180).", + "fullName": "Joystick angle", + "functionType": "Expression", + "name": "JoystickAngle", + "sentence": "", + "events": [ { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Right\"" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "JoystickAngle" + ] + } ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" }, { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo4Way" - }, - "parameters": [ - "", - "=", - "0", - "Angle", - "" + "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", + "" + ] + } ] } ], - "actions": [ + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" + "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": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "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": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Down\"" + "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" }, { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo4Way" - }, - "parameters": [ - "", - "=", - "1", - "Angle", - "" + "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" + ] + } ] } ], - "actions": [ + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" + }, { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "description": "Direction", + "name": "Direction", + "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\"]", + "type": "stringWithSelector" } - ] + ], + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Left\"" - ] - }, + "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": { - "value": "SpriteMultitouchJoystick::AngleTo4Way" - }, - "parameters": [ - "", - "=", - "2", - "Angle", - "" + "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" + ] + } ] } ], - "actions": [ + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - }, - { - "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", - "" - ] + "description": "Direction", + "name": "Direction", + "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\",\"UpLeft\",\"UpRight\",\"DownLeft\",\"DownRight\"]", + "type": "stringWithSelector" } ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Angle", - "name": "Angle", - "type": "expression" + "objectGroups": [] }, { - "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": [ + "description": "Check if a joystick is pressed.", + "fullName": "Joystick pressed", + "functionType": "Condition", + "name": "IsPressed", + "sentence": "Joystick _PARAM0_ is pressed", + "events": [ { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Right\"" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "!=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" }, { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "0", - "Angle", - "" - ] + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } ], - "actions": [ + "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": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "0", + "" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "0" + ] + } ] } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + ], + "parameters": [ { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"DownRight\"" - ] + "description": "Object", + "name": "Object", + "type": "object" }, { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "1", - "Angle", - "" - ] + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Down\"" - ] - }, + "description": "the multitouch controller identifier.", + "fullName": "Multitouch controller identifier", + "functionType": "ExpressionAndCondition", + "group": "Multitouch Joystick configuration", + "name": "ControllerIdentifier", + "sentence": "the multitouch controller identifier", + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "2", - "Angle", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "ControllerIdentifier" + ] + } ] } ], - "actions": [ + "expressionType": { + "type": "expression" + }, + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } - ] + ], + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"DownLeft\"" - ] - }, + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "ControllerIdentifier", + "name": "SetControllerIdentifier", + "sentence": "", + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "3", - "Angle", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "ControllerIdentifier", + "=", + "Value" + ] + } ] } ], - "actions": [ + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } - ] + ], + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Left\"" - ] - }, + "description": "the joystick name.", + "fullName": "Joystick name", + "functionType": "ExpressionAndCondition", + "group": "Multitouch Joystick configuration", + "name": "JoystickIdentifier", + "sentence": "the joystick name", + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "4", - "Angle", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnString" + }, + "parameters": [ + "JoystickIdentifier" + ] + } ] } ], - "actions": [ + "expressionType": { + "type": "string" + }, + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } - ] + ], + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"UpLeft\"" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "5", - "Angle", - "" + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "JoystickIdentifier", + "name": "SetJoystickIdentifier", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "JoystickIdentifier", + "=", + "Value" + ] + } ] } ], - "actions": [ + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } - ] + ], + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Up\"" - ] - }, + "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": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "6", - "Angle", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "DeadZoneRadius" + ] + } ] } ], - "actions": [ + "expressionType": { + "type": "expression" + }, + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } - ] + ], + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"UpRight\"" - ] - }, + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "DeadZoneRadius", + "name": "SetDeadZoneRadius", + "sentence": "", + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "7", - "Angle", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "DeadZoneRadius", + "=", + "Value" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::SetDeadZone" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JoystickIdentifier", + "Value", + "" + ] + } ] } ], - "actions": [ + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } - ] - } - ], - "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" + ], + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::JoystickForce" - }, - "parameters": [ - "", - ">", - "0", - "ControllerIdentifier", - "JoystickIdentifier", - "" - ] - }, + "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": { - "value": "SpriteMultitouchJoystick::IsAngleIn4WayDirection" - }, - "parameters": [ - "", - "SpriteMultitouchJoystick::JoystickAngle(ControllerIdentifier, JoystickIdentifier)", - "Direction", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "Value" + ] + } ] } ], - "actions": [ + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" + }, + { + "description": "Touch identifier", + "name": "Value", + "type": "expression" } - ] + ], + "objectGroups": [] } ], - "parameters": [ + "propertyDescriptors": [ { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" + "value": "1", + "type": "Number", + "label": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier" }, { - "description": "Joystick name", - "name": "JoystickIdentifier", - "supplementaryInformation": "[\"Primary\",\"Secondary\"]", - "type": "stringWithSelector" + "value": "Primary", + "type": "String", + "label": "Joystick name", + "name": "JoystickIdentifier" }, { - "description": "Direction", - "name": "Direction", - "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\"]", - "type": "stringWithSelector" + "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" } ], - "objectGroups": [] + "sharedPropertyDescriptors": [] }, { - "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" - }, + "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": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "fullName": "", + "functionType": "Action", + "name": "doStepPreEvents", + "sentence": "", + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::JoystickForce" - }, - "parameters": [ - "", - ">", - "0", - "ControllerIdentifier", - "JoystickIdentifier", - "" + "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": { - "value": "SpriteMultitouchJoystick::IsAngleIn8WayDirection" - }, - "parameters": [ - "", - "SpriteMultitouchJoystick::JoystickAngle(ControllerIdentifier, JoystickIdentifier)", - "Direction", - "" + "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" + ] + } ] } ], - "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": [ + "parameters": [ { - "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": [ + "description": "Object", + "name": "Object", + "type": "object" + }, { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "max(0, Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].Force - SpriteMultitouchJoystick::DeadZone(ControllerIdentifier, JoystickIdentifier)) / (1 - SpriteMultitouchJoystick::DeadZone(ControllerIdentifier, JoystickIdentifier))" - ] + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "type": "behavior" } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" + ], + "objectGroups": [] }, { - "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": [ + "description": "Check if the button was just pressed.", + "fullName": "Button just pressed", + "functionType": "Condition", + "name": "IsJustPressed", + "sentence": "Button _PARAM0_ was just pressed", + "events": [ { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].Force", - "=", - "Value" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } ] } - ] - } - ], - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" - }, - { - "description": "Joystick name", - "name": "JoystickIdentifier", - "type": "string" + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "type": "behavior" + } + ], + "objectGroups": [] }, { - "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": [ + "description": "Check if the button is pressed.", + "fullName": "Button pressed", + "functionType": "Condition", + "name": "IsPressed", + "sentence": "Button _PARAM0_ is pressed", + "events": [ { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier)" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "!=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } ] } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "type": "behavior" + } + ], + "objectGroups": [] }, { - "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": "Check if the button is released.", + "fullName": "Button released", + "functionType": "Condition", + "name": "IsReleased", + "sentence": "Button _PARAM0_ is released", + "events": [ { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].Angle" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsReleased", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } ] } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "type": "behavior" + } + ], + "objectGroups": [] }, { - "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": [ + "fullName": "Button state", + "functionType": "Action", + "name": "SetButtonState", + "private": true, + "sentence": "Mark the button _PARAM0_ as _PARAM2_", + "events": [ { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].Angle", - "=", - "Value" + "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": [] } ], - "parameters": [ + "propertyDescriptors": [ { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" + "value": "1", + "type": "Number", + "label": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier" }, { - "description": "Joystick name", - "name": "JoystickIdentifier", - "type": "string" + "value": "A", + "type": "String", + "label": "Button identifier", + "name": "ButtonIdentifier" }, { - "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": [ - "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" + "value": "0", + "type": "Number", + "label": "TouchID", + "hidden": true, + "name": "TouchId" }, { - "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": [ + "value": "", + "type": "Number", + "label": "", + "hidden": true, + "name": "TouchIndex" + }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "SpriteMultitouchJoystick::JoystickForce(ControllerIdentifier, JoystickIdentifier) * sin(ToRad(SpriteMultitouchJoystick::JoystickAngle(ControllerIdentifier, JoystickIdentifier)))" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ + "value": "", + "type": "Boolean", + "label": "Button released", + "hidden": true, + "name": "IsReleased" + }, { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" + "value": "", + "type": "Boolean", + "label": "Button just pressed", + "hidden": true, + "name": "IsJustPressed" }, { - "description": "Joystick name", - "name": "JoystickIdentifier", - "supplementaryInformation": "[\"Primary\",\"Secondary\"]", - "type": "stringWithSelector" + "value": "0", + "type": "Number", + "unit": "Pixel", + "label": "Triggering circle radius", + "description": "This circle adds up to the object collision mask.", + "name": "Radius" } ], - "objectGroups": [] - } - ], - "eventsBasedBehaviors": [ + "sharedPropertyDescriptors": [] + }, { - "description": "Joystick that can be controlled by interacting with a touchscreen.", - "fullName": "Multitouch Joystick", - "name": "MultitouchJoystick", + "description": "Control a platformer character with a multitouch controller.", + "fullName": "Platformer multitouch controller mapper", + "name": "PlatformerMultitouchMapper", "objectType": "", - "private": true, + "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", "functionType": "Action", - "name": "onCreated", + "name": "doStepPreEvents", "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ + "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::SetDeadZone" + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" }, "parameters": [ "", "ControllerIdentifier", "JoystickIdentifier", - "DeadZoneRadius", + "\"Left\"", "" ] - }, + } + ], + "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" + "value": "PlatformBehavior::SimulateLeftKey" }, "parameters": [ "Object", - "Behavior", + "Property" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JoystickIdentifier", + "\"Right\"", "" ] } + ], + "actions": [ + { + "type": { + "value": "PlatformBehavior::SimulateRightKey" + }, + "parameters": [ + "Object", + "Property" + ] + } ] - } - ], - "parameters": [ + }, { - "description": "Object", - "name": "Object", - "type": "object" + "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" + ] + } + ] }, { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "Action", - "name": "onDeActivate", - "sentence": "", - "events": [ + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JoystickIdentifier", + "\"Down\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "PlatformBehavior::SimulateDownKey" + }, + "parameters": [ + "Object", + "Property" + ] + } + ] + }, { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::IsButtonPressed" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JumpButton", + "\"Down\"" + ] + } + ], "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" + "value": "PlatformBehavior::SimulateJumpKey" }, "parameters": [ "Object", - "Behavior", - "" + "Property" ] } ] @@ -5470,12 +7928,64 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::PlatformerMultitouchMapper", "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", @@ -5487,262 +7997,71 @@ "conditions": [ { "type": { - "value": "HasGameJustResumed" + "value": "SpriteMultitouchJoystick::StickForce" }, "parameters": [ + "", + ">", + "0", + "ControllerIdentifier", + "JoystickIdentifier", "" ] } ], "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": "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 - }, - "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)", - "" - ] - } + { + "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)" ] } - ], - "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": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::IsButtonPressed" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JumpButton", + "\"Down\"" + ] + } + ], "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" }, "parameters": [ - "max(0, JoystickForce - DeadZoneRadius) / (1 - DeadZoneRadius)" + "Object", + "PhysicsCharacter3D" ] } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -5752,45 +8071,124 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "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": "ActionWithOperator", - "getterName": "JoystickForce", - "name": "SetJoystickForce", - "private": true, + "functionType": "Action", + "name": "doStepPreEvents", "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::StickForce" + }, + "parameters": [ + "", + ">", + "0", + "ControllerIdentifier", + "JoystickIdentifier", + "" + ] + } + ], "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickForce" + "value": "Physics3D::PhysicsCharacter3D::SimulateStick" }, "parameters": [ "Object", - "Behavior", - "=", - "Value" + "PhysicsCharacter3D", + "SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier)", + "SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier)" ] - }, + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::SetJoystickForce" + "value": "SpriteMultitouchJoystick::IsButtonPressed" }, "parameters": [ "", "ControllerIdentifier", - "JoystickIdentifier", - "JoystickForce", - "" + "JumpButton", + "\"Down\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" + }, + "parameters": [ + "Object", + "PhysicsCharacter3D" ] } ] @@ -5805,37 +8203,151 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::Shooter3DMultitouchMapper", "type": "behavior" } ], "objectGroups": [] + } + ], + "propertyDescriptors": [ + { + "value": "", + "type": "Behavior", + "label": "3D physics character", + "extraInformation": [ + "Physics3D::PhysicsCharacter3D" + ], + "choices": [], + "name": "PhysicsCharacter3D" }, { - "description": "Return the angle the joystick is pointing towards (Range: -180 to 180).", - "fullName": "Joystick angle", - "functionType": "Expression", - "name": "JoystickAngle", + "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": "SetReturnNumber" + "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": [ - "JoystickAngle" + "Object", + "Behavior", + "" ] } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -5845,19 +8357,20 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], "objectGroups": [] }, { - "description": "Change the angle the joystick is pointing towards (Range: -180 to 180).", - "fullName": "Joystick angle", + "description": "Move the camera to look though _PARAM1_ eyes. The object must look to the right when all its angles are 0 and the top of its head be toward Z+.", + "fullName": "Look through object eyes", "functionType": "Action", - "name": "SetJoystickAngle", + "group": "Layers and cameras", + "name": "LookFromObjectEyes", "private": true, - "sentence": "Change the joystick angle of _PARAM0_ to _PARAM2_", + "sentence": "Move the camera to look though _PARAM0_ eyes", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -5865,24 +8378,61 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickAngle" + "value": "CentreCamera" }, "parameters": [ + "", "Object", - "Behavior", + "", + "Object.Layer()", + "" + ] + }, + { + "type": { + "value": "Scene3D::SetCameraZ" + }, + "parameters": [ + "", "=", - "Value" + "Object.Object3D::Z() + Object.Object3D::Depth() + OffsetZ", + "", + "" ] }, { "type": { - "value": "SpriteMultitouchJoystick::SetJoystickAngle" + "value": "Scene3D::SetCameraRotationX" }, "parameters": [ "", - "ControllerIdentifier", - "JoystickIdentifier", - "JoystickAngle", + "=", + "- 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()", "" ] } @@ -5898,23 +8448,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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": "", + "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", @@ -5925,7 +8471,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "Object.Behavior::JoystickForce() * cos(ToRad(Object.Behavior::JoystickAngle()))" + "HorizontalRotationSpeedMax" ] } ] @@ -5943,17 +8489,17 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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", + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "HorizontalRotationSpeedMax", + "name": "SetHorizontalRotationSpeedMax", "sentence": "", "events": [ { @@ -5962,18 +8508,17 @@ "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "SetNumberVariable" }, "parameters": [ - "Object.Behavior::JoystickForce() * sin(ToRad(Object.Behavior::JoystickAngle()))" + "HorizontalRotationSpeedMax", + "=", + "Value" ] } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -5983,58 +8528,38 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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_", + "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": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::JoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - ">", - "0", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::IsAngleIn4WayDirection" - }, - "parameters": [ - "", - "JoystickAngle", - "Direction", - "" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "SetReturnBoolean" + "value": "SetReturnNumber" }, "parameters": [ - "True" + "HorizontalRotationAcceleration" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -6044,59 +8569,31 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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_", + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "HorizontalRotationAcceleration", + "name": "SetHorizontalRotationAcceleration", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::JoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - ">", - "0", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::IsAngleIn8WayDirection" - }, - "parameters": [ - "", - "JoystickAngle", - "Direction", - "" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "SetReturnBoolean" + "value": "SetNumberVariable" }, "parameters": [ - "True" + "HorizontalRotationAcceleration", + "=", + "Value" ] } ] @@ -6111,52 +8608,38 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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", + "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": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::PropertyTouchId" - }, - "parameters": [ - "Object", - "Behavior", - "!=", - "0" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "SetReturnBoolean" + "value": "SetReturnNumber" }, "parameters": [ - "True" + "HorizontalRotationDeceleration" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -6166,19 +8649,18 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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_", + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "HorizontalRotationDeceleration", + "name": "SetHorizontalRotationDeceleration", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -6186,25 +8668,12 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "0", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyTouchId" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "HorizontalRotationDeceleration", "=", - "0" + "Value" ] } ] @@ -6219,19 +8688,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the multitouch controller identifier.", - "fullName": "Multitouch controller identifier", + "description": "the maximum vertical rotation speed of the object.", + "fullName": "Maximum vertical rotation speed", "functionType": "ExpressionAndCondition", - "group": "Multitouch Joystick configuration", - "name": "ControllerIdentifier", - "sentence": "the multitouch controller identifier", + "group": "First person camera multitouch controller mapper vertical rotation configuration", + "name": "VerticalRotationSpeedMax", + "sentence": "the maximum vertical rotation speed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -6242,7 +8711,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "ControllerIdentifier" + "VerticalRotationSpeedMax" ] } ] @@ -6260,7 +8729,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], @@ -6269,8 +8738,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "ControllerIdentifier", - "name": "SetControllerIdentifier", + "getterName": "VerticalRotationSpeedMax", + "name": "SetVerticalRotationSpeedMax", "sentence": "", "events": [ { @@ -6279,11 +8748,10 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyControllerIdentifier" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "VerticalRotationSpeedMax", "=", "Value" ] @@ -6300,19 +8768,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the joystick name.", - "fullName": "Joystick name", + "description": "the vertical rotation acceleration of the object.", + "fullName": "Vertical rotation acceleration", "functionType": "ExpressionAndCondition", - "group": "Multitouch Joystick configuration", - "name": "JoystickIdentifier", - "sentence": "the joystick name", + "group": "First person camera multitouch controller mapper vertical rotation configuration", + "name": "VerticalRotationAcceleration", + "sentence": "the vertical rotation acceleration", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -6320,17 +8788,17 @@ "actions": [ { "type": { - "value": "SetReturnString" + "value": "SetReturnNumber" }, "parameters": [ - "JoystickIdentifier" + "VerticalRotationAcceleration" ] } ] } ], "expressionType": { - "type": "string" + "type": "expression" }, "parameters": [ { @@ -6341,7 +8809,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], @@ -6350,8 +8818,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "JoystickIdentifier", - "name": "SetJoystickIdentifier", + "getterName": "VerticalRotationAcceleration", + "name": "SetVerticalRotationAcceleration", "sentence": "", "events": [ { @@ -6360,11 +8828,10 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickIdentifier" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "VerticalRotationAcceleration", "=", "Value" ] @@ -6381,19 +8848,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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", + "description": "the vertical rotation deceleration of the object.", + "fullName": "Vertical rotation deceleration", "functionType": "ExpressionAndCondition", - "group": "Multitouch Joystick configuration", - "name": "DeadZoneRadius", - "sentence": "the dead zone radius", + "group": "First person camera multitouch controller mapper vertical rotation configuration", + "name": "VerticalRotationDeceleration", + "sentence": "the vertical rotation deceleration", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -6404,7 +8871,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "DeadZoneRadius" + "VerticalRotationDeceleration" ] } ] @@ -6422,7 +8889,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], @@ -6431,8 +8898,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "DeadZoneRadius", - "name": "SetDeadZoneRadius", + "getterName": "VerticalRotationDeceleration", + "name": "SetVerticalRotationDeceleration", "sentence": "", "events": [ { @@ -6441,11 +8908,10 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyDeadZoneRadius" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "VerticalRotationDeceleration", "=", "Value" ] @@ -6462,271 +8928,72 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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": "Action", - "name": "doStepPreEvents", - "sentence": "", + "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": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::IsReleased" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyIsReleased" - }, - "parameters": [ - "Object", - "Behavior", - "no" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + "value": "SetReturnNumber" }, "parameters": [ - "Object", - "Behavior", - "\"Idle\"", - "" + "VerticalAngleMin" ] } ] - }, + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ { - "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" - ] - } - ] - } - ] - } - ] + "description": "Object", + "name": "Object", + "type": "object" }, { - "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" - ] - }, + "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": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchId" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "VerticalAngleMin", "=", - "0" + "Value" ] } ] @@ -6741,44 +9008,38 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], "objectGroups": [] }, { - "description": "Check if button is released.", - "fullName": "Button released", - "functionType": "Condition", - "name": "IsReleased", - "sentence": "Button _PARAM0_ is released", + "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": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::PropertyIsReleased" - }, - "parameters": [ - "Object", - "Behavior" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "SetReturnBoolean" + "value": "SetReturnNumber" }, "parameters": [ - "True" + "VerticalAngleMax" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -6788,46 +9049,77 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], "objectGroups": [] }, { - "description": "Check if button is pressed.", - "fullName": "Button pressed", - "functionType": "Condition", - "name": "IsPressed", - "sentence": "Button _PARAM0_ is pressed", + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "VerticalAngleMax", + "name": "SetVerticalAngleMax", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "conditions": [], + "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::PropertyTouchId" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", - "!=", - "0" + "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": "SetReturnBoolean" + "value": "SetReturnNumber" }, "parameters": [ - "True" + "OffsetZ" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -6837,18 +9129,18 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], "objectGroups": [] }, { - "fullName": "Button state", - "functionType": "Action", - "name": "SetButtonState", - "private": true, - "sentence": "Mark the button _PARAM0_ as _PARAM2_", + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "OffsetZ", + "name": "SetOffsetZ", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -6856,14 +9148,12 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::SetButtonState" + "value": "SetNumberVariable" }, "parameters": [ - "", - "ControllerIdentifier", - "ButtonIdentifier", - "ButtonState", - "" + "OffsetZ", + "=", + "Value" ] } ] @@ -6878,61 +9168,140 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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": "Multitouch controller identifier (1, 2, 3, 4...)", + "label": "Controller identifier (1, 2, 3, 4...)", "name": "ControllerIdentifier" }, { - "value": "A", - "type": "String", - "label": "Button identifier", - "name": "ButtonIdentifier" + "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", - "label": "TouchID", - "hidden": true, - "name": "TouchId" + "unit": "Pixel", + "label": "Z position offset", + "group": "Position", + "name": "OffsetZ" }, { - "value": "", + "value": "0", "type": "Number", - "label": "", + "unit": "AngularSpeed", + "label": "Current rotation speed Z", "hidden": true, - "name": "TouchIndex" + "name": "CurrentRotationSpeedZ" }, { - "value": "", - "type": "Boolean", - "label": "Button released", + "value": "0", + "type": "Number", + "unit": "AngularSpeed", + "label": "Current rotation speed Y", "hidden": true, - "name": "IsReleased" + "name": "CurrentRotationSpeedY" } ], "sharedPropertyDescriptors": [] }, { - "description": "Control a platformer character with a multitouch controller.", - "fullName": "Platformer multitouch controller mapper", - "name": "PlatformerMultitouchMapper", + "description": "Control a 3D physics car with a multitouch controller.", + "fullName": "3D car multitouch controller mapper", + "name": "PhysicsCar3DMultitouchMapper", "objectType": "", + "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -6945,69 +9314,14 @@ "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" + "value": "SpriteMultitouchJoystick::StickForce" }, "parameters": [ "", + ">", + "0", "ControllerIdentifier", - "JoystickIdentifier", - "\"Up\"", + "SteerJoystickIdentifier", "" ] } @@ -7015,20 +9329,12 @@ "actions": [ { "type": { - "value": "PlatformBehavior::SimulateUpKey" - }, - "parameters": [ - "Object", - "Property" - ] - }, - { - "type": { - "value": "PlatformBehavior::SimulateLadderKey" + "value": "Physics3D::PhysicsCar3D::SimulateSteeringStick" }, "parameters": [ "Object", - "Property" + "PhysicsCar3D", + "SpriteMultitouchJoystick::StickForceX(ControllerIdentifier, \"Primary\")" ] } ] @@ -7038,13 +9344,14 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" + "value": "SpriteMultitouchJoystick::StickForce" }, "parameters": [ "", + ">", + "0", "ControllerIdentifier", - "JoystickIdentifier", - "\"Down\"", + "SpeedJoystickIdentifier", "" ] } @@ -7052,11 +9359,12 @@ "actions": [ { "type": { - "value": "PlatformBehavior::SimulateDownKey" + "value": "Physics3D::PhysicsCar3D::SimulateAcceleratorStick" }, "parameters": [ "Object", - "Property" + "PhysicsCar3D", + "-SpriteMultitouchJoystick::StickForceY(ControllerIdentifier, \"Secondary\")" ] } ] @@ -7071,7 +9379,7 @@ "parameters": [ "", "ControllerIdentifier", - "JumpButton", + "HandBrakeButton", "\"Down\"" ] } @@ -7079,11 +9387,11 @@ "actions": [ { "type": { - "value": "PlatformBehavior::SimulateJumpKey" + "value": "Physics3D::PhysicsCar3D::SimulateHandBrakeKey" }, "parameters": [ "Object", - "Property" + "PhysicsCar3D" ] } ] @@ -7098,7 +9406,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::PlatformerMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::PhysicsCar3DMultitouchMapper", "type": "behavior" } ], @@ -7109,12 +9417,12 @@ { "value": "", "type": "Behavior", - "label": "Platform character behavior", + "label": "3D physics car", "extraInformation": [ - "PlatformBehavior::PlatformerObjectBehavior" + "Physics3D::PhysicsCar3D" ], "choices": [], - "name": "Property" + "name": "PhysicsCar3D" }, { "value": "1", @@ -7125,7 +9433,7 @@ { "value": "Primary", "type": "Choice", - "label": "Joystick name", + "label": "Steer joystick", "group": "Controls", "choices": [ { @@ -7137,14 +9445,31 @@ "value": "Secondary" } ], - "name": "JoystickIdentifier" + "name": "SteerJoystickIdentifier" }, { - "value": "A", + "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": "Jump button name", + "label": "Hand brake button name", "group": "Controls", - "name": "JumpButton" + "name": "HandBrakeButton" } ], "sharedPropertyDescriptors": [] @@ -7154,6 +9479,7 @@ "fullName": "Top-down multitouch controller mapper", "name": "TopDownMultitouchMapper", "objectType": "", + "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -7166,11 +9492,10 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "StickMode", "=", "\"Analog\"" ] @@ -7195,11 +9520,10 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "StickMode", "=", "\"360°\"" ] @@ -7224,11 +9548,10 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "StickMode", "=", "\"8 Directions\"" ] @@ -7837,7 +10160,6 @@ } ], "instances": [], - "editionSettings": {}, "eventsFunctions": [ { "fullName": "", @@ -7956,17 +10278,90 @@ "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ + "conditions": [ { "type": { - "value": "MettreAutour" + "inverted": true, + "value": "SpriteMultitouchJoystick::IsInGameEdition" }, "parameters": [ - "Thumb", - "Border", - "Border.MultitouchJoystick::JoystickForce() * Border.Width() / 2", - "Border.MultitouchJoystick::JoystickAngle()" + "", + "" + ] + } + ], + "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", + "" + ] + } ] } ] @@ -8034,7 +10429,7 @@ "Border", "MultitouchJoystick", "=", - "Object.PropertyControllerIdentifier()", + "ControllerIdentifier", "" ] }, @@ -8046,7 +10441,7 @@ "Border", "MultitouchJoystick", "=", - "Object.PropertyJoystickIdentifier()", + "JoystickIdentifier", "" ] }, @@ -8058,7 +10453,92 @@ "Border", "MultitouchJoystick", "=", - "Object.PropertyDeadZoneRadius()", + "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)", "" ] } @@ -8075,6 +10555,92 @@ ], "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", @@ -8088,10 +10654,12 @@ { "type": { "inverted": true, - "value": "GetArgumentAsBoolean" + "value": "BooleanVariable" }, "parameters": [ - "\"ShouldActivate\"" + "ShouldActivate", + "True", + "" ] } ], @@ -8113,10 +10681,12 @@ "conditions": [ { "type": { - "value": "GetArgumentAsBoolean" + "value": "BooleanVariable" }, "parameters": [ - "\"ShouldActivate\"" + "ShouldActivate", + "True", + "" ] } ], @@ -8790,9 +11360,15 @@ "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 04fc4045b..49dfaf35d 100644 --- a/examples/starting-top-down/starting-top-down.json +++ b/examples/starting-top-down/starting-top-down.json @@ -923,18 +923,19 @@ "category": "Input", "extensionNamespace": "", "fullName": "Multitouch joystick and buttons (sprite)", + "gdevelopVersion": ">=5.5.222", "helpPath": "/objects/multitouch-joystick", "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyMy4wLjMsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iSWNvbnMiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB2aWV3Qm94PSIwIDAgMzIgMzIiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDMyIDMyOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8c3R5bGUgdHlwZT0idGV4dC9jc3MiPg0KCS5zdDB7ZmlsbDpub25lO3N0cm9rZTojMDAwMDAwO3N0cm9rZS13aWR0aDoyO3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1saW5lam9pbjpyb3VuZDtzdHJva2UtbWl0ZXJsaW1pdDoxMDt9DQo8L3N0eWxlPg0KPGNpcmNsZSBjbGFzcz0ic3QwIiBjeD0iMTYiIGN5PSIxNiIgcj0iMTMiLz4NCjxwb2x5bGluZSBjbGFzcz0ic3QwIiBwb2ludHM9IjI4LjQsMTIgMjAsMTIgMjAsMy42ICIvPg0KPHBvbHlsaW5lIGNsYXNzPSJzdDAiIHBvaW50cz0iMjAsMjguNCAyMCwyMCAyOC40LDIwICIvPg0KPHBvbHlsaW5lIGNsYXNzPSJzdDAiIHBvaW50cz0iMy42LDIwIDEyLDIwIDEyLDI4LjQgIi8+DQo8cG9seWxpbmUgY2xhc3M9InN0MCIgcG9pbnRzPSIxMiwzLjYgMTIsMTIgMy42LDEyICIvPg0KPHBvbHlnb24gY2xhc3M9InN0MCIgcG9pbnRzPSIxNiw2IDE2LjcsNyAxNS4zLDcgIi8+DQo8cG9seWdvbiBjbGFzcz0ic3QwIiBwb2ludHM9IjE2LDI2IDE1LjMsMjUgMTYuNywyNSAiLz4NCjxwb2x5Z29uIGNsYXNzPSJzdDAiIHBvaW50cz0iNiwxNiA3LDE1LjMgNywxNi43ICIvPg0KPHBvbHlnb24gY2xhc3M9InN0MCIgcG9pbnRzPSIyNiwxNiAyNSwxNi43IDI1LDE1LjMgIi8+DQo8L3N2Zz4NCg==", "name": "SpriteMultitouchJoystick", "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/Line Hero Pack/Master/SVG/Videogames/Videogames_controller_joystick_arrows_direction.svg", "shortDescription": "Joysticks or buttons for touchscreens.", - "version": "1.4.0", + "version": "1.9.0", "description": [ - "Multitouch joysticks can be used the same way as physical gamepads:", + "Multitouch joysticks are objects showing a joystick on the screen, useful for mobile. They work like a physical gamepad:", "- 4 or 8 directions", "- Analogus pads", "- Player selection", - "- Controls mapping for top-down movement and platformer characters", + "- Automatic \"mapper\" behaviors for 2D and 3D movement behaviors (platformer characters, top-down movement, 3D character etc...). Add one of these to the object with the movement behavior (i.e: the player most of the time) and the behavior will then be controlled automatically by the virtual joystick (it works by reading the multitouch joystick state and simulating controls). No need for additional events to make it work once the behaviors are set up.", "", "There are ready-to-use joysticks in the asset-store [multitouch joysticks pack](https://editor.gdevelop.io/?initial-dialog=asset-store&asset-pack=multitouch-joysticks-multitouch-joysticks)." ], @@ -999,153 +1000,33 @@ ], "eventsFunctions": [ { - "description": "Check if a button is pressed on a gamepad.", - "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": "StringVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Buttons[Button].State", - "=", - "\"Pressed\"" - ] - } - ], - "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 gamepad.", - "fullName": "Multitouch controller button released", + "description": "Check if the events are running for the editor.", + "fullName": "Editor is running", "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", + "name": "IsInGameEdition", "private": true, - "sentence": "Mark _PARAM2_ button as _PARAM3_ for multitouch controller _PARAM1_", + "sentence": "Events are running for the editor", "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" + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const game = runtimeScene.getGame();\r", + "eventsFunctionContext.returnValue = game.isInGameEdition && game.isInGameEdition();" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false } ], + "parameters": [], "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", + "fullName": "Accelerated speed", + "functionType": "Expression", + "name": "AcceleratedSpeed", "private": true, - "sentence": "Change the dead zone of multitouch joystick _PARAM2_ of multitouch controller _PARAM1_ to _PARAM3_", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -1156,212 +1037,425 @@ "value": "SetNumberVariable" }, "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].DeadZone", + "AcceleratedSpeed", "=", - "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)" + "CurrentSpeed" ] } - ] - } - ], - "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": [ + ], + "events": [ { - "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": "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": "SpriteMultitouchJoystick::AngleTo4Way" - }, - "parameters": [ - "", - "=", - "0", - "Angle", - "" + "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())" + ] + } + ] + } ] - } - ], - "actions": [ + }, { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" + "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": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Down\"" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo4Way" + "value": "StringVariable" }, "parameters": [ - "", + "Controllers[ControllerIdentifier].Buttons[Button].State", "=", - "1", - "Angle", - "" + "\"JustPressed\"" ] } ], @@ -1375,30 +1469,59 @@ ] } ] + } + ], + "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::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Left\"" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo4Way" + "value": "BuiltinCommonInstructions::Or" }, - "parameters": [ - "", - "=", - "2", - "Angle", - "" + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"Pressed\"" + ] + }, + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"JustPressed\"" + ] + } ] } ], @@ -1412,30 +1535,41 @@ ] } ] + } + ], + "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": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Up\"" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo4Way" + "value": "StringVariable" }, "parameters": [ - "", + "Controllers[ControllerIdentifier].Buttons[Button].State", "=", - "3", - "Angle", - "" + "\"Released\"" ] } ], @@ -1453,64 +1587,227 @@ ], "parameters": [ { - "description": "Angle", - "name": "Angle", + "description": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier", "type": "expression" }, { - "description": "Direction", - "name": "Direction", - "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\"]", - "type": "stringWithSelector" + "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 angle is in a given direction.", - "fullName": "Angle 8-way direction", - "functionType": "Condition", - "name": "IsAngleIn8WayDirection", + "description": "Change a button state for a multitouch controller.", + "fullName": "Button state", + "functionType": "Action", + "name": "SetButtonState", "private": true, - "sentence": "The angle _PARAM1_ is the 8-way direction _PARAM2_", + "sentence": "Mark _PARAM2_ button as _PARAM3_ for multitouch controller _PARAM1_", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "conditions": [], + "actions": [ { "type": { - "value": "BuiltinCommonInstructions::CompareStrings" + "value": "SetStringVariable" }, "parameters": [ - "Direction", + "Controllers[ControllerIdentifier].Buttons[Button].State", "=", - "\"Right\"" + "ButtonState" ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "0", - "Angle", - "" + } + ] + } + ], + "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": "SetReturnBoolean" + "value": "SetReturnNumber" }, "parameters": [ - "True" + "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": [ @@ -1521,17 +1818,17 @@ "parameters": [ "Direction", "=", - "\"DownRight\"" + "\"Right\"" ] }, { "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" + "value": "SpriteMultitouchJoystick::AngleTo4Way" }, "parameters": [ "", "=", - "1", + "0", "Angle", "" ] @@ -1563,12 +1860,12 @@ }, { "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" + "value": "SpriteMultitouchJoystick::AngleTo4Way" }, "parameters": [ "", "=", - "2", + "1", "Angle", "" ] @@ -1595,17 +1892,17 @@ "parameters": [ "Direction", "=", - "\"DownLeft\"" + "\"Left\"" ] }, { "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" + "value": "SpriteMultitouchJoystick::AngleTo4Way" }, "parameters": [ "", "=", - "3", + "2", "Angle", "" ] @@ -1632,17 +1929,17 @@ "parameters": [ "Direction", "=", - "\"Left\"" + "\"Up\"" ] }, { "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" + "value": "SpriteMultitouchJoystick::AngleTo4Way" }, "parameters": [ "", "=", - "4", + "3", "Angle", "" ] @@ -1658,7 +1955,31 @@ ] } ] + } + ], + "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": [ @@ -1669,7 +1990,7 @@ "parameters": [ "Direction", "=", - "\"UpLeft\"" + "\"Right\"" ] }, { @@ -1679,7 +2000,7 @@ "parameters": [ "", "=", - "5", + "0", "Angle", "" ] @@ -1706,7 +2027,7 @@ "parameters": [ "Direction", "=", - "\"Up\"" + "\"DownRight\"" ] }, { @@ -1716,7 +2037,7 @@ "parameters": [ "", "=", - "6", + "1", "Angle", "" ] @@ -1743,7 +2064,7 @@ "parameters": [ "Direction", "=", - "\"UpRight\"" + "\"Down\"" ] }, { @@ -1753,7 +2074,7 @@ "parameters": [ "", "=", - "7", + "2", "Angle", "" ] @@ -1769,26 +2090,211 @@ ] } ] - } - ], - "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)", + "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_", @@ -1983,6 +2489,11 @@ "name": "JoystickIdentifier", "supplementaryInformation": "[\"Primary\",\"Secondary\"]", "type": "stringWithSelector" + }, + { + "description": "", + "name": "Coucou", + "type": "expression" } ], "objectGroups": [] @@ -2212,7 +2723,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "SpriteMultitouchJoystick::JoystickForce(ControllerIdentifier, JoystickIdentifier) * cos(ToRad(SpriteMultitouchJoystick::JoystickAngle(ControllerIdentifier, JoystickIdentifier)))" + "XFromAngleAndDistance(SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier), SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier))" ] } ] @@ -2252,7 +2763,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "SpriteMultitouchJoystick::JoystickForce(ControllerIdentifier, JoystickIdentifier) * sin(ToRad(SpriteMultitouchJoystick::JoystickAngle(ControllerIdentifier, JoystickIdentifier)))" + "YFromAngleAndDistance(SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier), SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier))" ] } ] @@ -2275,57 +2786,174 @@ } ], "objectGroups": [] - } - ], - "eventsBasedBehaviors": [ + }, { - "description": "Joystick that can be controlled by interacting with a touchscreen.", - "fullName": "Multitouch Joystick", - "name": "MultitouchJoystick", - "objectType": "", - "private": true, - "eventsFunctions": [ + "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": [ { - "fullName": "", - "functionType": "Action", - "name": "onCreated", - "sentence": "", + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "HasAnyTouchOrMouseStarted" + }, + "parameters": [ + "" + ] + } + ], + "actions": [], "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ + "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::SetDeadZone" + "value": "StringVariable" }, "parameters": [ - "", - "ControllerIdentifier", - "JoystickIdentifier", - "DeadZoneRadius", - "" + "Side", + "=", + "\"Left\"" ] }, { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" + "value": "TouchX" }, "parameters": [ - "Object", - "Behavior", + "", + "StartedTouchOrMouseId(0)", + "<", + "CameraCenterX(Object.Layer())", + "Object.Layer()", "" ] } - ] - } - ], - "parameters": [ - { - "description": "Object", - "name": "Object", - "type": "object" - }, + ], + "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", @@ -2384,41 +3012,23 @@ "conditions": [ { "type": { - "value": "HasGameJustResumed" + "inverted": true, + "value": "SpriteMultitouchJoystick::IsInGameEdition" }, "parameters": [ + "", "" ] } ], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - } - ] - }, - { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Manage touches", - "source": "", - "type": "BuiltinCommonInstructions::Group", + "actions": [], "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "value": "HasAnyTouchOrMouseStarted" + "value": "HasGameJustResumed" }, "parameters": [ "" @@ -2428,176 +3038,207 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyTouchIndex" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" }, "parameters": [ "Object", "Behavior", - "=", - "0" + "" ] } - ], + ] + }, + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Manage touches", + "source": "", + "type": "BuiltinCommonInstructions::Group", "events": [ { - "type": "BuiltinCommonInstructions::Repeat", - "repeatExpression": "StartedTouchOrMouseCount()", - "conditions": [], - "actions": [], + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "HasAnyTouchOrMouseStarted" + }, + "parameters": [ + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchIndex", + "=", + "0" + ] + } + ], "events": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "StartedTouchOrMouseCount()", + "conditions": [], + "actions": [], + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::PropertyTouchId" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "0" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "0" + ] + }, + { + "type": { + "value": "CollisionPoint" + }, + "parameters": [ + "Object", + "TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)", + "TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "StartedTouchOrMouseId(TouchIndex)" + ] + } ] }, { - "type": { - "value": "CollisionPoint" - }, - "parameters": [ - "Object", - "TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)", - "TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)" - ] - } - ], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyTouchId" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "StartedTouchOrMouseId(TouchIndex)" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyTouchIndex" - }, - "parameters": [ - "Object", - "Behavior", - "+", - "1" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchIndex", + "+", + "1" + ] + } ] } ] } ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 - }, - "comment": "Move thumb back to center when not being pressed (acts like a spring on a real controller)" - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + }, { - "type": { - "value": "HasTouchEnded" - }, - "parameters": [ - "", - "TouchId" - ] - } - ], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 }, - "parameters": [ - "Object", - "Behavior", - "" - ] - } - ] - } - ], - "parameters": [] - }, - { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Update joystick position", - "source": "", - "type": "BuiltinCommonInstructions::Group", - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "comment": "Move thumb back to center when not being pressed (acts like a spring on a real controller)" + }, { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::PropertyTouchId" - }, - "parameters": [ - "Object", - "Behavior", - "!=", - "0" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "HasTouchEnded" + }, + "parameters": [ + "", + "TouchId" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } ] } ], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickAngle" - }, - "parameters": [ - "Object", - "Behavior", - "AngleBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0))", - "AngleBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0))" - ] - }, + "parameters": [] + }, + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Update joystick position", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "clamp(2 * DistanceBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0)) / Object.Width(), 0, 1)", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "!=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickAngle" + }, + "parameters": [ + "Object", + "Behavior", + "AngleBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0))", + "AngleBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0))" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "clamp(2 * DistanceBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0)) / Object.Width(), 0, 1)", + "" + ] + } ] } - ] + ], + "parameters": [] } - ], - "parameters": [] + ] } ], "parameters": [ @@ -2669,11 +3310,10 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickForce" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "JoystickForce", "=", "Value" ] @@ -2704,6 +3344,11 @@ "name": "Behavior", "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" + }, + { + "description": "", + "name": "Parameter", + "type": "objectList" } ], "objectGroups": [] @@ -2762,11 +3407,10 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickAngle" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "JoystickAngle", "=", "Value" ] @@ -3032,11 +3676,10 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::PropertyTouchId" + "value": "NumberVariable" }, "parameters": [ - "Object", - "Behavior", + "TouchId", "!=", "0" ] @@ -3095,11 +3738,10 @@ }, { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyTouchId" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "TouchId", "=", "0" ] @@ -3176,11 +3818,10 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyControllerIdentifier" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "ControllerIdentifier", "=", "Value" ] @@ -3257,11 +3898,10 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickIdentifier" + "value": "SetStringVariable" }, "parameters": [ - "Object", - "Behavior", + "JoystickIdentifier", "=", "Value" ] @@ -3338,11 +3978,61 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyDeadZoneRadius" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "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" ] @@ -3361,6 +4051,11 @@ "name": "Behavior", "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", "type": "behavior" + }, + { + "description": "Touch identifier", + "name": "Value", + "type": "expression" } ], "objectGroups": [] @@ -3371,18 +4066,12 @@ "value": "1", "type": "Number", "label": "Multitouch controller identifier (1, 2, 3, 4...)", - "description": "", - "group": "", - "extraInformation": [], "name": "ControllerIdentifier" }, { "value": "Primary", "type": "String", "label": "Joystick name", - "description": "", - "group": "", - "extraInformation": [], "name": "JoystickIdentifier" }, { @@ -3390,17 +4079,12 @@ "type": "Number", "label": "Dead zone radius (range: 0 to 1)", "description": "The deadzone is an area for which movement on sticks won't be taken into account (instead, the stick will be considered as not moved)", - "group": "", - "extraInformation": [], "name": "DeadZoneRadius" }, { "value": "0", "type": "Number", "label": "Joystick angle (range: -180 to 180)", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "JoystickAngle" }, @@ -3408,9 +4092,6 @@ "value": "0", "type": "Number", "label": "Joystick force (range: 0 to 1)", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "JoystickForce" }, @@ -3418,9 +4099,6 @@ "value": "0", "type": "Number", "label": "", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "TouchId" }, @@ -3428,9 +4106,6 @@ "value": "", "type": "Number", "label": "", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "TouchIndex" } @@ -3438,7 +4113,7 @@ "sharedPropertyDescriptors": [] }, { - "description": "Detect button presses made on a touchscreen.", + "description": "Detect presses made on a touchscreen on the object so it acts like a button and automatically trigger the button having the same identifier for the mapper behaviors.", "fullName": "Multitouch button", "name": "MultitouchButton", "objectType": "", @@ -3454,11 +4129,11 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::IsReleased" + "value": "BooleanVariable" }, "parameters": [ - "Object", - "Behavior", + "IsReleased", + "True", "" ] } @@ -3466,12 +4141,50 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyIsReleased" + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsReleased", + "False", + "" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" }, "parameters": [ "Object", "Behavior", - "no" + "\"Idle\"", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "False", + "" ] }, { @@ -3481,7 +4194,7 @@ "parameters": [ "Object", "Behavior", - "\"Idle\"", + "\"Pressed\"", "" ] } @@ -3513,11 +4226,10 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchIndex" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "TouchIndex", "=", "0" ] @@ -3535,23 +4247,40 @@ "conditions": [ { "type": { - "value": "CollisionPoint" + "value": "BuiltinCommonInstructions::Or" }, - "parameters": [ - "Object", - "TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)", - "TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)" + "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": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchId" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "TouchId", "=", "StartedTouchOrMouseId(TouchIndex)" ] @@ -3563,7 +4292,17 @@ "parameters": [ "Object", "Behavior", - "\"Pressed\"", + "\"JustPressed\"", + "" + ] + }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "True", "" ] } @@ -3575,11 +4314,10 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchIndex" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "TouchIndex", "+", "1" ] @@ -3627,21 +4365,30 @@ }, { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyIsReleased" + "value": "SetBooleanVariable" }, "parameters": [ - "Object", - "Behavior", - "yes" + "IsReleased", + "True", + "" ] }, { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchId" + "value": "SetBooleanVariable" }, "parameters": [ - "Object", - "Behavior", + "IsJustPressed", + "False", + "" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchId", "=", "0" ] @@ -3665,22 +4412,23 @@ "objectGroups": [] }, { - "description": "Check if button is released.", - "fullName": "Button released", + "description": "Check if the button was just pressed.", + "fullName": "Button just pressed", "functionType": "Condition", - "name": "IsReleased", - "sentence": "Button _PARAM0_ is released", + "name": "IsJustPressed", + "sentence": "Button _PARAM0_ was just pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::PropertyIsReleased" + "value": "BooleanVariable" }, "parameters": [ - "Object", - "Behavior" + "IsJustPressed", + "True", + "" ] } ], @@ -3712,7 +4460,7 @@ "objectGroups": [] }, { - "description": "Check if button is pressed.", + "description": "Check if the button is pressed.", "fullName": "Button pressed", "functionType": "Condition", "name": "IsPressed", @@ -3723,11 +4471,10 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::PropertyTouchId" + "value": "NumberVariable" }, "parameters": [ - "Object", - "Behavior", + "TouchId", "!=", "0" ] @@ -3760,6 +4507,54 @@ ], "objectGroups": [] }, + { + "description": "Check if the button is released.", + "fullName": "Button released", + "functionType": "Condition", + "name": "IsReleased", + "sentence": "Button _PARAM0_ is released", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsReleased", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "type": "behavior" + } + ], + "objectGroups": [] + }, { "fullName": "Button state", "functionType": "Action", @@ -3801,7 +4596,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"JustPressed\",\"Pressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -3813,27 +4608,18 @@ "value": "1", "type": "Number", "label": "Multitouch controller identifier (1, 2, 3, 4...)", - "description": "", - "group": "", - "extraInformation": [], "name": "ControllerIdentifier" }, { "value": "A", "type": "String", "label": "Button identifier", - "description": "", - "group": "", - "extraInformation": [], "name": "ButtonIdentifier" }, { "value": "0", "type": "Number", "label": "TouchID", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "TouchId" }, @@ -3841,9 +4627,6 @@ "value": "", "type": "Number", "label": "", - "description": "", - "group": "", - "extraInformation": [], "hidden": true, "name": "TouchIndex" }, @@ -3851,11 +4634,23 @@ "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": [] @@ -3865,6 +4660,7 @@ "fullName": "Platformer multitouch controller mapper", "name": "PlatformerMultitouchMapper", "objectType": "", + "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -4030,7 +4826,2057 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::PlatformerMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::PlatformerMultitouchMapper", + "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": "", + "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\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" + }, + "parameters": [ + "Object", + "PhysicsCharacter3D" + ] + } + ] + } + ], + "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" + }, + "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\"" + ] + } + ], + "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" } ], @@ -4041,537 +6887,377 @@ { "value": "", "type": "Behavior", - "label": "Platform character behavior", - "description": "", - "group": "", + "label": "Top-down movement behavior", "extraInformation": [ - "PlatformBehavior::PlatformerObjectBehavior" + "TopDownMovementBehavior::TopDownMovementBehavior" ], - "name": "Property" + "choices": [], + "name": "TopDownMovement" }, { "value": "1", "type": "Number", "label": "Controller identifier (1, 2, 3, 4...)", - "description": "", - "group": "", - "extraInformation": [], "name": "ControllerIdentifier" }, { - "value": "Primary", - "type": "Choice", - "label": "Joystick name", - "description": "", - "group": "Controls", - "extraInformation": [ - "Primary", - "Secondary" + "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 + } ], - "name": "JoystickIdentifier" - }, - { - "value": "A", - "type": "String", - "label": "Jump button name", - "description": "", - "group": "Controls", - "extraInformation": [], - "name": "JumpButton" + "effects": [] } ], - "sharedPropertyDescriptors": [] - }, - { - "description": "Control a top-down character with a multitouch controller.", - "fullName": "Top-down multitouch controller mapper", - "name": "TopDownMultitouchMapper", - "objectType": "", + "instances": [], "eventsFunctions": [ { "fullName": "", "functionType": "Action", - "name": "doStepPreEvents", + "name": "onCreated", "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "conditions": [], + "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" + "value": "Create" }, "parameters": [ - "Object", - "Behavior", - "=", - "\"Analog\"" + "", + "Border", + "0", + "0", + "" ] - } - ], - "actions": [ + }, { "type": { - "value": "TopDownMovementBehavior::SimulateStick" + "value": "Create" }, "parameters": [ - "Object", - "TopDownMovement", - "SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier)", - "SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier)" + "", + "Thumb", + "0", + "0", + "" ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + }, { "type": { - "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" + "value": "ChangePlan" }, "parameters": [ - "Object", - "Behavior", + "Border", "=", - "\"360°\"" + "1" ] - } - ], - "actions": [ + }, { "type": { - "value": "TopDownMovementBehavior::SimulateStick" + "value": "ChangePlan" }, "parameters": [ - "Object", - "TopDownMovement", - "SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier)", - "sign(SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier))" + "Thumb", + "=", + "2" ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + }, { "type": { - "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" + "value": "SetCenter" }, "parameters": [ - "Object", - "Behavior", + "Border", "=", - "\"8 Directions\"" + "0", + "=", + "0" ] - } - ], - "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": { + "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": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "conditions": [], + "actions": [ { "type": { - "value": "TopDownMovementBehavior::DiagonalsAllowed" + "value": "MettreAutour" }, "parameters": [ - "Object", - "TopDownMovement" + "Thumb", + "Border", + "Border.MultitouchJoystick::JoystickForce() * Border.Width() / 2", + "Border.MultitouchJoystick::JoystickAngle()" ] } - ], - "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": "BooleanVariable" + }, + "parameters": [ + "ShouldBeHiddenWhenReleased", + "True", + "" ] }, { - "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": { + "inverted": true, + "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::IsPressed" + }, + "parameters": [ + "Object", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "Cache" + }, + "parameters": [ + "Object" ] }, { - "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" - ] - } + "type": { + "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::ActivateControl" + }, + "parameters": [ + "Object", + "no", + "" + ] + }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "ShouldBeHiddenWhenReleased", + "False", + "" ] } ] @@ -4583,86 +7269,16 @@ { "description": "Object", "name": "Object", + "supplementaryInformation": "SpriteMultitouchJoystick::SpriteMultitouchJoystick", "type": "object" - }, - { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::TopDownMultitouchMapper", - "type": "behavior" } ], "objectGroups": [] - } - ], - "propertyDescriptors": [ - { - "value": "", - "type": "Behavior", - "label": "Top-down movement behavior", - "description": "", - "group": "", - "extraInformation": [ - "TopDownMovementBehavior::TopDownMovementBehavior" - ], - "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" - ], - "name": "JoystickIdentifier" }, - { - "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": "onCreated", + "name": "onHotReloading", "sentence": "", "events": [ { @@ -4671,75 +7287,132 @@ "actions": [ { "type": { - "value": "Create" + "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::UpdateConfiguration" }, "parameters": [ - "", - "Border", - "0", - "0", + "Object", "" ] - }, + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "SpriteMultitouchJoystick::SpriteMultitouchJoystick", + "type": "object" + } + ], + "objectGroups": [] + }, + { + "description": "Pass the object property values to the behavior.", + "fullName": "Update configuration", + "functionType": "Action", + "name": "UpdateConfiguration", + "private": true, + "sentence": "Update the configuration of _PARAM0_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ { "type": { - "value": "Create" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetControllerIdentifier" }, "parameters": [ - "", - "Thumb", - "0", - "0", + "Border", + "MultitouchJoystick", + "=", + "ControllerIdentifier", "" ] }, { "type": { - "value": "ChangePlan" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickIdentifier" }, "parameters": [ "Border", + "MultitouchJoystick", "=", - "1" + "JoystickIdentifier", + "" ] }, { "type": { - "value": "ChangePlan" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetDeadZoneRadius" }, "parameters": [ - "Thumb", + "Border", + "MultitouchJoystick", "=", - "2" + "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": "SetCenter" + "value": "MettreXY" }, "parameters": [ - "Border", + "Object", "=", - "0", + "Object.ParentTouchX(StartedTouchOrMouseId(0))", "=", - "0" + "Object.ParentTouchY(StartedTouchOrMouseId(0))" ] }, { "type": { - "value": "SetCenter" + "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::ActivateControl" }, "parameters": [ - "Thumb", - "=", - "0", - "=", - "0" + "Object", + "yes", + "" ] }, { "type": { - "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::UpdateConfiguration" + "value": "Montre" }, "parameters": [ "Object", @@ -4748,45 +7421,23 @@ }, { "type": { - "value": "SetIncludedInParentCollisionMask" + "value": "SetBooleanVariable" }, "parameters": [ - "Thumb", + "ShouldBeHiddenWhenReleased", + "True", "" ] - } - ] - } - ], - "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": "MettreAutour" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::ForceStartPressing" }, "parameters": [ - "Thumb", "Border", - "Border.MultitouchJoystick::JoystickForce() * Border.Width() / 2", - "Border.MultitouchJoystick::JoystickAngle()" + "MultitouchJoystick", + "StartedTouchOrMouseId(0)", + "" ] } ] @@ -4803,94 +7454,87 @@ "objectGroups": [] }, { - "fullName": "", - "functionType": "Action", - "name": "onHotReloading", + "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": { - "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::UpdateConfiguration" - }, - "parameters": [ - "Object", - "" - ] - } - ] + "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": "Pass the object property values to the behavior.", - "fullName": "Update configuration", - "functionType": "Action", - "name": "UpdateConfiguration", + "description": "Return the X position of a specified touch", + "fullName": "Touch X position (on parent)", + "functionType": "Expression", + "name": "ParentTouchY", "private": true, - "sentence": "Update the configuration of _PARAM0_", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [], - "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()", - "" - ] - } - ] + "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": [] @@ -4908,10 +7552,12 @@ { "type": { "inverted": true, - "value": "GetArgumentAsBoolean" + "value": "BooleanVariable" }, "parameters": [ - "\"ShouldActivate\"" + "ShouldActivate", + "True", + "" ] } ], @@ -4933,10 +7579,12 @@ "conditions": [ { "type": { - "value": "GetArgumentAsBoolean" + "value": "BooleanVariable" }, "parameters": [ - "\"ShouldActivate\"" + "ShouldActivate", + "True", + "" ] } ], @@ -5546,20 +8194,21 @@ "value": "1", "type": "Number", "label": "Multitouch controller identifier (1, 2, 3, 4...)", - "description": "", - "group": "", - "extraInformation": [], "name": "ControllerIdentifier" }, { "value": "Primary", "type": "Choice", "label": "Joystick name", - "description": "", - "group": "", - "extraInformation": [ - "Primary", - "Secondary" + "choices": [ + { + "label": "Primary", + "value": "Primary" + }, + { + "label": "Secondary", + "value": "Secondary" + } ], "name": "JoystickIdentifier" }, @@ -5568,8 +8217,6 @@ "type": "Number", "label": "Dead zone radius (range: 0 to 1)", "description": "The deadzone is an area for which movement on sticks won't be taken into account (instead, the stick will be considered as not moved)", - "group": "", - "extraInformation": [], "name": "DeadZoneRadius" }, { @@ -5577,10 +8224,10 @@ "type": "String", "label": "", "description": "Only used by the scene editor.", - "group": "", "extraInformation": [ "Thumb" ], + "choices": [], "hidden": true, "name": "ThumbAnchorOrigin" }, @@ -5589,8 +8236,6 @@ "type": "Number", "label": "", "description": "Only used by the scene editor.", - "group": "", - "extraInformation": [], "hidden": true, "name": "ThumbAnchorTarget" }, @@ -5599,10 +8244,10 @@ "type": "Boolean", "label": "", "description": "Only used by the scene editor.", - "group": "", "extraInformation": [ "Thumb" ], + "choices": [], "hidden": true, "name": "ThumbIsScaledProportionally" }, @@ -5611,116 +8256,17 @@ "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": [] - } - ] - } - ] }, { - "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": [] + "value": "", + "type": "Boolean", + "label": "", + "hidden": true, + "name": "ShouldBeHiddenWhenReleased" } - ], - "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 29e4bce57..949222b34 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": "", + "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.4.0", + "version": "1.9.0", "description": [ - "Multitouch joysticks can be used the same way as physical gamepads:", + "Multitouch joysticks are objects showing a joystick on the screen, useful for mobile. They work like a physical gamepad:", "- 4 or 8 directions", "- Analogus pads", "- Player selection", - "- Controls mapping for top-down movement and platformer characters", + "- Automatic \"mapper\" behaviors for 2D and 3D movement behaviors (platformer characters, top-down movement, 3D character etc...). Add one of these to the object with the movement behavior (i.e: the player most of the time) and the behavior will then be controlled automatically by the virtual joystick (it works by reading the multitouch joystick state and simulating controls). No need for additional events to make it work once the behaviors are set up.", "", "There are ready-to-use joysticks in the asset-store [multitouch joysticks pack](https://editor.gdevelop.io/?initial-dialog=asset-store&asset-pack=multitouch-joysticks-multitouch-joysticks)." ], @@ -1283,153 +1283,33 @@ ], "eventsFunctions": [ { - "description": "Check if a button is pressed on a gamepad.", - "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": "StringVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Buttons[Button].State", - "=", - "\"Pressed\"" - ] - } - ], - "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 gamepad.", - "fullName": "Multitouch controller button released", + "description": "Check if the events are running for the editor.", + "fullName": "Editor is running", "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", + "name": "IsInGameEdition", "private": true, - "sentence": "Mark _PARAM2_ button as _PARAM3_ for multitouch controller _PARAM1_", + "sentence": "Events are running for the editor", "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" + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const game = runtimeScene.getGame();\r", + "eventsFunctionContext.returnValue = game.isInGameEdition && game.isInGameEdition();" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false } ], + "parameters": [], "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", + "fullName": "Accelerated speed", + "functionType": "Expression", + "name": "AcceleratedSpeed", "private": true, - "sentence": "Change the dead zone of multitouch joystick _PARAM2_ of multitouch controller _PARAM1_ to _PARAM3_", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -1440,1203 +1320,3781 @@ "value": "SetNumberVariable" }, "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].DeadZone", + "AcceleratedSpeed", "=", - "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)" + "CurrentSpeed" ] } - ] - } - ], - "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": [ + ], + "events": [ { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ + "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": [ + ] + } + ], + "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": "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": [ + "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": [] + }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "JoystickForce", + "name": "SetJoystickForce", + "private": true, + "sentence": "", + "events": [ { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Right\"" + "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" }, { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo4Way" - }, - "parameters": [ - "", - "=", - "0", - "Angle", - "" - ] + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" + }, + { + "description": "", + "name": "Parameter", + "type": "objectList" } ], - "actions": [ + "objectGroups": [] + }, + { + "description": "Return the angle the joystick is pointing towards (Range: -180 to 180).", + "fullName": "Joystick angle", + "functionType": "Expression", + "name": "JoystickAngle", + "sentence": "", + "events": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" + "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": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "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": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Down\"" + "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" }, { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo4Way" - }, - "parameters": [ - "", - "=", - "1", - "Angle", - "" - ] + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" + }, + { + "description": "Angle", + "name": "Value", + "type": "expression" } ], - "actions": [ + "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": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" + "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": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "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": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Left\"" + "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" }, { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo4Way" - }, - "parameters": [ - "", - "=", - "2", - "Angle", - "" + "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" + ] + } ] } ], - "actions": [ + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - }, - { - "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", - "" - ] + "description": "Direction", + "name": "Direction", + "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\"]", + "type": "stringWithSelector" } ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - } - ], - "parameters": [ - { - "description": "Angle", - "name": "Angle", - "type": "expression" + "objectGroups": [] }, { - "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\"" - ] - }, + "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": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "0", - "Angle", - "" + "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" + ] + } ] } ], - "actions": [ + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] - }, - { - "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", - "" - ] + "description": "Direction", + "name": "Direction", + "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\",\"UpLeft\",\"UpRight\",\"DownLeft\",\"DownRight\"]", + "type": "stringWithSelector" } ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Down\"" - ] - }, + "description": "Check if a joystick is pressed.", + "fullName": "Joystick pressed", + "functionType": "Condition", + "name": "IsPressed", + "sentence": "Joystick _PARAM0_ is pressed", + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "2", - "Angle", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "!=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } ] } ], - "actions": [ + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } - ] + ], + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"DownLeft\"" - ] - }, + "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": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "3", - "Angle", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "0", + "" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "0" + ] + } ] } ], - "actions": [ + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } - ] + ], + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Left\"" - ] - }, + "description": "the multitouch controller identifier.", + "fullName": "Multitouch controller identifier", + "functionType": "ExpressionAndCondition", + "group": "Multitouch Joystick configuration", + "name": "ControllerIdentifier", + "sentence": "the multitouch controller identifier", + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "4", - "Angle", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "ControllerIdentifier" + ] + } ] } ], - "actions": [ + "expressionType": { + "type": "expression" + }, + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } - ] + ], + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"UpLeft\"" - ] - }, + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "ControllerIdentifier", + "name": "SetControllerIdentifier", + "sentence": "", + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "5", - "Angle", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "ControllerIdentifier", + "=", + "Value" + ] + } ] } ], - "actions": [ + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } - ] + ], + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Up\"" - ] - }, + "description": "the joystick name.", + "fullName": "Joystick name", + "functionType": "ExpressionAndCondition", + "group": "Multitouch Joystick configuration", + "name": "JoystickIdentifier", + "sentence": "the joystick name", + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "6", - "Angle", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnString" + }, + "parameters": [ + "JoystickIdentifier" + ] + } ] } ], - "actions": [ + "expressionType": { + "type": "string" + }, + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } - ] + ], + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "JoystickIdentifier", + "name": "SetJoystickIdentifier", + "sentence": "", + "events": [ { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"UpRight\"" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "JoystickIdentifier", + "=", + "Value" + ] + } ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" }, { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "7", - "Angle", - "" - ] + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } ], - "actions": [ + "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": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "DeadZoneRadius" + ] + } ] } - ] - } - ], - "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 + ], + "expressionType": { + "type": "expression" }, - "comment": "Make sure the joystick has moved from center" - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "parameters": [ { - "type": { - "value": "SpriteMultitouchJoystick::JoystickForce" - }, - "parameters": [ - "", - ">", - "0", - "ControllerIdentifier", - "JoystickIdentifier", - "" - ] + "description": "Object", + "name": "Object", + "type": "object" }, { - "type": { - "value": "SpriteMultitouchJoystick::IsAngleIn4WayDirection" - }, - "parameters": [ - "", - "SpriteMultitouchJoystick::JoystickAngle(ControllerIdentifier, JoystickIdentifier)", - "Direction", - "" - ] + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } ], - "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" + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "DeadZoneRadius", + "name": "SetDeadZoneRadius", + "sentence": "", + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::JoystickForce" - }, - "parameters": [ - "", - ">", - "0", - "ControllerIdentifier", - "JoystickIdentifier", - "" + "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" }, { - "type": { - "value": "SpriteMultitouchJoystick::IsAngleIn8WayDirection" - }, - "parameters": [ - "", - "SpriteMultitouchJoystick::JoystickAngle(ControllerIdentifier, JoystickIdentifier)", - "Direction", - "" - ] + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } ], - "actions": [ + "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": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" + "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": [] } ], - "parameters": [ + "propertyDescriptors": [ { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" + "value": "1", + "type": "Number", + "label": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier" }, { - "description": "Joystick name", - "name": "JoystickIdentifier", - "supplementaryInformation": "[\"Primary\",\"Secondary\"]", - "type": "stringWithSelector" + "value": "Primary", + "type": "String", + "label": "Joystick name", + "name": "JoystickIdentifier" }, { - "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" + "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" }, { - "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": [ + "value": "0", + "type": "Number", + "label": "Joystick angle (range: -180 to 180)", + "hidden": true, + "name": "JoystickAngle" + }, { - "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": [ + "value": "0", + "type": "Number", + "label": "Joystick force (range: 0 to 1)", + "hidden": true, + "name": "JoystickForce" + }, { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" + "value": "0", + "type": "Number", + "label": "", + "hidden": true, + "name": "TouchId" }, { - "description": "Stick name", - "name": "JoystickIdentifier", - "supplementaryInformation": "[\"Primary\",\"Secondary\"]", - "type": "stringWithSelector" + "value": "", + "type": "Number", + "label": "", + "hidden": true, + "name": "TouchIndex" } ], - "objectGroups": [] + "sharedPropertyDescriptors": [] }, { - "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": [ + "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": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ + "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": { - "value": "SetNumberVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].Force", - "=", - "Value" + "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" + ] + } + ] + } + ] + } ] - } - ] - } - ], - "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)" + "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" + ] + } ] } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "type": "behavior" + } + ], + "objectGroups": [] }, { - "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": "Check if the button was just pressed.", + "fullName": "Button just pressed", + "functionType": "Condition", + "name": "IsJustPressed", + "sentence": "Button _PARAM0_ was just pressed", + "events": [ { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].Angle" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } ] } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "type": "behavior" + } + ], + "objectGroups": [] }, { - "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": [ + "description": "Check if the button is pressed.", + "fullName": "Button pressed", + "functionType": "Condition", + "name": "IsPressed", + "sentence": "Button _PARAM0_ is pressed", + "events": [ { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].Angle", - "=", - "Value" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "!=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } ] } - ] - } - ], - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "type": "behavior" + } + ], + "objectGroups": [] }, { - "description": "Joystick name", - "name": "JoystickIdentifier", - "type": "string" + "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": [] }, { - "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": [ + "fullName": "Button state", + "functionType": "Action", + "name": "SetButtonState", + "private": true, + "sentence": "Mark the button _PARAM0_ as _PARAM2_", + "events": [ { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "SpriteMultitouchJoystick::JoystickForce(ControllerIdentifier, JoystickIdentifier) * cos(ToRad(SpriteMultitouchJoystick::JoystickAngle(ControllerIdentifier, JoystickIdentifier)))" + "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": [] } ], - "expressionType": { - "type": "expression" - }, - "parameters": [ + "propertyDescriptors": [ { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" + "value": "1", + "type": "Number", + "label": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier" }, { - "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": [ + "value": "A", + "type": "String", + "label": "Button identifier", + "name": "ButtonIdentifier" + }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "SpriteMultitouchJoystick::JoystickForce(ControllerIdentifier, JoystickIdentifier) * sin(ToRad(SpriteMultitouchJoystick::JoystickAngle(ControllerIdentifier, JoystickIdentifier)))" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ + "value": "0", + "type": "Number", + "label": "TouchID", + "hidden": true, + "name": "TouchId" + }, { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" + "value": "", + "type": "Number", + "label": "", + "hidden": true, + "name": "TouchIndex" }, { - "description": "Joystick name", - "name": "JoystickIdentifier", - "supplementaryInformation": "[\"Primary\",\"Secondary\"]", - "type": "stringWithSelector" + "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" } ], - "objectGroups": [] - } - ], - "eventsBasedBehaviors": [ + "sharedPropertyDescriptors": [] + }, { - "description": "Joystick that can be controlled by interacting with a touchscreen.", - "fullName": "Multitouch Joystick", - "name": "MultitouchJoystick", + "description": "Control a platformer character with a multitouch controller.", + "fullName": "Platformer multitouch controller mapper", + "name": "PlatformerMultitouchMapper", "objectType": "", - "private": true, + "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", "functionType": "Action", - "name": "onCreated", + "name": "doStepPreEvents", "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ + "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::SetDeadZone" + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" }, "parameters": [ "", "ControllerIdentifier", "JoystickIdentifier", - "DeadZoneRadius", + "\"Left\"", "" ] - }, + } + ], + "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" + "value": "PlatformBehavior::SimulateLeftKey" }, "parameters": [ "Object", - "Behavior", + "Property" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JoystickIdentifier", + "\"Right\"", "" ] } + ], + "actions": [ + { + "type": { + "value": "PlatformBehavior::SimulateRightKey" + }, + "parameters": [ + "Object", + "Property" + ] + } ] - } - ], - "parameters": [ + }, { - "description": "Object", - "name": "Object", - "type": "object" + "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" + ] + } + ] }, { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "Action", - "name": "onDeActivate", - "sentence": "", - "events": [ + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JoystickIdentifier", + "\"Down\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "PlatformBehavior::SimulateDownKey" + }, + "parameters": [ + "Object", + "Property" + ] + } + ] + }, { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::IsButtonPressed" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JumpButton", + "\"Down\"" + ] + } + ], "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" + "value": "PlatformBehavior::SimulateJumpKey" }, "parameters": [ "Object", - "Behavior", - "" + "Property" ] } ] @@ -2651,12 +5109,64 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::PlatformerMultitouchMapper", "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", @@ -2668,262 +5178,71 @@ "conditions": [ { "type": { - "value": "HasGameJustResumed" - }, - "parameters": [ - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" + "value": "SpriteMultitouchJoystick::StickForce" }, "parameters": [ - "Object", - "Behavior", + "", + ">", + "0", + "ControllerIdentifier", + "JoystickIdentifier", "" ] } - ] - }, - { - "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": "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": "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" + "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)" + ] + } + ] }, - { - "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": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::IsButtonPressed" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JumpButton", + "\"Down\"" + ] + } + ], "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" }, "parameters": [ - "max(0, JoystickForce - DeadZoneRadius) / (1 - DeadZoneRadius)" + "Object", + "PhysicsCharacter3D" ] } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -2933,45 +5252,124 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "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": "ActionWithOperator", - "getterName": "JoystickForce", - "name": "SetJoystickForce", - "private": true, + "functionType": "Action", + "name": "doStepPreEvents", "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::StickForce" + }, + "parameters": [ + "", + ">", + "0", + "ControllerIdentifier", + "JoystickIdentifier", + "" + ] + } + ], "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickForce" + "value": "Physics3D::PhysicsCharacter3D::SimulateStick" }, "parameters": [ "Object", - "Behavior", - "=", - "Value" + "PhysicsCharacter3D", + "SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier)", + "SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier)" ] - }, + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::SetJoystickForce" + "value": "SpriteMultitouchJoystick::IsButtonPressed" }, "parameters": [ "", "ControllerIdentifier", - "JoystickIdentifier", - "JoystickForce", - "" + "JumpButton", + "\"Down\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" + }, + "parameters": [ + "Object", + "PhysicsCharacter3D" ] } ] @@ -2986,37 +5384,151 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::Shooter3DMultitouchMapper", "type": "behavior" } ], "objectGroups": [] + } + ], + "propertyDescriptors": [ + { + "value": "", + "type": "Behavior", + "label": "3D physics character", + "extraInformation": [ + "Physics3D::PhysicsCharacter3D" + ], + "choices": [], + "name": "PhysicsCharacter3D" }, { - "description": "Return the angle the joystick is pointing towards (Range: -180 to 180).", - "fullName": "Joystick angle", - "functionType": "Expression", - "name": "JoystickAngle", + "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": "SetReturnNumber" + "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": [ - "JoystickAngle" + "Object", + "Behavior", + "" ] } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -3026,19 +5538,20 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], "objectGroups": [] }, { - "description": "Change the angle the joystick is pointing towards (Range: -180 to 180).", - "fullName": "Joystick angle", + "description": "Move the camera to look though _PARAM1_ eyes. The object must look to the right when all its angles are 0 and the top of its head be toward Z+.", + "fullName": "Look through object eyes", "functionType": "Action", - "name": "SetJoystickAngle", + "group": "Layers and cameras", + "name": "LookFromObjectEyes", "private": true, - "sentence": "Change the joystick angle of _PARAM0_ to _PARAM2_", + "sentence": "Move the camera to look though _PARAM0_ eyes", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -3046,24 +5559,61 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickAngle" + "value": "CentreCamera" }, "parameters": [ + "", "Object", - "Behavior", + "", + "Object.Layer()", + "" + ] + }, + { + "type": { + "value": "Scene3D::SetCameraZ" + }, + "parameters": [ + "", "=", - "Value" + "Object.Object3D::Z() + Object.Object3D::Depth() + OffsetZ", + "", + "" ] }, { "type": { - "value": "SpriteMultitouchJoystick::SetJoystickAngle" + "value": "Scene3D::SetCameraRotationX" }, "parameters": [ "", - "ControllerIdentifier", - "JoystickIdentifier", - "JoystickAngle", + "=", + "- 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()", "" ] } @@ -3079,23 +5629,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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": "", + "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", @@ -3106,7 +5652,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "Object.Behavior::JoystickForce() * cos(ToRad(Object.Behavior::JoystickAngle()))" + "HorizontalRotationSpeedMax" ] } ] @@ -3124,17 +5670,17 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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", + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "HorizontalRotationSpeedMax", + "name": "SetHorizontalRotationSpeedMax", "sentence": "", "events": [ { @@ -3143,18 +5689,17 @@ "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "SetNumberVariable" }, "parameters": [ - "Object.Behavior::JoystickForce() * sin(ToRad(Object.Behavior::JoystickAngle()))" + "HorizontalRotationSpeedMax", + "=", + "Value" ] } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -3164,58 +5709,38 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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_", + "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": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::JoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - ">", - "0", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::IsAngleIn4WayDirection" - }, - "parameters": [ - "", - "JoystickAngle", - "Direction", - "" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "SetReturnBoolean" + "value": "SetReturnNumber" }, "parameters": [ - "True" + "HorizontalRotationAcceleration" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -3225,59 +5750,31 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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_", + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "HorizontalRotationAcceleration", + "name": "SetHorizontalRotationAcceleration", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::JoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - ">", - "0", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::IsAngleIn8WayDirection" - }, - "parameters": [ - "", - "JoystickAngle", - "Direction", - "" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "SetReturnBoolean" + "value": "SetNumberVariable" }, "parameters": [ - "True" + "HorizontalRotationAcceleration", + "=", + "Value" ] } ] @@ -3292,52 +5789,38 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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", + "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": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::PropertyTouchId" - }, - "parameters": [ - "Object", - "Behavior", - "!=", - "0" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "SetReturnBoolean" + "value": "SetReturnNumber" }, "parameters": [ - "True" + "HorizontalRotationDeceleration" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -3347,19 +5830,18 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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_", + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "HorizontalRotationDeceleration", + "name": "SetHorizontalRotationDeceleration", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -3367,25 +5849,12 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "0", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyTouchId" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "HorizontalRotationDeceleration", "=", - "0" + "Value" ] } ] @@ -3400,19 +5869,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the multitouch controller identifier.", - "fullName": "Multitouch controller identifier", + "description": "the maximum vertical rotation speed of the object.", + "fullName": "Maximum vertical rotation speed", "functionType": "ExpressionAndCondition", - "group": "Multitouch Joystick configuration", - "name": "ControllerIdentifier", - "sentence": "the multitouch controller identifier", + "group": "First person camera multitouch controller mapper vertical rotation configuration", + "name": "VerticalRotationSpeedMax", + "sentence": "the maximum vertical rotation speed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -3423,7 +5892,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "ControllerIdentifier" + "VerticalRotationSpeedMax" ] } ] @@ -3441,7 +5910,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], @@ -3450,8 +5919,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "ControllerIdentifier", - "name": "SetControllerIdentifier", + "getterName": "VerticalRotationSpeedMax", + "name": "SetVerticalRotationSpeedMax", "sentence": "", "events": [ { @@ -3460,11 +5929,10 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyControllerIdentifier" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "VerticalRotationSpeedMax", "=", "Value" ] @@ -3481,19 +5949,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the joystick name.", - "fullName": "Joystick name", + "description": "the vertical rotation acceleration of the object.", + "fullName": "Vertical rotation acceleration", "functionType": "ExpressionAndCondition", - "group": "Multitouch Joystick configuration", - "name": "JoystickIdentifier", - "sentence": "the joystick name", + "group": "First person camera multitouch controller mapper vertical rotation configuration", + "name": "VerticalRotationAcceleration", + "sentence": "the vertical rotation acceleration", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -3501,17 +5969,17 @@ "actions": [ { "type": { - "value": "SetReturnString" + "value": "SetReturnNumber" }, "parameters": [ - "JoystickIdentifier" + "VerticalRotationAcceleration" ] } ] } ], "expressionType": { - "type": "string" + "type": "expression" }, "parameters": [ { @@ -3522,7 +5990,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], @@ -3531,8 +5999,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "JoystickIdentifier", - "name": "SetJoystickIdentifier", + "getterName": "VerticalRotationAcceleration", + "name": "SetVerticalRotationAcceleration", "sentence": "", "events": [ { @@ -3541,11 +6009,10 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickIdentifier" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "VerticalRotationAcceleration", "=", "Value" ] @@ -3562,19 +6029,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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", + "description": "the vertical rotation deceleration of the object.", + "fullName": "Vertical rotation deceleration", "functionType": "ExpressionAndCondition", - "group": "Multitouch Joystick configuration", - "name": "DeadZoneRadius", - "sentence": "the dead zone radius", + "group": "First person camera multitouch controller mapper vertical rotation configuration", + "name": "VerticalRotationDeceleration", + "sentence": "the vertical rotation deceleration", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -3585,7 +6052,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "DeadZoneRadius" + "VerticalRotationDeceleration" ] } ] @@ -3603,7 +6070,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], @@ -3612,8 +6079,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "DeadZoneRadius", - "name": "SetDeadZoneRadius", + "getterName": "VerticalRotationDeceleration", + "name": "SetVerticalRotationDeceleration", "sentence": "", "events": [ { @@ -3622,11 +6089,10 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyDeadZoneRadius" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "VerticalRotationDeceleration", "=", "Value" ] @@ -3643,271 +6109,72 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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": "Action", - "name": "doStepPreEvents", - "sentence": "", + "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": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::IsReleased" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyIsReleased" - }, - "parameters": [ - "Object", - "Behavior", - "no" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + "value": "SetReturnNumber" }, "parameters": [ - "Object", - "Behavior", - "\"Idle\"", - "" + "VerticalAngleMin" ] } ] - }, + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ { - "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" - ] - } - ] - } - ] - } - ] + "description": "Object", + "name": "Object", + "type": "object" }, { - "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" - ] - }, + "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": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchId" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "VerticalAngleMin", "=", - "0" + "Value" ] } ] @@ -3922,44 +6189,38 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], "objectGroups": [] }, { - "description": "Check if button is released.", - "fullName": "Button released", - "functionType": "Condition", - "name": "IsReleased", - "sentence": "Button _PARAM0_ is released", + "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": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::PropertyIsReleased" - }, - "parameters": [ - "Object", - "Behavior" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "SetReturnBoolean" + "value": "SetReturnNumber" }, "parameters": [ - "True" + "VerticalAngleMax" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -3969,46 +6230,77 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], "objectGroups": [] }, { - "description": "Check if button is pressed.", - "fullName": "Button pressed", - "functionType": "Condition", - "name": "IsPressed", - "sentence": "Button _PARAM0_ is pressed", + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "VerticalAngleMax", + "name": "SetVerticalAngleMax", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "conditions": [], + "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::PropertyTouchId" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", - "!=", - "0" + "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": "SetReturnBoolean" + "value": "SetReturnNumber" }, "parameters": [ - "True" + "OffsetZ" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -4018,18 +6310,18 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], "objectGroups": [] }, { - "fullName": "Button state", - "functionType": "Action", - "name": "SetButtonState", - "private": true, - "sentence": "Mark the button _PARAM0_ as _PARAM2_", + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "OffsetZ", + "name": "SetOffsetZ", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -4037,14 +6329,12 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::SetButtonState" + "value": "SetNumberVariable" }, "parameters": [ - "", - "ControllerIdentifier", - "ButtonIdentifier", - "ButtonState", - "" + "OffsetZ", + "=", + "Value" ] } ] @@ -4059,61 +6349,140 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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": "Multitouch controller identifier (1, 2, 3, 4...)", + "label": "Controller identifier (1, 2, 3, 4...)", "name": "ControllerIdentifier" }, { - "value": "A", - "type": "String", - "label": "Button identifier", - "name": "ButtonIdentifier" + "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", - "label": "TouchID", - "hidden": true, - "name": "TouchId" + "unit": "Pixel", + "label": "Z position offset", + "group": "Position", + "name": "OffsetZ" }, { - "value": "", + "value": "0", "type": "Number", - "label": "", + "unit": "AngularSpeed", + "label": "Current rotation speed Z", "hidden": true, - "name": "TouchIndex" + "name": "CurrentRotationSpeedZ" }, { - "value": "", - "type": "Boolean", - "label": "Button released", + "value": "0", + "type": "Number", + "unit": "AngularSpeed", + "label": "Current rotation speed Y", "hidden": true, - "name": "IsReleased" + "name": "CurrentRotationSpeedY" } ], "sharedPropertyDescriptors": [] }, { - "description": "Control a platformer character with a multitouch controller.", - "fullName": "Platformer multitouch controller mapper", - "name": "PlatformerMultitouchMapper", + "description": "Control a 3D physics car with a multitouch controller.", + "fullName": "3D car multitouch controller mapper", + "name": "PhysicsCar3DMultitouchMapper", "objectType": "", + "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -4126,69 +6495,14 @@ "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" + "value": "SpriteMultitouchJoystick::StickForce" }, "parameters": [ "", + ">", + "0", "ControllerIdentifier", - "JoystickIdentifier", - "\"Up\"", + "SteerJoystickIdentifier", "" ] } @@ -4196,20 +6510,12 @@ "actions": [ { "type": { - "value": "PlatformBehavior::SimulateUpKey" - }, - "parameters": [ - "Object", - "Property" - ] - }, - { - "type": { - "value": "PlatformBehavior::SimulateLadderKey" + "value": "Physics3D::PhysicsCar3D::SimulateSteeringStick" }, "parameters": [ "Object", - "Property" + "PhysicsCar3D", + "SpriteMultitouchJoystick::StickForceX(ControllerIdentifier, \"Primary\")" ] } ] @@ -4219,13 +6525,14 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" + "value": "SpriteMultitouchJoystick::StickForce" }, "parameters": [ "", - "ControllerIdentifier", - "JoystickIdentifier", - "\"Down\"", + ">", + "0", + "ControllerIdentifier", + "SpeedJoystickIdentifier", "" ] } @@ -4233,11 +6540,12 @@ "actions": [ { "type": { - "value": "PlatformBehavior::SimulateDownKey" + "value": "Physics3D::PhysicsCar3D::SimulateAcceleratorStick" }, "parameters": [ "Object", - "Property" + "PhysicsCar3D", + "-SpriteMultitouchJoystick::StickForceY(ControllerIdentifier, \"Secondary\")" ] } ] @@ -4252,7 +6560,7 @@ "parameters": [ "", "ControllerIdentifier", - "JumpButton", + "HandBrakeButton", "\"Down\"" ] } @@ -4260,11 +6568,11 @@ "actions": [ { "type": { - "value": "PlatformBehavior::SimulateJumpKey" + "value": "Physics3D::PhysicsCar3D::SimulateHandBrakeKey" }, "parameters": [ "Object", - "Property" + "PhysicsCar3D" ] } ] @@ -4279,7 +6587,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::PlatformerMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::PhysicsCar3DMultitouchMapper", "type": "behavior" } ], @@ -4290,12 +6598,12 @@ { "value": "", "type": "Behavior", - "label": "Platform character behavior", + "label": "3D physics car", "extraInformation": [ - "PlatformBehavior::PlatformerObjectBehavior" + "Physics3D::PhysicsCar3D" ], "choices": [], - "name": "Property" + "name": "PhysicsCar3D" }, { "value": "1", @@ -4306,7 +6614,7 @@ { "value": "Primary", "type": "Choice", - "label": "Joystick name", + "label": "Steer joystick", "group": "Controls", "choices": [ { @@ -4318,14 +6626,31 @@ "value": "Secondary" } ], - "name": "JoystickIdentifier" + "name": "SteerJoystickIdentifier" }, { - "value": "A", + "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": "Jump button name", + "label": "Hand brake button name", "group": "Controls", - "name": "JumpButton" + "name": "HandBrakeButton" } ], "sharedPropertyDescriptors": [] @@ -4335,6 +6660,7 @@ "fullName": "Top-down multitouch controller mapper", "name": "TopDownMultitouchMapper", "objectType": "", + "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -4347,11 +6673,10 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "StickMode", "=", "\"Analog\"" ] @@ -4376,11 +6701,10 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "StickMode", "=", "\"360°\"" ] @@ -4405,11 +6729,10 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "StickMode", "=", "\"8 Directions\"" ] @@ -5018,7 +7341,6 @@ } ], "instances": [], - "editionSettings": {}, "eventsFunctions": [ { "fullName": "", @@ -5137,17 +7459,90 @@ "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ + "conditions": [ { "type": { - "value": "MettreAutour" + "inverted": true, + "value": "SpriteMultitouchJoystick::IsInGameEdition" }, "parameters": [ - "Thumb", - "Border", - "Border.MultitouchJoystick::JoystickForce() * Border.Width() / 2", - "Border.MultitouchJoystick::JoystickAngle()" + "", + "" + ] + } + ], + "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", + "" + ] + } ] } ] @@ -5215,7 +7610,7 @@ "Border", "MultitouchJoystick", "=", - "Object.PropertyControllerIdentifier()", + "ControllerIdentifier", "" ] }, @@ -5227,7 +7622,7 @@ "Border", "MultitouchJoystick", "=", - "Object.PropertyJoystickIdentifier()", + "JoystickIdentifier", "" ] }, @@ -5239,7 +7634,92 @@ "Border", "MultitouchJoystick", "=", - "Object.PropertyDeadZoneRadius()", + "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)", "" ] } @@ -5256,6 +7736,92 @@ ], "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", @@ -5269,10 +7835,12 @@ { "type": { "inverted": true, - "value": "GetArgumentAsBoolean" + "value": "BooleanVariable" }, "parameters": [ - "\"ShouldActivate\"" + "ShouldActivate", + "True", + "" ] } ], @@ -5294,10 +7862,12 @@ "conditions": [ { "type": { - "value": "GetArgumentAsBoolean" + "value": "BooleanVariable" }, "parameters": [ - "\"ShouldActivate\"" + "ShouldActivate", + "True", + "" ] } ], @@ -5971,9 +8541,15 @@ "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 a0751e07b..43916c1e8 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": "", + "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.4.0", + "version": "1.9.0", "description": [ - "Multitouch joysticks can be used the same way as physical gamepads:", + "Multitouch joysticks are objects showing a joystick on the screen, useful for mobile. They work like a physical gamepad:", "- 4 or 8 directions", "- Analogus pads", "- Player selection", - "- Controls mapping for top-down movement and platformer characters", + "- Automatic \"mapper\" behaviors for 2D and 3D movement behaviors (platformer characters, top-down movement, 3D character etc...). Add one of these to the object with the movement behavior (i.e: the player most of the time) and the behavior will then be controlled automatically by the virtual joystick (it works by reading the multitouch joystick state and simulating controls). No need for additional events to make it work once the behaviors are set up.", "", "There are ready-to-use joysticks in the asset-store [multitouch joysticks pack](https://editor.gdevelop.io/?initial-dialog=asset-store&asset-pack=multitouch-joysticks-multitouch-joysticks)." ], @@ -1095,153 +1095,33 @@ ], "eventsFunctions": [ { - "description": "Check if a button is pressed on a gamepad.", - "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": "StringVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Buttons[Button].State", - "=", - "\"Pressed\"" - ] - } - ], - "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 gamepad.", - "fullName": "Multitouch controller button released", + "description": "Check if the events are running for the editor.", + "fullName": "Editor is running", "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", + "name": "IsInGameEdition", "private": true, - "sentence": "Mark _PARAM2_ button as _PARAM3_ for multitouch controller _PARAM1_", + "sentence": "Events are running for the editor", "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" + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const game = runtimeScene.getGame();\r", + "eventsFunctionContext.returnValue = game.isInGameEdition && game.isInGameEdition();" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false } ], + "parameters": [], "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", + "fullName": "Accelerated speed", + "functionType": "Expression", + "name": "AcceleratedSpeed", "private": true, - "sentence": "Change the dead zone of multitouch joystick _PARAM2_ of multitouch controller _PARAM1_ to _PARAM3_", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -1252,1203 +1132,3781 @@ "value": "SetNumberVariable" }, "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].DeadZone", + "AcceleratedSpeed", "=", - "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)" + "CurrentSpeed" ] } - ] - } - ], - "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": [ + ], + "events": [ { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ + "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": [ + ] + } + ], + "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": "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": [ + "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": [] + }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "JoystickForce", + "name": "SetJoystickForce", + "private": true, + "sentence": "", + "events": [ { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Right\"" + "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" }, { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo4Way" - }, - "parameters": [ - "", - "=", - "0", - "Angle", - "" + "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" + ] + } ] } ], - "actions": [ + "expressionType": { + "type": "expression" + }, + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } - ] + ], + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "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": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Down\"" + "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" }, { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo4Way" - }, - "parameters": [ - "", - "=", - "1", - "Angle", - "" - ] + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" + }, + { + "description": "Angle", + "name": "Value", + "type": "expression" } ], - "actions": [ + "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": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" + "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": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "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": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Left\"" + "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" }, { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo4Way" - }, - "parameters": [ - "", - "=", - "2", - "Angle", - "" + "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" + ] + } ] } ], - "actions": [ + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "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": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Up\"" - ] - }, + "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": { - "value": "SpriteMultitouchJoystick::AngleTo4Way" - }, - "parameters": [ - "", - "=", - "3", - "Angle", - "" + "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" + ] + } ] } ], - "actions": [ + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "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" } - ] - } - ], - "parameters": [ - { - "description": "Angle", - "name": "Angle", - "type": "expression" + ], + "objectGroups": [] }, { - "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\"" - ] - }, + "description": "Check if a joystick is pressed.", + "fullName": "Joystick pressed", + "functionType": "Condition", + "name": "IsPressed", + "sentence": "Joystick _PARAM0_ is pressed", + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "0", - "Angle", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "!=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } ] } ], - "actions": [ + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } - ] + ], + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"DownRight\"" - ] - }, + "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": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "1", - "Angle", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "0", + "" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "0" + ] + } ] } ], - "actions": [ + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } - ] + ], + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Down\"" - ] - }, + "description": "the multitouch controller identifier.", + "fullName": "Multitouch controller identifier", + "functionType": "ExpressionAndCondition", + "group": "Multitouch Joystick configuration", + "name": "ControllerIdentifier", + "sentence": "the multitouch controller identifier", + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "2", - "Angle", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "ControllerIdentifier" + ] + } ] } ], - "actions": [ + "expressionType": { + "type": "expression" + }, + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } - ] + ], + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "ControllerIdentifier", + "name": "SetControllerIdentifier", + "sentence": "", + "events": [ { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"DownLeft\"" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "ControllerIdentifier", + "=", + "Value" + ] + } ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" }, { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "3", - "Angle", - "" - ] + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } ], - "actions": [ + "objectGroups": [] + }, + { + "description": "the joystick name.", + "fullName": "Joystick name", + "functionType": "ExpressionAndCondition", + "group": "Multitouch Joystick configuration", + "name": "JoystickIdentifier", + "sentence": "the joystick name", + "events": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" + "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": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "JoystickIdentifier", + "name": "SetJoystickIdentifier", + "sentence": "", + "events": [ { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Left\"" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "JoystickIdentifier", + "=", + "Value" + ] + } ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" }, { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "4", - "Angle", - "" - ] + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } ], - "actions": [ + "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": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "DeadZoneRadius" + ] + } ] } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"UpLeft\"" - ] + "description": "Object", + "name": "Object", + "type": "object" }, { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "5", - "Angle", - "" - ] + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"Up\"" - ] - }, + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "DeadZoneRadius", + "name": "SetDeadZoneRadius", + "sentence": "", + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "6", - "Angle", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "DeadZoneRadius", + "=", + "Value" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::SetDeadZone" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JoystickIdentifier", + "Value", + "" + ] + } ] } ], - "actions": [ + "parameters": [ { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" } - ] + ], + "objectGroups": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::CompareStrings" - }, - "parameters": [ - "Direction", - "=", - "\"UpRight\"" - ] - }, + "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": { - "value": "SpriteMultitouchJoystick::AngleTo8Way" - }, - "parameters": [ - "", - "=", - "7", - "Angle", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "Value" + ] + } ] } ], - "actions": [ + "parameters": [ { - "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": [ + "description": "Object", + "name": "Object", + "type": "object" + }, { - "type": { - "value": "SpriteMultitouchJoystick::JoystickForce" - }, - "parameters": [ - "", - ">", - "0", - "ControllerIdentifier", - "JoystickIdentifier", - "" - ] + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "type": "behavior" }, { - "type": { - "value": "SpriteMultitouchJoystick::IsAngleIn4WayDirection" - }, - "parameters": [ - "", - "SpriteMultitouchJoystick::JoystickAngle(ControllerIdentifier, JoystickIdentifier)", - "Direction", - "" - ] + "description": "Touch identifier", + "name": "Value", + "type": "expression" } ], - "actions": [ - { - "type": { - "value": "SetReturnBoolean" - }, - "parameters": [ - "True" - ] - } - ] + "objectGroups": [] } ], - "parameters": [ + "propertyDescriptors": [ + { + "value": "1", + "type": "Number", + "label": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier" + }, { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" + "value": "Primary", + "type": "String", + "label": "Joystick name", + "name": "JoystickIdentifier" }, { - "description": "Joystick name", - "name": "JoystickIdentifier", - "supplementaryInformation": "[\"Primary\",\"Secondary\"]", - "type": "stringWithSelector" + "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" }, { - "description": "Direction", - "name": "Direction", - "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\"]", - "type": "stringWithSelector" + "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" } ], - "objectGroups": [] + "sharedPropertyDescriptors": [] }, { - "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" - }, + "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": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "fullName": "", + "functionType": "Action", + "name": "doStepPreEvents", + "sentence": "", + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::JoystickForce" - }, - "parameters": [ - "", - ">", - "0", - "ControllerIdentifier", - "JoystickIdentifier", - "" + "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": { - "value": "SpriteMultitouchJoystick::IsAngleIn8WayDirection" - }, - "parameters": [ - "", - "SpriteMultitouchJoystick::JoystickAngle(ControllerIdentifier, JoystickIdentifier)", - "Direction", - "" + "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" + ] + } ] } ], - "actions": [ + "parameters": [ { - "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": "Object", + "name": "Object", + "type": "object" + }, { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier)" - ] + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "type": "behavior" } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" + ], + "objectGroups": [] }, { - "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": [ + "description": "Check if the button was just pressed.", + "fullName": "Button just pressed", + "functionType": "Condition", + "name": "IsJustPressed", + "sentence": "Button _PARAM0_ was just pressed", + "events": [ { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "max(0, Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].Force - SpriteMultitouchJoystick::DeadZone(ControllerIdentifier, JoystickIdentifier)) / (1 - SpriteMultitouchJoystick::DeadZone(ControllerIdentifier, JoystickIdentifier))" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } ] } - ] - } - ], - "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": [ + ], + "parameters": [ { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].Force", - "=", - "Value" - ] + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "type": "behavior" } - ] - } - ], - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" - }, - { - "description": "Joystick name", - "name": "JoystickIdentifier", - "type": "string" + ], + "objectGroups": [] }, { - "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": [ + "description": "Check if the button is pressed.", + "fullName": "Button pressed", + "functionType": "Condition", + "name": "IsPressed", + "sentence": "Button _PARAM0_ is pressed", + "events": [ { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier)" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "!=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } ] } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "type": "behavior" + } + ], + "objectGroups": [] }, { - "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": "Check if the button is released.", + "fullName": "Button released", + "functionType": "Condition", + "name": "IsReleased", + "sentence": "Button _PARAM0_ is released", + "events": [ { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].Angle" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsReleased", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } ] } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ - { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "type": "behavior" + } + ], + "objectGroups": [] }, { - "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": [ + "fullName": "Button state", + "functionType": "Action", + "name": "SetButtonState", + "private": true, + "sentence": "Mark the button _PARAM0_ as _PARAM2_", + "events": [ { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "Controllers[ControllerIdentifier].Joystick[JoystickIdentifier].Angle", - "=", - "Value" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::SetButtonState" + }, + "parameters": [ + "", + "ControllerIdentifier", + "ButtonIdentifier", + "ButtonState", + "" + ] + } ] } - ] - } - ], - "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": [ + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "SpriteMultitouchJoystick::JoystickForce(ControllerIdentifier, JoystickIdentifier) * cos(ToRad(SpriteMultitouchJoystick::JoystickAngle(ControllerIdentifier, JoystickIdentifier)))" - ] + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "type": "behavior" + }, + { + "description": "Button state", + "name": "ButtonState", + "supplementaryInformation": "[\"Idle\",\"JustPressed\",\"Pressed\",\"Released\"]", + "type": "stringWithSelector" } - ] + ], + "objectGroups": [] } ], - "expressionType": { - "type": "expression" - }, - "parameters": [ + "propertyDescriptors": [ { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" + "value": "1", + "type": "Number", + "label": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier" }, { - "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": [ + "value": "A", + "type": "String", + "label": "Button identifier", + "name": "ButtonIdentifier" + }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetReturnNumber" - }, - "parameters": [ - "SpriteMultitouchJoystick::JoystickForce(ControllerIdentifier, JoystickIdentifier) * sin(ToRad(SpriteMultitouchJoystick::JoystickAngle(ControllerIdentifier, JoystickIdentifier)))" - ] - } - ] - } - ], - "expressionType": { - "type": "expression" - }, - "parameters": [ + "value": "0", + "type": "Number", + "label": "TouchID", + "hidden": true, + "name": "TouchId" + }, { - "description": "Multitouch controller identifier (1, 2, 3, 4...)", - "name": "ControllerIdentifier", - "type": "expression" + "value": "", + "type": "Number", + "label": "", + "hidden": true, + "name": "TouchIndex" }, { - "description": "Joystick name", - "name": "JoystickIdentifier", - "supplementaryInformation": "[\"Primary\",\"Secondary\"]", - "type": "stringWithSelector" + "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" } ], - "objectGroups": [] - } - ], - "eventsBasedBehaviors": [ + "sharedPropertyDescriptors": [] + }, { - "description": "Joystick that can be controlled by interacting with a touchscreen.", - "fullName": "Multitouch Joystick", - "name": "MultitouchJoystick", + "description": "Control a platformer character with a multitouch controller.", + "fullName": "Platformer multitouch controller mapper", + "name": "PlatformerMultitouchMapper", "objectType": "", - "private": true, + "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", "functionType": "Action", - "name": "onCreated", + "name": "doStepPreEvents", "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ + "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::SetDeadZone" + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" }, "parameters": [ "", "ControllerIdentifier", "JoystickIdentifier", - "DeadZoneRadius", + "\"Left\"", "" ] - }, + } + ], + "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" + "value": "PlatformBehavior::SimulateLeftKey" }, "parameters": [ "Object", - "Behavior", + "Property" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JoystickIdentifier", + "\"Right\"", "" ] } + ], + "actions": [ + { + "type": { + "value": "PlatformBehavior::SimulateRightKey" + }, + "parameters": [ + "Object", + "Property" + ] + } ] - } - ], - "parameters": [ + }, { - "description": "Object", - "name": "Object", - "type": "object" + "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" + ] + } + ] }, { - "description": "Behavior", - "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", - "type": "behavior" - } - ], - "objectGroups": [] - }, - { - "fullName": "", - "functionType": "Action", - "name": "onDeActivate", - "sentence": "", - "events": [ + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JoystickIdentifier", + "\"Down\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "PlatformBehavior::SimulateDownKey" + }, + "parameters": [ + "Object", + "Property" + ] + } + ] + }, { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::IsButtonPressed" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JumpButton", + "\"Down\"" + ] + } + ], "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" + "value": "PlatformBehavior::SimulateJumpKey" }, "parameters": [ "Object", - "Behavior", - "" + "Property" ] } ] @@ -2463,12 +4921,64 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::PlatformerMultitouchMapper", "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", @@ -2480,9 +4990,14 @@ "conditions": [ { "type": { - "value": "HasGameJustResumed" + "value": "SpriteMultitouchJoystick::StickForce" }, "parameters": [ + "", + ">", + "0", + "ControllerIdentifier", + "JoystickIdentifier", "" ] } @@ -2490,252 +5005,56 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" + "value": "Physics3D::PhysicsCharacter3D::SetForwardAngle" }, "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": "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 - }, - "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": [ + "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": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::IsButtonPressed" + }, + "parameters": [ + "", + "ControllerIdentifier", + "JumpButton", + "\"Down\"" + ] + } + ], "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" }, "parameters": [ - "max(0, JoystickForce - DeadZoneRadius) / (1 - DeadZoneRadius)" + "Object", + "PhysicsCharacter3D" ] } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -2745,45 +5064,124 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "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": "ActionWithOperator", - "getterName": "JoystickForce", - "name": "SetJoystickForce", - "private": true, + "functionType": "Action", + "name": "doStepPreEvents", "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], + "conditions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::StickForce" + }, + "parameters": [ + "", + ">", + "0", + "ControllerIdentifier", + "JoystickIdentifier", + "" + ] + } + ], "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickForce" + "value": "Physics3D::PhysicsCharacter3D::SimulateStick" }, "parameters": [ "Object", - "Behavior", - "=", - "Value" + "PhysicsCharacter3D", + "SpriteMultitouchJoystick::StickAngle(ControllerIdentifier, JoystickIdentifier)", + "SpriteMultitouchJoystick::StickForce(ControllerIdentifier, JoystickIdentifier)" ] - }, + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::SetJoystickForce" + "value": "SpriteMultitouchJoystick::IsButtonPressed" }, "parameters": [ "", "ControllerIdentifier", - "JoystickIdentifier", - "JoystickForce", - "" + "JumpButton", + "\"Down\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "Physics3D::PhysicsCharacter3D::SimulateJumpKey" + }, + "parameters": [ + "Object", + "PhysicsCharacter3D" ] } ] @@ -2798,37 +5196,151 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::Shooter3DMultitouchMapper", "type": "behavior" } ], "objectGroups": [] + } + ], + "propertyDescriptors": [ + { + "value": "", + "type": "Behavior", + "label": "3D physics character", + "extraInformation": [ + "Physics3D::PhysicsCharacter3D" + ], + "choices": [], + "name": "PhysicsCharacter3D" }, { - "description": "Return the angle the joystick is pointing towards (Range: -180 to 180).", - "fullName": "Joystick angle", - "functionType": "Expression", - "name": "JoystickAngle", + "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": "SetReturnNumber" + "value": "SetNumberVariable" }, "parameters": [ - "JoystickAngle" + "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", + "" ] } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -2838,19 +5350,20 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], "objectGroups": [] }, { - "description": "Change the angle the joystick is pointing towards (Range: -180 to 180).", - "fullName": "Joystick angle", + "description": "Move the camera to look though _PARAM1_ eyes. The object must look to the right when all its angles are 0 and the top of its head be toward Z+.", + "fullName": "Look through object eyes", "functionType": "Action", - "name": "SetJoystickAngle", + "group": "Layers and cameras", + "name": "LookFromObjectEyes", "private": true, - "sentence": "Change the joystick angle of _PARAM0_ to _PARAM2_", + "sentence": "Move the camera to look though _PARAM0_ eyes", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -2858,24 +5371,61 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickAngle" + "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", - "Behavior", + "", "=", - "Value" + "Object.Object3D::RotationX()", + "GetArgumentAsString(\"Layer\")", + "" ] }, { "type": { - "value": "SpriteMultitouchJoystick::SetJoystickAngle" + "value": "SetCameraAngle" }, "parameters": [ "", - "ControllerIdentifier", - "JoystickIdentifier", - "JoystickAngle", + "=", + "Object.Angle() + 90", + "Object.Layer()", "" ] } @@ -2891,23 +5441,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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": "", + "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", @@ -2918,7 +5464,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "Object.Behavior::JoystickForce() * cos(ToRad(Object.Behavior::JoystickAngle()))" + "HorizontalRotationSpeedMax" ] } ] @@ -2936,17 +5482,17 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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", + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "HorizontalRotationSpeedMax", + "name": "SetHorizontalRotationSpeedMax", "sentence": "", "events": [ { @@ -2955,18 +5501,17 @@ "actions": [ { "type": { - "value": "SetReturnNumber" + "value": "SetNumberVariable" }, "parameters": [ - "Object.Behavior::JoystickForce() * sin(ToRad(Object.Behavior::JoystickAngle()))" + "HorizontalRotationSpeedMax", + "=", + "Value" ] } ] } ], - "expressionType": { - "type": "expression" - }, "parameters": [ { "description": "Object", @@ -2976,58 +5521,38 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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_", + "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": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::JoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - ">", - "0", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::IsAngleIn4WayDirection" - }, - "parameters": [ - "", - "JoystickAngle", - "Direction", - "" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "SetReturnBoolean" + "value": "SetReturnNumber" }, "parameters": [ - "True" + "HorizontalRotationAcceleration" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -3037,59 +5562,31 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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_", + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "HorizontalRotationAcceleration", + "name": "SetHorizontalRotationAcceleration", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::JoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - ">", - "0", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::IsAngleIn8WayDirection" - }, - "parameters": [ - "", - "JoystickAngle", - "Direction", - "" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "SetReturnBoolean" + "value": "SetNumberVariable" }, "parameters": [ - "True" + "HorizontalRotationAcceleration", + "=", + "Value" ] } ] @@ -3104,52 +5601,38 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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", + "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": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::PropertyTouchId" - }, - "parameters": [ - "Object", - "Behavior", - "!=", - "0" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "SetReturnBoolean" + "value": "SetReturnNumber" }, "parameters": [ - "True" + "HorizontalRotationDeceleration" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -3159,19 +5642,18 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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_", + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "HorizontalRotationDeceleration", + "name": "SetHorizontalRotationDeceleration", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -3179,25 +5661,12 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "0", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyTouchId" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "HorizontalRotationDeceleration", "=", - "0" + "Value" ] } ] @@ -3212,19 +5681,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the multitouch controller identifier.", - "fullName": "Multitouch controller identifier", + "description": "the maximum vertical rotation speed of the object.", + "fullName": "Maximum vertical rotation speed", "functionType": "ExpressionAndCondition", - "group": "Multitouch Joystick configuration", - "name": "ControllerIdentifier", - "sentence": "the multitouch controller identifier", + "group": "First person camera multitouch controller mapper vertical rotation configuration", + "name": "VerticalRotationSpeedMax", + "sentence": "the maximum vertical rotation speed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -3235,7 +5704,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "ControllerIdentifier" + "VerticalRotationSpeedMax" ] } ] @@ -3253,7 +5722,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], @@ -3262,8 +5731,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "ControllerIdentifier", - "name": "SetControllerIdentifier", + "getterName": "VerticalRotationSpeedMax", + "name": "SetVerticalRotationSpeedMax", "sentence": "", "events": [ { @@ -3272,11 +5741,10 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyControllerIdentifier" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "VerticalRotationSpeedMax", "=", "Value" ] @@ -3293,19 +5761,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], "objectGroups": [] }, { - "description": "the joystick name.", - "fullName": "Joystick name", + "description": "the vertical rotation acceleration of the object.", + "fullName": "Vertical rotation acceleration", "functionType": "ExpressionAndCondition", - "group": "Multitouch Joystick configuration", - "name": "JoystickIdentifier", - "sentence": "the joystick name", + "group": "First person camera multitouch controller mapper vertical rotation configuration", + "name": "VerticalRotationAcceleration", + "sentence": "the vertical rotation acceleration", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -3313,17 +5781,17 @@ "actions": [ { "type": { - "value": "SetReturnString" + "value": "SetReturnNumber" }, "parameters": [ - "JoystickIdentifier" + "VerticalRotationAcceleration" ] } ] } ], "expressionType": { - "type": "string" + "type": "expression" }, "parameters": [ { @@ -3334,7 +5802,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], @@ -3343,8 +5811,8 @@ { "fullName": "", "functionType": "ActionWithOperator", - "getterName": "JoystickIdentifier", - "name": "SetJoystickIdentifier", + "getterName": "VerticalRotationAcceleration", + "name": "SetVerticalRotationAcceleration", "sentence": "", "events": [ { @@ -3353,11 +5821,10 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyJoystickIdentifier" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", + "VerticalRotationAcceleration", "=", "Value" ] @@ -3374,19 +5841,19 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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", + "description": "the vertical rotation deceleration of the object.", + "fullName": "Vertical rotation deceleration", "functionType": "ExpressionAndCondition", - "group": "Multitouch Joystick configuration", - "name": "DeadZoneRadius", - "sentence": "the dead zone radius", + "group": "First person camera multitouch controller mapper vertical rotation configuration", + "name": "VerticalRotationDeceleration", + "sentence": "the vertical rotation deceleration", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -3397,7 +5864,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "DeadZoneRadius" + "VerticalRotationDeceleration" ] } ] @@ -3415,18 +5882,58 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "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": [] }, { - "fullName": "", - "functionType": "ActionWithOperator", - "getterName": "DeadZoneRadius", - "name": "SetDeadZoneRadius", - "sentence": "", + "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", @@ -3434,18 +5941,18 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetPropertyDeadZoneRadius" + "value": "SetReturnNumber" }, "parameters": [ - "Object", - "Behavior", - "=", - "Value" + "VerticalAngleMin" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -3455,271 +5962,31 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchJoystick", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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": "Action", - "name": "doStepPreEvents", + "functionType": "ActionWithOperator", + "getterName": "VerticalAngleMin", + "name": "SetVerticalAngleMin", "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::IsReleased" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - } - ], - "actions": [ - { - "type": { - "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" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" - }, - "parameters": [ - "Object", - "Behavior", - "\"Released\"", - "" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyIsReleased" - }, - "parameters": [ - "Object", - "Behavior", - "yes" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::SetPropertyTouchId" + "value": "SetNumberVariable" }, - "parameters": [ - "Object", - "Behavior", + "parameters": [ + "VerticalAngleMin", "=", - "0" + "Value" ] } ] @@ -3734,44 +6001,38 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], "objectGroups": [] }, { - "description": "Check if button is released.", - "fullName": "Button released", - "functionType": "Condition", - "name": "IsReleased", - "sentence": "Button _PARAM0_ is released", + "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": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::PropertyIsReleased" - }, - "parameters": [ - "Object", - "Behavior" - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "SetReturnBoolean" + "value": "SetReturnNumber" }, "parameters": [ - "True" + "VerticalAngleMax" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -3781,46 +6042,77 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], "objectGroups": [] }, { - "description": "Check if button is pressed.", - "fullName": "Button pressed", - "functionType": "Condition", - "name": "IsPressed", - "sentence": "Button _PARAM0_ is pressed", + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "VerticalAngleMax", + "name": "SetVerticalAngleMax", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "conditions": [], + "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::PropertyTouchId" + "value": "SetNumberVariable" }, "parameters": [ - "Object", - "Behavior", - "!=", - "0" + "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": "SetReturnBoolean" + "value": "SetReturnNumber" }, "parameters": [ - "True" + "OffsetZ" ] } ] } ], + "expressionType": { + "type": "expression" + }, "parameters": [ { "description": "Object", @@ -3830,18 +6122,18 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "type": "behavior" } ], "objectGroups": [] }, { - "fullName": "Button state", - "functionType": "Action", - "name": "SetButtonState", - "private": true, - "sentence": "Mark the button _PARAM0_ as _PARAM2_", + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "OffsetZ", + "name": "SetOffsetZ", + "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -3849,14 +6141,12 @@ "actions": [ { "type": { - "value": "SpriteMultitouchJoystick::SetButtonState" + "value": "SetNumberVariable" }, "parameters": [ - "", - "ControllerIdentifier", - "ButtonIdentifier", - "ButtonState", - "" + "OffsetZ", + "=", + "Value" ] } ] @@ -3871,61 +6161,140 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "supplementaryInformation": "SpriteMultitouchJoystick::FirstPersonMultitouchMapper", "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": "Multitouch controller identifier (1, 2, 3, 4...)", + "label": "Controller identifier (1, 2, 3, 4...)", "name": "ControllerIdentifier" }, { - "value": "A", - "type": "String", - "label": "Button identifier", - "name": "ButtonIdentifier" + "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", - "label": "TouchID", - "hidden": true, - "name": "TouchId" + "unit": "Pixel", + "label": "Z position offset", + "group": "Position", + "name": "OffsetZ" }, { - "value": "", + "value": "0", "type": "Number", - "label": "", + "unit": "AngularSpeed", + "label": "Current rotation speed Z", "hidden": true, - "name": "TouchIndex" + "name": "CurrentRotationSpeedZ" }, { - "value": "", - "type": "Boolean", - "label": "Button released", + "value": "0", + "type": "Number", + "unit": "AngularSpeed", + "label": "Current rotation speed Y", "hidden": true, - "name": "IsReleased" + "name": "CurrentRotationSpeedY" } ], "sharedPropertyDescriptors": [] }, { - "description": "Control a platformer character with a multitouch controller.", - "fullName": "Platformer multitouch controller mapper", - "name": "PlatformerMultitouchMapper", + "description": "Control a 3D physics car with a multitouch controller.", + "fullName": "3D car multitouch controller mapper", + "name": "PhysicsCar3DMultitouchMapper", "objectType": "", + "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -3938,69 +6307,14 @@ "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" + "value": "SpriteMultitouchJoystick::StickForce" }, "parameters": [ "", + ">", + "0", "ControllerIdentifier", - "JoystickIdentifier", - "\"Up\"", + "SteerJoystickIdentifier", "" ] } @@ -4008,20 +6322,12 @@ "actions": [ { "type": { - "value": "PlatformBehavior::SimulateUpKey" - }, - "parameters": [ - "Object", - "Property" - ] - }, - { - "type": { - "value": "PlatformBehavior::SimulateLadderKey" + "value": "Physics3D::PhysicsCar3D::SimulateSteeringStick" }, "parameters": [ "Object", - "Property" + "PhysicsCar3D", + "SpriteMultitouchJoystick::StickForceX(ControllerIdentifier, \"Primary\")" ] } ] @@ -4031,13 +6337,14 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::IsDirectionPushed4Way" + "value": "SpriteMultitouchJoystick::StickForce" }, "parameters": [ "", + ">", + "0", "ControllerIdentifier", - "JoystickIdentifier", - "\"Down\"", + "SpeedJoystickIdentifier", "" ] } @@ -4045,11 +6352,12 @@ "actions": [ { "type": { - "value": "PlatformBehavior::SimulateDownKey" + "value": "Physics3D::PhysicsCar3D::SimulateAcceleratorStick" }, "parameters": [ "Object", - "Property" + "PhysicsCar3D", + "-SpriteMultitouchJoystick::StickForceY(ControllerIdentifier, \"Secondary\")" ] } ] @@ -4064,7 +6372,7 @@ "parameters": [ "", "ControllerIdentifier", - "JumpButton", + "HandBrakeButton", "\"Down\"" ] } @@ -4072,11 +6380,11 @@ "actions": [ { "type": { - "value": "PlatformBehavior::SimulateJumpKey" + "value": "Physics3D::PhysicsCar3D::SimulateHandBrakeKey" }, "parameters": [ "Object", - "Property" + "PhysicsCar3D" ] } ] @@ -4091,7 +6399,7 @@ { "description": "Behavior", "name": "Behavior", - "supplementaryInformation": "SpriteMultitouchJoystick::PlatformerMultitouchMapper", + "supplementaryInformation": "SpriteMultitouchJoystick::PhysicsCar3DMultitouchMapper", "type": "behavior" } ], @@ -4102,11 +6410,12 @@ { "value": "", "type": "Behavior", - "label": "Platform character behavior", + "label": "3D physics car", "extraInformation": [ - "PlatformBehavior::PlatformerObjectBehavior" + "Physics3D::PhysicsCar3D" ], - "name": "Property" + "choices": [], + "name": "PhysicsCar3D" }, { "value": "1", @@ -4115,22 +6424,45 @@ "name": "ControllerIdentifier" }, { - "value": "Primary", + "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": "Joystick name", + "label": "Speed joystick", "group": "Controls", - "extraInformation": [ - "Primary", - "Secondary" + "choices": [ + { + "label": "Primary", + "value": "Primary" + }, + { + "label": "Secondary", + "value": "Secondary" + } ], - "name": "JoystickIdentifier" + "name": "SpeedJoystickIdentifier" }, { - "value": "A", + "value": "B", "type": "String", - "label": "Jump button name", + "label": "Hand brake button name", "group": "Controls", - "name": "JumpButton" + "name": "HandBrakeButton" } ], "sharedPropertyDescriptors": [] @@ -4140,6 +6472,7 @@ "fullName": "Top-down multitouch controller mapper", "name": "TopDownMultitouchMapper", "objectType": "", + "quickCustomizationVisibility": "hidden", "eventsFunctions": [ { "fullName": "", @@ -4152,11 +6485,10 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "StickMode", "=", "\"Analog\"" ] @@ -4181,11 +6513,10 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "StickMode", "=", "\"360°\"" ] @@ -4210,11 +6541,10 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::TopDownMultitouchMapper::PropertyStickMode" + "value": "StringVariable" }, "parameters": [ - "Object", - "Behavior", + "StickMode", "=", "\"8 Directions\"" ] @@ -4656,6 +6986,7 @@ "extraInformation": [ "TopDownMovementBehavior::TopDownMovementBehavior" ], + "choices": [], "name": "TopDownMovement" }, { @@ -4668,9 +6999,15 @@ "value": "Primary", "type": "Choice", "label": "Joystick name", - "extraInformation": [ - "Primary", - "Secondary" + "choices": [ + { + "label": "Primary", + "value": "Primary" + }, + { + "label": "Secondary", + "value": "Secondary" + } ], "name": "JoystickIdentifier" }, @@ -4679,10 +7016,19 @@ "type": "Choice", "label": "Stick mode", "group": "Controls", - "extraInformation": [ - "Analog", - "360°", - "8 Directions" + "choices": [ + { + "label": "Analog", + "value": "Analog" + }, + { + "label": "360°", + "value": "360°" + }, + { + "label": "8 Directions", + "value": "8 Directions" + } ], "name": "StickMode" } @@ -4925,17 +7271,90 @@ "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ + "conditions": [ { "type": { - "value": "MettreAutour" + "inverted": true, + "value": "SpriteMultitouchJoystick::IsInGameEdition" }, "parameters": [ - "Thumb", - "Border", - "Border.MultitouchJoystick::JoystickForce() * Border.Width() / 2", - "Border.MultitouchJoystick::JoystickAngle()" + "", + "" + ] + } + ], + "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", + "" + ] + } ] } ] @@ -5003,7 +7422,7 @@ "Border", "MultitouchJoystick", "=", - "Object.PropertyControllerIdentifier()", + "ControllerIdentifier", "" ] }, @@ -5015,7 +7434,7 @@ "Border", "MultitouchJoystick", "=", - "Object.PropertyJoystickIdentifier()", + "JoystickIdentifier", "" ] }, @@ -5027,7 +7446,92 @@ "Border", "MultitouchJoystick", "=", - "Object.PropertyDeadZoneRadius()", + "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)", "" ] } @@ -5044,6 +7548,92 @@ ], "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", @@ -5057,10 +7647,12 @@ { "type": { "inverted": true, - "value": "GetArgumentAsBoolean" + "value": "BooleanVariable" }, "parameters": [ - "\"ShouldActivate\"" + "ShouldActivate", + "True", + "" ] } ], @@ -5082,10 +7674,12 @@ "conditions": [ { "type": { - "value": "GetArgumentAsBoolean" + "value": "BooleanVariable" }, "parameters": [ - "\"ShouldActivate\"" + "ShouldActivate", + "True", + "" ] } ], @@ -5701,9 +8295,15 @@ "value": "Primary", "type": "Choice", "label": "Joystick name", - "extraInformation": [ - "Primary", - "Secondary" + "choices": [ + { + "label": "Primary", + "value": "Primary" + }, + { + "label": "Secondary", + "value": "Secondary" + } ], "name": "JoystickIdentifier" }, @@ -5722,6 +8322,7 @@ "extraInformation": [ "Thumb" ], + "choices": [], "hidden": true, "name": "ThumbAnchorOrigin" }, @@ -5741,6 +8342,7 @@ "extraInformation": [ "Thumb" ], + "choices": [], "hidden": true, "name": "ThumbIsScaledProportionally" }, @@ -5751,9 +8353,15 @@ "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 b6faa348a..276a1baaf 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.8.3", + "version": "1.9.0", "description": [ - "Multitouch joysticks can be used the same way as physical gamepads:", + "Multitouch joysticks are objects showing a joystick on the screen, useful for mobile. They work like a physical gamepad:", "- 4 or 8 directions", "- Analogus pads", "- Player selection", - "- Controls mapping for top-down movement and platformer characters", + "- Automatic \"mapper\" behaviors for 2D and 3D movement behaviors (platformer characters, top-down movement, 3D character etc...). Add one of these to the object with the movement behavior (i.e: the player most of the time) and the behavior will then be controlled automatically by the virtual joystick (it works by reading the multitouch joystick state and simulating controls). No need for additional events to make it work once the behaviors are set up.", "", "There are ready-to-use joysticks in the asset-store [multitouch joysticks pack](https://editor.gdevelop.io/?initial-dialog=asset-store&asset-pack=multitouch-joysticks-multitouch-joysticks)." ], @@ -8065,6 +8065,28 @@ } ], "eventsFunctions": [ + { + "description": "Check if the events are running for the editor.", + "fullName": "Editor is running", + "functionType": "Condition", + "name": "IsInGameEdition", + "private": true, + "sentence": "Events are running for the editor", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const game = runtimeScene.getGame();\r", + "eventsFunctionContext.returnValue = game.isInGameEdition && game.isInGameEdition();" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [], + "objectGroups": [] + }, { "fullName": "Accelerated speed", "functionType": "Expression", @@ -8483,11 +8505,11 @@ "objectGroups": [] }, { - "description": "Check if a button is pressed on a gamepad.", - "fullName": "Multitouch controller button pressed", + "description": "Check if a button was just pressed on a multitouch controller.", + "fullName": "Multitouch controller button just pressed", "functionType": "Condition", - "name": "IsButtonPressed", - "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", + "name": "IsButtonJustPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ was just pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -8499,7 +8521,73 @@ "parameters": [ "Controllers[ControllerIdentifier].Buttons[Button].State", "=", - "\"Pressed\"" + "\"JustPressed\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Multitouch controller identifier (1, 2, 3, 4...)", + "name": "ControllerIdentifier", + "type": "expression" + }, + { + "description": "Button name", + "name": "Button", + "supplementaryInformation": "[\"A\",\"CROSS\",\"B\",\"CIRCLE\",\"X\",\"SQUARE\",\"Y\",\"TRIANGLE\",\"LB\",\"L1\",\"RB\",\"R1\",\"LT\",\"L2\",\"RT\",\"R2\",\"UP\",\"DOWN\",\"LEFT\",\"RIGHT\",\"BACK\",\"SHARE\",\"START\",\"OPTIONS\",\"CLICK_STICK_LEFT\",\"CLICK_STICK_RIGHT\",\"PS_BUTTON\",\"CLICK_TOUCHPAD\"]", + "type": "string" + } + ], + "objectGroups": [] + }, + { + "description": "Check if a button is pressed on a multitouch controller.", + "fullName": "Multitouch controller button pressed", + "functionType": "Condition", + "name": "IsButtonPressed", + "sentence": "Button _PARAM2_ of multitouch controller _PARAM1_ is pressed", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::Or" + }, + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"Pressed\"" + ] + }, + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Controllers[ControllerIdentifier].Buttons[Button].State", + "=", + "\"JustPressed\"" + ] + } ] } ], @@ -8531,7 +8619,7 @@ "objectGroups": [] }, { - "description": "Check if a button is released on a gamepad.", + "description": "Check if a button is released on a multitouch controller.", "fullName": "Multitouch controller button released", "functionType": "Condition", "name": "IsButtonReleased", @@ -8617,7 +8705,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"Pressed\",\"JustPressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -9990,41 +10078,23 @@ "conditions": [ { "type": { - "value": "HasGameJustResumed" + "inverted": true, + "value": "SpriteMultitouchJoystick::IsInGameEdition" }, "parameters": [ + "", "" ] } ], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" - }, - "parameters": [ - "Object", - "Behavior", - "" - ] - } - ] - }, - { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Manage touches", - "source": "", - "type": "BuiltinCommonInstructions::Group", + "actions": [], "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "value": "HasAnyTouchOrMouseStarted" + "value": "HasGameJustResumed" }, "parameters": [ "" @@ -10034,171 +10104,207 @@ "actions": [ { "type": { - "value": "SetNumberVariable" + "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" }, "parameters": [ - "TouchIndex", - "=", - "0" + "Object", + "Behavior", + "" ] } - ], + ] + }, + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Manage touches", + "source": "", + "type": "BuiltinCommonInstructions::Group", "events": [ { - "type": "BuiltinCommonInstructions::Repeat", - "repeatExpression": "StartedTouchOrMouseCount()", - "conditions": [], - "actions": [], + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "HasAnyTouchOrMouseStarted" + }, + "parameters": [ + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchIndex", + "=", + "0" + ] + } + ], "events": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "StartedTouchOrMouseCount()", + "conditions": [], + "actions": [], + "events": [ { - "type": { - "value": "NumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "0" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "0" + ] + }, + { + "type": { + "value": "CollisionPoint" + }, + "parameters": [ + "Object", + "TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)", + "TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "StartedTouchOrMouseId(TouchIndex)" + ] + } ] }, { - "type": { - "value": "CollisionPoint" - }, - "parameters": [ - "Object", - "TouchX(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)", - "TouchY(StartedTouchOrMouseId(TouchIndex), Object.Layer(), 0)" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchId", - "=", - "StartedTouchOrMouseId(TouchIndex)" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "TouchIndex", - "+", - "1" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchIndex", + "+", + "1" + ] + } ] } ] } ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 - }, - "comment": "Move thumb back to center when not being pressed (acts like a spring on a real controller)" - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + }, { - "type": { - "value": "HasTouchEnded" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 }, - "parameters": [ - "", - "TouchId" - ] - } - ], - "actions": [ + "comment": "Move thumb back to center when not being pressed (acts like a spring on a real controller)" + }, { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" - }, - "parameters": [ - "Object", - "Behavior", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "HasTouchEnded" + }, + "parameters": [ + "", + "TouchId" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::Reset" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } ] } - ] - } - ], - "parameters": [] - }, - { - "colorB": 228, - "colorG": 176, - "colorR": 74, - "creationTime": 0, - "name": "Update joystick position", - "source": "", - "type": "BuiltinCommonInstructions::Group", - "events": [ + ], + "parameters": [] + }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Update joystick position", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ { - "type": { - "value": "NumberVariable" - }, - "parameters": [ - "TouchId", - "!=", - "0" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "!=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickAngle" + }, + "parameters": [ + "Object", + "Behavior", + "AngleBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0))", + "AngleBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0))" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "clamp(2 * DistanceBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0)) / Object.Width(), 0, 1)", + "" + ] + } ] } ], - "actions": [ - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickAngle" - }, - "parameters": [ - "Object", - "Behavior", - "AngleBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0))", - "AngleBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0))" - ] - }, - { - "type": { - "value": "SpriteMultitouchJoystick::MultitouchJoystick::SetJoystickForce" - }, - "parameters": [ - "Object", - "Behavior", - "=", - "clamp(2 * DistanceBetweenPositions(Object.CenterX(), Object.CenterY(), TouchX(TouchId, Object.Layer(), 0), TouchY(TouchId, Object.Layer(), 0)) / Object.Width(), 0, 1)", - "" - ] - } - ] + "parameters": [] } - ], - "parameters": [] + ] } ], "parameters": [ @@ -11073,7 +11179,7 @@ "sharedPropertyDescriptors": [] }, { - "description": "Detect button presses made on a touchscreen.", + "description": "Detect presses made on a touchscreen on the object so it acts like a button and automatically trigger the button having the same identifier for the mapper behaviors.", "fullName": "Multitouch button", "name": "MultitouchButton", "objectType": "", @@ -11089,11 +11195,11 @@ "conditions": [ { "type": { - "value": "SpriteMultitouchJoystick::MultitouchButton::IsReleased" + "value": "BooleanVariable" }, "parameters": [ - "Object", - "Behavior", + "IsReleased", + "True", "" ] } @@ -11122,6 +11228,44 @@ } ] }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "False", + "" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::MultitouchButton::SetButtonState" + }, + "parameters": [ + "Object", + "Behavior", + "\"Pressed\"", + "" + ] + } + ] + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ @@ -11214,7 +11358,17 @@ "parameters": [ "Object", "Behavior", - "\"Pressed\"", + "\"JustPressed\"", + "" + ] + }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "True", "" ] } @@ -11285,6 +11439,16 @@ "" ] }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsJustPressed", + "False", + "" + ] + }, { "type": { "value": "SetNumberVariable" @@ -11314,11 +11478,11 @@ "objectGroups": [] }, { - "description": "Check if button is released.", - "fullName": "Button released", + "description": "Check if the button was just pressed.", + "fullName": "Button just pressed", "functionType": "Condition", - "name": "IsReleased", - "sentence": "Button _PARAM0_ is released", + "name": "IsJustPressed", + "sentence": "Button _PARAM0_ was just pressed", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -11328,7 +11492,7 @@ "value": "BooleanVariable" }, "parameters": [ - "IsReleased", + "IsJustPressed", "True", "" ] @@ -11362,7 +11526,7 @@ "objectGroups": [] }, { - "description": "Check if button is pressed.", + "description": "Check if the button is pressed.", "fullName": "Button pressed", "functionType": "Condition", "name": "IsPressed", @@ -11409,6 +11573,54 @@ ], "objectGroups": [] }, + { + "description": "Check if the button is released.", + "fullName": "Button released", + "functionType": "Condition", + "name": "IsReleased", + "sentence": "Button _PARAM0_ is released", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsReleased", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "SpriteMultitouchJoystick::MultitouchButton", + "type": "behavior" + } + ], + "objectGroups": [] + }, { "fullName": "Button state", "functionType": "Action", @@ -11450,7 +11662,7 @@ { "description": "Button state", "name": "ButtonState", - "supplementaryInformation": "[\"Idle\",\"Pressed\",\"Released\"]", + "supplementaryInformation": "[\"Idle\",\"JustPressed\",\"Pressed\",\"Released\"]", "type": "stringWithSelector" } ], @@ -11491,6 +11703,13 @@ "hidden": true, "name": "IsReleased" }, + { + "value": "", + "type": "Boolean", + "label": "Button just pressed", + "hidden": true, + "name": "IsJustPressed" + }, { "value": "0", "type": "Number", @@ -13879,7 +14098,6 @@ "ambientLightColorB": 200, "ambientLightColorG": 200, "ambientLightColorR": 200, - "camera2DPlaneMaxDrawingDistance": 5000, "camera3DFarPlaneDistance": 10000, "camera3DFieldOfView": 45, "camera3DNearPlaneDistance": 3, @@ -13906,7 +14124,6 @@ } ], "instances": [], - "editionSettings": {}, "eventsFunctions": [ { "fullName": "", @@ -14023,74 +14240,92 @@ "name": "doStepPostEvents", "sentence": "", "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "MettreAutour" - }, - "parameters": [ - "Thumb", - "Border", - "Border.MultitouchJoystick::JoystickForce() * Border.Width() / 2", - "Border.MultitouchJoystick::JoystickAngle()" - ] - } - ] - }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ - { - "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "ShouldBeHiddenWhenReleased", - "True", - "" - ] - }, { "type": { "inverted": true, - "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::IsPressed" + "value": "SpriteMultitouchJoystick::IsInGameEdition" }, "parameters": [ - "Object", + "", "" ] } ], - "actions": [ - { - "type": { - "value": "Cache" - }, - "parameters": [ - "Object" - ] - }, + "actions": [], + "events": [ { - "type": { - "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::ActivateControl" - }, - "parameters": [ - "Object", - "no", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "MettreAutour" + }, + "parameters": [ + "Thumb", + "Border", + "Border.MultitouchJoystick::JoystickForce() * Border.Width() / 2", + "Border.MultitouchJoystick::JoystickAngle()" + ] + } ] }, { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "ShouldBeHiddenWhenReleased", - "False", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "ShouldBeHiddenWhenReleased", + "True", + "" + ] + }, + { + "type": { + "inverted": true, + "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::IsPressed" + }, + "parameters": [ + "Object", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "Cache" + }, + "parameters": [ + "Object" + ] + }, + { + "type": { + "value": "SpriteMultitouchJoystick::SpriteMultitouchJoystick::ActivateControl" + }, + "parameters": [ + "Object", + "no", + "" + ] + }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "ShouldBeHiddenWhenReleased", + "False", + "" + ] + } ] } ] @@ -15097,8 +15332,7 @@ "hidden": true, "name": "ShouldBeHiddenWhenReleased" } - ], - "variants": [] + ] } ] },