Skip to content

Instantly share code, notes, and snippets.

@BrentAureli
Created July 20, 2018 12:37
Show Gist options
  • Save BrentAureli/91f39fa4730073ab0005681de62ed83b to your computer and use it in GitHub Desktop.
Save BrentAureli/91f39fa4730073ab0005681de62ed83b to your computer and use it in GitHub Desktop.
function drawGrid(){
for (var i = 0; i < cols; i++) {
for (var j = 0; j < rows; j++) {
grid[i][j].draw() //grid is a 2D array of nodes
}
}
}
//inside node class
draw(){
if(this.active)
fill(255, 0, 0)
else
fill(255)
rect(this.x * this.size, this.y * this.size, this.size, this.size)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment