How to start creating android games using the LibGDX game development framework (UPDATED with gdx-setup-ui.jar)

NOTE: This is an updated version of a previous article, since it is now much easier+faster to create a LibGDX project using gdx-setup-ui

Why Android?

I’ve been creating games using flash/actionscript for a while now, but have really wanted to get started with android game development, since it’s an open source platform, the sky is the limit to how much you can learn about it.

The devices are usually fairly non-restrictive, being able to load custom roms, install any available software – even not directly through the market, being more practical (using internal storage as storage, not needing to install bloatware to connect to a computer), as well as having many more choices in hardware, since there is such a wide diversity of available mobile phones.

All in all, Android is very non-restrictive and flexible to it’s users, as well as it’s developers, and the market is supposed to be much easier to upload your app on, without getting turned down without a reason. It also caters more towards free apps (with ads), which is what I had wanted to offer, to allow everyone to be able to play my games.

Why LibGDX?

I have read a few android programming books, and most go into quite a bit of detail about application programming, but very little about OpenGL, not to mention I hadn’t done much programming using multiple separate threads in the past.

LibGDX takes care off pretty much all of the low-level stuff for you, so you can focus on game programming, or basic engine programming, and not about techniques for loading different image and music types, creating and handling multiple threads, or creating OpenGL surfaces to render 2d bitmaps on to.

Using it also does not take away any of the control you have, i f you wanted to or needed to program lower level stuff, such as creating surfaces and 3d objects using OpenGL. Thus, it provides an excellent platform to get started with without having to worry about creating everything from scratch yourself, but also allows you to create things later on when you need them.

And for super-icing on the cake, it is specifically made for creating games, and it also allows you to compile and test using native Java on your computer before deploying to your android device, which makes debugging and compile time so much faster! No needing to deal with the android emulator for most of your design, unless you wish to, no needing to compile the apk, move it to the SD card, install, open, and finally debug- you can do it all on your computer before deploying to your android device!

So in summary:

  • Handles a lot of the stuff that you would normally need to program from scratch, saves you time, as well as allows you to expand it if needed
  • Specifically created for games!
  • Debug, test and try out your android app without having to rely on having a device/ emulator running almost all the time!
  • Open source and free, as well as great forums for support

So Now that you know why it is a great framework to use to develop android games, lets get up and running.
Continue reading

Ackmi Dress Up 2 released!!!

Ackmi Dress Up 2 has finally been released after many months of development!

You can now download Ackmi Dress Up 2 on your Android Device from the market:

You can also play the game in your browser on your PC at:

Or install on the chrome store at:

Making money on Android – tips from an Android developer

I decided to start posting articles to update other Android developers with information I’ve found from in my games released in the past 3 years.

First Game

My first released Android game: Ackmi Dress Up was released on the Android market in the end of 2011, and is still going pretty strong, with regular updates.

The key ideas for that game were:

  1. Find a niche area with high demand and low competition (described in “The 4 hour work week” by Tim Ferris)
  2. Create something as simple as possible, to decrease the development time to as little as possible for first release. Both to test the Niche area, as well as fund further development.
  3. Create something that we could update regularly with new content, to keep it fresh, and players returning to try out the new content.

After we released the game, it was slowly bringing in a few dollars per week, but as October hit, the number of downloads started increasing drastically, and increased even more in December. During December, we made enough from Ad money from Admob to potentially afford a one bedroom apartment with normal food an utility bills!

January Blues

As soon as January hit- we went from making low livable wages, to making about what groceries would cost for the month. The number of people downloading and playing didn’t decrease until the end of January- just the Ad network paid a small portion of what it paid in December for eCPM.

So from this- you can generally expect December to be your best month of the year, and January to be the worst (but it actually continued to decrease for us, occasionally increasing until October again).

In summary:

Things that worked:

  • Find a niche market that isn’t overcrowded yet, and hopefully with high demand (use Google keyword research to determine monthly global searches)
  • Create a product with the smallest development time possible in that market- then try to decrease it as much as possible.
  • Make sure you can update regularly to keep some users

Things that didn’t work:

  • Creating a game that requires months of content creation, with only minutes of gameplay
  • Creating a game with limited re-playability
  • Only having one game during the Christmas season, and not realizing that October->December will give a temporary boost to download numbers/ revenue

I’ll try to touch on more issues/ things learned in future articles.

