Guest User

Untitled

a guest
Jul 20th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. function drawGrid(){
  2. for (var i = 0; i < cols; i++) {
  3. for (var j = 0; j < rows; j++) {
  4. grid[i][j].draw() //grid is a 2D array of nodes
  5. }
  6. }
  7. }
  8.  
  9. //inside node class
  10. draw(){
  11. if(this.active)
  12. fill(255, 0, 0)
  13. else
  14. fill(255)
  15. rect(this.x * this.size, this.y * this.size, this.size, this.size)
  16. }
Add Comment
Please, Sign In to add comment