- Firstly, You don't need an array with all the
map info, what you need is a 2D array of tiles.
The tile object will contain all the info like the
image, isSolid, etc.
- Secondly, You will always have the player
visible, so that acts as your anchor,
Only show the tiles around your
player and render that to the screen. Its makes no
sense to render the tiles that will not be
rendered on the screen e.g., If the player is at
the center and the screen renders 5x5 tiles then
+/- 2 tiles of the player tile. Same goes for
checking if the tile is visible No, need
to check all
- Lastly, Again you don't need to check the
player collision with all the obstacles, only need
to check collision with the tile that the player
is going to move on.
Hope it helps.