Let me know if you want to know any specifics! (Aside from very generic questions like “How do I make a game”, or things that you could easily use Google to find out yourself)

Spine – 2D skeletal Animation software + runtimes KickStarter- discounted for 2 more days!

I funded this awhile ago, and it was very relevant for a project I was working on, but if you guys are interested- the KickStarter has it discounted quite a bit:

I’m using it instead of flash for animating characters for my game, and it does a good job, as well as being lightweight.

They also have runtimes for libGDX, cocos2d, and since they made their goals, AS3, C#, javascript, ect.

Made by one of the two guys who are the main contributers of LibGDX.

Definitely more than worth it if you intend to ever use 2d skeletal animation in a project.

I spent a couple months writing a AIR program to convert flash XML files into easily read XML/JSON files, then loading them into my game, and it is still quite a ways off their app (That also includes the program to actually animate).

You can also buy it not off their website, but for a bit extra outside of the KickStarter(if you can’t stand waiting 2 more days)

Learning Adobe Muse Review

Learn to use Muse to create websites without learning HTML and CSS

If you have wanted to create websites, but would rather focus on design instead of needing to first learn HTML and CSS, Adobe Muse will get you there, and this book will teach you how to use it.

The book walks you through learning the interface and panels, but also uses goes through many examples, showing how you can create content, styling, and different effects in Muse.

The book is catered more towards beginners, showing you concepts that are valuable outside even using Muse, such as planning out the design of your site, wireframing before creating, and teaching you how to create websites efficiently. You will learn everything you need to learn to get a website online, adding text, images, styling, adding widgets, how to test your site for multiple browsers, and even ways to publish your final site online.

If you’re a designer, and interested in using Muse to speed up your workflow, or if you are a beginner who hasn’t created a website before, but interested in learning valuable tools without learning HTML and CSS up front, this is a great book to get you going.

You can pick up the book here:

Learning Adobe Edge Animate Review


Create rich HTML5 applications and websites by the end of the book!

The author seems to be both knowledgeable with using Flash, and HTML5, and explains the capabilities and limitations of Adobe Edge Animate, to publish HTML5 content, as compared to Flash. He also includes detailed information of what you can expect from Adobe Edge Animate vs. Flash, but does not require you to have ever used Flash.

The book covers the tools and the interface extensively, so you will become comfortable with the interface.
It also works through many examples that you will need when creating a website or animation, such as how to use different fonts (and the options available), importing vector and rasterized graphics, from other adobe products and in general, and creating animations and adding interactivity to your content.

The book gives you many tools that you can use to create websites based on HTML5 and CSS3, with complicated animations, and interactions that will work for modern and mobile browsers.

You can pick up the book here:

HTML5 Video How-to Review


Everything you would want to know about HTML5 video and more.

If you are interested in displaying HTML5 video on your website, and want to know all the intricacies and challenges, this is a great book to get you started.

The book covers converting your video to different HTML5 compliant codecs and formats, how to embed it on a webpage, and how to handle different current browser and mobile issues when displaying video. An added bonus is that you will also learn how to add custom skinned controls to your video, and how to tie it together with jquery for functionality.

If you’re looking for comprehensive information about adding HTML5 video to your site, how to make it work with different browsers and mobile systems, or even how to skin/theme the controls, this book includes it all.
You can pick up the book here:

Mastering Adobe Captivate 6 Review


Complete guide to getting started with, and creating lessons using Captivate 6.

As someone new to Captivate, I found this book very helpful got getting started with, and using Captivate.
The author makes it easy to follow along with the examples, and provides an iterative approach to building lessons, which become more complicated and advanced each chapter.

The book starts showing how to record clips to be used in teaching, and giving advice on the best way to do it.. From there, you learn to edit the recordings, add objects such as text, images, videos and shapes, and adding animations and effects to the objects.

You learn how to add audio, quizzes, themes, how to interface with an LMS (if you need to), and even a detailed chapter on how to publish to many different formats.

After reading through the book, I feel I could create youtube like tutorials without a problem, as well as full lessons with quizzes and feedback which a lot of professional organizations use to teach their employees.

If you are looking for a book that can teach you how to create lessons, tutorials, and computer based training using Captivate, this is the book for you.

You can pick up the book here:

Zombie Marshmallows From Space!!!

I had worked on a flash prototype a few years ago, and enjoyed the basic gameplay, so finally got around to finishing it off enough to make it a basic game, and have it now on google play.

