Members - Reputation: 141
Posted 18 December 2012 - 12:37 PM
Right now Players simply move around with X,Y coordinates and Velocity.
Collision is detected if a players X,Y is = to an objects X,Y.
I would rather work with a grid.
Grid = [
But right now I have no real Idea how to work on grids :-/ In my head I am only able to run Left and Right on an Array...
Any good tutorials?
I need to learn how to use a grid, and collision detection. Path-finding I understand mostly.
Prime Members - Reputation: 1610
Posted 18 December 2012 - 04:28 PM
index = x + (y * MAP_WIDTH)
where your array is (MAP_WIDTH * MAP_WIDTH)..
basically, this puts each 'row' of map-grid points together so that where the first row ends, the second one starts, and where that one ends, the next one starts, etc..