O'Reilly logo

Mastering LibGDX Game Development by Patrick Hoey

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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){ ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required