Try it out and let me know what you think!

Lots of stuff I’d still like to add, but want to see if people would be interested in it. The basic gameplay is fun, and has a lot of areas where I can expand on it/ enhance, add more stuff.

Box2D for Flash Games demos in LibGDX with Projects for Desktop, Android, and HTML5


I recently reviewed Emanuele Feronato’s new book “Box2D for Flash Games”, and created all the demos from the book in FlashDevelop.
In this post, I wanted to bring them all into LibGDX, so that everyone could also see how to work in Box2D using LibGDX, to develop Android, Desktop, and HTML5 Box2D games.

I would recommend picking up his book if you are interested in Box2D, and want to understand these demos from his book better. His site is also one of the best for tutorials an examples for beginner and intermediate game developers. (

Obviously the syntax between AS3 and Java are a little different, but most of the lines of code worked pretty well, only having to change variable declarations, of function capitalization.

The only large problem I ran into was the implementation of JBox2d on LibGDX for the HTML5 version of the project. Everything still built correctly, and works, but blocks begin randomly shifting and falling over, and I wasn’t able to discover a solution to this problem yet.

In Example 2.1, we build on chapter one by adding objects to our world, making them dynamic, and changing the material properties, to allow the objects to interact differently.

Download the source code for the eclipse projects for Desktop, Android, and HTML5

And so you can see how easy it is to setup a basic Box2D world in LibGDX, that compiles for Desktop, Android and HTML5:
(The main difference is that OpenGL/LibGDX use the bottom-left corner as 0,0 (normal Cartesian) , whereas Flash uses the top left as 0,0, with down increasing in y-value, so for any y-coordinates from AS3, you have to do SCREEN_HEIGHT-y_coord. Also, I keep track of screen scaling, to scale everything relative to screen size, since obviously most Android devices can’t display 640×480 resolution, and should be full screen, regardless)

package com.chrismweb.box2dforflashgames;

import java.util.Iterator;

import com.badlogic.gdx.ApplicationListener;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.math.Vector3;
import com.badlogic.gdx.physics.box2d.Body;
import com.badlogic.gdx.physics.box2d.BodyDef;
import com.badlogic.gdx.physics.box2d.Box2DDebugRenderer;
import com.badlogic.gdx.physics.box2d.CircleShape;
import com.badlogic.gdx.physics.box2d.FixtureDef;
import com.badlogic.gdx.physics.box2d.PolygonShape;
import com.badlogic.gdx.physics.box2d.World;
import com.badlogic.gdx.physics.box2d.BodyDef.BodyType;

 * ...
 * #Chp2.1 - Ball drop with bounce
 * @book by Emanuele Feronato
 * Get it now @

public class MyGdxGame implements ApplicationListener
	//for drawing
	private OrthographicCamera camera;
	private SpriteBatch batch;
	Vector3 touchPoint;

	public static float SCREEN_WIDTH_ORIGINAL=640;
	public static float SCREEN_HEIGHT_ORIGINAL=480;
	public static float SCREEN_WIDTH=640;
	public static float SCREEN_HEIGHT=480;
	//for testing other screen resolutions quickly in the desktop version
//	public static float SCREEN_WIDTH=1280;
//	public static float SCREEN_HEIGHT=800;
	public static float BOX2D_WIDTH_SCALE=1;
	public static float BOX2D_HEIGHT_SCALE=1;
	//box2d variables
	private World world;
	private Box2DDebugRenderer debugRenderer;
	public static float PIXELS_PER_METER = 30.0f;
	//reset variables
	BitmapFont font;
	Rectangle rect_reset;
	private ShapeRenderer renderer;

	public void create()
		//NOTE: with different screen sizes (on android for instance) the world will be setup as different sizes, so the mass of objects won't be the same.
		//you need to create the world the same size, and scale the camera, so that it behaves the same regardless of screen resolution
		// setup the camera. In Box2D we operate on a
		// meter scale, pixels won't do it. So we use
		// an orthographic camera with a viewport of
		// 48 meters in width and 32 meters in height.
		// We also position the camera so that it
		// looks at (0,16) (that's where the middle of the
		// screen will be located).
		camera = new OrthographicCamera(PixToMeter(SCREEN_WIDTH)*BOX2D_WIDTH_SCALE, PixToMeter(SCREEN_HEIGHT)*BOX2D_HEIGHT_SCALE);
		camera.position.set(PixToMeter(SCREEN_WIDTH)/2*BOX2D_WIDTH_SCALE, PixToMeter(SCREEN_HEIGHT)/2*BOX2D_HEIGHT_SCALE, 0);
		batch = new SpriteBatch();
		touchPoint = new Vector3(0,0,0);

		Vector2 gravity=new Vector2(0.0f, -9.81f); //we have to flip ALL y values- AS3 uses down int he y duirection as increasing, whereas OpenGL uses UP in the y direction as positive
		Boolean sleep = true;
		world = new World(gravity, sleep);
		debugRenderer = new Box2DDebugRenderer();
		font = new BitmapFont(Gdx.files.internal("resources/fonts/arial-15.fnt"), false);
		rect_reset = new Rectangle(0, SCREEN_HEIGHT-30/BOX2D_HEIGHT_SCALE, 100/BOX2D_WIDTH_SCALE, 30/BOX2D_HEIGHT_SCALE);
		renderer = new ShapeRenderer();"MyGdxGame", "GAME STARTED");
	private void ResetWorld()
	{"MyGdxGame", "Resetting world");
		Iterator iterator = world.getBodies();
	         Body body =;
	public void Setup()
		//for creating a circle
		//first create a bodydef
		BodyDef bodyDef = new BodyDef();
		bodyDef.position.set(PixToMeter(SCREEN_WIDTH_ORIGINAL/2), PixToMeter(SCREEN_HEIGHT_ORIGINAL-30));
		bodyDef.type = BodyType.DynamicBody;
		CircleShape circleShape = new CircleShape();
		FixtureDef fixtureDef = new FixtureDef();
		Body theBall = world.createBody(bodyDef);
		//for creating the "floor" bottom rectangle
		bodyDef.position.set(PixToMeter(SCREEN_WIDTH_ORIGINAL/2), PixToMeter(SCREEN_HEIGHT_ORIGINAL-470));//center location of the box- 320 to the right (640/2), and 10px from the bottom(480)
		PolygonShape polygonShape=new PolygonShape();
		polygonShape.setAsBox(PixToMeter(SCREEN_WIDTH_ORIGINAL/2), PixToMeter(10));//1/2 width and height, so 640x20 px box
		Body theFloor=world.createBody(bodyDef);
	private float PixToMeter(float pixels)
		return pixels / PIXELS_PER_METER;
	private float MeterToPix(float meters)
		return meters * PIXELS_PER_METER;

	public void dispose()


	public void render()
		world.step(, 3, 3);, .2f, .2f, 1); //0->1 = 0->255;

		debugRenderer.render(world, camera.combined);
