{ "author": "", "category": "General", "extensionNamespace": "", "fullName": "Paper Engine", "helpPath": "https://github.com/FlokiTV/Paper-Engine", "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0ibWRpLW5vdGUtbXVsdGlwbGUtb3V0bGluZSIgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0IiB2aWV3Qm94PSIwIDAgMjQgMjQiPjxwYXRoIGQ9Ik0zLDZWMjJIMjFWMjRIM0EyLDIgMCAwLDEgMSwyMlY2SDNNMTYsOUgyMS41TDE2LDMuNVY5TTcsMkgxN0wyMyw4VjE4QTIsMiAwIDAsMSAyMSwyMEg3QzUuODksMjAgNSwxOS4xIDUsMThWNEEyLDIgMCAwLDEgNywyTTcsNFYxOEgyMVYxMUgxNFY0SDdaIiAvPjwvc3ZnPg==", "name": "PaperEngine", "previewIconUrl": "https://asset-resources.gdevelop.io/public-resources/Icons/70ce666b63361390263144d920b3a5c1ae3972b9a64de7dd4add9ae62f25d68d_note-multiple-outline.svg", "shortDescription": "Paper Engine", "version": "0.0.3", "description": "Paper Engine", "tags": [ "paper", "3d" ], "authorIds": [ "nopQpwNfA7acPQcwExwWmp1NgLZ2" ], "dependencies": [], "eventsFunctions": [ { "fullName": "", "functionType": "Action", "name": "onFirstSceneLoaded", "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ "gdjs.PaperEngine = {\r", " getDistance: (x1, y1, x2, y2) => {\r", " let y = x2 - x1;\r", " let x = y2 - y1;\r", " return Math.sqrt(x * x + y * y);\r", " },\r", " getLayerType: (layerName) => {\r", " if (!layerName) return \"\"\r", " let type = layerName.split(\"_\")[1]\r", " if (!type) return \"\"\r", " let size = type.split(\" \")\r", " if (size) {\r", " type = size[0]\r", " }\r", " return type\r", " },\r", " getLayerNumber: (layerName) => {\r", " if (!layerName) return 0\r", " return Number(layerName.split(\"_\")[0])\r", " },\r", " getLayerData: (layerName, dataName) => {\r", " let res = 0\r", " if (layerName.includes(dataName.toLowerCase() + \":\")) {\r", " let value = layerName.split(\":\")[1].split(\"]\")[0]\r", " res = Number(value)\r", " }\r", " return res\r", " },\r", " getSkew: (angle) => {\r", " let cameraAngle = runtimeScene.getLayer().getCameraRotation()\r", " cameraAngle = cameraAngle % 360\r", " cameraAngle = cameraAngle < 0 ? cameraAngle + 360 : cameraAngle //normalize rotation\r", " let quad = parseInt(cameraAngle % 360 / 90)\r", " cameraAngle = cameraAngle % 90 //normalize rotation by quad\r", " if (quad === 0)\r", " return -gdjs.toRad(cameraAngle + angle)\r", " if (quad === 2)\r", " return -gdjs.toRad(cameraAngle + angle + 180)\r", " if (quad === 1)\r", " return -gdjs.toRad(cameraAngle + angle - 270)\r", " if (quad === 3)\r", " return -gdjs.toRad(cameraAngle + angle - 90)\r", " },\r", " setXYSort: (obj) => {\r", " // let _o = objects[0] // GD object\r", " // let __o = _o.getRendererObject() // Pixi Object\r", " let layer = runtimeScene.getLayer()\r", "\r", " let r = 2000\r", " let rotation = layer.getCameraRotation() + 90\r", " let rot = gdjs.toRad(rotation)\r", "\r", " let dx = r * Math.cos(rot);\r", " let dy = r * Math.sin(rot);\r", " // let obj = objects[0]\r", "\r", " let x2 = layer.getCameraX() + dx\r", " let y2 = layer.getCameraY() + dy\r", " let z = obj.getVariables().get(\"z\").getValue()\r", " let offz = obj.getVariables().get(\"offsetZ\").getAsNumber()\r", " let rmZ = parseFloat(z + offz) || 0\r", " // console.log(obj.getVariables().get(\"offsetZ\").getAsNumber())\r", " //remove z\r", " let distance = obj.getDistanceToPosition(x2, y2) + rmZ\r", "\r", " let x = obj.getXFromAngleAndDistance(rotation, obj.getHeight() / 2) - x2\r", " let y = obj.getYFromAngleAndDistance(rotation, obj.getHeight() / 2) - y2\r", " let dis = Math.sqrt(x * x + y * y)\r", " obj.setZOrder((dis * -1) + rmZ)\r", " }\r", "}" ], "parameterObjects": "", "useStrict": true, "eventsSheetExpanded": true } ], "parameters": [], "objectGroups": [] }, { "fullName": "", "functionType": "Action", "name": "onScenePreEvents", "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Comment", "color": { "b": 109, "g": 230, "r": 255, "textB": 0, "textG": 0, "textR": 0 }, "comment": "Camera Scale" }, { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ "const MAIN = runtimeScene.getLayer().getRenderer().getRendererObject().parent", "const layer = runtimeScene.getLayer()", "MAIN.scale.y = 0.5", "MAIN.pivot.y = layer.getHeight() / 2 * -1", "", "const layers = runtimeScene._layers.items", "for (const layer in layers) {", " let check = layer.includes(\"_floor\") ||", " layer.includes(\"_plane\") ||", " layer.includes(\"_roof\") ||", " layer.includes(\"_collision\")", " if (check)", " runtimeScene.getLayer(layer).followBaseLayer(true)", "}", "", "" ], "parameterObjects": "", "useStrict": true, "eventsSheetExpanded": true } ], "parameters": [], "objectGroups": [] }, { "fullName": "", "functionType": "Expression", "name": "_____OBJECT_____", "private": true, "sentence": "", "events": [], "expressionType": { "type": "expression" }, "parameters": [], "objectGroups": [] }, { "description": "Creates a box collision using a Shape Painter", "fullName": "Create collision box", "functionType": "Action", "group": "Object", "name": "makeCollision", "sentence": "Set Shape: _PARAM1_. With margin: _PARAM2_ on X: _PARAM3_ and Y: _PARAM4_, with size: _PARAM5_ x _PARAM6_ and angle of: _PARAM7_", "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { "value": "BuiltinCommonInstructions::Once" }, "parameters": [] } ], "actions": [], "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [], "actions": [ { "type": { "value": "Create" }, "parameters": [ "", "Collider", "GetArgumentAsNumber(\"X\")", "GetArgumentAsNumber(\"Y\")", "" ] }, { "type": { "value": "ChangePlan" }, "parameters": [ "Collider", "=", "2000" ] } ] }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { "value": "ObjectVariableAsBoolean" }, "parameters": [ "Collider", "init", "" ] } ], "actions": [ { "type": { "value": "SetObjectVariableAsBoolean" }, "parameters": [ "Collider", "init", "True" ] }, { "type": { "value": "PrimitiveDrawing::Rectangle" }, "parameters": [ "Collider", "-(GetArgumentAsNumber(\"Width\")/2)-GetArgumentAsNumber(\"Margin\")", "-(GetArgumentAsNumber(\"Height\")/2)-GetArgumentAsNumber(\"Margin\")", "(GetArgumentAsNumber(\"Width\")/2)+GetArgumentAsNumber(\"Margin\")", "(GetArgumentAsNumber(\"Height\")/2)+GetArgumentAsNumber(\"Margin\")" ] }, { "type": { "value": "SetAngle" }, "parameters": [ "Collider", "=", "GetArgumentAsNumber(\"Angle\")" ] } ] } ] } ], "parameters": [ { "description": "Collider object", "name": "Collider", "supplementaryInformation": "PrimitiveDrawing::Drawer", "type": "objectList" }, { "description": "Margin", "name": "Margin", "type": "expression" }, { "description": "Center X", "name": "X", "type": "expression" }, { "description": "Center Y", "name": "Y", "type": "expression" }, { "description": "Width", "name": "Width", "type": "expression" }, { "description": "Height", "name": "Height", "type": "expression" }, { "description": "Angle", "name": "Angle", "type": "expression" } ], "objectGroups": [] }, { "description": "Assign that this shadow should follow the object. The shadow will follow the position of the labeled object.", "fullName": "Assign Shadow to Object", "functionType": "Action", "group": "Object", "name": "setObjectShadow", "sentence": "Set shadow: _PARAM2_ to object: _PARAM1_ ", "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { "inverted": true, "value": "LinkedObjects::PickObjectsLinkedTo" }, "parameters": [ "", "Shadow", "Object", "" ] } ], "actions": [ { "type": { "value": "Create" }, "parameters": [ "", "Shadow", "0", "0", "Object.Layer()" ] }, { "type": { "value": "LinkedObjects::LinkObjects" }, "parameters": [ "", "Shadow", "Object" ] } ] }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { "value": "LinkedObjects::PickObjectsLinkedTo" }, "parameters": [ "", "Shadow", "Object", "" ] } ], "actions": [ { "type": { "value": "MettreAutourPos" }, "parameters": [ "Shadow", "Object.CenterX()", "Object.CenterY()", "Object.Height()/2+Object.Variable(z)", "CameraAngle()+90" ] }, { "type": { "value": "ChangePlan" }, "parameters": [ "Shadow", "=", "Object.ZOrder()-1" ] } ] } ], "parameters": [ { "description": "Shadow Target", "name": "Object", "type": "objectList" }, { "description": "Shadow Object", "name": "Shadow", "type": "objectList" } ], "objectGroups": [] }, { "description": "Change the variables X and Y from object to update the position", "fullName": "Set object position", "functionType": "Action", "group": "Object", "name": "setPosition", "sentence": "Set _PARAM1_ position X:_PARAM2_ Y:_PARAM3_ ", "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [], "actions": [ { "type": { "value": "ModVarObjet" }, "parameters": [ "Object", "x", "=", "GetArgumentAsNumber(\"X\")" ] }, { "type": { "value": "ModVarObjet" }, "parameters": [ "Object", "y", "=", "GetArgumentAsNumber(\"Y\")" ] } ] } ], "parameters": [ { "description": "Object", "name": "Object", "type": "objectList" }, { "description": "X position", "name": "X", "type": "expression" }, { "description": "Y position", "name": "Y", "type": "expression" } ], "objectGroups": [] }, { "description": "Change the variable angle from object to update the angle", "fullName": "Set object angle", "functionType": "Action", "group": "Object", "name": "setAngle", "sentence": "Set _PARAM1_ angle:_PARAM2_ _PARAM3_ ", "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { "value": "CompareArgumentAsString" }, "parameters": [ "\"Operator\"", "=", "\"=\"" ] } ], "actions": [ { "type": { "value": "ModVarObjet" }, "parameters": [ "Object", "angle", "=", "GetArgumentAsNumber(\"Angle\")" ] } ] }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { "value": "CompareArgumentAsString" }, "parameters": [ "\"Operator\"", "=", "\"+\"" ] } ], "actions": [ { "type": { "value": "ModVarObjet" }, "parameters": [ "Object", "angle", "+", "GetArgumentAsNumber(\"Angle\")" ] } ] }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { "value": "CompareArgumentAsString" }, "parameters": [ "\"Operator\"", "=", "\"-\"" ] } ], "actions": [ { "type": { "value": "ModVarObjet" }, "parameters": [ "Object", "angle", "-", "GetArgumentAsNumber(\"Angle\")" ] } ] }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { "value": "CompareArgumentAsString" }, "parameters": [ "\"Operator\"", "=", "\"*\"" ] } ], "actions": [ { "type": { "value": "ModVarObjet" }, "parameters": [ "Object", "angle", "*", "GetArgumentAsNumber(\"Angle\")" ] } ] }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { "value": "CompareArgumentAsString" }, "parameters": [ "\"Operator\"", "=", "\"/\"" ] } ], "actions": [ { "type": { "value": "ModVarObjet" }, "parameters": [ "Object", "angle", "/", "GetArgumentAsNumber(\"Angle\")" ] } ] } ], "parameters": [ { "description": "Object", "name": "Object", "type": "objectList" }, { "description": "Math operator", "name": "Operator", "supplementaryInformation": "[\"=\",\"+\",\"-\",\"*\",\"/\"]", "type": "stringWithSelector" }, { "description": "Angle", "name": "Angle", "type": "expression" } ], "objectGroups": [] }, { "description": "Change the variable z from object to update the Z axis value", "fullName": "Set object Z axis value", "functionType": "Action", "group": "Object", "name": "setZ", "sentence": "Set _PARAM1_ Z:_PARAM2_ _PARAM3_ ", "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { "value": "CompareArgumentAsString" }, "parameters": [ "\"Operator\"", "=", "\"=\"" ] } ], "actions": [ { "type": { "value": "ModVarObjet" }, "parameters": [ "Object", "z", "=", "GetArgumentAsNumber(\"Z\")" ] } ] }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { "value": "CompareArgumentAsString" }, "parameters": [ "\"Operator\"", "=", "\"+\"" ] } ], "actions": [ { "type": { "value": "ModVarObjet" }, "parameters": [ "Object", "z", "+", "GetArgumentAsNumber(\"Z\")" ] } ] }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { "value": "CompareArgumentAsString" }, "parameters": [ "\"Operator\"", "=", "\"-\"" ] } ], "actions": [ { "type": { "value": "ModVarObjet" }, "parameters": [ "Object", "z", "-", "GetArgumentAsNumber(\"Z\")" ] } ] }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { "value": "CompareArgumentAsString" }, "parameters": [ "\"Operator\"", "=", "\"*\"" ] } ], "actions": [ { "type": { "value": "ModVarObjet" }, "parameters": [ "Object", "z", "*", "GetArgumentAsNumber(\"Z\")" ] } ] }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { "value": "CompareArgumentAsString" }, "parameters": [ "\"Operator\"", "=", "\"/\"" ] } ], "actions": [ { "type": { "value": "ModVarObjet" }, "parameters": [ "Object", "z", "/", "GetArgumentAsNumber(\"Z\")" ] } ] } ], "parameters": [ { "description": "Object", "name": "Object", "type": "objectList" }, { "description": "Math operator", "name": "Operator", "supplementaryInformation": "[\"=\",\"+\",\"-\",\"*\",\"/\"]", "type": "stringWithSelector" }, { "description": "Z value", "name": "Z", "type": "expression" } ], "objectGroups": [] }, { "description": "Set object to a layer. (By number)", "fullName": "Set object layer by number", "functionType": "Action", "group": "Object", "name": "setObjectLayerNumber", "sentence": "Set object: _PARAM1_ to layer number: _PARAM2_ ", "events": [ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ "let obj = objects[0]", "let type = gdjs.PaperEngine.getLayerType(obj.getLayer())", "let number = eventsFunctionContext.getArgument(\"LayerNumber\")", "const layers = runtimeScene._layers.items", "for (const layer in layers) {", " let check = gdjs.PaperEngine.getLayerType(layer) == type &&", " gdjs.PaperEngine.getLayerNumber(layer) == number", " ", " if (check) {", " obj.setLayer(layer)", " }", "}", "", "" ], "parameterObjects": "Object", "useStrict": true, "eventsSheetExpanded": true }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [], "actions": [ { "type": { "value": "PaperEngine::setOffset" }, "parameters": [ "", "Object", "" ] } ] } ], "parameters": [ { "description": "Object", "name": "Object", "type": "objectList" }, { "description": "Layer number", "name": "LayerNumber", "type": "expression" } ], "objectGroups": [] }, { "fullName": "", "functionType": "Action", "name": "setObjectSkew", "private": true, "sentence": "update _PARAM1_ Skew", "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [], "actions": [ { "type": { "value": "SetAngle" }, "parameters": [ "Object", "=", "CameraAngle()" ] } ] }, { "colorB": 254, "colorG": 19, "colorR": 144, "creationTime": 0, "folded": true, "name": "Core javascript", "source": "", "type": "BuiltinCommonInstructions::Group", "events": [ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ "let object = objects[0]", "let pixiObject = object.getRendererObject()", "let angle = object.getVariables().get(\"angle\").getValue()", "pixiObject.skew.y = gdjs.PaperEngine.getSkew(angle)" ], "parameterObjects": "Object", "useStrict": true, "eventsSheetExpanded": false } ], "parameters": [] }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [], "actions": [ { "type": { "value": "MettreAutourPos" }, "parameters": [ "Object", "Object.Variable(x)+Object.Variable(offsetX)", "Object.Variable(y)+Object.Variable(offsetY)", "-(Object.Height()/2+(Object.Variable(z)+Object.Variable(offsetZ) )*1.5)", "CameraAngle()+90" ] } ] } ], "parameters": [ { "description": "Object", "name": "Object", "type": "objectList" } ], "objectGroups": [] }, { "description": "Set Object Offset", "fullName": "Set Object Offset", "functionType": "Action", "name": "setOffset", "private": true, "sentence": "Set _PARAM1_ Offset", "events": [ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ "let obj = objects[0]", "const checkOffset = (layer, axis) => {", " let res = obj.getVariables().get(\"offset\" + axis.toUpperCase()).getAsNumber()", " if (layer.includes(axis.toLowerCase() + \":\")) {", " let value = layer.split(\":\")[1].split(\"]\")[0]", " res = Number(value)", " }", " obj.getVariables().get(\"offset\" + axis.toUpperCase()).setNumber(res)", " // return res", "}", "let layer = obj.getLayer()", "checkOffset(layer, \"x\")", "checkOffset(layer, \"y\")", "checkOffset(layer, \"z\")" ], "parameterObjects": "Object", "useStrict": true, "eventsSheetExpanded": true } ], "parameters": [ { "description": "", "name": "Object", "type": "objectList" } ], "objectGroups": [] }, { "description": "Get distance beteween Paper Objects", "fullName": "Get distance beteween Paper Objects", "functionType": "Expression", "group": "Object", "name": "getDistance", "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ "let obj = eventsFunctionContext.getObjects(\"Object1\")[0].getVariables()", "let obj2 = eventsFunctionContext.getObjects(\"Object2\")[0].getVariables()", "", "eventsFunctionContext.returnValue = gdjs.PaperEngine.getDistance(", " obj.get(\"x\").getAsNumber(), obj.get(\"y\").getAsNumber(),", " obj2.get(\"x\").getAsNumber(), obj2.get(\"y\").getAsNumber())" ], "parameterObjects": "", "useStrict": true, "eventsSheetExpanded": true } ], "expressionType": { "type": "expression" }, "parameters": [ { "description": "Object 1", "name": "Object1", "type": "objectList" }, { "description": "Object 2", "name": "Object2", "type": "objectList" } ], "objectGroups": [] }, { "fullName": "", "functionType": "Expression", "name": "_____LAYER_____", "private": true, "sentence": "", "events": [], "expressionType": { "type": "expression" }, "parameters": [], "objectGroups": [] }, { "description": "Set camera rotate with mouse button or with touch, as well set the sensitivity.", "fullName": "Rotate Camera with Mouse/Touch", "functionType": "Action", "group": "Layer", "name": "handleCameraRotation", "sentence": "Camera rotation sensitivity: _PARAM1_ _PARAM2_", "events": [ { "colorB": 228, "colorG": 176, "colorR": 74, "creationTime": 0, "name": "Camera Rotation", "source": "", "type": "BuiltinCommonInstructions::Group", "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { "value": "BuiltinCommonInstructions::Once" }, "parameters": [] } ], "actions": [], "events": [ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ "if (window._CameraInstall) return", "window._CameraInstall = true", "window.dragging = false", "window.touchX = 0", "const normalize = (val, max, min) => (val - min) / (max - min)", "const layer = runtimeScene.getLayer()", "const canvas = runtimeScene.getRenderer().getPIXIRenderer().view", "console.log(eventsFunctionContext.getArgument(\"Button\"))", "document.addEventListener(\"mousemove\", e => {", " if (dragging) {", " let sens = parseFloat(eventsFunctionContext.getArgument(\"Sensitivity\")) / 10", " let r = layer.getCameraRotation()", " layer.setCameraRotation(r + sens * e.movementX)", " }", "}, false)", "", "document.addEventListener(\"touchmove\", e => {", " if (dragging) {", " let sens = parseFloat(eventsFunctionContext.getArgument(\"Sensitivity\")) / 10", " let r = layer.getCameraRotation()", " let touch = e.touches[0]", " if (touchX == 0) {", " console.log(\"touch start\", touch.clientX)", " touchX = touch.clientX", " } else {", " let value = touchX - touch.clientX > 0 ? 15 : -15", " console.log(value)", " layer.setCameraRotation(r + sens * value)", " }", " touchX = touch.clientX", " // ", " }", "}, false)", "", "" ], "parameterObjects": "", "useStrict": true, "eventsSheetExpanded": true } ] }, { "folded": true, "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { "value": "MouseButtonPressed" }, "parameters": [ "", "Left" ] }, { "type": { "value": "CompareArgumentAsString" }, "parameters": [ "\"Button\"", "=", "\"Left\"" ] } ], "actions": [], "events": [ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ "var canvas = runtimeScene.getRenderer().getPIXIRenderer().view", "canvas.requestPointerLock()", "window.dragging = true" ], "parameterObjects": "", "useStrict": true, "eventsSheetExpanded": false } ] }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { "inverted": true, "value": "MouseButtonPressed" }, "parameters": [ "", "Left" ] }, { "type": { "value": "CompareArgumentAsString" }, "parameters": [ "\"Button\"", "=", "\"Left\"" ] } ], "actions": [], "events": [ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ "document.exitPointerLock()", "window.dragging = false", "window.touchX = 0", "" ], "parameterObjects": "", "useStrict": true, "eventsSheetExpanded": false } ] }, { "folded": true, "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { "value": "MouseButtonPressed" }, "parameters": [ "", "Middle" ] }, { "type": { "value": "CompareArgumentAsString" }, "parameters": [ "\"Button\"", "=", "\"Middle\"" ] } ], "actions": [], "events": [ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ "var canvas = runtimeScene.getRenderer().getPIXIRenderer().view", "canvas.requestPointerLock()", "window.dragging = true" ], "parameterObjects": "", "useStrict": true, "eventsSheetExpanded": false } ] }, { "folded": true, "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { "inverted": true, "value": "MouseButtonPressed" }, "parameters": [ "", "Middle" ] }, { "type": { "value": "CompareArgumentAsString" }, "parameters": [ "\"Button\"", "=", "\"Middle\"" ] } ], "actions": [], "events": [ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ "document.exitPointerLock()", "window.dragging = false" ], "parameterObjects": "", "useStrict": true, "eventsSheetExpanded": false } ] }, { "folded": true, "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { "value": "MouseButtonPressed" }, "parameters": [ "", "Right" ] }, { "type": { "value": "CompareArgumentAsString" }, "parameters": [ "\"Button\"", "=", "\"Right\"" ] } ], "actions": [], "events": [ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ "var canvas = runtimeScene.getRenderer().getPIXIRenderer().view", "canvas.requestPointerLock()", "window.dragging = true" ], "parameterObjects": "", "useStrict": true, "eventsSheetExpanded": false } ] }, { "folded": true, "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { "inverted": true, "value": "MouseButtonPressed" }, "parameters": [ "", "Right" ] }, { "type": { "value": "CompareArgumentAsString" }, "parameters": [ "\"Button\"", "=", "\"Right\"" ] } ], "actions": [], "events": [ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ "document.exitPointerLock()", "window.dragging = false" ], "parameterObjects": "", "useStrict": true, "eventsSheetExpanded": false } ] } ], "parameters": [] } ], "parameters": [ { "description": "Sensitivity", "name": "Sensitivity", "type": "expression" }, { "description": "Mouse button (use Left for touch)", "name": "Button", "type": "mouse" } ], "objectGroups": [] }, { "description": "Normalize layer to non 3D scale", "fullName": "Normalize Layer to non 3D scale", "functionType": "Action", "group": "Layer", "name": "normalizeLayer", "sentence": "Normalize layer: _PARAM1_", "events": [ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ "let layer = runtimeScene.getLayer(eventsFunctionContext.getArgument(\"Layer\"))", "let pixiContainer = layer._renderer._pixiContainer", "", "if (layer._renderer._isLightingLayer) {", " // layer._renderer._lightingSprite.scale.y = 2", " // ", " layer._renderer._lightingSprite.pivot.y = -layer.getCameraHeight() / 4", " window.L = layer._renderer", " // layer._renderer._lightingSprite.height = 720*2", " // layer._renderer._lightingSprite.y = -(720*2)/4", " // console.log(layer._renderer._lightingSprite)", " // pixiContainer.height = 720*2", "} else {", " pixiContainer.scale.y = 2", " pixiContainer.pivot.y = layer.getCameraHeight() / 4", "}", "// _lightingSprite", "if (false) {", " const normalize = (val, max, min) => (val - min) / (max - min)", " let ISOMETRIC = runtimeScene.getVariables().get(\"CAMERA_STACK\").getValue() == 1 ? true : false", " let layer = runtimeScene.getLayer(eventsFunctionContext.getArgument(\"Layer\"))", " let pixiContainer = layer._renderer._pixiContainer", " const angle = -gdjs.toRad(layer.getCameraRotation())", "", " if (ISOMETRIC) {", " pixiContainer.scale.y = 2", " pixiContainer.pivot.y = layer.getCameraHeight() / 4", " }", "}", "if (false) {", " let rot = runtimeScene.getLayer().getCameraRotation() % 360", " if (rot < 0) rot = rot + 360", " // let an = gdjs.toRad(rot)", " // an = normalize(an, Math.PI, 0)", " rot = parseFloat(normalize(rot, 360, 0))", "", " let zoom = layer.getCameraZoom()", " let zoomFactor = zoom //- (zoom * rot) ", " let zoomFactory = zoom //- (zoom * rot / 2) ", "", " pixiContainer.scale.x = zoomFactor //+ (zoomFactor * an);", " pixiContainer.scale.y = zoomFactory //+ (zoomFactory * an);", " const cosValue = Math.cos(angle);", " const sinValue = Math.sin(angle);", " const centerX =", " layer.getCameraX() * zoomFactor * cosValue -", " layer.getCameraY() * zoomFactory * sinValue;", " const centerY =", " layer.getCameraX() * zoomFactor * sinValue +", " layer.getCameraY() * zoomFactory * cosValue;", "", " pixiContainer.position.x = -centerX;", " pixiContainer.position.y = -centerY;", " pixiContainer.position.x += layer.getWidth() / 2;", " pixiContainer.position.y += layer.getHeight() / 2;", "}", "" ], "parameterObjects": "", "useStrict": true, "eventsSheetExpanded": true } ], "parameters": [ { "description": "Layer", "name": "Layer", "type": "layer" } ], "objectGroups": [] }, { "description": "Get object layer number", "fullName": "Get layer number", "functionType": "Expression", "group": "Layer", "name": "getObjectLayerNumber", "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ "let obj = objects[0]", "eventsFunctionContext.returnValue = gdjs.PaperEngine.getLayerNumber(obj.getLayer())", "" ], "parameterObjects": "obj", "useStrict": true, "eventsSheetExpanded": false } ], "expressionType": { "type": "expression" }, "parameters": [ { "description": "Object", "name": "obj", "type": "objectList" } ], "objectGroups": [] }, { "description": "Get data from layer ", "fullName": "Get data", "functionType": "StringExpression", "group": "Layer", "name": "getLayerData", "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ "let layer = eventsFunctionContext.getArgument(\"Layer\")", "let data = eventsFunctionContext.getArgument(\"Data\")", "eventsFunctionContext.returnValue = gdjs.PaperEngine.getLayerData(layer, data)" ], "parameterObjects": "", "useStrict": true, "eventsSheetExpanded": false } ], "expressionType": { "type": "string" }, "parameters": [ { "description": "Layer", "name": "Layer", "type": "layer" }, { "description": "Data", "name": "Data", "type": "string" } ], "objectGroups": [] }, { "description": "Follow base layer", "fullName": "Follow base layer", "functionType": "Action", "group": "Layer", "name": "setFollowBaseLayer", "sentence": "Set _PARAM1_ to follow base layer", "events": [ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": "runtimeScene.getLayer(eventsFunctionContext.getArgument(\"Layer\")).followBaseLayer(true)", "parameterObjects": "", "useStrict": true, "eventsSheetExpanded": false } ], "parameters": [ { "description": "Layer", "name": "Layer", "type": "layer" } ], "objectGroups": [] } ], "eventsBasedBehaviors": [ { "description": "Variables:\n[ z ] Z axis value (ex: 100, -20) |\n[ x ] real X position |\n[ y ] real Y position | \nmodify x, y value to move projected sprite", "fullName": "Project Sprite", "name": "Project", "objectType": "Sprite", "eventsFunctions": [ { "fullName": "", "functionType": "Action", "name": "doStepPreEvents", "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ "let obj = objects[0]", "gdjs.PaperEngine.setXYSort(obj)" ], "parameterObjects": "Object", "useStrict": true, "eventsSheetExpanded": false }, { "folded": true, "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { "value": "ObjectVariableAsBoolean" }, "parameters": [ "Object", "planeInit", "" ] } ], "actions": [ { "type": { "value": "SetObjectVariableAsBoolean" }, "parameters": [ "Object", "planeInit", "True" ] } ], "events": [ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ "let obj = objects[0]", "// x/2 , y full", "obj._animationFrame.points.put(\"Point\", {", " x: (obj.getWidth() / obj.getScaleX()) / 2,", " y: obj.getHeight() / obj.getScaleY() ", "})" ], "parameterObjects": "Object", "useStrict": true, "eventsSheetExpanded": false }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [], "actions": [ { "type": { "value": "ModVarObjet" }, "parameters": [ "Object", "y", "=", "Object.PointY(\"Point\")" ] }, { "type": { "value": "ModVarObjet" }, "parameters": [ "Object", "x", "=", "Object.PointX(\"Point\")" ] }, { "type": { "value": "ChangeWidth" }, "parameters": [ "Object", "+", "0.1" ] } ] }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [], "actions": [ { "type": { "value": "ModVarObjet" }, "parameters": [ "Object", "angle", "=", "-Object.Angle()" ] }, { "type": { "value": "PaperEngine::setOffset" }, "parameters": [ "", "Object", "" ] } ] }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { "inverted": true, "value": "PaperEngine::Project::PropertyFollow" }, "parameters": [ "Object", "Behavior" ] } ], "actions": [ { "type": { "value": "ChangeScaleHeight" }, "parameters": [ "Object", "*", "1.5" ] } ] }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { "value": "PaperEngine::Project::PropertyFollow" }, "parameters": [ "Object", "Behavior" ] } ], "actions": [ { "type": { "value": "ChangeScaleHeight" }, "parameters": [ "Object", "*", "1.75" ] } ] } ] }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [], "actions": [ { "type": { "value": "PaperEngine::setObjectSkew" }, "parameters": [ "", "Object", "" ] } ] }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { "value": "PaperEngine::Project::PropertyFollow" }, "parameters": [ "Object", "Behavior" ] } ], "actions": [ { "type": { "value": "ModVarObjet" }, "parameters": [ "Object", "angle", "=", "-CameraAngle()" ] } ] } ], "parameters": [ { "description": "Object", "name": "Object", "supplementaryInformation": "Sprite", "type": "object" }, { "description": "Behavior", "name": "Behavior", "supplementaryInformation": "PaperEngine::Project", "type": "behavior" } ], "objectGroups": [] }, { "fullName": "", "functionType": "Action", "name": "doStepPostEvents", "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [], "actions": [ { "type": { "value": "PaperEngine::setObjectSkew" }, "parameters": [ "", "Object", "" ] } ] } ], "parameters": [ { "description": "Object", "name": "Object", "supplementaryInformation": "Sprite", "type": "object" }, { "description": "Behavior", "name": "Behavior", "supplementaryInformation": "PaperEngine::Project", "type": "behavior" } ], "objectGroups": [] }, { "description": "Update position", "fullName": "Update position", "functionType": "Action", "name": "updatePosition", "private": true, "sentence": "Update position _PARAM0_", "events": [ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ "let obj = objects[0]", "// x/2 , y full", "obj._animationFrame.points.put(\"Point\", {", " x: (obj.getWidth() / obj.getScaleX()) / 2,", " y: obj.getHeight() / obj.getScaleY() ", "})" ], "parameterObjects": "Object", "useStrict": true, "eventsSheetExpanded": false }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [], "actions": [ { "type": { "value": "ModVarObjet" }, "parameters": [ "Object", "x", "=", "Object.PointX(\"Point\")" ] }, { "type": { "value": "ModVarObjet" }, "parameters": [ "Object", "y", "=", "Object.PointY(\"Point\")" ] } ] } ], "parameters": [ { "description": "Object", "name": "Object", "supplementaryInformation": "Sprite", "type": "object" }, { "description": "Behavior", "name": "Behavior", "supplementaryInformation": "PaperEngine::Project", "type": "behavior" } ], "objectGroups": [] }, { "description": "Set object position. The point of origin is at the center bottom", "fullName": "Set object position", "functionType": "Action", "group": "Paper Engine", "name": "setPosition", "sentence": "Set _PARAM0_ position X:_PARAM2_ Y:_PARAM3_", "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [], "actions": [ { "type": { "value": "PaperEngine::setPosition" }, "parameters": [ "", "Object", "GetArgumentAsNumber(\"X\")", "GetArgumentAsNumber(\"Y\")", "" ] } ] } ], "parameters": [ { "description": "Object", "name": "Object", "supplementaryInformation": "Sprite", "type": "object" }, { "description": "Behavior", "name": "Behavior", "supplementaryInformation": "PaperEngine::Project", "type": "behavior" }, { "description": "X position", "name": "X", "type": "expression" }, { "description": "Y position", "name": "Y", "type": "expression" } ], "objectGroups": [] }, { "description": "Change the variable angle from object to update the angle", "fullName": "Set object angle", "functionType": "Action", "group": "Paper Engine", "name": "setAngle", "sentence": "Set _PARAM0_ angle:_PARAM2_ _PARAM3_ ", "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [], "actions": [ { "type": { "value": "PaperEngine::setAngle" }, "parameters": [ "", "Object", "GetArgumentAsString(\"Operator\")", "GetArgumentAsNumber(\"Angle\")", "" ] } ] } ], "parameters": [ { "description": "Object", "name": "Object", "supplementaryInformation": "Sprite", "type": "object" }, { "description": "Behavior", "name": "Behavior", "supplementaryInformation": "PaperEngine::Project", "type": "behavior" }, { "description": "Operator", "name": "Operator", "supplementaryInformation": "[\"=\",\"+\",\"-\",\"*\",\"/\"]", "type": "stringWithSelector" }, { "description": "Angle", "name": "Angle", "type": "expression" } ], "objectGroups": [] }, { "description": "Change the variable z from object to update the Z axis value", "fullName": "Set object Z axis value", "functionType": "Action", "group": "Paper Engine", "name": "setZ", "sentence": "Set _PARAM0_ Z:_PARAM2_ _PARAM3_ ", "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [], "actions": [ { "type": { "value": "PaperEngine::setZ" }, "parameters": [ "", "Object", "GetArgumentAsString(\"Operator\")", "GetArgumentAsNumber(\"Z\")", "" ] } ] } ], "parameters": [ { "description": "Object", "name": "Object", "supplementaryInformation": "Sprite", "type": "object" }, { "description": "Behavior", "name": "Behavior", "supplementaryInformation": "PaperEngine::Project", "type": "behavior" }, { "description": "Operator", "name": "Operator", "supplementaryInformation": "[\"=\",\"+\",\"-\",\"*\",\"/\"]", "type": "stringWithSelector" }, { "description": "Angle", "name": "Z", "type": "expression" } ], "objectGroups": [] } ], "propertyDescriptors": [ { "value": "X", "type": "Choice", "label": "Axis projection (X or Y)", "description": "", "group": "", "extraInformation": [ "X", "Y" ], "hidden": true, "name": "Axis" }, { "value": "", "type": "Boolean", "label": "Follow camera angle", "description": "Follow camera angle", "group": "", "extraInformation": [], "hidden": false, "name": "Follow" } ], "sharedPropertyDescriptors": [] }, { "description": "", "fullName": "", "name": "Wall", "objectType": "Sprite", "eventsFunctions": [ { "description": "Set object to mirror a texture, and set a width (px)", "fullName": "Set mirror texture", "functionType": "Action", "group": "Paper Engine", "name": "setMirrorTexture", "sentence": "Set object: _PARAM0_ to mirror texture: _PARAM2_ with width: _PARAM4_", "events": [ { "folded": true, "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { "value": "BuiltinCommonInstructions::Once" }, "parameters": [] } ], "actions": [], "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [], "actions": [ { "type": { "value": "ModVarObjet" }, "parameters": [ "Object", "slice", "=", "0" ] }, { "type": { "value": "ModVarObjet" }, "parameters": [ "Object", "size", "=", "GetArgumentAsNumber(\"Width\")" ] } ] }, { "folded": true, "infiniteLoopWarning": true, "type": "BuiltinCommonInstructions::While", "whileConditions": [ { "type": { "value": "BuiltinCommonInstructions::CompareNumbers" }, "parameters": [ "Object.Width()", ">", "Object.Variable(slice)" ] } ], "conditions": [], "actions": [], "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [], "actions": [ { "type": { "value": "Create" }, "parameters": [ "", "Texture", "0", "0", "Object.Layer()" ] }, { "type": { "value": "LinkedObjects::LinkObjects" }, "parameters": [ "", "Object", "Texture" ] } ] }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { "value": "ObjectVariableAsBoolean" }, "parameters": [ "Texture", "init", "" ] }, { "type": { "value": "LinkedObjects::PickObjectsLinkedTo" }, "parameters": [ "", "Texture", "Object", "" ] } ], "actions": [ { "type": { "value": "SetObjectVariableAsBoolean" }, "parameters": [ "Texture", "init", "True" ] }, { "type": { "value": "ModVarObjet" }, "parameters": [ "Texture", "index", "=", "Object.Variable(slice)" ] }, { "type": { "value": "ModVarObjetTxt" }, "parameters": [ "Texture", "type", "=", "\"bottom\"" ] } ] }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [], "actions": [ { "type": { "value": "Create" }, "parameters": [ "", "Texture", "0", "0", "Object.Layer()" ] }, { "type": { "value": "LinkedObjects::LinkObjects" }, "parameters": [ "", "Object", "Texture" ] } ] }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { "value": "ObjectVariableAsBoolean" }, "parameters": [ "Texture", "init", "" ] }, { "type": { "value": "LinkedObjects::PickObjectsLinkedTo" }, "parameters": [ "", "Texture", "Object", "" ] } ], "actions": [ { "type": { "value": "SetObjectVariableAsBoolean" }, "parameters": [ "Texture", "init", "True" ] }, { "type": { "value": "ModVarObjet" }, "parameters": [ "Texture", "index", "=", "Object.Variable(slice)" ] }, { "type": { "value": "ModVarObjetTxt" }, "parameters": [ "Texture", "type", "=", "\"top\"" ] } ] }, { "type": "BuiltinCommonInstructions::Comment", "color": { "b": 109, "g": 230, "r": 255, "textB": 0, "textG": 0, "textR": 0 }, "comment": "" }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [], "actions": [ { "type": { "value": "ModVarObjet" }, "parameters": [ "Object", "slice", "+", "GetArgumentAsNumber(\"Width\")" ] } ] } ] }, { "colorB": 228, "colorG": 176, "colorR": 74, "creationTime": 0, "folded": true, "name": "", "source": "", "type": "BuiltinCommonInstructions::Group", "events": [ { "disabled": true, "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { "value": "ObjectVariableAsBoolean" }, "parameters": [ "Texture", "init", "" ] } ], "actions": [ { "type": { "value": "SetObjectVariableAsBoolean" }, "parameters": [ "Texture", "init", "True" ] }, { "type": { "value": "ModVarObjetTxt" }, "parameters": [ "Texture", "id", "=", "\"top\"" ] } ] }, { "disabled": true, "type": "BuiltinCommonInstructions::Standard", "conditions": [], "actions": [ { "type": { "value": "Create" }, "parameters": [ "", "Texture", "0", "0", "Object.Layer()" ] }, { "type": { "value": "LinkedObjects::LinkObjects" }, "parameters": [ "", "Object", "Texture" ] } ] }, { "disabled": true, "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { "value": "ObjectVariableAsBoolean" }, "parameters": [ "Texture", "init", "" ] } ], "actions": [ { "type": { "value": "SetObjectVariableAsBoolean" }, "parameters": [ "Texture", "init", "True" ] }, { "type": { "value": "ModVarObjetTxt" }, "parameters": [ "Texture", "id", "=", "\"left\"" ] } ] }, { "disabled": true, "type": "BuiltinCommonInstructions::Standard", "conditions": [], "actions": [ { "type": { "value": "Create" }, "parameters": [ "", "Texture", "0", "0", "Object.Layer()" ] }, { "type": { "value": "LinkedObjects::LinkObjects" }, "parameters": [ "", "Object", "Texture" ] } ] }, { "disabled": true, "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { "value": "ObjectVariableAsBoolean" }, "parameters": [ "Texture", "init", "" ] } ], "actions": [ { "type": { "value": "SetObjectVariableAsBoolean" }, "parameters": [ "Texture", "init", "True" ] }, { "type": { "value": "ModVarObjetTxt" }, "parameters": [ "Texture", "id", "=", "\"right\"" ] } ] } ], "parameters": [] } ] }, { "folded": true, "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { "value": "LinkedObjects::PickObjectsLinkedTo" }, "parameters": [ "", "Texture", "Object", "" ] } ], "actions": [], "events": [ { "folded": true, "type": "BuiltinCommonInstructions::ForEach", "object": "Texture", "conditions": [], "actions": [ { "type": { "value": "ModVarObjet" }, "parameters": [ "Object", "index", "=", "Texture.Variable(index)" ] } ], "events": [ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ "let obj = objects[0]", "// x/2 , y full", "let size = obj.getVariables().get(\"size\").getAsNumber()", "let index = obj.getVariables().get(\"index\").getAsNumber()", "let slice = index + (size / 2)", "", "obj._animationFrame.points.put(\"bottom\", {", " x: slice / obj.getScaleX(),", " y: obj.getHeight() / obj.getScaleY()", "})", "", "obj._animationFrame.points.put(\"top\", {", " x: slice / obj.getScaleX(),", " y: 0", "})", "", "obj._animationFrame.points.put(\"left\", {", " x: 0,", " y: (obj.getHeight() / obj.getScaleY()) / 2", "})", "", "obj._animationFrame.points.put(\"right\", {", " x: slice,", " y: (obj.getHeight() / obj.getScaleY()) / 2", "})" ], "parameterObjects": "Object", "useStrict": true, "eventsSheetExpanded": true }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [], "actions": [ { "type": { "value": "ChangeLayer" }, "parameters": [ "Texture", "Object.Layer()" ] }, { "type": { "value": "ModVarObjet" }, "parameters": [ "Texture", "angle", "=", "-Object.Angle()" ] }, { "type": { "value": "ModVarObjet" }, "parameters": [ "Texture", "x", "=", "Object.PointX(Texture.VariableString(type))" ] }, { "type": { "value": "ModVarObjet" }, "parameters": [ "Texture", "y", "=", "Object.PointY(Texture.VariableString(type))" ] } ] } ] } ] }, { "colorB": 228, "colorG": 176, "colorR": 74, "creationTime": 0, "folded": true, "name": "Javascript", "source": "", "type": "BuiltinCommonInstructions::Group", "events": [ { "disabled": true, "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ "let obj = objects[0]", "// x/2 , y full", "obj._animationFrame.points.put(\"bottom\", {", " x: (obj.getWidth() / obj.getScaleX()) / 2,", " y: obj.getHeight() / obj.getScaleY()", "})", "", "obj._animationFrame.points.put(\"top\", {", " x: (obj.getWidth() / obj.getScaleX()) / 2,", " y: 0", "})", "", "obj._animationFrame.points.put(\"left\", {", " x: 0,", " y: (obj.getHeight() / obj.getScaleY()) / 2", "})", "", "obj._animationFrame.points.put(\"right\", {", " x: (obj.getWidth() / obj.getScaleX()),", " y: (obj.getHeight() / obj.getScaleY()) / 2", "})" ], "parameterObjects": "Object", "useStrict": true, "eventsSheetExpanded": false } ], "parameters": [] }, { "disabled": true, "folded": true, "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { "value": "LinkedObjects::PickObjectsLinkedTo" }, "parameters": [ "", "Texture", "Object", "" ] } ], "actions": [ { "type": { "value": "ChangeLayer" }, "parameters": [ "Texture", "Object.Layer()" ] }, { "type": { "value": "ModVarObjet" }, "parameters": [ "Texture", "x", "=", "Object.PointX(Texture.VariableString(id))" ] }, { "type": { "value": "ModVarObjet" }, "parameters": [ "Texture", "y", "=", "Object.PointY(Texture.VariableString(id))" ] }, { "type": { "value": "ModVarObjet" }, "parameters": [ "Texture", "angle", "=", "-Object.Angle()" ] }, { "type": { "value": "TiledSpriteObject::Width" }, "parameters": [ "Texture", "=", "Object.Width()" ] } ], "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { "value": "VarObjetTxt" }, "parameters": [ "Texture", "id", "=", "\"top\"" ] } ], "actions": [ { "type": { "value": "ModVarObjet" }, "parameters": [ "Texture", "angle", "=", "-Object.Angle()-180" ] } ] }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { "value": "VarObjetTxt" }, "parameters": [ "Texture", "id", "=", "\"left\"" ] } ], "actions": [ { "type": { "value": "TiledSpriteObject::Width" }, "parameters": [ "Texture", "=", "Object.Height()" ] }, { "type": { "value": "ModVarObjet" }, "parameters": [ "Texture", "angle", "=", "-Object.Angle()-90" ] } ] }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { "value": "VarObjetTxt" }, "parameters": [ "Texture", "id", "=", "\"right\"" ] } ], "actions": [ { "type": { "value": "TiledSpriteObject::Width" }, "parameters": [ "Texture", "=", "Object.Height()" ] }, { "type": { "value": "ModVarObjet" }, "parameters": [ "Texture", "angle", "=", "-Object.Angle()+90" ] } ] } ] } ], "parameters": [ { "description": "Object", "name": "Object", "supplementaryInformation": "Sprite", "type": "object" }, { "description": "Behavior", "name": "Behavior", "supplementaryInformation": "PaperEngine::Wall", "type": "behavior" }, { "description": "Texture", "name": "Texture", "supplementaryInformation": "Sprite", "type": "objectList" }, { "description": "Project Tiled Sprite", "name": "TxTBehavior", "supplementaryInformation": "PaperEngine::Project", "type": "behavior" }, { "description": "Width", "name": "Width", "type": "string" } ], "objectGroups": [] }, { "fullName": "", "functionType": "Action", "name": "doStepPreEvents", "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [], "actions": [] } ], "parameters": [ { "description": "Object", "name": "Object", "supplementaryInformation": "Sprite", "type": "object" }, { "description": "Behavior", "name": "Behavior", "supplementaryInformation": "PaperEngine::Wall", "type": "behavior" } ], "objectGroups": [] } ], "propertyDescriptors": [], "sharedPropertyDescriptors": [] }, { "description": "Set zOrder based on XY center position and camera angle", "fullName": "Sort object by XY", "name": "XYSort", "objectType": "", "private": true, "eventsFunctions": [ { "fullName": "", "functionType": "Action", "name": "doStepPreEvents", "sentence": "", "events": [ { "folded": true, "type": "BuiltinCommonInstructions::Standard", "conditions": [], "actions": [], "events": [ { "disabled": true, "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ "let _o = objects[0] // GD object", "let __o = _o.getRendererObject() // Pixi Object", "let layer = runtimeScene.getLayer()", "", "let obj = objects[0]", "", "", "let x2 = runtimeScene.getVariables().get(\"_armX\").getValue()", "let y2 = runtimeScene.getVariables().get(\"_armY\").getValue()", "let rotation = layer.getCameraRotation() + 90", "", "let rmZ = Number(_o.getVariables().get(\"z\").getAsNumber() + _o.getVariables().get(\"offsetZ\").getAsNumber()) || 0 ", "console.log(rmZ)", "//remove z", "let distance = _o.getDistanceToPosition(x2, y2) + rmZ", "", "let x = _o.getXFromAngleAndDistance(rotation, _o.getHeight() / 2) - x2", "let y = _o.getYFromAngleAndDistance(rotation, _o.getHeight() / 2) - y2", "let dis = Math.sqrt(x * x + y * y)", "", "let tempz = y2 - _o.getYFromAngleAndDistance(rotation, _o.getHeight() / 2)", "let angle = runtimeScene.getVariables().get(\"camAngle\").getValue()", "// if(angle > 180)", "// _o.setZOrder(tempz)", "// else", "_o.setZOrder(tempz)", "// console.log( y2 - _o.getYFromAngleAndDistance(rotation, _o.getHeight()/2) )", "", "_o.getVariables().get(\"X\").setNumber(_o.getXFromAngleAndDistance(rotation, _o.getHeight() / 2))", "_o.getVariables().get(\"Y\").setNumber(_o.getYFromAngleAndDistance(rotation, _o.getHeight() / 2))", "", "/*", " The max", "*/", "let max = _o.getAABB().max", "let _x = max[0] - x2;", "let _y = max[1] - y2;", "let _dis = Math.sqrt(_x * _x + _y * _y)", "if (_dis < distance && false) {", " _o.getVariables().get(\"X\").setNumber(max[0])", " _o.getVariables().get(\"Y\").setNumber(max[1])", " _o.setZOrder(_dis * -1)", "}", "", "/*", " The min", "*/", "let min = _o.getAABB().min", "let __x = min[0] - x2", "let __y = min[1] - y2", "let __dis = Math.sqrt(__x * __x + __y * __y)", "if (__dis < _dis && false) {", " _o.getVariables().get(\"X\").setNumber(min[0])", " _o.getVariables().get(\"Y\").setNumber(min[1])", " _o.setZOrder(__dis * -1)", "}", "", "", "// console.log( \"--\" )", "// console.log( distance )", "// console.log( _dis , (_dis > distance))", "// console.log( __dis )", "// console.log( _o.zOrder )", "", "", "", "" ], "parameterObjects": "Object", "useStrict": true, "eventsSheetExpanded": true } ] }, { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ "// let _o = objects[0] // GD object", "// let __o = _o.getRendererObject() // Pixi Object", "let layer = runtimeScene.getLayer()", "", "let r = 2000", "let rotation = layer.getCameraRotation() + 90", "let rot = gdjs.toRad(rotation)", "", "let dx = r * Math.cos(rot);", "let dy = r * Math.sin(rot);", "let obj = objects[0]", "", "let x2 = layer.getCameraX() + dx", "let y2 = layer.getCameraY() + dy", "let rmZ = parseFloat(obj.getVariables().get(\"z\").getValue() + obj.getVariables().get(\"offsetZ\").getAsNumber()) || 0 ", "// console.log(obj.getVariables().get(\"offsetZ\").getAsNumber())", "//remove z", "let distance = obj.getDistanceToPosition(x2, y2) + rmZ", "", "let x = obj.getXFromAngleAndDistance(rotation, obj.getHeight() / 2) - x2", "let y = obj.getYFromAngleAndDistance(rotation, obj.getHeight() / 2) - y2", "let dis = Math.sqrt(x * x + y * y)", "obj.setZOrder((dis * -1) + rmZ)", "" ], "parameterObjects": "Object", "useStrict": true, "eventsSheetExpanded": false } ], "parameters": [ { "description": "Object", "name": "Object", "type": "object" }, { "description": "Behavior", "name": "Behavior", "supplementaryInformation": "PaperEngine::XYSort", "type": "behavior" } ], "objectGroups": [] } ], "propertyDescriptors": [], "sharedPropertyDescriptors": [] }, { "description": "Variables:\n[ z ] Z axis value (ex: 100, -20) |\n[ x ] real X position |\n[ y ] real Y position | \nmodify x, y value to move the tile", "fullName": "Project Tile", "name": "ProjectTile", "objectType": "", "eventsFunctions": [ { "fullName": "", "functionType": "Action", "name": "doStepPreEvents", "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ "let obj = objects[0]", "gdjs.PaperEngine.setXYSort(obj)", "if (!obj.getVariables().has(\"x\")) {", " obj.getVariables().get(\"x\").setNumber(obj.getCenterXInScene())", " obj.getVariables().get(\"y\").setNumber(obj.getCenterYInScene())", "}" ], "parameterObjects": "Object", "useStrict": true, "eventsSheetExpanded": false }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [], "actions": [ { "type": { "value": "PaperEngine::setOffset" }, "parameters": [ "", "Object", "" ] }, { "type": { "value": "MettreAutourPos" }, "parameters": [ "Object", "Object.Variable(x)+Object.Variable(offsetX)", "Object.Variable(y)+Object.Variable(offsetY)", "(Object.Variable(z)+Object.Variable(offsetZ))*1.5", "CameraAngle()-90" ] } ] }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [], "actions": [] } ], "parameters": [ { "description": "Object", "name": "Object", "type": "object" }, { "description": "Behavior", "name": "Behavior", "supplementaryInformation": "PaperEngine::ProjectTile", "type": "behavior" } ], "objectGroups": [] }, { "fullName": "", "functionType": "Action", "name": "doStepPostEvents", "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ "let obj = objects[0]", "if (!obj.getVariables().has(\"x\")) {", " obj.getVariables().get(\"x\").setNumber(obj.getCenterXInScene())", " obj.getVariables().get(\"y\").setNumber(obj.getCenterYInScene())", "}" ], "parameterObjects": "Object", "useStrict": true, "eventsSheetExpanded": false }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [], "actions": [ { "type": { "value": "PaperEngine::setOffset" }, "parameters": [ "", "Object", "" ] }, { "type": { "value": "MettreAutourPos" }, "parameters": [ "Object", "Object.Variable(x)+Object.Variable(offsetX)", "Object.Variable(y)+Object.Variable(offsetY)", "(Object.Variable(z)+Object.Variable(offsetZ))*1.5", "CameraAngle()-90" ] } ] } ], "parameters": [ { "description": "Object", "name": "Object", "type": "object" }, { "description": "Behavior", "name": "Behavior", "supplementaryInformation": "PaperEngine::ProjectTile", "type": "behavior" } ], "objectGroups": [] }, { "description": "Set object position. The point of origin is at the center bottom", "fullName": "Set object position", "functionType": "Action", "group": "Paper Engine", "name": "setPosition", "sentence": "Set _PARAM0_ position X:_PARAM2_ Y:_PARAM3_", "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [], "actions": [ { "type": { "value": "PaperEngine::setPosition" }, "parameters": [ "", "Object", "GetArgumentAsNumber(\"X\")", "GetArgumentAsNumber(\"Y\")", "" ] } ] } ], "parameters": [ { "description": "Object", "name": "Object", "type": "object" }, { "description": "Behavior", "name": "Behavior", "supplementaryInformation": "PaperEngine::ProjectTile", "type": "behavior" }, { "description": "X position", "name": "X", "type": "expression" }, { "description": "Y position", "name": "Y", "type": "expression" } ], "objectGroups": [] }, { "description": "Change the variable angle from object to update the angle", "fullName": "Set object angle", "functionType": "Action", "group": "Paper Engine", "name": "setAngle", "sentence": "Set _PARAM0_ angle:_PARAM2_ _PARAM3_ ", "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [], "actions": [ { "type": { "value": "PaperEngine::setAngle" }, "parameters": [ "", "Object", "GetArgumentAsString(\"Operator\")", "GetArgumentAsNumber(\"Angle\")", "" ] } ] } ], "parameters": [ { "description": "Object", "name": "Object", "type": "object" }, { "description": "Behavior", "name": "Behavior", "supplementaryInformation": "PaperEngine::ProjectTile", "type": "behavior" }, { "description": "Operator", "name": "Operator", "supplementaryInformation": "[\"=\",\"+\",\"-\",\"*\",\"/\"]", "type": "stringWithSelector" }, { "description": "Angle", "name": "Angle", "type": "expression" } ], "objectGroups": [] }, { "description": "Change the variable z from object to update the Z axis value", "fullName": "Set object Z axis value", "functionType": "Action", "group": "Paper Engine", "name": "setZ", "sentence": "Set _PARAM0_ Z:_PARAM2_ _PARAM3_ ", "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [], "actions": [ { "type": { "value": "PaperEngine::setZ" }, "parameters": [ "", "Object", "GetArgumentAsString(\"Operator\")", "GetArgumentAsNumber(\"Z\")", "" ] } ] } ], "parameters": [ { "description": "Object", "name": "Object", "type": "object" }, { "description": "Behavior", "name": "Behavior", "supplementaryInformation": "PaperEngine::ProjectTile", "type": "behavior" }, { "description": "Operator", "name": "Operator", "supplementaryInformation": "[\"=\",\"+\",\"-\",\"*\",\"/\"]", "type": "stringWithSelector" }, { "description": "Z", "name": "Z", "type": "expression" } ], "objectGroups": [] } ], "propertyDescriptors": [], "sharedPropertyDescriptors": [] }, { "description": "", "fullName": "", "name": "ProjectPreRenderSprite", "objectType": "Sprite", "eventsFunctions": [ { "fullName": "", "functionType": "Action", "name": "doStepPreEvents", "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [], "actions": [ { "type": { "value": "PauseAnimation" }, "parameters": [ "Object" ] } ] }, { "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ "let obj = objects[0]", "let sides = obj.getBehavior(\"ProjectPreRenderSprite\")._behaviorData.Sides", "let size = -(360 / sides)", "let cameraAngle = runtimeScene.getLayer().getCameraRotation()", "cameraAngle = cameraAngle % 360", "cameraAngle = cameraAngle < 0 ? cameraAngle + 360 : cameraAngle //normalize rotation", "let quad = parseInt(cameraAngle % 360 / size)", "cameraAngle = cameraAngle % size", "", "//normalize rotation by quad", "obj.getVariables().get(\"quad\").setNumber(quad ? quad + (sides - 1) : 0)" ], "parameterObjects": "Object", "useStrict": true, "eventsSheetExpanded": false }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [], "actions": [ { "type": { "value": "ChangeSprite" }, "parameters": [ "Object", "=", "Object.Variable(quad)" ] } ] } ], "parameters": [ { "description": "Object", "name": "Object", "supplementaryInformation": "Sprite", "type": "object" }, { "description": "Behavior", "name": "Behavior", "supplementaryInformation": "PaperEngine::ProjectPreRenderSprite", "type": "behavior" } ], "objectGroups": [] } ], "propertyDescriptors": [ { "value": "0", "type": "Number", "label": "Side count", "description": "Number of sides of the pre-rendered sprite", "group": "", "extraInformation": [], "hidden": false, "name": "Sides" } ], "sharedPropertyDescriptors": [] }, { "description": "Simple Top Down Behavior based on camera angle", "fullName": "Top Down Behavior", "name": "TopDown", "objectType": "", "eventsFunctions": [ { "fullName": "", "functionType": "Action", "name": "doStepPreEvents", "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [], "actions": [ { "type": { "value": "PaperEngine::TopDown::SetPropertyUp" }, "parameters": [ "Object", "Behavior", "no" ] }, { "type": { "value": "PaperEngine::TopDown::SetPropertyDown" }, "parameters": [ "Object", "Behavior", "no" ] }, { "type": { "value": "PaperEngine::TopDown::SetPropertyLeft" }, "parameters": [ "Object", "Behavior", "no" ] }, { "type": { "value": "PaperEngine::TopDown::SetPropertyRight" }, "parameters": [ "Object", "Behavior", "no" ] } ] } ], "parameters": [ { "description": "Object", "name": "Object", "type": "object" }, { "description": "Behavior", "name": "Behavior", "supplementaryInformation": "PaperEngine::TopDown", "type": "behavior" } ], "objectGroups": [] }, { "fullName": "", "functionType": "Action", "name": "doStepPostEvents", "sentence": "", "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { "value": "PaperEngine::TopDown::PropertyUp" }, "parameters": [ "Object", "Behavior" ] } ], "actions": [ { "type": { "value": "AddForceAL" }, "parameters": [ "Object", "CameraAngle()-90", "Object.Behavior::PropertySpeed()", "" ] } ] }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { "value": "PaperEngine::TopDown::PropertyDown" }, "parameters": [ "Object", "Behavior" ] } ], "actions": [ { "type": { "value": "AddForceAL" }, "parameters": [ "Object", "CameraAngle()+90", "Object.Behavior::PropertySpeed()", "" ] } ] }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { "value": "PaperEngine::TopDown::PropertyLeft" }, "parameters": [ "Object", "Behavior" ] } ], "actions": [ { "type": { "value": "AddForceAL" }, "parameters": [ "Object", "CameraAngle()+180", "Object.Behavior::PropertySpeed()", "" ] } ] }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { "value": "PaperEngine::TopDown::PropertyRight" }, "parameters": [ "Object", "Behavior" ] } ], "actions": [ { "type": { "value": "AddForceAL" }, "parameters": [ "Object", "CameraAngle()", "Object.Behavior::PropertySpeed()", "" ] } ] } ], "parameters": [ { "description": "Object", "name": "Object", "type": "object" }, { "description": "Behavior", "name": "Behavior", "supplementaryInformation": "PaperEngine::TopDown", "type": "behavior" } ], "objectGroups": [] }, { "description": "Simulate Up", "fullName": "Simulate Up", "functionType": "Action", "name": "SimulateUP", "sentence": "Simulate Up _PARAM0_", "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [], "actions": [ { "type": { "value": "PaperEngine::TopDown::SetPropertyUp" }, "parameters": [ "Object", "Behavior", "yes" ] } ] } ], "parameters": [ { "description": "Object", "name": "Object", "type": "object" }, { "description": "Behavior", "name": "Behavior", "supplementaryInformation": "PaperEngine::TopDown", "type": "behavior" } ], "objectGroups": [] }, { "description": "Simulate Down", "fullName": "Simulate Down", "functionType": "Action", "name": "SimulateDown", "sentence": "Simulate Down _PARAM0_", "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [], "actions": [ { "type": { "value": "PaperEngine::TopDown::SetPropertyDown" }, "parameters": [ "Object", "Behavior", "yes" ] } ] } ], "parameters": [ { "description": "Object", "name": "Object", "type": "object" }, { "description": "Behavior", "name": "Behavior", "supplementaryInformation": "PaperEngine::TopDown", "type": "behavior" } ], "objectGroups": [] }, { "description": "Simulate Left", "fullName": "Simulate Left", "functionType": "Action", "name": "SimulateLeft", "sentence": "Simulate Left _PARAM0_", "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [], "actions": [ { "type": { "value": "PaperEngine::TopDown::SetPropertyLeft" }, "parameters": [ "Object", "Behavior", "yes" ] } ] } ], "parameters": [ { "description": "Object", "name": "Object", "type": "object" }, { "description": "Behavior", "name": "Behavior", "supplementaryInformation": "PaperEngine::TopDown", "type": "behavior" } ], "objectGroups": [] }, { "description": "Simulate Right", "fullName": "Simulate Right", "functionType": "Action", "name": "SimulateRight", "sentence": "Simulate Right _PARAM0_", "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [], "actions": [ { "type": { "value": "PaperEngine::TopDown::SetPropertyRight" }, "parameters": [ "Object", "Behavior", "yes" ] } ] } ], "parameters": [ { "description": "Object", "name": "Object", "type": "object" }, { "description": "Behavior", "name": "Behavior", "supplementaryInformation": "PaperEngine::TopDown", "type": "behavior" } ], "objectGroups": [] } ], "propertyDescriptors": [ { "value": "", "type": "Boolean", "label": "", "description": "", "group": "", "extraInformation": [], "hidden": true, "name": "Up" }, { "value": "", "type": "Boolean", "label": "", "description": "", "group": "", "extraInformation": [], "hidden": true, "name": "Right" }, { "value": "", "type": "Boolean", "label": "", "description": "", "group": "", "extraInformation": [], "hidden": true, "name": "Down" }, { "value": "", "type": "Boolean", "label": "", "description": "", "group": "", "extraInformation": [], "hidden": true, "name": "Left" }, { "value": "200", "type": "Number", "unit": "PixelSpeed", "label": "", "description": "", "group": "", "extraInformation": [], "hidden": false, "name": "Speed" } ], "sharedPropertyDescriptors": [] } ], "eventsBasedObjects": [] }