Programming With Jon Logo

Programming with Jon

Android Development Part II

June 5th, 2020

Soul Collector

I created the game Soul Collector which happens to be an endless runner. I would say it's kind of like Flappy Bird when it comes to game mechanics as you tap on the screen and the character floats upward. The more you tap on the screen the further up the character will float. Once you stop tapping the character will start to drop slowly towards the ground. Unlike in Flappy Bird however your character can hit the ground. The only way to lose is to get hit by the flaming skulls flying your way. I had a lot of fun developing the game and as I promised in my last post I will be going over the some of the development process. Hope you enjoy.


The setup for the game is pretty straight forward. I needed to use something that would make the development of Android apps some what easy. I needed to find a game engine that would work on Android that was easy to use and setup. And I needed to figure out what language to use. The following sections will go into more detail on the individual tools used.

Android Studio

I used Android Studio since it is the number one choice for developing Android apps and games. It has a really good interface which allows you to drag and drop the elements for each view/scene that the users of your app will see. It supports both Kotlin and Java. Since it is developed and maintained by JetBrains it made sense to use it for the project. I also really liked how easy it was to setup and how comfortable it felt using it. It was very much like using IntelliJ but with a more focused Android environment. If that feature is available in IntelliJ I wasn't able to find it and didn't want to take too long figuring out how to convert IntelliJ for Android development. If you are coming from IntelliJ and don't already use IntelliJ for Android development you will feel right at home with the layout of Android Studio.


This is a game engine that allows you to create cross platform games for Android, HTML, iOS, PC, and macOS. The engine is really awesome to use because it's not like Unity or Unreal in the sense that you have to download the game engine and swap back and forth between your IDE environment and the game environment. The below picture will show you how I set up the game using libGdx.

[object Object]

The picture shows how you would set up your game. You give the game a name, the name of the package (if you are familiar with Java then you will know what a package is), the game class which must be in camelCase but also start with a capital letter, and finally the path to your Android SDK(Android Studio makes finding this really easy). The other settings are check boxes for what platform you want to create the game for. For my project I only chose Android. Box2d is the physics engine used which is a very arcade like physics system. It's perfect for most games. If you are developing a FPS game or perhaps a really sophisticated ARPG then I would suggest choosing the Bullet option. Once you are finished click the generate button and the project will be generated for you and then you will be able to open it in Android Studio(or whichever IDE you are using).

The Language of Choice: Java

The language I chose was Java. The reason is that libGDX supports Java and has all kinds of really helpful and useful documentation on how to do just about everything you can think of with examples in Java. I am not all that familiar with Kotlin yet so I didn't want to go down the road of trying to convert what I saw in Java to Kotlin. I also wasn't sure whether Kotlin was a supported language for the engine. Java has been the go-to language for Android development and there are a lot of resources to help you if you get stuck. I figured I would pick the language that would be the easier of the two to implement with all the docs and helpful communities around that support Android development with Java.

Game Idea

I had the tools installed and the project setup. Now it was just a matter of taking the idea I had and actually implementing it. The code wasn't too hard to figure out. I've been working with Java building microservices for a while now and have some experience building games with other languages. The most recent game I created was with TypeScript and Phaser. Which helped me realize that the game engines that exist, by this I mean not Unity or Unreal Engine, have three main methods/functions that are used to build the game.

Project Structure

The structure that libGDX uses is a bit different from you might be used to in normal Android development. When you open the project you will see two folders one says android the other core. The assets will go under android -> assets and the code you write will be under core -> java -> <Insert package name> -> NameOfGameClass. It's not a drastic change in the way things are done but you won't be using the android folder like you might be used to.

Create Method

The create method is used to preload your assets for the game. These assets include the art, sound, buttons, etc that you are using for your game. While the game is loading up the create method is getting these assets ready for the game to use. You will use this method to load in all of your games assets.

Render Method

The render method is where all of the logic for the game will go. This handles the touch controls for the player. The gameplay aspects of each different object as well as handling the score and game over. This is where the brunt of your code will go.

Dispose Method

The dispose method is the method that you will use to kill the game. Once the player is finished with your game this is the method that is called to quit the game.

That's pretty much all there is to libGDX. The engine is setup through a GUI form that then generates the project files for you. Then you open the project up in your IDE of choice and start coding the business logic in the correct method. Add your assets to the assets folder and you are good to go.

Testing the Game

It's a good idea to test your app. Whether it's a game or an actual app. Testing it to make sure that it functions in the way you expect is a really great habit to form. I did not do TDD as I am accustomed to doing with other Java projects I work on but clicking the play button after implementing a couple lines of code and making sure that it worked the way I intended it to made me feel better about the code I wrote. I will be creating another app here soon that will focus on TDD for Android.


That's it. You can download the game and play it on your Android device. There are two versions. A paid for app that will remove the ads and the free version that will have ads. I look forward to hearing any feedback on the game. If anything is missing or you find bugs please feel free to write to me. You can contact me here

Created by Jonathan Reeves, © 2020