//		renderer.begin(type)
		renderer.setColor(.05f, .2f, .31f, 1.0f);
		renderer.filledRect(rect_reset.x, rect_reset.y, rect_reset.width, rect_reset.height);
		font.drawMultiLine(batch, "Reset", rect_reset.x, rect_reset.y+font.getLineHeight(), rect_reset.width, HAlignment.CENTER);
	public void Update()
		// translate the mouse coordinates to world coordinates
		if (Gdx.input.justTouched()) 
			camera.unproject(touchPoint.set(Gdx.input.getX(), Gdx.input.getY(), 0));
			Vector2 touchPointPixels =new Vector2(MeterToPix(touchPoint.x)/BOX2D_WIDTH_SCALE, MeterToPix(touchPoint.y)/BOX2D_HEIGHT_SCALE);"MyGdxGame", "GAME touchPointPixels: "+touchPointPixels);
			if(rect_reset.contains(touchPointPixels.x, touchPointPixels.y))

	public void resize(int width, int height)

	public void pause()

	public void resume()

After that, in Example 2.2 we also create a “Totem” game level, and create the totem object using compound objects to make a complex object from simple shapes.
We also create the head of the totem as a generic polygon, by specifying individual vertices to create the shape. (Blocks for some reason behave somewhat like jelly in the HTML5 with LibGDX and JBox2d)

Download the source code for the eclipse projects for Desktop, Android, and HTML5

In Example 3.1, we then learn how to convert mouse input to box2D meters, how to delete a body, and how to selectively get physical information about certain bodies that we are interested in.
(click on certain bodies to destroy them)

Download the source code for the eclipse projects for Desktop, Android, and HTML5

I will upload the rest of the demos and source code for each in the near future.