Map design

The following class diagram (Figure 5) shows the top-level architecture for handling the loading of multiple maps and their corresponding entities:

Map design

Figure 5

Here, we first start with the MapFactory class, which can be found at core/src/com/packtpub/libgdx/bludbourne/MapFactory.java, with the source code as follows:

package com.packtpub.libgdx.bludbourne; import java.util.Hashtable; public class MapFactory { //All maps for the game private static Hashtable<MapType,Map> _mapTable = new Hashtable<MapType, Map>(); public static enum MapType{ TOP_WORLD, TOWN, CASTLE_OF_DOOM } static public Map getMap(MapType mapType){ Map map = null; switch(mapType){ ...

Get Mastering LibGDX Game Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.