Tools to help you build and debug your sketches. These are not part of your game β they're overlays that help you understand the coordinate system and position things.
Shows a coordinate grid overlay on your canvas with a crosshair that follows your mouse. Super useful when you're trying to figure out where to place shapes! Call it once in setup() and it stays on every frame.
| Parameter | Type | Description |
|---|---|---|
gridSizeoptional | number | Spacing between grid lines in pixels (default: 50) |
gridColoroptional | string | Color of the grid lines (default: "rgba(0,0,0,0.15)") |
labelColoroptional | string | Color of the number labels (default: "rgba(0,0,0,0.4)") |
markerColoroptional | string | Color of the crosshair and coordinate label (default: "red") |
function setup() {
size(400, 300);
gridHelper();
}
function draw() {
background("skyblue");
fill("tomato");
circle(200, 150, 40);
fill("gold");
rect(50, 50, 80, 60);
}