Skip to content

Toggleable Map Class

RileyWhitty edited this page Oct 17, 2023 · 2 revisions

Toggleable Map Class

The toggleable map can be opened and closed by pressing the m key. It shows the entire map in a window that is displayed on the screen and displays the players position, the quest givers position and the spaceship position on top of the map. The player is represented by a red square, the questgiver by a black square and the spaceship by a white square.

When the toggleable map is opened, the game is paused and when the toggleable map is closed the game is un-paused.

Adding to the ToggleMap

If you wish to display more entities on the toggleable map (i.e. enemy positions, friendly entity positions etc), you have to go modify the addImageToTable method and just add the entity type as a new case in the switch statement and copy the existing code for other entity types. You will need to create a new image sprite that has the same size as the base terrain tiles (16 x 16 pixels) and use that as the image inside the switch statement.

This will only work for entities which are registered to the entity service, that have actual positions on the map and that have a well define and unique entity type as defined by the EntityType enum.

Example of the Toggleable Map

image

Clone this wiki locally