View Single Post
Old 12-31-2012, 09:44 PM   PM User | #1
pdiddles03
New Coder

 
Join Date: Jun 2010
Posts: 76
Thanks: 0
Thanked 1 Time in 1 Post
pdiddles03 is an unknown quantity at this point
clickable grid on top of canvas

Ok, so lets say I'm trying to make a game that can be played on phone or computer. To do this I'm just going to use mousedown.

I'm creating a canvas, and then a <div> tag that will act as a grid over the canvas. I create an array like so,

var grid = [
'0000',
'0000',
'0000'
];

Now I programed the grid array to populate in the div tag sitting on top of the canvas. What happens on the canvas depends on which grid box is clicked. How can I detect which grid box is clicked? I know it's probably using "this" but I seem to have trouble using that. I DON'T WANT A JQUERY SOLUTION. After I do that, how can i find the position that that specific grid box is in? meaning the css left and top.

thanks
pdiddles03 is offline   Reply With Quote