diff --git a/examples/3d-endless-terrain/3d-endless-terrain.json b/examples/3d-endless-terrain/3d-endless-terrain.json index 2377883a4..b9ba18f03 100644 --- a/examples/3d-endless-terrain/3d-endless-terrain.json +++ b/examples/3d-endless-terrain/3d-endless-terrain.json @@ -8498,8 +8498,8 @@ "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyMy4wLjMsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iSWNvbnMiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB2aWV3Qm94PSIwIDAgMzIgMzIiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDMyIDMyOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8c3R5bGUgdHlwZT0idGV4dC9jc3MiPg0KCS5zdDB7ZmlsbDpub25lO3N0cm9rZTojMDAwMDAwO3N0cm9rZS13aWR0aDoyO3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1saW5lam9pbjpyb3VuZDtzdHJva2UtbWl0ZXJsaW1pdDoxMDt9DQo8L3N0eWxlPg0KPHBvbHlsaW5lIGNsYXNzPSJzdDAiIHBvaW50cz0iMTksMTkgMjQsMTkgMjQsMjQgIi8+DQo8cG9seWxpbmUgY2xhc3M9InN0MCIgcG9pbnRzPSI2LDIzIDExLDIzIDExLDE4ICIvPg0KPHBhdGggY2xhc3M9InN0MCIgZD0iTTI0LDE5LjRjLTAuNywwLjgtMS40LDEuNi0yLjIsMi40Yy03LDctMTUuMywxMC4yLTE4LjUsN3MtMC4xLTExLjUsNy0xOC41czE1LjMtMTAuMiwxOC41LTcNCgljMS40LDEuNCwxLjYsMy42LDAuOCw2LjMiLz4NCjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik0xMSwyMi41Yy0wLjMtMC4yLTAuNS0wLjUtMC44LTAuOGMtNy03LTEwLjItMTUuMy03LTE4LjVzMTEuNS0wLjEsMTguNSw3czEwLjIsMTUuMyw3LDE4LjUNCgljLTEuNywxLjctNC44LDEuNi04LjQsMC4xIi8+DQo8L3N2Zz4NCg==", "name": "MousePointerLock", "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/Line Hero Pack/Master/SVG/Virtual Reality/Virtual Reality_360_rotate_vr_movement.svg", - "shortDescription": "This behavior removes the limit on the distance the mouse can move and hides the cursor.", - "version": "0.3.0", + "shortDescription": "Lock and hide mouse pointer for unlimited movement (e.g., FPS mouse look).", + "version": "0.3.2", "description": [ "This behavior removes the limit on the distance the mouse can move and hides the cursor.", "", @@ -8547,7 +8547,7 @@ { "name": "TouchSpeedFactor", "type": "number", - "value": 4 + "value": 2 } ], "eventsFunctions": [ @@ -8795,16 +8795,46 @@ ] }, { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "const { handler } = gdjs._MousePointerLockExtension;\r", - "\r", - "handler.requestPointerLock();\r", - "" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Fingers are followed instead of locking the pointer, because mobile browsers give tiny pointer movements." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "<", + "2" + ] + } ], - "parameterObjects": "", - "useStrict": true, - "eventsSheetExpanded": false + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const { handler } = gdjs._MousePointerLockExtension;\r", + "\r", + "handler.requestPointerLock();\r", + "" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ] } ], "parameters": [], @@ -8951,7 +8981,7 @@ "functionType": "Condition", "name": "isEmulatingPointerLock", "private": true, - "sentence": "The mouse pointer is lock is emulated", + "sentence": "The mouse pointer lock is emulated", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -8987,6 +9017,31 @@ ] } ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + ">=", + "2" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] } ], "parameters": [], @@ -9293,6 +9348,18 @@ }, "comment": "TODO It's probably a bad idea to rotate the object around Y." }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Both rotations are relative to the screen height because the field of view is vertical. This way, the speed doesn't change with the screen ratio." + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ @@ -9314,7 +9381,7 @@ "parameters": [ "Object", "+", - "MousePointerLock::MovementX() * HorizontalSpeed / SceneWindowWidth()" + "MousePointerLock::MovementX() * HorizontalSpeed / (SceneWindowHeight() * 16 / 9)" ] }, { @@ -9957,32 +10024,7 @@ "name": "ShouldLock" } ], - "propertiesFolderStructure": { - "folderName": "__ROOT", - "children": [ - { - "propertyName": "Object3D" - }, - { - "propertyName": "HorizontalSpeed" - }, - { - "propertyName": "VerticalSpeed" - }, - { - "propertyName": "VerticalAngleMin" - }, - { - "propertyName": "VerticalAngleMax" - }, - { - "propertyName": "OffsetZ" - }, - { - "propertyName": "ShouldLock" - } - ] - } + "sharedPropertyDescriptors": [] } ], "eventsBasedObjects": [] diff --git a/examples/3d-first-person/3d-first-person.json b/examples/3d-first-person/3d-first-person.json index 2bbcc98eb..74f7fec7e 100644 --- a/examples/3d-first-person/3d-first-person.json +++ b/examples/3d-first-person/3d-first-person.json @@ -3356,8 +3356,8 @@ "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyMy4wLjMsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iSWNvbnMiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB2aWV3Qm94PSIwIDAgMzIgMzIiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDMyIDMyOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8c3R5bGUgdHlwZT0idGV4dC9jc3MiPg0KCS5zdDB7ZmlsbDpub25lO3N0cm9rZTojMDAwMDAwO3N0cm9rZS13aWR0aDoyO3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1saW5lam9pbjpyb3VuZDtzdHJva2UtbWl0ZXJsaW1pdDoxMDt9DQo8L3N0eWxlPg0KPHBvbHlsaW5lIGNsYXNzPSJzdDAiIHBvaW50cz0iMTksMTkgMjQsMTkgMjQsMjQgIi8+DQo8cG9seWxpbmUgY2xhc3M9InN0MCIgcG9pbnRzPSI2LDIzIDExLDIzIDExLDE4ICIvPg0KPHBhdGggY2xhc3M9InN0MCIgZD0iTTI0LDE5LjRjLTAuNywwLjgtMS40LDEuNi0yLjIsMi40Yy03LDctMTUuMywxMC4yLTE4LjUsN3MtMC4xLTExLjUsNy0xOC41czE1LjMtMTAuMiwxOC41LTcNCgljMS40LDEuNCwxLjYsMy42LDAuOCw2LjMiLz4NCjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik0xMSwyMi41Yy0wLjMtMC4yLTAuNS0wLjUtMC44LTAuOGMtNy03LTEwLjItMTUuMy03LTE4LjVzMTEuNS0wLjEsMTguNSw3czEwLjIsMTUuMyw3LDE4LjUNCgljLTEuNywxLjctNC44LDEuNi04LjQsMC4xIi8+DQo8L3N2Zz4NCg==", "name": "MousePointerLock", "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/Line Hero Pack/Master/SVG/Virtual Reality/Virtual Reality_360_rotate_vr_movement.svg", - "shortDescription": "This behavior removes the limit on the distance the mouse can move and hides the cursor.", - "version": "0.3.0", + "shortDescription": "Lock and hide mouse pointer for unlimited movement (e.g., FPS mouse look).", + "version": "0.3.2", "description": [ "This behavior removes the limit on the distance the mouse can move and hides the cursor.", "", @@ -3405,7 +3405,7 @@ { "name": "TouchSpeedFactor", "type": "number", - "value": 4 + "value": 2 } ], "eventsFunctions": [ @@ -3653,16 +3653,46 @@ ] }, { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "const { handler } = gdjs._MousePointerLockExtension;\r", - "\r", - "handler.requestPointerLock();\r", - "" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Fingers are followed instead of locking the pointer, because mobile browsers give tiny pointer movements." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "<", + "2" + ] + } ], - "parameterObjects": "", - "useStrict": true, - "eventsSheetExpanded": false + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const { handler } = gdjs._MousePointerLockExtension;\r", + "\r", + "handler.requestPointerLock();\r", + "" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ] } ], "parameters": [], @@ -3809,7 +3839,7 @@ "functionType": "Condition", "name": "isEmulatingPointerLock", "private": true, - "sentence": "The mouse pointer is lock is emulated", + "sentence": "The mouse pointer lock is emulated", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -3845,6 +3875,31 @@ ] } ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + ">=", + "2" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] } ], "parameters": [], @@ -4151,6 +4206,18 @@ }, "comment": "TODO It's probably a bad idea to rotate the object around Y." }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Both rotations are relative to the screen height because the field of view is vertical. This way, the speed doesn't change with the screen ratio." + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ @@ -4172,7 +4239,7 @@ "parameters": [ "Object", "+", - "MousePointerLock::MovementX() * HorizontalSpeed / SceneWindowWidth()" + "MousePointerLock::MovementX() * HorizontalSpeed / (SceneWindowHeight() * 16 / 9)" ] }, { @@ -4815,32 +4882,7 @@ "name": "ShouldLock" } ], - "propertiesFolderStructure": { - "folderName": "__ROOT", - "children": [ - { - "propertyName": "Object3D" - }, - { - "propertyName": "HorizontalSpeed" - }, - { - "propertyName": "VerticalSpeed" - }, - { - "propertyName": "VerticalAngleMin" - }, - { - "propertyName": "VerticalAngleMax" - }, - { - "propertyName": "OffsetZ" - }, - { - "propertyName": "ShouldLock" - } - ] - } + "sharedPropertyDescriptors": [] } ], "eventsBasedObjects": [] diff --git a/examples/3d-island-terrain/3d-island-terrain.json b/examples/3d-island-terrain/3d-island-terrain.json index 705fee01a..0b24084dc 100644 --- a/examples/3d-island-terrain/3d-island-terrain.json +++ b/examples/3d-island-terrain/3d-island-terrain.json @@ -2164,6 +2164,51 @@ "source": "", "type": "BuiltinCommonInstructions::Group", "events": [ + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Start with touch controls on touchscreens." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SceneJustBegins" + }, + "parameters": [ + "" + ] + }, + { + "type": { + "value": "SystemInfo::HasTouchScreen" + }, + "parameters": [ + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteToggleSwitch::SpriteToggleSwitch::SetChecked" + }, + "parameters": [ + "ControlsToggle", + "yes", + "" + ] + } + ] + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ @@ -2710,18 +2755,11 @@ "conditions": [ { "type": { - "value": "MouseButtonFromTextPressed" + "value": "HasAnyTouchOrMouseStarted" }, "parameters": [ - "", - "\"Left\"" + "" ] - }, - { - "type": { - "value": "BuiltinCommonInstructions::Once" - }, - "parameters": [] } ], "actions": [], @@ -2740,17 +2778,6 @@ "\"Left\"", "" ] - }, - { - "type": { - "inverted": true, - "value": "SpriteMultitouchJoystick::MultitouchButton::IsPressed" - }, - "parameters": [ - "JumpButton", - "MultitouchButton", - "" - ] } ], "actions": [ @@ -17239,7 +17266,7 @@ "name": "MousePointerLock", "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/Line Hero Pack/Master/SVG/Virtual Reality/Virtual Reality_360_rotate_vr_movement.svg", "shortDescription": "Lock and hide mouse pointer for unlimited movement (e.g., FPS mouse look).", - "version": "0.3.1", + "version": "0.3.2", "description": [ "This behavior removes the limit on the distance the mouse can move and hides the cursor.", "", @@ -17287,7 +17314,7 @@ { "name": "TouchSpeedFactor", "type": "number", - "value": 4 + "value": 2 } ], "eventsFunctions": [ @@ -17535,16 +17562,46 @@ ] }, { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "const { handler } = gdjs._MousePointerLockExtension;\r", - "\r", - "handler.requestPointerLock();\r", - "" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Fingers are followed instead of locking the pointer, because mobile browsers give tiny pointer movements." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "<", + "2" + ] + } ], - "parameterObjects": "", - "useStrict": true, - "eventsSheetExpanded": false + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const { handler } = gdjs._MousePointerLockExtension;\r", + "\r", + "handler.requestPointerLock();\r", + "" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ] } ], "parameters": [], @@ -17727,6 +17784,31 @@ ] } ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + ">=", + "2" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] } ], "parameters": [], @@ -18033,6 +18115,18 @@ }, "comment": "TODO It's probably a bad idea to rotate the object around Y." }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Both rotations are relative to the screen height because the field of view is vertical. This way, the speed doesn't change with the screen ratio." + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ @@ -18054,7 +18148,7 @@ "parameters": [ "Object", "+", - "MousePointerLock::MovementX() * HorizontalSpeed / SceneWindowWidth()" + "MousePointerLock::MovementX() * HorizontalSpeed / (SceneWindowHeight() * 16 / 9)" ] }, { diff --git a/examples/3d-platformer/3d-platformer.json b/examples/3d-platformer/3d-platformer.json index 15c192026..91ee83401 100644 --- a/examples/3d-platformer/3d-platformer.json +++ b/examples/3d-platformer/3d-platformer.json @@ -19919,7 +19919,6 @@ { "author": "PANDAKO-GitHub", "category": "Input", - "dimension": "", "extensionNamespace": "", "fullName": "Mouse Pointer Lock", "gdevelopVersion": ">=5.5.222", @@ -19927,8 +19926,8 @@ "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyMy4wLjMsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iSWNvbnMiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB2aWV3Qm94PSIwIDAgMzIgMzIiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDMyIDMyOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8c3R5bGUgdHlwZT0idGV4dC9jc3MiPg0KCS5zdDB7ZmlsbDpub25lO3N0cm9rZTojMDAwMDAwO3N0cm9rZS13aWR0aDoyO3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1saW5lam9pbjpyb3VuZDtzdHJva2UtbWl0ZXJsaW1pdDoxMDt9DQo8L3N0eWxlPg0KPHBvbHlsaW5lIGNsYXNzPSJzdDAiIHBvaW50cz0iMTksMTkgMjQsMTkgMjQsMjQgIi8+DQo8cG9seWxpbmUgY2xhc3M9InN0MCIgcG9pbnRzPSI2LDIzIDExLDIzIDExLDE4ICIvPg0KPHBhdGggY2xhc3M9InN0MCIgZD0iTTI0LDE5LjRjLTAuNywwLjgtMS40LDEuNi0yLjIsMi40Yy03LDctMTUuMywxMC4yLTE4LjUsN3MtMC4xLTExLjUsNy0xOC41czE1LjMtMTAuMiwxOC41LTcNCgljMS40LDEuNCwxLjYsMy42LDAuOCw2LjMiLz4NCjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik0xMSwyMi41Yy0wLjMtMC4yLTAuNS0wLjUtMC44LTAuOGMtNy03LTEwLjItMTUuMy03LTE4LjVzMTEuNS0wLjEsMTguNSw3czEwLjIsMTUuMyw3LDE4LjUNCgljLTEuNywxLjctNC44LDEuNi04LjQsMC4xIi8+DQo8L3N2Zz4NCg==", "name": "MousePointerLock", "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/Line Hero Pack/Master/SVG/Virtual Reality/Virtual Reality_360_rotate_vr_movement.svg", - "shortDescription": "This behavior removes the limit on the distance the mouse can move and hides the cursor.", - "version": "0.3.0", + "shortDescription": "Lock and hide mouse pointer for unlimited movement (e.g., FPS mouse look).", + "version": "0.3.2", "description": [ "This behavior removes the limit on the distance the mouse can move and hides the cursor.", "", @@ -19976,7 +19975,7 @@ { "name": "TouchSpeedFactor", "type": "number", - "value": 4 + "value": 2 } ], "eventsFunctions": [ @@ -20224,16 +20223,46 @@ ] }, { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "const { handler } = gdjs._MousePointerLockExtension;\r", - "\r", - "handler.requestPointerLock();\r", - "" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Fingers are followed instead of locking the pointer, because mobile browsers give tiny pointer movements." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "<", + "2" + ] + } ], - "parameterObjects": "", - "useStrict": true, - "eventsSheetExpanded": false + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const { handler } = gdjs._MousePointerLockExtension;\r", + "\r", + "handler.requestPointerLock();\r", + "" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ] } ], "parameters": [], @@ -20416,6 +20445,31 @@ ] } ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + ">=", + "2" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] } ], "parameters": [], @@ -20697,68 +20751,12 @@ "objectGroups": [] } ], - "eventsFunctionsFolderStructure": { - "folderName": "__ROOT", - "children": [ - { - "functionName": "onFirstSceneLoaded" - }, - { - "functionName": "onScenePostEvents" - }, - { - "functionName": "RequestPointerLock" - }, - { - "functionName": "ExitPointerLock" - }, - { - "functionName": "isPointerLocked" - }, - { - "functionName": "isPointerActuallyLocked" - }, - { - "functionName": "isEmulatingPointerLock" - }, - { - "functionName": "IsMoving" - }, - { - "functionName": "MovementX" - }, - { - "functionName": "SetMovementX" - }, - { - "functionName": "MovementY" - }, - { - "functionName": "SetMovementY" - }, - { - "functionName": "TouchX" - }, - { - "functionName": "TouchY" - }, - { - "functionName": "TouchSpeedFactor" - }, - { - "functionName": "SetTouchSpeedFactor" - } - ] - }, "eventsBasedBehaviors": [ { "description": "Control camera rotations with a mouse.", "fullName": "First person camera mouse mapper", - "helpPath": "", - "iconUrl": "", "name": "FirstPersonPointerMapper", "objectType": "", - "previewIconUrl": "", "eventsFunctions": [ { "fullName": "", @@ -20778,6 +20776,18 @@ }, "comment": "TODO It's probably a bad idea to rotate the object around Y." }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Both rotations are relative to the screen height because the field of view is vertical. This way, the speed doesn't change with the screen ratio." + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ @@ -20799,7 +20809,7 @@ "parameters": [ "Object", "+", - "MousePointerLock::MovementX() * HorizontalSpeed / SceneWindowWidth()" + "MousePointerLock::MovementX() * HorizontalSpeed / (SceneWindowHeight() * 16 / 9)" ] }, { @@ -21033,7 +21043,6 @@ "fullName": "", "functionType": "ActionWithOperator", "getterName": "HorizontalSpeed", - "group": "First person camera mouse mapper configuration", "name": "SetHorizontalSpeed", "sentence": "", "events": [ @@ -21114,7 +21123,6 @@ "fullName": "", "functionType": "ActionWithOperator", "getterName": "VerticalSpeed", - "group": "First person camera mouse mapper configuration", "name": "SetVerticalSpeed", "sentence": "", "events": [ @@ -21195,7 +21203,6 @@ "fullName": "", "functionType": "ActionWithOperator", "getterName": "VerticalAngleMin", - "group": "First person camera mouse mapper configuration", "name": "SetVerticalAngleMin", "sentence": "", "events": [ @@ -21276,7 +21283,6 @@ "fullName": "", "functionType": "ActionWithOperator", "getterName": "VerticalAngleMax", - "group": "First person camera mouse mapper configuration", "name": "SetVerticalAngleMax", "sentence": "", "events": [ @@ -21357,7 +21363,6 @@ "fullName": "", "functionType": "ActionWithOperator", "getterName": "OffsetZ", - "group": "First person camera mouse mapper configuration", "name": "SetOffsetZ", "sentence": "", "events": [ @@ -21394,57 +21399,6 @@ "objectGroups": [] } ], - "eventsFunctionsFolderStructure": { - "folderName": "__ROOT", - "children": [ - { - "functionName": "doStepPreEvents" - }, - { - "folderName": "Layers and cameras", - "children": [ - { - "functionName": "LookFromObjectEyes" - } - ] - }, - { - "folderName": "First person camera mouse mapper configuration", - "children": [ - { - "functionName": "HorizontalSpeed" - }, - { - "functionName": "SetHorizontalSpeed" - }, - { - "functionName": "VerticalSpeed" - }, - { - "functionName": "SetVerticalSpeed" - }, - { - "functionName": "VerticalAngleMin" - }, - { - "functionName": "SetVerticalAngleMin" - }, - { - "functionName": "VerticalAngleMax" - }, - { - "functionName": "SetVerticalAngleMax" - }, - { - "functionName": "OffsetZ" - }, - { - "functionName": "SetOffsetZ" - } - ] - } - ] - }, "propertyDescriptors": [ { "value": "", @@ -21498,32 +21452,7 @@ "name": "ShouldLock" } ], - "propertiesFolderStructure": { - "folderName": "__ROOT", - "children": [ - { - "propertyName": "Object3D" - }, - { - "propertyName": "HorizontalSpeed" - }, - { - "propertyName": "VerticalSpeed" - }, - { - "propertyName": "VerticalAngleMin" - }, - { - "propertyName": "VerticalAngleMax" - }, - { - "propertyName": "OffsetZ" - }, - { - "propertyName": "ShouldLock" - } - ] - } + "sharedPropertyDescriptors": [] } ], "eventsBasedObjects": [] diff --git a/examples/3d-shooting-gallery/3d-shooting-gallery.json b/examples/3d-shooting-gallery/3d-shooting-gallery.json index 4444bba1b..3fd54aa75 100644 --- a/examples/3d-shooting-gallery/3d-shooting-gallery.json +++ b/examples/3d-shooting-gallery/3d-shooting-gallery.json @@ -11666,8 +11666,8 @@ "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyMy4wLjMsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iSWNvbnMiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB2aWV3Qm94PSIwIDAgMzIgMzIiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDMyIDMyOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8c3R5bGUgdHlwZT0idGV4dC9jc3MiPg0KCS5zdDB7ZmlsbDpub25lO3N0cm9rZTojMDAwMDAwO3N0cm9rZS13aWR0aDoyO3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1saW5lam9pbjpyb3VuZDtzdHJva2UtbWl0ZXJsaW1pdDoxMDt9DQo8L3N0eWxlPg0KPHBvbHlsaW5lIGNsYXNzPSJzdDAiIHBvaW50cz0iMTksMTkgMjQsMTkgMjQsMjQgIi8+DQo8cG9seWxpbmUgY2xhc3M9InN0MCIgcG9pbnRzPSI2LDIzIDExLDIzIDExLDE4ICIvPg0KPHBhdGggY2xhc3M9InN0MCIgZD0iTTI0LDE5LjRjLTAuNywwLjgtMS40LDEuNi0yLjIsMi40Yy03LDctMTUuMywxMC4yLTE4LjUsN3MtMC4xLTExLjUsNy0xOC41czE1LjMtMTAuMiwxOC41LTcNCgljMS40LDEuNCwxLjYsMy42LDAuOCw2LjMiLz4NCjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik0xMSwyMi41Yy0wLjMtMC4yLTAuNS0wLjUtMC44LTAuOGMtNy03LTEwLjItMTUuMy03LTE4LjVzMTEuNS0wLjEsMTguNSw3czEwLjIsMTUuMyw3LDE4LjUNCgljLTEuNywxLjctNC44LDEuNi04LjQsMC4xIi8+DQo8L3N2Zz4NCg==", "name": "MousePointerLock", "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/Line Hero Pack/Master/SVG/Virtual Reality/Virtual Reality_360_rotate_vr_movement.svg", - "shortDescription": "This behavior removes the limit on the distance the mouse can move and hides the cursor.", - "version": "0.3.0", + "shortDescription": "Lock and hide mouse pointer for unlimited movement (e.g., FPS mouse look).", + "version": "0.3.2", "description": [ "This behavior removes the limit on the distance the mouse can move and hides the cursor.", "", @@ -11715,7 +11715,7 @@ { "name": "TouchSpeedFactor", "type": "number", - "value": 4 + "value": 2 } ], "eventsFunctions": [ @@ -11963,16 +11963,46 @@ ] }, { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "const { handler } = gdjs._MousePointerLockExtension;\r", - "\r", - "handler.requestPointerLock();\r", - "" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Fingers are followed instead of locking the pointer, because mobile browsers give tiny pointer movements." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "<", + "2" + ] + } ], - "parameterObjects": "", - "useStrict": true, - "eventsSheetExpanded": false + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const { handler } = gdjs._MousePointerLockExtension;\r", + "\r", + "handler.requestPointerLock();\r", + "" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ] } ], "parameters": [], @@ -12119,7 +12149,7 @@ "functionType": "Condition", "name": "isEmulatingPointerLock", "private": true, - "sentence": "The mouse pointer is lock is emulated", + "sentence": "The mouse pointer lock is emulated", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -12155,6 +12185,31 @@ ] } ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + ">=", + "2" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] } ], "parameters": [], @@ -12461,6 +12516,18 @@ }, "comment": "TODO It's probably a bad idea to rotate the object around Y." }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Both rotations are relative to the screen height because the field of view is vertical. This way, the speed doesn't change with the screen ratio." + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ @@ -12482,7 +12549,7 @@ "parameters": [ "Object", "+", - "MousePointerLock::MovementX() * HorizontalSpeed / SceneWindowWidth()" + "MousePointerLock::MovementX() * HorizontalSpeed / (SceneWindowHeight() * 16 / 9)" ] }, { diff --git a/examples/3d-tile-based-city-builder/3d-tile-based-city-builder.json b/examples/3d-tile-based-city-builder/3d-tile-based-city-builder.json index 6bc9b62fe..500effaf1 100644 --- a/examples/3d-tile-based-city-builder/3d-tile-based-city-builder.json +++ b/examples/3d-tile-based-city-builder/3d-tile-based-city-builder.json @@ -2074,8 +2074,8 @@ "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyMy4wLjMsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iSWNvbnMiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB2aWV3Qm94PSIwIDAgMzIgMzIiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDMyIDMyOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8c3R5bGUgdHlwZT0idGV4dC9jc3MiPg0KCS5zdDB7ZmlsbDpub25lO3N0cm9rZTojMDAwMDAwO3N0cm9rZS13aWR0aDoyO3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1saW5lam9pbjpyb3VuZDtzdHJva2UtbWl0ZXJsaW1pdDoxMDt9DQo8L3N0eWxlPg0KPHBvbHlsaW5lIGNsYXNzPSJzdDAiIHBvaW50cz0iMTksMTkgMjQsMTkgMjQsMjQgIi8+DQo8cG9seWxpbmUgY2xhc3M9InN0MCIgcG9pbnRzPSI2LDIzIDExLDIzIDExLDE4ICIvPg0KPHBhdGggY2xhc3M9InN0MCIgZD0iTTI0LDE5LjRjLTAuNywwLjgtMS40LDEuNi0yLjIsMi40Yy03LDctMTUuMywxMC4yLTE4LjUsN3MtMC4xLTExLjUsNy0xOC41czE1LjMtMTAuMiwxOC41LTcNCgljMS40LDEuNCwxLjYsMy42LDAuOCw2LjMiLz4NCjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik0xMSwyMi41Yy0wLjMtMC4yLTAuNS0wLjUtMC44LTAuOGMtNy03LTEwLjItMTUuMy03LTE4LjVzMTEuNS0wLjEsMTguNSw3czEwLjIsMTUuMyw3LDE4LjUNCgljLTEuNywxLjctNC44LDEuNi04LjQsMC4xIi8+DQo8L3N2Zz4NCg==", "name": "MousePointerLock", "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/Line Hero Pack/Master/SVG/Virtual Reality/Virtual Reality_360_rotate_vr_movement.svg", - "shortDescription": "This behavior removes the limit on the distance the mouse can move and hides the cursor.", - "version": "0.3.0", + "shortDescription": "Lock and hide mouse pointer for unlimited movement (e.g., FPS mouse look).", + "version": "0.3.2", "description": [ "This behavior removes the limit on the distance the mouse can move and hides the cursor.", "", @@ -2123,7 +2123,7 @@ { "name": "TouchSpeedFactor", "type": "number", - "value": 4 + "value": 2 } ], "eventsFunctions": [ @@ -2371,16 +2371,46 @@ ] }, { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "const { handler } = gdjs._MousePointerLockExtension;\r", - "\r", - "handler.requestPointerLock();\r", - "" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Fingers are followed instead of locking the pointer, because mobile browsers give tiny pointer movements." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "<", + "2" + ] + } ], - "parameterObjects": "", - "useStrict": true, - "eventsSheetExpanded": false + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const { handler } = gdjs._MousePointerLockExtension;\r", + "\r", + "handler.requestPointerLock();\r", + "" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ] } ], "parameters": [], @@ -2527,7 +2557,7 @@ "functionType": "Condition", "name": "isEmulatingPointerLock", "private": true, - "sentence": "The mouse pointer is lock is emulated", + "sentence": "The mouse pointer lock is emulated", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -2563,6 +2593,31 @@ ] } ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + ">=", + "2" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] } ], "parameters": [], @@ -2869,6 +2924,18 @@ }, "comment": "TODO It's probably a bad idea to rotate the object around Y." }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Both rotations are relative to the screen height because the field of view is vertical. This way, the speed doesn't change with the screen ratio." + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ @@ -2890,7 +2957,7 @@ "parameters": [ "Object", "+", - "MousePointerLock::MovementX() * HorizontalSpeed / SceneWindowWidth()" + "MousePointerLock::MovementX() * HorizontalSpeed / (SceneWindowHeight() * 16 / 9)" ] }, { diff --git a/examples/3d-wall-sliding/3d-wall-sliding.json b/examples/3d-wall-sliding/3d-wall-sliding.json index 859560a58..a96e2b495 100644 --- a/examples/3d-wall-sliding/3d-wall-sliding.json +++ b/examples/3d-wall-sliding/3d-wall-sliding.json @@ -3714,8 +3714,8 @@ "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyMy4wLjMsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iSWNvbnMiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB2aWV3Qm94PSIwIDAgMzIgMzIiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDMyIDMyOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8c3R5bGUgdHlwZT0idGV4dC9jc3MiPg0KCS5zdDB7ZmlsbDpub25lO3N0cm9rZTojMDAwMDAwO3N0cm9rZS13aWR0aDoyO3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1saW5lam9pbjpyb3VuZDtzdHJva2UtbWl0ZXJsaW1pdDoxMDt9DQo8L3N0eWxlPg0KPHBvbHlsaW5lIGNsYXNzPSJzdDAiIHBvaW50cz0iMTksMTkgMjQsMTkgMjQsMjQgIi8+DQo8cG9seWxpbmUgY2xhc3M9InN0MCIgcG9pbnRzPSI2LDIzIDExLDIzIDExLDE4ICIvPg0KPHBhdGggY2xhc3M9InN0MCIgZD0iTTI0LDE5LjRjLTAuNywwLjgtMS40LDEuNi0yLjIsMi40Yy03LDctMTUuMywxMC4yLTE4LjUsN3MtMC4xLTExLjUsNy0xOC41czE1LjMtMTAuMiwxOC41LTcNCgljMS40LDEuNCwxLjYsMy42LDAuOCw2LjMiLz4NCjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik0xMSwyMi41Yy0wLjMtMC4yLTAuNS0wLjUtMC44LTAuOGMtNy03LTEwLjItMTUuMy03LTE4LjVzMTEuNS0wLjEsMTguNSw3czEwLjIsMTUuMyw3LDE4LjUNCgljLTEuNywxLjctNC44LDEuNi04LjQsMC4xIi8+DQo8L3N2Zz4NCg==", "name": "MousePointerLock", "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/Line Hero Pack/Master/SVG/Virtual Reality/Virtual Reality_360_rotate_vr_movement.svg", - "shortDescription": "This behavior removes the limit on the distance the mouse can move and hides the cursor.", - "version": "0.3.0", + "shortDescription": "Lock and hide mouse pointer for unlimited movement (e.g., FPS mouse look).", + "version": "0.3.2", "description": [ "This behavior removes the limit on the distance the mouse can move and hides the cursor.", "", @@ -3763,7 +3763,7 @@ { "name": "TouchSpeedFactor", "type": "number", - "value": 4 + "value": 2 } ], "eventsFunctions": [ @@ -4011,16 +4011,46 @@ ] }, { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "const { handler } = gdjs._MousePointerLockExtension;\r", - "\r", - "handler.requestPointerLock();\r", - "" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Fingers are followed instead of locking the pointer, because mobile browsers give tiny pointer movements." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "<", + "2" + ] + } ], - "parameterObjects": "", - "useStrict": true, - "eventsSheetExpanded": false + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const { handler } = gdjs._MousePointerLockExtension;\r", + "\r", + "handler.requestPointerLock();\r", + "" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ] } ], "parameters": [], @@ -4167,7 +4197,7 @@ "functionType": "Condition", "name": "isEmulatingPointerLock", "private": true, - "sentence": "The mouse pointer is lock is emulated", + "sentence": "The mouse pointer lock is emulated", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -4203,6 +4233,31 @@ ] } ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + ">=", + "2" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] } ], "parameters": [], @@ -4509,6 +4564,18 @@ }, "comment": "TODO It's probably a bad idea to rotate the object around Y." }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Both rotations are relative to the screen height because the field of view is vertical. This way, the speed doesn't change with the screen ratio." + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ @@ -4530,7 +4597,7 @@ "parameters": [ "Object", "+", - "MousePointerLock::MovementX() * HorizontalSpeed / SceneWindowWidth()" + "MousePointerLock::MovementX() * HorizontalSpeed / (SceneWindowHeight() * 16 / 9)" ] }, { diff --git a/examples/platformer-3d-wipeout/platformer-3d-wipeout.json b/examples/platformer-3d-wipeout/platformer-3d-wipeout.json index 14be783a7..0c0234bee 100644 --- a/examples/platformer-3d-wipeout/platformer-3d-wipeout.json +++ b/examples/platformer-3d-wipeout/platformer-3d-wipeout.json @@ -11475,8 +11475,8 @@ "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyMy4wLjMsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iSWNvbnMiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB2aWV3Qm94PSIwIDAgMzIgMzIiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDMyIDMyOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8c3R5bGUgdHlwZT0idGV4dC9jc3MiPg0KCS5zdDB7ZmlsbDpub25lO3N0cm9rZTojMDAwMDAwO3N0cm9rZS13aWR0aDoyO3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1saW5lam9pbjpyb3VuZDtzdHJva2UtbWl0ZXJsaW1pdDoxMDt9DQo8L3N0eWxlPg0KPHBvbHlsaW5lIGNsYXNzPSJzdDAiIHBvaW50cz0iMTksMTkgMjQsMTkgMjQsMjQgIi8+DQo8cG9seWxpbmUgY2xhc3M9InN0MCIgcG9pbnRzPSI2LDIzIDExLDIzIDExLDE4ICIvPg0KPHBhdGggY2xhc3M9InN0MCIgZD0iTTI0LDE5LjRjLTAuNywwLjgtMS40LDEuNi0yLjIsMi40Yy03LDctMTUuMywxMC4yLTE4LjUsN3MtMC4xLTExLjUsNy0xOC41czE1LjMtMTAuMiwxOC41LTcNCgljMS40LDEuNCwxLjYsMy42LDAuOCw2LjMiLz4NCjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik0xMSwyMi41Yy0wLjMtMC4yLTAuNS0wLjUtMC44LTAuOGMtNy03LTEwLjItMTUuMy03LTE4LjVzMTEuNS0wLjEsMTguNSw3czEwLjIsMTUuMyw3LDE4LjUNCgljLTEuNywxLjctNC44LDEuNi04LjQsMC4xIi8+DQo8L3N2Zz4NCg==", "name": "MousePointerLock", "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/Line Hero Pack/Master/SVG/Virtual Reality/Virtual Reality_360_rotate_vr_movement.svg", - "shortDescription": "This behavior removes the limit on the distance the mouse can move and hides the cursor.", - "version": "0.3.0", + "shortDescription": "Lock and hide mouse pointer for unlimited movement (e.g., FPS mouse look).", + "version": "0.3.2", "description": [ "This behavior removes the limit on the distance the mouse can move and hides the cursor.", "", @@ -11524,7 +11524,7 @@ { "name": "TouchSpeedFactor", "type": "number", - "value": 4 + "value": 2 } ], "eventsFunctions": [ @@ -11772,16 +11772,46 @@ ] }, { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "const { handler } = gdjs._MousePointerLockExtension;\r", - "\r", - "handler.requestPointerLock();\r", - "" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Fingers are followed instead of locking the pointer, because mobile browsers give tiny pointer movements." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "<", + "2" + ] + } ], - "parameterObjects": "", - "useStrict": true, - "eventsSheetExpanded": false + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const { handler } = gdjs._MousePointerLockExtension;\r", + "\r", + "handler.requestPointerLock();\r", + "" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ] } ], "parameters": [], @@ -11928,7 +11958,7 @@ "functionType": "Condition", "name": "isEmulatingPointerLock", "private": true, - "sentence": "The mouse pointer is lock is emulated", + "sentence": "The mouse pointer lock is emulated", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -11964,6 +11994,31 @@ ] } ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + ">=", + "2" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] } ], "parameters": [], @@ -12270,6 +12325,18 @@ }, "comment": "TODO It's probably a bad idea to rotate the object around Y." }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Both rotations are relative to the screen height because the field of view is vertical. This way, the speed doesn't change with the screen ratio." + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ @@ -12291,7 +12358,7 @@ "parameters": [ "Object", "+", - "MousePointerLock::MovementX() * HorizontalSpeed / SceneWindowWidth()" + "MousePointerLock::MovementX() * HorizontalSpeed / (SceneWindowHeight() * 16 / 9)" ] }, { @@ -12934,32 +13001,7 @@ "name": "ShouldLock" } ], - "propertiesFolderStructure": { - "folderName": "__ROOT", - "children": [ - { - "propertyName": "Object3D" - }, - { - "propertyName": "HorizontalSpeed" - }, - { - "propertyName": "VerticalSpeed" - }, - { - "propertyName": "VerticalAngleMin" - }, - { - "propertyName": "VerticalAngleMax" - }, - { - "propertyName": "OffsetZ" - }, - { - "propertyName": "ShouldLock" - } - ] - } + "sharedPropertyDescriptors": [] } ], "eventsBasedObjects": [] diff --git a/examples/starting-3D-platformer/starting-3D-platformer.json b/examples/starting-3D-platformer/starting-3D-platformer.json index dc710a171..37dbf52ff 100644 --- a/examples/starting-3D-platformer/starting-3D-platformer.json +++ b/examples/starting-3D-platformer/starting-3D-platformer.json @@ -1526,6 +1526,51 @@ "source": "", "type": "BuiltinCommonInstructions::Group", "events": [ + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Start with touch controls on touchscreens." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SceneJustBegins" + }, + "parameters": [ + "" + ] + }, + { + "type": { + "value": "SystemInfo::HasTouchScreen" + }, + "parameters": [ + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteToggleSwitch::SpriteToggleSwitch::SetChecked" + }, + "parameters": [ + "ControlsToggle", + "yes", + "" + ] + } + ] + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ @@ -2072,18 +2117,11 @@ "conditions": [ { "type": { - "value": "MouseButtonFromTextPressed" + "value": "HasAnyTouchOrMouseStarted" }, "parameters": [ - "", - "\"Left\"" + "" ] - }, - { - "type": { - "value": "BuiltinCommonInstructions::Once" - }, - "parameters": [] } ], "actions": [], @@ -2102,17 +2140,6 @@ "\"Left\"", "" ] - }, - { - "type": { - "inverted": true, - "value": "SpriteMultitouchJoystick::MultitouchButton::IsPressed" - }, - "parameters": [ - "JumpButton", - "MultitouchButton", - "" - ] } ], "actions": [ @@ -15283,7 +15310,6 @@ { "author": "PANDAKO-GitHub", "category": "Input", - "dimension": "", "extensionNamespace": "", "fullName": "Mouse Pointer Lock", "gdevelopVersion": ">=5.5.222", @@ -15291,8 +15317,8 @@ "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyMy4wLjMsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iSWNvbnMiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB2aWV3Qm94PSIwIDAgMzIgMzIiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDMyIDMyOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8c3R5bGUgdHlwZT0idGV4dC9jc3MiPg0KCS5zdDB7ZmlsbDpub25lO3N0cm9rZTojMDAwMDAwO3N0cm9rZS13aWR0aDoyO3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1saW5lam9pbjpyb3VuZDtzdHJva2UtbWl0ZXJsaW1pdDoxMDt9DQo8L3N0eWxlPg0KPHBvbHlsaW5lIGNsYXNzPSJzdDAiIHBvaW50cz0iMTksMTkgMjQsMTkgMjQsMjQgIi8+DQo8cG9seWxpbmUgY2xhc3M9InN0MCIgcG9pbnRzPSI2LDIzIDExLDIzIDExLDE4ICIvPg0KPHBhdGggY2xhc3M9InN0MCIgZD0iTTI0LDE5LjRjLTAuNywwLjgtMS40LDEuNi0yLjIsMi40Yy03LDctMTUuMywxMC4yLTE4LjUsN3MtMC4xLTExLjUsNy0xOC41czE1LjMtMTAuMiwxOC41LTcNCgljMS40LDEuNCwxLjYsMy42LDAuOCw2LjMiLz4NCjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik0xMSwyMi41Yy0wLjMtMC4yLTAuNS0wLjUtMC44LTAuOGMtNy03LTEwLjItMTUuMy03LTE4LjVzMTEuNS0wLjEsMTguNSw3czEwLjIsMTUuMyw3LDE4LjUNCgljLTEuNywxLjctNC44LDEuNi04LjQsMC4xIi8+DQo8L3N2Zz4NCg==", "name": "MousePointerLock", "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/Line Hero Pack/Master/SVG/Virtual Reality/Virtual Reality_360_rotate_vr_movement.svg", - "shortDescription": "This behavior removes the limit on the distance the mouse can move and hides the cursor.", - "version": "0.3.0", + "shortDescription": "Lock and hide mouse pointer for unlimited movement (e.g., FPS mouse look).", + "version": "0.3.2", "description": [ "This behavior removes the limit on the distance the mouse can move and hides the cursor.", "", @@ -15340,7 +15366,7 @@ { "name": "TouchSpeedFactor", "type": "number", - "value": 4 + "value": 2 } ], "eventsFunctions": [ @@ -15588,16 +15614,46 @@ ] }, { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "const { handler } = gdjs._MousePointerLockExtension;\r", - "\r", - "handler.requestPointerLock();\r", - "" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Fingers are followed instead of locking the pointer, because mobile browsers give tiny pointer movements." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "<", + "2" + ] + } ], - "parameterObjects": "", - "useStrict": true, - "eventsSheetExpanded": false + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const { handler } = gdjs._MousePointerLockExtension;\r", + "\r", + "handler.requestPointerLock();\r", + "" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ] } ], "parameters": [], @@ -15744,7 +15800,7 @@ "functionType": "Condition", "name": "isEmulatingPointerLock", "private": true, - "sentence": "The mouse pointer is lock is emulated", + "sentence": "The mouse pointer lock is emulated", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -15780,6 +15836,31 @@ ] } ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + ">=", + "2" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] } ], "parameters": [], @@ -16061,68 +16142,12 @@ "objectGroups": [] } ], - "eventsFunctionsFolderStructure": { - "folderName": "__ROOT", - "children": [ - { - "functionName": "onFirstSceneLoaded" - }, - { - "functionName": "onScenePostEvents" - }, - { - "functionName": "RequestPointerLock" - }, - { - "functionName": "ExitPointerLock" - }, - { - "functionName": "isPointerLocked" - }, - { - "functionName": "isPointerActuallyLocked" - }, - { - "functionName": "isEmulatingPointerLock" - }, - { - "functionName": "IsMoving" - }, - { - "functionName": "MovementX" - }, - { - "functionName": "SetMovementX" - }, - { - "functionName": "MovementY" - }, - { - "functionName": "SetMovementY" - }, - { - "functionName": "TouchX" - }, - { - "functionName": "TouchY" - }, - { - "functionName": "TouchSpeedFactor" - }, - { - "functionName": "SetTouchSpeedFactor" - } - ] - }, "eventsBasedBehaviors": [ { "description": "Control camera rotations with a mouse.", "fullName": "First person camera mouse mapper", - "helpPath": "", - "iconUrl": "", "name": "FirstPersonPointerMapper", "objectType": "", - "previewIconUrl": "", "eventsFunctions": [ { "fullName": "", @@ -16142,6 +16167,18 @@ }, "comment": "TODO It's probably a bad idea to rotate the object around Y." }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Both rotations are relative to the screen height because the field of view is vertical. This way, the speed doesn't change with the screen ratio." + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ @@ -16163,7 +16200,7 @@ "parameters": [ "Object", "+", - "MousePointerLock::MovementX() * HorizontalSpeed / SceneWindowWidth()" + "MousePointerLock::MovementX() * HorizontalSpeed / (SceneWindowHeight() * 16 / 9)" ] }, { @@ -16397,7 +16434,6 @@ "fullName": "", "functionType": "ActionWithOperator", "getterName": "HorizontalSpeed", - "group": "First person camera mouse mapper configuration", "name": "SetHorizontalSpeed", "sentence": "", "events": [ @@ -16478,7 +16514,6 @@ "fullName": "", "functionType": "ActionWithOperator", "getterName": "VerticalSpeed", - "group": "First person camera mouse mapper configuration", "name": "SetVerticalSpeed", "sentence": "", "events": [ @@ -16559,7 +16594,6 @@ "fullName": "", "functionType": "ActionWithOperator", "getterName": "VerticalAngleMin", - "group": "First person camera mouse mapper configuration", "name": "SetVerticalAngleMin", "sentence": "", "events": [ @@ -16640,7 +16674,6 @@ "fullName": "", "functionType": "ActionWithOperator", "getterName": "VerticalAngleMax", - "group": "First person camera mouse mapper configuration", "name": "SetVerticalAngleMax", "sentence": "", "events": [ @@ -16721,7 +16754,6 @@ "fullName": "", "functionType": "ActionWithOperator", "getterName": "OffsetZ", - "group": "First person camera mouse mapper configuration", "name": "SetOffsetZ", "sentence": "", "events": [ @@ -16758,57 +16790,6 @@ "objectGroups": [] } ], - "eventsFunctionsFolderStructure": { - "folderName": "__ROOT", - "children": [ - { - "functionName": "doStepPreEvents" - }, - { - "folderName": "Layers and cameras", - "children": [ - { - "functionName": "LookFromObjectEyes" - } - ] - }, - { - "folderName": "First person camera mouse mapper configuration", - "children": [ - { - "functionName": "HorizontalSpeed" - }, - { - "functionName": "SetHorizontalSpeed" - }, - { - "functionName": "VerticalSpeed" - }, - { - "functionName": "SetVerticalSpeed" - }, - { - "functionName": "VerticalAngleMin" - }, - { - "functionName": "SetVerticalAngleMin" - }, - { - "functionName": "VerticalAngleMax" - }, - { - "functionName": "SetVerticalAngleMax" - }, - { - "functionName": "OffsetZ" - }, - { - "functionName": "SetOffsetZ" - } - ] - } - ] - }, "propertyDescriptors": [ { "value": "", @@ -16862,32 +16843,7 @@ "name": "ShouldLock" } ], - "propertiesFolderStructure": { - "folderName": "__ROOT", - "children": [ - { - "propertyName": "Object3D" - }, - { - "propertyName": "HorizontalSpeed" - }, - { - "propertyName": "VerticalSpeed" - }, - { - "propertyName": "VerticalAngleMin" - }, - { - "propertyName": "VerticalAngleMax" - }, - { - "propertyName": "OffsetZ" - }, - { - "propertyName": "ShouldLock" - } - ] - } + "sharedPropertyDescriptors": [] } ], "eventsBasedObjects": [] diff --git a/examples/starting-3d-grand-theft-auto/starting-3d-grand-theft-auto.json b/examples/starting-3d-grand-theft-auto/starting-3d-grand-theft-auto.json index 6352a1a8a..aea4d69ca 100644 --- a/examples/starting-3d-grand-theft-auto/starting-3d-grand-theft-auto.json +++ b/examples/starting-3d-grand-theft-auto/starting-3d-grand-theft-auto.json @@ -1965,6 +1965,51 @@ "source": "", "type": "BuiltinCommonInstructions::Group", "events": [ + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Start with touch controls on touchscreens." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SceneJustBegins" + }, + "parameters": [ + "" + ] + }, + { + "type": { + "value": "SystemInfo::HasTouchScreen" + }, + "parameters": [ + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteToggleSwitch::SpriteToggleSwitch::SetChecked" + }, + "parameters": [ + "ControlsToggle", + "yes", + "" + ] + } + ] + }, { "folded": true, "type": "BuiltinCommonInstructions::Standard", @@ -3196,18 +3241,11 @@ "conditions": [ { "type": { - "value": "MouseButtonFromTextPressed" + "value": "HasAnyTouchOrMouseStarted" }, "parameters": [ - "", - "\"Left\"" + "" ] - }, - { - "type": { - "value": "BuiltinCommonInstructions::Once" - }, - "parameters": [] } ], "actions": [], @@ -3228,17 +3266,6 @@ "" ] }, - { - "type": { - "inverted": true, - "value": "SpriteMultitouchJoystick::MultitouchButton::IsPressed" - }, - "parameters": [ - "JumpButton", - "MultitouchButton", - "" - ] - }, { "type": { "inverted": true, @@ -18783,7 +18810,6 @@ { "author": "PANDAKO-GitHub", "category": "Input", - "dimension": "", "extensionNamespace": "", "fullName": "Mouse Pointer Lock", "gdevelopVersion": ">=5.5.222", @@ -18792,7 +18818,7 @@ "name": "MousePointerLock", "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/Line Hero Pack/Master/SVG/Virtual Reality/Virtual Reality_360_rotate_vr_movement.svg", "shortDescription": "Lock and hide mouse pointer for unlimited movement (e.g., FPS mouse look).", - "version": "0.3.1", + "version": "0.3.2", "description": [ "This behavior removes the limit on the distance the mouse can move and hides the cursor.", "", @@ -18840,7 +18866,7 @@ { "name": "TouchSpeedFactor", "type": "number", - "value": 4 + "value": 2 } ], "eventsFunctions": [ @@ -19088,16 +19114,46 @@ ] }, { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "const { handler } = gdjs._MousePointerLockExtension;\r", - "\r", - "handler.requestPointerLock();\r", - "" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Fingers are followed instead of locking the pointer, because mobile browsers give tiny pointer movements." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "<", + "2" + ] + } ], - "parameterObjects": "", - "useStrict": true, - "eventsSheetExpanded": false + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const { handler } = gdjs._MousePointerLockExtension;\r", + "\r", + "handler.requestPointerLock();\r", + "" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ] } ], "parameters": [], @@ -19280,6 +19336,31 @@ ] } ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + ">=", + "2" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] } ], "parameters": [], @@ -19561,68 +19642,12 @@ "objectGroups": [] } ], - "eventsFunctionsFolderStructure": { - "folderName": "__ROOT", - "children": [ - { - "functionName": "onFirstSceneLoaded" - }, - { - "functionName": "onScenePostEvents" - }, - { - "functionName": "RequestPointerLock" - }, - { - "functionName": "ExitPointerLock" - }, - { - "functionName": "isPointerLocked" - }, - { - "functionName": "isPointerActuallyLocked" - }, - { - "functionName": "isEmulatingPointerLock" - }, - { - "functionName": "IsMoving" - }, - { - "functionName": "MovementX" - }, - { - "functionName": "SetMovementX" - }, - { - "functionName": "MovementY" - }, - { - "functionName": "SetMovementY" - }, - { - "functionName": "TouchX" - }, - { - "functionName": "TouchY" - }, - { - "functionName": "TouchSpeedFactor" - }, - { - "functionName": "SetTouchSpeedFactor" - } - ] - }, "eventsBasedBehaviors": [ { "description": "Control camera rotations with a mouse.", "fullName": "First person camera mouse mapper", - "helpPath": "", - "iconUrl": "", "name": "FirstPersonPointerMapper", "objectType": "", - "previewIconUrl": "", "eventsFunctions": [ { "fullName": "", @@ -19642,6 +19667,18 @@ }, "comment": "TODO It's probably a bad idea to rotate the object around Y." }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Both rotations are relative to the screen height because the field of view is vertical. This way, the speed doesn't change with the screen ratio." + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ @@ -19663,7 +19700,7 @@ "parameters": [ "Object", "+", - "MousePointerLock::MovementX() * HorizontalSpeed / SceneWindowWidth()" + "MousePointerLock::MovementX() * HorizontalSpeed / (SceneWindowHeight() * 16 / 9)" ] }, { @@ -19897,7 +19934,6 @@ "fullName": "", "functionType": "ActionWithOperator", "getterName": "HorizontalSpeed", - "group": "First person camera mouse mapper configuration", "name": "SetHorizontalSpeed", "sentence": "", "events": [ @@ -19978,7 +20014,6 @@ "fullName": "", "functionType": "ActionWithOperator", "getterName": "VerticalSpeed", - "group": "First person camera mouse mapper configuration", "name": "SetVerticalSpeed", "sentence": "", "events": [ @@ -20059,7 +20094,6 @@ "fullName": "", "functionType": "ActionWithOperator", "getterName": "VerticalAngleMin", - "group": "First person camera mouse mapper configuration", "name": "SetVerticalAngleMin", "sentence": "", "events": [ @@ -20140,7 +20174,6 @@ "fullName": "", "functionType": "ActionWithOperator", "getterName": "VerticalAngleMax", - "group": "First person camera mouse mapper configuration", "name": "SetVerticalAngleMax", "sentence": "", "events": [ @@ -20221,7 +20254,6 @@ "fullName": "", "functionType": "ActionWithOperator", "getterName": "OffsetZ", - "group": "First person camera mouse mapper configuration", "name": "SetOffsetZ", "sentence": "", "events": [ @@ -20258,57 +20290,6 @@ "objectGroups": [] } ], - "eventsFunctionsFolderStructure": { - "folderName": "__ROOT", - "children": [ - { - "functionName": "doStepPreEvents" - }, - { - "folderName": "Layers and cameras", - "children": [ - { - "functionName": "LookFromObjectEyes" - } - ] - }, - { - "folderName": "First person camera mouse mapper configuration", - "children": [ - { - "functionName": "HorizontalSpeed" - }, - { - "functionName": "SetHorizontalSpeed" - }, - { - "functionName": "VerticalSpeed" - }, - { - "functionName": "SetVerticalSpeed" - }, - { - "functionName": "VerticalAngleMin" - }, - { - "functionName": "SetVerticalAngleMin" - }, - { - "functionName": "VerticalAngleMax" - }, - { - "functionName": "SetVerticalAngleMax" - }, - { - "functionName": "OffsetZ" - }, - { - "functionName": "SetOffsetZ" - } - ] - } - ] - }, "propertyDescriptors": [ { "value": "", @@ -20362,32 +20343,7 @@ "name": "ShouldLock" } ], - "propertiesFolderStructure": { - "folderName": "__ROOT", - "children": [ - { - "propertyName": "Object3D" - }, - { - "propertyName": "HorizontalSpeed" - }, - { - "propertyName": "VerticalSpeed" - }, - { - "propertyName": "VerticalAngleMin" - }, - { - "propertyName": "VerticalAngleMax" - }, - { - "propertyName": "OffsetZ" - }, - { - "propertyName": "ShouldLock" - } - ] - } + "sharedPropertyDescriptors": [] } ], "eventsBasedObjects": [] diff --git a/examples/starting-expanded-3D-platformer/starting-expanded-3D-platformer.json b/examples/starting-expanded-3D-platformer/starting-expanded-3D-platformer.json index 9a72a2bb8..23f2ced35 100644 --- a/examples/starting-expanded-3D-platformer/starting-expanded-3D-platformer.json +++ b/examples/starting-expanded-3D-platformer/starting-expanded-3D-platformer.json @@ -2957,6 +2957,51 @@ "source": "", "type": "BuiltinCommonInstructions::Group", "events": [ + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Start with touch controls on touchscreens." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SceneJustBegins" + }, + "parameters": [ + "" + ] + }, + { + "type": { + "value": "SystemInfo::HasTouchScreen" + }, + "parameters": [ + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteToggleSwitch::SpriteToggleSwitch::SetChecked" + }, + "parameters": [ + "ControlsToggle", + "yes", + "" + ] + } + ] + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ @@ -3503,18 +3548,11 @@ "conditions": [ { "type": { - "value": "MouseButtonFromTextPressed" + "value": "HasAnyTouchOrMouseStarted" }, "parameters": [ - "", - "\"Left\"" + "" ] - }, - { - "type": { - "value": "BuiltinCommonInstructions::Once" - }, - "parameters": [] } ], "actions": [], @@ -3533,17 +3571,6 @@ "\"Left\"", "" ] - }, - { - "type": { - "inverted": true, - "value": "SpriteMultitouchJoystick::MultitouchButton::IsPressed" - }, - "parameters": [ - "JumpButton", - "MultitouchButton", - "" - ] } ], "actions": [ @@ -17328,7 +17355,7 @@ "name": "MousePointerLock", "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/Line Hero Pack/Master/SVG/Virtual Reality/Virtual Reality_360_rotate_vr_movement.svg", "shortDescription": "Lock and hide mouse pointer for unlimited movement (e.g., FPS mouse look).", - "version": "0.3.1", + "version": "0.3.2", "description": [ "This behavior removes the limit on the distance the mouse can move and hides the cursor.", "", @@ -17376,7 +17403,7 @@ { "name": "TouchSpeedFactor", "type": "number", - "value": 4 + "value": 2 } ], "eventsFunctions": [ @@ -17624,16 +17651,46 @@ ] }, { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "const { handler } = gdjs._MousePointerLockExtension;\r", - "\r", - "handler.requestPointerLock();\r", - "" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Fingers are followed instead of locking the pointer, because mobile browsers give tiny pointer movements." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "<", + "2" + ] + } ], - "parameterObjects": "", - "useStrict": true, - "eventsSheetExpanded": false + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const { handler } = gdjs._MousePointerLockExtension;\r", + "\r", + "handler.requestPointerLock();\r", + "" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ] } ], "parameters": [], @@ -17816,6 +17873,31 @@ ] } ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + ">=", + "2" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] } ], "parameters": [], @@ -18122,6 +18204,18 @@ }, "comment": "TODO It's probably a bad idea to rotate the object around Y." }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Both rotations are relative to the screen height because the field of view is vertical. This way, the speed doesn't change with the screen ratio." + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ @@ -18143,7 +18237,7 @@ "parameters": [ "Object", "+", - "MousePointerLock::MovementX() * HorizontalSpeed / SceneWindowWidth()" + "MousePointerLock::MovementX() * HorizontalSpeed / (SceneWindowHeight() * 16 / 9)" ] }, { diff --git a/examples/starting-expanded-3d-grand-theft-auto/starting-expanded-3d-grand-theft-auto.json b/examples/starting-expanded-3d-grand-theft-auto/starting-expanded-3d-grand-theft-auto.json index 6181db416..b1838de62 100644 --- a/examples/starting-expanded-3d-grand-theft-auto/starting-expanded-3d-grand-theft-auto.json +++ b/examples/starting-expanded-3d-grand-theft-auto/starting-expanded-3d-grand-theft-auto.json @@ -4719,6 +4719,51 @@ "source": "", "type": "BuiltinCommonInstructions::Group", "events": [ + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Start with touch controls on touchscreens." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SceneJustBegins" + }, + "parameters": [ + "" + ] + }, + { + "type": { + "value": "SystemInfo::HasTouchScreen" + }, + "parameters": [ + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteToggleSwitch::SpriteToggleSwitch::SetChecked" + }, + "parameters": [ + "ControlsToggle", + "yes", + "" + ] + } + ] + }, { "folded": false, "type": "BuiltinCommonInstructions::Standard", @@ -5950,18 +5995,11 @@ "conditions": [ { "type": { - "value": "MouseButtonFromTextPressed" + "value": "HasAnyTouchOrMouseStarted" }, "parameters": [ - "", - "\"Left\"" + "" ] - }, - { - "type": { - "value": "BuiltinCommonInstructions::Once" - }, - "parameters": [] } ], "actions": [], @@ -5982,17 +6020,6 @@ "" ] }, - { - "type": { - "inverted": true, - "value": "SpriteMultitouchJoystick::MultitouchButton::IsPressed" - }, - "parameters": [ - "JumpButton", - "MultitouchButton", - "" - ] - }, { "type": { "inverted": true, @@ -22040,7 +22067,6 @@ { "author": "PANDAKO-GitHub", "category": "Input", - "dimension": "", "extensionNamespace": "", "fullName": "Mouse Pointer Lock", "gdevelopVersion": ">=5.5.222", @@ -22049,7 +22075,7 @@ "name": "MousePointerLock", "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/Line Hero Pack/Master/SVG/Virtual Reality/Virtual Reality_360_rotate_vr_movement.svg", "shortDescription": "Lock and hide mouse pointer for unlimited movement (e.g., FPS mouse look).", - "version": "0.3.1", + "version": "0.3.2", "description": [ "This behavior removes the limit on the distance the mouse can move and hides the cursor.", "", @@ -22097,7 +22123,7 @@ { "name": "TouchSpeedFactor", "type": "number", - "value": 4 + "value": 2 } ], "eventsFunctions": [ @@ -22345,16 +22371,46 @@ ] }, { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "const { handler } = gdjs._MousePointerLockExtension;\r", - "\r", - "handler.requestPointerLock();\r", - "" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Fingers are followed instead of locking the pointer, because mobile browsers give tiny pointer movements." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "<", + "2" + ] + } ], - "parameterObjects": "", - "useStrict": true, - "eventsSheetExpanded": false + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const { handler } = gdjs._MousePointerLockExtension;\r", + "\r", + "handler.requestPointerLock();\r", + "" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ] } ], "parameters": [], @@ -22537,6 +22593,31 @@ ] } ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + ">=", + "2" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] } ], "parameters": [], @@ -22818,68 +22899,12 @@ "objectGroups": [] } ], - "eventsFunctionsFolderStructure": { - "folderName": "__ROOT", - "children": [ - { - "functionName": "onFirstSceneLoaded" - }, - { - "functionName": "onScenePostEvents" - }, - { - "functionName": "RequestPointerLock" - }, - { - "functionName": "ExitPointerLock" - }, - { - "functionName": "isPointerLocked" - }, - { - "functionName": "isPointerActuallyLocked" - }, - { - "functionName": "isEmulatingPointerLock" - }, - { - "functionName": "IsMoving" - }, - { - "functionName": "MovementX" - }, - { - "functionName": "SetMovementX" - }, - { - "functionName": "MovementY" - }, - { - "functionName": "SetMovementY" - }, - { - "functionName": "TouchX" - }, - { - "functionName": "TouchY" - }, - { - "functionName": "TouchSpeedFactor" - }, - { - "functionName": "SetTouchSpeedFactor" - } - ] - }, "eventsBasedBehaviors": [ { "description": "Control camera rotations with a mouse.", "fullName": "First person camera mouse mapper", - "helpPath": "", - "iconUrl": "", "name": "FirstPersonPointerMapper", "objectType": "", - "previewIconUrl": "", "eventsFunctions": [ { "fullName": "", @@ -22899,6 +22924,18 @@ }, "comment": "TODO It's probably a bad idea to rotate the object around Y." }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Both rotations are relative to the screen height because the field of view is vertical. This way, the speed doesn't change with the screen ratio." + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ @@ -22920,7 +22957,7 @@ "parameters": [ "Object", "+", - "MousePointerLock::MovementX() * HorizontalSpeed / SceneWindowWidth()" + "MousePointerLock::MovementX() * HorizontalSpeed / (SceneWindowHeight() * 16 / 9)" ] }, { @@ -23154,7 +23191,6 @@ "fullName": "", "functionType": "ActionWithOperator", "getterName": "HorizontalSpeed", - "group": "First person camera mouse mapper configuration", "name": "SetHorizontalSpeed", "sentence": "", "events": [ @@ -23235,7 +23271,6 @@ "fullName": "", "functionType": "ActionWithOperator", "getterName": "VerticalSpeed", - "group": "First person camera mouse mapper configuration", "name": "SetVerticalSpeed", "sentence": "", "events": [ @@ -23316,7 +23351,6 @@ "fullName": "", "functionType": "ActionWithOperator", "getterName": "VerticalAngleMin", - "group": "First person camera mouse mapper configuration", "name": "SetVerticalAngleMin", "sentence": "", "events": [ @@ -23397,7 +23431,6 @@ "fullName": "", "functionType": "ActionWithOperator", "getterName": "VerticalAngleMax", - "group": "First person camera mouse mapper configuration", "name": "SetVerticalAngleMax", "sentence": "", "events": [ @@ -23478,7 +23511,6 @@ "fullName": "", "functionType": "ActionWithOperator", "getterName": "OffsetZ", - "group": "First person camera mouse mapper configuration", "name": "SetOffsetZ", "sentence": "", "events": [ @@ -23515,57 +23547,6 @@ "objectGroups": [] } ], - "eventsFunctionsFolderStructure": { - "folderName": "__ROOT", - "children": [ - { - "functionName": "doStepPreEvents" - }, - { - "folderName": "Layers and cameras", - "children": [ - { - "functionName": "LookFromObjectEyes" - } - ] - }, - { - "folderName": "First person camera mouse mapper configuration", - "children": [ - { - "functionName": "HorizontalSpeed" - }, - { - "functionName": "SetHorizontalSpeed" - }, - { - "functionName": "VerticalSpeed" - }, - { - "functionName": "SetVerticalSpeed" - }, - { - "functionName": "VerticalAngleMin" - }, - { - "functionName": "SetVerticalAngleMin" - }, - { - "functionName": "VerticalAngleMax" - }, - { - "functionName": "SetVerticalAngleMax" - }, - { - "functionName": "OffsetZ" - }, - { - "functionName": "SetOffsetZ" - } - ] - } - ] - }, "propertyDescriptors": [ { "value": "", @@ -23619,32 +23600,7 @@ "name": "ShouldLock" } ], - "propertiesFolderStructure": { - "folderName": "__ROOT", - "children": [ - { - "propertyName": "Object3D" - }, - { - "propertyName": "HorizontalSpeed" - }, - { - "propertyName": "VerticalSpeed" - }, - { - "propertyName": "VerticalAngleMin" - }, - { - "propertyName": "VerticalAngleMax" - }, - { - "propertyName": "OffsetZ" - }, - { - "propertyName": "ShouldLock" - } - ] - } + "sharedPropertyDescriptors": [] } ], "eventsBasedObjects": [] diff --git a/examples/starting-expanded-3d-house-horror/starting-expanded-3d-house-horror.json b/examples/starting-expanded-3d-house-horror/starting-expanded-3d-house-horror.json index f0ef1a37c..fa33d5eb2 100644 --- a/examples/starting-expanded-3d-house-horror/starting-expanded-3d-house-horror.json +++ b/examples/starting-expanded-3d-house-horror/starting-expanded-3d-house-horror.json @@ -9165,6 +9165,51 @@ "source": "", "type": "BuiltinCommonInstructions::Group", "events": [ + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Start with touch controls on touchscreens." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SceneJustBegins" + }, + "parameters": [ + "" + ] + }, + { + "type": { + "value": "SystemInfo::HasTouchScreen" + }, + "parameters": [ + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteToggleSwitch::SpriteToggleSwitch::SetChecked" + }, + "parameters": [ + "ControlsToggle", + "yes", + "" + ] + } + ] + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ @@ -9371,18 +9416,11 @@ "conditions": [ { "type": { - "value": "MouseButtonFromTextPressed" + "value": "HasAnyTouchOrMouseStarted" }, "parameters": [ - "", - "\"Left\"" + "" ] - }, - { - "type": { - "value": "BuiltinCommonInstructions::Once" - }, - "parameters": [] } ], "actions": [], @@ -9401,17 +9439,6 @@ "\"Left\"", "" ] - }, - { - "type": { - "inverted": true, - "value": "SpriteMultitouchJoystick::MultitouchButton::IsPressed" - }, - "parameters": [ - "JumpButton", - "MultitouchButton", - "" - ] } ], "actions": [ @@ -19543,7 +19570,7 @@ "name": "MousePointerLock", "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/Line Hero Pack/Master/SVG/Virtual Reality/Virtual Reality_360_rotate_vr_movement.svg", "shortDescription": "Lock and hide mouse pointer for unlimited movement (e.g., FPS mouse look).", - "version": "0.3.1", + "version": "0.3.2", "description": [ "This behavior removes the limit on the distance the mouse can move and hides the cursor.", "", @@ -19591,7 +19618,7 @@ { "name": "TouchSpeedFactor", "type": "number", - "value": 4 + "value": 2 } ], "eventsFunctions": [ @@ -19839,16 +19866,46 @@ ] }, { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "const { handler } = gdjs._MousePointerLockExtension;\r", - "\r", - "handler.requestPointerLock();\r", - "" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Fingers are followed instead of locking the pointer, because mobile browsers give tiny pointer movements." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "<", + "2" + ] + } ], - "parameterObjects": "", - "useStrict": true, - "eventsSheetExpanded": false + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const { handler } = gdjs._MousePointerLockExtension;\r", + "\r", + "handler.requestPointerLock();\r", + "" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ] } ], "parameters": [], @@ -20031,6 +20088,31 @@ ] } ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + ">=", + "2" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] } ], "parameters": [], @@ -20337,6 +20419,18 @@ }, "comment": "TODO It's probably a bad idea to rotate the object around Y." }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Both rotations are relative to the screen height because the field of view is vertical. This way, the speed doesn't change with the screen ratio." + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ @@ -20358,7 +20452,7 @@ "parameters": [ "Object", "+", - "MousePointerLock::MovementX() * HorizontalSpeed / SceneWindowWidth()" + "MousePointerLock::MovementX() * HorizontalSpeed / (SceneWindowHeight() * 16 / 9)" ] }, { diff --git a/examples/starting-expanded-first-person-farming/starting-expanded-first-person-farming.json b/examples/starting-expanded-first-person-farming/starting-expanded-first-person-farming.json index 7db116656..c741d7c97 100644 --- a/examples/starting-expanded-first-person-farming/starting-expanded-first-person-farming.json +++ b/examples/starting-expanded-first-person-farming/starting-expanded-first-person-farming.json @@ -5287,6 +5287,51 @@ "source": "", "type": "BuiltinCommonInstructions::Group", "events": [ + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Start with touch controls on touchscreens." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SceneJustBegins" + }, + "parameters": [ + "" + ] + }, + { + "type": { + "value": "SystemInfo::HasTouchScreen" + }, + "parameters": [ + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteToggleSwitch::SpriteToggleSwitch::SetChecked" + }, + "parameters": [ + "ControlsToggle", + "yes", + "" + ] + } + ] + }, { "folded": false, "type": "BuiltinCommonInstructions::Standard", @@ -5537,18 +5582,11 @@ "conditions": [ { "type": { - "value": "MouseButtonFromTextPressed" + "value": "HasAnyTouchOrMouseStarted" }, "parameters": [ - "", - "\"Left\"" + "" ] - }, - { - "type": { - "value": "BuiltinCommonInstructions::Once" - }, - "parameters": [] } ], "actions": [], @@ -5569,17 +5607,6 @@ "" ] }, - { - "type": { - "inverted": true, - "value": "SpriteMultitouchJoystick::MultitouchButton::IsPressed" - }, - "parameters": [ - "JumpButton", - "MultitouchButton", - "" - ] - }, { "type": { "inverted": true, @@ -17253,7 +17280,7 @@ "name": "MousePointerLock", "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/Line Hero Pack/Master/SVG/Virtual Reality/Virtual Reality_360_rotate_vr_movement.svg", "shortDescription": "Lock and hide mouse pointer for unlimited movement (e.g., FPS mouse look).", - "version": "0.3.1", + "version": "0.3.2", "description": [ "This behavior removes the limit on the distance the mouse can move and hides the cursor.", "", @@ -17301,7 +17328,7 @@ { "name": "TouchSpeedFactor", "type": "number", - "value": 4 + "value": 2 } ], "eventsFunctions": [ @@ -17549,16 +17576,46 @@ ] }, { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "const { handler } = gdjs._MousePointerLockExtension;\r", - "\r", - "handler.requestPointerLock();\r", - "" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Fingers are followed instead of locking the pointer, because mobile browsers give tiny pointer movements." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "<", + "2" + ] + } ], - "parameterObjects": "", - "useStrict": true, - "eventsSheetExpanded": false + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const { handler } = gdjs._MousePointerLockExtension;\r", + "\r", + "handler.requestPointerLock();\r", + "" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ] } ], "parameters": [], @@ -17741,6 +17798,31 @@ ] } ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + ">=", + "2" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] } ], "parameters": [], @@ -18047,6 +18129,18 @@ }, "comment": "TODO It's probably a bad idea to rotate the object around Y." }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Both rotations are relative to the screen height because the field of view is vertical. This way, the speed doesn't change with the screen ratio." + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ @@ -18068,7 +18162,7 @@ "parameters": [ "Object", "+", - "MousePointerLock::MovementX() * HorizontalSpeed / SceneWindowWidth()" + "MousePointerLock::MovementX() * HorizontalSpeed / (SceneWindowHeight() * 16 / 9)" ] }, { diff --git a/examples/starting-expanded-first-person-horror/starting-expanded-first-person-horror.json b/examples/starting-expanded-first-person-horror/starting-expanded-first-person-horror.json index 1a13c3121..7b34b604a 100644 --- a/examples/starting-expanded-first-person-horror/starting-expanded-first-person-horror.json +++ b/examples/starting-expanded-first-person-horror/starting-expanded-first-person-horror.json @@ -2796,6 +2796,51 @@ "source": "", "type": "BuiltinCommonInstructions::Group", "events": [ + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Start with touch controls on touchscreens." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SceneJustBegins" + }, + "parameters": [ + "" + ] + }, + { + "type": { + "value": "SystemInfo::HasTouchScreen" + }, + "parameters": [ + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteToggleSwitch::SpriteToggleSwitch::SetChecked" + }, + "parameters": [ + "ControlsToggle", + "yes", + "" + ] + } + ] + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ @@ -3002,18 +3047,11 @@ "conditions": [ { "type": { - "value": "MouseButtonFromTextPressed" + "value": "HasAnyTouchOrMouseStarted" }, "parameters": [ - "", - "\"Left\"" + "" ] - }, - { - "type": { - "value": "BuiltinCommonInstructions::Once" - }, - "parameters": [] } ], "actions": [], @@ -3032,17 +3070,6 @@ "\"Left\"", "" ] - }, - { - "type": { - "inverted": true, - "value": "SpriteMultitouchJoystick::MultitouchButton::IsPressed" - }, - "parameters": [ - "JumpButton", - "MultitouchButton", - "" - ] } ], "actions": [ @@ -12589,7 +12616,7 @@ "name": "MousePointerLock", "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/Line Hero Pack/Master/SVG/Virtual Reality/Virtual Reality_360_rotate_vr_movement.svg", "shortDescription": "Lock and hide mouse pointer for unlimited movement (e.g., FPS mouse look).", - "version": "0.3.1", + "version": "0.3.2", "description": [ "This behavior removes the limit on the distance the mouse can move and hides the cursor.", "", @@ -12637,7 +12664,7 @@ { "name": "TouchSpeedFactor", "type": "number", - "value": 4 + "value": 2 } ], "eventsFunctions": [ @@ -12885,16 +12912,46 @@ ] }, { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "const { handler } = gdjs._MousePointerLockExtension;\r", - "\r", - "handler.requestPointerLock();\r", - "" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Fingers are followed instead of locking the pointer, because mobile browsers give tiny pointer movements." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "<", + "2" + ] + } ], - "parameterObjects": "", - "useStrict": true, - "eventsSheetExpanded": false + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const { handler } = gdjs._MousePointerLockExtension;\r", + "\r", + "handler.requestPointerLock();\r", + "" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ] } ], "parameters": [], @@ -13077,6 +13134,31 @@ ] } ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + ">=", + "2" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] } ], "parameters": [], @@ -13383,6 +13465,18 @@ }, "comment": "TODO It's probably a bad idea to rotate the object around Y." }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Both rotations are relative to the screen height because the field of view is vertical. This way, the speed doesn't change with the screen ratio." + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ @@ -13404,7 +13498,7 @@ "parameters": [ "Object", "+", - "MousePointerLock::MovementX() * HorizontalSpeed / SceneWindowWidth()" + "MousePointerLock::MovementX() * HorizontalSpeed / (SceneWindowHeight() * 16 / 9)" ] }, { diff --git a/examples/starting-expanded-first-person-shooter-enemies/starting-expanded-first-person-shooter-enemies.json b/examples/starting-expanded-first-person-shooter-enemies/starting-expanded-first-person-shooter-enemies.json index 53d2cc9f4..17da43339 100644 --- a/examples/starting-expanded-first-person-shooter-enemies/starting-expanded-first-person-shooter-enemies.json +++ b/examples/starting-expanded-first-person-shooter-enemies/starting-expanded-first-person-shooter-enemies.json @@ -496,6 +496,30 @@ "persistentUuid": "f1651ed6-c467-4174-a82a-ab153372b2c5", "type": "string", "value": "Keyboard" + }, + { + "name": "TapTouchId", + "persistentUuid": "bc4856a7-5c77-49ba-98c1-d01e6cfb9863", + "type": "number", + "value": 0 + }, + { + "name": "TapStartX", + "persistentUuid": "30e1c901-cac6-4261-b144-023e3c30d658", + "type": "number", + "value": 0 + }, + { + "name": "TapStartY", + "persistentUuid": "f30830c0-5c21-40d3-b7ec-b21e3c9139ee", + "type": "number", + "value": 0 + }, + { + "name": "TapShot", + "persistentUuid": "059bff17-882a-4cd5-9b93-89789610eb28", + "type": "boolean", + "value": false } ], "instances": [ @@ -3302,6 +3326,125 @@ "source": "", "type": "BuiltinCommonInstructions::Group", "events": [ + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Keep shooting while the button is held, even when the finger drags away from it to aim." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SceneJustBegins" + }, + "parameters": [ + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "ResetTimer" + }, + "parameters": [ + "", + "\"ShootCooldown\"" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "A quick tap anywhere outside the buttons also shoots. Dragging only aims." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "HasTouchEnded" + }, + "parameters": [ + "", + "TapTouchId" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "CompareTimer" + }, + "parameters": [ + "", + "\"TapTouch\"", + "<", + "0.25" + ] + }, + { + "type": { + "value": "BuiltinCommonInstructions::CompareNumbers" + }, + "parameters": [ + "DistanceBetweenPositions(TapStartX, TapStartY, TouchX(TapTouchId, \"MobileControls\", 0), TouchY(TapTouchId, \"MobileControls\", 0))", + "<", + "30" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "TapShot", + "True", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TapTouchId", + "=", + "0" + ] + } + ] + } + ] + }, { "folded": false, "type": "BuiltinCommonInstructions::Standard", @@ -3369,11 +3512,57 @@ }, { "type": { - "value": "ButtonStates::ButtonFSM::IsPressed" + "value": "BuiltinCommonInstructions::Or" + }, + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "ButtonStates::ButtonFSM::IsPressed" + }, + "parameters": [ + "ShootButton", + "ButtonFSM", + "" + ] + }, + { + "type": { + "value": "ButtonStates::ButtonFSM::IsPressedOutside" + }, + "parameters": [ + "ShootButton", + "ButtonFSM", + "" + ] + } + ] + } + ] + }, + { + "type": { + "value": "BuiltinCommonInstructions::And" + }, + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "StringVariable" }, "parameters": [ - "ShootButton", - "ButtonFSM", + "ControlKind", + "=", + "\"Touch\"" + ] + }, + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "TapShot", + "True", "" ] } @@ -3383,12 +3572,26 @@ }, { "type": { - "value": "BuiltinCommonInstructions::Once" + "value": "CompareTimer" }, - "parameters": [] + "parameters": [ + "", + "\"ShootCooldown\"", + ">=", + "0.2" + ] } ], "actions": [ + { + "type": { + "value": "ResetTimer" + }, + "parameters": [ + "", + "\"ShootCooldown\"" + ] + }, { "type": { "value": "PlaySound" @@ -3563,6 +3766,22 @@ ] } ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "TapShot", + "False", + "" + ] + } + ] } ], "parameters": [] @@ -4134,6 +4353,51 @@ "source": "", "type": "BuiltinCommonInstructions::Group", "events": [ + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Start with touch controls on touchscreens." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SceneJustBegins" + }, + "parameters": [ + "" + ] + }, + { + "type": { + "value": "SystemInfo::HasTouchScreen" + }, + "parameters": [ + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteToggleSwitch::SpriteToggleSwitch::SetChecked" + }, + "parameters": [ + "ControlsToggle", + "yes", + "" + ] + } + ] + }, { "folded": false, "type": "BuiltinCommonInstructions::Standard", @@ -4385,18 +4649,11 @@ "conditions": [ { "type": { - "value": "MouseButtonFromTextPressed" + "value": "HasAnyTouchOrMouseStarted" }, "parameters": [ - "", - "\"Left\"" + "" ] - }, - { - "type": { - "value": "BuiltinCommonInstructions::Once" - }, - "parameters": [] } ], "actions": [], @@ -4416,28 +4673,6 @@ "\"Left\"", "" ] - }, - { - "type": { - "inverted": true, - "value": "SpriteMultitouchJoystick::MultitouchButton::IsPressed" - }, - "parameters": [ - "JumpButton", - "MultitouchButton", - "" - ] - }, - { - "type": { - "inverted": true, - "value": "ButtonStates::ButtonFSM::IsPressed" - }, - "parameters": [ - "ShootButton", - "ButtonFSM", - "" - ] } ], "actions": [ @@ -4450,6 +4685,76 @@ "" ] } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "SpriteMultitouchJoystick::MultitouchButton::IsPressed" + }, + "parameters": [ + "JumpButton", + "MultitouchButton", + "" + ] + }, + { + "type": { + "inverted": true, + "value": "ButtonStates::ButtonFSM::IsPressed" + }, + "parameters": [ + "ShootButton", + "ButtonFSM", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TapTouchId", + "=", + "StartedTouchOrMouseId(0)" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TapStartX", + "=", + "TouchX(TapTouchId, \"MobileControls\", 0)" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TapStartY", + "=", + "TouchY(TapTouchId, \"MobileControls\", 0)" + ] + }, + { + "type": { + "value": "ResetTimer" + }, + "parameters": [ + "", + "\"TapTouch\"" + ] + } + ] + } ] } ] @@ -14047,7 +14352,7 @@ "name": "MousePointerLock", "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/Line Hero Pack/Master/SVG/Virtual Reality/Virtual Reality_360_rotate_vr_movement.svg", "shortDescription": "Lock and hide mouse pointer for unlimited movement (e.g., FPS mouse look).", - "version": "0.3.1", + "version": "0.3.2", "description": [ "This behavior removes the limit on the distance the mouse can move and hides the cursor.", "", @@ -14095,7 +14400,7 @@ { "name": "TouchSpeedFactor", "type": "number", - "value": 4 + "value": 2 } ], "eventsFunctions": [ @@ -14343,16 +14648,46 @@ ] }, { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "const { handler } = gdjs._MousePointerLockExtension;\r", - "\r", - "handler.requestPointerLock();\r", - "" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Fingers are followed instead of locking the pointer, because mobile browsers give tiny pointer movements." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "<", + "2" + ] + } ], - "parameterObjects": "", - "useStrict": true, - "eventsSheetExpanded": false + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const { handler } = gdjs._MousePointerLockExtension;\r", + "\r", + "handler.requestPointerLock();\r", + "" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ] } ], "parameters": [], @@ -14535,6 +14870,31 @@ ] } ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + ">=", + "2" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] } ], "parameters": [], @@ -14841,6 +15201,18 @@ }, "comment": "TODO It's probably a bad idea to rotate the object around Y." }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Both rotations are relative to the screen height because the field of view is vertical. This way, the speed doesn't change with the screen ratio." + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ @@ -14862,7 +15234,7 @@ "parameters": [ "Object", "+", - "MousePointerLock::MovementX() * HorizontalSpeed / SceneWindowWidth()" + "MousePointerLock::MovementX() * HorizontalSpeed / (SceneWindowHeight() * 16 / 9)" ] }, { diff --git a/examples/starting-expanded-first-person-shooter-horror/starting-expanded-first-person-shooter-horror.json b/examples/starting-expanded-first-person-shooter-horror/starting-expanded-first-person-shooter-horror.json index 789b5b35f..9741ca3ec 100644 --- a/examples/starting-expanded-first-person-shooter-horror/starting-expanded-first-person-shooter-horror.json +++ b/examples/starting-expanded-first-person-shooter-horror/starting-expanded-first-person-shooter-horror.json @@ -500,6 +500,30 @@ "persistentUuid": "f1651ed6-c467-4174-a82a-ab153372b2c5", "type": "string", "value": "Keyboard" + }, + { + "name": "TapTouchId", + "persistentUuid": "5bce4273-e625-4b6e-a223-ebb81131f092", + "type": "number", + "value": 0 + }, + { + "name": "TapStartX", + "persistentUuid": "b0c2a842-b488-4776-a3df-23ca099e4b8f", + "type": "number", + "value": 0 + }, + { + "name": "TapStartY", + "persistentUuid": "e18ff0bb-2dc3-4cdc-bcb6-53097d2d0ecf", + "type": "number", + "value": 0 + }, + { + "name": "TapShot", + "persistentUuid": "1430c50d-6636-4c7e-bcab-645a1d292dc2", + "type": "boolean", + "value": false } ], "instances": [ @@ -3699,6 +3723,125 @@ "source": "", "type": "BuiltinCommonInstructions::Group", "events": [ + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Keep shooting while the button is held, even when the finger drags away from it to aim." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SceneJustBegins" + }, + "parameters": [ + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "ResetTimer" + }, + "parameters": [ + "", + "\"ShootCooldown\"" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "A quick tap anywhere outside the buttons also shoots. Dragging only aims." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "HasTouchEnded" + }, + "parameters": [ + "", + "TapTouchId" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "CompareTimer" + }, + "parameters": [ + "", + "\"TapTouch\"", + "<", + "0.25" + ] + }, + { + "type": { + "value": "BuiltinCommonInstructions::CompareNumbers" + }, + "parameters": [ + "DistanceBetweenPositions(TapStartX, TapStartY, TouchX(TapTouchId, \"MobileControls\", 0), TouchY(TapTouchId, \"MobileControls\", 0))", + "<", + "30" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "TapShot", + "True", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TapTouchId", + "=", + "0" + ] + } + ] + } + ] + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ @@ -3765,11 +3908,57 @@ }, { "type": { - "value": "ButtonStates::ButtonFSM::IsPressed" + "value": "BuiltinCommonInstructions::Or" + }, + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "ButtonStates::ButtonFSM::IsPressed" + }, + "parameters": [ + "ShootButton", + "ButtonFSM", + "" + ] + }, + { + "type": { + "value": "ButtonStates::ButtonFSM::IsPressedOutside" + }, + "parameters": [ + "ShootButton", + "ButtonFSM", + "" + ] + } + ] + } + ] + }, + { + "type": { + "value": "BuiltinCommonInstructions::And" + }, + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "StringVariable" }, "parameters": [ - "ShootButton", - "ButtonFSM", + "ControlKind", + "=", + "\"Touch\"" + ] + }, + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "TapShot", + "True", "" ] } @@ -3779,12 +3968,26 @@ }, { "type": { - "value": "BuiltinCommonInstructions::Once" + "value": "CompareTimer" }, - "parameters": [] + "parameters": [ + "", + "\"ShootCooldown\"", + ">=", + "0.2" + ] } ], "actions": [ + { + "type": { + "value": "ResetTimer" + }, + "parameters": [ + "", + "\"ShootCooldown\"" + ] + }, { "type": { "value": "PlaySound" @@ -3958,6 +4161,22 @@ ] } ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "TapShot", + "False", + "" + ] + } + ] } ], "parameters": [] @@ -4581,6 +4800,51 @@ "source": "", "type": "BuiltinCommonInstructions::Group", "events": [ + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Start with touch controls on touchscreens." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SceneJustBegins" + }, + "parameters": [ + "" + ] + }, + { + "type": { + "value": "SystemInfo::HasTouchScreen" + }, + "parameters": [ + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteToggleSwitch::SpriteToggleSwitch::SetChecked" + }, + "parameters": [ + "ControlsToggle", + "yes", + "" + ] + } + ] + }, { "folded": false, "type": "BuiltinCommonInstructions::Standard", @@ -4832,18 +5096,11 @@ "conditions": [ { "type": { - "value": "MouseButtonFromTextPressed" + "value": "HasAnyTouchOrMouseStarted" }, "parameters": [ - "", - "\"Left\"" + "" ] - }, - { - "type": { - "value": "BuiltinCommonInstructions::Once" - }, - "parameters": [] } ], "actions": [], @@ -4863,28 +5120,6 @@ "\"Left\"", "" ] - }, - { - "type": { - "inverted": true, - "value": "SpriteMultitouchJoystick::MultitouchButton::IsPressed" - }, - "parameters": [ - "JumpButton", - "MultitouchButton", - "" - ] - }, - { - "type": { - "inverted": true, - "value": "ButtonStates::ButtonFSM::IsPressed" - }, - "parameters": [ - "ShootButton", - "ButtonFSM", - "" - ] } ], "actions": [ @@ -4897,6 +5132,76 @@ "" ] } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "SpriteMultitouchJoystick::MultitouchButton::IsPressed" + }, + "parameters": [ + "JumpButton", + "MultitouchButton", + "" + ] + }, + { + "type": { + "inverted": true, + "value": "ButtonStates::ButtonFSM::IsPressed" + }, + "parameters": [ + "ShootButton", + "ButtonFSM", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TapTouchId", + "=", + "StartedTouchOrMouseId(0)" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TapStartX", + "=", + "TouchX(TapTouchId, \"MobileControls\", 0)" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TapStartY", + "=", + "TouchY(TapTouchId, \"MobileControls\", 0)" + ] + }, + { + "type": { + "value": "ResetTimer" + }, + "parameters": [ + "", + "\"TapTouch\"" + ] + } + ] + } ] } ] @@ -14517,7 +14822,7 @@ "name": "MousePointerLock", "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/Line Hero Pack/Master/SVG/Virtual Reality/Virtual Reality_360_rotate_vr_movement.svg", "shortDescription": "Lock and hide mouse pointer for unlimited movement (e.g., FPS mouse look).", - "version": "0.3.1", + "version": "0.3.2", "description": [ "This behavior removes the limit on the distance the mouse can move and hides the cursor.", "", @@ -14565,7 +14870,7 @@ { "name": "TouchSpeedFactor", "type": "number", - "value": 4 + "value": 2 } ], "eventsFunctions": [ @@ -14813,16 +15118,46 @@ ] }, { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "const { handler } = gdjs._MousePointerLockExtension;\r", - "\r", - "handler.requestPointerLock();\r", - "" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Fingers are followed instead of locking the pointer, because mobile browsers give tiny pointer movements." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "<", + "2" + ] + } ], - "parameterObjects": "", - "useStrict": true, - "eventsSheetExpanded": false + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const { handler } = gdjs._MousePointerLockExtension;\r", + "\r", + "handler.requestPointerLock();\r", + "" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ] } ], "parameters": [], @@ -15005,6 +15340,31 @@ ] } ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + ">=", + "2" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] } ], "parameters": [], @@ -15311,6 +15671,18 @@ }, "comment": "TODO It's probably a bad idea to rotate the object around Y." }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Both rotations are relative to the screen height because the field of view is vertical. This way, the speed doesn't change with the screen ratio." + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ @@ -15332,7 +15704,7 @@ "parameters": [ "Object", "+", - "MousePointerLock::MovementX() * HorizontalSpeed / SceneWindowWidth()" + "MousePointerLock::MovementX() * HorizontalSpeed / (SceneWindowHeight() * 16 / 9)" ] }, { diff --git a/examples/starting-expanded-first-person-survival-crafting/starting-expanded-first-person-survival-crafting.json b/examples/starting-expanded-first-person-survival-crafting/starting-expanded-first-person-survival-crafting.json index 06c57aa21..00a46487a 100644 --- a/examples/starting-expanded-first-person-survival-crafting/starting-expanded-first-person-survival-crafting.json +++ b/examples/starting-expanded-first-person-survival-crafting/starting-expanded-first-person-survival-crafting.json @@ -4628,6 +4628,51 @@ "source": "", "type": "BuiltinCommonInstructions::Group", "events": [ + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Start with touch controls on touchscreens." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SceneJustBegins" + }, + "parameters": [ + "" + ] + }, + { + "type": { + "value": "SystemInfo::HasTouchScreen" + }, + "parameters": [ + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteToggleSwitch::SpriteToggleSwitch::SetChecked" + }, + "parameters": [ + "ControlsToggle", + "yes", + "" + ] + } + ] + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ @@ -4870,18 +4915,11 @@ "conditions": [ { "type": { - "value": "MouseButtonFromTextPressed" + "value": "HasAnyTouchOrMouseStarted" }, "parameters": [ - "", - "\"Left\"" + "" ] - }, - { - "type": { - "value": "BuiltinCommonInstructions::Once" - }, - "parameters": [] } ], "actions": [], @@ -4901,17 +4939,6 @@ "" ] }, - { - "type": { - "inverted": true, - "value": "SpriteMultitouchJoystick::MultitouchButton::IsPressed" - }, - "parameters": [ - "JumpButton", - "MultitouchButton", - "" - ] - }, { "type": { "inverted": true, @@ -16174,7 +16201,7 @@ "name": "MousePointerLock", "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/Line Hero Pack/Master/SVG/Virtual Reality/Virtual Reality_360_rotate_vr_movement.svg", "shortDescription": "Lock and hide mouse pointer for unlimited movement (e.g., FPS mouse look).", - "version": "0.3.1", + "version": "0.3.2", "description": [ "This behavior removes the limit on the distance the mouse can move and hides the cursor.", "", @@ -16222,7 +16249,7 @@ { "name": "TouchSpeedFactor", "type": "number", - "value": 4 + "value": 2 } ], "eventsFunctions": [ @@ -16470,16 +16497,46 @@ ] }, { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "const { handler } = gdjs._MousePointerLockExtension;\r", - "\r", - "handler.requestPointerLock();\r", - "" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Fingers are followed instead of locking the pointer, because mobile browsers give tiny pointer movements." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "<", + "2" + ] + } ], - "parameterObjects": "", - "useStrict": true, - "eventsSheetExpanded": false + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const { handler } = gdjs._MousePointerLockExtension;\r", + "\r", + "handler.requestPointerLock();\r", + "" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ] } ], "parameters": [], @@ -16662,6 +16719,31 @@ ] } ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + ">=", + "2" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] } ], "parameters": [], @@ -16968,6 +17050,18 @@ }, "comment": "TODO It's probably a bad idea to rotate the object around Y." }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Both rotations are relative to the screen height because the field of view is vertical. This way, the speed doesn't change with the screen ratio." + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ @@ -16989,7 +17083,7 @@ "parameters": [ "Object", "+", - "MousePointerLock::MovementX() * HorizontalSpeed / SceneWindowWidth()" + "MousePointerLock::MovementX() * HorizontalSpeed / (SceneWindowHeight() * 16 / 9)" ] }, { diff --git a/examples/starting-first-person-farming/starting-first-person-farming.json b/examples/starting-first-person-farming/starting-first-person-farming.json index ef18a3283..dd8dae010 100644 --- a/examples/starting-first-person-farming/starting-first-person-farming.json +++ b/examples/starting-first-person-farming/starting-first-person-farming.json @@ -3622,6 +3622,51 @@ "source": "", "type": "BuiltinCommonInstructions::Group", "events": [ + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Start with touch controls on touchscreens." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SceneJustBegins" + }, + "parameters": [ + "" + ] + }, + { + "type": { + "value": "SystemInfo::HasTouchScreen" + }, + "parameters": [ + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteToggleSwitch::SpriteToggleSwitch::SetChecked" + }, + "parameters": [ + "ControlsToggle", + "yes", + "" + ] + } + ] + }, { "folded": true, "type": "BuiltinCommonInstructions::Standard", @@ -3872,18 +3917,11 @@ "conditions": [ { "type": { - "value": "MouseButtonFromTextPressed" + "value": "HasAnyTouchOrMouseStarted" }, "parameters": [ - "", - "\"Left\"" + "" ] - }, - { - "type": { - "value": "BuiltinCommonInstructions::Once" - }, - "parameters": [] } ], "actions": [], @@ -3904,17 +3942,6 @@ "" ] }, - { - "type": { - "inverted": true, - "value": "SpriteMultitouchJoystick::MultitouchButton::IsPressed" - }, - "parameters": [ - "JumpButton", - "MultitouchButton", - "" - ] - }, { "type": { "inverted": true, @@ -15530,7 +15557,6 @@ { "author": "PANDAKO-GitHub", "category": "Input", - "dimension": "", "extensionNamespace": "", "fullName": "Mouse Pointer Lock", "gdevelopVersion": ">=5.5.222", @@ -15538,8 +15564,8 @@ "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyMy4wLjMsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iSWNvbnMiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB2aWV3Qm94PSIwIDAgMzIgMzIiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDMyIDMyOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8c3R5bGUgdHlwZT0idGV4dC9jc3MiPg0KCS5zdDB7ZmlsbDpub25lO3N0cm9rZTojMDAwMDAwO3N0cm9rZS13aWR0aDoyO3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1saW5lam9pbjpyb3VuZDtzdHJva2UtbWl0ZXJsaW1pdDoxMDt9DQo8L3N0eWxlPg0KPHBvbHlsaW5lIGNsYXNzPSJzdDAiIHBvaW50cz0iMTksMTkgMjQsMTkgMjQsMjQgIi8+DQo8cG9seWxpbmUgY2xhc3M9InN0MCIgcG9pbnRzPSI2LDIzIDExLDIzIDExLDE4ICIvPg0KPHBhdGggY2xhc3M9InN0MCIgZD0iTTI0LDE5LjRjLTAuNywwLjgtMS40LDEuNi0yLjIsMi40Yy03LDctMTUuMywxMC4yLTE4LjUsN3MtMC4xLTExLjUsNy0xOC41czE1LjMtMTAuMiwxOC41LTcNCgljMS40LDEuNCwxLjYsMy42LDAuOCw2LjMiLz4NCjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik0xMSwyMi41Yy0wLjMtMC4yLTAuNS0wLjUtMC44LTAuOGMtNy03LTEwLjItMTUuMy03LTE4LjVzMTEuNS0wLjEsMTguNSw3czEwLjIsMTUuMyw3LDE4LjUNCgljLTEuNywxLjctNC44LDEuNi04LjQsMC4xIi8+DQo8L3N2Zz4NCg==", "name": "MousePointerLock", "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/Line Hero Pack/Master/SVG/Virtual Reality/Virtual Reality_360_rotate_vr_movement.svg", - "shortDescription": "This behavior removes the limit on the distance the mouse can move and hides the cursor.", - "version": "0.3.0", + "shortDescription": "Lock and hide mouse pointer for unlimited movement (e.g., FPS mouse look).", + "version": "0.3.2", "description": [ "This behavior removes the limit on the distance the mouse can move and hides the cursor.", "", @@ -15587,7 +15613,7 @@ { "name": "TouchSpeedFactor", "type": "number", - "value": 4 + "value": 2 } ], "eventsFunctions": [ @@ -15835,16 +15861,46 @@ ] }, { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "const { handler } = gdjs._MousePointerLockExtension;\r", - "\r", - "handler.requestPointerLock();\r", - "" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Fingers are followed instead of locking the pointer, because mobile browsers give tiny pointer movements." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "<", + "2" + ] + } ], - "parameterObjects": "", - "useStrict": true, - "eventsSheetExpanded": false + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const { handler } = gdjs._MousePointerLockExtension;\r", + "\r", + "handler.requestPointerLock();\r", + "" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ] } ], "parameters": [], @@ -15991,7 +16047,7 @@ "functionType": "Condition", "name": "isEmulatingPointerLock", "private": true, - "sentence": "The mouse pointer is lock is emulated", + "sentence": "The mouse pointer lock is emulated", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -16027,6 +16083,31 @@ ] } ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + ">=", + "2" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] } ], "parameters": [], @@ -16308,68 +16389,12 @@ "objectGroups": [] } ], - "eventsFunctionsFolderStructure": { - "folderName": "__ROOT", - "children": [ - { - "functionName": "onFirstSceneLoaded" - }, - { - "functionName": "onScenePostEvents" - }, - { - "functionName": "RequestPointerLock" - }, - { - "functionName": "ExitPointerLock" - }, - { - "functionName": "isPointerLocked" - }, - { - "functionName": "isPointerActuallyLocked" - }, - { - "functionName": "isEmulatingPointerLock" - }, - { - "functionName": "IsMoving" - }, - { - "functionName": "MovementX" - }, - { - "functionName": "SetMovementX" - }, - { - "functionName": "MovementY" - }, - { - "functionName": "SetMovementY" - }, - { - "functionName": "TouchX" - }, - { - "functionName": "TouchY" - }, - { - "functionName": "TouchSpeedFactor" - }, - { - "functionName": "SetTouchSpeedFactor" - } - ] - }, "eventsBasedBehaviors": [ { "description": "Control camera rotations with a mouse.", "fullName": "First person camera mouse mapper", - "helpPath": "", - "iconUrl": "", "name": "FirstPersonPointerMapper", "objectType": "", - "previewIconUrl": "", "eventsFunctions": [ { "fullName": "", @@ -16389,6 +16414,18 @@ }, "comment": "TODO It's probably a bad idea to rotate the object around Y." }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Both rotations are relative to the screen height because the field of view is vertical. This way, the speed doesn't change with the screen ratio." + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ @@ -16410,7 +16447,7 @@ "parameters": [ "Object", "+", - "MousePointerLock::MovementX() * HorizontalSpeed / SceneWindowWidth()" + "MousePointerLock::MovementX() * HorizontalSpeed / (SceneWindowHeight() * 16 / 9)" ] }, { @@ -16644,7 +16681,6 @@ "fullName": "", "functionType": "ActionWithOperator", "getterName": "HorizontalSpeed", - "group": "First person camera mouse mapper configuration", "name": "SetHorizontalSpeed", "sentence": "", "events": [ @@ -16725,7 +16761,6 @@ "fullName": "", "functionType": "ActionWithOperator", "getterName": "VerticalSpeed", - "group": "First person camera mouse mapper configuration", "name": "SetVerticalSpeed", "sentence": "", "events": [ @@ -16806,7 +16841,6 @@ "fullName": "", "functionType": "ActionWithOperator", "getterName": "VerticalAngleMin", - "group": "First person camera mouse mapper configuration", "name": "SetVerticalAngleMin", "sentence": "", "events": [ @@ -16887,7 +16921,6 @@ "fullName": "", "functionType": "ActionWithOperator", "getterName": "VerticalAngleMax", - "group": "First person camera mouse mapper configuration", "name": "SetVerticalAngleMax", "sentence": "", "events": [ @@ -16968,7 +17001,6 @@ "fullName": "", "functionType": "ActionWithOperator", "getterName": "OffsetZ", - "group": "First person camera mouse mapper configuration", "name": "SetOffsetZ", "sentence": "", "events": [ @@ -17005,57 +17037,6 @@ "objectGroups": [] } ], - "eventsFunctionsFolderStructure": { - "folderName": "__ROOT", - "children": [ - { - "functionName": "doStepPreEvents" - }, - { - "folderName": "Layers and cameras", - "children": [ - { - "functionName": "LookFromObjectEyes" - } - ] - }, - { - "folderName": "First person camera mouse mapper configuration", - "children": [ - { - "functionName": "HorizontalSpeed" - }, - { - "functionName": "SetHorizontalSpeed" - }, - { - "functionName": "VerticalSpeed" - }, - { - "functionName": "SetVerticalSpeed" - }, - { - "functionName": "VerticalAngleMin" - }, - { - "functionName": "SetVerticalAngleMin" - }, - { - "functionName": "VerticalAngleMax" - }, - { - "functionName": "SetVerticalAngleMax" - }, - { - "functionName": "OffsetZ" - }, - { - "functionName": "SetOffsetZ" - } - ] - } - ] - }, "propertyDescriptors": [ { "value": "", @@ -17109,32 +17090,7 @@ "name": "ShouldLock" } ], - "propertiesFolderStructure": { - "folderName": "__ROOT", - "children": [ - { - "propertyName": "Object3D" - }, - { - "propertyName": "HorizontalSpeed" - }, - { - "propertyName": "VerticalSpeed" - }, - { - "propertyName": "VerticalAngleMin" - }, - { - "propertyName": "VerticalAngleMax" - }, - { - "propertyName": "OffsetZ" - }, - { - "propertyName": "ShouldLock" - } - ] - } + "sharedPropertyDescriptors": [] } ], "eventsBasedObjects": [] diff --git a/examples/starting-first-person-horror/starting-first-person-horror.json b/examples/starting-first-person-horror/starting-first-person-horror.json index 1d793791a..00a6f9c5d 100644 --- a/examples/starting-first-person-horror/starting-first-person-horror.json +++ b/examples/starting-first-person-horror/starting-first-person-horror.json @@ -2103,6 +2103,51 @@ "source": "", "type": "BuiltinCommonInstructions::Group", "events": [ + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Start with touch controls on touchscreens." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SceneJustBegins" + }, + "parameters": [ + "" + ] + }, + { + "type": { + "value": "SystemInfo::HasTouchScreen" + }, + "parameters": [ + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteToggleSwitch::SpriteToggleSwitch::SetChecked" + }, + "parameters": [ + "ControlsToggle", + "yes", + "" + ] + } + ] + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ @@ -2309,18 +2354,11 @@ "conditions": [ { "type": { - "value": "MouseButtonFromTextPressed" + "value": "HasAnyTouchOrMouseStarted" }, "parameters": [ - "", - "\"Left\"" + "" ] - }, - { - "type": { - "value": "BuiltinCommonInstructions::Once" - }, - "parameters": [] } ], "actions": [], @@ -2339,17 +2377,6 @@ "\"Left\"", "" ] - }, - { - "type": { - "inverted": true, - "value": "SpriteMultitouchJoystick::MultitouchButton::IsPressed" - }, - "parameters": [ - "JumpButton", - "MultitouchButton", - "" - ] } ], "actions": [ @@ -11857,7 +11884,6 @@ { "author": "PANDAKO-GitHub", "category": "Input", - "dimension": "", "extensionNamespace": "", "fullName": "Mouse Pointer Lock", "gdevelopVersion": ">=5.5.222", @@ -11865,8 +11891,8 @@ "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyMy4wLjMsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iSWNvbnMiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB2aWV3Qm94PSIwIDAgMzIgMzIiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDMyIDMyOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8c3R5bGUgdHlwZT0idGV4dC9jc3MiPg0KCS5zdDB7ZmlsbDpub25lO3N0cm9rZTojMDAwMDAwO3N0cm9rZS13aWR0aDoyO3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1saW5lam9pbjpyb3VuZDtzdHJva2UtbWl0ZXJsaW1pdDoxMDt9DQo8L3N0eWxlPg0KPHBvbHlsaW5lIGNsYXNzPSJzdDAiIHBvaW50cz0iMTksMTkgMjQsMTkgMjQsMjQgIi8+DQo8cG9seWxpbmUgY2xhc3M9InN0MCIgcG9pbnRzPSI2LDIzIDExLDIzIDExLDE4ICIvPg0KPHBhdGggY2xhc3M9InN0MCIgZD0iTTI0LDE5LjRjLTAuNywwLjgtMS40LDEuNi0yLjIsMi40Yy03LDctMTUuMywxMC4yLTE4LjUsN3MtMC4xLTExLjUsNy0xOC41czE1LjMtMTAuMiwxOC41LTcNCgljMS40LDEuNCwxLjYsMy42LDAuOCw2LjMiLz4NCjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik0xMSwyMi41Yy0wLjMtMC4yLTAuNS0wLjUtMC44LTAuOGMtNy03LTEwLjItMTUuMy03LTE4LjVzMTEuNS0wLjEsMTguNSw3czEwLjIsMTUuMyw3LDE4LjUNCgljLTEuNywxLjctNC44LDEuNi04LjQsMC4xIi8+DQo8L3N2Zz4NCg==", "name": "MousePointerLock", "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/Line Hero Pack/Master/SVG/Virtual Reality/Virtual Reality_360_rotate_vr_movement.svg", - "shortDescription": "This behavior removes the limit on the distance the mouse can move and hides the cursor.", - "version": "0.3.0", + "shortDescription": "Lock and hide mouse pointer for unlimited movement (e.g., FPS mouse look).", + "version": "0.3.2", "description": [ "This behavior removes the limit on the distance the mouse can move and hides the cursor.", "", @@ -11914,7 +11940,7 @@ { "name": "TouchSpeedFactor", "type": "number", - "value": 4 + "value": 2 } ], "eventsFunctions": [ @@ -12162,16 +12188,46 @@ ] }, { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "const { handler } = gdjs._MousePointerLockExtension;\r", - "\r", - "handler.requestPointerLock();\r", - "" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Fingers are followed instead of locking the pointer, because mobile browsers give tiny pointer movements." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "<", + "2" + ] + } ], - "parameterObjects": "", - "useStrict": true, - "eventsSheetExpanded": false + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const { handler } = gdjs._MousePointerLockExtension;\r", + "\r", + "handler.requestPointerLock();\r", + "" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ] } ], "parameters": [], @@ -12318,7 +12374,7 @@ "functionType": "Condition", "name": "isEmulatingPointerLock", "private": true, - "sentence": "The mouse pointer is lock is emulated", + "sentence": "The mouse pointer lock is emulated", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -12354,6 +12410,31 @@ ] } ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + ">=", + "2" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] } ], "parameters": [], @@ -12635,68 +12716,12 @@ "objectGroups": [] } ], - "eventsFunctionsFolderStructure": { - "folderName": "__ROOT", - "children": [ - { - "functionName": "onFirstSceneLoaded" - }, - { - "functionName": "onScenePostEvents" - }, - { - "functionName": "RequestPointerLock" - }, - { - "functionName": "ExitPointerLock" - }, - { - "functionName": "isPointerLocked" - }, - { - "functionName": "isPointerActuallyLocked" - }, - { - "functionName": "isEmulatingPointerLock" - }, - { - "functionName": "IsMoving" - }, - { - "functionName": "MovementX" - }, - { - "functionName": "SetMovementX" - }, - { - "functionName": "MovementY" - }, - { - "functionName": "SetMovementY" - }, - { - "functionName": "TouchX" - }, - { - "functionName": "TouchY" - }, - { - "functionName": "TouchSpeedFactor" - }, - { - "functionName": "SetTouchSpeedFactor" - } - ] - }, "eventsBasedBehaviors": [ { "description": "Control camera rotations with a mouse.", "fullName": "First person camera mouse mapper", - "helpPath": "", - "iconUrl": "", "name": "FirstPersonPointerMapper", "objectType": "", - "previewIconUrl": "", "eventsFunctions": [ { "fullName": "", @@ -12716,6 +12741,18 @@ }, "comment": "TODO It's probably a bad idea to rotate the object around Y." }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Both rotations are relative to the screen height because the field of view is vertical. This way, the speed doesn't change with the screen ratio." + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ @@ -12737,7 +12774,7 @@ "parameters": [ "Object", "+", - "MousePointerLock::MovementX() * HorizontalSpeed / SceneWindowWidth()" + "MousePointerLock::MovementX() * HorizontalSpeed / (SceneWindowHeight() * 16 / 9)" ] }, { @@ -12971,7 +13008,6 @@ "fullName": "", "functionType": "ActionWithOperator", "getterName": "HorizontalSpeed", - "group": "First person camera mouse mapper configuration", "name": "SetHorizontalSpeed", "sentence": "", "events": [ @@ -13052,7 +13088,6 @@ "fullName": "", "functionType": "ActionWithOperator", "getterName": "VerticalSpeed", - "group": "First person camera mouse mapper configuration", "name": "SetVerticalSpeed", "sentence": "", "events": [ @@ -13133,7 +13168,6 @@ "fullName": "", "functionType": "ActionWithOperator", "getterName": "VerticalAngleMin", - "group": "First person camera mouse mapper configuration", "name": "SetVerticalAngleMin", "sentence": "", "events": [ @@ -13214,7 +13248,6 @@ "fullName": "", "functionType": "ActionWithOperator", "getterName": "VerticalAngleMax", - "group": "First person camera mouse mapper configuration", "name": "SetVerticalAngleMax", "sentence": "", "events": [ @@ -13295,7 +13328,6 @@ "fullName": "", "functionType": "ActionWithOperator", "getterName": "OffsetZ", - "group": "First person camera mouse mapper configuration", "name": "SetOffsetZ", "sentence": "", "events": [ @@ -13332,57 +13364,6 @@ "objectGroups": [] } ], - "eventsFunctionsFolderStructure": { - "folderName": "__ROOT", - "children": [ - { - "functionName": "doStepPreEvents" - }, - { - "folderName": "Layers and cameras", - "children": [ - { - "functionName": "LookFromObjectEyes" - } - ] - }, - { - "folderName": "First person camera mouse mapper configuration", - "children": [ - { - "functionName": "HorizontalSpeed" - }, - { - "functionName": "SetHorizontalSpeed" - }, - { - "functionName": "VerticalSpeed" - }, - { - "functionName": "SetVerticalSpeed" - }, - { - "functionName": "VerticalAngleMin" - }, - { - "functionName": "SetVerticalAngleMin" - }, - { - "functionName": "VerticalAngleMax" - }, - { - "functionName": "SetVerticalAngleMax" - }, - { - "functionName": "OffsetZ" - }, - { - "functionName": "SetOffsetZ" - } - ] - } - ] - }, "propertyDescriptors": [ { "value": "", @@ -13436,32 +13417,7 @@ "name": "ShouldLock" } ], - "propertiesFolderStructure": { - "folderName": "__ROOT", - "children": [ - { - "propertyName": "Object3D" - }, - { - "propertyName": "HorizontalSpeed" - }, - { - "propertyName": "VerticalSpeed" - }, - { - "propertyName": "VerticalAngleMin" - }, - { - "propertyName": "VerticalAngleMax" - }, - { - "propertyName": "OffsetZ" - }, - { - "propertyName": "ShouldLock" - } - ] - } + "sharedPropertyDescriptors": [] } ], "eventsBasedObjects": [] diff --git a/examples/starting-first-person-shooter-enemies/starting-first-person-shooter-enemies.json b/examples/starting-first-person-shooter-enemies/starting-first-person-shooter-enemies.json index 3a6da8536..68800913e 100644 --- a/examples/starting-first-person-shooter-enemies/starting-first-person-shooter-enemies.json +++ b/examples/starting-first-person-shooter-enemies/starting-first-person-shooter-enemies.json @@ -338,6 +338,30 @@ "persistentUuid": "f1651ed6-c467-4174-a82a-ab153372b2c5", "type": "string", "value": "Keyboard" + }, + { + "name": "TapTouchId", + "persistentUuid": "1df99264-f71e-4e5a-bbac-2a63e9ae0584", + "type": "number", + "value": 0 + }, + { + "name": "TapStartX", + "persistentUuid": "85ba283b-6bfe-4109-88e5-4c89d73355ab", + "type": "number", + "value": 0 + }, + { + "name": "TapStartY", + "persistentUuid": "a9c8e66f-b54a-4e72-8b4a-83b31fcafc89", + "type": "number", + "value": 0 + }, + { + "name": "TapShot", + "persistentUuid": "99a8dcab-cf2c-4dd6-adbb-229300aec174", + "type": "boolean", + "value": false } ], "instances": [ @@ -2056,6 +2080,125 @@ "source": "", "type": "BuiltinCommonInstructions::Group", "events": [ + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Keep shooting while the button is held, even when the finger drags away from it to aim." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SceneJustBegins" + }, + "parameters": [ + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "ResetTimer" + }, + "parameters": [ + "", + "\"ShootCooldown\"" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "A quick tap anywhere outside the buttons also shoots. Dragging only aims." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "HasTouchEnded" + }, + "parameters": [ + "", + "TapTouchId" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "CompareTimer" + }, + "parameters": [ + "", + "\"TapTouch\"", + "<", + "0.25" + ] + }, + { + "type": { + "value": "BuiltinCommonInstructions::CompareNumbers" + }, + "parameters": [ + "DistanceBetweenPositions(TapStartX, TapStartY, TouchX(TapTouchId, \"MobileControls\", 0), TouchY(TapTouchId, \"MobileControls\", 0))", + "<", + "30" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "TapShot", + "True", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TapTouchId", + "=", + "0" + ] + } + ] + } + ] + }, { "folded": false, "type": "BuiltinCommonInstructions::Standard", @@ -2123,11 +2266,57 @@ }, { "type": { - "value": "ButtonStates::ButtonFSM::IsPressed" + "value": "BuiltinCommonInstructions::Or" + }, + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "ButtonStates::ButtonFSM::IsPressed" + }, + "parameters": [ + "ShootButton", + "ButtonFSM", + "" + ] + }, + { + "type": { + "value": "ButtonStates::ButtonFSM::IsPressedOutside" + }, + "parameters": [ + "ShootButton", + "ButtonFSM", + "" + ] + } + ] + } + ] + }, + { + "type": { + "value": "BuiltinCommonInstructions::And" + }, + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "StringVariable" }, "parameters": [ - "ShootButton", - "ButtonFSM", + "ControlKind", + "=", + "\"Touch\"" + ] + }, + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "TapShot", + "True", "" ] } @@ -2137,12 +2326,26 @@ }, { "type": { - "value": "BuiltinCommonInstructions::Once" + "value": "CompareTimer" }, - "parameters": [] + "parameters": [ + "", + "\"ShootCooldown\"", + ">=", + "0.2" + ] } ], "actions": [ + { + "type": { + "value": "ResetTimer" + }, + "parameters": [ + "", + "\"ShootCooldown\"" + ] + }, { "type": { "value": "PlaySound" @@ -2317,6 +2520,22 @@ ] } ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "TapShot", + "False", + "" + ] + } + ] } ], "parameters": [] @@ -2876,6 +3095,51 @@ "source": "", "type": "BuiltinCommonInstructions::Group", "events": [ + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Start with touch controls on touchscreens." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SceneJustBegins" + }, + "parameters": [ + "" + ] + }, + { + "type": { + "value": "SystemInfo::HasTouchScreen" + }, + "parameters": [ + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteToggleSwitch::SpriteToggleSwitch::SetChecked" + }, + "parameters": [ + "ControlsToggle", + "yes", + "" + ] + } + ] + }, { "folded": false, "type": "BuiltinCommonInstructions::Standard", @@ -3127,18 +3391,11 @@ "conditions": [ { "type": { - "value": "MouseButtonFromTextPressed" + "value": "HasAnyTouchOrMouseStarted" }, "parameters": [ - "", - "\"Left\"" + "" ] - }, - { - "type": { - "value": "BuiltinCommonInstructions::Once" - }, - "parameters": [] } ], "actions": [], @@ -3158,28 +3415,6 @@ "\"Left\"", "" ] - }, - { - "type": { - "inverted": true, - "value": "SpriteMultitouchJoystick::MultitouchButton::IsPressed" - }, - "parameters": [ - "JumpButton", - "MultitouchButton", - "" - ] - }, - { - "type": { - "inverted": true, - "value": "ButtonStates::ButtonFSM::IsPressed" - }, - "parameters": [ - "ShootButton", - "ButtonFSM", - "" - ] } ], "actions": [ @@ -3192,6 +3427,76 @@ "" ] } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "SpriteMultitouchJoystick::MultitouchButton::IsPressed" + }, + "parameters": [ + "JumpButton", + "MultitouchButton", + "" + ] + }, + { + "type": { + "inverted": true, + "value": "ButtonStates::ButtonFSM::IsPressed" + }, + "parameters": [ + "ShootButton", + "ButtonFSM", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TapTouchId", + "=", + "StartedTouchOrMouseId(0)" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TapStartX", + "=", + "TouchX(TapTouchId, \"MobileControls\", 0)" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TapStartY", + "=", + "TouchY(TapTouchId, \"MobileControls\", 0)" + ] + }, + { + "type": { + "value": "ResetTimer" + }, + "parameters": [ + "", + "\"TapTouch\"" + ] + } + ] + } ] } ] @@ -12759,7 +13064,7 @@ "name": "MousePointerLock", "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/Line Hero Pack/Master/SVG/Virtual Reality/Virtual Reality_360_rotate_vr_movement.svg", "shortDescription": "Lock and hide mouse pointer for unlimited movement (e.g., FPS mouse look).", - "version": "0.3.1", + "version": "0.3.2", "description": [ "This behavior removes the limit on the distance the mouse can move and hides the cursor.", "", @@ -12807,7 +13112,7 @@ { "name": "TouchSpeedFactor", "type": "number", - "value": 4 + "value": 2 } ], "eventsFunctions": [ @@ -13055,16 +13360,46 @@ ] }, { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "const { handler } = gdjs._MousePointerLockExtension;\r", - "\r", - "handler.requestPointerLock();\r", - "" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Fingers are followed instead of locking the pointer, because mobile browsers give tiny pointer movements." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "<", + "2" + ] + } ], - "parameterObjects": "", - "useStrict": true, - "eventsSheetExpanded": false + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const { handler } = gdjs._MousePointerLockExtension;\r", + "\r", + "handler.requestPointerLock();\r", + "" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ] } ], "parameters": [], @@ -13247,6 +13582,31 @@ ] } ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + ">=", + "2" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] } ], "parameters": [], @@ -13553,6 +13913,18 @@ }, "comment": "TODO It's probably a bad idea to rotate the object around Y." }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Both rotations are relative to the screen height because the field of view is vertical. This way, the speed doesn't change with the screen ratio." + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ @@ -13574,7 +13946,7 @@ "parameters": [ "Object", "+", - "MousePointerLock::MovementX() * HorizontalSpeed / SceneWindowWidth()" + "MousePointerLock::MovementX() * HorizontalSpeed / (SceneWindowHeight() * 16 / 9)" ] }, { diff --git a/examples/starting-first-person-shooter-horror/starting-first-person-shooter-horror.json b/examples/starting-first-person-shooter-horror/starting-first-person-shooter-horror.json index 8bd90ff9c..034204264 100644 --- a/examples/starting-first-person-shooter-horror/starting-first-person-shooter-horror.json +++ b/examples/starting-first-person-shooter-horror/starting-first-person-shooter-horror.json @@ -346,6 +346,30 @@ "persistentUuid": "f1651ed6-c467-4174-a82a-ab153372b2c5", "type": "string", "value": "Keyboard" + }, + { + "name": "TapTouchId", + "persistentUuid": "6974289c-65b0-4107-a412-30c77b1e1324", + "type": "number", + "value": 0 + }, + { + "name": "TapStartX", + "persistentUuid": "2da0f146-de58-4b90-a986-08fd498eff27", + "type": "number", + "value": 0 + }, + { + "name": "TapStartY", + "persistentUuid": "023b3adc-20e9-4c78-b147-91d2cc10b339", + "type": "number", + "value": 0 + }, + { + "name": "TapShot", + "persistentUuid": "80f7538c-8236-4d3c-8e04-27816d9c7ef3", + "type": "boolean", + "value": false } ], "instances": [ @@ -2144,6 +2168,125 @@ "source": "", "type": "BuiltinCommonInstructions::Group", "events": [ + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Keep shooting while the button is held, even when the finger drags away from it to aim." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SceneJustBegins" + }, + "parameters": [ + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "ResetTimer" + }, + "parameters": [ + "", + "\"ShootCooldown\"" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "A quick tap anywhere outside the buttons also shoots. Dragging only aims." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "HasTouchEnded" + }, + "parameters": [ + "", + "TapTouchId" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "CompareTimer" + }, + "parameters": [ + "", + "\"TapTouch\"", + "<", + "0.25" + ] + }, + { + "type": { + "value": "BuiltinCommonInstructions::CompareNumbers" + }, + "parameters": [ + "DistanceBetweenPositions(TapStartX, TapStartY, TouchX(TapTouchId, \"MobileControls\", 0), TouchY(TapTouchId, \"MobileControls\", 0))", + "<", + "30" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "TapShot", + "True", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TapTouchId", + "=", + "0" + ] + } + ] + } + ] + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ @@ -2210,11 +2353,57 @@ }, { "type": { - "value": "ButtonStates::ButtonFSM::IsPressed" + "value": "BuiltinCommonInstructions::Or" + }, + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "ButtonStates::ButtonFSM::IsPressed" + }, + "parameters": [ + "ShootButton", + "ButtonFSM", + "" + ] + }, + { + "type": { + "value": "ButtonStates::ButtonFSM::IsPressedOutside" + }, + "parameters": [ + "ShootButton", + "ButtonFSM", + "" + ] + } + ] + } + ] + }, + { + "type": { + "value": "BuiltinCommonInstructions::And" + }, + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "StringVariable" }, "parameters": [ - "ShootButton", - "ButtonFSM", + "ControlKind", + "=", + "\"Touch\"" + ] + }, + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "TapShot", + "True", "" ] } @@ -2224,12 +2413,26 @@ }, { "type": { - "value": "BuiltinCommonInstructions::Once" + "value": "CompareTimer" }, - "parameters": [] + "parameters": [ + "", + "\"ShootCooldown\"", + ">=", + "0.2" + ] } ], "actions": [ + { + "type": { + "value": "ResetTimer" + }, + "parameters": [ + "", + "\"ShootCooldown\"" + ] + }, { "type": { "value": "PlaySound" @@ -2381,6 +2584,22 @@ ] } ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "TapShot", + "False", + "" + ] + } + ] } ], "parameters": [] @@ -2898,6 +3117,51 @@ "source": "", "type": "BuiltinCommonInstructions::Group", "events": [ + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Start with touch controls on touchscreens." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SceneJustBegins" + }, + "parameters": [ + "" + ] + }, + { + "type": { + "value": "SystemInfo::HasTouchScreen" + }, + "parameters": [ + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteToggleSwitch::SpriteToggleSwitch::SetChecked" + }, + "parameters": [ + "ControlsToggle", + "yes", + "" + ] + } + ] + }, { "folded": true, "type": "BuiltinCommonInstructions::Standard", @@ -3149,18 +3413,11 @@ "conditions": [ { "type": { - "value": "MouseButtonFromTextPressed" + "value": "HasAnyTouchOrMouseStarted" }, "parameters": [ - "", - "\"Left\"" + "" ] - }, - { - "type": { - "value": "BuiltinCommonInstructions::Once" - }, - "parameters": [] } ], "actions": [], @@ -3180,28 +3437,6 @@ "\"Left\"", "" ] - }, - { - "type": { - "inverted": true, - "value": "SpriteMultitouchJoystick::MultitouchButton::IsPressed" - }, - "parameters": [ - "JumpButton", - "MultitouchButton", - "" - ] - }, - { - "type": { - "inverted": true, - "value": "ButtonStates::ButtonFSM::IsPressed" - }, - "parameters": [ - "ShootButton", - "ButtonFSM", - "" - ] } ], "actions": [ @@ -3214,6 +3449,76 @@ "" ] } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "SpriteMultitouchJoystick::MultitouchButton::IsPressed" + }, + "parameters": [ + "JumpButton", + "MultitouchButton", + "" + ] + }, + { + "type": { + "inverted": true, + "value": "ButtonStates::ButtonFSM::IsPressed" + }, + "parameters": [ + "ShootButton", + "ButtonFSM", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TapTouchId", + "=", + "StartedTouchOrMouseId(0)" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TapStartX", + "=", + "TouchX(TapTouchId, \"MobileControls\", 0)" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TapStartY", + "=", + "TouchY(TapTouchId, \"MobileControls\", 0)" + ] + }, + { + "type": { + "value": "ResetTimer" + }, + "parameters": [ + "", + "\"TapTouch\"" + ] + } + ] + } ] } ] @@ -12749,7 +13054,6 @@ { "author": "PANDAKO-GitHub", "category": "Input", - "dimension": "", "extensionNamespace": "", "fullName": "Mouse Pointer Lock", "gdevelopVersion": ">=5.5.222", @@ -12757,8 +13061,8 @@ "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyMy4wLjMsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iSWNvbnMiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB2aWV3Qm94PSIwIDAgMzIgMzIiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDMyIDMyOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8c3R5bGUgdHlwZT0idGV4dC9jc3MiPg0KCS5zdDB7ZmlsbDpub25lO3N0cm9rZTojMDAwMDAwO3N0cm9rZS13aWR0aDoyO3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1saW5lam9pbjpyb3VuZDtzdHJva2UtbWl0ZXJsaW1pdDoxMDt9DQo8L3N0eWxlPg0KPHBvbHlsaW5lIGNsYXNzPSJzdDAiIHBvaW50cz0iMTksMTkgMjQsMTkgMjQsMjQgIi8+DQo8cG9seWxpbmUgY2xhc3M9InN0MCIgcG9pbnRzPSI2LDIzIDExLDIzIDExLDE4ICIvPg0KPHBhdGggY2xhc3M9InN0MCIgZD0iTTI0LDE5LjRjLTAuNywwLjgtMS40LDEuNi0yLjIsMi40Yy03LDctMTUuMywxMC4yLTE4LjUsN3MtMC4xLTExLjUsNy0xOC41czE1LjMtMTAuMiwxOC41LTcNCgljMS40LDEuNCwxLjYsMy42LDAuOCw2LjMiLz4NCjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik0xMSwyMi41Yy0wLjMtMC4yLTAuNS0wLjUtMC44LTAuOGMtNy03LTEwLjItMTUuMy03LTE4LjVzMTEuNS0wLjEsMTguNSw3czEwLjIsMTUuMyw3LDE4LjUNCgljLTEuNywxLjctNC44LDEuNi04LjQsMC4xIi8+DQo8L3N2Zz4NCg==", "name": "MousePointerLock", "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/Line Hero Pack/Master/SVG/Virtual Reality/Virtual Reality_360_rotate_vr_movement.svg", - "shortDescription": "This behavior removes the limit on the distance the mouse can move and hides the cursor.", - "version": "0.3.0", + "shortDescription": "Lock and hide mouse pointer for unlimited movement (e.g., FPS mouse look).", + "version": "0.3.2", "description": [ "This behavior removes the limit on the distance the mouse can move and hides the cursor.", "", @@ -12806,7 +13110,7 @@ { "name": "TouchSpeedFactor", "type": "number", - "value": 4 + "value": 2 } ], "eventsFunctions": [ @@ -13054,16 +13358,46 @@ ] }, { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "const { handler } = gdjs._MousePointerLockExtension;\r", - "\r", - "handler.requestPointerLock();\r", - "" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Fingers are followed instead of locking the pointer, because mobile browsers give tiny pointer movements." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "<", + "2" + ] + } ], - "parameterObjects": "", - "useStrict": true, - "eventsSheetExpanded": false + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const { handler } = gdjs._MousePointerLockExtension;\r", + "\r", + "handler.requestPointerLock();\r", + "" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ] } ], "parameters": [], @@ -13210,7 +13544,7 @@ "functionType": "Condition", "name": "isEmulatingPointerLock", "private": true, - "sentence": "The mouse pointer is lock is emulated", + "sentence": "The mouse pointer lock is emulated", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -13246,6 +13580,31 @@ ] } ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + ">=", + "2" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] } ], "parameters": [], @@ -13527,68 +13886,12 @@ "objectGroups": [] } ], - "eventsFunctionsFolderStructure": { - "folderName": "__ROOT", - "children": [ - { - "functionName": "onFirstSceneLoaded" - }, - { - "functionName": "onScenePostEvents" - }, - { - "functionName": "RequestPointerLock" - }, - { - "functionName": "ExitPointerLock" - }, - { - "functionName": "isPointerLocked" - }, - { - "functionName": "isPointerActuallyLocked" - }, - { - "functionName": "isEmulatingPointerLock" - }, - { - "functionName": "IsMoving" - }, - { - "functionName": "MovementX" - }, - { - "functionName": "SetMovementX" - }, - { - "functionName": "MovementY" - }, - { - "functionName": "SetMovementY" - }, - { - "functionName": "TouchX" - }, - { - "functionName": "TouchY" - }, - { - "functionName": "TouchSpeedFactor" - }, - { - "functionName": "SetTouchSpeedFactor" - } - ] - }, "eventsBasedBehaviors": [ { "description": "Control camera rotations with a mouse.", "fullName": "First person camera mouse mapper", - "helpPath": "", - "iconUrl": "", "name": "FirstPersonPointerMapper", "objectType": "", - "previewIconUrl": "", "eventsFunctions": [ { "fullName": "", @@ -13608,6 +13911,18 @@ }, "comment": "TODO It's probably a bad idea to rotate the object around Y." }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Both rotations are relative to the screen height because the field of view is vertical. This way, the speed doesn't change with the screen ratio." + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ @@ -13629,7 +13944,7 @@ "parameters": [ "Object", "+", - "MousePointerLock::MovementX() * HorizontalSpeed / SceneWindowWidth()" + "MousePointerLock::MovementX() * HorizontalSpeed / (SceneWindowHeight() * 16 / 9)" ] }, { @@ -13863,7 +14178,6 @@ "fullName": "", "functionType": "ActionWithOperator", "getterName": "HorizontalSpeed", - "group": "First person camera mouse mapper configuration", "name": "SetHorizontalSpeed", "sentence": "", "events": [ @@ -13944,7 +14258,6 @@ "fullName": "", "functionType": "ActionWithOperator", "getterName": "VerticalSpeed", - "group": "First person camera mouse mapper configuration", "name": "SetVerticalSpeed", "sentence": "", "events": [ @@ -14025,7 +14338,6 @@ "fullName": "", "functionType": "ActionWithOperator", "getterName": "VerticalAngleMin", - "group": "First person camera mouse mapper configuration", "name": "SetVerticalAngleMin", "sentence": "", "events": [ @@ -14106,7 +14418,6 @@ "fullName": "", "functionType": "ActionWithOperator", "getterName": "VerticalAngleMax", - "group": "First person camera mouse mapper configuration", "name": "SetVerticalAngleMax", "sentence": "", "events": [ @@ -14187,7 +14498,6 @@ "fullName": "", "functionType": "ActionWithOperator", "getterName": "OffsetZ", - "group": "First person camera mouse mapper configuration", "name": "SetOffsetZ", "sentence": "", "events": [ @@ -14224,57 +14534,6 @@ "objectGroups": [] } ], - "eventsFunctionsFolderStructure": { - "folderName": "__ROOT", - "children": [ - { - "functionName": "doStepPreEvents" - }, - { - "folderName": "Layers and cameras", - "children": [ - { - "functionName": "LookFromObjectEyes" - } - ] - }, - { - "folderName": "First person camera mouse mapper configuration", - "children": [ - { - "functionName": "HorizontalSpeed" - }, - { - "functionName": "SetHorizontalSpeed" - }, - { - "functionName": "VerticalSpeed" - }, - { - "functionName": "SetVerticalSpeed" - }, - { - "functionName": "VerticalAngleMin" - }, - { - "functionName": "SetVerticalAngleMin" - }, - { - "functionName": "VerticalAngleMax" - }, - { - "functionName": "SetVerticalAngleMax" - }, - { - "functionName": "OffsetZ" - }, - { - "functionName": "SetOffsetZ" - } - ] - } - ] - }, "propertyDescriptors": [ { "value": "", @@ -14328,32 +14587,7 @@ "name": "ShouldLock" } ], - "propertiesFolderStructure": { - "folderName": "__ROOT", - "children": [ - { - "propertyName": "Object3D" - }, - { - "propertyName": "HorizontalSpeed" - }, - { - "propertyName": "VerticalSpeed" - }, - { - "propertyName": "VerticalAngleMin" - }, - { - "propertyName": "VerticalAngleMax" - }, - { - "propertyName": "OffsetZ" - }, - { - "propertyName": "ShouldLock" - } - ] - } + "sharedPropertyDescriptors": [] } ], "eventsBasedObjects": [] diff --git a/examples/starting-first-person-shooter/starting-first-person-shooter.json b/examples/starting-first-person-shooter/starting-first-person-shooter.json index 151b68d67..be8ad1db0 100644 --- a/examples/starting-first-person-shooter/starting-first-person-shooter.json +++ b/examples/starting-first-person-shooter/starting-first-person-shooter.json @@ -328,6 +328,30 @@ "persistentUuid": "f7dcc002-63ed-45a9-acf0-51088ff88d26", "type": "string", "value": "Keyboard" + }, + { + "name": "TapTouchId", + "persistentUuid": "b141fd05-d337-448e-84bd-bfee1266f43f", + "type": "number", + "value": 0 + }, + { + "name": "TapStartX", + "persistentUuid": "fe844a2e-8ea8-492a-ada1-198e11d3f53b", + "type": "number", + "value": 0 + }, + { + "name": "TapStartY", + "persistentUuid": "3e6804fc-6c63-4e44-be6e-d742aebb0f17", + "type": "number", + "value": 0 + }, + { + "name": "TapShot", + "persistentUuid": "fe218464-64fc-445e-bbc1-ab44977d61cb", + "type": "boolean", + "value": false } ], "instances": [ @@ -1796,6 +1820,125 @@ "source": "", "type": "BuiltinCommonInstructions::Group", "events": [ + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Keep shooting while the button is held, even when the finger drags away from it to aim." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SceneJustBegins" + }, + "parameters": [ + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "ResetTimer" + }, + "parameters": [ + "", + "\"ShootCooldown\"" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "A quick tap anywhere outside the buttons also shoots. Dragging only aims." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "HasTouchEnded" + }, + "parameters": [ + "", + "TapTouchId" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "CompareTimer" + }, + "parameters": [ + "", + "\"TapTouch\"", + "<", + "0.25" + ] + }, + { + "type": { + "value": "BuiltinCommonInstructions::CompareNumbers" + }, + "parameters": [ + "DistanceBetweenPositions(TapStartX, TapStartY, TouchX(TapTouchId, \"MobileControls\", 0), TouchY(TapTouchId, \"MobileControls\", 0))", + "<", + "30" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "TapShot", + "True", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TapTouchId", + "=", + "0" + ] + } + ] + } + ] + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ @@ -1862,11 +2005,57 @@ }, { "type": { - "value": "ButtonStates::ButtonFSM::IsPressed" + "value": "BuiltinCommonInstructions::Or" + }, + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "ButtonStates::ButtonFSM::IsPressed" + }, + "parameters": [ + "ShootButton", + "ButtonFSM", + "" + ] + }, + { + "type": { + "value": "ButtonStates::ButtonFSM::IsPressedOutside" + }, + "parameters": [ + "ShootButton", + "ButtonFSM", + "" + ] + } + ] + } + ] + }, + { + "type": { + "value": "BuiltinCommonInstructions::And" + }, + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "StringVariable" }, "parameters": [ - "ShootButton", - "ButtonFSM", + "ControlKind", + "=", + "\"Touch\"" + ] + }, + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "TapShot", + "True", "" ] } @@ -1876,12 +2065,26 @@ }, { "type": { - "value": "BuiltinCommonInstructions::Once" + "value": "CompareTimer" }, - "parameters": [] + "parameters": [ + "", + "\"ShootCooldown\"", + ">=", + "0.2" + ] } ], "actions": [ + { + "type": { + "value": "ResetTimer" + }, + "parameters": [ + "", + "\"ShootCooldown\"" + ] + }, { "type": { "value": "PlaySound" @@ -1984,6 +2187,22 @@ ] } ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "TapShot", + "False", + "" + ] + } + ] } ], "parameters": [] @@ -1998,6 +2217,51 @@ "source": "", "type": "BuiltinCommonInstructions::Group", "events": [ + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Start with touch controls on touchscreens." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SceneJustBegins" + }, + "parameters": [ + "" + ] + }, + { + "type": { + "value": "SystemInfo::HasTouchScreen" + }, + "parameters": [ + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteToggleSwitch::SpriteToggleSwitch::SetChecked" + }, + "parameters": [ + "ControlsToggle", + "yes", + "" + ] + } + ] + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ @@ -2241,18 +2505,11 @@ "conditions": [ { "type": { - "value": "MouseButtonFromTextPressed" + "value": "HasAnyTouchOrMouseStarted" }, "parameters": [ - "", - "\"Left\"" + "" ] - }, - { - "type": { - "value": "BuiltinCommonInstructions::Once" - }, - "parameters": [] } ], "actions": [], @@ -2271,28 +2528,6 @@ "\"Left\"", "" ] - }, - { - "type": { - "inverted": true, - "value": "SpriteMultitouchJoystick::MultitouchButton::IsPressed" - }, - "parameters": [ - "JumpButton", - "MultitouchButton", - "" - ] - }, - { - "type": { - "inverted": true, - "value": "ButtonStates::ButtonFSM::IsPressed" - }, - "parameters": [ - "ShootButton", - "ButtonFSM", - "" - ] } ], "actions": [ @@ -2305,6 +2540,76 @@ "" ] } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "SpriteMultitouchJoystick::MultitouchButton::IsPressed" + }, + "parameters": [ + "JumpButton", + "MultitouchButton", + "" + ] + }, + { + "type": { + "inverted": true, + "value": "ButtonStates::ButtonFSM::IsPressed" + }, + "parameters": [ + "ShootButton", + "ButtonFSM", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TapTouchId", + "=", + "StartedTouchOrMouseId(0)" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TapStartX", + "=", + "TouchX(TapTouchId, \"MobileControls\", 0)" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TapStartY", + "=", + "TouchY(TapTouchId, \"MobileControls\", 0)" + ] + }, + { + "type": { + "value": "ResetTimer" + }, + "parameters": [ + "", + "\"TapTouch\"" + ] + } + ] + } ] } ] @@ -11846,7 +12151,6 @@ { "author": "PANDAKO-GitHub", "category": "Input", - "dimension": "", "extensionNamespace": "", "fullName": "Mouse Pointer Lock", "gdevelopVersion": ">=5.5.222", @@ -11854,8 +12158,8 @@ "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyMy4wLjMsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iSWNvbnMiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB2aWV3Qm94PSIwIDAgMzIgMzIiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDMyIDMyOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8c3R5bGUgdHlwZT0idGV4dC9jc3MiPg0KCS5zdDB7ZmlsbDpub25lO3N0cm9rZTojMDAwMDAwO3N0cm9rZS13aWR0aDoyO3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1saW5lam9pbjpyb3VuZDtzdHJva2UtbWl0ZXJsaW1pdDoxMDt9DQo8L3N0eWxlPg0KPHBvbHlsaW5lIGNsYXNzPSJzdDAiIHBvaW50cz0iMTksMTkgMjQsMTkgMjQsMjQgIi8+DQo8cG9seWxpbmUgY2xhc3M9InN0MCIgcG9pbnRzPSI2LDIzIDExLDIzIDExLDE4ICIvPg0KPHBhdGggY2xhc3M9InN0MCIgZD0iTTI0LDE5LjRjLTAuNywwLjgtMS40LDEuNi0yLjIsMi40Yy03LDctMTUuMywxMC4yLTE4LjUsN3MtMC4xLTExLjUsNy0xOC41czE1LjMtMTAuMiwxOC41LTcNCgljMS40LDEuNCwxLjYsMy42LDAuOCw2LjMiLz4NCjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik0xMSwyMi41Yy0wLjMtMC4yLTAuNS0wLjUtMC44LTAuOGMtNy03LTEwLjItMTUuMy03LTE4LjVzMTEuNS0wLjEsMTguNSw3czEwLjIsMTUuMyw3LDE4LjUNCgljLTEuNywxLjctNC44LDEuNi04LjQsMC4xIi8+DQo8L3N2Zz4NCg==", "name": "MousePointerLock", "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/Line Hero Pack/Master/SVG/Virtual Reality/Virtual Reality_360_rotate_vr_movement.svg", - "shortDescription": "This behavior removes the limit on the distance the mouse can move and hides the cursor.", - "version": "0.3.0", + "shortDescription": "Lock and hide mouse pointer for unlimited movement (e.g., FPS mouse look).", + "version": "0.3.2", "description": [ "This behavior removes the limit on the distance the mouse can move and hides the cursor.", "", @@ -11903,7 +12207,7 @@ { "name": "TouchSpeedFactor", "type": "number", - "value": 4 + "value": 2 } ], "eventsFunctions": [ @@ -12151,16 +12455,46 @@ ] }, { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "const { handler } = gdjs._MousePointerLockExtension;\r", - "\r", - "handler.requestPointerLock();\r", - "" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Fingers are followed instead of locking the pointer, because mobile browsers give tiny pointer movements." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "<", + "2" + ] + } ], - "parameterObjects": "", - "useStrict": true, - "eventsSheetExpanded": false + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const { handler } = gdjs._MousePointerLockExtension;\r", + "\r", + "handler.requestPointerLock();\r", + "" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ] } ], "parameters": [], @@ -12307,7 +12641,7 @@ "functionType": "Condition", "name": "isEmulatingPointerLock", "private": true, - "sentence": "The mouse pointer is lock is emulated", + "sentence": "The mouse pointer lock is emulated", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -12343,6 +12677,31 @@ ] } ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + ">=", + "2" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] } ], "parameters": [], @@ -12624,68 +12983,12 @@ "objectGroups": [] } ], - "eventsFunctionsFolderStructure": { - "folderName": "__ROOT", - "children": [ - { - "functionName": "onFirstSceneLoaded" - }, - { - "functionName": "onScenePostEvents" - }, - { - "functionName": "RequestPointerLock" - }, - { - "functionName": "ExitPointerLock" - }, - { - "functionName": "isPointerLocked" - }, - { - "functionName": "isPointerActuallyLocked" - }, - { - "functionName": "isEmulatingPointerLock" - }, - { - "functionName": "IsMoving" - }, - { - "functionName": "MovementX" - }, - { - "functionName": "SetMovementX" - }, - { - "functionName": "MovementY" - }, - { - "functionName": "SetMovementY" - }, - { - "functionName": "TouchX" - }, - { - "functionName": "TouchY" - }, - { - "functionName": "TouchSpeedFactor" - }, - { - "functionName": "SetTouchSpeedFactor" - } - ] - }, "eventsBasedBehaviors": [ { "description": "Control camera rotations with a mouse.", "fullName": "First person camera mouse mapper", - "helpPath": "", - "iconUrl": "", "name": "FirstPersonPointerMapper", "objectType": "", - "previewIconUrl": "", "eventsFunctions": [ { "fullName": "", @@ -12705,6 +13008,18 @@ }, "comment": "TODO It's probably a bad idea to rotate the object around Y." }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Both rotations are relative to the screen height because the field of view is vertical. This way, the speed doesn't change with the screen ratio." + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ @@ -12726,7 +13041,7 @@ "parameters": [ "Object", "+", - "MousePointerLock::MovementX() * HorizontalSpeed / SceneWindowWidth()" + "MousePointerLock::MovementX() * HorizontalSpeed / (SceneWindowHeight() * 16 / 9)" ] }, { @@ -12960,7 +13275,6 @@ "fullName": "", "functionType": "ActionWithOperator", "getterName": "HorizontalSpeed", - "group": "First person camera mouse mapper configuration", "name": "SetHorizontalSpeed", "sentence": "", "events": [ @@ -13041,7 +13355,6 @@ "fullName": "", "functionType": "ActionWithOperator", "getterName": "VerticalSpeed", - "group": "First person camera mouse mapper configuration", "name": "SetVerticalSpeed", "sentence": "", "events": [ @@ -13122,7 +13435,6 @@ "fullName": "", "functionType": "ActionWithOperator", "getterName": "VerticalAngleMin", - "group": "First person camera mouse mapper configuration", "name": "SetVerticalAngleMin", "sentence": "", "events": [ @@ -13203,7 +13515,6 @@ "fullName": "", "functionType": "ActionWithOperator", "getterName": "VerticalAngleMax", - "group": "First person camera mouse mapper configuration", "name": "SetVerticalAngleMax", "sentence": "", "events": [ @@ -13284,7 +13595,6 @@ "fullName": "", "functionType": "ActionWithOperator", "getterName": "OffsetZ", - "group": "First person camera mouse mapper configuration", "name": "SetOffsetZ", "sentence": "", "events": [ @@ -13321,57 +13631,6 @@ "objectGroups": [] } ], - "eventsFunctionsFolderStructure": { - "folderName": "__ROOT", - "children": [ - { - "functionName": "doStepPreEvents" - }, - { - "folderName": "Layers and cameras", - "children": [ - { - "functionName": "LookFromObjectEyes" - } - ] - }, - { - "folderName": "First person camera mouse mapper configuration", - "children": [ - { - "functionName": "HorizontalSpeed" - }, - { - "functionName": "SetHorizontalSpeed" - }, - { - "functionName": "VerticalSpeed" - }, - { - "functionName": "SetVerticalSpeed" - }, - { - "functionName": "VerticalAngleMin" - }, - { - "functionName": "SetVerticalAngleMin" - }, - { - "functionName": "VerticalAngleMax" - }, - { - "functionName": "SetVerticalAngleMax" - }, - { - "functionName": "OffsetZ" - }, - { - "functionName": "SetOffsetZ" - } - ] - } - ] - }, "propertyDescriptors": [ { "value": "", @@ -13425,32 +13684,7 @@ "name": "ShouldLock" } ], - "propertiesFolderStructure": { - "folderName": "__ROOT", - "children": [ - { - "propertyName": "Object3D" - }, - { - "propertyName": "HorizontalSpeed" - }, - { - "propertyName": "VerticalSpeed" - }, - { - "propertyName": "VerticalAngleMin" - }, - { - "propertyName": "VerticalAngleMax" - }, - { - "propertyName": "OffsetZ" - }, - { - "propertyName": "ShouldLock" - } - ] - } + "sharedPropertyDescriptors": [] } ], "eventsBasedObjects": [] diff --git a/examples/starting-first-person-survival-crafting/starting-first-person-survival-crafting.json b/examples/starting-first-person-survival-crafting/starting-first-person-survival-crafting.json index f4301eb9f..ae5cd9f06 100644 --- a/examples/starting-first-person-survival-crafting/starting-first-person-survival-crafting.json +++ b/examples/starting-first-person-survival-crafting/starting-first-person-survival-crafting.json @@ -2344,6 +2344,51 @@ "source": "", "type": "BuiltinCommonInstructions::Group", "events": [ + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Start with touch controls on touchscreens." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SceneJustBegins" + }, + "parameters": [ + "" + ] + }, + { + "type": { + "value": "SystemInfo::HasTouchScreen" + }, + "parameters": [ + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteToggleSwitch::SpriteToggleSwitch::SetChecked" + }, + "parameters": [ + "ControlsToggle", + "yes", + "" + ] + } + ] + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ @@ -2586,18 +2631,11 @@ "conditions": [ { "type": { - "value": "MouseButtonFromTextPressed" + "value": "HasAnyTouchOrMouseStarted" }, "parameters": [ - "", - "\"Left\"" + "" ] - }, - { - "type": { - "value": "BuiltinCommonInstructions::Once" - }, - "parameters": [] } ], "actions": [], @@ -2617,17 +2655,6 @@ "" ] }, - { - "type": { - "inverted": true, - "value": "SpriteMultitouchJoystick::MultitouchButton::IsPressed" - }, - "parameters": [ - "JumpButton", - "MultitouchButton", - "" - ] - }, { "type": { "inverted": true, @@ -13856,7 +13883,6 @@ { "author": "PANDAKO-GitHub", "category": "Input", - "dimension": "", "extensionNamespace": "", "fullName": "Mouse Pointer Lock", "gdevelopVersion": ">=5.5.222", @@ -13864,8 +13890,8 @@ "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyMy4wLjMsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iSWNvbnMiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB2aWV3Qm94PSIwIDAgMzIgMzIiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDMyIDMyOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8c3R5bGUgdHlwZT0idGV4dC9jc3MiPg0KCS5zdDB7ZmlsbDpub25lO3N0cm9rZTojMDAwMDAwO3N0cm9rZS13aWR0aDoyO3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1saW5lam9pbjpyb3VuZDtzdHJva2UtbWl0ZXJsaW1pdDoxMDt9DQo8L3N0eWxlPg0KPHBvbHlsaW5lIGNsYXNzPSJzdDAiIHBvaW50cz0iMTksMTkgMjQsMTkgMjQsMjQgIi8+DQo8cG9seWxpbmUgY2xhc3M9InN0MCIgcG9pbnRzPSI2LDIzIDExLDIzIDExLDE4ICIvPg0KPHBhdGggY2xhc3M9InN0MCIgZD0iTTI0LDE5LjRjLTAuNywwLjgtMS40LDEuNi0yLjIsMi40Yy03LDctMTUuMywxMC4yLTE4LjUsN3MtMC4xLTExLjUsNy0xOC41czE1LjMtMTAuMiwxOC41LTcNCgljMS40LDEuNCwxLjYsMy42LDAuOCw2LjMiLz4NCjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik0xMSwyMi41Yy0wLjMtMC4yLTAuNS0wLjUtMC44LTAuOGMtNy03LTEwLjItMTUuMy03LTE4LjVzMTEuNS0wLjEsMTguNSw3czEwLjIsMTUuMyw3LDE4LjUNCgljLTEuNywxLjctNC44LDEuNi04LjQsMC4xIi8+DQo8L3N2Zz4NCg==", "name": "MousePointerLock", "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/Line Hero Pack/Master/SVG/Virtual Reality/Virtual Reality_360_rotate_vr_movement.svg", - "shortDescription": "This behavior removes the limit on the distance the mouse can move and hides the cursor.", - "version": "0.3.0", + "shortDescription": "Lock and hide mouse pointer for unlimited movement (e.g., FPS mouse look).", + "version": "0.3.2", "description": [ "This behavior removes the limit on the distance the mouse can move and hides the cursor.", "", @@ -13913,7 +13939,7 @@ { "name": "TouchSpeedFactor", "type": "number", - "value": 4 + "value": 2 } ], "eventsFunctions": [ @@ -14161,16 +14187,46 @@ ] }, { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "const { handler } = gdjs._MousePointerLockExtension;\r", - "\r", - "handler.requestPointerLock();\r", - "" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Fingers are followed instead of locking the pointer, because mobile browsers give tiny pointer movements." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "<", + "2" + ] + } ], - "parameterObjects": "", - "useStrict": true, - "eventsSheetExpanded": false + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const { handler } = gdjs._MousePointerLockExtension;\r", + "\r", + "handler.requestPointerLock();\r", + "" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ] } ], "parameters": [], @@ -14317,7 +14373,7 @@ "functionType": "Condition", "name": "isEmulatingPointerLock", "private": true, - "sentence": "The mouse pointer is lock is emulated", + "sentence": "The mouse pointer lock is emulated", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -14353,6 +14409,31 @@ ] } ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + ">=", + "2" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] } ], "parameters": [], @@ -14634,68 +14715,12 @@ "objectGroups": [] } ], - "eventsFunctionsFolderStructure": { - "folderName": "__ROOT", - "children": [ - { - "functionName": "onFirstSceneLoaded" - }, - { - "functionName": "onScenePostEvents" - }, - { - "functionName": "RequestPointerLock" - }, - { - "functionName": "ExitPointerLock" - }, - { - "functionName": "isPointerLocked" - }, - { - "functionName": "isPointerActuallyLocked" - }, - { - "functionName": "isEmulatingPointerLock" - }, - { - "functionName": "IsMoving" - }, - { - "functionName": "MovementX" - }, - { - "functionName": "SetMovementX" - }, - { - "functionName": "MovementY" - }, - { - "functionName": "SetMovementY" - }, - { - "functionName": "TouchX" - }, - { - "functionName": "TouchY" - }, - { - "functionName": "TouchSpeedFactor" - }, - { - "functionName": "SetTouchSpeedFactor" - } - ] - }, "eventsBasedBehaviors": [ { "description": "Control camera rotations with a mouse.", "fullName": "First person camera mouse mapper", - "helpPath": "", - "iconUrl": "", "name": "FirstPersonPointerMapper", "objectType": "", - "previewIconUrl": "", "eventsFunctions": [ { "fullName": "", @@ -14715,6 +14740,18 @@ }, "comment": "TODO It's probably a bad idea to rotate the object around Y." }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Both rotations are relative to the screen height because the field of view is vertical. This way, the speed doesn't change with the screen ratio." + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ @@ -14736,7 +14773,7 @@ "parameters": [ "Object", "+", - "MousePointerLock::MovementX() * HorizontalSpeed / SceneWindowWidth()" + "MousePointerLock::MovementX() * HorizontalSpeed / (SceneWindowHeight() * 16 / 9)" ] }, { @@ -14970,7 +15007,6 @@ "fullName": "", "functionType": "ActionWithOperator", "getterName": "HorizontalSpeed", - "group": "First person camera mouse mapper configuration", "name": "SetHorizontalSpeed", "sentence": "", "events": [ @@ -15051,7 +15087,6 @@ "fullName": "", "functionType": "ActionWithOperator", "getterName": "VerticalSpeed", - "group": "First person camera mouse mapper configuration", "name": "SetVerticalSpeed", "sentence": "", "events": [ @@ -15132,7 +15167,6 @@ "fullName": "", "functionType": "ActionWithOperator", "getterName": "VerticalAngleMin", - "group": "First person camera mouse mapper configuration", "name": "SetVerticalAngleMin", "sentence": "", "events": [ @@ -15213,7 +15247,6 @@ "fullName": "", "functionType": "ActionWithOperator", "getterName": "VerticalAngleMax", - "group": "First person camera mouse mapper configuration", "name": "SetVerticalAngleMax", "sentence": "", "events": [ @@ -15294,7 +15327,6 @@ "fullName": "", "functionType": "ActionWithOperator", "getterName": "OffsetZ", - "group": "First person camera mouse mapper configuration", "name": "SetOffsetZ", "sentence": "", "events": [ @@ -15331,57 +15363,6 @@ "objectGroups": [] } ], - "eventsFunctionsFolderStructure": { - "folderName": "__ROOT", - "children": [ - { - "functionName": "doStepPreEvents" - }, - { - "folderName": "Layers and cameras", - "children": [ - { - "functionName": "LookFromObjectEyes" - } - ] - }, - { - "folderName": "First person camera mouse mapper configuration", - "children": [ - { - "functionName": "HorizontalSpeed" - }, - { - "functionName": "SetHorizontalSpeed" - }, - { - "functionName": "VerticalSpeed" - }, - { - "functionName": "SetVerticalSpeed" - }, - { - "functionName": "VerticalAngleMin" - }, - { - "functionName": "SetVerticalAngleMin" - }, - { - "functionName": "VerticalAngleMax" - }, - { - "functionName": "SetVerticalAngleMax" - }, - { - "functionName": "OffsetZ" - }, - { - "functionName": "SetOffsetZ" - } - ] - } - ] - }, "propertyDescriptors": [ { "value": "", @@ -15435,32 +15416,7 @@ "name": "ShouldLock" } ], - "propertiesFolderStructure": { - "folderName": "__ROOT", - "children": [ - { - "propertyName": "Object3D" - }, - { - "propertyName": "HorizontalSpeed" - }, - { - "propertyName": "VerticalSpeed" - }, - { - "propertyName": "VerticalAngleMin" - }, - { - "propertyName": "VerticalAngleMax" - }, - { - "propertyName": "OffsetZ" - }, - { - "propertyName": "ShouldLock" - } - ] - } + "sharedPropertyDescriptors": [] } ], "eventsBasedObjects": [] diff --git a/examples/starting-first-person/starting-first-person.json b/examples/starting-first-person/starting-first-person.json index 036046876..95adc5b64 100644 --- a/examples/starting-first-person/starting-first-person.json +++ b/examples/starting-first-person/starting-first-person.json @@ -1186,6 +1186,51 @@ "source": "", "type": "BuiltinCommonInstructions::Group", "events": [ + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Start with touch controls on touchscreens." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SceneJustBegins" + }, + "parameters": [ + "" + ] + }, + { + "type": { + "value": "SystemInfo::HasTouchScreen" + }, + "parameters": [ + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SpriteToggleSwitch::SpriteToggleSwitch::SetChecked" + }, + "parameters": [ + "ControlsToggle", + "yes", + "" + ] + } + ] + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ @@ -1392,18 +1437,11 @@ "conditions": [ { "type": { - "value": "MouseButtonFromTextPressed" + "value": "HasAnyTouchOrMouseStarted" }, "parameters": [ - "", - "\"Left\"" + "" ] - }, - { - "type": { - "value": "BuiltinCommonInstructions::Once" - }, - "parameters": [] } ], "actions": [], @@ -1422,17 +1460,6 @@ "\"Left\"", "" ] - }, - { - "type": { - "inverted": true, - "value": "SpriteMultitouchJoystick::MultitouchButton::IsPressed" - }, - "parameters": [ - "JumpButton", - "MultitouchButton", - "" - ] } ], "actions": [ @@ -10846,7 +10873,6 @@ { "author": "PANDAKO-GitHub", "category": "Input", - "dimension": "", "extensionNamespace": "", "fullName": "Mouse Pointer Lock", "gdevelopVersion": ">=5.5.222", @@ -10854,8 +10880,8 @@ "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyMy4wLjMsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iSWNvbnMiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB2aWV3Qm94PSIwIDAgMzIgMzIiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDMyIDMyOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8c3R5bGUgdHlwZT0idGV4dC9jc3MiPg0KCS5zdDB7ZmlsbDpub25lO3N0cm9rZTojMDAwMDAwO3N0cm9rZS13aWR0aDoyO3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1saW5lam9pbjpyb3VuZDtzdHJva2UtbWl0ZXJsaW1pdDoxMDt9DQo8L3N0eWxlPg0KPHBvbHlsaW5lIGNsYXNzPSJzdDAiIHBvaW50cz0iMTksMTkgMjQsMTkgMjQsMjQgIi8+DQo8cG9seWxpbmUgY2xhc3M9InN0MCIgcG9pbnRzPSI2LDIzIDExLDIzIDExLDE4ICIvPg0KPHBhdGggY2xhc3M9InN0MCIgZD0iTTI0LDE5LjRjLTAuNywwLjgtMS40LDEuNi0yLjIsMi40Yy03LDctMTUuMywxMC4yLTE4LjUsN3MtMC4xLTExLjUsNy0xOC41czE1LjMtMTAuMiwxOC41LTcNCgljMS40LDEuNCwxLjYsMy42LDAuOCw2LjMiLz4NCjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik0xMSwyMi41Yy0wLjMtMC4yLTAuNS0wLjUtMC44LTAuOGMtNy03LTEwLjItMTUuMy03LTE4LjVzMTEuNS0wLjEsMTguNSw3czEwLjIsMTUuMyw3LDE4LjUNCgljLTEuNywxLjctNC44LDEuNi04LjQsMC4xIi8+DQo8L3N2Zz4NCg==", "name": "MousePointerLock", "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/Line Hero Pack/Master/SVG/Virtual Reality/Virtual Reality_360_rotate_vr_movement.svg", - "shortDescription": "This behavior removes the limit on the distance the mouse can move and hides the cursor.", - "version": "0.3.0", + "shortDescription": "Lock and hide mouse pointer for unlimited movement (e.g., FPS mouse look).", + "version": "0.3.2", "description": [ "This behavior removes the limit on the distance the mouse can move and hides the cursor.", "", @@ -10903,7 +10929,7 @@ { "name": "TouchSpeedFactor", "type": "number", - "value": 4 + "value": 2 } ], "eventsFunctions": [ @@ -11151,16 +11177,46 @@ ] }, { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "const { handler } = gdjs._MousePointerLockExtension;\r", - "\r", - "handler.requestPointerLock();\r", - "" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Fingers are followed instead of locking the pointer, because mobile browsers give tiny pointer movements." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "<", + "2" + ] + } ], - "parameterObjects": "", - "useStrict": true, - "eventsSheetExpanded": false + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const { handler } = gdjs._MousePointerLockExtension;\r", + "\r", + "handler.requestPointerLock();\r", + "" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ] } ], "parameters": [], @@ -11307,7 +11363,7 @@ "functionType": "Condition", "name": "isEmulatingPointerLock", "private": true, - "sentence": "The mouse pointer is lock is emulated", + "sentence": "The mouse pointer lock is emulated", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -11343,6 +11399,31 @@ ] } ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + ">=", + "2" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] } ], "parameters": [], @@ -11624,68 +11705,12 @@ "objectGroups": [] } ], - "eventsFunctionsFolderStructure": { - "folderName": "__ROOT", - "children": [ - { - "functionName": "onFirstSceneLoaded" - }, - { - "functionName": "onScenePostEvents" - }, - { - "functionName": "RequestPointerLock" - }, - { - "functionName": "ExitPointerLock" - }, - { - "functionName": "isPointerLocked" - }, - { - "functionName": "isPointerActuallyLocked" - }, - { - "functionName": "isEmulatingPointerLock" - }, - { - "functionName": "IsMoving" - }, - { - "functionName": "MovementX" - }, - { - "functionName": "SetMovementX" - }, - { - "functionName": "MovementY" - }, - { - "functionName": "SetMovementY" - }, - { - "functionName": "TouchX" - }, - { - "functionName": "TouchY" - }, - { - "functionName": "TouchSpeedFactor" - }, - { - "functionName": "SetTouchSpeedFactor" - } - ] - }, "eventsBasedBehaviors": [ { "description": "Control camera rotations with a mouse.", "fullName": "First person camera mouse mapper", - "helpPath": "", - "iconUrl": "", "name": "FirstPersonPointerMapper", "objectType": "", - "previewIconUrl": "", "eventsFunctions": [ { "fullName": "", @@ -11705,6 +11730,18 @@ }, "comment": "TODO It's probably a bad idea to rotate the object around Y." }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Both rotations are relative to the screen height because the field of view is vertical. This way, the speed doesn't change with the screen ratio." + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ @@ -11726,7 +11763,7 @@ "parameters": [ "Object", "+", - "MousePointerLock::MovementX() * HorizontalSpeed / SceneWindowWidth()" + "MousePointerLock::MovementX() * HorizontalSpeed / (SceneWindowHeight() * 16 / 9)" ] }, { @@ -11960,7 +11997,6 @@ "fullName": "", "functionType": "ActionWithOperator", "getterName": "HorizontalSpeed", - "group": "First person camera mouse mapper configuration", "name": "SetHorizontalSpeed", "sentence": "", "events": [ @@ -12041,7 +12077,6 @@ "fullName": "", "functionType": "ActionWithOperator", "getterName": "VerticalSpeed", - "group": "First person camera mouse mapper configuration", "name": "SetVerticalSpeed", "sentence": "", "events": [ @@ -12122,7 +12157,6 @@ "fullName": "", "functionType": "ActionWithOperator", "getterName": "VerticalAngleMin", - "group": "First person camera mouse mapper configuration", "name": "SetVerticalAngleMin", "sentence": "", "events": [ @@ -12203,7 +12237,6 @@ "fullName": "", "functionType": "ActionWithOperator", "getterName": "VerticalAngleMax", - "group": "First person camera mouse mapper configuration", "name": "SetVerticalAngleMax", "sentence": "", "events": [ @@ -12284,7 +12317,6 @@ "fullName": "", "functionType": "ActionWithOperator", "getterName": "OffsetZ", - "group": "First person camera mouse mapper configuration", "name": "SetOffsetZ", "sentence": "", "events": [ @@ -12321,57 +12353,6 @@ "objectGroups": [] } ], - "eventsFunctionsFolderStructure": { - "folderName": "__ROOT", - "children": [ - { - "functionName": "doStepPreEvents" - }, - { - "folderName": "Layers and cameras", - "children": [ - { - "functionName": "LookFromObjectEyes" - } - ] - }, - { - "folderName": "First person camera mouse mapper configuration", - "children": [ - { - "functionName": "HorizontalSpeed" - }, - { - "functionName": "SetHorizontalSpeed" - }, - { - "functionName": "VerticalSpeed" - }, - { - "functionName": "SetVerticalSpeed" - }, - { - "functionName": "VerticalAngleMin" - }, - { - "functionName": "SetVerticalAngleMin" - }, - { - "functionName": "VerticalAngleMax" - }, - { - "functionName": "SetVerticalAngleMax" - }, - { - "functionName": "OffsetZ" - }, - { - "functionName": "SetOffsetZ" - } - ] - } - ] - }, "propertyDescriptors": [ { "value": "", @@ -12425,32 +12406,7 @@ "name": "ShouldLock" } ], - "propertiesFolderStructure": { - "folderName": "__ROOT", - "children": [ - { - "propertyName": "Object3D" - }, - { - "propertyName": "HorizontalSpeed" - }, - { - "propertyName": "VerticalSpeed" - }, - { - "propertyName": "VerticalAngleMin" - }, - { - "propertyName": "VerticalAngleMax" - }, - { - "propertyName": "OffsetZ" - }, - { - "propertyName": "ShouldLock" - } - ] - } + "sharedPropertyDescriptors": [] } ], "eventsBasedObjects": []