From 666e41da145f994d12248fb34e8b0661035e2fbe Mon Sep 17 00:00:00 2001 From: Laszlo Koosz Date: Sat, 28 Sep 2024 21:15:29 +0100 Subject: [PATCH 1/4] Add boolean variables Replaced number variables with boolean variables where it was reasonable and made sure the variables are added to variables editor. Also updated comments to reflect this --- .../advanced-shape-based-painter.json | 830 ++++++------------ 1 file changed, 285 insertions(+), 545 deletions(-) diff --git a/examples/advanced-shape-based-painter/advanced-shape-based-painter.json b/examples/advanced-shape-based-painter/advanced-shape-based-painter.json index 0589d0765..920e184cf 100755 --- a/examples/advanced-shape-based-painter/advanced-shape-based-painter.json +++ b/examples/advanced-shape-based-painter/advanced-shape-based-painter.json @@ -1,13 +1,15 @@ { "firstLayout": "", "gdVersion": { - "build": 99, - "major": 4, - "minor": 0, + "build": 213, + "major": 5, + "minor": 4, "revision": 0 }, "properties": { "adaptGameResolutionAtRuntime": false, + "antialiasingMode": "MSAA", + "antialisingEnabledOnMobile": false, "folderProject": false, "orientation": "default", "packageName": "com.example.shapepainter", @@ -15,9 +17,11 @@ "projectUuid": "49af45a6-8dc7-4f4e-bce8-5fe696257fd1", "scaleMode": "linear", "sizeOnStartupMode": "", + "templateSlug": "", "useExternalSourceFiles": false, "version": "1.0.0", "name": "Advanced Shape Painter", + "description": "", "author": "", "windowWidth": 800, "windowHeight": 600, @@ -42,9 +46,16 @@ "showGDevelopSplash": true, "showProgressBar": true }, + "watermark": { + "placement": "bottom-left", + "showWatermark": true + }, "authorIds": [ "t0AOR3JaOlak1TykejmNhjR5UQb2" ], + "authorUsernames": [], + "categories": [], + "playableDevices": [], "extensionProperties": [], "platforms": [ { @@ -113,6 +124,9 @@ "resourceFolders": [] }, "objects": [], + "objectsFolderStructure": { + "folderName": "__ROOT" + }, "objectsGroups": [], "variables": [], "layouts": [ @@ -121,9 +135,6 @@ "disableInputWhenNotFocused": true, "mangledName": "Scene", "name": "Scene", - "oglFOV": 90, - "oglZFar": 500, - "oglZNear": 1, "r": 209, "standardSortMethod": true, "stopSoundsOnStartup": true, @@ -269,9 +280,9 @@ "value": "0" }, { - "name": "drawing", - "type": "string", - "value": "0" + "name": "isDrawing", + "type": "boolean", + "value": false }, { "name": "R", @@ -292,6 +303,12 @@ "name": "A", "type": "string", "value": "100" + }, + { + "folded": true, + "name": "canDraw", + "type": "boolean", + "value": false } ], "instances": [ @@ -300,7 +317,6 @@ "customSize": false, "height": 0, "layer": "", - "locked": false, "name": "Drawer", "persistentUuid": "1fb23849-d60e-4e8f-96e1-7e2e20d988c0", "width": 0, @@ -322,7 +338,6 @@ "customSize": false, "height": 0, "layer": "", - "locked": false, "name": "BarSelect", "persistentUuid": "c3144d13-d5d7-41dd-908a-3b1eecd1bd14", "width": 0, @@ -344,7 +359,6 @@ "customSize": false, "height": 0, "layer": "", - "locked": false, "name": "BarSelect", "persistentUuid": "0bf1ca5d-2b6d-4d00-8128-29338d3a89fa", "width": 0, @@ -366,7 +380,6 @@ "customSize": false, "height": 0, "layer": "", - "locked": false, "name": "BarSelect", "persistentUuid": "6389becb-a502-4967-baa5-68b9d0c353ba", "width": 0, @@ -388,7 +401,6 @@ "customSize": false, "height": 0, "layer": "", - "locked": false, "name": "BarSelect", "persistentUuid": "82ad3623-fdf2-4962-9e2d-604484a3ea35", "width": 0, @@ -410,7 +422,6 @@ "customSize": false, "height": 0, "layer": "", - "locked": false, "name": "message", "persistentUuid": "a0ad8fec-cdc3-4398-af1a-02a5282931e0", "width": 0, @@ -424,8 +435,8 @@ ], "objects": [ { + "assetStoreId": "", "name": "Drawer", - "tags": "", "type": "PrimitiveDrawing::Drawer", "variables": [ { @@ -470,11 +481,13 @@ "r": 0 }, "absoluteCoordinates": true, - "clearBetweenFrames": true + "clearBetweenFrames": true, + "antialiasing": "none" }, { + "adaptCollisionMaskAutomatically": false, + "assetStoreId": "", "name": "Shapes", - "tags": "", "type": "Sprite", "updateIfNotVisible": true, "variables": [], @@ -676,15 +689,16 @@ ] }, { + "adaptCollisionMaskAutomatically": false, + "assetStoreId": "", "name": "BarSelect", - "tags": "", "type": "Sprite", "updateIfNotVisible": true, "variables": [ { - "name": "Drag", - "type": "string", - "value": "0" + "name": "isDragged", + "type": "boolean", + "value": false }, { "name": "Value", @@ -746,11 +760,11 @@ ] }, { + "assetStoreId": "", "bold": false, "italic": false, "name": "message", "smoothed": true, - "tags": "", "type": "TextObject::Text", "underlined": false, "variables": [], @@ -758,18 +772,54 @@ "behaviors": [], "string": "Click the Shape buttons on the left to select a shape\nDrag the bars below to change color and opacity\nClick the empty area to start drawing the selected shape", "font": "", + "textAlignment": "", "characterSize": 20, "color": { "b": 0, "g": 0, "r": 0 + }, + "content": { + "bold": false, + "isOutlineEnabled": false, + "isShadowEnabled": false, + "italic": false, + "outlineColor": "255;255;255", + "outlineThickness": 2, + "shadowAngle": 90, + "shadowBlurRadius": 2, + "shadowColor": "0;0;0", + "shadowDistance": 4, + "shadowOpacity": 127, + "smoothed": true, + "underlined": false, + "text": "Click the Shape buttons on the left to select a shape\nDrag the bars below to change color and opacity\nClick the empty area to start drawing the selected shape", + "font": "", + "textAlignment": "", + "characterSize": 20, + "color": "0;0;0" } } ], + "objectsFolderStructure": { + "folderName": "__ROOT", + "children": [ + { + "objectName": "Drawer" + }, + { + "objectName": "Shapes" + }, + { + "objectName": "BarSelect" + }, + { + "objectName": "message" + } + ] + }, "events": [ { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Comment", "color": { "b": 109, @@ -779,50 +829,40 @@ "textG": 0, "textR": 0 }, - "comment": "This example is using the shape painter object to draw shapes\nAt the beginning we are creating the graphical user interface using the Shapes object which is used to select what shape to draw\nWe also use the shape drawer object to draw the lines on the screen that we can use to drag the BarSelect objects to select the color and opacitiy of the shape", - "comment2": "" + "comment": "This example is using the shape painter object to draw shapes\nAt the beginning we are creating the graphical user interface using the Shapes object which is used to select what shape to draw\nWe also use the shape drawer object to draw the lines on the screen that we can use to drag the BarSelect objects to select the color and opacitiy of the shape" }, { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "inverted": false, "value": "DepartScene" }, "parameters": [ "" - ], - "subInstructions": [] + ] } ], "actions": [ { "type": { - "inverted": false, "value": "ModVarScene" }, "parameters": [ "i", "=", "0" - ], - "subInstructions": [] + ] } ], "events": [ { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Repeat", "repeatExpression": "5", "conditions": [], "actions": [ { "type": { - "inverted": false, "value": "Create" }, "parameters": [ @@ -831,92 +871,75 @@ "50", "150+Variable(i)*40", "" - ], - "subInstructions": [] + ] }, { "type": { - "inverted": false, "value": "ChangeSprite" }, "parameters": [ "Shapes", "=", "Variable(i)" - ], - "subInstructions": [] + ] }, { "type": { - "inverted": false, "value": "PauseAnimation" }, "parameters": [ "Shapes" - ], - "subInstructions": [] + ] }, { "type": { - "inverted": false, "value": "ModVarScene" }, "parameters": [ "i", "+", "1" - ], - "subInstructions": [] + ] } - ], - "events": [] + ] } ] }, { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Standard", "conditions": [], "actions": [ { "type": { - "inverted": false, "value": "PrimitiveDrawing::FillColor" }, "parameters": [ "Drawer", "\"0;0;0\"" - ], - "subInstructions": [] + ] }, { "type": { - "inverted": false, "value": "PrimitiveDrawing::FillOpacity" }, "parameters": [ "Drawer", "=", "255" - ], - "subInstructions": [] + ] }, { "type": { - "inverted": false, "value": "PrimitiveDrawing::OutlineSize" }, "parameters": [ "Drawer", "=", "0" - ], - "subInstructions": [] + ] }, { "type": { - "inverted": false, "value": "PrimitiveDrawing::Rectangle" }, "parameters": [ @@ -925,12 +948,10 @@ "400", "305", "405" - ], - "subInstructions": [] + ] }, { "type": { - "inverted": false, "value": "PrimitiveDrawing::Rectangle" }, "parameters": [ @@ -939,12 +960,10 @@ "430", "305", "435" - ], - "subInstructions": [] + ] }, { "type": { - "inverted": false, "value": "PrimitiveDrawing::Rectangle" }, "parameters": [ @@ -953,12 +972,10 @@ "460", "305", "465" - ], - "subInstructions": [] + ] }, { "type": { - "inverted": false, "value": "PrimitiveDrawing::Rectangle" }, "parameters": [ @@ -967,43 +984,35 @@ "490", "305", "495" - ], - "subInstructions": [] + ] } ], "events": [ { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Standard", "conditions": [], "actions": [ { "type": { - "inverted": false, "value": "PrimitiveDrawing::FillColor" }, "parameters": [ "Drawer", "VariableString(R)+\";\"+VariableString(G)+\";\"+VariableString(B)" - ], - "subInstructions": [] + ] }, { "type": { - "inverted": false, "value": "PrimitiveDrawing::FillOpacity" }, "parameters": [ "Drawer", "=", "Variable(A)" - ], - "subInstructions": [] + ] }, { "type": { - "inverted": false, "value": "PrimitiveDrawing::Rectangle" }, "parameters": [ @@ -1012,36 +1021,28 @@ "400", "405", "495" - ], - "subInstructions": [] + ] } - ], - "events": [] + ] } ] }, { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "inverted": false, "value": "SourisBouton" }, "parameters": [ "", "Left" - ], - "subInstructions": [] + ] } ], "actions": [], "events": [ { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Comment", "color": { "b": 109, @@ -1051,41 +1052,32 @@ "textG": 0, "textR": 0 }, - "comment": "If the mouse is first-time pressed, set canDraw to 1 as an indication we can start drawing", - "comment2": "" + "comment": "If the mouse is first-time pressed, set canDraw to true as an indication we can start drawing" }, { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "inverted": false, "value": "BuiltinCommonInstructions::Once" }, - "parameters": [], - "subInstructions": [] + "parameters": [] } ], "actions": [ { "type": { - "inverted": false, - "value": "ModVarScene" + "value": "SetBooleanVariable" }, "parameters": [ "canDraw", - "=", - "1" - ], - "subInstructions": [] + "True", + "" + ] } ], "events": [ { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Comment", "color": { "b": 109, @@ -1095,58 +1087,46 @@ "textG": 0, "textR": 0 }, - "comment": "While the pointer is down, if the pointer is over a shape, get the sprite of the object and store it number in the shape variable which is used then to pick which shape to draw\nWe also set canDraw to 0 to indicate we don't want to draw just yet", - "comment2": "" + "comment": "While the pointer is down, if the pointer is over a shape, get the sprite of the object and store it number in the shape variable which is used then to pick which shape to draw\nWe also set canDraw to false to indicate we don't want to draw just yet" }, { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "inverted": false, "value": "SourisSurObjet" }, "parameters": [ "Shapes", "", "" - ], - "subInstructions": [] + ] } ], "actions": [ { "type": { - "inverted": false, - "value": "ModVarScene" + "value": "SetBooleanVariable" }, "parameters": [ "canDraw", - "=", - "0" - ], - "subInstructions": [] + "False", + "" + ] }, { "type": { - "inverted": false, "value": "ModVarScene" }, "parameters": [ "shape", "=", "Shapes.Sprite()" - ], - "subInstructions": [] + ] } - ], - "events": [] + ] }, { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Comment", "color": { "b": 109, @@ -1156,59 +1136,47 @@ "textG": 0, "textR": 0 }, - "comment": "In case the pointer is over the BarSelect object that means we want to drag the object to change the color of the shape, we set Drag value of the objec to 1 to indicate that we are about to drag this object\nWe also set the value of canDraw to 0 to indicate we don't want to draw just yet", - "comment2": "" + "comment": "In case the pointer is over the BarSelect object that means we want to drag the object to change the color of the shape, we set isDragged value of the objec to true to indicate that we are about to drag this object\nWe also set the value of canDraw to false to indicate we don't want to draw just yet" }, { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "inverted": false, "value": "SourisSurObjet" }, "parameters": [ "BarSelect", "", "" - ], - "subInstructions": [] + ] } ], "actions": [ { "type": { - "inverted": false, - "value": "ModVarScene" + "value": "SetBooleanVariable" }, "parameters": [ "canDraw", - "=", - "0" - ], - "subInstructions": [] + "False", + "" + ] }, { "type": { - "inverted": false, - "value": "ModVarObjet" + "value": "SetBooleanObjectVariable" }, "parameters": [ "BarSelect", - "Drag", - "=", - "1" - ], - "subInstructions": [] + "isDragged", + "True", + "" + ] } - ], - "events": [] + ] }, { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Comment", "color": { "b": 109, @@ -1218,93 +1186,76 @@ "textG": 0, "textR": 0 }, - "comment": "In case the value of canDraw is 1 that means the pointer is NOT over the gui element so we can start drawing the selected shape as we move the mouse\nIn order to draw a shape, the drawer object going to need some initial values such as tart position of drawing, shape, shape size", - "comment2": "" + "comment": "In case the value of canDraw is true that means the pointer is NOT over the gui element so we can start drawing the selected shape as we move the mouse\nIn order to draw a shape, the drawer object going to need some initial values such as start position of drawing, shape, shape size" }, { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "inverted": false, - "value": "VarScene" + "value": "BooleanVariable" }, "parameters": [ "canDraw", - "=", - "1" - ], - "subInstructions": [] + "True", + "" + ] } ], "actions": [ { "type": { - "inverted": false, - "value": "ModVarScene" + "value": "SetBooleanVariable" }, "parameters": [ - "drawing", - "=", - "1" - ], - "subInstructions": [] + "isDrawing", + "True", + "" + ] }, { "type": { - "inverted": false, "value": "ModVarScene" }, "parameters": [ "Shapes.Size", "+", "1" - ], - "subInstructions": [] + ] }, { "type": { - "inverted": false, "value": "ModVarScene" }, "parameters": [ "Shapes[VariableString(Shapes.Size)].Type", "=", "Variable(shape)" - ], - "subInstructions": [] + ] }, { "type": { - "inverted": false, "value": "ModVarScene" }, "parameters": [ "Shapes[VariableString(Shapes.Size)].StartX", "=", "MouseX(\"\",0)" - ], - "subInstructions": [] + ] }, { "type": { - "inverted": false, "value": "ModVarScene" }, "parameters": [ "Shapes[VariableString(Shapes.Size)].StartY", "=", "MouseY(\"\",0)" - ], - "subInstructions": [] + ] } ], "events": [ { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Comment", "color": { "b": 109, @@ -1314,12 +1265,9 @@ "textG": 0, "textR": 0 }, - "comment": "The shape painter object has properties that we also need to set such as RGB color values, opacity and border. We set these values here and store them in variables for each different shape we can draw", - "comment2": "" + "comment": "The shape painter object has properties that we also need to set such as RGB color values, opacity and border. We set these values here and store them in variables for each different shape we can draw" }, { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Comment", "color": { "b": 109, @@ -1329,12 +1277,9 @@ "textG": 0, "textR": 0 }, - "comment": "Circle Filled", - "comment2": "" + "comment": "Circle Filled" }, { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Comment", "color": { "b": 109, @@ -1344,12 +1289,9 @@ "textG": 0, "textR": 0 }, - "comment": "Rectangle Filled", - "comment2": "" + "comment": "Rectangle Filled" }, { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Comment", "color": { "b": 109, @@ -1359,56 +1301,46 @@ "textG": 0, "textR": 0 }, - "comment": "Line", - "comment2": "" + "comment": "Line" }, { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "inverted": false, "value": "BuiltinCommonInstructions::Or" }, "parameters": [], "subInstructions": [ { "type": { - "inverted": false, "value": "VarScene" }, "parameters": [ "shape", "=", "0" - ], - "subInstructions": [] + ] }, { "type": { - "inverted": false, "value": "VarScene" }, "parameters": [ "shape", "=", "2" - ], - "subInstructions": [] + ] }, { "type": { - "inverted": false, "value": "VarScene" }, "parameters": [ "shape", "=", "4" - ], - "subInstructions": [] + ] } ] } @@ -1416,82 +1348,67 @@ "actions": [ { "type": { - "inverted": false, "value": "ModVarScene" }, "parameters": [ "Shapes[VariableString(Shapes.Size)].FillColor.R", "=", "Variable(R)" - ], - "subInstructions": [] + ] }, { "type": { - "inverted": false, "value": "ModVarScene" }, "parameters": [ "Shapes[VariableString(Shapes.Size)].FillColor.G", "=", "Variable(G)" - ], - "subInstructions": [] + ] }, { "type": { - "inverted": false, "value": "ModVarScene" }, "parameters": [ "Shapes[VariableString(Shapes.Size)].FillColor.B", "=", "Variable(B)" - ], - "subInstructions": [] + ] }, { "type": { - "inverted": false, "value": "ModVarScene" }, "parameters": [ "Shapes[VariableString(Shapes.Size)].FillOpacity", "=", "Variable(A)" - ], - "subInstructions": [] + ] }, { "type": { - "inverted": false, "value": "ModVarScene" }, "parameters": [ "Shapes[VariableString(Shapes.Size)].BorderOpacity", "=", "0" - ], - "subInstructions": [] + ] }, { "type": { - "inverted": false, "value": "ModVarScene" }, "parameters": [ "Shapes[VariableString(Shapes.Size)].Thickness", "=", "2" - ], - "subInstructions": [] + ] } - ], - "events": [] + ] }, { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Comment", "color": { "b": 109, @@ -1501,12 +1418,9 @@ "textG": 0, "textR": 0 }, - "comment": "Circle Border", - "comment2": "" + "comment": "Circle Border" }, { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Comment", "color": { "b": 109, @@ -1516,44 +1430,36 @@ "textG": 0, "textR": 0 }, - "comment": "Rectangle Border", - "comment2": "" + "comment": "Rectangle Border" }, { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "inverted": false, "value": "BuiltinCommonInstructions::Or" }, "parameters": [], "subInstructions": [ { "type": { - "inverted": false, "value": "VarScene" }, "parameters": [ "shape", "=", "1" - ], - "subInstructions": [] + ] }, { "type": { - "inverted": false, "value": "VarScene" }, "parameters": [ "shape", "=", "3" - ], - "subInstructions": [] + ] } ] } @@ -1561,86 +1467,71 @@ "actions": [ { "type": { - "inverted": false, "value": "ModVarScene" }, "parameters": [ "Shapes[VariableString(Shapes.Size)].FillOpacity", "=", "0" - ], - "subInstructions": [] + ] }, { "type": { - "inverted": false, "value": "ModVarScene" }, "parameters": [ "Shapes[VariableString(Shapes.Size)].BorderColor.R", "=", "Variable(R)" - ], - "subInstructions": [] + ] }, { "type": { - "inverted": false, "value": "ModVarScene" }, "parameters": [ "Shapes[VariableString(Shapes.Size)].BorderColor.G", "=", "Variable(G)" - ], - "subInstructions": [] + ] }, { "type": { - "inverted": false, "value": "ModVarScene" }, "parameters": [ "Shapes[VariableString(Shapes.Size)].BorderColor.B", "=", "Variable(B)" - ], - "subInstructions": [] + ] }, { "type": { - "inverted": false, "value": "ModVarScene" }, "parameters": [ "Shapes[VariableString(Shapes.Size)].BorderOpacity", "=", "Variable(A)" - ], - "subInstructions": [] + ] }, { "type": { - "inverted": false, "value": "ModVarScene" }, "parameters": [ "Shapes[VariableString(Shapes.Size)].Border", "=", "2" - ], - "subInstructions": [] + ] } - ], - "events": [] + ] } ] } ] }, { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Comment", "color": { "b": 109, @@ -1650,120 +1541,96 @@ "textG": 0, "textR": 0 }, - "comment": "If the pointer is down and the bar is selected BarSelect = 1, move the bar", - "comment2": "" + "comment": "If the pointer is down and the bar is selected BarSelect isDragged = true, move the bar" }, { - "disabled": false, - "folded": true, "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "inverted": false, - "value": "VarObjet" + "value": "BooleanObjectVariable" }, "parameters": [ "BarSelect", - "Drag", - "=", - "1" - ], - "subInstructions": [] + "isDragged", + "True", + "" + ] } ], "actions": [ { "type": { - "inverted": false, "value": "MettreX" }, "parameters": [ "BarSelect", "=", "MouseX(\"\",0)" - ], - "subInstructions": [] + ] } ], "events": [ { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "inverted": false, "value": "PosX" }, "parameters": [ "BarSelect", "<", "50" - ], - "subInstructions": [] + ] } ], "actions": [ { "type": { - "inverted": false, "value": "MettreX" }, "parameters": [ "BarSelect", "=", "50" - ], - "subInstructions": [] + ] } - ], - "events": [] + ] }, { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "inverted": false, "value": "PosX" }, "parameters": [ "BarSelect", ">", "305" - ], - "subInstructions": [] + ] } ], "actions": [ { "type": { - "inverted": false, "value": "MettreX" }, "parameters": [ "BarSelect", "=", "305" - ], - "subInstructions": [] + ] } - ], - "events": [] + ] }, { - "disabled": false, - "folded": true, "type": "BuiltinCommonInstructions::Standard", "conditions": [], "actions": [ { "type": { - "inverted": false, "value": "ModVarObjet" }, "parameters": [ @@ -1771,19 +1638,15 @@ "Value", "=", "BarSelect.X()-50" - ], - "subInstructions": [] + ] } ], "events": [ { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "inverted": false, "value": "VarObjet" }, "parameters": [ @@ -1791,34 +1654,27 @@ "ID", "=", "0" - ], - "subInstructions": [] + ] } ], "actions": [ { "type": { - "inverted": false, "value": "ModVarScene" }, "parameters": [ "R", "=", "BarSelect.Variable(Value)" - ], - "subInstructions": [] + ] } - ], - "events": [] + ] }, { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "inverted": false, "value": "VarObjet" }, "parameters": [ @@ -1826,34 +1682,27 @@ "ID", "=", "1" - ], - "subInstructions": [] + ] } ], "actions": [ { "type": { - "inverted": false, "value": "ModVarScene" }, "parameters": [ "G", "=", "BarSelect.Variable(Value)" - ], - "subInstructions": [] + ] } - ], - "events": [] + ] }, { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "inverted": false, "value": "VarObjet" }, "parameters": [ @@ -1861,34 +1710,27 @@ "ID", "=", "2" - ], - "subInstructions": [] + ] } ], "actions": [ { "type": { - "inverted": false, "value": "ModVarScene" }, "parameters": [ "B", "=", "BarSelect.Variable(Value)" - ], - "subInstructions": [] + ] } - ], - "events": [] + ] }, { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "inverted": false, "value": "VarObjet" }, "parameters": [ @@ -1896,33 +1738,27 @@ "ID", "=", "3" - ], - "subInstructions": [] + ] } ], "actions": [ { "type": { - "inverted": false, "value": "ModVarScene" }, "parameters": [ "A", "=", "BarSelect.Variable(Value)" - ], - "subInstructions": [] + ] } - ], - "events": [] + ] } ] } ] }, { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Comment", "color": { "b": 109, @@ -1932,32 +1768,25 @@ "textG": 0, "textR": 0 }, - "comment": "If the pointer is down and the value of drawing = 1 then we can start drawing", - "comment2": "" + "comment": "If the pointer is down and the value of isDrawing = true then we can start drawing" }, { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "inverted": false, - "value": "VarScene" + "value": "BooleanVariable" }, "parameters": [ - "drawing", - "=", - "1" - ], - "subInstructions": [] + "isDrawing", + "True", + "" + ] } ], "actions": [], "events": [ { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Comment", "color": { "b": 109, @@ -1967,12 +1796,9 @@ "textG": 0, "textR": 0 }, - "comment": "Before we can start drawing, we need to initialize some more values\nIn case of circle we need to set the radius", - "comment2": "" + "comment": "Before we can start drawing, we need to initialize some more values\nIn case of circle we need to set the radius" }, { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Comment", "color": { "b": 109, @@ -1982,12 +1808,9 @@ "textG": 0, "textR": 0 }, - "comment": "Circle Filled", - "comment2": "" + "comment": "Circle Filled" }, { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Comment", "color": { "b": 109, @@ -1997,44 +1820,36 @@ "textG": 0, "textR": 0 }, - "comment": "Circle Border", - "comment2": "" + "comment": "Circle Border" }, { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "inverted": false, "value": "BuiltinCommonInstructions::Or" }, "parameters": [], "subInstructions": [ { "type": { - "inverted": false, "value": "VarScene" }, "parameters": [ "shape", "=", "0" - ], - "subInstructions": [] + ] }, { "type": { - "inverted": false, "value": "VarScene" }, "parameters": [ "shape", "=", "1" - ], - "subInstructions": [] + ] } ] } @@ -2042,22 +1857,17 @@ "actions": [ { "type": { - "inverted": false, "value": "ModVarScene" }, "parameters": [ "Shapes[VariableString(Shapes.Size)].Radius", "=", "sqrt( pow(MouseX(\"\",0)-Variable(Shapes[VariableString(Shapes.Size)].StartX), 2) + pow(MouseY(\"\",0)-Variable(Shapes[VariableString(Shapes.Size)].StartY), 2) )" - ], - "subInstructions": [] + ] } - ], - "events": [] + ] }, { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Comment", "color": { "b": 109, @@ -2067,12 +1877,9 @@ "textG": 0, "textR": 0 }, - "comment": "In case of rectangle and line we need to set the end point of the shape", - "comment2": "" + "comment": "In case of rectangle and line we need to set the end point of the shape" }, { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Comment", "color": { "b": 109, @@ -2082,12 +1889,9 @@ "textG": 0, "textR": 0 }, - "comment": "Rectangle Filled", - "comment2": "" + "comment": "Rectangle Filled" }, { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Comment", "color": { "b": 109, @@ -2097,12 +1901,9 @@ "textG": 0, "textR": 0 }, - "comment": "Rectangle Border", - "comment2": "" + "comment": "Rectangle Border" }, { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Comment", "color": { "b": 109, @@ -2112,56 +1913,46 @@ "textG": 0, "textR": 0 }, - "comment": "Line", - "comment2": "" + "comment": "Line" }, { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "inverted": false, "value": "BuiltinCommonInstructions::Or" }, "parameters": [], "subInstructions": [ { "type": { - "inverted": false, "value": "VarScene" }, "parameters": [ "shape", "=", "2" - ], - "subInstructions": [] + ] }, { "type": { - "inverted": false, "value": "VarScene" }, "parameters": [ "shape", "=", "3" - ], - "subInstructions": [] + ] }, { "type": { - "inverted": false, "value": "VarScene" }, "parameters": [ "shape", "=", "4" - ], - "subInstructions": [] + ] } ] } @@ -2169,46 +1960,36 @@ "actions": [ { "type": { - "inverted": false, "value": "ModVarScene" }, "parameters": [ "Shapes[VariableString(Shapes.Size)].EndX", "=", "MouseX(\"\",0)" - ], - "subInstructions": [] + ] }, { "type": { - "inverted": false, "value": "ModVarScene" }, "parameters": [ "Shapes[VariableString(Shapes.Size)].EndY", "=", "MouseY(\"\",0)" - ], - "subInstructions": [] + ] } - ], - "events": [] + ] }, { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Standard", "conditions": [], - "actions": [], - "events": [] + "actions": [] } ] } ] }, { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Comment", "color": { "b": 109, @@ -2218,12 +1999,9 @@ "textG": 0, "textR": 0 }, - "comment": "If the pointer is no longer down, stop drawing", - "comment2": "" + "comment": "If the pointer is no longer down, stop drawing" }, { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Standard", "conditions": [ { @@ -2234,50 +2012,40 @@ "parameters": [ "", "Left" - ], - "subInstructions": [] + ] }, { "type": { - "inverted": false, "value": "BuiltinCommonInstructions::Once" }, - "parameters": [], - "subInstructions": [] + "parameters": [] } ], "actions": [ { "type": { - "inverted": false, - "value": "ModVarScene" + "value": "SetBooleanVariable" }, "parameters": [ - "drawing", - "=", - "0" - ], - "subInstructions": [] + "isDrawing", + "False", + "" + ] }, { "type": { - "inverted": false, - "value": "ModVarObjet" + "value": "SetBooleanObjectVariable" }, "parameters": [ "BarSelect", - "Drag", - "=", - "0" - ], - "subInstructions": [] + "isDragged", + "False", + "" + ] } - ], - "events": [] + ] }, { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Comment", "color": { "b": 109, @@ -2287,33 +2055,25 @@ "textG": 0, "textR": 0 }, - "comment": "Reset the counter used to pick shape number", - "comment2": "" + "comment": "Reset the counter used to pick shape number" }, { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Standard", "conditions": [], "actions": [ { "type": { - "inverted": false, "value": "ModVarScene" }, "parameters": [ "i", "=", "0" - ], - "subInstructions": [] + ] } - ], - "events": [] + ] }, { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Comment", "color": { "b": 109, @@ -2323,79 +2083,64 @@ "textG": 0, "textR": 0 }, - "comment": "Repeat = the size of the rectangle struct (+1 because I like the struct start with 0)\n-draw the rectangle in the struct with index = i\n-add 1 to i\nWe apply all the properties now on the drawer object based on what shape we picked to draw, what color and opacity", - "comment2": "" + "comment": "Repeat = the size of the rectangle struct (+1 because I like the struct start with 0)\n-draw the rectangle in the struct with index = i\n-add 1 to i\nWe apply all the properties now on the drawer object based on what shape we picked to draw, what color and opacity" }, { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Repeat", "repeatExpression": "Variable(Shapes.Size)+1", "conditions": [], "actions": [ { "type": { - "inverted": false, "value": "PrimitiveDrawing::FillColor" }, "parameters": [ "Drawer", "VariableString(Shapes[VariableString(i)].FillColor.R)+\";\"+VariableString(Shapes[VariableString(i)].FillColor.G)+\";\"+VariableString(Shapes[VariableString(i)].FillColor.B)" - ], - "subInstructions": [] + ] }, { "type": { - "inverted": false, "value": "PrimitiveDrawing::FillOpacity" }, "parameters": [ "Drawer", "=", "Variable(Shapes[VariableString(i)].FillOpacity)" - ], - "subInstructions": [] + ] }, { "type": { - "inverted": false, "value": "PrimitiveDrawing::OutlineColor" }, "parameters": [ "Drawer", "VariableString(Shapes[VariableString(i)].BorderColor.R)+\";\"+VariableString(Shapes[VariableString(i)].BorderColor.G)+\";\"+VariableString(Shapes[VariableString(i)].BorderColor.B)" - ], - "subInstructions": [] + ] }, { "type": { - "inverted": false, "value": "PrimitiveDrawing::OutlineOpacity" }, "parameters": [ "Drawer", "=", "Variable(Shapes[VariableString(i)].BorderOpacity)" - ], - "subInstructions": [] + ] }, { "type": { - "inverted": false, "value": "PrimitiveDrawing::OutlineSize" }, "parameters": [ "Drawer", "=", "Variable(Shapes[VariableString(i)].Border)" - ], - "subInstructions": [] + ] } ], "events": [ { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Comment", "color": { "b": 109, @@ -2405,44 +2150,36 @@ "textG": 0, "textR": 0 }, - "comment": "Draw the circle if the circle is picked shape 0 and 1", - "comment2": "" + "comment": "Draw the circle if the circle is picked shape 0 and 1" }, { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "inverted": false, "value": "BuiltinCommonInstructions::Or" }, "parameters": [], "subInstructions": [ { "type": { - "inverted": false, "value": "VarScene" }, "parameters": [ "Shapes[VariableString(i)].Type", "=", "0" - ], - "subInstructions": [] + ] }, { "type": { - "inverted": false, "value": "VarScene" }, "parameters": [ "Shapes[VariableString(i)].Type", "=", "1" - ], - "subInstructions": [] + ] } ] } @@ -2450,7 +2187,6 @@ "actions": [ { "type": { - "inverted": false, "value": "PrimitiveDrawing::Circle" }, "parameters": [ @@ -2458,15 +2194,11 @@ "Variable(Shapes[VariableString(i)].StartX)", "Variable(Shapes[VariableString(i)].StartY)", "Variable(Shapes[VariableString(i)].Radius)" - ], - "subInstructions": [] + ] } - ], - "events": [] + ] }, { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Comment", "color": { "b": 109, @@ -2476,44 +2208,36 @@ "textG": 0, "textR": 0 }, - "comment": "Draw the rectangle if the rectangle is picked shape: 2 and 3", - "comment2": "" + "comment": "Draw the rectangle if the rectangle is picked shape: 2 and 3" }, { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "inverted": false, "value": "BuiltinCommonInstructions::Or" }, "parameters": [], "subInstructions": [ { "type": { - "inverted": false, "value": "VarScene" }, "parameters": [ "Shapes[VariableString(i)].Type", "=", "2" - ], - "subInstructions": [] + ] }, { "type": { - "inverted": false, "value": "VarScene" }, "parameters": [ "Shapes[VariableString(i)].Type", "=", "3" - ], - "subInstructions": [] + ] } ] } @@ -2521,7 +2245,6 @@ "actions": [ { "type": { - "inverted": false, "value": "PrimitiveDrawing::Rectangle" }, "parameters": [ @@ -2530,15 +2253,11 @@ "Variable(Shapes[VariableString(i)].StartY)", "Variable(Shapes[VariableString(i)].EndX)", "Variable(Shapes[VariableString(i)].EndY)" - ], - "subInstructions": [] + ] } - ], - "events": [] + ] }, { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Comment", "color": { "b": 109, @@ -2548,32 +2267,26 @@ "textG": 0, "textR": 0 }, - "comment": "Draw the line if the line is picked shape: 4", - "comment2": "" + "comment": "Draw the line if the line is picked shape: 4" }, { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "inverted": false, "value": "BuiltinCommonInstructions::Or" }, "parameters": [], "subInstructions": [ { "type": { - "inverted": false, "value": "VarScene" }, "parameters": [ "Shapes[VariableString(i)].Type", "=", "4" - ], - "subInstructions": [] + ] } ] } @@ -2581,7 +2294,6 @@ "actions": [ { "type": { - "inverted": false, "value": "PrimitiveDrawing::Line" }, "parameters": [ @@ -2591,32 +2303,25 @@ "Variable(Shapes[VariableString(i)].EndX)", "Variable(Shapes[VariableString(i)].EndY)", "Variable(Shapes[VariableString(i)].Thickness)" - ], - "subInstructions": [] + ] } - ], - "events": [] + ] }, { - "disabled": false, - "folded": false, "type": "BuiltinCommonInstructions::Standard", "conditions": [], "actions": [ { "type": { - "inverted": false, "value": "ModVarScene" }, "parameters": [ "i", "+", "1" - ], - "subInstructions": [] + ] } - ], - "events": [] + ] } ] } @@ -2626,9 +2331,15 @@ "ambientLightColorB": 200, "ambientLightColorG": 200, "ambientLightColorR": 200, + "camera3DFarPlaneDistance": 10000, + "camera3DFieldOfView": 45, + "camera3DNearPlaneDistance": 0.1, + "cameraType": "perspective", "followBaseLayerCamera": false, "isLightingLayer": false, + "isLocked": false, "name": "", + "renderingType": "", "visibility": true, "cameras": [ { @@ -2645,7 +2356,36 @@ "effects": [] } ], - "behaviorsSharedData": [] + "behaviorsSharedData": [ + { + "name": "Animation", + "type": "AnimatableCapability::AnimatableBehavior" + }, + { + "name": "Effect", + "type": "EffectCapability::EffectBehavior" + }, + { + "name": "Flippable", + "type": "FlippableCapability::FlippableBehavior" + }, + { + "name": "Opacity", + "type": "OpacityCapability::OpacityBehavior" + }, + { + "name": "Resizable", + "type": "ResizableCapability::ResizableBehavior" + }, + { + "name": "Scale", + "type": "ScalableCapability::ScalableBehavior" + }, + { + "name": "Text", + "type": "TextContainerCapability::TextContainerBehavior" + } + ] } ], "externalEvents": [], From fe5e5cfe1ffad668d4a49367911a95e1c47312f1 Mon Sep 17 00:00:00 2001 From: Laszlo Koosz Date: Sat, 28 Sep 2024 21:27:18 +0100 Subject: [PATCH 2/4] Add extra comments and event groups Added extra comments and event groups to make it more simple to see through how the example works. --- .../advanced-shape-based-painter.json | 2150 +++++++++-------- 1 file changed, 1105 insertions(+), 1045 deletions(-) diff --git a/examples/advanced-shape-based-painter/advanced-shape-based-painter.json b/examples/advanced-shape-based-painter/advanced-shape-based-painter.json index 920e184cf..4ca19ca75 100755 --- a/examples/advanced-shape-based-painter/advanced-shape-based-painter.json +++ b/examples/advanced-shape-based-painter/advanced-shape-based-painter.json @@ -832,162 +832,124 @@ "comment": "This example is using the shape painter object to draw shapes\nAt the beginning we are creating the graphical user interface using the Shapes object which is used to select what shape to draw\nWe also use the shape drawer object to draw the lines on the screen that we can use to drag the BarSelect objects to select the color and opacitiy of the shape" }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "DepartScene" - }, - "parameters": [ - "" - ] - } - ], - "actions": [ + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Initialize", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ { - "type": { - "value": "ModVarScene" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 }, - "parameters": [ - "i", - "=", - "0" - ] - } - ], - "events": [ + "comment": "Create the 5 shape selector objects\nThe variable i is used to dynamically increase the position of the shape object instance on the Y axis :: 50;150+Variable(i)\nThe variable also used to display the correct animation for the object :: Change the animation frame of Shape to Variable(i)\nLater this value is also used to identify which shape was clicked as each shape is the animation of the same Shape object so we are using i as the ID value to identify them." + }, { - "type": "BuiltinCommonInstructions::Repeat", - "repeatExpression": "5", - "conditions": [], - "actions": [ + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { "type": { - "value": "Create" + "value": "DepartScene" }, "parameters": [ - "", - "Shapes", - "50", - "150+Variable(i)*40", "" ] - }, + } + ], + "actions": [ { "type": { - "value": "ChangeSprite" + "value": "ModVarScene" }, "parameters": [ - "Shapes", + "i", "=", - "Variable(i)" + "0" ] - }, - { - "type": { - "value": "PauseAnimation" - }, - "parameters": [ - "Shapes" - ] - }, + } + ], + "events": [ { - "type": { - "value": "ModVarScene" - }, - "parameters": [ - "i", - "+", - "1" + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "5", + "conditions": [], + "actions": [ + { + "type": { + "value": "Create" + }, + "parameters": [ + "", + "Shapes", + "50", + "150+Variable(i)*40", + "" + ] + }, + { + "type": { + "value": "ChangeSprite" + }, + "parameters": [ + "Shapes", + "=", + "Variable(i)" + ] + }, + { + "type": { + "value": "PauseAnimation" + }, + "parameters": [ + "Shapes" + ] + }, + { + "type": { + "value": "ModVarScene" + }, + "parameters": [ + "i", + "+", + "1" + ] + } ] } ] } - ] + ], + "parameters": [] }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "PrimitiveDrawing::FillColor" - }, - "parameters": [ - "Drawer", - "\"0;0;0\"" - ] - }, - { - "type": { - "value": "PrimitiveDrawing::FillOpacity" - }, - "parameters": [ - "Drawer", - "=", - "255" - ] - }, - { - "type": { - "value": "PrimitiveDrawing::OutlineSize" - }, - "parameters": [ - "Drawer", - "=", - "0" - ] - }, - { - "type": { - "value": "PrimitiveDrawing::Rectangle" - }, - "parameters": [ - "Drawer", - "50", - "400", - "305", - "405" - ] - }, - { - "type": { - "value": "PrimitiveDrawing::Rectangle" - }, - "parameters": [ - "Drawer", - "50", - "430", - "305", - "435" - ] - }, + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Update", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ { - "type": { - "value": "PrimitiveDrawing::Rectangle" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 }, - "parameters": [ - "Drawer", - "50", - "460", - "305", - "465" - ] + "comment": "Draw the color selection lines" }, - { - "type": { - "value": "PrimitiveDrawing::Rectangle" - }, - "parameters": [ - "Drawer", - "50", - "490", - "305", - "495" - ] - } - ], - "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [], @@ -998,7 +960,7 @@ }, "parameters": [ "Drawer", - "VariableString(R)+\";\"+VariableString(G)+\";\"+VariableString(B)" + "\"0;0;0\"" ] }, { @@ -1008,7 +970,17 @@ "parameters": [ "Drawer", "=", - "Variable(A)" + "255" + ] + }, + { + "type": { + "value": "PrimitiveDrawing::OutlineSize" + }, + "parameters": [ + "Drawer", + "=", + "0" ] }, { @@ -1017,115 +989,116 @@ }, "parameters": [ "Drawer", - "310", + "50", "400", - "405", - "495" + "305", + "405" ] - } - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "SourisBouton" - }, - "parameters": [ - "", - "Left" - ] - } - ], - "actions": [], - "events": [ - { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 - }, - "comment": "If the mouse is first-time pressed, set canDraw to true as an indication we can start drawing" - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + }, { "type": { - "value": "BuiltinCommonInstructions::Once" + "value": "PrimitiveDrawing::Rectangle" }, - "parameters": [] - } - ], - "actions": [ + "parameters": [ + "Drawer", + "50", + "430", + "305", + "435" + ] + }, { "type": { - "value": "SetBooleanVariable" + "value": "PrimitiveDrawing::Rectangle" }, "parameters": [ - "canDraw", - "True", - "" + "Drawer", + "50", + "460", + "305", + "465" + ] + }, + { + "type": { + "value": "PrimitiveDrawing::Rectangle" + }, + "parameters": [ + "Drawer", + "50", + "490", + "305", + "495" ] } ], "events": [ - { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 - }, - "comment": "While the pointer is down, if the pointer is over a shape, get the sprite of the object and store it number in the shape variable which is used then to pick which shape to draw\nWe also set canDraw to false to indicate we don't want to draw just yet" - }, { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "conditions": [], + "actions": [ { "type": { - "value": "SourisSurObjet" + "value": "PrimitiveDrawing::FillColor" }, "parameters": [ - "Shapes", - "", - "" + "Drawer", + "VariableString(R)+\";\"+VariableString(G)+\";\"+VariableString(B)" ] - } - ], - "actions": [ + }, { "type": { - "value": "SetBooleanVariable" + "value": "PrimitiveDrawing::FillOpacity" }, "parameters": [ - "canDraw", - "False", - "" + "Drawer", + "=", + "Variable(A)" ] }, { "type": { - "value": "ModVarScene" + "value": "PrimitiveDrawing::Rectangle" }, "parameters": [ - "shape", - "=", - "Shapes.Sprite()" + "Drawer", + "310", + "400", + "405", + "495" ] } ] - }, + } + ] + }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Draw shapes" + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SourisBouton" + }, + "parameters": [ + "", + "Left" + ] + } + ], + "actions": [], + "events": [ { "type": "BuiltinCommonInstructions::Comment", "color": { @@ -1136,20 +1109,16 @@ "textG": 0, "textR": 0 }, - "comment": "In case the pointer is over the BarSelect object that means we want to drag the object to change the color of the shape, we set isDragged value of the objec to true to indicate that we are about to drag this object\nWe also set the value of canDraw to false to indicate we don't want to draw just yet" + "comment": "If the mouse is first-time pressed, set canDraw to true as an indication we can start drawing" }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "value": "SourisSurObjet" + "value": "BuiltinCommonInstructions::Once" }, - "parameters": [ - "BarSelect", - "", - "" - ] + "parameters": [] } ], "actions": [ @@ -1159,100 +1128,10 @@ }, "parameters": [ "canDraw", - "False", - "" - ] - }, - { - "type": { - "value": "SetBooleanObjectVariable" - }, - "parameters": [ - "BarSelect", - "isDragged", "True", "" ] } - ] - }, - { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 - }, - "comment": "In case the value of canDraw is true that means the pointer is NOT over the gui element so we can start drawing the selected shape as we move the mouse\nIn order to draw a shape, the drawer object going to need some initial values such as start position of drawing, shape, shape size" - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "canDraw", - "True", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "isDrawing", - "True", - "" - ] - }, - { - "type": { - "value": "ModVarScene" - }, - "parameters": [ - "Shapes.Size", - "+", - "1" - ] - }, - { - "type": { - "value": "ModVarScene" - }, - "parameters": [ - "Shapes[VariableString(Shapes.Size)].Type", - "=", - "Variable(shape)" - ] - }, - { - "type": { - "value": "ModVarScene" - }, - "parameters": [ - "Shapes[VariableString(Shapes.Size)].StartX", - "=", - "MouseX(\"\",0)" - ] - }, - { - "type": { - "value": "ModVarScene" - }, - "parameters": [ - "Shapes[VariableString(Shapes.Size)].StartY", - "=", - "MouseY(\"\",0)" - ] - } ], "events": [ { @@ -1265,105 +1144,31 @@ "textG": 0, "textR": 0 }, - "comment": "The shape painter object has properties that we also need to set such as RGB color values, opacity and border. We set these values here and store them in variables for each different shape we can draw" - }, - { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 - }, - "comment": "Circle Filled" - }, - { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 - }, - "comment": "Rectangle Filled" - }, - { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 - }, - "comment": "Line" + "comment": "While the pointer is down, if the pointer is over a shape, get the sprite of the object and store it number in the shape variable which is used then to pick which shape to draw\nWe also set canDraw to false to indicate we don't want to draw just yet" }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "value": "BuiltinCommonInstructions::Or" + "value": "SourisSurObjet" }, - "parameters": [], - "subInstructions": [ - { - "type": { - "value": "VarScene" - }, - "parameters": [ - "shape", - "=", - "0" - ] - }, - { - "type": { - "value": "VarScene" - }, - "parameters": [ - "shape", - "=", - "2" - ] - }, - { - "type": { - "value": "VarScene" - }, - "parameters": [ - "shape", - "=", - "4" - ] - } + "parameters": [ + "Shapes", + "", + "" ] } ], "actions": [ { "type": { - "value": "ModVarScene" - }, - "parameters": [ - "Shapes[VariableString(Shapes.Size)].FillColor.R", - "=", - "Variable(R)" - ] - }, - { - "type": { - "value": "ModVarScene" + "value": "SetBooleanVariable" }, "parameters": [ - "Shapes[VariableString(Shapes.Size)].FillColor.G", - "=", - "Variable(G)" + "canDraw", + "False", + "" ] }, { @@ -1371,39 +1176,59 @@ "value": "ModVarScene" }, "parameters": [ - "Shapes[VariableString(Shapes.Size)].FillColor.B", + "shape", "=", - "Variable(B)" + "Shapes.Sprite()" ] - }, + } + ] + }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "In case the pointer is over the BarSelect object that means we want to drag the object to change the color of the shape, we set isDragged value of the objec to true to indicate that we are about to drag this object\nWe also set the value of canDraw to false to indicate we don't want to draw just yet" + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { "type": { - "value": "ModVarScene" + "value": "SourisSurObjet" }, "parameters": [ - "Shapes[VariableString(Shapes.Size)].FillOpacity", - "=", - "Variable(A)" + "BarSelect", + "", + "" ] - }, + } + ], + "actions": [ { "type": { - "value": "ModVarScene" + "value": "SetBooleanVariable" }, "parameters": [ - "Shapes[VariableString(Shapes.Size)].BorderOpacity", - "=", - "0" + "canDraw", + "False", + "" ] }, { "type": { - "value": "ModVarScene" + "value": "SetBooleanObjectVariable" }, "parameters": [ - "Shapes[VariableString(Shapes.Size)].Thickness", - "=", - "2" + "BarSelect", + "isDragged", + "True", + "" ] } ] @@ -1418,61 +1243,31 @@ "textG": 0, "textR": 0 }, - "comment": "Circle Border" - }, - { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 - }, - "comment": "Rectangle Border" + "comment": "In case the value of canDraw is true that means the pointer is NOT over the gui element so we can start drawing the selected shape as we move the mouse\nIn order to draw a shape, the drawer object going to need some initial values such as start position of drawing, shape, shape size" }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "value": "BuiltinCommonInstructions::Or" + "value": "BooleanVariable" }, - "parameters": [], - "subInstructions": [ - { - "type": { - "value": "VarScene" - }, - "parameters": [ - "shape", - "=", - "1" - ] - }, - { - "type": { - "value": "VarScene" - }, - "parameters": [ - "shape", - "=", - "3" - ] - } + "parameters": [ + "canDraw", + "True", + "" ] } ], "actions": [ { "type": { - "value": "ModVarScene" + "value": "SetBooleanVariable" }, "parameters": [ - "Shapes[VariableString(Shapes.Size)].FillOpacity", - "=", - "0" + "isDrawing", + "True", + "" ] }, { @@ -1480,9 +1275,9 @@ "value": "ModVarScene" }, "parameters": [ - "Shapes[VariableString(Shapes.Size)].BorderColor.R", - "=", - "Variable(R)" + "Shapes.Size", + "+", + "1" ] }, { @@ -1490,9 +1285,9 @@ "value": "ModVarScene" }, "parameters": [ - "Shapes[VariableString(Shapes.Size)].BorderColor.G", + "Shapes[VariableString(Shapes.Size)].Type", "=", - "Variable(G)" + "Variable(shape)" ] }, { @@ -1500,9 +1295,9 @@ "value": "ModVarScene" }, "parameters": [ - "Shapes[VariableString(Shapes.Size)].BorderColor.B", + "Shapes[VariableString(Shapes.Size)].StartX", "=", - "Variable(B)" + "MouseX(\"\",0)" ] }, { @@ -1510,105 +1305,313 @@ "value": "ModVarScene" }, "parameters": [ - "Shapes[VariableString(Shapes.Size)].BorderOpacity", + "Shapes[VariableString(Shapes.Size)].StartY", "=", - "Variable(A)" + "MouseY(\"\",0)" ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "The shape painter object has properties that we also need to set such as RGB color values, opacity and border. We set these values here and store them in variables for each different shape we can draw" }, { - "type": { - "value": "ModVarScene" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 }, - "parameters": [ - "Shapes[VariableString(Shapes.Size)].Border", - "=", - "2" - ] - } - ] - } - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 - }, - "comment": "If the pointer is down and the bar is selected BarSelect isDragged = true, move the bar" - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BooleanObjectVariable" - }, - "parameters": [ - "BarSelect", - "isDragged", - "True", - "" - ] - } - ], - "actions": [ - { - "type": { - "value": "MettreX" - }, - "parameters": [ - "BarSelect", - "=", - "MouseX(\"\",0)" - ] - } - ], - "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "PosX" - }, - "parameters": [ - "BarSelect", - "<", - "50" - ] - } - ], - "actions": [ - { - "type": { - "value": "MettreX" - }, - "parameters": [ - "BarSelect", - "=", - "50" + "comment": "Circle Filled" + }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Rectangle Filled" + }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Line" + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::Or" + }, + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "VarScene" + }, + "parameters": [ + "shape", + "=", + "0" + ] + }, + { + "type": { + "value": "VarScene" + }, + "parameters": [ + "shape", + "=", + "2" + ] + }, + { + "type": { + "value": "VarScene" + }, + "parameters": [ + "shape", + "=", + "4" + ] + } + ] + } + ], + "actions": [ + { + "type": { + "value": "ModVarScene" + }, + "parameters": [ + "Shapes[VariableString(Shapes.Size)].FillColor.R", + "=", + "Variable(R)" + ] + }, + { + "type": { + "value": "ModVarScene" + }, + "parameters": [ + "Shapes[VariableString(Shapes.Size)].FillColor.G", + "=", + "Variable(G)" + ] + }, + { + "type": { + "value": "ModVarScene" + }, + "parameters": [ + "Shapes[VariableString(Shapes.Size)].FillColor.B", + "=", + "Variable(B)" + ] + }, + { + "type": { + "value": "ModVarScene" + }, + "parameters": [ + "Shapes[VariableString(Shapes.Size)].FillOpacity", + "=", + "Variable(A)" + ] + }, + { + "type": { + "value": "ModVarScene" + }, + "parameters": [ + "Shapes[VariableString(Shapes.Size)].BorderOpacity", + "=", + "0" + ] + }, + { + "type": { + "value": "ModVarScene" + }, + "parameters": [ + "Shapes[VariableString(Shapes.Size)].Thickness", + "=", + "2" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Circle Border" + }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Rectangle Border" + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::Or" + }, + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "VarScene" + }, + "parameters": [ + "shape", + "=", + "1" + ] + }, + { + "type": { + "value": "VarScene" + }, + "parameters": [ + "shape", + "=", + "3" + ] + } + ] + } + ], + "actions": [ + { + "type": { + "value": "ModVarScene" + }, + "parameters": [ + "Shapes[VariableString(Shapes.Size)].FillOpacity", + "=", + "0" + ] + }, + { + "type": { + "value": "ModVarScene" + }, + "parameters": [ + "Shapes[VariableString(Shapes.Size)].BorderColor.R", + "=", + "Variable(R)" + ] + }, + { + "type": { + "value": "ModVarScene" + }, + "parameters": [ + "Shapes[VariableString(Shapes.Size)].BorderColor.G", + "=", + "Variable(G)" + ] + }, + { + "type": { + "value": "ModVarScene" + }, + "parameters": [ + "Shapes[VariableString(Shapes.Size)].BorderColor.B", + "=", + "Variable(B)" + ] + }, + { + "type": { + "value": "ModVarScene" + }, + "parameters": [ + "Shapes[VariableString(Shapes.Size)].BorderOpacity", + "=", + "Variable(A)" + ] + }, + { + "type": { + "value": "ModVarScene" + }, + "parameters": [ + "Shapes[VariableString(Shapes.Size)].Border", + "=", + "2" + ] + } + ] + } ] } ] }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "If the pointer is down and the bar is selected BarSelect isDragged = true, move the bar" + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "value": "PosX" + "value": "BooleanObjectVariable" }, "parameters": [ "BarSelect", - ">", - "305" + "isDragged", + "True", + "" ] } ], @@ -1620,24 +1623,7 @@ "parameters": [ "BarSelect", "=", - "305" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "ModVarObjet" - }, - "parameters": [ - "BarSelect", - "Value", - "=", - "BarSelect.X()-50" + "MouseX(\"\",0)" ] } ], @@ -1647,25 +1633,24 @@ "conditions": [ { "type": { - "value": "VarObjet" + "value": "PosX" }, "parameters": [ "BarSelect", - "ID", - "=", - "0" + "<", + "50" ] } ], "actions": [ { "type": { - "value": "ModVarScene" + "value": "MettreX" }, "parameters": [ - "R", + "BarSelect", "=", - "BarSelect.Variable(Value)" + "50" ] } ] @@ -1675,128 +1660,160 @@ "conditions": [ { "type": { - "value": "VarObjet" + "value": "PosX" }, "parameters": [ "BarSelect", - "ID", - "=", - "1" + ">", + "305" ] } ], "actions": [ { "type": { - "value": "ModVarScene" + "value": "MettreX" }, "parameters": [ - "G", + "BarSelect", "=", - "BarSelect.Variable(Value)" + "305" ] } ] }, { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "conditions": [], + "actions": [ { "type": { - "value": "VarObjet" + "value": "ModVarObjet" }, "parameters": [ "BarSelect", - "ID", + "Value", "=", - "2" + "BarSelect.X()-50" ] } ], - "actions": [ + "events": [ { - "type": { - "value": "ModVarScene" - }, - "parameters": [ - "B", - "=", - "BarSelect.Variable(Value)" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "VarObjet" + }, + "parameters": [ + "BarSelect", + "ID", + "=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "ModVarScene" + }, + "parameters": [ + "R", + "=", + "BarSelect.Variable(Value)" + ] + } ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + }, { - "type": { - "value": "VarObjet" - }, - "parameters": [ - "BarSelect", - "ID", - "=", - "3" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "VarObjet" + }, + "parameters": [ + "BarSelect", + "ID", + "=", + "1" + ] + } + ], + "actions": [ + { + "type": { + "value": "ModVarScene" + }, + "parameters": [ + "G", + "=", + "BarSelect.Variable(Value)" + ] + } ] - } - ], - "actions": [ + }, { - "type": { - "value": "ModVarScene" - }, - "parameters": [ - "A", - "=", - "BarSelect.Variable(Value)" - ] - } - ] - } - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 - }, - "comment": "If the pointer is down and the value of isDrawing = true then we can start drawing" - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BooleanVariable" - }, - "parameters": [ - "isDrawing", - "True", - "" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "VarObjet" + }, + "parameters": [ + "BarSelect", + "ID", + "=", + "2" + ] + } + ], + "actions": [ + { + "type": { + "value": "ModVarScene" + }, + "parameters": [ + "B", + "=", + "BarSelect.Variable(Value)" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "VarObjet" + }, + "parameters": [ + "BarSelect", + "ID", + "=", + "3" + ] + } + ], + "actions": [ + { + "type": { + "value": "ModVarScene" + }, + "parameters": [ + "A", + "=", + "BarSelect.Variable(Value)" + ] + } + ] + } + ] + } ] - } - ], - "actions": [], - "events": [ - { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 - }, - "comment": "Before we can start drawing, we need to initialize some more values\nIn case of circle we need to set the radius" }, { "type": "BuiltinCommonInstructions::Comment", @@ -1808,338 +1825,283 @@ "textG": 0, "textR": 0 }, - "comment": "Circle Filled" - }, - { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 - }, - "comment": "Circle Border" + "comment": "If the pointer is down and the value of isDrawing = true then we can start drawing" }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "value": "BuiltinCommonInstructions::Or" + "value": "BooleanVariable" }, - "parameters": [], - "subInstructions": [ + "parameters": [ + "isDrawing", + "True", + "" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Before we can start drawing, we need to initialize some more values\nIn case of circle we need to set the radius" + }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Circle Filled" + }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Circle Border" + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { "type": { - "value": "VarScene" + "value": "BuiltinCommonInstructions::Or" }, - "parameters": [ - "shape", - "=", - "0" + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "VarScene" + }, + "parameters": [ + "shape", + "=", + "0" + ] + }, + { + "type": { + "value": "VarScene" + }, + "parameters": [ + "shape", + "=", + "1" + ] + } ] - }, + } + ], + "actions": [ { "type": { - "value": "VarScene" + "value": "ModVarScene" }, "parameters": [ - "shape", + "Shapes[VariableString(Shapes.Size)].Radius", "=", - "1" + "sqrt( pow(MouseX(\"\",0)-Variable(Shapes[VariableString(Shapes.Size)].StartX), 2) + pow(MouseY(\"\",0)-Variable(Shapes[VariableString(Shapes.Size)].StartY), 2) )" ] } ] - } - ], - "actions": [ + }, { - "type": { - "value": "ModVarScene" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 }, - "parameters": [ - "Shapes[VariableString(Shapes.Size)].Radius", - "=", - "sqrt( pow(MouseX(\"\",0)-Variable(Shapes[VariableString(Shapes.Size)].StartX), 2) + pow(MouseY(\"\",0)-Variable(Shapes[VariableString(Shapes.Size)].StartY), 2) )" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 - }, - "comment": "In case of rectangle and line we need to set the end point of the shape" - }, - { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 - }, - "comment": "Rectangle Filled" - }, - { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 - }, - "comment": "Rectangle Border" - }, - { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 - }, - "comment": "Line" - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "comment": "In case of rectangle and line we need to set the end point of the shape" + }, { - "type": { - "value": "BuiltinCommonInstructions::Or" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 }, - "parameters": [], - "subInstructions": [ + "comment": "Rectangle Filled" + }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Rectangle Border" + }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Line" + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { "type": { - "value": "VarScene" + "value": "BuiltinCommonInstructions::Or" }, - "parameters": [ - "shape", - "=", - "2" + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "VarScene" + }, + "parameters": [ + "shape", + "=", + "2" + ] + }, + { + "type": { + "value": "VarScene" + }, + "parameters": [ + "shape", + "=", + "3" + ] + }, + { + "type": { + "value": "VarScene" + }, + "parameters": [ + "shape", + "=", + "4" + ] + } ] - }, + } + ], + "actions": [ { "type": { - "value": "VarScene" + "value": "ModVarScene" }, "parameters": [ - "shape", + "Shapes[VariableString(Shapes.Size)].EndX", "=", - "3" + "MouseX(\"\",0)" ] }, { "type": { - "value": "VarScene" + "value": "ModVarScene" }, "parameters": [ - "shape", + "Shapes[VariableString(Shapes.Size)].EndY", "=", - "4" + "MouseY(\"\",0)" ] } ] - } - ], - "actions": [ - { - "type": { - "value": "ModVarScene" - }, - "parameters": [ - "Shapes[VariableString(Shapes.Size)].EndX", - "=", - "MouseX(\"\",0)" - ] }, { - "type": { - "value": "ModVarScene" - }, - "parameters": [ - "Shapes[VariableString(Shapes.Size)].EndY", - "=", - "MouseY(\"\",0)" - ] + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [] } ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [] } ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 - }, - "comment": "If the pointer is no longer down, stop drawing" - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "inverted": true, - "value": "SourisBouton" - }, - "parameters": [ - "", - "Left" - ] - }, - { - "type": { - "value": "BuiltinCommonInstructions::Once" - }, - "parameters": [] - } - ], - "actions": [ - { - "type": { - "value": "SetBooleanVariable" - }, - "parameters": [ - "isDrawing", - "False", - "" - ] - }, - { - "type": { - "value": "SetBooleanObjectVariable" - }, - "parameters": [ - "BarSelect", - "isDragged", - "False", - "" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 - }, - "comment": "Reset the counter used to pick shape number" - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "ModVarScene" - }, - "parameters": [ - "i", - "=", - "0" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 - }, - "comment": "Repeat = the size of the rectangle struct (+1 because I like the struct start with 0)\n-draw the rectangle in the struct with index = i\n-add 1 to i\nWe apply all the properties now on the drawer object based on what shape we picked to draw, what color and opacity" - }, - { - "type": "BuiltinCommonInstructions::Repeat", - "repeatExpression": "Variable(Shapes.Size)+1", - "conditions": [], - "actions": [ - { - "type": { - "value": "PrimitiveDrawing::FillColor" - }, - "parameters": [ - "Drawer", - "VariableString(Shapes[VariableString(i)].FillColor.R)+\";\"+VariableString(Shapes[VariableString(i)].FillColor.G)+\";\"+VariableString(Shapes[VariableString(i)].FillColor.B)" - ] }, { - "type": { - "value": "PrimitiveDrawing::FillOpacity" - }, - "parameters": [ - "Drawer", - "=", - "Variable(Shapes[VariableString(i)].FillOpacity)" - ] - }, - { - "type": { - "value": "PrimitiveDrawing::OutlineColor" - }, - "parameters": [ - "Drawer", - "VariableString(Shapes[VariableString(i)].BorderColor.R)+\";\"+VariableString(Shapes[VariableString(i)].BorderColor.G)+\";\"+VariableString(Shapes[VariableString(i)].BorderColor.B)" - ] - }, - { - "type": { - "value": "PrimitiveDrawing::OutlineOpacity" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 }, - "parameters": [ - "Drawer", - "=", - "Variable(Shapes[VariableString(i)].BorderOpacity)" - ] + "comment": "If the pointer is no longer down, stop drawing" }, { - "type": { - "value": "PrimitiveDrawing::OutlineSize" - }, - "parameters": [ - "Drawer", - "=", - "Variable(Shapes[VariableString(i)].Border)" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "SourisBouton" + }, + "parameters": [ + "", + "Left" + ] + }, + { + "type": { + "value": "BuiltinCommonInstructions::Once" + }, + "parameters": [] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "isDrawing", + "False", + "" + ] + }, + { + "type": { + "value": "SetBooleanObjectVariable" + }, + "parameters": [ + "BarSelect", + "isDragged", + "False", + "" + ] + } ] - } - ], - "events": [ + }, { "type": "BuiltinCommonInstructions::Comment", "color": { @@ -2150,50 +2112,20 @@ "textG": 0, "textR": 0 }, - "comment": "Draw the circle if the circle is picked shape 0 and 1" + "comment": "Reset the counter used to pick shape number" }, { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "BuiltinCommonInstructions::Or" - }, - "parameters": [], - "subInstructions": [ - { - "type": { - "value": "VarScene" - }, - "parameters": [ - "Shapes[VariableString(i)].Type", - "=", - "0" - ] - }, - { - "type": { - "value": "VarScene" - }, - "parameters": [ - "Shapes[VariableString(i)].Type", - "=", - "1" - ] - } - ] - } - ], + "conditions": [], "actions": [ { "type": { - "value": "PrimitiveDrawing::Circle" + "value": "ModVarScene" }, "parameters": [ - "Drawer", - "Variable(Shapes[VariableString(i)].StartX)", - "Variable(Shapes[VariableString(i)].StartY)", - "Variable(Shapes[VariableString(i)].Radius)" + "i", + "=", + "0" ] } ] @@ -2208,122 +2140,250 @@ "textG": 0, "textR": 0 }, - "comment": "Draw the rectangle if the rectangle is picked shape: 2 and 3" + "comment": "Repeat = the size of the rectangle struct (+1 because I like the struct start with 0)\n-draw the rectangle in the struct with index = i\n-add 1 to i\nWe apply all the properties now on the drawer object based on what shape we picked to draw, what color and opacity" }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "Variable(Shapes.Size)+1", + "conditions": [], + "actions": [ + { + "type": { + "value": "PrimitiveDrawing::FillColor" + }, + "parameters": [ + "Drawer", + "VariableString(Shapes[VariableString(i)].FillColor.R)+\";\"+VariableString(Shapes[VariableString(i)].FillColor.G)+\";\"+VariableString(Shapes[VariableString(i)].FillColor.B)" + ] + }, + { + "type": { + "value": "PrimitiveDrawing::FillOpacity" + }, + "parameters": [ + "Drawer", + "=", + "Variable(Shapes[VariableString(i)].FillOpacity)" + ] + }, + { + "type": { + "value": "PrimitiveDrawing::OutlineColor" + }, + "parameters": [ + "Drawer", + "VariableString(Shapes[VariableString(i)].BorderColor.R)+\";\"+VariableString(Shapes[VariableString(i)].BorderColor.G)+\";\"+VariableString(Shapes[VariableString(i)].BorderColor.B)" + ] + }, + { + "type": { + "value": "PrimitiveDrawing::OutlineOpacity" + }, + "parameters": [ + "Drawer", + "=", + "Variable(Shapes[VariableString(i)].BorderOpacity)" + ] + }, { "type": { - "value": "BuiltinCommonInstructions::Or" + "value": "PrimitiveDrawing::OutlineSize" + }, + "parameters": [ + "Drawer", + "=", + "Variable(Shapes[VariableString(i)].Border)" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 }, - "parameters": [], - "subInstructions": [ + "comment": "Draw the circle if the circle is picked shape 0 and 1" + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ { "type": { - "value": "VarScene" + "value": "BuiltinCommonInstructions::Or" }, - "parameters": [ - "Shapes[VariableString(i)].Type", - "=", - "2" + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "VarScene" + }, + "parameters": [ + "Shapes[VariableString(i)].Type", + "=", + "0" + ] + }, + { + "type": { + "value": "VarScene" + }, + "parameters": [ + "Shapes[VariableString(i)].Type", + "=", + "1" + ] + } ] - }, + } + ], + "actions": [ { "type": { - "value": "VarScene" + "value": "PrimitiveDrawing::Circle" }, "parameters": [ - "Shapes[VariableString(i)].Type", - "=", - "3" + "Drawer", + "Variable(Shapes[VariableString(i)].StartX)", + "Variable(Shapes[VariableString(i)].StartY)", + "Variable(Shapes[VariableString(i)].Radius)" ] } ] - } - ], - "actions": [ + }, { - "type": { - "value": "PrimitiveDrawing::Rectangle" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 }, - "parameters": [ - "Drawer", - "Variable(Shapes[VariableString(i)].StartX)", - "Variable(Shapes[VariableString(i)].StartY)", - "Variable(Shapes[VariableString(i)].EndX)", - "Variable(Shapes[VariableString(i)].EndY)" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 - }, - "comment": "Draw the line if the line is picked shape: 4" - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + "comment": "Draw the rectangle if the rectangle is picked shape: 2 and 3" + }, { - "type": { - "value": "BuiltinCommonInstructions::Or" - }, - "parameters": [], - "subInstructions": [ + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::Or" + }, + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "VarScene" + }, + "parameters": [ + "Shapes[VariableString(i)].Type", + "=", + "2" + ] + }, + { + "type": { + "value": "VarScene" + }, + "parameters": [ + "Shapes[VariableString(i)].Type", + "=", + "3" + ] + } + ] + } + ], + "actions": [ { "type": { - "value": "VarScene" + "value": "PrimitiveDrawing::Rectangle" }, "parameters": [ - "Shapes[VariableString(i)].Type", - "=", - "4" + "Drawer", + "Variable(Shapes[VariableString(i)].StartX)", + "Variable(Shapes[VariableString(i)].StartY)", + "Variable(Shapes[VariableString(i)].EndX)", + "Variable(Shapes[VariableString(i)].EndY)" ] } ] - } - ], - "actions": [ + }, { - "type": { - "value": "PrimitiveDrawing::Line" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 }, - "parameters": [ - "Drawer", - "Variable(Shapes[VariableString(i)].StartX)", - "Variable(Shapes[VariableString(i)].StartY)", - "Variable(Shapes[VariableString(i)].EndX)", - "Variable(Shapes[VariableString(i)].EndY)", - "Variable(Shapes[VariableString(i)].Thickness)" + "comment": "Draw the line if the line is picked shape: 4" + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::Or" + }, + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "VarScene" + }, + "parameters": [ + "Shapes[VariableString(i)].Type", + "=", + "4" + ] + } + ] + } + ], + "actions": [ + { + "type": { + "value": "PrimitiveDrawing::Line" + }, + "parameters": [ + "Drawer", + "Variable(Shapes[VariableString(i)].StartX)", + "Variable(Shapes[VariableString(i)].StartY)", + "Variable(Shapes[VariableString(i)].EndX)", + "Variable(Shapes[VariableString(i)].EndY)", + "Variable(Shapes[VariableString(i)].Thickness)" + ] + } ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ + }, { - "type": { - "value": "ModVarScene" - }, - "parameters": [ - "i", - "+", - "1" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "ModVarScene" + }, + "parameters": [ + "i", + "+", + "1" + ] + } ] } ] } - ] + ], + "parameters": [] } ], "layers": [ From f0f6333b1c16c3bed4808f2916e90514db298644 Mon Sep 17 00:00:00 2001 From: Laszlo Koosz Date: Sat, 28 Sep 2024 21:35:41 +0100 Subject: [PATCH 3/4] Add RGBA text Added RGBA text to color selection lines --- .../advanced-shape-based-painter.json | 246 +++++++++++++++++- 1 file changed, 243 insertions(+), 3 deletions(-) diff --git a/examples/advanced-shape-based-painter/advanced-shape-based-painter.json b/examples/advanced-shape-based-painter/advanced-shape-based-painter.json index 4ca19ca75..1d2d1d622 100755 --- a/examples/advanced-shape-based-painter/advanced-shape-based-painter.json +++ b/examples/advanced-shape-based-painter/advanced-shape-based-painter.json @@ -143,13 +143,13 @@ "uiSettings": { "grid": false, "gridType": "rectangular", - "gridWidth": 32, - "gridHeight": 32, + "gridWidth": 4, + "gridHeight": 4, "gridOffsetX": 0, "gridOffsetY": 0, "gridColor": 10401023, "gridAlpha": 0.8, - "snap": true, + "snap": false, "zoomFactor": 1, "windowMask": false }, @@ -431,6 +431,70 @@ "numberProperties": [], "stringProperties": [], "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "keepRatio": true, + "layer": "", + "name": "R", + "persistentUuid": "c4767c7f-6713-4f33-9c45-7e7365d8507c", + "width": 0, + "x": 16, + "y": 396, + "zOrder": 3, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "keepRatio": true, + "layer": "", + "name": "G", + "persistentUuid": "225ea3ac-d21c-4eaa-876d-45d7cd69985a", + "width": 0, + "x": 16, + "y": 428, + "zOrder": 4, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "keepRatio": true, + "layer": "", + "name": "B", + "persistentUuid": "ae04b256-ffb5-45d7-8f2b-0f0d90bc76d7", + "width": 0, + "x": 16, + "y": 460, + "zOrder": 5, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "keepRatio": true, + "layer": "", + "name": "A", + "persistentUuid": "44b9e403-94a8-43bc-8c5f-d1ce29992895", + "width": 0, + "x": 16, + "y": 488, + "zOrder": 6, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] } ], "objects": [ @@ -799,6 +863,170 @@ "characterSize": 20, "color": "0;0;0" } + }, + { + "assetStoreId": "", + "bold": false, + "italic": false, + "name": "R", + "smoothed": true, + "type": "TextObject::Text", + "underlined": false, + "variables": [], + "effects": [], + "behaviors": [], + "string": "R", + "font": "", + "textAlignment": "left", + "characterSize": 20, + "color": { + "b": 27, + "g": 2, + "r": 208 + }, + "content": { + "bold": false, + "isOutlineEnabled": false, + "isShadowEnabled": false, + "italic": false, + "outlineColor": "255;255;255", + "outlineThickness": 2, + "shadowAngle": 90, + "shadowBlurRadius": 2, + "shadowColor": "0;0;0", + "shadowDistance": 4, + "shadowOpacity": 127, + "smoothed": true, + "underlined": false, + "text": "R", + "font": "", + "textAlignment": "left", + "characterSize": 20, + "color": "208;2;27" + } + }, + { + "assetStoreId": "", + "bold": false, + "italic": false, + "name": "G", + "smoothed": true, + "type": "TextObject::Text", + "underlined": false, + "variables": [], + "effects": [], + "behaviors": [], + "string": "G", + "font": "", + "textAlignment": "left", + "characterSize": 20, + "color": { + "b": 33, + "g": 211, + "r": 126 + }, + "content": { + "bold": false, + "isOutlineEnabled": false, + "isShadowEnabled": false, + "italic": false, + "outlineColor": "255;255;255", + "outlineThickness": 2, + "shadowAngle": 90, + "shadowBlurRadius": 2, + "shadowColor": "0;0;0", + "shadowDistance": 4, + "shadowOpacity": 127, + "smoothed": true, + "underlined": false, + "text": "G", + "font": "", + "textAlignment": "left", + "characterSize": 20, + "color": "126;211;33" + } + }, + { + "assetStoreId": "", + "bold": false, + "italic": false, + "name": "B", + "smoothed": true, + "type": "TextObject::Text", + "underlined": false, + "variables": [], + "effects": [], + "behaviors": [], + "string": "B", + "font": "", + "textAlignment": "left", + "characterSize": 20, + "color": { + "b": 250, + "g": 58, + "r": 0 + }, + "content": { + "bold": false, + "isOutlineEnabled": false, + "isShadowEnabled": false, + "italic": false, + "outlineColor": "255;255;255", + "outlineThickness": 2, + "shadowAngle": 90, + "shadowBlurRadius": 2, + "shadowColor": "0;0;0", + "shadowDistance": 4, + "shadowOpacity": 127, + "smoothed": true, + "underlined": false, + "text": "B", + "font": "", + "textAlignment": "left", + "characterSize": 20, + "color": "0;58;250" + } + }, + { + "assetStoreId": "", + "bold": false, + "italic": false, + "name": "A", + "smoothed": true, + "type": "TextObject::Text", + "underlined": false, + "variables": [], + "effects": [], + "behaviors": [], + "string": "A", + "font": "", + "textAlignment": "left", + "characterSize": 20, + "color": { + "b": 0, + "g": 0, + "r": 0 + }, + "content": { + "bold": false, + "isOutlineEnabled": false, + "isShadowEnabled": false, + "italic": false, + "outlineColor": "255;255;255", + "outlineThickness": 2, + "shadowAngle": 90, + "shadowBlurRadius": 2, + "shadowColor": "0;0;0", + "shadowDistance": 4, + "shadowOpacity": 127, + "smoothed": true, + "underlined": false, + "text": "A", + "font": "", + "textAlignment": "left", + "characterSize": 20, + "color": "0;0;0" + } } ], "objectsFolderStructure": { @@ -807,6 +1035,15 @@ { "objectName": "Drawer" }, + { + "objectName": "R" + }, + { + "objectName": "G" + }, + { + "objectName": "B" + }, { "objectName": "Shapes" }, @@ -815,6 +1052,9 @@ }, { "objectName": "message" + }, + { + "objectName": "A" } ] }, From 72131534ff710f0db4fb6e4fb4b0801da26756ef Mon Sep 17 00:00:00 2001 From: Laszlo Koosz Date: Sun, 29 Sep 2024 11:29:01 +0100 Subject: [PATCH 4/4] Fix corrupted project Variable types in variable editors was wrong, variable expressions in some events were also wrong and replaced all legacy variable events with the new universal variable event. Rounded the Value of BarSelect, it seemed float value can not be used as color --- .../advanced-shape-based-painter.json | 244 +++++++++--------- 1 file changed, 118 insertions(+), 126 deletions(-) diff --git a/examples/advanced-shape-based-painter/advanced-shape-based-painter.json b/examples/advanced-shape-based-painter/advanced-shape-based-painter.json index 1d2d1d622..1521c78f3 100755 --- a/examples/advanced-shape-based-painter/advanced-shape-based-painter.json +++ b/examples/advanced-shape-based-painter/advanced-shape-based-painter.json @@ -165,8 +165,8 @@ "children": [ { "name": "Border", - "type": "string", - "value": "0" + "type": "number", + "value": 0 }, { "name": "BorderColor", @@ -191,18 +191,18 @@ }, { "name": "BorderOpacity", - "type": "string", - "value": "0" + "type": "number", + "value": 0 }, { "name": "EndX", - "type": "string", - "value": "0" + "type": "number", + "value": 0 }, { "name": "EndY", - "type": "string", - "value": "0" + "type": "number", + "value": 0 }, { "name": "FillColor", @@ -227,47 +227,47 @@ }, { "name": "FillOpacity", - "type": "string", - "value": "0" + "type": "number", + "value": 0 }, { "name": "Radius", - "type": "string", - "value": "0" + "type": "number", + "value": 0 }, { "name": "StartX", - "type": "string", - "value": "0" + "type": "number", + "value": 0 }, { "name": "StartY", - "type": "string", - "value": "0" + "type": "number", + "value": 0 }, { "name": "Thickness", - "type": "string", - "value": "0" + "type": "number", + "value": 0 }, { "name": "Type", - "type": "string", - "value": "0" + "type": "number", + "value": 0 } ] }, { "name": "Size", - "type": "string", - "value": "-1" + "type": "number", + "value": -1 } ] }, { "name": "i", - "type": "string", - "value": "0" + "type": "number", + "value": 0 }, { "name": "else", @@ -276,8 +276,8 @@ }, { "name": "shape", - "type": "string", - "value": "0" + "type": "number", + "value": 0 }, { "name": "isDrawing", @@ -301,8 +301,8 @@ }, { "name": "A", - "type": "string", - "value": "100" + "type": "number", + "value": 100 }, { "folded": true, @@ -348,9 +348,10 @@ "stringProperties": [], "initialVariables": [ { + "folded": true, "name": "ID", - "type": "string", - "value": "3" + "type": "number", + "value": 3 } ] }, @@ -367,13 +368,7 @@ "zOrder": 1, "numberProperties": [], "stringProperties": [], - "initialVariables": [ - { - "name": "ID", - "type": "string", - "value": "0" - } - ] + "initialVariables": [] }, { "angle": 0, @@ -390,9 +385,10 @@ "stringProperties": [], "initialVariables": [ { + "folded": true, "name": "ID", - "type": "string", - "value": "1" + "type": "number", + "value": 1 } ] }, @@ -411,9 +407,10 @@ "stringProperties": [], "initialVariables": [ { + "folded": true, "name": "ID", - "type": "string", - "value": "2" + "type": "number", + "value": 2 } ] }, @@ -438,7 +435,7 @@ "height": 0, "keepRatio": true, "layer": "", - "name": "R", + "name": "ObjR", "persistentUuid": "c4767c7f-6713-4f33-9c45-7e7365d8507c", "width": 0, "x": 16, @@ -454,7 +451,7 @@ "height": 0, "keepRatio": true, "layer": "", - "name": "G", + "name": "ObjG", "persistentUuid": "225ea3ac-d21c-4eaa-876d-45d7cd69985a", "width": 0, "x": 16, @@ -470,7 +467,7 @@ "height": 0, "keepRatio": true, "layer": "", - "name": "B", + "name": "ObjB", "persistentUuid": "ae04b256-ffb5-45d7-8f2b-0f0d90bc76d7", "width": 0, "x": 16, @@ -486,7 +483,7 @@ "height": 0, "keepRatio": true, "layer": "", - "name": "A", + "name": "ObjA", "persistentUuid": "44b9e403-94a8-43bc-8c5f-d1ce29992895", "width": 0, "x": 16, @@ -551,7 +548,7 @@ { "adaptCollisionMaskAutomatically": false, "assetStoreId": "", - "name": "Shapes", + "name": "ObjShapes", "type": "Sprite", "updateIfNotVisible": true, "variables": [], @@ -766,8 +763,14 @@ }, { "name": "Value", - "type": "string", - "value": "0" + "type": "number", + "value": 0 + }, + { + "folded": true, + "name": "ID", + "type": "number", + "value": 0 } ], "effects": [], @@ -868,7 +871,7 @@ "assetStoreId": "", "bold": false, "italic": false, - "name": "R", + "name": "ObjR", "smoothed": true, "type": "TextObject::Text", "underlined": false, @@ -909,7 +912,7 @@ "assetStoreId": "", "bold": false, "italic": false, - "name": "G", + "name": "ObjG", "smoothed": true, "type": "TextObject::Text", "underlined": false, @@ -950,7 +953,7 @@ "assetStoreId": "", "bold": false, "italic": false, - "name": "B", + "name": "ObjB", "smoothed": true, "type": "TextObject::Text", "underlined": false, @@ -991,7 +994,7 @@ "assetStoreId": "", "bold": false, "italic": false, - "name": "A", + "name": "ObjA", "smoothed": true, "type": "TextObject::Text", "underlined": false, @@ -1036,16 +1039,16 @@ "objectName": "Drawer" }, { - "objectName": "R" + "objectName": "ObjR" }, { - "objectName": "G" + "objectName": "ObjG" }, { - "objectName": "B" + "objectName": "ObjB" }, { - "objectName": "Shapes" + "objectName": "ObjShapes" }, { "objectName": "BarSelect" @@ -1054,7 +1057,7 @@ "objectName": "message" }, { - "objectName": "A" + "objectName": "ObjA" } ] }, @@ -1104,18 +1107,7 @@ ] } ], - "actions": [ - { - "type": { - "value": "ModVarScene" - }, - "parameters": [ - "i", - "=", - "0" - ] - } - ], + "actions": [], "events": [ { "type": "BuiltinCommonInstructions::Repeat", @@ -1128,7 +1120,7 @@ }, "parameters": [ "", - "Shapes", + "ObjShapes", "50", "150+Variable(i)*40", "" @@ -1139,7 +1131,7 @@ "value": "ChangeSprite" }, "parameters": [ - "Shapes", + "ObjShapes", "=", "Variable(i)" ] @@ -1149,12 +1141,12 @@ "value": "PauseAnimation" }, "parameters": [ - "Shapes" + "ObjShapes" ] }, { "type": { - "value": "ModVarScene" + "value": "SetNumberVariable" }, "parameters": [ "i", @@ -1394,7 +1386,7 @@ "value": "SourisSurObjet" }, "parameters": [ - "Shapes", + "ObjShapes", "", "" ] @@ -1413,12 +1405,12 @@ }, { "type": { - "value": "ModVarScene" + "value": "SetNumberVariable" }, "parameters": [ "shape", "=", - "Shapes.Sprite()" + "ObjShapes.Sprite()" ] } ] @@ -1512,7 +1504,7 @@ }, { "type": { - "value": "ModVarScene" + "value": "SetNumberVariable" }, "parameters": [ "Shapes.Size", @@ -1522,7 +1514,7 @@ }, { "type": { - "value": "ModVarScene" + "value": "SetNumberVariable" }, "parameters": [ "Shapes[VariableString(Shapes.Size)].Type", @@ -1532,7 +1524,7 @@ }, { "type": { - "value": "ModVarScene" + "value": "SetNumberVariable" }, "parameters": [ "Shapes[VariableString(Shapes.Size)].StartX", @@ -1542,7 +1534,7 @@ }, { "type": { - "value": "ModVarScene" + "value": "SetNumberVariable" }, "parameters": [ "Shapes[VariableString(Shapes.Size)].StartY", @@ -1611,7 +1603,7 @@ "subInstructions": [ { "type": { - "value": "VarScene" + "value": "NumberVariable" }, "parameters": [ "shape", @@ -1621,7 +1613,7 @@ }, { "type": { - "value": "VarScene" + "value": "NumberVariable" }, "parameters": [ "shape", @@ -1631,7 +1623,7 @@ }, { "type": { - "value": "VarScene" + "value": "NumberVariable" }, "parameters": [ "shape", @@ -1645,37 +1637,37 @@ "actions": [ { "type": { - "value": "ModVarScene" + "value": "SetStringVariable" }, "parameters": [ "Shapes[VariableString(Shapes.Size)].FillColor.R", "=", - "Variable(R)" + "VariableString(R)" ] }, { "type": { - "value": "ModVarScene" + "value": "SetStringVariable" }, "parameters": [ "Shapes[VariableString(Shapes.Size)].FillColor.G", "=", - "Variable(G)" + "VariableString(G)" ] }, { "type": { - "value": "ModVarScene" + "value": "SetStringVariable" }, "parameters": [ "Shapes[VariableString(Shapes.Size)].FillColor.B", "=", - "Variable(B)" + "VariableString(B)" ] }, { "type": { - "value": "ModVarScene" + "value": "SetNumberVariable" }, "parameters": [ "Shapes[VariableString(Shapes.Size)].FillOpacity", @@ -1685,7 +1677,7 @@ }, { "type": { - "value": "ModVarScene" + "value": "SetNumberVariable" }, "parameters": [ "Shapes[VariableString(Shapes.Size)].BorderOpacity", @@ -1695,7 +1687,7 @@ }, { "type": { - "value": "ModVarScene" + "value": "SetNumberVariable" }, "parameters": [ "Shapes[VariableString(Shapes.Size)].Thickness", @@ -1740,7 +1732,7 @@ "subInstructions": [ { "type": { - "value": "VarScene" + "value": "NumberVariable" }, "parameters": [ "shape", @@ -1750,7 +1742,7 @@ }, { "type": { - "value": "VarScene" + "value": "NumberVariable" }, "parameters": [ "shape", @@ -1764,7 +1756,7 @@ "actions": [ { "type": { - "value": "ModVarScene" + "value": "SetNumberVariable" }, "parameters": [ "Shapes[VariableString(Shapes.Size)].FillOpacity", @@ -1774,37 +1766,37 @@ }, { "type": { - "value": "ModVarScene" + "value": "SetStringVariable" }, "parameters": [ "Shapes[VariableString(Shapes.Size)].BorderColor.R", "=", - "Variable(R)" + "VariableString(R)" ] }, { "type": { - "value": "ModVarScene" + "value": "SetStringVariable" }, "parameters": [ "Shapes[VariableString(Shapes.Size)].BorderColor.G", "=", - "Variable(G)" + "VariableString(G)" ] }, { "type": { - "value": "ModVarScene" + "value": "SetStringVariable" }, "parameters": [ "Shapes[VariableString(Shapes.Size)].BorderColor.B", "=", - "Variable(B)" + "VariableString(B)" ] }, { "type": { - "value": "ModVarScene" + "value": "SetNumberVariable" }, "parameters": [ "Shapes[VariableString(Shapes.Size)].BorderOpacity", @@ -1814,7 +1806,7 @@ }, { "type": { - "value": "ModVarScene" + "value": "SetNumberVariable" }, "parameters": [ "Shapes[VariableString(Shapes.Size)].Border", @@ -1928,13 +1920,13 @@ "actions": [ { "type": { - "value": "ModVarObjet" + "value": "SetNumberObjectVariable" }, "parameters": [ "BarSelect", "Value", "=", - "BarSelect.X()-50" + "floor(BarSelect.X()-50)" ] } ], @@ -1957,12 +1949,12 @@ "actions": [ { "type": { - "value": "ModVarScene" + "value": "SetStringVariable" }, "parameters": [ "R", "=", - "BarSelect.Variable(Value)" + "ToString(BarSelect.Variable(Value))" ] } ] @@ -1985,12 +1977,12 @@ "actions": [ { "type": { - "value": "ModVarScene" + "value": "SetStringVariable" }, "parameters": [ "G", "=", - "BarSelect.Variable(Value)" + "ToString(BarSelect.Variable(Value))" ] } ] @@ -2013,12 +2005,12 @@ "actions": [ { "type": { - "value": "ModVarScene" + "value": "SetStringVariable" }, "parameters": [ "B", "=", - "BarSelect.Variable(Value)" + "ToString(BarSelect.Variable(Value))" ] } ] @@ -2041,7 +2033,7 @@ "actions": [ { "type": { - "value": "ModVarScene" + "value": "SetNumberVariable" }, "parameters": [ "A", @@ -2130,7 +2122,7 @@ "subInstructions": [ { "type": { - "value": "VarScene" + "value": "NumberVariable" }, "parameters": [ "shape", @@ -2140,7 +2132,7 @@ }, { "type": { - "value": "VarScene" + "value": "NumberVariable" }, "parameters": [ "shape", @@ -2154,7 +2146,7 @@ "actions": [ { "type": { - "value": "ModVarScene" + "value": "SetNumberVariable" }, "parameters": [ "Shapes[VariableString(Shapes.Size)].Radius", @@ -2223,7 +2215,7 @@ "subInstructions": [ { "type": { - "value": "VarScene" + "value": "NumberVariable" }, "parameters": [ "shape", @@ -2233,7 +2225,7 @@ }, { "type": { - "value": "VarScene" + "value": "NumberVariable" }, "parameters": [ "shape", @@ -2243,7 +2235,7 @@ }, { "type": { - "value": "VarScene" + "value": "NumberVariable" }, "parameters": [ "shape", @@ -2257,7 +2249,7 @@ "actions": [ { "type": { - "value": "ModVarScene" + "value": "SetNumberVariable" }, "parameters": [ "Shapes[VariableString(Shapes.Size)].EndX", @@ -2267,7 +2259,7 @@ }, { "type": { - "value": "ModVarScene" + "value": "SetNumberVariable" }, "parameters": [ "Shapes[VariableString(Shapes.Size)].EndY", @@ -2460,7 +2452,7 @@ "subInstructions": [ { "type": { - "value": "VarScene" + "value": "NumberVariable" }, "parameters": [ "Shapes[VariableString(i)].Type", @@ -2470,7 +2462,7 @@ }, { "type": { - "value": "VarScene" + "value": "NumberVariable" }, "parameters": [ "Shapes[VariableString(i)].Type", @@ -2518,7 +2510,7 @@ "subInstructions": [ { "type": { - "value": "VarScene" + "value": "NumberVariable" }, "parameters": [ "Shapes[VariableString(i)].Type", @@ -2528,7 +2520,7 @@ }, { "type": { - "value": "VarScene" + "value": "NumberVariable" }, "parameters": [ "Shapes[VariableString(i)].Type", @@ -2577,7 +2569,7 @@ "subInstructions": [ { "type": { - "value": "VarScene" + "value": "NumberVariable" }, "parameters": [ "Shapes[VariableString(i)].Type", @@ -2610,7 +2602,7 @@ "actions": [ { "type": { - "value": "ModVarScene" + "value": "SetNumberVariable" }, "parameters": [ "i",