Hi there,
Is there any way to have the whole layout split into a grid with its own X and Y values? The grid would obviously be made of squares bigger than a single pixel.
Develop games in your browser. Powerful, performant & highly capable.
Do you just want to show a grid, or display objects snapped to a grid?
Snapping to a grid is easy, just set every object's X and Y to:
round(Object.X / 32) * 32
round(Object.Y / 32) * 32
where 32 is the size of the grid cell.
Thanks!
Just another quick question, if the objects are snapped to a grid, if an object is one cell above another (say obj1.y=1 & obj2.y=2 on the grid) would they still be considered touching (for any collision events)?
I'm not sure, try it and see. You might want to compare positions directly instead of testing for collisions anyway.