Archive for the ‘ Tutorial ’ Category

How To Play?

Here’s a little on how some in-game controls and overlays work.

After we had the tiled map up and running, we thought about how the controls would work. Most of the TD games we’ve played had a pointer since it’s either on the PC or Xbox 360, so how would this work with a touch screen? Hmmm.

Following the same train of thought about dealing with player experience, we realized the necessity of a HUD (Heads-Up Display) as well. The player need to know how much health and coins they have, what wave of enemies they’re at, etc. We needed a system to deal with that as well.


Tiled Maps

libgdx contains built-in support for tiled maps.  If you look inside com.cmein.tilemap.utils, you will see several classes, none of which we wrote (thanks libgdx!).  If you open up, you’ll notice it has a runnable main method.  In this main method, there are only three lines that need to be edited to create a tiled map:

tmxFile = new File("data/tiledmaps/LEVEL2.tmx");
baseDir = new File("data/");
outputDir = new File("data/");

The file extension “.tmx” may be foreign to you; it is associated with “Tiled”, a program to help the process of making tiled maps (see  The main method in TiledMapPacker takes the .tmx file and outputs two new files.

Continue reading


In libgdx, the loading of the art and the game loop are all controlled in a single file.  For our project [source code], this is the ‘’ class located in com.cmein.tilemap.  This class is the top level loader and renderer; every other class in some way connects back to it.  Notice that tilemap extends the abstract class ApplicationListener.  It is this feature of libgdx that abstracts away the differences between the desktop application and the Android application.

Continue reading