Firstly, some are gonna ask for a code dump, but I gotta tell ya, theres a lot of it and it has little to do with my question. I’m trying to draw on a canvas and each Class has its own draw method and all objects are created from a Class. Let me give you a rundown of my object structure…
In my Cell class (which is used to create the cells in each row) I have a draw method…how do I reference the x,y values of the cell.
The board.draw(context) method calls the draw method for each row like this
And in my row.draw(context) method i have
And in my cell.draw(context) method I have
In my current Cell draw method I use this.x and this.y, but thats not working as console.log returns 0,0 for x,y, but the object structure shows cell[i].x and cell[i].y have proper values.
I’m not referencing x,y properly. A little guidance here would be appreciated.
All the context calls before the cell.draw method work fine. I’m sure it’s my x,y referencing I’m not geting right.