Laser Squad [Day 2] – Basic data models and UI

Today I created some basic data models for items, tiles and units. These classes will be extended in the future to offer more and more special functionalities and states to the models.

How it works? You have a basic tile which represents a door on the map. It will be extended to the “door tile” to handle opened/closed states so that the player can perform  these actions on that tile. More complex door tiles can extend the already created “door tile” to handle more states like unlocked/locked, or they can react on a specific event in the game (auto close when an alarm goes off). Same logic is used for items… Weapons extend the basic functionality of an item with parameters used when firing, reloading or priming.

I also created a simple inventory system in the unit class which handles all the taking / dropping of items. Several parameters are checked for these actions like item size and weight if it fits in unit’s inventory. The inventory is also capable to change units action points, because all inventory actions cost AP’s.

Last but not least for today, I worked a little bit on the UI. The main screen is divided to reserve 75% of it for the map which is a simple scrollable text view, and the other 25% for current unit’s data and action buttons.

* * * * *