Implementing map management with spawn points and a portal system
The next class represented in our top-level class diagram is MapManager
, which can be found at core/src/com/packtpub/libgdx/bludbourne/MapManager.java
. This class has helper methods for loading the TiledMap
maps, as well as methods for accessing the different MapLayer
, and MapObject
objects in the layers.
MapManager
A class diagram that outlines the different attributes and helper methods is represented by the following diagram (Figure 10):
The import classes are as follows:
package com.packtpub.libgdx.bludbourne; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.maps.MapLayer; import com.badlogic.gdx.maps.MapObject; import com.badlogic.gdx.maps.objects.RectangleMapObject; import com.badlogic.gdx.maps.tiled.TiledMap; import com.badlogic.gdx.math.*; import java.util.Hashtable;
We are going to be using TiledMap
(TMX format) maps that will then be rendered to a Screen
instance using the OrthogonalTiledMapRenderer
class...