Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create DrawGrid.json #1174

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
305 changes: 305 additions & 0 deletions extensions/community/DrawGrid.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,305 @@
{
"author": "",
"category": "Game mechanic",
"extensionNamespace": "",
"fullName": "Draw Grid",
"helpPath": "",
"iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0ibWRpLWdyaWQtbGFyZ2UiIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNNCwySDIwQTIsMiAwIDAsMSAyMiw0VjIwQTIsMiAwIDAsMSAyMCwyMkg0QzIuOTIsMjIgMiwyMS4xIDIsMjBWNEEyLDIgMCAwLDEgNCwyTTQsNFYxMUgxMVY0SDRNNCwyMEgxMVYxM0g0VjIwTTIwLDIwVjEzSDEzVjIwSDIwTTIwLDRIMTNWMTFIMjBWNFoiIC8+PC9zdmc+",
"name": "DrawGrid",
"previewIconUrl": "https://asset-resources.gdevelop.io/public-resources/Icons/f70f7577000abf9f1547244d623aeb4f3f223ad7113371890503518be605cc27_grid-large.svg",
"shortDescription": "Draw a virtual grid.",
"version": "1.0.0",
"description": [
"This draws a virtual grid.",
"",
"It's useful for:",
"- level editors",
"- building systems."
],
"tags": [
"snap",
"grid",
"positioning",
"tiles"
],
"authorIds": [
"jy7FXnGX0ZZcWfrAI9YuQaeIphi1"
],
"dependencies": [],
"eventsFunctions": [
{
"description": "Draw a virtual grid (i.e: this is not the grid used in the editor).",
"fullName": "Draw grid",
"functionType": "Action",
"name": "DrawGrid",
"sentence": "Draw _PARAM1_ as a virtual grid using cells with width: _PARAM3_px, height _PARAM4_px an offset position (_PARAM5_; _PARAM6_) and a thickness of (_PARAM7_;_PARAM8_)",
"events": [
{
"type": "BuiltinCommonInstructions::Standard",
"conditions": [
{
"type": {
"value": "BuiltinCommonInstructions::Once"
},
"parameters": []
}
],
"actions": [],
"events": [
{
"type": "BuiltinCommonInstructions::Standard",
"conditions": [
{
"type": {
"value": "SceneInstancesCount"
},
"parameters": [
"",
"object",
"=",
"0"
]
}
],
"actions": [
{
"type": {
"value": "Create"
},
"parameters": [
"",
"object",
"0",
"0",
""
]
}
]
},
{
"type": "BuiltinCommonInstructions::Standard",
"conditions": [],
"actions": [
{
"type": {
"value": "ModVarScene"
},
"parameters": [
"__posX",
"=",
"OffsetX"
]
},
{
"type": {
"value": "ModVarScene"
},
"parameters": [
"__posY",
"=",
"OffsetY"
]
},
{
"type": {
"value": "ModVarScene"
},
"parameters": [
"__lineIndex",
"=",
"0"
]
}
]
},
{
"type": "BuiltinCommonInstructions::Standard",
"conditions": [],
"actions": [
{
"type": {
"value": "PrimitiveDrawing::OutlineColor"
},
"parameters": [
"object",
"outlineColor"
]
}
]
},
{
"type": "BuiltinCommonInstructions::Repeat",
"repeatExpression": "gridHeight/cellWidth",
"conditions": [],
"actions": [
{
"type": {
"value": "PrimitiveDrawing::LineV2"
},
"parameters": [
"object",
"cellWidth * Variable(__lineIndex) + OffsetX",
"0",
"cellWidth * Variable(__lineIndex) + OffsetX",
"gridHeight",
"cellWidthTickness"
]
},
{
"type": {
"value": "ModVarScene"
},
"parameters": [
"__lineIndex",
"+",
"1"
]
}
]
},
{
"type": "BuiltinCommonInstructions::Standard",
"conditions": [],
"actions": [
{
"type": {
"value": "ModVarScene"
},
"parameters": [
"__lineIndex",
"=",
"0"
]
}
]
},
{
"type": "BuiltinCommonInstructions::Repeat",
"repeatExpression": "gridWidth/cellHeight",
"conditions": [
{
"type": {
"value": "BuiltinCommonInstructions::Once"
},
"parameters": []
}
],
"actions": [
{
"type": {
"value": "PrimitiveDrawing::LineV2"
},
"parameters": [
"object",
"0",
"cellHeight * Variable(__lineIndex) + OffsetY",
"gridWidth",
"cellHeight * Variable(__lineIndex) + OffsetY",
"cellWidthTickness"
]
},
{
"type": {
"value": "ModVarScene"
},
"parameters": [
"__lineIndex",
"+",
"1"
]
}
]
},
{
"type": "BuiltinCommonInstructions::Standard",
"conditions": [],
"actions": [
{
"type": {
"value": "PrimitiveDrawing::ClearBetweenFrames"
},
"parameters": [
"object",
"80"
]
},
{
"type": {
"value": "PrimitiveDrawing::UseRelativeCoordinates"
},
"parameters": [
"object",
""
]
}
]
}
]
}
],
"parameters": [
{
"description": "Object to draw the grid",
"name": "object",
"supplementaryInformation": "PrimitiveDrawing::Drawer",
"type": "objectList"
},
{
"description": "Layer to draw the grid",
"name": "layer",
"type": "layer"
},
{
"description": "Cell width (in pixels)",
"name": "cellWidth",
"type": "expression"
},
{
"description": "Cell height (in pixels)",
"name": "cellHeight",
"type": "expression"
},
{
"description": "Offset on the X axis of the virtual grid (in pixels)",
"name": "OffsetX",
"type": "expression"
},
{
"description": "Offset on the Y axis of the virtual grid (in pixels)",
"name": "OffsetY",
"type": "expression"
},
{
"description": "Cell width thickness (in pixels)",
"name": "cellWidthTickness",
"type": "expression"
},
{
"description": "Cell height thickness (in pixels)",
"name": "cellHeightTickness",
"type": "expression"
},
{
"description": "Grid width (in pixels)",
"longDescription": "SceneWindowWidth()",
"name": "gridWidth",
"type": "expression"
},
{
"description": "Grid Height (in pixels)",
"longDescription": "SceneWindowHeight()",
"name": "gridHeight",
"type": "expression"
},
{
"description": "Grid color",
"name": "outlineColor",
"type": "color"
}
],
"objectGroups": []
}
],
"eventsBasedBehaviors": [],
"eventsBasedObjects": []
}