Step 1 – Download libGDX
You can download libGDX using this link.
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, and installed Java as well. If you have installed Java on you computer, then double click on the downloaded libGDX file. If you don’t have Java installed on you computer, then you can download it from here:
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.
Extensions: Select only Box2d
Before you generate the code, click on the Advanced button and this window will pop up for you.
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
- apply plugin: “kotlin-android”
- api “org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion”
Create Kotlin classes
- android – java – package – AndroidLauncher
- core – java – package – TekiTutorial
Step 5 – 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. 🙂
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! 🙂