diff --git a/src/assets/weapons/icons/ammo_machinegun.png b/src/assets/weapons/icons/ammo_machinegun.png new file mode 100644 index 00000000..3b0969e7 Binary files /dev/null and b/src/assets/weapons/icons/ammo_machinegun.png differ diff --git a/src/assets/weapons/icons/ammo_machinegunLauncher.png b/src/assets/weapons/icons/ammo_machinegunLauncher.png new file mode 100644 index 00000000..37cf0657 Binary files /dev/null and b/src/assets/weapons/icons/ammo_machinegunLauncher.png differ diff --git a/src/assets/weapons/icons/ammo_pistol.png b/src/assets/weapons/icons/ammo_pistol.png new file mode 100644 index 00000000..906e2cc6 Binary files /dev/null and b/src/assets/weapons/icons/ammo_pistol.png differ diff --git a/src/assets/weapons/icons/ammo_rocket.png b/src/assets/weapons/icons/ammo_rocket.png new file mode 100644 index 00000000..9344d1d4 Binary files /dev/null and b/src/assets/weapons/icons/ammo_rocket.png differ diff --git a/src/assets/weapons/icons/ammo_rocketModern.png b/src/assets/weapons/icons/ammo_rocketModern.png new file mode 100644 index 00000000..848db616 Binary files /dev/null and b/src/assets/weapons/icons/ammo_rocketModern.png differ diff --git a/src/assets/weapons/icons/ammo_shotgun.png b/src/assets/weapons/icons/ammo_shotgun.png new file mode 100644 index 00000000..62564532 Binary files /dev/null and b/src/assets/weapons/icons/ammo_shotgun.png differ diff --git a/src/assets/weapons/icons/ammo_sniper.png b/src/assets/weapons/icons/ammo_sniper.png new file mode 100644 index 00000000..03d3afa2 Binary files /dev/null and b/src/assets/weapons/icons/ammo_sniper.png differ diff --git a/src/assets/weapons/icons/ammo_uzi.png b/src/assets/weapons/icons/ammo_uzi.png new file mode 100644 index 00000000..752d784b Binary files /dev/null and b/src/assets/weapons/icons/ammo_uzi.png differ diff --git a/src/assets/weapons/icons/bar.png b/src/assets/weapons/icons/bar.png new file mode 100644 index 00000000..7298f83b Binary files /dev/null and b/src/assets/weapons/icons/bar.png differ diff --git a/src/assets/weapons/icons/flamethrower_long.png b/src/assets/weapons/icons/flamethrower_long.png new file mode 100644 index 00000000..833edf6d Binary files /dev/null and b/src/assets/weapons/icons/flamethrower_long.png differ diff --git a/src/assets/weapons/icons/flamethrower_short.png b/src/assets/weapons/icons/flamethrower_short.png new file mode 100644 index 00000000..1769115e Binary files /dev/null and b/src/assets/weapons/icons/flamethrower_short.png differ diff --git a/src/assets/weapons/icons/grenade.png b/src/assets/weapons/icons/grenade.png new file mode 100644 index 00000000..ae9b2bf4 Binary files /dev/null and b/src/assets/weapons/icons/grenade.png differ diff --git a/src/assets/weapons/icons/grenadeFlash.png b/src/assets/weapons/icons/grenadeFlash.png new file mode 100644 index 00000000..fcfcea9e Binary files /dev/null and b/src/assets/weapons/icons/grenadeFlash.png differ diff --git a/src/assets/weapons/icons/grenadeSmoke.png b/src/assets/weapons/icons/grenadeSmoke.png new file mode 100644 index 00000000..cb63dd36 Binary files /dev/null and b/src/assets/weapons/icons/grenadeSmoke.png differ diff --git a/src/assets/weapons/icons/grenadeVintage.png b/src/assets/weapons/icons/grenadeVintage.png new file mode 100644 index 00000000..dd129eac Binary files /dev/null and b/src/assets/weapons/icons/grenadeVintage.png differ diff --git a/src/assets/weapons/icons/knifeRound_sharp.png b/src/assets/weapons/icons/knifeRound_sharp.png new file mode 100644 index 00000000..ff01891c Binary files /dev/null and b/src/assets/weapons/icons/knifeRound_sharp.png differ diff --git a/src/assets/weapons/icons/knifeRound_smooth.png b/src/assets/weapons/icons/knifeRound_smooth.png new file mode 100644 index 00000000..fed60988 Binary files /dev/null and b/src/assets/weapons/icons/knifeRound_smooth.png differ diff --git a/src/assets/weapons/icons/knife_sharp.png b/src/assets/weapons/icons/knife_sharp.png new file mode 100644 index 00000000..13518f8b Binary files /dev/null and b/src/assets/weapons/icons/knife_sharp.png differ diff --git a/src/assets/weapons/icons/knife_smooth.png b/src/assets/weapons/icons/knife_smooth.png new file mode 100644 index 00000000..3cc2aa5b Binary files /dev/null and b/src/assets/weapons/icons/knife_smooth.png differ diff --git a/src/assets/weapons/icons/machinegun.png b/src/assets/weapons/icons/machinegun.png new file mode 100644 index 00000000..bde6e3d2 Binary files /dev/null and b/src/assets/weapons/icons/machinegun.png differ diff --git a/src/assets/weapons/icons/machinegunLauncher.png b/src/assets/weapons/icons/machinegunLauncher.png new file mode 100644 index 00000000..2303e278 Binary files /dev/null and b/src/assets/weapons/icons/machinegunLauncher.png differ diff --git a/src/assets/weapons/icons/pistol.png b/src/assets/weapons/icons/pistol.png new file mode 100644 index 00000000..06c740c6 Binary files /dev/null and b/src/assets/weapons/icons/pistol.png differ diff --git a/src/assets/weapons/icons/pistolSilencer.png b/src/assets/weapons/icons/pistolSilencer.png new file mode 100644 index 00000000..6f8ee5c7 Binary files /dev/null and b/src/assets/weapons/icons/pistolSilencer.png differ diff --git a/src/assets/weapons/icons/rocketlauncher.png b/src/assets/weapons/icons/rocketlauncher.png new file mode 100644 index 00000000..18a53954 Binary files /dev/null and b/src/assets/weapons/icons/rocketlauncher.png differ diff --git a/src/assets/weapons/icons/rocketlauncherModern.png b/src/assets/weapons/icons/rocketlauncherModern.png new file mode 100644 index 00000000..a6768856 Binary files /dev/null and b/src/assets/weapons/icons/rocketlauncherModern.png differ diff --git a/src/assets/weapons/icons/shotgun.png b/src/assets/weapons/icons/shotgun.png new file mode 100644 index 00000000..13031d16 Binary files /dev/null and b/src/assets/weapons/icons/shotgun.png differ diff --git a/src/assets/weapons/icons/shotgunShort.png b/src/assets/weapons/icons/shotgunShort.png new file mode 100644 index 00000000..ccf71d26 Binary files /dev/null and b/src/assets/weapons/icons/shotgunShort.png differ diff --git a/src/assets/weapons/icons/sniper.png b/src/assets/weapons/icons/sniper.png new file mode 100644 index 00000000..44596085 Binary files /dev/null and b/src/assets/weapons/icons/sniper.png differ diff --git a/src/assets/weapons/icons/uzi.png b/src/assets/weapons/icons/uzi.png new file mode 100644 index 00000000..8e648ed6 Binary files /dev/null and b/src/assets/weapons/icons/uzi.png differ diff --git a/src/assets/weapons/icons/uziLong.png b/src/assets/weapons/icons/uziLong.png new file mode 100644 index 00000000..75dd5716 Binary files /dev/null and b/src/assets/weapons/icons/uziLong.png differ diff --git a/src/assets/weapons/icons/uziLongSilencer.png b/src/assets/weapons/icons/uziLongSilencer.png new file mode 100644 index 00000000..4a9121f8 Binary files /dev/null and b/src/assets/weapons/icons/uziLongSilencer.png differ diff --git a/src/assets/weapons/icons/uziSilencer.png b/src/assets/weapons/icons/uziSilencer.png new file mode 100644 index 00000000..2ca6fa7a Binary files /dev/null and b/src/assets/weapons/icons/uziSilencer.png differ diff --git a/src/eventsFunctionsExtensions/extendedvariables.json b/src/eventsFunctionsExtensions/extendedvariables.json new file mode 100644 index 00000000..2595123c --- /dev/null +++ b/src/eventsFunctionsExtensions/extendedvariables.json @@ -0,0 +1,1225 @@ +{ + "author": "@Bouh, D8H", + "category": "General", + "extensionNamespace": "", + "fullName": "Extended variables support", + "helpPath": "", + "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0ibWRpLXZhcmlhYmxlLWJveCIgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0IiB2aWV3Qm94PSIwIDAgMjQgMjQiPjxwYXRoIGQ9Ik0xOSAzSDVDMy45IDMgMyAzLjkgMyA1VjE5QzMgMjAuMSAzLjkgMjEgNSAyMUgxOUMyMC4xIDIxIDIxIDIwLjEgMjEgMTlWNUMyMSAzLjkgMjAuMSAzIDE5IDNNNy40IDE4QzUuOSAxNi41IDUgMTQuMyA1IDEyUzUuOSA3LjUgNy40IDZMOSA2LjdDNy43IDcuOSA3IDkuOSA3IDEyUzcuNyAxNi4xIDkgMTcuM0w3LjQgMThNMTIuNyAxNUwxMS45IDEzTDEwLjUgMTVIOUwxMS4zIDExLjlMMTAgOUgxMS4zTDEyLjEgMTFMMTMuNSA5SDE1TDEyLjggMTJMMTQuMSAxNUgxMi43TTE2LjYgMThMMTUgMTcuM0MxNi4zIDE2IDE3IDE0LjEgMTcgMTJTMTYuMyA3LjkgMTUgNi43TDE2LjYgNkMxOC4xIDcuNSAxOSA5LjcgMTkgMTJTMTguMSAxNi41IDE2LjYgMThaIiAvPjwvc3ZnPg==", + "name": "ExtendedVariables", + "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/variable-box.svg", + "shortDescription": "Add conditions, actions and expressions to check for the existence of a variable, copy variables, delete existing ones from memory, and create dynamic variables.", + "version": "1.0.3", + "description": [ + "This extension provides: ", + "- Conditions to check if a global/scene/object variable exists.", + "- Actions to copy object variables, global and scene variables.", + "- Actions to delete an existing global/scene variable from memory.", + "- Actions to create a global/scene variable using a text expression, rather than a variable name input.", + "- Expressions to get the value or text from a global/scene variable using a text expression, rather than a variable name.", + "", + "Text expressions allows to enter the name of the variable with an expression like `\"MyVar\"+ ToString(Variable(Health))`" + ], + "origin": { + "identifier": "ExtendedVariables", + "name": "gdevelop-extension-store" + }, + "tags": [ + "variable", + "scene", + "global", + "object", + "remove", + "expression", + "copy", + "structure", + "array", + "boolean", + "duplication" + ], + "authorIds": [ + "2OwwM8ToR9dx9RJ2sAKTcrLmCB92", + "IWykYNRvhCZBN3vEgKEbBPOR3Oc2" + ], + "dependencies": [], + "eventsFunctions": [ + { + "description": "Check if a global variable exists.", + "fullName": "Global variable exists", + "functionType": "Condition", + "group": "Deprecated", + "name": "C_global_variable_exist", + "private": true, + "sentence": "If the global variable _PARAM1_ exist", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "False" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "ExtendedVariables::GlobalVariableExist" + }, + "parameters": [ + "", + "GetArgumentAsString(\"GlobalVariableName\")", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Name of the global variable", + "name": "GlobalVariableName", + "type": "string" + } + ], + "objectGroups": [] + }, + { + "description": "Check if the global variable exists.", + "fullName": "Global variable exists", + "functionType": "Condition", + "group": "Global variables", + "name": "GlobalVariableExist", + "sentence": "If the global variable _PARAM1_ exist", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const globalVariables = runtimeScene.getGame().getVariables();\r", + "eventsFunctionContext.returnValue = globalVariables.has(eventsFunctionContext.getArgument(\"GlobalVariableName\"));" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [ + { + "description": "Name of the global variable", + "name": "GlobalVariableName", + "type": "string" + } + ], + "objectGroups": [] + }, + { + "description": "Check if a scene variable exists.", + "fullName": "Scene variable exists", + "functionType": "Condition", + "group": "Deprecated", + "name": "C_scene_variable_exist", + "private": true, + "sentence": "If the scene variable _PARAM1_ exist", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "False" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "ExtendedVariables::SceneVariableExist" + }, + "parameters": [ + "", + "GetArgumentAsString(\"SceneVariableName\")", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Name of the scene variable", + "name": "SceneVariableName", + "type": "string" + } + ], + "objectGroups": [] + }, + { + "description": "Check if the scene variable exists.", + "fullName": "Scene variable exists", + "functionType": "Condition", + "group": "Scene variables", + "name": "SceneVariableExist", + "sentence": "If the scene variable _PARAM1_ exist", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const sceneVariables = runtimeScene.getVariables();\r", + "eventsFunctionContext.returnValue = sceneVariables.has(eventsFunctionContext.getArgument(\"SceneVariableName\"));" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [ + { + "description": "Name of the scene variable", + "name": "SceneVariableName", + "type": "string" + } + ], + "objectGroups": [] + }, + { + "description": "Check if an object variable exists.", + "fullName": "Object variable exists", + "functionType": "Condition", + "group": "Deprecated", + "name": "C_object_variable_exist", + "private": true, + "sentence": "Object _PARAM1_ has object variable _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "False" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "ExtendedVariables::ObjectVariableExist" + }, + "parameters": [ + "", + "ObjectToCheck", + "GetArgumentAsString(\"ObjectVariableName\")", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "ObjectToCheck", + "type": "objectList" + }, + { + "description": "Name of object variable", + "name": "ObjectVariableName", + "type": "string" + } + ], + "objectGroups": [] + }, + { + "description": "Check if an object variable exists.", + "fullName": "Object variable exists", + "functionType": "Condition", + "group": "Variables", + "name": "ObjectVariableExist", + "sentence": "Object _PARAM1_ has object variable _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "let returnValue = true;\r", + "if (!objects.length) {\r", + " returnValue = false;\r", + "} else {\r", + " const objectVariableName = eventsFunctionContext.getArgument(\"ObjectVariableName\");\r", + " for (let i = 0; i < objects.length; i++) {\r", + " if (!objects[i].hasVariable(objectVariableName)) {\r", + " // If any object does NOT have the variable, return false.\r", + " returnValue = false;\r", + " break;\r", + " }\r", + " }\r", + "}\r", + "\r", + "eventsFunctionContext.returnValue = returnValue;" + ], + "parameterObjects": "ObjectToCheck", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [ + { + "description": "Object", + "name": "ObjectToCheck", + "type": "objectList" + }, + { + "description": "Name of object variable", + "name": "ObjectVariableName", + "type": "string" + } + ], + "objectGroups": [] + }, + { + "description": "Delete a global variable, removing it from memory.", + "fullName": "Delete global variable", + "functionType": "Action", + "group": "Deprecated", + "name": "A_Delete_global_variable", + "private": true, + "sentence": "Delete global variable _PARAM1_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "ExtendedVariables::DeleteGlobalVariable" + }, + "parameters": [ + "", + "GetArgumentAsString(\"GlobalVariableName\")", + "" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Name of the global variable to delete", + "name": "GlobalVariableName", + "type": "string" + } + ], + "objectGroups": [] + }, + { + "description": "Delete the global variable, removing it from memory.", + "fullName": "Delete global variable", + "functionType": "Action", + "group": "Global variables", + "name": "DeleteGlobalVariable", + "sentence": "Delete the global variable _PARAM1_ from memory", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": "runtimeScene.getGame().getVariables().remove(eventsFunctionContext.getArgument(\"GlobalVariableName\"));", + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [ + { + "description": "Name of the global variable to delete", + "name": "GlobalVariableName", + "type": "string" + } + ], + "objectGroups": [] + }, + { + "description": "Modify the text of a scene variable.", + "fullName": "String of a scene variable", + "functionType": "Action", + "group": "Deprecated", + "name": "A_Modify_scene_variable_string", + "private": true, + "sentence": "Change the text of scene variable _PARAM1_ to _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "ExtendedVariables::ModifySceneVariableString" + }, + "parameters": [ + "", + "GetArgumentAsString(\"SceneVariableName\")", + "GetArgumentAsNumber(\"SceneVariableValue\")", + "" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Name of the scene variable", + "name": "SceneVariableName", + "type": "string" + }, + { + "description": "Value", + "name": "SceneVariableValue", + "type": "string" + } + ], + "objectGroups": [] + }, + { + "description": "Modify the text of a scene variable.", + "fullName": "String of a scene variable", + "functionType": "Action", + "group": "Scene variables", + "name": "ModifySceneVariableString", + "sentence": "Change the text of scene variable _PARAM1_ to _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const variable = runtimeScene.getVariables().get(eventsFunctionContext.getArgument(\"SceneVariableName\"));\r", + "variable.setString(eventsFunctionContext.getArgument(\"SceneVariableValue\"));" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [ + { + "description": "Name of the scene variable", + "name": "SceneVariableName", + "type": "string" + }, + { + "description": "Value", + "name": "SceneVariableValue", + "type": "string" + } + ], + "objectGroups": [] + }, + { + "description": "Modify the text of a global variable.", + "fullName": "String of a global variable", + "functionType": "Action", + "group": "Global variables", + "name": "ModifyGlobalVariableString", + "sentence": "Change the text of global variable _PARAM1_ to _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const variable = runtimeScene.getGame().getVariables().get(eventsFunctionContext.getArgument(\"GlobalVariableName\"));\r", + "variable.setString(eventsFunctionContext.getArgument(\"GlobalVariableValue\"));" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [ + { + "description": "Name of the global variable", + "name": "GlobalVariableName", + "type": "string" + }, + { + "description": "Value", + "name": "GlobalVariableValue", + "type": "string" + } + ], + "objectGroups": [] + }, + { + "description": "Modify the value of a global variable.", + "fullName": "Value of a global variable", + "functionType": "Action", + "group": "Deprecated", + "name": "A_Modify_global_variable", + "private": true, + "sentence": "Change the global variable _PARAM1_ with value: _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "ExtendedVariables::ModifyGlobalVariable" + }, + "parameters": [ + "", + "GetArgumentAsString(\"SceneVariableName\")", + "GetArgumentAsNumber(\"SceneVariableValue\")", + "" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Name of the global variable", + "name": "SceneVariableName", + "type": "string" + }, + { + "description": "Value", + "name": "SceneVariableValue", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Modify the text of a global variable.", + "fullName": "String of a global variable", + "functionType": "Action", + "group": "Deprecated", + "name": "A_Modify_global_variable_string", + "private": true, + "sentence": "Change the text of global variable _PARAM1_ to _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "ExtendedVariables::ModifyGlobalVariableString" + }, + "parameters": [ + "", + "GetArgumentAsString(\"SceneVariableName\")", + "GetArgumentAsNumber(\"SceneVariableValue\")", + "" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Name of the global variable", + "name": "SceneVariableName", + "type": "string" + }, + { + "description": "Value", + "name": "SceneVariableValue", + "type": "string" + } + ], + "objectGroups": [] + }, + { + "description": "Modify the value of a global variable.", + "fullName": "Value of a global variable", + "functionType": "Action", + "group": "Global variables", + "name": "ModifyGlobalVariable", + "sentence": "Change the global variable _PARAM1_ with value: _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const variable = runtimeScene.getGame().getVariables().get(eventsFunctionContext.getArgument(\"GlobalVariableName\"));\r", + "variable.setNumber(eventsFunctionContext.getArgument(\"GlobalVariableValue\"));" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [ + { + "description": "Name of the global variable", + "name": "GlobalVariableName", + "type": "string" + }, + { + "description": "Value", + "name": "GlobalVariableValue", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Modify the value of a scene variable.", + "fullName": "Value of a scene variable", + "functionType": "Action", + "group": "Deprecated", + "name": "A_Modify_scene_variable", + "private": true, + "sentence": "Change the scene variable _PARAM1_ with value: _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "ExtendedVariables::ModifySceneVariable" + }, + "parameters": [ + "", + "GetArgumentAsString(\"SceneVariableName\")", + "GetArgumentAsNumber(\"SceneVariableValue\")", + "" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Name of the scene variable", + "name": "SceneVariableName", + "type": "string" + }, + { + "description": "Value", + "name": "SceneVariableValue", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Modify the value of a scene variable.", + "fullName": "Value of a scene variable", + "functionType": "Action", + "group": "Scene variables", + "name": "ModifySceneVariable", + "sentence": "Change the scene variable _PARAM1_ with value: _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const variable = runtimeScene.getVariables().get(eventsFunctionContext.getArgument(\"SceneVariableName\"));\r", + "variable.setNumber(eventsFunctionContext.getArgument(\"SceneVariableValue\"));" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [ + { + "description": "Name of the scene variable", + "name": "SceneVariableName", + "type": "string" + }, + { + "description": "Value", + "name": "SceneVariableValue", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Delete scene variable, the variable will be deleted from the memory.", + "fullName": "Delete scene variable", + "functionType": "Action", + "group": "Deprecated", + "name": "A_Delete_scene_variable", + "private": true, + "sentence": "Delete the scene variable _PARAM1_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "ExtendedVariables::DeleteSceneVariable" + }, + "parameters": [ + "", + "GetArgumentAsString(\"SceneVariableName\")", + "" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Name of the scene variable to delete", + "name": "SceneVariableName", + "type": "string" + } + ], + "objectGroups": [] + }, + { + "description": "Delete the scene variable, the variable will be deleted from the memory.", + "fullName": "Delete scene variable", + "functionType": "Action", + "group": "Scene variables", + "name": "DeleteSceneVariable", + "sentence": "Delete the scene variable _PARAM1_ from memory", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": "runtimeScene.getVariables().remove(eventsFunctionContext.getArgument(\"SceneVariableName\"));", + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [ + { + "description": "Name of the scene variable to delete", + "name": "SceneVariableName", + "type": "string" + } + ], + "objectGroups": [] + }, + { + "description": "Copy an object variable from one object to another.", + "fullName": "Copy an object variable", + "functionType": "Action", + "group": "Deprecated", + "name": "A_CopyObjectVariable", + "private": true, + "sentence": "Copy the variable _PARAM1_ of _PARAM2_ to the variable _PARAM3_ of _PARAM4_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "ExtendedVariables::CopyObjectVariable" + }, + "parameters": [ + "", + "SourceObject", + "GetArgumentAsString(\"SourceVariableName\")", + "TargetObject", + "GetArgumentAsString(\"TargetVariableName\")", + "no", + "" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Source object", + "name": "SourceObject", + "type": "objectList" + }, + { + "description": "Variable to copy", + "name": "SourceVariableName", + "type": "string" + }, + { + "description": "Destination object", + "longDescription": "To copy the variable between 2 instances of the same object, the variable has to be copied to another object first.", + "name": "TargetObject", + "type": "objectList" + }, + { + "description": "Destination variable", + "name": "TargetVariableName", + "type": "string" + } + ], + "objectGroups": [] + }, + { + "description": "Copy the object variable from one object to another.", + "fullName": "Copy an object variable", + "functionType": "Action", + "group": "Variables", + "name": "CopyObjectVariable", + "sentence": "Copy the variable _PARAM2_ of _PARAM1_ to the variable _PARAM4_ of _PARAM3_ (clear destination first: _PARAM5_)", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const sourceObject = eventsFunctionContext.getObjects(\"SourceObject\")[0];", + "const targetObject = eventsFunctionContext.getObjects(\"TargetObject\")[0];", + "const sourceVariableName = eventsFunctionContext.getArgument(\"SourceVariableName\");", + "const targetVariableName = eventsFunctionContext.getArgument(\"TargetVariableName\");", + "const isExactCopy = eventsFunctionContext.getArgument(\"isExactCopy\");", + "", + "const sourceVariables = sourceObject.getVariables();", + "const targetVariables = targetObject.getVariables();", + "", + "if (sourceVariables.has(sourceVariableName))", + "{", + " gdjs.Variable.copy", + " (", + " sourceVariables.get(sourceVariableName),", + " targetVariables.get(targetVariableName),", + " isExactCopy", + " );", + "}" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "parameters": [ + { + "description": "Source object", + "name": "SourceObject", + "type": "objectList" + }, + { + "description": "Variable to copy", + "name": "SourceVariableName", + "type": "string" + }, + { + "description": "Destination object", + "longDescription": "To copy the variable between 2 instances of the same object, the variable has to be copied to another object first.", + "name": "TargetObject", + "type": "objectList" + }, + { + "description": "Destination variable", + "name": "TargetVariableName", + "type": "string" + }, + { + "defaultValue": "yes", + "description": "Clear the destination variable before copying", + "name": "isExactCopy", + "optional": true, + "type": "yesorno" + } + ], + "objectGroups": [] + }, + { + "description": "Copy all object variables from one object to another.", + "fullName": "Copy all object variables", + "functionType": "Action", + "group": "Deprecated", + "name": "A_CopyAllObjectVariables", + "private": true, + "sentence": "Copy all variables from _PARAM1_ to _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "ExtendedVariables::CopyAllObjectVariables" + }, + "parameters": [ + "", + "SourceObject", + "TargetObject", + "no", + "" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Source object", + "name": "SourceObject", + "type": "objectList" + }, + { + "description": "Destination object", + "name": "TargetObject", + "type": "objectList" + } + ], + "objectGroups": [] + }, + { + "description": "Copy all object variables from one object to another.", + "fullName": "Copy all object variables", + "functionType": "Action", + "group": "Variables", + "name": "CopyAllObjectVariables", + "sentence": "Copy all variables from object _PARAM1_ to object _PARAM2_ (clear destination first: _PARAM3_)", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "// This JS event use private scope from the API, this can be borken at anytime.", + "", + "const sourceObject = eventsFunctionContext.getObjects(\"SourceObject\")[0];", + "const targetObject = eventsFunctionContext.getObjects(\"TargetObject\")[0];", + "const isExactCopy = eventsFunctionContext.getArgument(\"isExactCopy\");", + "", + "const targetVariables = targetObject.getVariables();", + "const sourceVariables = sourceObject.getVariables()._variables.items;", + "for (const variableName in sourceVariables)", + "{", + " if (sourceVariables.hasOwnProperty(variableName))", + " {", + " gdjs.Variable.copy(sourceVariables[variableName], targetVariables.get(variableName), isExactCopy);", + " }", + "}" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "parameters": [ + { + "description": "Source object", + "name": "SourceObject", + "type": "objectList" + }, + { + "description": "Destination object", + "name": "TargetObject", + "type": "objectList" + }, + { + "defaultValue": "yes", + "description": "Clear the destination variable before copying", + "name": "isExactCopy", + "optional": true, + "type": "yesorno" + } + ], + "objectGroups": [] + }, + { + "description": "Delete an object variable, removing it from memory.", + "fullName": "Delete object variable", + "functionType": "Action", + "group": "Variables", + "name": "DeleteObjectVariable", + "sentence": "Delete for the object _PARAM1_ the object variable _PARAM2_ from the memory", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const object = eventsFunctionContext.getObjects(\"Object\")[0];\r", + "const objectVariables = object.getVariables();\r", + "\r", + "objectVariables.remove(eventsFunctionContext.getArgument(\"VariableName\"));" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "objectList" + }, + { + "description": "Name of object variable", + "name": "VariableName", + "type": "string" + } + ], + "objectGroups": [] + }, + { + "description": "Return the text of a global variable.", + "fullName": "Text of a global variable", + "functionType": "StringExpression", + "group": "Global variables", + "name": "GlobalVariableString", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const globalVariables = runtimeScene.getGame().getVariables();\r", + "const variableExist = globalVariables.has(eventsFunctionContext.getArgument(\"GlobalVariableName\"));\r", + "\r", + "if (variableExist) {\r", + " eventsFunctionContext.returnValue = globalVariables.get(eventsFunctionContext.getArgument(\"GlobalVariableName\")).getAsString();\r", + "}" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "expressionType": { + "type": "string" + }, + "parameters": [ + { + "description": "Name of the global variable", + "name": "GlobalVariableName", + "type": "string" + } + ], + "objectGroups": [] + }, + { + "description": "Return the text of a scene variable.", + "fullName": "Text of a scene variable", + "functionType": "StringExpression", + "group": "Scene variables", + "name": "VariableString", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const sceneVariables = runtimeScene.getVariables();\r", + "const variableExist = sceneVariables.has(eventsFunctionContext.getArgument(\"SceneVariableName\"));\r", + "\r", + "if (variableExist) {\r", + " eventsFunctionContext.returnValue = sceneVariables.get(eventsFunctionContext.getArgument(\"SceneVariableName\")).getAsString();\r", + "}" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "expressionType": { + "type": "string" + }, + "parameters": [ + { + "description": "Name of the scene variable", + "name": "SceneVariableName", + "type": "string" + } + ], + "objectGroups": [] + }, + { + "description": "Return the value of a global variable.", + "fullName": "Value of a global variable", + "functionType": "Expression", + "group": "Global variables", + "name": "GlobalVariable", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const globalVariables = runtimeScene.getGame().getVariables();\r", + "const variableExist = globalVariables.has(eventsFunctionContext.getArgument(\"GlobalVariableName\"));\r", + "\r", + "if (variableExist) {\r", + " eventsFunctionContext.returnValue = globalVariables.get(eventsFunctionContext.getArgument(\"GlobalVariableName\")).getAsNumber();\r", + "}" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Name of the global variable", + "name": "GlobalVariableName", + "type": "string" + } + ], + "objectGroups": [] + }, + { + "description": "Return the value of a scene variable.", + "fullName": "Value of a scene variable", + "functionType": "Expression", + "group": "Scene variables", + "name": "Variable", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const sceneVariables = runtimeScene.getVariables();\r", + "const variableExist = sceneVariables.has(eventsFunctionContext.getArgument(\"SceneVariableName\"));\r", + "\r", + "if (variableExist) {\r", + " eventsFunctionContext.returnValue = sceneVariables.get(eventsFunctionContext.getArgument(\"SceneVariableName\")).getAsNumber();\r", + "}" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Name of the scene variable", + "name": "SceneVariableName", + "type": "string" + } + ], + "objectGroups": [] + }, + { + "description": "Copy the global variable to scene. This copy everything from the types to the values.", + "fullName": "Copy a global variable to scene", + "functionType": "Action", + "group": "Convert", + "name": "CopyGlobalVariableToScene", + "sentence": "Copy the global variable:_PARAM1_ to a scene variable:_PARAM2_ (clear destination first: _PARAM3_)", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const globalVariable = runtimeScene.getGame().getVariables().get(eventsFunctionContext.getArgument(\"globalVariableName\"));", + "const sceneVariable = runtimeScene.getVariables().get(eventsFunctionContext.getArgument(\"sceneVariableName\"));", + "const isExactCopy = eventsFunctionContext.getArgument(\"isExactCopy\");", + "", + "gdjs.Variable.copy(globalVariable, sceneVariable, isExactCopy);", + "" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "parameters": [ + { + "description": "Global variable to copy", + "name": "globalVariableName", + "type": "string" + }, + { + "description": "Scene variable destination", + "name": "sceneVariableName", + "type": "string" + }, + { + "defaultValue": "yes", + "description": "Clear the destination variable before copying", + "name": "isExactCopy", + "optional": true, + "type": "yesorno" + } + ], + "objectGroups": [] + }, + { + "description": "Copy the scene variable to global. This copy everything from the types to the values.", + "fullName": "Copy a scene variable to global ", + "functionType": "Action", + "group": "Copy variables", + "name": "CopySceneVariableToGlobal", + "sentence": "Copy the scene variable:_PARAM1_ to a global variable:_PARAM2_ (clear destination first: _PARAM3_)", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const sceneVariable = runtimeScene.getVariables().get(eventsFunctionContext.getArgument(\"sceneVariableName\"));", + "const globalVariable = runtimeScene.getGame().getVariables().get(eventsFunctionContext.getArgument(\"globalVariableName\"));", + "const isExactCopy = eventsFunctionContext.getArgument(\"isExactCopy\");", + "", + "gdjs.Variable.copy(sceneVariable, globalVariable, isExactCopy);" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "parameters": [ + { + "description": "Scene variable to copy", + "name": "sceneVariableName", + "type": "string" + }, + { + "description": "Global variable destination", + "name": "globalVariableName", + "type": "string" + }, + { + "defaultValue": "yes", + "description": "Clear the destination variable before copying", + "name": "isExactCopy", + "optional": true, + "type": "yesorno" + } + ], + "objectGroups": [] + } + ], + "eventsBasedBehaviors": [], + "eventsBasedObjects": [] +} \ No newline at end of file diff --git a/src/eventsFunctionsExtensions/gamepads.json b/src/eventsFunctionsExtensions/gamepads.json new file mode 100644 index 00000000..3fb5268b --- /dev/null +++ b/src/eventsFunctionsExtensions/gamepads.json @@ -0,0 +1,3551 @@ +{ + "author": "Bouh", + "category": "Input", + "extensionNamespace": "", + "fullName": "Gamepads (controllers)", + "helpPath": "/all-features/gamepad", + "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0ibWRpLWdhbWVwYWQtdmFyaWFudC1vdXRsaW5lIiB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCI+PHBhdGggZD0iTTYsOUg4VjExSDEwVjEzSDhWMTVINlYxM0g0VjExSDZWOU0xOC41LDlBMS41LDEuNSAwIDAsMSAyMCwxMC41QTEuNSwxLjUgMCAwLDEgMTguNSwxMkExLjUsMS41IDAgMCwxIDE3LDEwLjVBMS41LDEuNSAwIDAsMSAxOC41LDlNMTUuNSwxMkExLjUsMS41IDAgMCwxIDE3LDEzLjVBMS41LDEuNSAwIDAsMSAxNS41LDE1QTEuNSwxLjUgMCAwLDEgMTQsMTMuNUExLjUsMS41IDAgMCwxIDE1LjUsMTJNMTcsNUE3LDcgMCAwLDEgMjQsMTJBNyw3IDAgMCwxIDE3LDE5QzE1LjA0LDE5IDEzLjI3LDE4LjIgMTIsMTYuOUMxMC43MywxOC4yIDguOTYsMTkgNywxOUE3LDcgMCAwLDEgMCwxMkE3LDcgMCAwLDEgNyw1SDE3TTcsN0E1LDUgMCAwLDAgMiwxMkE1LDUgMCAwLDAgNywxN0M4LjY0LDE3IDEwLjA5LDE2LjIxIDExLDE1SDEzQzEzLjkxLDE2LjIxIDE1LjM2LDE3IDE3LDE3QTUsNSAwIDAsMCAyMiwxMkE1LDUgMCAwLDAgMTcsN0g3WiIgLz48L3N2Zz4=", + "name": "Gamepads", + "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/gamepad-variant-outline.svg", + "shortDescription": "Add support for gamepads (or other controllers) to your game, giving access to information such as button presses, axis positions, trigger pressure, etc...", + "version": "0.6.1", + "description": [ + "Add support for gamepads (or other controllers).", + "", + "It gives access to:", + "- button presses", + "- axis positions and force", + "- trigger pressure", + "- configurable deadzone", + "- vibration", + "- automatic mappers for platformer characters and top-down movement", + "", + "The Bomberman-like example handles 4 players with gamepads ([open the project online](https://editor.gdevelop.io/?project=example://goose-bomberman))." + ], + "origin": { + "identifier": "Gamepads", + "name": "gdevelop-extension-store" + }, + "tags": [ + "controllers", + "gamepads", + "joysticks", + "axis", + "xbox", + "ps4", + "platformer", + "platform", + "top-down" + ], + "authorIds": [ + "2OwwM8ToR9dx9RJ2sAKTcrLmCB92", + "taRwmWxwAFYFL9yyBwB3cwBw0BO2", + "mnImQKdn8nQxwzkS5D6a1JB27V23" + ], + "dependencies": [], + "eventsFunctions": [ + { + "description": "Get the value of the pressure on a gamepad trigger.", + "fullName": "Pressure on a gamepad trigger", + "functionType": "Expression", + "name": "TriggerPressure", + "sentence": "Player _PARAM1_ push axis _PARAM2_ to _PARAM3_", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "/** @type {Gamepad[]} */\r", + "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", + "\r", + "//Get function parameters\r", + "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", + "const trigger = eventsFunctionContext.getArgument(\"trigger\").toUpperCase();\r", + "\r", + "if (playerId < 0 || playerId > 4) {\r", + " console.error('Parameter gamepad identifier in expression: \"Pressure on a gamepad trigger\", is not valid number, must be between 0 and 4.');\r", + " return;\r", + "}\r", + "if (trigger != \"LT\" && trigger != \"RT\" && trigger != \"L2\" && trigger != \"R2\") {\r", + " console.error('Parameter trigger is not valid in expression: \"Pressure on a gamepad trigger\"');\r", + " return;\r", + "}\r", + "\r", + "const gamepad = gamepads[playerId];\r", + "\r", + "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", + "if (gamepad == null) return;\r", + "\r", + "switch (trigger) {\r", + " case 'LT':\r", + " case 'L2':\r", + " eventsFunctionContext.returnValue = gamepad.buttons[6].value;\r", + " break;\r", + "\r", + " case 'RT':\r", + " case 'R2':\r", + " eventsFunctionContext.returnValue = gamepad.buttons[7].value;\r", + " break;\r", + "\r", + " default:\r", + " eventsFunctionContext.returnValue = -1;\r", + " break;\r", + "}" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "The gamepad identifier: 1, 2, 3 or 4", + "name": "player_ID", + "type": "expression" + }, + { + "description": "Trigger button", + "name": "trigger", + "supplementaryInformation": "[\"LT\",\"RT\",\"L2\",\"R2\"]", + "type": "stringWithSelector" + } + ], + "objectGroups": [] + }, + { + "description": "the force of gamepad stick (from 0 to 1).", + "fullName": "Stick force", + "functionType": "ExpressionAndCondition", + "name": "StickForce", + "sentence": "the gamepad _PARAM1_ _PARAM2_ stick force", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "/** @type {Gamepad[]} */\r", + "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", + "\r", + "//Get function parameters\r", + "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", + "const stick = eventsFunctionContext.getArgument(\"stick\").toUpperCase();\r", + "\r", + "\r", + "if (playerId < 0 || playerId > 4) {\r", + " console.error('Parameter gamepad identifier is not valid in expression: \"Value of a stick force\"');\r", + " return;\r", + "}\r", + "\r", + "if (stick !== \"LEFT\" && stick !== \"RIGHT\") {\r", + " console.error('Parameter stick is not valid in expression: \"Value of a stick force\"');\r", + " return;\r", + "}\r", + "\r", + "const gamepad = gamepads[playerId];\r", + "\r", + "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", + "if (gamepad == null) return;\r", + "\r", + "\r", + "switch (stick) {\r", + " case 'LEFT':\r", + " eventsFunctionContext.returnValue = gdjs.evtTools.common.clamp(Math.abs(gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[0], playerId)) + Math.abs(gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[1], playerId)), 0, 1);\r", + " break;\r", + "\r", + " case 'RIGHT':\r", + " eventsFunctionContext.returnValue = gdjs.evtTools.common.clamp(Math.abs(gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[2], playerId)) + Math.abs(gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[3], playerId)), 0, 1);\r", + " break;\r", + "\r", + " default:\r", + " eventsFunctionContext.returnValue = -1;\r", + " break;\r", + "}" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "The gamepad identifier: 1, 2, 3 or 4", + "name": "player_ID", + "type": "expression" + }, + { + "description": "Stick: \"Left\" or \"Right\"", + "name": "stick", + "supplementaryInformation": "[\"Left\",\"Right\"]", + "type": "stringWithSelector" + } + ], + "objectGroups": [] + }, + { + "description": "Get the rotation value of a gamepad stick.\nIf the deadzone value is high, the angle value is rounded to main axes, left, left, up, down.\nAn zero deadzone value give a total freedom on the angle value.", + "fullName": "Value of a stick rotation (deprecated)", + "functionType": "Expression", + "name": "StickRotationValue", + "private": true, + "sentence": "Player _PARAM1_ push axis _PARAM2_ to _PARAM3_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "Gamepads::StickAngle(GetArgumentAsNumber(\"player_ID\"), GetArgumentAsString(\"stick\"))" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "The gamepad identifier: 1, 2, 3 or 4", + "name": "player_ID", + "type": "expression" + }, + { + "description": "Stick: \"Left\" or \"Right\"", + "name": "stick", + "supplementaryInformation": "[\"Left\",\"Right\"]", + "type": "stringWithSelector" + } + ], + "objectGroups": [] + }, + { + "description": "Return the angle of a gamepad stick.\nIf the deadzone value is high, the angle value is rounded to main axes, left, left, up, down.\nAn zero deadzone value give a total freedom on the angle value.", + "fullName": "Stick angle", + "functionType": "Expression", + "name": "StickAngle", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "/** @type {Gamepad[]} */\r", + "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", + "\r", + "//Get function parameters\r", + "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", + "const stick = eventsFunctionContext.getArgument(\"stick\").toUpperCase();\r", + "\r", + "\r", + "if (playerId < 0 || playerId > 4) {\r", + " console.error('Parameter gamepad identifier is not valid in expression: \"Value of a stick rotation\"');\r", + " return;\r", + "}\r", + "if (stick !== \"LEFT\" && stick !== \"RIGHT\") {\r", + " console.error('Parameter stick is not valid in expression: \"Value of a stick rotation\"');\r", + " return;\r", + "}\r", + "const gamepad = gamepads[playerId];\r", + "\r", + "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", + "if (gamepad == null) return;\r", + "\r", + "switch (stick) {\r", + " case 'LEFT':\r", + " eventsFunctionContext.returnValue = gdjs._extensionController.axisToAngle(gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[0], playerId), gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[1], playerId));\r", + " break;\r", + "\r", + " case 'RIGHT':\r", + " eventsFunctionContext.returnValue = gdjs._extensionController.axisToAngle(gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[2], playerId), gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[3], playerId));\r", + " break;\r", + "\r", + " default:\r", + " eventsFunctionContext.returnValue = -1;\r", + " break;\r", + "}" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "The gamepad identifier: 1, 2, 3 or 4", + "name": "player_ID", + "type": "expression" + }, + { + "description": "Stick: \"Left\" or \"Right\"", + "name": "stick", + "supplementaryInformation": "[\"Left\",\"Right\"]", + "type": "stringWithSelector" + } + ], + "objectGroups": [] + }, + { + "description": "Get the value of axis of a gamepad stick.", + "fullName": "Value of a gamepad axis (deprecated)", + "functionType": "Expression", + "name": "AxisValue", + "private": true, + "sentence": "Player _PARAM1_ push axis _PARAM2_ to _PARAM3_", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "/** @type {Gamepad[]} */\r", + "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", + "\r", + "//Get function parameters\r", + "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", + "const stick = eventsFunctionContext.getArgument(\"stick\").toUpperCase();\r", + "const direction = eventsFunctionContext.getArgument(\"direction\").toUpperCase();\r", + "\r", + "if (playerId < 0 || playerId > 4) {\r", + " console.error('Parameter gamepad identifier is not valid in expression: \"Value of a gamepad axis\"');\r", + " return;\r", + "}\r", + "if (stick != \"LEFT\" && stick != \"RIGHT\") {\r", + " console.error('Parameter stick is not valid in expression: \"Value of a gamepad axis\"');\r", + " return;\r", + "}\r", + "if (direction != \"UP\" && direction != \"DOWN\" && direction != \"LEFT\" && direction != \"RIGHT\" && direction != \"HORIZONTAL\" && direction != \"VERTICAL\") {\r", + " console.error('Parameter direction is not valid in expression: \"Value of a gamepad axis\"');\r", + " return;\r", + "}\r", + "const gamepad = gamepads[playerId];\r", + "\r", + "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", + "if (gamepad == null) return;\r", + "\r", + "let parameterError = false;\r", + "switch (stick) {\r", + " case 'LEFT':\r", + " switch (direction) {\r", + " case 'LEFT':\r", + " if (gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[0], playerId) < 0) {\r", + " eventsFunctionContext.returnValue = -gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[0], playerId);\r", + " }\r", + " break;\r", + "\r", + " case 'RIGHT':\r", + " if (gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[0], playerId) > 0) {\r", + " eventsFunctionContext.returnValue = gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[0], playerId);\r", + " }\r", + " break;\r", + "\r", + " case 'UP':\r", + " if (gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[1], playerId) < 0) {\r", + " eventsFunctionContext.returnValue = -gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[1], playerId);\r", + " }\r", + " break;\r", + "\r", + " case 'DOWN':\r", + " if (gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[1], playerId) > 0) {\r", + " eventsFunctionContext.returnValue = gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[1], playerId);\r", + " }\r", + " break;\r", + "\r", + " case \"HORIZONTAL\":\r", + " eventsFunctionContext.returnValue = gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[0], playerId);\r", + " break;\r", + "\r", + " case \"VERTICAL\":\r", + " eventsFunctionContext.returnValue = gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[1], playerId);\r", + " break;\r", + "\r", + " default:\r", + " break;\r", + " }\r", + " break;\r", + "\r", + " case 'RIGHT':\r", + " switch (direction) {\r", + " case 'LEFT':\r", + " if (gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[2], playerId) < 0) {\r", + " eventsFunctionContext.returnValue = -gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[2], playerId);\r", + " }\r", + " break;\r", + "\r", + " case 'RIGHT':\r", + " if (gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[2], playerId) > 0) {\r", + " eventsFunctionContext.returnValue = gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[2], playerId);\r", + " }\r", + " break;\r", + "\r", + " case 'UP':\r", + " if (gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[3], playerId) < 0) {\r", + " eventsFunctionContext.returnValue = -gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[3], playerId);\r", + " }\r", + " break;\r", + "\r", + " case 'DOWN':\r", + " if (gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[3], playerId) > 0) {\r", + " eventsFunctionContext.returnValue = gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[3], playerId);\r", + " }\r", + " break;\r", + "\r", + " case \"HORIZONTAL\":\r", + " eventsFunctionContext.returnValue = gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[2], playerId);\r", + " break;\r", + "\r", + " case \"VERTICAL\":\r", + " eventsFunctionContext.returnValue = gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[3], playerId);\r", + " break;\r", + "\r", + " default:\r", + " break;\r", + " }\r", + " break;\r", + "\r", + " default:\r", + " break;\r", + "}\r", + "" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "The gamepad identifier: 1, 2, 3 or 4", + "name": "player_ID", + "type": "expression" + }, + { + "description": "Stick: \"Left\" or \"Right\"", + "name": "stick", + "supplementaryInformation": "[\"Left\",\"Right\"]", + "type": "stringWithSelector" + }, + { + "description": "Direction", + "name": "direction", + "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\",\"Horizontal\",\"Vertical\"]", + "type": "stringWithSelector" + } + ], + "objectGroups": [] + }, + { + "description": "Return the gamepad 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::JsCode", + "inlineCode": [ + "/** @type {Gamepad[]} */\r", + "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", + "\r", + "//Get function parameters\r", + "const playerId = eventsFunctionContext.getArgument(\"Gamepad\") - 1;\r", + "const stick = eventsFunctionContext.getArgument(\"Stick\").toLowerCase();\r", + "\r", + "if (playerId < 0 || playerId > 4) {\r", + " console.error('Parameter gamepad identifier is not valid in expression: \"Value of a gamepad axis\"');\r", + " return;\r", + "}\r", + "if (stick != \"left\" && stick != \"right\") {\r", + " console.error('Parameter stick is not valid in expression: \"Value of a gamepad axis\"');\r", + " return;\r", + "}\r", + "const gamepad = gamepads[playerId];\r", + "\r", + "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", + "if (gamepad == null) return;\r", + "\r", + "const axisIndex = stick === 'right' ? 2 : 0;\r", + "eventsFunctionContext.returnValue = gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[axisIndex], playerId);\r", + "" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "The gamepad identifier: 1, 2, 3 or 4", + "name": "Gamepad", + "type": "expression" + }, + { + "description": "Stick: \"Left\" or \"Right\"", + "name": "Stick", + "supplementaryInformation": "[\"Left\",\"Right\"]", + "type": "stringWithSelector" + } + ], + "objectGroups": [] + }, + { + "description": "Return the gamepad 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::JsCode", + "inlineCode": [ + "/** @type {Gamepad[]} */\r", + "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", + "\r", + "//Get function parameters\r", + "const playerId = eventsFunctionContext.getArgument(\"Gamepad\") - 1;\r", + "const stick = eventsFunctionContext.getArgument(\"Stick\").toLowerCase();\r", + "\r", + "if (playerId < 0 || playerId > 4) {\r", + " console.error('Parameter gamepad identifier is not valid in expression: \"Value of a gamepad axis\"');\r", + " return;\r", + "}\r", + "if (stick != \"left\" && stick != \"right\") {\r", + " console.error('Parameter stick is not valid in expression: \"Value of a gamepad axis\"');\r", + " return;\r", + "}\r", + "const gamepad = gamepads[playerId];\r", + "\r", + "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", + "if (gamepad == null) return;\r", + "\r", + "const axisIndex = stick === 'right' ? 3 : 1;\r", + "eventsFunctionContext.returnValue = gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[axisIndex], playerId);\r", + "" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "The gamepad identifier: 1, 2, 3 or 4", + "name": "Gamepad", + "type": "expression" + }, + { + "description": "Stick: \"Left\" or \"Right\"", + "name": "Stick", + "supplementaryInformation": "[\"Left\",\"Right\"]", + "type": "stringWithSelector" + } + ], + "objectGroups": [] + }, + { + "description": "Test if a button is released on a gamepad. Buttons can be:\n* Xbox: \"A\", \"B\", \"X\", \"Y\", \"LB\", \"RB\", \"LT\", \"RT\", \"BACK\", \"START\",\n* PS4: \"CROSS\", \"SQUARE\", \"CIRCLE\", \"TRIANGLE\", \"L1\", \"L2\", \"R1\", \"R2\", \"SHARE\", \"OPTIONS\", \"PS_BUTTON\", \"CLICK_TOUCHPAD\",\n* Other: \"UP\", \"DOWN\", \"LEFT\", \"RIGHT\", \"CLICK_STICK_LEFT\", \"CLICK_STICK_RIGHT\".", + "fullName": "Gamepad button released", + "functionType": "Condition", + "name": "C_Button_released", + "sentence": "Button _PARAM2_ of gamepad _PARAM1_ is released", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "/** @type {Gamepad[]} */\r", + "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", + "\r", + "//Get function parameters\r", + "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", + "const button = eventsFunctionContext.getArgument(\"button\").toUpperCase();\r", + "\r", + "if (playerId < 0 || playerId > 4) {\r", + " console.error('Parameter gamepad identifier in condition: \"Gamepad button released\", is not valid number, must be between 0 and 4.');\r", + " return;\r", + "}\r", + "if (button === \"\") {\r", + " console.error('Parameter button is not valid in condition: \"Gamepad button released\"');\r", + " return;\r", + "}\r", + "\r", + "const gamepad = gamepads[playerId];\r", + "\r", + "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", + "if (gamepad == null) return;\r", + "\r", + "let buttonId;\r", + "\r", + "switch (button) {\r", + " case 'A':\r", + " case 'CROSS':\r", + " buttonId = 0;\r", + " break;\r", + " case 'B':\r", + " case 'CIRCLE':\r", + " buttonId = 1;\r", + " break;\r", + " case 'X':\r", + " case 'SQUARE':\r", + " buttonId = 2;\r", + " break;\r", + " case 'Y':\r", + " case 'TRIANGLE':\r", + " buttonId = 3;\r", + " break;\r", + " case 'LB':\r", + " case 'L1':\r", + " buttonId = 4;\r", + " break;\r", + " case 'RB':\r", + " case 'R1':\r", + " buttonId = 5;\r", + " break;\r", + " case 'LT':\r", + " case 'L2':\r", + " buttonId = 6;\r", + " break;\r", + " case 'RT':\r", + " case 'R2':\r", + " buttonId = 7;\r", + " break;\r", + "\r", + " case 'UP':\r", + " buttonId = 12;\r", + " break;\r", + " case 'DOWN':\r", + " buttonId = 13;\r", + " break;\r", + " case 'LEFT':\r", + " buttonId = 14;\r", + " break;\r", + " case 'RIGHT':\r", + " buttonId = 15;\r", + " break;\r", + "\r", + " case 'BACK':\r", + " case 'SHARE':\r", + " buttonId = 8;\r", + " break;\r", + " case 'START':\r", + " case 'OPTIONS':\r", + " buttonId = 9;\r", + " break;\r", + "\r", + " case 'CLICK_STICK_LEFT':\r", + " buttonId = 10;\r", + " break;\r", + " case 'CLICK_STICK_RIGHT':\r", + " buttonId = 11;\r", + " break;\r", + "\r", + " //PS4\r", + " case 'PS_BUTTON':\r", + " buttonId = 16;\r", + " break;\r", + " case 'CLICK_TOUCHPAD':\r", + " buttonId = 17;\r", + " break;\r", + "\r", + " default:\r", + " console.error('The button: ' + button + ' in condition: \"Gamepad button released\" is not valid.');\r", + " break;\r", + "}\r", + "\r", + "if (buttonId === undefined) {\r", + " console.error('There is no buttons valid in condition: \"Gamepad button released\"');\r", + " eventsFunctionContext.returnValue = false;\r", + " return;\r", + "}\r", + "\r", + "if (gamepad.buttons == null || gamepad.buttons[buttonId] == null) {\r", + " console.error('Buttons on the gamepad are not accessible in condition: \"Gamepad button released\"');\r", + " eventsFunctionContext.returnValue = false;\r", + " return;\r", + "}\r", + "\r", + "//Define default value on pressed button or use previous value\r", + "gdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId] = gdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId] || { pressed: false };\r", + "\r", + "//Get state of button at previous frame\r", + "const previousStateButton = gdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId].pressed;\r", + "\r", + "//When previousStateButton is true and actual button state is not pressed\r", + "//Player have release the button\r", + "if (previousStateButton === true && gamepad.buttons[buttonId].pressed === false) {\r", + " // Save the last button used for the player \r", + " gdjs._extensionController.players[playerId].lastButtonUsed = buttonId;\r", + " gdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId].pressed = true;\r", + " eventsFunctionContext.returnValue = true;\r", + "\r", + "} else {\r", + " gdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId].pressed = false;\r", + " eventsFunctionContext.returnValue = false;\r", + "}\r", + "" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "parameters": [ + { + "description": "The gamepad identifier: 1, 2, 3 or 4", + "name": "player_ID", + "type": "expression" + }, + { + "description": "Name of the button", + "name": "button", + "supplementaryInformation": "[\"A\",\"Cross\",\"B\",\"Circle\",\"X\",\"Square\",\"Y\",\"Triangle\",\"LB\",\"L1\",\"RB\",\"R1\",\"LT\",\"L2\",\"RT\",\"R2\",\"Up\",\"Down\",\"Left\",\"Right\",\"Back\",\"Share\",\"Start\",\"Options\",\"Click_Stick_Left\",\"Click_Stick_Right\",\"PS_Button\",\"Click_Touchpad\"]", + "type": "stringWithSelector" + } + ], + "objectGroups": [] + }, + { + "description": "Return the index of the last pressed button of a gamepad.", + "fullName": "Last pressed button (id)", + "functionType": "Expression", + "name": "LastButtonID", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "//Get function parameter\r", + "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", + "\r", + "//Player id is not valid\r", + "if (playerId < 0 || playerId > 4) {\r", + " console.error('Parameter gamepad identifier in expression: \"Last pressed button (id)\", is not valid number, must be between 0 and 4.');\r", + " return;\r", + "}\r", + "\r", + "//Return the last button used by the player\r", + "eventsFunctionContext.returnValue = gdjs._extensionController.players[playerId].lastButtonUsed;" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "The gamepad identifier: 1, 2, 3 or 4", + "name": "player_ID", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Check if any button is pressed on a gamepad.", + "fullName": "Any gamepad button pressed", + "functionType": "Condition", + "name": "C_Any_Button_pressed", + "sentence": "Any button of gamepad _PARAM1_ is pressed", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "/** @type {Gamepad[]} */\r", + "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", + "\r", + "//Get function parameter\r", + "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", + "\r", + "if (playerId < 0 || playerId > 4) {\r", + " console.error('Parameter gamepad identifier in condition: \"Any gamepad button pressed\", is not valid number, must be between 0 and 4.');\r", + " return;\r", + "}\r", + "const gamepad = gamepads[playerId];\r", + "\r", + "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", + "if (gamepad == null) return;\r", + "\r", + "let buttonId;\r", + "for (let i = 0; i < gamepad.buttons.length; i++) { //For each buttons\r", + " if (gamepad.buttons[i].pressed) { //One of them is pressed\r", + " buttonId = i; //Save the button pressed\r", + " break;\r", + " }\r", + "}\r", + "\r", + "if (buttonId === undefined) {\r", + " // No buttons are pressed.\r", + " eventsFunctionContext.returnValue = false;\r", + " return;\r", + "}\r", + "\r", + "if (gamepad.buttons == null || gamepad.buttons[buttonId] == null) {\r", + " console.error('Buttons on the gamepad are not accessible in condition: \"Any gamepad button pressed\"');\r", + " eventsFunctionContext.returnValue = false;\r", + " return;\r", + "}\r", + "\r", + "//When a button is pressed, save the button in lastButtonUsed for each players\r", + "if (gamepad.buttons[buttonId].pressed) gdjs._extensionController.players[playerId].lastButtonUsed = buttonId;\r", + "eventsFunctionContext.returnValue = gamepad.buttons[buttonId].pressed;\r", + "\r", + "\r", + "" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "parameters": [ + { + "description": "The gamepad identifier: 1, 2, 3 or 4", + "name": "player_ID", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Return the last button pressed. \nButtons for Xbox and PS4 can be:\n* Xbox: \"A\", \"B\", \"X\", \"Y\", \"LB\", \"RB\", \"LT\", \"RT\", \"BACK\", \"START\",\n* PS4: \"CROSS\", \"SQUARE\", \"CIRCLE\", \"TRIANGLE\", \"L1\", \"L2\", \"R1\", \"R2\", \"SHARE\", \"OPTIONS\", \"PS_BUTTON\", \"CLICK_TOUCHPAD\",\n* Both: \"UP\", \"DOWN\", \"LEFT\", \"RIGHT\", \"CLICK_STICK_LEFT\", \"CLICK_STICK_RIGHT\".", + "fullName": "Last pressed button (string)", + "functionType": "StringExpression", + "name": "LastButtonString", + "sentence": "Button _PARAM2_ of gamepad _PARAM1_ is pressed", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "/** @type {Gamepad[]} */\r", + "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", + "\r", + "//Get function parameters\r", + "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", + "const controllerType = eventsFunctionContext.getArgument(\"controller_type\").toUpperCase();\r", + "\r", + "if (playerId < 0 || playerId > 4) {\r", + " console.error('Parameter gamepad identifier in string expression: \"Last pressed button (LastButtonString)\", is not valid number, must be between 0 and 4.');\r", + " return;\r", + "}\r", + "if (controllerType === \"\") {\r", + " console.error('Parameter controller type is not valid in string expression: \"Last pressed button (LastButtonString)\"');\r", + " return;\r", + "}\r", + "\r", + "const gamepad = gamepads[playerId];\r", + "\r", + "if (gamepad !== null) { //Gamepad exist\r", + " //Get last btn id\r", + " const lastButtonUsedID = gdjs._extensionController.players[playerId].lastButtonUsed;\r", + "\r", + " //Return last button as string \r", + " eventsFunctionContext.returnValue = gdjs._extensionController.getInputString(controllerType, lastButtonUsedID);\r", + "\r", + "} else { //Gamepad dosen't exist\r", + " console.error('Your controller is not supported or the gamepad wasn\\'t detected in string expression: \"Last pressed button (LastButtonString)\"');\r", + " eventsFunctionContext.returnValue = \"Gamepad not connected\";\r", + "}" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "expressionType": { + "type": "string" + }, + "parameters": [ + { + "description": "The gamepad identifier: 1, 2, 3 or 4", + "name": "player_ID", + "type": "expression" + }, + { + "description": "Controller type", + "name": "controller_type", + "supplementaryInformation": "[\"Xbox\",\"PS4\"]", + "type": "stringWithSelector" + } + ], + "objectGroups": [] + }, + { + "description": "Return the number of gamepads.", + "fullName": "Gamepad count", + "functionType": "Expression", + "name": "GamepadCount", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", + "\r", + "//Get the last activated controller\r", + "const controllerId = gdjs._extensionController.lastActiveController;\r", + "\r", + "// Check if controller is active\r", + "const gamepad = gamepads[controllerId];\r", + "if (gamepad == null) {\r", + " eventsFunctionContext.returnValue = 0;\r", + "} else {\r", + " // Return active controller id\r", + " eventsFunctionContext.returnValue = controllerId + 1;\r", + "}\r", + "" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [], + "objectGroups": [] + }, + { + "description": "Check if a button is pressed on a gamepad. \nButtons can be:\n* Xbox: \"A\", \"B\", \"X\", \"Y\", \"LB\", \"RB\", \"LT\", \"RT\", \"BACK\", \"START\",\n* PS4: \"CROSS\", \"SQUARE\", \"CIRCLE\", \"TRIANGLE\", \"L1\", \"L2\", \"R1\", \"R2\", \"SHARE\", \"OPTIONS\", \"PS_BUTTON\", \"CLICK_TOUCHPAD\",\n* Other: \"UP\", \"DOWN\", \"LEFT\", \"RIGHT\", \"CLICK_STICK_LEFT\", \"CLICK_STICK_RIGHT\".", + "fullName": "Gamepad button pressed", + "functionType": "Condition", + "name": "C_Button_pressed", + "sentence": "Button _PARAM2_ of gamepad _PARAM1_ is pressed", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "/** @type {Gamepad[]} */\r", + "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", + "\r", + "//Get function parameters\r", + "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", + "const button = eventsFunctionContext.getArgument(\"button\").toUpperCase();\r", + "\r", + "if (playerId < 0 || playerId > 4) {\r", + " console.error('Parameter gamepad identifier in condition: \"Gamepad button pressed\", is not valid number, must be between 0 and 4.');\r", + " return;\r", + "}\r", + "if (button === \"\") {\r", + " console.error('Parameter button is not valid in condition: \"Gamepad button pressed\"');\r", + " eventsFunctionContext.returnValue = false;\r", + " return;\r", + "}\r", + "\r", + "const gamepad = gamepads[playerId];\r", + "\r", + "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", + "if (gamepad == null) return;\r", + "\r", + "let buttonId;\r", + "\r", + "switch (button) {\r", + " case 'A':\r", + " case 'CROSS':\r", + " buttonId = 0;\r", + " break;\r", + " case 'B':\r", + " case 'CIRCLE':\r", + " buttonId = 1;\r", + " break;\r", + " case 'X':\r", + " case 'SQUARE':\r", + " buttonId = 2;\r", + " break;\r", + " case 'Y':\r", + " case 'TRIANGLE':\r", + " buttonId = 3;\r", + " break;\r", + " case 'LB':\r", + " case 'L1':\r", + " buttonId = 4;\r", + " break;\r", + " case 'RB':\r", + " case 'R1':\r", + " buttonId = 5;\r", + " break;\r", + " case 'LT':\r", + " case 'L2':\r", + " buttonId = 6;\r", + " break;\r", + " case 'RT':\r", + " case 'R2':\r", + " buttonId = 7;\r", + " break;\r", + "\r", + " case 'UP':\r", + " buttonId = 12;\r", + " break;\r", + " case 'DOWN':\r", + " buttonId = 13;\r", + " break;\r", + " case 'LEFT':\r", + " buttonId = 14;\r", + " break;\r", + " case 'RIGHT':\r", + " buttonId = 15;\r", + " break;\r", + "\r", + " case 'BACK':\r", + " case 'SHARE':\r", + " buttonId = 8;\r", + " break;\r", + " case 'START':\r", + " case 'OPTIONS':\r", + " buttonId = 9;\r", + " break;\r", + "\r", + " case 'CLICK_STICK_LEFT':\r", + " buttonId = 10;\r", + " break;\r", + " case 'CLICK_STICK_RIGHT':\r", + " buttonId = 11;\r", + " break;\r", + "\r", + " //PS4\r", + " case 'PS_BUTTON':\r", + " buttonId = 16;\r", + " break;\r", + " case 'CLICK_TOUCHPAD':\r", + " buttonId = 17;\r", + " break;\r", + "\r", + " default:\r", + " console.error('The button: ' + button + ' in condition: \"Gamepad button pressed\" is not valid.');\r", + " eventsFunctionContext.returnValue = false;\r", + " break;\r", + "}\r", + "\r", + "\r", + "\r", + "if (buttonId === undefined) {\r", + " console.error('There is no buttons valid in condition: \"Gamepad button pressed\"');\r", + " eventsFunctionContext.returnValue = false;\r", + " return;\r", + "}\r", + "\r", + "if (gamepad.buttons == null || gamepad.buttons[buttonId] == null) {\r", + " console.error('Buttons on the gamepad are not accessible in condition: \"Gamepad button pressed\"');\r", + " eventsFunctionContext.returnValue = false;\r", + " return;\r", + "}\r", + "\r", + "//When a button is pressed, save the button in lastButtonUsed for each players\r", + "if (gamepad.buttons[buttonId].pressed) gdjs._extensionController.players[playerId].lastButtonUsed = buttonId;\r", + "eventsFunctionContext.returnValue = gamepad.buttons[buttonId].pressed;\r", + "\r", + "\r", + "\r", + "" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "parameters": [ + { + "description": "The gamepad identifier: 1, 2, 3 or 4", + "name": "player_ID", + "type": "expression" + }, + { + "description": "Name of the button", + "name": "button", + "supplementaryInformation": "[\"A\",\"Cross\",\"B\",\"Circle\",\"X\",\"Square\",\"Y\",\"Triangle\",\"LB\",\"L1\",\"RB\",\"R1\",\"LT\",\"L2\",\"RT\",\"R2\",\"Up\",\"Down\",\"Left\",\"Right\",\"Back\",\"Share\",\"Start\",\"Options\",\"Click_Stick_Left\",\"Click_Stick_Right\",\"PS_Button\",\"Click_Touchpad\"]", + "type": "stringWithSelector" + } + ], + "objectGroups": [] + }, + { + "description": "Return the value of the deadzone applied to a gamepad sticks, between 0 and 1.", + "fullName": "Gamepad deadzone for sticks", + "functionType": "Expression", + "name": "Deadzone", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [] + }, + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "//Get function parameter\r", + "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", + "\r", + "if (playerId < 0 || playerId > 4) {\r", + " console.error('Parameter gamepad identifier in expression: \"Gamepad deadzone for sticks\", is not valid number, must be between 0 and 4.');\r", + " return;\r", + "}\r", + "///Return the deadzone value for a given player\r", + "eventsFunctionContext.returnValue = gdjs._extensionController.players[playerId].deadzone;" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "The gamepad identifier: 1, 2, 3 or 4", + "name": "player_ID", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Set the deadzone for sticks of the gamepad. 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). Deadzone is between 0 and 1, and is by default 0.2.", + "fullName": "Set gamepad deadzone for sticks", + "functionType": "Action", + "name": "A_Set_deadzone", + "sentence": "Set deadzone for sticks on gamepad: _PARAM1_ to _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "//Get function parameter\r", + "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", + "const newDeadzone = eventsFunctionContext.getArgument(\"deadzone\");\r", + "\r", + "if (playerId < 0 || playerId > 4) {\r", + " console.error('Parameter gamepad identifier in action: \"Set gamepad deadzone for sticks\", is not valid, must be between 0 and 4.');\r", + " return;\r", + "}\r", + "\r", + "// clamp the newDeadzone in range [0, 1].\r", + "// https://github.com/4ian/GDevelop-extensions/pull/33#issuecomment-618224857\r", + "gdjs._extensionController.players[playerId].deadzone = gdjs.evtTools.common.clamp(newDeadzone, 0, 1);\r", + "" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "parameters": [ + { + "description": "The gamepad identifier: 1, 2, 3 or 4", + "name": "player_ID", + "type": "expression" + }, + { + "description": "Deadzone for sticks, 0.2 by default (0 to 1)", + "name": "deadzone", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Check if a stick of a gamepad is pushed in a given direction.", + "fullName": "Gamepad stick pushed (axis)", + "functionType": "Condition", + "name": "C_Axis_pushed", + "sentence": "_PARAM2_ stick of gamepad _PARAM1_ is pushed in direction _PARAM3_", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "/** @type {Gamepad[]} */\r", + "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", + "\r", + "//Get function parameters\r", + "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", + "const stick = eventsFunctionContext.getArgument(\"stick\").toUpperCase();\r", + "const direction = eventsFunctionContext.getArgument(\"direction\").toUpperCase();\r", + "\r", + "if (playerId < 0 || playerId > 4) {\r", + " console.error('Parameter gamepad identifier in condition: \"Gamepad stick pushed (axis)\", is not valid number, must be between 0 and 4.');\r", + " return;\r", + "}\r", + "if (stick != \"LEFT\" && stick != \"RIGHT\") {\r", + " console.error('Parameter stick in condition: \"Gamepad stick pushed (axis)\", is not valid, must be LEFT or RIGHT');\r", + " return;\r", + "}\r", + "if (direction != \"UP\" && direction != \"DOWN\" && direction != \"LEFT\" && direction != \"RIGHT\" && direction != \"ANY\") {\r", + " console.error('Parameter deadzone in condition: \"Gamepad stick pushed (axis)\", is not valid, must be UP, DOWN, LEFT or RIGHT');\r", + " return;\r", + "}\r", + "\r", + "const gamepad = gamepads[playerId];\r", + "\r", + "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", + "if (gamepad == null) {\r", + " eventsFunctionContext.returnValue = false;\r", + " return;\r", + "}\r", + "\r", + "\r", + "//Define in onFirstSceneLoaded function\r", + "const getNormalizedAxisValue = gdjs._extensionController.getNormalizedAxisValue;\r", + "\r", + "switch (stick) {\r", + " case 'LEFT':\r", + " switch (direction) {\r", + " case 'LEFT':\r", + " if (getNormalizedAxisValue(gamepad.axes[0], playerId) < 0) {\r", + " eventsFunctionContext.returnValue = true;\r", + " return;\r", + " }\r", + " break;\r", + "\r", + " case 'RIGHT':\r", + " if (getNormalizedAxisValue(gamepad.axes[0], playerId) > 0) {\r", + " eventsFunctionContext.returnValue = true;\r", + " return;\r", + " }\r", + " break;\r", + "\r", + " case 'UP':\r", + " if (getNormalizedAxisValue(gamepad.axes[1], playerId) < 0) {\r", + " eventsFunctionContext.returnValue = true;\r", + " return;\r", + " }\r", + " break;\r", + "\r", + " case 'DOWN':\r", + " if (getNormalizedAxisValue(gamepad.axes[1], playerId) > 0) {\r", + " eventsFunctionContext.returnValue = true;\r", + " return;\r", + " }\r", + " break;\r", + "\r", + " case 'ANY':\r", + " if ( getNormalizedAxisValue(gamepad.axes[0], playerId) < 0\r", + " || getNormalizedAxisValue(gamepad.axes[0], playerId) > 0\r", + " || getNormalizedAxisValue(gamepad.axes[1], playerId) < 0 \r", + " || getNormalizedAxisValue(gamepad.axes[1], playerId) > 0) {\r", + " eventsFunctionContext.returnValue = true;\r", + " return;\r", + " }\r", + " break;\r", + "\r", + " default:\r", + " console.error('The value Direction on stick Left on the condition: \"Gamepad stick pushed (axis)\" is not valid.');\r", + " eventsFunctionContext.returnValue = false;\r", + " break;\r", + " }\r", + " break;\r", + "\r", + " case 'RIGHT':\r", + " switch (direction) {\r", + " case 'LEFT':\r", + " if (getNormalizedAxisValue(gamepad.axes[2], playerId) < 0) {\r", + " eventsFunctionContext.returnValue = true;\r", + " return;\r", + " }\r", + " break;\r", + "\r", + " case 'RIGHT':\r", + " if (getNormalizedAxisValue(gamepad.axes[2], playerId) > 0) {\r", + " eventsFunctionContext.returnValue = true;\r", + " return;\r", + " }\r", + " break;\r", + "\r", + " case 'UP':\r", + " if (getNormalizedAxisValue(gamepad.axes[3], playerId) < 0) {\r", + " eventsFunctionContext.returnValue = true;\r", + " return;\r", + " }\r", + " break;\r", + "\r", + " case 'DOWN':\r", + " if (getNormalizedAxisValue(gamepad.axes[3], playerId) > 0) {\r", + " eventsFunctionContext.returnValue = true;\r", + " return;\r", + " }\r", + " break;\r", + "\r", + " case 'ANY':\r", + " if ( getNormalizedAxisValue(gamepad.axes[2], playerId) < 0\r", + " || getNormalizedAxisValue(gamepad.axes[2], playerId) > 0\r", + " || getNormalizedAxisValue(gamepad.axes[3], playerId) < 0 \r", + " || getNormalizedAxisValue(gamepad.axes[3], playerId) > 0) {\r", + " eventsFunctionContext.returnValue = true;\r", + " return;\r", + " }\r", + " break;\r", + "\r", + " default:\r", + " console.error('The value Direction on stick Right on the condition: \"Gamepad stick pushed (axis)\" is not valid.');\r", + " eventsFunctionContext.returnValue = false;\r", + " break;\r", + " }\r", + " break;\r", + "\r", + " default:\r", + " console.error('The value Stick on the condition: \"Gamepad stick pushed (axis)\" is not valid.');\r", + " eventsFunctionContext.returnValue = false;\r", + " break;\r", + "}\r", + "\r", + "eventsFunctionContext.returnValue = false;\r", + "" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "parameters": [ + { + "description": "The gamepad identifier: 1, 2, 3 or 4", + "name": "player_ID", + "type": "expression" + }, + { + "description": "Stick: \"Left\" or \"Right\"", + "name": "stick", + "supplementaryInformation": "[\"Left\",\"Right\"]", + "type": "stringWithSelector" + }, + { + "description": "Direction", + "name": "direction", + "supplementaryInformation": "[\"Up\",\"Down\",\"Left\",\"Right\",\"Any\"]", + "type": "stringWithSelector" + } + ], + "objectGroups": [] + }, + { + "description": "Return the number of connected gamepads.", + "fullName": "Connected gamepads number", + "functionType": "Expression", + "name": "ConnectedGamepadsCount", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [] + }, + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "/** @type {Gamepad[]} */\r", + "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", + "\r", + "// Gamepads can be disconnected and become null, so we have to filter them.\r", + "eventsFunctionContext.returnValue = Object.keys(gamepads).filter(key => !!gamepads[key]).length;\r", + "" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [], + "objectGroups": [] + }, + { + "description": "Return a string containing informations about the specified gamepad.", + "fullName": "Gamepad type", + "functionType": "StringExpression", + "name": "GamepadType", + "sentence": "Player _PARAM1_ use _PARAM2_ controller", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "/** @type {Gamepad[]} */", + "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);", + "", + "//Get function parameter", + "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;", + "", + "if (playerId < 0 || playerId > 4) {", + " console.error('Parameter gamepad identifier in string expression: \"Gamepad type\", is not valid number, must be between 0 and 4');", + " return;", + "}", + "", + "const gamepad = gamepads[playerId];", + "", + "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.", + "if (gamepad == null) return;", + "", + "eventsFunctionContext.returnValue = (gamepad && gamepad.id) ? gamepad.id : \"No information for player \" + (playerId + 1)", + "" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "expressionType": { + "type": "string" + }, + "parameters": [ + { + "description": "The gamepad identifier: 1, 2, 3 or 4", + "name": "player_ID", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Check if the specified gamepad has the specified information in its description. Useful to know if the gamepad is a Xbox or PS4 controller.", + "fullName": "Gamepad type", + "functionType": "Condition", + "name": "C_Controller_type", + "sentence": "Gamepad _PARAM1_ is a _PARAM2_ controller", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "/** @type {Gamepad[]} */", + "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);", + "", + "//Get function parameters", + "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;", + "const controllerType = eventsFunctionContext.getArgument(\"controller_type\").toUpperCase();", + "", + "if (playerId < 0 || playerId > 4) {", + " console.error('Parameter gamepad identifier in condition: \"Gamepad type\", is not valid number, must be between 0 and 4.');", + " return;", + "}", + "if (controllerType === \"\") {", + " console.error('Parameter type in condition: \"Gamepad type\", is not a string.');", + " return;", + "}", + "", + "const gamepad = gamepads[playerId];", + "", + "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.", + "if (gamepad == null) return;", + "", + "", + "if (controllerType == \"XBOX\") {", + " eventsFunctionContext.returnValue = gdjs._extensionController.isXbox(gamepad);", + "} else {", + " eventsFunctionContext.returnValue = gamepad ? gamepad.id.toUpperCase().indexOf(controllerType) !== -1 : false;", + "}" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "parameters": [ + { + "description": "The gamepad identifier: 1, 2, 3 or 4", + "name": "player_ID", + "type": "expression" + }, + { + "description": "Type: \"Xbox\", \"PS4\", \"Steam\" or \"PS3\" (among other)", + "name": "controller_type", + "type": "string" + } + ], + "objectGroups": [] + }, + { + "description": "Check if a gamepad is connected.", + "fullName": "Gamepad connected", + "functionType": "Condition", + "name": "C_Controller_X_is_connected", + "sentence": "Gamepad _PARAM1_ is plugged and connected", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "/** @type {Gamepad[]} */", + "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);", + "", + "//Get function parameter", + "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;", + "", + "if (playerId < 0 || playerId > 4) {", + " console.error('Parameter gamepad identifier in condition: \"Gamepad connected\", is not valid number, must be between 0 and 4.');", + " return;", + "}", + "", + "// If gamepad was disconnected it will be null (so this will return false)", + "// If gamepad was never connected it will be undefined (so this will return false)", + "eventsFunctionContext.returnValue = !!gamepads[playerId];" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "parameters": [ + { + "description": "The gamepad identifier: 1, 2, 3 or 4", + "name": "player_ID", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Generate a vibration on the specified controller. Might only work if the game is running in a recent web browser.", + "fullName": "Gamepad vibration", + "functionType": "Action", + "name": "A_Vibrate_controller", + "sentence": "Make gamepad _PARAM1_ vibrate for _PARAM2_ seconds", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "/** @type {Gamepad[]} */", + "//Vibration work only on game in browser.", + "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);", + "", + "//Get function parameters", + "const playerId = eventsFunctionContext.getArgument(\"Player_ID\") - 1;", + "const duration = eventsFunctionContext.getArgument(\"Duration\") || 1;", + "", + "if (playerId < 0 || playerId > 4) {", + " console.error('Parameter gamepad identifier in action: \"Gamepad connected\", is not valid number, must be between 0 and 4.');", + " return;", + "}", + "", + "const gamepad = gamepads[playerId];", + "", + "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.", + "if (gamepad == null) return;", + "", + "if (gamepad && gamepad.vibrationActuator) {", + " gamepad.vibrationActuator.playEffect(\"dual-rumble\", {", + " startDelay: 0,", + " duration: duration * 1000,", + " weakMagnitude: 1.0,", + " strongMagnitude: 1.0", + " });", + "}" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "parameters": [ + { + "description": "The gamepad identifier: 1, 2, 3 or 4", + "name": "Player_ID", + "type": "expression" + }, + { + "description": "Time of the vibration, in seconds (optional, default value is 1)", + "name": "Duration", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Generate an advanced vibration on the specified controller. Incompatible with Firefox.", + "fullName": "Advanced gamepad vibration", + "functionType": "Action", + "name": "A_Advanced_Vibration_Controller", + "sentence": "Make gamepad _PARAM1_ vibrate for _PARAM2_ seconds with the vibration magnitude of _PARAM3_ and _PARAM4_", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "/** @type {Gamepad[]} */", + "//Vibration work only on game in browser.", + "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);", + "", + "//Get function parameters", + "const playerId = eventsFunctionContext.getArgument(\"Player_ID\") - 1;", + "const duration = eventsFunctionContext.getArgument(\"Duration\") || 1;", + "const strongRumbleMagnitude = eventsFunctionContext.getArgument(\"StrongMagnitude\");", + "const weakRumbleMagnitude = eventsFunctionContext.getArgument(\"WeakMagnitude\");", + "", + "if (playerId < 0 || playerId > 4) {", + " console.error('Parameter gamepad identifier in action: \"Advanced gamepad vibration\", is not valid number, must be between 0 and 4.');", + " return;", + "}", + "if (weakRumbleMagnitude < 0 || weakRumbleMagnitude > 1) {", + " console.error('Parameter weakRumble identifier in action: \"Advanced gamepad vibration\", is not valid number, must be between 0 and 1.');", + " return;", + "}", + "if (strongRumbleMagnitude < 0 || strongRumbleMagnitude > 1) {", + " console.error('Parameter strongRumble identifier in action: \"Advanced gamepad vibration\", is not valid number, must be between 0 and 1.');", + " return;", + "}", + "", + "const gamepad = gamepads[playerId];", + "", + "//we need keep this condition because when use have not yet plug the controller we can't get the controller in the gamepad variable.", + "if (gamepad == null) return;", + "", + "if (gamepad && gamepad.vibrationActuator) {", + " gamepad.vibrationActuator.playEffect(\"dual-rumble\", {", + " startDelay: 0,", + " duration: duration * 1000,", + " weakMagnitude: weakRumbleMagnitude,", + " strongMagnitude: strongRumbleMagnitude", + " });", + "}", + "", + "gdjs._extensionController.players[playerId].rumble.duration = duration;", + "gdjs._extensionController.players[playerId].rumble.elapsedTime = 0;", + "gdjs._extensionController.players[playerId].rumble.weakMagnitude = weakRumbleMagnitude;", + "gdjs._extensionController.players[playerId].rumble.strongMagnitude = strongRumbleMagnitude;" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "parameters": [ + { + "description": "The gamepad identifier: 1, 2, 3 or 4", + "name": "Player_ID", + "type": "expression" + }, + { + "description": "Time of the vibration, in seconds (optional, default value is 1)", + "name": "Duration", + "type": "expression" + }, + { + "description": "Strong rumble magnitude (from 0 to 1)", + "name": "StrongMagnitude", + "type": "expression" + }, + { + "description": "Weak rumble magnitude (from 0 to 1)", + "name": "WeakMagnitude", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Change a vibration on the specified controller. Incompatible with Firefox.", + "fullName": "Change gamepad active vibration", + "functionType": "Action", + "name": "A_Change_Vibration_Magnitude", + "sentence": "Change the vibration magnitude of _PARAM2_ & _PARAM3_ on gamepad _PARAM1_", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "/** @type {Gamepad[]} */", + "//Vibration work only on game in browser.", + "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);", + "", + "//Get function parameters", + "const playerId = eventsFunctionContext.getArgument(\"Player_ID\") - 1;", + "const elapsedTime = gdjs._extensionController.players[playerId].rumble.elapsedTime || 0;", + "const originalDuration = gdjs._extensionController.players[playerId].rumble.duration || 1;", + "const strongRumbleMagnitude = eventsFunctionContext.getArgument(\"StrongMagnitude\");", + "const weakRumbleMagnitude = eventsFunctionContext.getArgument(\"WeakMagnitude\");", + "", + "", + "if (playerId < 0 || playerId > 4) {", + " console.error('Parameter gamepad identifier in action: \"Change gamepad active vibration\", is not valid number, must be between 0 and 4.');", + " return;", + "}", + "if (weakRumbleMagnitude < 0 || weakRumbleMagnitude > 1) {", + " console.error('Parameter weakRumble identifier in action: \"Change gamepad active vibration\", is not valid number, must be between 0 and 1.');", + " return;", + "}", + "if (strongRumbleMagnitude < 0 || strongRumbleMagnitude > 1) {", + " console.error('Parameter strongRumble identifier in action: \"Change gamepad active vibration\", is not valid number, must be between 0 and 1.');", + " return;", + "}", + "", + "const gamepad = gamepads[playerId];", + "", + "//we need keep this condition because when use have not yet plug the controller we can't get the controller in the gamepad variable.", + "if (gamepad == null) return;", + "", + "if (originalDuration - elapsedTime <= 0) return;", + "", + "if (gamepad && gamepad.vibrationActuator) {", + " gamepad.vibrationActuator.playEffect(\"dual-rumble\", {", + " startDelay: 0,", + " duration: 1000 * (originalDuration - elapsedTime),", + " weakMagnitude: weakRumbleMagnitude,", + " strongMagnitude: strongRumbleMagnitude", + " });", + "}", + "", + "gdjs._extensionController.players[playerId].rumble.weakMagnitude = weakRumbleMagnitude;", + "gdjs._extensionController.players[playerId].rumble.strongMagnitude = strongRumbleMagnitude;" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "parameters": [ + { + "description": "The gamepad identifier: 1, 2, 3 or 4", + "name": "Player_ID", + "type": "expression" + }, + { + "description": "Strong rumble magnitude (from 0 to 1)", + "name": "StrongMagnitude", + "type": "expression" + }, + { + "description": "Weak rumble magnitude (from 0 to 1)", + "name": "WeakMagnitude", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "Action", + "name": "onFirstSceneLoaded", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [] + }, + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "//Define an new private object javascript for the gamepad extension\r", + "gdjs._extensionController = {\r", + " players: {\r", + " 0: { mapping: 'DEFAULT', lastButtonUsed: -1, deadzone: 0.2, previousFrameStateButtons: {}, rumble: {} },\r", + " 1: { mapping: 'DEFAULT', lastButtonUsed: -1, deadzone: 0.2, previousFrameStateButtons: {}, rumble: {} },\r", + " 2: { mapping: 'DEFAULT', lastButtonUsed: -1, deadzone: 0.2, previousFrameStateButtons: {}, rumble: {} },\r", + " 3: { mapping: 'DEFAULT', lastButtonUsed: -1, deadzone: 0.2, previousFrameStateButtons: {}, rumble: {} },\r", + " },\r", + " lastActiveController: -1, // Last active controller\r", + " controllerButtonNames: { //Map associating controller button ids to button names\r", + " \"XBOX\": {\r", + " 0: \"A\",\r", + " 1: \"B\",\r", + " 2: \"X\",\r", + " 3: \"Y\",\r", + " 4: \"LB\",\r", + " 5: \"RB\",\r", + " 6: \"LT\",\r", + " 7: \"RT\",\r", + " 8: \"BACK\",\r", + " 9: \"START\",\r", + " 10: \"CLICK_STICK_LEFT\",\r", + " 11: \"CLICK_STICK_RIGHT\",\r", + " 12: \"UP\",\r", + " 13: \"DOWN\",\r", + " 14: \"LEFT\",\r", + " 15: \"RIGHT\",\r", + " 16: \"NONE\",\r", + " 17: \"NONE\"\r", + " },\r", + " \"PS4\": {\r", + " 0: \"CROSS\",\r", + " 1: \"CIRCLE\",\r", + " 2: \"SQUARE\",\r", + " 3: \"TRIANGLE\",\r", + " 4: \"L1\",\r", + " 5: \"R1\",\r", + " 6: \"L2\",\r", + " 7: \"R2\",\r", + " 8: \"SHARE\",\r", + " 9: \"OPTIONS\",\r", + " 10: \"CLICK_STICK_LEFT\",\r", + " 11: \"CLICK_STICK_RIGHT\",\r", + " 12: \"UP\",\r", + " 13: \"DOWN\",\r", + " 14: \"LEFT\",\r", + " 15: \"RIGHT\",\r", + " 16: \"PS_BUTTON\",\r", + " 17: \"CLICK_TOUCHPAD\"\r", + " }\r", + " }\r", + "};\r", + "\r", + "gdjs._extensionController.getInputString = function (type, buttonId) {\r", + " const controllerButtonNames = gdjs._extensionController.controllerButtonNames;\r", + " if (controllerButtonNames[type] !== undefined) {\r", + " return controllerButtonNames[type][buttonId];\r", + " }\r", + "\r", + " return \"UNKNOWN_BUTTON\";\r", + "}\r", + "\r", + "gdjs._extensionController.axisToAngle = function (deltaX, deltaY) {\r", + " const rad = Math.atan2(deltaY, deltaX);\r", + " const deg = rad * (180 / Math.PI);\r", + " return deg;\r", + "}\r", + "\r", + "gdjs._extensionController.isXbox = function (gamepad) {\r", + " return (gamepad ? (\r", + " gamepad.id.toUpperCase().indexOf(\"XBOX\") !== -1\r", + " // \"XINPUT\" cannot be used to check if it is a xbox controller is just a generic\r", + " // name reported in Firefox corresponding to the driver being used by the controller\r", + " // https://gamefaqs.gamespot.com/boards/916373-pc/73341312?page=1\r", + " ) : false);\r", + "}\r", + "\r", + "//Returns the new value taking into account the dead zone for the player_ID given\r", + "gdjs._extensionController.getNormalizedAxisValue = function (v, player_ID) {\r", + " // gdjs._extensionController = gdjs._extensionController || { deadzone: 0.2 };\r", + "\r", + " // Anything smaller than this is assumed to be 0,0\r", + " const DEADZONE = gdjs._extensionController.players[player_ID].deadzone;\r", + "\r", + " if (Math.abs(v) < DEADZONE) {\r", + " // In the dead zone, set to 0\r", + " v = 0;\r", + "\r", + " if (v == null) {\r", + " return 0;\r", + " } else {\r", + " return v;\r", + " }\r", + "\r", + " } else {\r", + " // We're outside the dead zone, but we'd like to smooth\r", + " // this value out so it still runs nicely between 0..1.\r", + " // That is, we don't want it to jump suddenly from 0 to\r", + " // DEADZONE.\r", + "\r", + " // Remap v from\r", + " // DEADZONE..1 to 0..(1-DEADZONE)\r", + " // or from\r", + " // -1..-DEADZONE to -(1-DEADZONE)..0\r", + "\r", + " v = v - Math.sign(v) * DEADZONE;\r", + "\r", + " // Remap v from\r", + " // 0..(1-DEADZONE) to 0..1\r", + " // or from\r", + " // -(1-DEADZONE)..0 to -1..0\r", + "\r", + " return v / (1 - DEADZONE);\r", + " }\r", + "};" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "parameters": [], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "Action", + "name": "onScenePostEvents", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [] + }, + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "//Each time a player press a button i save the last button pressed for the next frame", + "/** @type {Gamepad[]} */", + "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);", + "", + "//Get function parameter", + "let countPlayers = Object.keys(gdjs._extensionController.players).length;", + "", + "//Repeat for each players", + "for (let i = 0; i < countPlayers; i++) {", + " let gamepad = gamepads[i]; // Get the gamepad of the player", + "", + " //We have to keep this condition because if the user hasn't plugged in his controller yet, we can't get the controller in the gamepad variable.", + " if (gamepad == null) {", + " continue;", + " }", + "", + " for (let b = 0; b < Object.keys(gamepad.buttons).length; b++) { //For each buttons", + " if (gamepad.buttons[b].pressed) { //One of them is pressed", + " gdjs._extensionController.players[i].lastButtonUsed = b; //Save the button pressed", + "", + " //Save the state of the button for the next frame.", + " gdjs._extensionController.players[i].previousFrameStateButtons[b] = { pressed: true };", + "", + " // Update Last Active Controller", + " gdjs._extensionController.lastActiveController = i;", + " } else {", + " gdjs._extensionController.players[i].previousFrameStateButtons[b] = { pressed: false };", + " }", + " }", + "", + "", + " gdjs._extensionController.players[i].rumble.elapsedTime += runtimeScene.getElapsedTime(runtimeScene) / 1000;", + " if (", + " gdjs._extensionController.players[i].rumble.duration - gdjs._extensionController.players[i].rumble.elapsedTime <= 0 &&", + " (gdjs._extensionController.players[i].rumble.weakMagnitude || gdjs._extensionController.players[i].rumble.strongMagnitude)", + " ) {", + " gdjs._extensionController.players[i].rumble.weakMagnitude = 0;", + " gdjs._extensionController.players[i].rumble.strongMagnitude = 0;", + " }", + "", + "", + "}", + "" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "parameters": [], + "objectGroups": [] + }, + { + "description": "Check if any button is released on a gamepad.", + "fullName": "Any gamepad button released", + "functionType": "Condition", + "name": "C_any_button_released", + "sentence": "Any button of gamepad _PARAM1_ is released", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [] + }, + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "/** @type {Gamepad[]} */\r", + "const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);\r", + "\r", + "//Get function parameters\r", + "const playerId = eventsFunctionContext.getArgument(\"player_ID\") - 1;\r", + "\r", + "if (playerId < 0 || playerId > 4) {\r", + "\tconsole.error('Parameter gamepad identifier in condition: \"Any gamepad button released\", is not valid number, must be between 0 and 4.');\r", + "\treturn;\r", + "}\r", + "\r", + "const gamepad = gamepads[playerId];\r", + "\r", + "//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable.\r", + "if (gamepad == null) return;\r", + "\r", + "for (let buttonId = 0; buttonId < gamepad.buttons.length; buttonId++) { //For each buttons on current frame.\r", + "\r", + "\tif (buttonId === undefined) {\r", + "\t\teventsFunctionContext.returnValue = false;\r", + "\t\treturn;\r", + "\t}\r", + "\r", + "\t//Get previous value or define value by default for the current button\r", + "\tgdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId] = gdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId] || { pressed: false };\r", + "\r", + "\t//Get state of the button at previous frame\r", + "\tconst previousStateButtonIsPressed = gdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId].pressed;\r", + "\r", + "\t//Get the state of the button on the current frame.\r", + "\tconst currentFrameStateButtonIsPressed = gamepad.buttons[buttonId].pressed;\r", + "\r", + "\t//When previousStateButtonIsPressed is true and actual button state is not pressed\r", + "\t//Player have release the button\r", + "\tif (previousStateButtonIsPressed === true && currentFrameStateButtonIsPressed === false) {\r", + "\t\tgdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId].pressed = true;\r", + "\t\teventsFunctionContext.returnValue = true;\r", + "\t\t//break;\r", + "\t\treturn;\r", + "\t} else {\r", + "\t\t//The player didn't released the button yet, the previous frame state is still true\r", + "\t\tgdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId].pressed = false;\r", + "\t\teventsFunctionContext.returnValue = false;\r", + "\t}\r", + "\r", + "\tif (currentFrameStateButtonIsPressed) gdjs._extensionController.players[playerId].lastButtonUsed = buttonId;\r", + "}\r", + "" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "parameters": [ + { + "description": "The gamepad identifier: 1, 2, 3 or 4", + "name": "player_ID", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Return the strength of the weak vibration motor on the gamepad of a player.", + "fullName": "Weak rumble magnitude", + "functionType": "Expression", + "name": "WeakVibrationMagnitude", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const playerId = eventsFunctionContext.getArgument(\"Player_ID\") - 1;\r", + "eventsFunctionContext.returnValue = gdjs._extensionController.players[playerId].rumble.weakMagnitude;" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "The gamepad identifier: 1, 2, 3 or 4", + "name": "Player_ID", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Return the strength of the strong vibration motor on the gamepad of a player.", + "fullName": "Strong rumble magnitude", + "functionType": "Expression", + "name": "StrongVibrationMagnitude", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const playerId = eventsFunctionContext.getArgument(\"Player_ID\") - 1;\r", + "eventsFunctionContext.returnValue = gdjs._extensionController.players[playerId].rumble.strongMagnitude;" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "The gamepad identifier: 1, 2, 3 or 4", + "name": "Player_ID", + "type": "expression" + } + ], + "objectGroups": [] + } + ], + "eventsBasedBehaviors": [ + { + "description": "Control a platformer character with a gamepad.", + "fullName": "Platformer gamepad mapper", + "name": "PlatformerGamepadMapper", + "objectType": "", + "eventsFunctions": [ + { + "fullName": "", + "functionType": "Action", + "name": "doStepPreEvents", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::C_Controller_X_is_connected" + }, + "parameters": [ + "", + "Object.Behavior::PropertyGamepadIdentifier()", + "" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::PlatformerGamepadMapper::PropertyUseArrows" + }, + "parameters": [ + "Object", + "Behavior" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::C_Button_pressed" + }, + "parameters": [ + "", + "Object.Behavior::PropertyGamepadIdentifier()", + "\"Left\"", + "\"Left\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "PlatformBehavior::SimulateLeftKey" + }, + "parameters": [ + "Object", + "PlatformerCharacter" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::C_Button_pressed" + }, + "parameters": [ + "", + "Object.Behavior::PropertyGamepadIdentifier()", + "\"Right\"", + "\"Left\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "PlatformBehavior::SimulateRightKey" + }, + "parameters": [ + "Object", + "PlatformerCharacter" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::C_Button_pressed" + }, + "parameters": [ + "", + "Object.Behavior::PropertyGamepadIdentifier()", + "\"Up\"", + "\"Left\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "PlatformBehavior::SimulateUpKey" + }, + "parameters": [ + "Object", + "PlatformerCharacter" + ] + }, + { + "type": { + "value": "PlatformBehavior::SimulateLadderKey" + }, + "parameters": [ + "Object", + "PlatformerCharacter" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::C_Button_pressed" + }, + "parameters": [ + "", + "Object.Behavior::PropertyGamepadIdentifier()", + "\"Down\"", + "\"Left\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "PlatformBehavior::SimulateDownKey" + }, + "parameters": [ + "Object", + "PlatformerCharacter" + ] + } + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::PlatformerGamepadMapper::PropertyUseLeftStick" + }, + "parameters": [ + "Object", + "Behavior" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::C_Axis_pushed" + }, + "parameters": [ + "", + "Object.Behavior::PropertyGamepadIdentifier()", + "\"Left\"", + "\"Left\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "PlatformBehavior::SimulateLeftKey" + }, + "parameters": [ + "Object", + "PlatformerCharacter" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::C_Axis_pushed" + }, + "parameters": [ + "", + "Object.Behavior::PropertyGamepadIdentifier()", + "\"Left\"", + "\"Right\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "PlatformBehavior::SimulateRightKey" + }, + "parameters": [ + "Object", + "PlatformerCharacter" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::C_Axis_pushed" + }, + "parameters": [ + "", + "Object.Behavior::PropertyGamepadIdentifier()", + "\"Left\"", + "\"Up\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "PlatformBehavior::SimulateUpKey" + }, + "parameters": [ + "Object", + "PlatformerCharacter" + ] + }, + { + "type": { + "value": "PlatformBehavior::SimulateLadderKey" + }, + "parameters": [ + "Object", + "PlatformerCharacter" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::C_Axis_pushed" + }, + "parameters": [ + "", + "Object.Behavior::PropertyGamepadIdentifier()", + "\"Left\"", + "\"Down\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "PlatformBehavior::SimulateDownKey" + }, + "parameters": [ + "Object", + "PlatformerCharacter" + ] + } + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::PlatformerGamepadMapper::PropertyUseRightStick" + }, + "parameters": [ + "Object", + "Behavior" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::C_Axis_pushed" + }, + "parameters": [ + "", + "Object.Behavior::PropertyGamepadIdentifier()", + "\"Right\"", + "\"Left\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "PlatformBehavior::SimulateLeftKey" + }, + "parameters": [ + "Object", + "PlatformerCharacter" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::C_Axis_pushed" + }, + "parameters": [ + "", + "Object.Behavior::PropertyGamepadIdentifier()", + "\"Right\"", + "\"Right\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "PlatformBehavior::SimulateRightKey" + }, + "parameters": [ + "Object", + "PlatformerCharacter" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::C_Axis_pushed" + }, + "parameters": [ + "", + "Object.Behavior::PropertyGamepadIdentifier()", + "\"Right\"", + "\"Up\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "PlatformBehavior::SimulateUpKey" + }, + "parameters": [ + "Object", + "PlatformerCharacter" + ] + }, + { + "type": { + "value": "PlatformBehavior::SimulateLadderKey" + }, + "parameters": [ + "Object", + "PlatformerCharacter" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::C_Axis_pushed" + }, + "parameters": [ + "", + "Object.Behavior::PropertyGamepadIdentifier()", + "\"Right\"", + "\"Down\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "PlatformBehavior::SimulateDownKey" + }, + "parameters": [ + "Object", + "PlatformerCharacter" + ] + } + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::PlatformerGamepadMapper::PropertyJumpButton" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "\"A or Cross\"" + ] + }, + { + "type": { + "value": "Gamepads::C_Button_pressed" + }, + "parameters": [ + "", + "Object.Behavior::PropertyGamepadIdentifier()", + "\"A\"", + "\"Left\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "PlatformBehavior::SimulateJumpKey" + }, + "parameters": [ + "Object", + "PlatformerCharacter" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::PlatformerGamepadMapper::PropertyJumpButton" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "\"B or Circle\"" + ] + }, + { + "type": { + "value": "Gamepads::C_Button_pressed" + }, + "parameters": [ + "", + "Object.Behavior::PropertyGamepadIdentifier()", + "\"B\"", + "\"Left\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "PlatformBehavior::SimulateJumpKey" + }, + "parameters": [ + "Object", + "PlatformerCharacter" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::PlatformerGamepadMapper::PropertyJumpButton" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "\"X or Square\"" + ] + }, + { + "type": { + "value": "Gamepads::C_Button_pressed" + }, + "parameters": [ + "", + "Object.Behavior::PropertyGamepadIdentifier()", + "\"X\"", + "\"Left\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "PlatformBehavior::SimulateJumpKey" + }, + "parameters": [ + "Object", + "PlatformerCharacter" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::PlatformerGamepadMapper::PropertyJumpButton" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "\"Y or Triangle\"" + ] + }, + { + "type": { + "value": "Gamepads::C_Button_pressed" + }, + "parameters": [ + "", + "Object.Behavior::PropertyGamepadIdentifier()", + "\"Y\"", + "\"Left\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "PlatformBehavior::SimulateJumpKey" + }, + "parameters": [ + "Object", + "PlatformerCharacter" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::PlatformerGamepadMapper::PropertyJumpButton" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "\"LB or L1\"" + ] + }, + { + "type": { + "value": "Gamepads::C_Button_pressed" + }, + "parameters": [ + "", + "Object.Behavior::PropertyGamepadIdentifier()", + "\"LB\"", + "\"Left\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "PlatformBehavior::SimulateJumpKey" + }, + "parameters": [ + "Object", + "PlatformerCharacter" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::PlatformerGamepadMapper::PropertyJumpButton" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "\"RB or R1\"" + ] + }, + { + "type": { + "value": "Gamepads::C_Button_pressed" + }, + "parameters": [ + "", + "Object.Behavior::PropertyGamepadIdentifier()", + "\"RB\"", + "\"Left\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "PlatformBehavior::SimulateJumpKey" + }, + "parameters": [ + "Object", + "PlatformerCharacter" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::PlatformerGamepadMapper::PropertyJumpButton" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "\"LT or L2\"" + ] + }, + { + "type": { + "value": "Gamepads::C_Button_pressed" + }, + "parameters": [ + "", + "Object.Behavior::PropertyGamepadIdentifier()", + "\"LT\"", + "\"Left\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "PlatformBehavior::SimulateJumpKey" + }, + "parameters": [ + "Object", + "PlatformerCharacter" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::PlatformerGamepadMapper::PropertyJumpButton" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "\"RT or R2\"" + ] + }, + { + "type": { + "value": "Gamepads::C_Button_pressed" + }, + "parameters": [ + "", + "Object.Behavior::PropertyGamepadIdentifier()", + "\"RT\"", + "\"Left\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "PlatformBehavior::SimulateJumpKey" + }, + "parameters": [ + "Object", + "PlatformerCharacter" + ] + } + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "Gamepads::PlatformerGamepadMapper", + "type": "behavior" + } + ], + "objectGroups": [] + } + ], + "propertyDescriptors": [ + { + "value": "", + "type": "Behavior", + "label": "Platformer character behavior", + "description": "", + "group": "", + "extraInformation": [ + "PlatformBehavior::PlatformerObjectBehavior" + ], + "name": "PlatformerCharacter" + }, + { + "value": "1", + "type": "Number", + "label": "Gamepad identifier (1, 2, 3 or 4)", + "description": "", + "group": "", + "extraInformation": [], + "name": "GamepadIdentifier" + }, + { + "value": "true", + "type": "Boolean", + "label": "Use directional pad", + "description": "", + "group": "Controls", + "extraInformation": [], + "name": "UseArrows" + }, + { + "value": "true", + "type": "Boolean", + "label": "Use left stick", + "description": "", + "group": "Controls", + "extraInformation": [], + "name": "UseLeftStick" + }, + { + "value": "", + "type": "Boolean", + "label": "Use right stick", + "description": "", + "group": "Controls", + "extraInformation": [], + "name": "UseRightStick" + }, + { + "value": "A or Cross", + "type": "Choice", + "label": "Jump button", + "description": "", + "group": "Controls", + "extraInformation": [ + "A or Cross", + "B or Circle", + "X or Square", + "Y or Triangle", + "LB or L1", + "RB or R1", + "LT or L2", + "RT or R2" + ], + "name": "JumpButton" + } + ], + "sharedPropertyDescriptors": [] + }, + { + "description": "Control a top-down character with a gamepad.", + "fullName": "Top-down gamepad mapper", + "name": "TopDownGamepadMapper", + "objectType": "", + "eventsFunctions": [ + { + "fullName": "", + "functionType": "Action", + "name": "doStepPreEvents", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::C_Controller_X_is_connected" + }, + "parameters": [ + "", + "Object.Behavior::PropertyGamepadIdentifier()", + "" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::PlatformerGamepadMapper::PropertyUseArrows" + }, + "parameters": [ + "Object", + "Behavior" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::C_Button_pressed" + }, + "parameters": [ + "", + "Object.Behavior::PropertyGamepadIdentifier()", + "\"Left\"", + "\"Left\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "TopDownMovementBehavior::SimulateLeftKey" + }, + "parameters": [ + "Object", + "TopDownMovement" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::C_Button_pressed" + }, + "parameters": [ + "", + "Object.Behavior::PropertyGamepadIdentifier()", + "\"Right\"", + "\"Left\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "TopDownMovementBehavior::SimulateRightKey" + }, + "parameters": [ + "Object", + "TopDownMovement" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::C_Button_pressed" + }, + "parameters": [ + "", + "Object.Behavior::PropertyGamepadIdentifier()", + "\"Up\"", + "\"Left\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "TopDownMovementBehavior::SimulateUpKey" + }, + "parameters": [ + "Object", + "TopDownMovement" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::C_Button_pressed" + }, + "parameters": [ + "", + "Object.Behavior::PropertyGamepadIdentifier()", + "\"Down\"", + "\"Left\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "TopDownMovementBehavior::SimulateDownKey" + }, + "parameters": [ + "Object", + "TopDownMovement" + ] + } + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::PlatformerGamepadMapper::PropertyUseLeftStick" + }, + "parameters": [ + "Object", + "Behavior" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::TopDownGamepadMapper::PropertyStickMode" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "\"Analog\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "TopDownMovementBehavior::SimulateStick" + }, + "parameters": [ + "Object", + "TopDownMovement", + "Gamepads::StickRotationValue(Object.Behavior::PropertyGamepadIdentifier(), \"Left\")", + "Gamepads::StickForce(Object.Behavior::PropertyGamepadIdentifier(), \"Left\")" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::TopDownGamepadMapper::PropertyStickMode" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "\"360°\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "TopDownMovementBehavior::SimulateStick" + }, + "parameters": [ + "Object", + "TopDownMovement", + "Gamepads::StickRotationValue(Object.Behavior::PropertyGamepadIdentifier(), \"Left\")", + "sign(Gamepads::StickForce(Object.Behavior::PropertyGamepadIdentifier(), \"Left\"))" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::TopDownGamepadMapper::PropertyStickMode" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "\"8 Directions\"" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::C_Axis_pushed" + }, + "parameters": [ + "", + "Object.Behavior::PropertyGamepadIdentifier()", + "\"Left\"", + "\"Left\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "TopDownMovementBehavior::SimulateLeftKey" + }, + "parameters": [ + "Object", + "TopDownMovement" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::C_Axis_pushed" + }, + "parameters": [ + "", + "Object.Behavior::PropertyGamepadIdentifier()", + "\"Left\"", + "\"Right\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "TopDownMovementBehavior::SimulateRightKey" + }, + "parameters": [ + "Object", + "TopDownMovement" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::C_Axis_pushed" + }, + "parameters": [ + "", + "Object.Behavior::PropertyGamepadIdentifier()", + "\"Left\"", + "\"Up\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "TopDownMovementBehavior::SimulateUpKey" + }, + "parameters": [ + "Object", + "TopDownMovement" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::C_Axis_pushed" + }, + "parameters": [ + "", + "Object.Behavior::PropertyGamepadIdentifier()", + "\"Left\"", + "\"Down\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "TopDownMovementBehavior::SimulateDownKey" + }, + "parameters": [ + "Object", + "TopDownMovement" + ] + } + ] + } + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::PlatformerGamepadMapper::PropertyUseRightStick" + }, + "parameters": [ + "Object", + "Behavior" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::TopDownGamepadMapper::PropertyStickMode" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "\"Analog\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "TopDownMovementBehavior::SimulateStick" + }, + "parameters": [ + "Object", + "TopDownMovement", + "Gamepads::StickRotationValue(Object.Behavior::PropertyGamepadIdentifier(), \"Right\")", + "Gamepads::StickForce(Object.Behavior::PropertyGamepadIdentifier(), \"Right\")" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::TopDownGamepadMapper::PropertyStickMode" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "\"360°\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "TopDownMovementBehavior::SimulateStick" + }, + "parameters": [ + "Object", + "TopDownMovement", + "sign(Gamepads::StickForce(Object.Behavior::PropertyGamepadIdentifier(), \"Right\"))", + "1" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::TopDownGamepadMapper::PropertyStickMode" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "\"8 Directions\"" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::C_Axis_pushed" + }, + "parameters": [ + "", + "Object.Behavior::PropertyGamepadIdentifier()", + "\"Right\"", + "\"Left\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "TopDownMovementBehavior::SimulateLeftKey" + }, + "parameters": [ + "Object", + "TopDownMovement" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::C_Axis_pushed" + }, + "parameters": [ + "", + "Object.Behavior::PropertyGamepadIdentifier()", + "\"Right\"", + "\"Right\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "TopDownMovementBehavior::SimulateRightKey" + }, + "parameters": [ + "Object", + "TopDownMovement" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::C_Axis_pushed" + }, + "parameters": [ + "", + "Object.Behavior::PropertyGamepadIdentifier()", + "\"Right\"", + "\"Up\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "TopDownMovementBehavior::SimulateUpKey" + }, + "parameters": [ + "Object", + "TopDownMovement" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::C_Axis_pushed" + }, + "parameters": [ + "", + "Object.Behavior::PropertyGamepadIdentifier()", + "\"Right\"", + "\"Down\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "TopDownMovementBehavior::SimulateDownKey" + }, + "parameters": [ + "Object", + "TopDownMovement" + ] + } + ] + } + ] + } + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "Gamepads::TopDownGamepadMapper", + "type": "behavior" + } + ], + "objectGroups": [] + } + ], + "propertyDescriptors": [ + { + "value": "", + "type": "Behavior", + "label": "Top-down movement behavior", + "description": "", + "group": "", + "extraInformation": [ + "TopDownMovementBehavior::TopDownMovementBehavior" + ], + "name": "TopDownMovement" + }, + { + "value": "1", + "type": "Number", + "label": "Gamepad identifier (1, 2, 3 or 4)", + "description": "", + "group": "", + "extraInformation": [], + "name": "GamepadIdentifier" + }, + { + "value": "true", + "type": "Boolean", + "label": "Use directional pad", + "description": "", + "group": "Controls", + "extraInformation": [], + "name": "UseArrows" + }, + { + "value": "true", + "type": "Boolean", + "label": "Use left stick", + "description": "", + "group": "Controls", + "extraInformation": [], + "name": "UseLeftStick" + }, + { + "value": "", + "type": "Boolean", + "label": "Use right stick", + "description": "", + "group": "Controls", + "extraInformation": [], + "name": "UseRightStick" + }, + { + "value": "Analog", + "type": "Choice", + "label": "Stick mode", + "description": "", + "group": "Controls", + "extraInformation": [ + "Analog", + "360°", + "8 Directions" + ], + "name": "StickMode" + } + ], + "sharedPropertyDescriptors": [] + } + ], + "eventsBasedObjects": [] +} \ No newline at end of file diff --git a/src/eventsFunctionsExtensions/references.json b/src/eventsFunctionsExtensions/references.json new file mode 100644 index 00000000..e4feb313 --- /dev/null +++ b/src/eventsFunctionsExtensions/references.json @@ -0,0 +1,152 @@ +{ + "author": "Arthur Pacaud (arthuro555)", + "category": "", + "extensionNamespace": "", + "fullName": "Variables/References", + "helpPath": "", + "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0ibWRpLXZhcmlhYmxlLWJveCIgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0IiB2aWV3Qm94PSIwIDAgMjQgMjQiPjxwYXRoIGQ9Ik0xOSAzSDVDMy45IDMgMyAzLjkgMyA1VjE5QzMgMjAuMSAzLjkgMjEgNSAyMUgxOUMyMC4xIDIxIDIxIDIwLjEgMjEgMTlWNUMyMSAzLjkgMjAuMSAzIDE5IDNNNy40IDE4QzUuOSAxNi41IDUgMTQuMyA1IDEyUzUuOSA3LjUgNy40IDZMOSA2LjdDNy43IDcuOSA3IDkuOSA3IDEyUzcuNyAxNi4xIDkgMTcuM0w3LjQgMThNMTIuNyAxNUwxMS45IDEzTDEwLjUgMTVIOUwxMS4zIDExLjlMMTAgOUgxMS4zTDEyLjEgMTFMMTMuNSA5SDE1TDEyLjggMTJMMTQuMSAxNUgxMi43TTE2LjYgMThMMTUgMTcuM0MxNi4zIDE2IDE3IDE0LjEgMTcgMTJTMTYuMyA3LjkgMTUgNi43TDE2LjYgNkMxOC4xIDcuNSAxOSA5LjcgMTkgMTJTMTguMSAxNi41IDE2LjYgMThaIiAvPjwvc3ZnPg==", + "name": "References", + "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/variable-box.svg", + "shortDescription": "Adds references and pointers for variables.", + "version": "1.0.0", + "description": "Adds actions to use references (variable that redirect any read/write to another variable) and pointers (unique numbers identifying a variable that can be resolved to a reference). Some usages are for callback variables in events based functions (getting a variable with a fixed name referring to a variable with a name passed as parameter), pointers to make advanced data structures like linked lists, and getting a top level variable dynamically.", + "origin": { + "identifier": "References", + "name": "gdevelop-extension-store" + }, + "tags": [ + "advanced", + "variables", + "reference", + "pointer", + "ref", + "memory", + "callback" + ], + "authorIds": [ + "ZgrsWuRTAkXgeuPV9bo0zuEcA2w1" + ], + "dependencies": [], + "eventsFunctions": [ + { + "description": "Transforms a scene variable into a reference to another scene variable.", + "fullName": "Create reference to scene variable", + "functionType": "Action", + "name": "CreateReference", + "sentence": "Make variable _PARAM1_ a reference to _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const reference = eventsFunctionContext.getArgument(\"reference\");", + "const source = eventsFunctionContext.getArgument(\"source\");", + "", + "// Override each method ", + "for (let func of Object.getOwnPropertyNames(gdjs.Variable.prototype))", + " reference[func] = gdjs.Variable.prototype[func].bind(source);", + "" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [ + { + "description": "The scene variable to turn into a reference", + "name": "reference", + "type": "scenevar" + }, + { + "description": "The scene variable the reference will refer to", + "name": "source", + "type": "scenevar" + } + ], + "objectGroups": [] + }, + { + "description": "Transforms a scene variable into a reference to a global variable.", + "fullName": "Create reference to global variable", + "functionType": "Action", + "name": "CreateGlobalReference", + "sentence": "Make variable _PARAM1_ a reference to _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const reference = eventsFunctionContext.getArgument(\"reference\");", + "const source = eventsFunctionContext.getArgument(\"source\");", + "", + "// Override each method ", + "for (let func of Object.getOwnPropertyNames(gdjs.Variable.prototype))", + " reference[func] = gdjs.Variable.prototype[func].bind(source);", + "" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [ + { + "description": "The scene variable to turn into a reference", + "name": "reference", + "type": "scenevar" + }, + { + "description": "The global variable the reference will refer to", + "name": "source", + "type": "globalvar" + } + ], + "objectGroups": [] + }, + { + "description": "Transforms a scene variable into a reference to an object's variable.", + "fullName": "Create reference to object variable", + "functionType": "Action", + "name": "CreateObjectReference", + "sentence": "Make variable _PARAM2_ a reference to variable _PARAM3_ of _PARAM1_", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const reference = eventsFunctionContext.getArgument(\"reference\");", + "const source = eventsFunctionContext.getArgument(\"source\");", + "", + "console.log(reference, source)", + "", + "// Override each method ", + "for (let func of Object.getOwnPropertyNames(gdjs.Variable.prototype))", + " reference[func] = gdjs.Variable.prototype[func].bind(source);", + "" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [ + { + "description": "The object that possesses the variable to refer to", + "name": "Object", + "type": "objectList" + }, + { + "description": "The scene variable to turn into a reference", + "name": "reference", + "type": "scenevar" + }, + { + "description": "The object variable the reference will refer to", + "name": "source", + "type": "objectvar" + } + ], + "objectGroups": [] + } + ], + "eventsBasedBehaviors": [], + "eventsBasedObjects": [] +} \ No newline at end of file diff --git a/src/externalEvents/game.json b/src/externalEvents/game.json index 8f33fd7e..bcd0a186 100644 --- a/src/externalEvents/game.json +++ b/src/externalEvents/game.json @@ -13,6 +13,13 @@ "source": "", "type": "BuiltinCommonInstructions::Group", "events": [ + { + "type": "BuiltinCommonInstructions::Link", + "include": { + "includeConfig": 0 + }, + "target": "WeaponWheel" + }, { "type": "BuiltinCommonInstructions::Link", "include": { diff --git a/src/externalEvents/player.json b/src/externalEvents/player.json index 7b828e28..c3141048 100644 --- a/src/externalEvents/player.json +++ b/src/externalEvents/player.json @@ -1719,11 +1719,31 @@ "conditions": [ { "type": { - "value": "KeyPressed" + "value": "BuiltinCommonInstructions::Or" }, - "parameters": [ - "", - "a" + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "KeyPressed" + }, + "parameters": [ + "", + "a" + ] + }, + { + "type": { + "value": "Gamepads::C_Axis_pushed" + }, + "parameters": [ + "", + "1", + "\"Left\"", + "\"Left\"", + "" + ] + } ] } ], @@ -1747,11 +1767,31 @@ "conditions": [ { "type": { - "value": "KeyPressed" + "value": "BuiltinCommonInstructions::Or" }, - "parameters": [ - "", - "d" + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "KeyPressed" + }, + "parameters": [ + "", + "d" + ] + }, + { + "type": { + "value": "Gamepads::C_Axis_pushed" + }, + "parameters": [ + "", + "1", + "\"Left\"", + "\"Right\"", + "" + ] + } ] } ], @@ -1775,11 +1815,31 @@ "conditions": [ { "type": { - "value": "KeyPressed" + "value": "BuiltinCommonInstructions::Or" }, - "parameters": [ - "", - "w" + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "KeyPressed" + }, + "parameters": [ + "", + "w" + ] + }, + { + "type": { + "value": "Gamepads::C_Axis_pushed" + }, + "parameters": [ + "", + "1", + "\"Left\"", + "\"Up\"", + "" + ] + } ] } ], @@ -1803,11 +1863,31 @@ "conditions": [ { "type": { - "value": "KeyPressed" + "value": "BuiltinCommonInstructions::Or" }, - "parameters": [ - "", - "s" + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "KeyPressed" + }, + "parameters": [ + "", + "s" + ] + }, + { + "type": { + "value": "Gamepads::C_Axis_pushed" + }, + "parameters": [ + "", + "1", + "\"Left\"", + "\"Down\"", + "" + ] + } ] } ], diff --git a/src/externalEvents/weaponselect.json b/src/externalEvents/weaponselect.json new file mode 100644 index 00000000..d1dfdaac --- /dev/null +++ b/src/externalEvents/weaponselect.json @@ -0,0 +1,165 @@ +{ + "associatedLayout": "City", + "lastChangeTimeStamp": 0, + "name": "WeaponSelect", + "events": [ + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Select", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "ResizableCapability::ResizableBehavior::SetWidth" + }, + "parameters": [ + "bar", + "Resizable", + "=", + "SceneWindowWidth() + 4" + ] + }, + { + "type": { + "value": "ScalableCapability::ScalableBehavior::SetValue" + }, + "parameters": [ + "icons", + "Scale", + "=", + "0.8" + ] + } + ] + }, + { + "disabled": true, + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "DepartScene" + }, + "parameters": [ + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "ExtendedVariables::CopyGlobalVariableToScene" + }, + "parameters": [ + "", + "\"Player.Weapons.Active\"", + "\"Player.Weapons.Active\"", + "yes", + "" + ] + } + ] + }, + { + "disabled": true, + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "DebuggerTools::ConsoleLog" + }, + "parameters": [ + "Player.Weapons.Active", + "\"info\"", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::ForEachChildVariable", + "iterableVariableName": "Player.Weapons.Active", + "valueIteratorVariableName": "child", + "keyIteratorVariableName": "i", + "conditions": [ + { + "type": { + "value": "SceneVariableAsBoolean" + }, + "parameters": [ + "Player.Weapons.Active[VariableString(i)]", + "True" + ] + }, + { + "type": { + "value": "BuiltinCommonInstructions::Once" + }, + "parameters": [] + } + ], + "actions": [ + { + "type": { + "value": "Create" + }, + "parameters": [ + "", + "icons", + "bar.CenterX() + Player.WeaponWheel.adder", + "bar.CenterY()", + "\"UI\"" + ] + }, + { + "type": { + "value": "AnimatableCapability::AnimatableBehavior::SetName" + }, + "parameters": [ + "icons", + "Animation", + "=", + "VariableString(i)" + ] + }, + { + "type": { + "value": "ModVarScene" + }, + "parameters": [ + "Player.WeaponWheel.adder", + "+", + "300" + ] + }, + { + "type": { + "value": "DebuggerTools::ConsoleLog" + }, + "parameters": [ + "VariableString(child)", + "\"info\"", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [] + } + ], + "parameters": [] + } + ] +} \ No newline at end of file diff --git a/src/externalEvents/weaponwheel.json b/src/externalEvents/weaponwheel.json new file mode 100644 index 00000000..9ab65b40 --- /dev/null +++ b/src/externalEvents/weaponwheel.json @@ -0,0 +1,577 @@ +{ + "associatedLayout": "City", + "lastChangeTimeStamp": 0, + "name": "WeaponWheel", + "events": [ + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Select", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "ResizableCapability::ResizableBehavior::SetWidth" + }, + "parameters": [ + "bar", + "Resizable", + "=", + "SceneWindowWidth() + 4" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "DepartScene" + }, + "parameters": [ + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "BuiltinExternalLayouts::CreateObjectsFromExternalLayout" + }, + "parameters": [ + "", + "\"WeaponWheel\"", + "0", + "0", + "0" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "KeyPressed" + }, + "parameters": [ + "", + "Tab" + ] + } + ], + "actions": [ + { + "type": { + "value": "Montre" + }, + "parameters": [ + "WeaponWheel", + "" + ] + }, + { + "type": { + "value": "MontreSouris" + }, + "parameters": [ + "" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::Once" + }, + "parameters": [] + } + ], + "actions": [ + { + "type": { + "value": "Tween::TweenBehavior::AddObjectPositionXTween2" + }, + "parameters": [ + "weaponWheelSticker", + "Tween", + "\"weaponWheelStickerAlign\"", + "SceneWindowWidth()/2 - weaponWheelSticker.Width()/2", + "\"easeOutQuad\"", + "0.5", + "" + ] + }, + { + "type": { + "value": "Tween::TweenNumberEffectPropertyTween" + }, + "parameters": [ + "", + "\"weaponWheelFade\"", + "20", + "", + "\"weaponwhe\"", + "\"blur\"", + "\"easeOutQuad\"", + "0.5" + ] + }, + { + "type": { + "value": "Tween::TweenBehavior::AddObjectOpacityTween2" + }, + "parameters": [ + "bar", + "Tween", + "\"bar\"", + "255", + "\"linear\"", + "0.1", + "" + ] + }, + { + "type": { + "value": "MontreSouris" + }, + "parameters": [ + "" + ] + } + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "KeyPressed" + }, + "parameters": [ + "", + "Tab" + ] + } + ], + "actions": [ + { + "type": { + "value": "CacheSouris" + }, + "parameters": [ + "" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::Once" + }, + "parameters": [] + } + ], + "actions": [ + { + "type": { + "value": "Tween::TweenNumberEffectPropertyTween" + }, + "parameters": [ + "", + "\"weaponWheelFade\"", + "0", + "", + "\"weaponwhe\"", + "\"blur\"", + "\"easeInQuad\"", + "0.3" + ] + }, + { + "type": { + "value": "Tween::TweenBehavior::AddObjectPositionXTween2" + }, + "parameters": [ + "weaponWheelSticker", + "Tween", + "\"weaponWheelStickerAlign\"", + "SceneWindowWidth()/2 - weaponWheelSticker.Width()/2 + 50", + "\"easeOutQuad\"", + "0.3", + "" + ] + }, + { + "type": { + "value": "Tween::TweenBehavior::AddObjectOpacityTween2" + }, + "parameters": [ + "bar", + "Tween", + "\"bar\"", + "0", + "\"linear\"", + "0.3", + "" + ] + }, + { + "type": { + "value": "Wait" + }, + "parameters": [ + "0.2" + ] + }, + { + "type": { + "value": "Cache" + }, + "parameters": [ + "WeaponWheel" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "SourisSurObjet" + }, + "parameters": [ + "icons", + "", + "", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "Tween::TweenBehavior::AddObjectScaleTween3" + }, + "parameters": [ + "icons", + "Tween", + "\"weaponWheelHoverScale\"", + "1", + "\"easeInQuad\"", + "0.05", + "", + "yes" + ] + }, + { + "type": { + "value": "Tween::TweenBehavior::AddObjectAngleTween2" + }, + "parameters": [ + "icons", + "Tween", + "\"weaponWheelHoverRotate\"", + "0.8", + "\"easeInQuad\"", + "0.05", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SourisSurObjet" + }, + "parameters": [ + "icons", + "", + "", + "" + ] + }, + { + "type": { + "value": "BuiltinCommonInstructions::Once" + }, + "parameters": [] + } + ], + "actions": [ + { + "type": { + "value": "Tween::TweenBehavior::AddObjectScaleTween3" + }, + "parameters": [ + "icons", + "Tween", + "\"weaponWheelHoverScale\"", + "1.2", + "\"easeInQuad\"", + "0.2", + "", + "yes" + ] + }, + { + "type": { + "value": "Tween::TweenBehavior::AddObjectAngleTween2" + }, + "parameters": [ + "icons", + "Tween", + "\"weaponWheelHoverRotate\"", + "-45", + "\"easeInQuad\"", + "0.2", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::ForEachChildVariable", + "iterableVariableName": "Player.Weapons.Active", + "valueIteratorVariableName": "child", + "keyIteratorVariableName": "i", + "conditions": [ + { + "type": { + "value": "SceneVariableAsBoolean" + }, + "parameters": [ + "Player.Weapons.Active[VariableString(i)].active", + "True" + ] + }, + { + "type": { + "value": "VarScene" + }, + "parameters": [ + "Player.Weapons.Slot.current", + "<", + "Player.Weapons.Slot.max" + ] + }, + { + "type": { + "value": "BuiltinCommonInstructions::Once" + }, + "parameters": [] + } + ], + "actions": [ + { + "type": { + "value": "Create" + }, + "parameters": [ + "", + "icons", + "weaponWheelSticker.CenterX() + Player.WeaponWheel.adder", + "bar.CenterY()", + "\"UI\"" + ] + }, + { + "type": { + "value": "ModVarScene" + }, + "parameters": [ + "Player.WeaponWheel.adder", + "+", + "icons.Width() + 50" + ] + }, + { + "type": { + "value": "ResizableCapability::ResizableBehavior::SetWidth" + }, + "parameters": [ + "weaponWheelSticker", + "Resizable", + "=", + "Player.WeaponWheel.adder" + ] + }, + { + "type": { + "value": "ResizableCapability::ResizableBehavior::SetHeight" + }, + "parameters": [ + "weaponWheelSticker", + "Resizable", + "=", + "bar.Height()" + ] + }, + { + "type": { + "value": "AnimatableCapability::AnimatableBehavior::SetName" + }, + "parameters": [ + "icons", + "Animation", + "=", + "VariableString(i)" + ] + }, + { + "type": { + "value": "ModVarScene" + }, + "parameters": [ + "Player.Weapons.Slot.current", + "+", + "Player.Weapons.Active[VariableString(i)].slot" + ] + }, + { + "type": { + "value": "Sticker::Sticker::Stick" + }, + "parameters": [ + "icons", + "Sticker", + "weaponWheelSticker", + "" + ] + }, + { + "type": { + "value": "Tween::TweenBehavior::AddObjectPositionXTween2" + }, + "parameters": [ + "weaponWheelSticker", + "Tween", + "\"weaponWheelStickerAlign\"", + "SceneWindowWidth()/2 - weaponWheelSticker.Width()/2 + 50", + "\"linear\"", + "0.5", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "Cache" + }, + "parameters": [ + "weaponWheelSticker" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "DepartScene" + }, + "parameters": [ + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "Cache" + }, + "parameters": [ + "WeaponWheel" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SourisSurObjet" + }, + "parameters": [ + "icons", + "=", + "", + "" + ] + }, + { + "type": { + "value": "MouseButtonReleased" + }, + "parameters": [ + "", + "Left" + ] + } + ], + "actions": [ + { + "type": { + "value": "ModVarSceneTxt" + }, + "parameters": [ + "Player.Weapons.Selected", + "=", + "icons.Animation::Name()" + ] + }, + { + "type": { + "value": "TextContainerCapability::TextContainerBehavior::SetValue" + }, + "parameters": [ + "AmmoText", + "Text", + "=", + "Player.Weapons.Selected" + ] + } + ] + } + ], + "parameters": [] + } + ] +} \ No newline at end of file diff --git a/src/externalLayouts/weaponselect.json b/src/externalLayouts/weaponselect.json new file mode 100644 index 00000000..30575f7d --- /dev/null +++ b/src/externalLayouts/weaponselect.json @@ -0,0 +1,36 @@ +{ + "associatedLayout": "City", + "name": "WeaponSelect", + "instances": [ + { + "angle": 0, + "customSize": true, + "depth": 1, + "height": 201, + "keepRatio": true, + "layer": "UI", + "name": "bar", + "persistentUuid": "b2b01e97-40ff-4a40-847f-b389514ffb53", + "width": 1920, + "x": -2, + "y": 757, + "zOrder": 1, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + } + ], + "editionSettings": { + "grid": true, + "gridType": "rectangular", + "gridWidth": 32, + "gridHeight": 32, + "gridOffsetX": 0, + "gridOffsetY": 0, + "gridColor": 10401023, + "gridAlpha": 0.8, + "snap": true, + "zoomFactor": 0.3895856273827297, + "windowMask": false + } +} \ No newline at end of file diff --git a/src/externalLayouts/weaponwheel.json b/src/externalLayouts/weaponwheel.json new file mode 100644 index 00000000..3bce1796 --- /dev/null +++ b/src/externalLayouts/weaponwheel.json @@ -0,0 +1,53 @@ +{ + "associatedLayout": "City", + "name": "WeaponWheel", + "instances": [ + { + "angle": 0, + "customSize": true, + "depth": 1, + "height": 201, + "keepRatio": true, + "layer": "UI", + "name": "bar", + "persistentUuid": "b2b01e97-40ff-4a40-847f-b389514ffb53", + "width": 1920, + "x": -2, + "y": 757, + "zOrder": 1, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": true, + "depth": 0.9901477832512315, + "height": 201, + "keepRatio": true, + "layer": "UI", + "name": "weaponWheelSticker", + "persistentUuid": "8a24af66-24b2-4908-9964-b239b8e905a7", + "width": 63.36945812807882, + "x": 736, + "y": 757, + "zOrder": 2, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + } + ], + "editionSettings": { + "grid": true, + "gridType": "rectangular", + "gridWidth": 32, + "gridHeight": 32, + "gridOffsetX": 0, + "gridOffsetY": 0, + "gridColor": 10401023, + "gridAlpha": 0.8, + "snap": true, + "zoomFactor": 2.756660758663872, + "windowMask": false + } +} \ No newline at end of file diff --git a/src/game.json b/src/game.json index 2b899a12..8df86eab 100644 --- a/src/game.json +++ b/src/game.json @@ -2266,6 +2266,222 @@ "name": "assets/phone/wallpaper/4.png", "smoothed": true, "userAdded": true + }, + { + "alwaysLoaded": false, + "file": "assets/weapons/icons/uziSilencer.png", + "kind": "image", + "metadata": "", + "name": "assets/weapons/icons/uziSilencer.png", + "smoothed": true, + "userAdded": true + }, + { + "alwaysLoaded": false, + "file": "assets/weapons/icons/uziLongSilencer.png", + "kind": "image", + "metadata": "", + "name": "assets/weapons/icons/uziLongSilencer.png", + "smoothed": true, + "userAdded": true + }, + { + "alwaysLoaded": false, + "file": "assets/weapons/icons/uziLong.png", + "kind": "image", + "metadata": "", + "name": "assets/weapons/icons/uziLong.png", + "smoothed": true, + "userAdded": true + }, + { + "alwaysLoaded": false, + "file": "assets/weapons/icons/uzi.png", + "kind": "image", + "metadata": "", + "name": "assets/weapons/icons/uzi.png", + "smoothed": true, + "userAdded": true + }, + { + "alwaysLoaded": false, + "file": "assets/weapons/icons/sniper.png", + "kind": "image", + "metadata": "", + "name": "assets/weapons/icons/sniper.png", + "smoothed": true, + "userAdded": true + }, + { + "alwaysLoaded": false, + "file": "assets/weapons/icons/shotgunShort.png", + "kind": "image", + "metadata": "", + "name": "assets/weapons/icons/shotgunShort.png", + "smoothed": true, + "userAdded": true + }, + { + "alwaysLoaded": false, + "file": "assets/weapons/icons/shotgun.png", + "kind": "image", + "metadata": "", + "name": "assets/weapons/icons/shotgun.png", + "smoothed": true, + "userAdded": true + }, + { + "alwaysLoaded": false, + "file": "assets/weapons/icons/rocketlauncherModern.png", + "kind": "image", + "metadata": "", + "name": "assets/weapons/icons/rocketlauncherModern.png", + "smoothed": true, + "userAdded": true + }, + { + "alwaysLoaded": false, + "file": "assets/weapons/icons/rocketlauncher.png", + "kind": "image", + "metadata": "", + "name": "assets/weapons/icons/rocketlauncher.png", + "smoothed": true, + "userAdded": true + }, + { + "alwaysLoaded": false, + "file": "assets/weapons/icons/pistolSilencer.png", + "kind": "image", + "metadata": "", + "name": "assets/weapons/icons/pistolSilencer.png", + "smoothed": true, + "userAdded": true + }, + { + "alwaysLoaded": false, + "file": "assets/weapons/icons/pistol.png", + "kind": "image", + "metadata": "", + "name": "assets/weapons/icons/pistol.png", + "smoothed": true, + "userAdded": true + }, + { + "alwaysLoaded": false, + "file": "assets/weapons/icons/machinegunLauncher.png", + "kind": "image", + "metadata": "", + "name": "assets/weapons/icons/machinegunLauncher.png", + "smoothed": true, + "userAdded": true + }, + { + "alwaysLoaded": false, + "file": "assets/weapons/icons/machinegun.png", + "kind": "image", + "metadata": "", + "name": "assets/weapons/icons/machinegun.png", + "smoothed": true, + "userAdded": true + }, + { + "alwaysLoaded": false, + "file": "assets/weapons/icons/knifeRound_smooth.png", + "kind": "image", + "metadata": "", + "name": "assets/weapons/icons/knifeRound_smooth.png", + "smoothed": true, + "userAdded": true + }, + { + "alwaysLoaded": false, + "file": "assets/weapons/icons/knifeRound_sharp.png", + "kind": "image", + "metadata": "", + "name": "assets/weapons/icons/knifeRound_sharp.png", + "smoothed": true, + "userAdded": true + }, + { + "alwaysLoaded": false, + "file": "assets/weapons/icons/knife_smooth.png", + "kind": "image", + "metadata": "", + "name": "assets/weapons/icons/knife_smooth.png", + "smoothed": true, + "userAdded": true + }, + { + "alwaysLoaded": false, + "file": "assets/weapons/icons/knife_sharp.png", + "kind": "image", + "metadata": "", + "name": "assets/weapons/icons/knife_sharp.png", + "smoothed": true, + "userAdded": true + }, + { + "alwaysLoaded": false, + "file": "assets/weapons/icons/grenadeVintage.png", + "kind": "image", + "metadata": "", + "name": "assets/weapons/icons/grenadeVintage.png", + "smoothed": true, + "userAdded": true + }, + { + "alwaysLoaded": false, + "file": "assets/weapons/icons/grenadeSmoke.png", + "kind": "image", + "metadata": "", + "name": "assets/weapons/icons/grenadeSmoke.png", + "smoothed": true, + "userAdded": true + }, + { + "alwaysLoaded": false, + "file": "assets/weapons/icons/grenadeFlash.png", + "kind": "image", + "metadata": "", + "name": "assets/weapons/icons/grenadeFlash.png", + "smoothed": true, + "userAdded": true + }, + { + "alwaysLoaded": false, + "file": "assets/weapons/icons/grenade.png", + "kind": "image", + "metadata": "", + "name": "assets/weapons/icons/grenade.png", + "smoothed": true, + "userAdded": true + }, + { + "alwaysLoaded": false, + "file": "assets/weapons/icons/flamethrower_short.png", + "kind": "image", + "metadata": "", + "name": "assets/weapons/icons/flamethrower_short.png", + "smoothed": true, + "userAdded": true + }, + { + "alwaysLoaded": false, + "file": "assets/weapons/icons/flamethrower_long.png", + "kind": "image", + "metadata": "", + "name": "assets/weapons/icons/flamethrower_long.png", + "smoothed": true, + "userAdded": true + }, + { + "alwaysLoaded": false, + "file": "assets/weapons/icons/bar.png", + "kind": "image", + "metadata": "", + "name": "assets/weapons/icons/bar.png", + "smoothed": true, + "userAdded": true } ], "resourceFolders": [] @@ -2414,11 +2630,11 @@ ] }, { - "folded": true, "name": "Player", "type": "structure", "children": [ { + "folded": true, "name": "Customisation", "persistentUuid": "6f3e9e87-d6f3-44d0-a02a-6c8089850a4a", "type": "structure", @@ -2446,6 +2662,7 @@ ] }, { + "folded": true, "name": "debug", "type": "structure", "children": [ @@ -2463,6 +2680,7 @@ ] }, { + "folded": true, "name": "Game", "type": "structure", "children": [ @@ -2612,9 +2830,25 @@ { "__REFERENCE_TO_SPLIT_OBJECT": true, "referenceTo": "/externalEvents/debug" + }, + { + "__REFERENCE_TO_SPLIT_OBJECT": true, + "referenceTo": "/externalEvents/weaponwheel" } ], "eventsFunctionsExtensions": [ + { + "__REFERENCE_TO_SPLIT_OBJECT": true, + "referenceTo": "/eventsFunctionsExtensions/extendedvariables" + }, + { + "__REFERENCE_TO_SPLIT_OBJECT": true, + "referenceTo": "/eventsFunctionsExtensions/references" + }, + { + "__REFERENCE_TO_SPLIT_OBJECT": true, + "referenceTo": "/eventsFunctionsExtensions/gamepads" + }, { "__REFERENCE_TO_SPLIT_OBJECT": true, "referenceTo": "/eventsFunctionsExtensions/spritemasking" @@ -2692,6 +2926,10 @@ { "__REFERENCE_TO_SPLIT_OBJECT": true, "referenceTo": "/externalLayouts/phone" + }, + { + "__REFERENCE_TO_SPLIT_OBJECT": true, + "referenceTo": "/externalLayouts/weaponwheel" } ], "externalSourceFiles": [] diff --git a/src/layouts/city.json b/src/layouts/city.json index e5b9e9fa..2cd2f251 100644 --- a/src/layouts/city.json +++ b/src/layouts/city.json @@ -18,7 +18,7 @@ "gridColor": 10401023, "gridAlpha": 0.8, "snap": false, - "zoomFactor": 0.24113360125461827, + "zoomFactor": 0.3250014140240832, "windowMask": false }, "objectsGroups": [ @@ -66,64 +66,23 @@ "name": "Fences" } ] + }, + { + "name": "WeaponWheel", + "objects": [ + { + "name": "icons" + }, + { + "name": "bar" + }, + { + "name": "weaponWheelSticker" + } + ] } ], "variables": [ - { - "name": "fade", - "type": "string", - "value": "" - }, - { - "name": "walk_in_west", - "type": "string", - "value": "" - }, - { - "name": "walk_in_north", - "type": "string", - "value": "" - }, - { - "name": "separate", - "type": "string", - "value": "" - }, - { - "name": "walk_in_south", - "type": "string", - "value": "" - }, - { - "name": "walk_in_east", - "type": "string", - "value": "" - }, - { - "name": "basketball", - "type": "string", - "value": "" - }, - { - "name": "phone", - "type": "string", - "value": "" - }, - { - "name": "using_phone", - "type": "string", - "value": "" - }, - { - "name": "phone_time", - "type": "string", - "value": "" - }, - { - "name": "Died_effects_tween", - "type": "string", - "value": "" - }, { "folded": true, "name": "DebugVariables", @@ -167,6 +126,223 @@ "value": false } ] + }, + { + "name": "Player", + "type": "structure", + "children": [ + { + "name": "WeaponWheel", + "type": "structure", + "children": [ + { + "folded": true, + "name": "adder", + "type": "number", + "value": 0 + } + ] + }, + { + "name": "Weapons", + "persistentUuid": "156e00a8-0565-4399-b01a-2d67f7dd2aea", + "type": "structure", + "children": [ + { + "name": "Active", + "type": "structure", + "children": [ + { + "name": "pistolSilencer", + "persistentUuid": "ca505ad0-64b4-44ee-b4b4-20ba640dd356", + "type": "structure", + "children": [ + { + "folded": true, + "name": "active", + "type": "boolean", + "value": true + }, + { + "name": "slot", + "type": "number", + "value": 1 + } + ] + }, + { + "name": "rocketLauncher", + "persistentUuid": "a8cbcdb0-769a-42ec-97ba-2d4452a2f44c", + "type": "structure", + "children": [ + { + "name": "active", + "type": "boolean", + "value": false + }, + { + "name": "slot", + "type": "number", + "value": 2 + } + ] + }, + { + "name": "rocketLauncherModern", + "persistentUuid": "c25e6f18-b9d3-4077-badd-9e7fe02d7289", + "type": "structure", + "children": [ + { + "name": "active", + "type": "boolean", + "value": false + }, + { + "folded": true, + "name": "slot", + "type": "number", + "value": 2 + } + ] + }, + { + "name": "shotgunLong", + "persistentUuid": "1ea7f09e-67e9-446c-b924-8b7841d8c706", + "type": "structure", + "children": [ + { + "folded": true, + "name": "active", + "type": "boolean", + "value": true + }, + { + "folded": true, + "name": "slot", + "type": "number", + "value": 1 + } + ] + }, + { + "name": "sniper", + "persistentUuid": "fd26e664-81a2-41e1-b99d-eb5b6f68fd1f", + "type": "structure", + "children": [ + { + "folded": true, + "name": "active", + "type": "boolean", + "value": false + }, + { + "folded": true, + "name": "slot", + "type": "number", + "value": 2 + } + ] + }, + { + "name": "uzi", + "persistentUuid": "8042baed-2539-4ca7-a163-86635a6c0c14", + "type": "structure", + "children": [ + { + "folded": true, + "name": "active", + "type": "boolean", + "value": false + }, + { + "folded": true, + "name": "slot", + "type": "number", + "value": 1 + } + ] + }, + { + "name": "uziLong", + "type": "structure", + "children": [ + { + "folded": true, + "name": "active", + "type": "boolean", + "value": false + }, + { + "name": "slot", + "type": "number", + "value": 1 + } + ] + }, + { + "name": "uziLongSilencer", + "persistentUuid": "f1e60af4-7996-42a0-b4ec-fa7e985445ea", + "type": "structure", + "children": [ + { + "folded": true, + "name": "active", + "type": "boolean", + "value": true + }, + { + "folded": true, + "name": "slot", + "type": "number", + "value": 1 + } + ] + }, + { + "name": "uziSilencer", + "type": "structure", + "children": [ + { + "folded": true, + "name": "active", + "type": "boolean", + "value": false + }, + { + "name": "slot", + "type": "number", + "value": 1 + } + ] + } + ] + }, + { + "folded": true, + "name": "Selected", + "type": "string", + "value": "" + }, + { + "name": "Slot", + "type": "structure", + "children": [ + { + "folded": true, + "name": "current", + "type": "number", + "value": 0 + }, + { + "name": "max", + "type": "number", + "value": 4 + } + ] + } + ] + } + ] } ], "instances": [ @@ -53905,26 +54081,6 @@ "stringProperties": [], "initialVariables": [] }, - { - "angle": 0, - "customSize": false, - "height": 0, - "layer": "UI", - "name": "weapon_icons", - "persistentUuid": "e1f10fa7-78d4-4f19-91f7-1e2a6439f087", - "width": 0, - "x": 1823, - "y": 32, - "zOrder": 12643489, - "numberProperties": [ - { - "name": "animation", - "value": 2 - } - ], - "stringProperties": [], - "initialVariables": [] - }, { "angle": 0, "customSize": true, @@ -54786,6 +54942,22 @@ "value": "shadow" } ] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "keepRatio": true, + "layer": "UI", + "name": "AmmoText", + "persistentUuid": "1d0de529-1976-49aa-995b-d6a7e22f8a7c", + "width": 0, + "x": 1671, + "y": 19, + "zOrder": 12643570, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] } ], "objects": [ @@ -57486,7 +57658,18 @@ "underlined": false, "variables": [], "effects": [], - "behaviors": [], + "behaviors": [ + { + "bottomEdgeAnchor": 0, + "leftEdgeAnchor": 0, + "name": "Anchor", + "relativeToOriginalWindowSize": true, + "rightEdgeAnchor": 2, + "topEdgeAnchor": 0, + "type": "AnchorBehavior::AnchorBehavior", + "useLegacyBottomAndRightAnchors": false + } + ], "string": "Ammo: [number]", "font": "", "textAlignment": "", @@ -60079,6 +60262,7 @@ "value": "" }, { + "folded": true, "name": "Movement", "type": "structure", "children": [ @@ -60224,6 +60408,7 @@ ] }, { + "folded": true, "name": "Phone", "type": "structure", "children": [ @@ -60234,6 +60419,28 @@ "value": false } ] + }, + { + "name": "Weapons", + "type": "structure", + "children": [ + { + "name": "Active", + "type": "structure", + "children": [ + { + "name": "uziLong", + "type": "boolean", + "value": false + }, + { + "name": "uziSilencer", + "type": "boolean", + "value": false + } + ] + } + ] } ], "effects": [ @@ -61635,254 +61842,1503 @@ ] } ] - } - ], - "objectsFolderStructure": { - "folderName": "__ROOT", - "children": [ - { - "folderName": "UI", - "children": [ - { - "folderName": "weapon", - "children": [ - { - "objectName": "NewObject" - }, - { - "objectName": "weapon_icons" - } - ] - }, - { - "folderName": "phone", - "children": [ - { - "objectName": "Thumb" - }, - { - "objectName": "phoneIcons" - }, - { - "objectName": "phoneFrame" - }, - { - "objectName": "phoneMask" - }, - { - "objectName": "phoneWallpaper" - }, - { - "objectName": "phone_battery" - }, - { - "objectName": "Pointer" - }, - { - "objectName": "phone_time" - }, - { - "objectName": "phone_wifi" - } - ] - }, - { - "folderName": "debug", - "children": [ - { - "objectName": "Wheel_info" - }, - { - "objectName": "weaponholding" - }, - { - "objectName": "reloading" - }, - { - "objectName": "debugToggle" - }, - { - "objectName": "debugText" - }, - { - "objectName": "AmmoText" - } - ] - }, - { - "objectName": "crosshair" - } - ] - }, - { - "folderName": "Environment", - "children": [ - { - "folderName": "particles", - "children": [ - { - "objectName": "green_leaves_particle" - }, - { - "objectName": "brown_leaves_particle" - } - ] - }, - { - "folderName": "sports", - "children": [ - { - "folderName": "basketball", - "children": [ - { - "objectName": "sports_equipments" - }, - { - "objectName": "ground_elements" - }, - { - "objectName": "sports_equipments_movable" - } - ] - } - ] - }, - { - "folderName": "props", - "children": [ - { - "objectName": "trash_movable" - }, - { - "objectName": "deco" - }, - { - "objectName": "Fences" - }, - { - "objectName": "road_block" - }, - { - "objectName": "foliage" - } - ] - } - ] - }, - { - "folderName": "Player", - "children": [ - { - "objectName": "Body" - }, - { - "objectName": "Leg" - }, - { - "objectName": "Hand" - } - ] - }, - { - "folderName": "Land", - "children": [ - { - "objectName": "beach_sand_2" - }, - { - "objectName": "sand_1" - }, - { - "objectName": "beach_sand_1" - }, - { - "objectName": "sand_2" - }, - { - "objectName": "concrete_1" - }, - { - "objectName": "sand" - }, - { - "objectName": "grass_tiled" - }, - { - "objectName": "grass" - } - ] - }, - { - "folderName": "Road", - "children": [ - { - "objectName": "road_3" - }, - { - "objectName": "road_4" - }, - { - "objectName": "bridge" - }, - { - "objectName": "road_2" - }, - { - "objectName": "road_1" - }, - { - "objectName": "road" - } - ] - }, - { - "folderName": "Weapons", - "children": [ - { - "folderName": "particles", - "children": [ - { - "objectName": "shooting_effect_sniper" - }, - { - "objectName": "shooting_effect" - }, - { - "objectName": "shooting_effect_rocket" - }, - { - "objectName": "bullet_destroy_pistol" - }, - { - "objectName": "bullet_destroy_sniper" - }, - { - "objectName": "bullet_destroy_machine" - }, - { - "objectName": "bullet_destroy_rocket" - } - ] - }, - { - "folderName": "type", - "children": [ - { - "folderName": "melee", - "children": [ - { - "objectName": "mele1" + }, + { + "adaptCollisionMaskAutomatically": true, + "assetStoreId": "", + "name": "icons", + "type": "Sprite", + "updateIfNotVisible": false, + "variables": [], + "effects": [], + "behaviors": [ + { + "name": "Sticker", + "type": "Sticker::Sticker", + "OnlyFollowPosition": false, + "IsDestroyedWithParent": false + }, + { + "name": "Tween", + "type": "Tween::TweenBehavior" + } + ], + "animations": [ + { + "name": "uziSilencer", + "useMultipleDirections": false, + "directions": [ + { + "looping": false, + "timeBetweenFrames": 0.08, + "sprites": [ + { + "hasCustomCollisionMask": true, + "image": "assets/weapons/icons/uziSilencer.png", + "points": [], + "originPoint": { + "name": "origine", + "x": 85, + "y": 65 }, - { - "objectName": "mele2" - } - ] - }, - { - "folderName": "gun", - "children": [ - { - "objectName": "gun1" + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [ + [ + { + "x": 0, + "y": 1 + }, + { + "x": 169, + "y": 1 + }, + { + "x": 169, + "y": 129 + }, + { + "x": 0, + "y": 129 + } + ] + ] + } + ] + } + ] + }, + { + "name": "uziLongSilencer", + "useMultipleDirections": false, + "directions": [ + { + "looping": false, + "timeBetweenFrames": 0.08, + "sprites": [ + { + "hasCustomCollisionMask": true, + "image": "assets/weapons/icons/uziLongSilencer.png", + "points": [], + "originPoint": { + "name": "origine", + "x": 121.5, + "y": 64.5 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [ + [ + { + "x": 0, + "y": 1 + }, + { + "x": 169, + "y": 1 + }, + { + "x": 169, + "y": 129 + }, + { + "x": 0, + "y": 129 + } + ] + ] + } + ] + } + ] + }, + { + "name": "uziLong", + "useMultipleDirections": false, + "directions": [ + { + "looping": false, + "timeBetweenFrames": 0.08, + "sprites": [ + { + "hasCustomCollisionMask": true, + "image": "assets/weapons/icons/uziLong.png", + "points": [], + "originPoint": { + "name": "origine", + "x": 85, + "y": 65 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [ + [ + { + "x": 0, + "y": 1 + }, + { + "x": 169, + "y": 1 + }, + { + "x": 169, + "y": 129 + }, + { + "x": 0, + "y": 129 + } + ] + ] + } + ] + } + ] + }, + { + "name": "uzi", + "useMultipleDirections": false, + "directions": [ + { + "looping": false, + "timeBetweenFrames": 0.08, + "sprites": [ + { + "hasCustomCollisionMask": true, + "image": "assets/weapons/icons/uzi.png", + "points": [], + "originPoint": { + "name": "origine", + "x": 52.5, + "y": 65 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [ + [ + { + "x": 0, + "y": 1 + }, + { + "x": 169, + "y": 1 + }, + { + "x": 169, + "y": 129 + }, + { + "x": 0, + "y": 129 + } + ] + ] + } + ] + } + ] + }, + { + "name": "sniper", + "useMultipleDirections": false, + "directions": [ + { + "looping": false, + "timeBetweenFrames": 0.08, + "sprites": [ + { + "hasCustomCollisionMask": true, + "image": "assets/weapons/icons/sniper.png", + "points": [], + "originPoint": { + "name": "origine", + "x": 200.5, + "y": 54.5 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [ + [ + { + "x": 0, + "y": 1 + }, + { + "x": 169, + "y": 1 + }, + { + "x": 169, + "y": 129 + }, + { + "x": 0, + "y": 129 + } + ] + ] + } + ] + } + ] + }, + { + "name": "shotgunShort", + "useMultipleDirections": false, + "directions": [ + { + "looping": false, + "timeBetweenFrames": 0.08, + "sprites": [ + { + "hasCustomCollisionMask": true, + "image": "assets/weapons/icons/shotgunShort.png", + "points": [], + "originPoint": { + "name": "origine", + "x": 98, + "y": 26 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [ + [ + { + "x": 0, + "y": 1 + }, + { + "x": 169, + "y": 1 + }, + { + "x": 169, + "y": 129 + }, + { + "x": 0, + "y": 129 + } + ] + ] + } + ] + } + ] + }, + { + "name": "shotgun", + "useMultipleDirections": false, + "directions": [ + { + "looping": false, + "timeBetweenFrames": 0.08, + "sprites": [ + { + "hasCustomCollisionMask": true, + "image": "assets/weapons/icons/shotgun.png", + "points": [], + "originPoint": { + "name": "origine", + "x": 97.5, + "y": 26 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [ + [ + { + "x": 0, + "y": 1 + }, + { + "x": 169, + "y": 1 + }, + { + "x": 169, + "y": 129 + }, + { + "x": 0, + "y": 129 + } + ] + ] + } + ] + } + ] + }, + { + "name": "rocketLauncherModern", + "useMultipleDirections": false, + "directions": [ + { + "looping": false, + "timeBetweenFrames": 0.08, + "sprites": [ + { + "hasCustomCollisionMask": true, + "image": "assets/weapons/icons/rocketlauncherModern.png", + "points": [], + "originPoint": { + "name": "origine", + "x": 152.5, + "y": 65 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [ + [ + { + "x": 0, + "y": 1 + }, + { + "x": 169, + "y": 1 + }, + { + "x": 169, + "y": 129 + }, + { + "x": 0, + "y": 129 + } + ] + ] + } + ] + } + ] + }, + { + "name": "rocketLauncher", + "useMultipleDirections": false, + "directions": [ + { + "looping": false, + "timeBetweenFrames": 0.08, + "sprites": [ + { + "hasCustomCollisionMask": true, + "image": "assets/weapons/icons/rocketlauncher.png", + "points": [], + "originPoint": { + "name": "origine", + "x": 199.5, + "y": 71 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [ + [ + { + "x": 0, + "y": 1 + }, + { + "x": 169, + "y": 1 + }, + { + "x": 169, + "y": 129 + }, + { + "x": 0, + "y": 129 + } + ] + ] + } + ] + } + ] + }, + { + "name": "pistolSilencer", + "useMultipleDirections": false, + "directions": [ + { + "looping": false, + "timeBetweenFrames": 0.08, + "sprites": [ + { + "hasCustomCollisionMask": true, + "image": "assets/weapons/icons/pistolSilencer.png", + "points": [], + "originPoint": { + "name": "origine", + "x": 79.5, + "y": 45 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [ + [ + { + "x": 0, + "y": 1 + }, + { + "x": 169, + "y": 1 + }, + { + "x": 169, + "y": 129 + }, + { + "x": 0, + "y": 129 + } + ] + ] + } + ] + } + ] + }, + { + "name": "pistol", + "useMultipleDirections": false, + "directions": [ + { + "looping": false, + "timeBetweenFrames": 0.08, + "sprites": [ + { + "hasCustomCollisionMask": true, + "image": "assets/weapons/icons/pistol.png", + "points": [], + "originPoint": { + "name": "origine", + "x": 57.5, + "y": 45 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [ + [ + { + "x": 0, + "y": 1 + }, + { + "x": 169, + "y": 1 + }, + { + "x": 169, + "y": 129 + }, + { + "x": 0, + "y": 129 + } + ] + ] + } + ] + } + ] + }, + { + "name": "", + "useMultipleDirections": false, + "directions": [ + { + "looping": false, + "timeBetweenFrames": 0.08, + "sprites": [ + { + "hasCustomCollisionMask": true, + "image": "assets/weapons/icons/machinegunLauncher.png", + "points": [], + "originPoint": { + "name": "origine", + "x": 116, + "y": 51.5 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [ + [ + { + "x": 0, + "y": 1 + }, + { + "x": 169, + "y": 1 + }, + { + "x": 169, + "y": 129 + }, + { + "x": 0, + "y": 129 + } + ] + ] + } + ] + } + ] + }, + { + "name": "", + "useMultipleDirections": false, + "directions": [ + { + "looping": false, + "timeBetweenFrames": 0.08, + "sprites": [ + { + "hasCustomCollisionMask": true, + "image": "assets/weapons/icons/machinegun.png", + "points": [], + "originPoint": { + "name": "origine", + "x": 116.5, + "y": 52 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [ + [ + { + "x": 0, + "y": 1 + }, + { + "x": 169, + "y": 1 + }, + { + "x": 169, + "y": 129 + }, + { + "x": 0, + "y": 129 + } + ] + ] + } + ] + } + ] + }, + { + "name": "", + "useMultipleDirections": false, + "directions": [ + { + "looping": false, + "timeBetweenFrames": 0.08, + "sprites": [ + { + "hasCustomCollisionMask": true, + "image": "assets/weapons/icons/knifeRound_smooth.png", + "points": [], + "originPoint": { + "name": "origine", + "x": 15.5, + "y": 68.5 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [ + [ + { + "x": 0, + "y": 1 + }, + { + "x": 169, + "y": 1 + }, + { + "x": 169, + "y": 129 + }, + { + "x": 0, + "y": 129 + } + ] + ] + } + ] + } + ] + }, + { + "name": "", + "useMultipleDirections": false, + "directions": [ + { + "looping": false, + "timeBetweenFrames": 0.08, + "sprites": [ + { + "hasCustomCollisionMask": true, + "image": "assets/weapons/icons/knifeRound_sharp.png", + "points": [], + "originPoint": { + "name": "origine", + "x": 17.5, + "y": 68 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [ + [ + { + "x": 0, + "y": 1 + }, + { + "x": 169, + "y": 1 + }, + { + "x": 169, + "y": 129 + }, + { + "x": 0, + "y": 129 + } + ] + ] + } + ] + } + ] + }, + { + "name": "", + "useMultipleDirections": false, + "directions": [ + { + "looping": false, + "timeBetweenFrames": 0.08, + "sprites": [ + { + "hasCustomCollisionMask": true, + "image": "assets/weapons/icons/knife_smooth.png", + "points": [], + "originPoint": { + "name": "origine", + "x": 17.5, + "y": 69 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [ + [ + { + "x": 0, + "y": 1 + }, + { + "x": 169, + "y": 1 + }, + { + "x": 169, + "y": 129 + }, + { + "x": 0, + "y": 129 + } + ] + ] + } + ] + } + ] + }, + { + "name": "", + "useMultipleDirections": false, + "directions": [ + { + "looping": false, + "timeBetweenFrames": 0.08, + "sprites": [ + { + "hasCustomCollisionMask": true, + "image": "assets/weapons/icons/knife_sharp.png", + "points": [], + "originPoint": { + "name": "origine", + "x": 15, + "y": 68.5 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [ + [ + { + "x": 0, + "y": 1 + }, + { + "x": 169, + "y": 1 + }, + { + "x": 169, + "y": 129 + }, + { + "x": 0, + "y": 129 + } + ] + ] + } + ] + } + ] + }, + { + "name": "", + "useMultipleDirections": false, + "directions": [ + { + "looping": false, + "timeBetweenFrames": 0.08, + "sprites": [ + { + "hasCustomCollisionMask": true, + "image": "assets/weapons/icons/grenadeVintage.png", + "points": [], + "originPoint": { + "name": "origine", + "x": 19.5, + "y": 74 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [ + [ + { + "x": 0, + "y": 1 + }, + { + "x": 169, + "y": 1 + }, + { + "x": 169, + "y": 129 + }, + { + "x": 0, + "y": 129 + } + ] + ] + } + ] + } + ] + }, + { + "name": "", + "useMultipleDirections": false, + "directions": [ + { + "looping": false, + "timeBetweenFrames": 0.08, + "sprites": [ + { + "hasCustomCollisionMask": true, + "image": "assets/weapons/icons/grenadeSmoke.png", + "points": [], + "originPoint": { + "name": "origine", + "x": 18.5, + "y": 38.5 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [ + [ + { + "x": 0, + "y": 1 + }, + { + "x": 169, + "y": 1 + }, + { + "x": 169, + "y": 129 + }, + { + "x": 0, + "y": 129 + } + ] + ] + } + ] + } + ] + }, + { + "name": "", + "useMultipleDirections": false, + "directions": [ + { + "looping": false, + "timeBetweenFrames": 0.08, + "sprites": [ + { + "hasCustomCollisionMask": true, + "image": "assets/weapons/icons/grenadeFlash.png", + "points": [], + "originPoint": { + "name": "origine", + "x": 17.5, + "y": 38.5 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [ + [ + { + "x": 0, + "y": 1 + }, + { + "x": 169, + "y": 1 + }, + { + "x": 169, + "y": 129 + }, + { + "x": 0, + "y": 129 + } + ] + ] + } + ] + } + ] + }, + { + "name": "", + "useMultipleDirections": false, + "directions": [ + { + "looping": false, + "timeBetweenFrames": 0.08, + "sprites": [ + { + "hasCustomCollisionMask": true, + "image": "assets/weapons/icons/grenade.png", + "points": [], + "originPoint": { + "name": "origine", + "x": 22.5, + "y": 34 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [ + [ + { + "x": 0, + "y": 1 + }, + { + "x": 169, + "y": 1 + }, + { + "x": 169, + "y": 129 + }, + { + "x": 0, + "y": 129 + } + ] + ] + } + ] + } + ] + }, + { + "name": "", + "useMultipleDirections": false, + "directions": [ + { + "looping": false, + "timeBetweenFrames": 0.08, + "sprites": [ + { + "hasCustomCollisionMask": true, + "image": "assets/weapons/icons/flamethrower_short.png", + "points": [], + "originPoint": { + "name": "origine", + "x": 106.5, + "y": 41 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [ + [ + { + "x": 0, + "y": 1 + }, + { + "x": 169, + "y": 1 + }, + { + "x": 169, + "y": 129 + }, + { + "x": 0, + "y": 129 + } + ] + ] + } + ] + } + ] + }, + { + "name": "", + "useMultipleDirections": false, + "directions": [ + { + "looping": false, + "timeBetweenFrames": 0.08, + "sprites": [ + { + "hasCustomCollisionMask": true, + "image": "assets/weapons/icons/flamethrower_long.png", + "points": [], + "originPoint": { + "name": "origine", + "x": 114, + "y": 40.5 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [ + [ + { + "x": 0, + "y": 1 + }, + { + "x": 169, + "y": 1 + }, + { + "x": 169, + "y": 129 + }, + { + "x": 0, + "y": 129 + } + ] + ] + } + ] + } + ] + } + ] + }, + { + "adaptCollisionMaskAutomatically": true, + "assetStoreId": "", + "name": "bar", + "type": "Sprite", + "updateIfNotVisible": false, + "variables": [], + "effects": [], + "behaviors": [ + { + "name": "Tween", + "type": "Tween::TweenBehavior" + } + ], + "animations": [ + { + "name": "", + "useMultipleDirections": false, + "directions": [ + { + "looping": false, + "timeBetweenFrames": 0.08, + "sprites": [ + { + "hasCustomCollisionMask": true, + "image": "assets/weapons/icons/bar.png", + "points": [], + "originPoint": { + "name": "origine", + "x": 0, + "y": 0 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [ + [ + { + "x": 112, + "y": 0 + }, + { + "x": 1807, + "y": 0 + }, + { + "x": 1807, + "y": 296 + }, + { + "x": 112, + "y": 296 + } + ] + ] + } + ] + } + ] + } + ] + }, + { + "adaptCollisionMaskAutomatically": false, + "assetStoreId": "", + "name": "weaponWheelSticker", + "type": "Sprite", + "updateIfNotVisible": false, + "variables": [], + "effects": [], + "behaviors": [ + { + "name": "Tween", + "type": "Tween::TweenBehavior" + } + ], + "animations": [ + { + "name": "hidden_separate", + "useMultipleDirections": false, + "directions": [ + { + "looping": false, + "timeBetweenFrames": 0.08, + "sprites": [ + { + "hasCustomCollisionMask": false, + "image": "assets\\sprite_objects\\hidden_separate-1.png", + "points": [], + "originPoint": { + "name": "origine", + "x": 0, + "y": 0 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [] + } + ] + } + ] + } + ] + } + ], + "objectsFolderStructure": { + "folderName": "__ROOT", + "children": [ + { + "folderName": "UI", + "children": [ + { + "folderName": "weapon", + "children": [ + { + "objectName": "NewObject" + }, + { + "objectName": "weapon_icons" + } + ] + }, + { + "folderName": "phone", + "children": [ + { + "objectName": "Thumb" + }, + { + "objectName": "phoneIcons" + }, + { + "objectName": "phoneFrame" + }, + { + "objectName": "phoneMask" + }, + { + "objectName": "phoneWallpaper" + }, + { + "objectName": "phone_battery" + }, + { + "objectName": "Pointer" + }, + { + "objectName": "phone_time" + }, + { + "objectName": "phone_wifi" + } + ] + }, + { + "folderName": "debug", + "children": [ + { + "objectName": "Wheel_info" + }, + { + "objectName": "weaponholding" + }, + { + "objectName": "reloading" + }, + { + "objectName": "debugToggle" + }, + { + "objectName": "debugText" + }, + { + "objectName": "AmmoText" + } + ] + }, + { + "objectName": "crosshair" + } + ] + }, + { + "folderName": "Environment", + "children": [ + { + "folderName": "particles", + "children": [ + { + "objectName": "green_leaves_particle" + }, + { + "objectName": "brown_leaves_particle" + } + ] + }, + { + "folderName": "sports", + "children": [ + { + "folderName": "basketball", + "children": [ + { + "objectName": "sports_equipments" + }, + { + "objectName": "ground_elements" + }, + { + "objectName": "sports_equipments_movable" + } + ] + } + ] + }, + { + "folderName": "props", + "children": [ + { + "objectName": "trash_movable" + }, + { + "objectName": "deco" + }, + { + "objectName": "Fences" + }, + { + "objectName": "road_block" + }, + { + "objectName": "foliage" + } + ] + } + ] + }, + { + "folderName": "Player", + "children": [ + { + "objectName": "Body" + }, + { + "objectName": "Leg" + }, + { + "objectName": "Hand" + } + ] + }, + { + "folderName": "Land", + "children": [ + { + "objectName": "beach_sand_2" + }, + { + "objectName": "sand_1" + }, + { + "objectName": "beach_sand_1" + }, + { + "objectName": "sand_2" + }, + { + "objectName": "concrete_1" + }, + { + "objectName": "sand" + }, + { + "objectName": "grass_tiled" + }, + { + "objectName": "grass" + } + ] + }, + { + "folderName": "Road", + "children": [ + { + "objectName": "road_3" + }, + { + "objectName": "road_4" + }, + { + "objectName": "bridge" + }, + { + "objectName": "road_2" + }, + { + "objectName": "road_1" + }, + { + "objectName": "road" + } + ] + }, + { + "folderName": "Weapons", + "children": [ + { + "folderName": "Icons", + "children": [ + { + "objectName": "icons" + }, + { + "objectName": "bar" + } + ] + }, + { + "folderName": "particles", + "children": [ + { + "objectName": "shooting_effect_sniper" + }, + { + "objectName": "shooting_effect" + }, + { + "objectName": "shooting_effect_rocket" + }, + { + "objectName": "bullet_destroy_pistol" + }, + { + "objectName": "bullet_destroy_sniper" + }, + { + "objectName": "bullet_destroy_machine" + }, + { + "objectName": "bullet_destroy_rocket" + } + ] + }, + { + "folderName": "type", + "children": [ + { + "folderName": "melee", + "children": [ + { + "objectName": "mele1" + }, + { + "objectName": "mele2" + } + ] + }, + { + "folderName": "gun", + "children": [ + { + "objectName": "gun1" }, { "objectName": "gun3" @@ -61972,6 +63428,9 @@ }, { "objectName": "hidden_separate" + }, + { + "objectName": "weaponWheelSticker" } ] } @@ -62009,7 +63468,6 @@ "colorG": 176, "colorR": 74, "creationTime": 0, - "folded": true, "name": "Links", "source": "", "type": "BuiltinCommonInstructions::Group", @@ -62428,6 +63886,16 @@ }, "stringParameters": {}, "booleanParameters": {} + }, + { + "effectType": "TiltShift", + "name": "weaponwhe", + "doubleParameters": { + "blur": 0, + "gradientBlur": 0 + }, + "stringParameters": {}, + "booleanParameters": {} } ] },