Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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)
- }
Add Comment
Please, Sign In to add comment