Hello and welcome to the first part of the create an android game with libgdx library series where I am going to create a libgdx game which runs on the android phone device, therefore, do enjoy 🙂

The game I am going to create is an air battle game where we will fly an aircraft to take down the flying rock as well as the enemy aircraft. All the source codes in this game design series are free for you to use as a framework to create your own android game, if you like this game series article then kindly do me a fever by sharing it with your friends. OK without wasting any time, let us begin.

In this chapter, we are going to import our fresh libgdx project into our Android Studio before writing any code. The first thing we need to do is to create the android project with the Gradle based setup application from libgdx. Go ahead to the official download page of this application to download the app through this link!

Next, start the application and fill in all the necessary details about your own project and then click on the generate button to generate the Gradle based project. You need to know where is the path to the Android SDK in your computer in order for this application to create the project for you. Make sure you thick most of the extensions because you will need them in your project. Under the sub-projects section only thick the Android checkbox because our main goal here is just to create an android application.

libGDX project setup application

The next thing we need to do is to start our Android Studio IDE then goto File->New->Import Project.

Select the base folder of the entire project to import the project

Now after you have imported the project into the Android Studio, Android Studio might ask you to further download extra files or re-downloaded the necessary modules you need for this project, I recommend you to do so because there might have the latest version of the libgdx modules out there for you to use.

There are a few java files under the project structure but what we are up to is the MainActivity file under the core/java/namespace folder. This is the file we are going to work on.

All java classes go into this directory

Let us render the background of the game and see whether this library is working or not. Under the assets folder add in an image as the background image of the game.

The assets folder of the project

Finally, open the MainActivity class and under the create method entered the name of the background file into the constructor of the Texture class.

@Override
	public void create () {
		batch = new SpriteBatch();
		img = new Texture("background0.png");
	}

OK, now let us install this game in the real device and see the result by our self. I have skipped a few steps such as how to run the project on a real device because I expect you have already known Android Studio very well. Also Java should not become a problem for you. The main purpose of this tutorial series is just all about the libgdx framework, if you want to learn some Java code then do read the other part of this website about the related topic.

The background image generates by the libgdx library

This ANDROID GAME series will show you how to develop a basic game with the libgdx library so don’t forget to insert this rss feed to your favorite rss reader to read the future tutorial about this topic! Basically I will write a post a day about this topic until the entire project has finished, so stay tuned! RSS LINK : https://kibiwebgeek.com/libgdx/feed/

Click to rate this post!
[Total: 0 Average: 0]
Please follow and like us:

Leave a Reply

Your email address will not be published. Required fields are marked *