Install libGDX

Reading Time: 4 minutes

We are going to start the Flappy Bird game by downloading libGDX framework,

libGDX logo

which is a free and open-source game-development application framework written in the Java programming language. It is cross-platform, supporting Windows, Android, iOS and web browsers with WebGL support, so it is a good system to learn.

Step 1 – Download libGDX

You can download libGDX using this link.

Download libGDX

Here just click on the download button, and save the set up app on you desktop or somewhere else on you computer.

Step 2 – Install libGDX

The requerement of this tutorial is to have installed Android Studio, so you have to have installed Java as well. It mean you should just be able to open the downloaded file.

If you don’t have Java installed on you computer, then you can download it from here:

Download Java

After you have opened the downloaded libGDX file, then you will get this.

Fill out the fields like you see it on the picture.

Destination: Where you would like to install the files.

Android SDK: If you don’t know it, then just open your Andorid Studio, select from the top menu the Tools option, and here the SDK Manager menuitem. At the top of the window will be the Android SDK Location. Copy this link and paste it into the libGDX.

Sub Projects: Select only Android

Extensions: Select only Box2d

Before you generate the code, click on the Advanced button and this window will pop up for you.

We are going to use Kotlin, so check out the line of “Use Kotlin”.

Step 3 – Open in Android Studio

After a successful generation, we will open the project in Android Studio.

To do this, first open Android Studio. There click File menuoption on the top menu and select Open…  then select the folder of the generated project. If it is done, then OK.

It will take few minutes, be patient. 😉

Step 4 – From Java to Kotlin

Our generated project is in Java, but it supports Kotlin also, because in libGDX we have chosen to use Kotlin. You can check it in the project also, if you open the Project from the left side of the window. From here open the build.gradle of the app.

Android Studio - Project tab

In build.gradle (Project: App) has to be this lines

    • apply plugin: “kotlin-android”
    • api “org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion”

Step 5 - Create Kotlin classes

To create the necessery Kotlin classes, open again the on the left side of the window the Project tab. Here open the needed folders.

  • android – java – package – AndroidLauncher
  • core – java – package – FlappyBird

Delete this two Java files and create new Kotlin files with the same names in the same folder.





Step 6 – First run

After the modifications the app still running, check it out and run it on an emulator or on your real device. If everything was successful, then you will see this … strange…. screen in landscape mode. 🙂

Compared to our previous tutorials it looks a little bit different. We have still the create method which runs when the app is run. Now we have a render method as well and it will contain our code because it runs again and again and again. So you can think of it as an ongoing loop and that is where we will put our code to animate our stripes to do our collision detection and everything like that to see where the game actually works.

We have some new classes here as well. SpriteBatches are the most important (arguably the only important) component of 2D drawing. A SpriteBatch contains methods for drawing groups of sprites onto the screen. And we have got textures which are basically images that we work with and think of them as sprites as well.

In the render method we have few lines, which sets the red background color, and draws to the screen the badLogic.jpg image to top the left bottom corner.


I hope the description was understandable and clear. But, if you have still questions, then leave me comments below! 😉

Have a nice a day! 🙂

Follow and like us:

Click to rate this post!
[Total: 2 Average: 5]

stay informed!

Subscribe to receive exclusive content and notifications