Laser Squad [Day 3] – Map data model and rendering

Moving on with modeling. Basic data model for the map is implemented which holds only the size of the map and the array of tiles. I also made a mock map with floor tiles (.) surrounded by a wall (*), just to test the map renderer.

The unit (o) can also be seen on the map. The class unit contains one more class which holds the map data (position and heading). Basic movement actions (move forward, move backward, turn left, turn right) are also added to this class. Every move uses AP’s depending of the direction of movement and on current tile’s obstacles factor. Each tile has an obstacle factor just to make a difference between easy crossable tiles, like floors, and, for example, furniture tiles. Also collisions with walls are implemented.

Last but not least, in the bottom of the screen I printed out some main data about the current unit, and added a inventory button.

 

* * * * *