Hello everyone,
As the title suggests, as an IDE (integrated development environment) or else in common language a thing that helps us write code in it, we are going to use Android Studio. The game will mainly be for Android devices and if you have read my first post you probably already know that it will be a 2D game.
So, first of all we will need two things, downloading Android Studio and libGDX setup app . You can find the links below;
LibGDX setup
Now then, it is quite easy to download and install Android Studio and there are a tone of great up - to - date tutorials out there, so if you encounter any problems just make a quick search on Google. For now lets just focus on how to setup LibGDX, after you have finished downloading and installing Android Studio. When you open the above link, the page looks like that;
Libgdx download page |
Just click on the "Download Setup App" button and your download will begin. When it ends open the .jar file you have just downloaded and it should look that;
LibGDX setup app |
What do the above fields mean?
- Name; The actual name of our game. We will name it getest.
- Package; Just rename that to com.getest.game.
- Game class; This is the name of the main Class that will be created. I always like giving the same name to the file that holds the project, to the actual name of the game, to the class AND the package. That way it is not confusing. So give the name GeTest to the class.
- Destination; Here you must insert the path of your Android Studio projects. This by default when you install Android Studio is; C:\Users\user\AndroidStudioProjects where user depends on the name of the user you are using... (Did you see what i did here?). Or just simply click Browse button and find it manually. After you finish add to the path the name of the file that will hold our project. You could also create the file on your own and Browse right on it. In the end it should look like; C:\Users\user\AndroidStudioProjects\Getest.
- Android SDK; Here you must insert the path where Android SDK files are stored. By default, this is; C:\Users\user\AppData\Local\Android\sdk and as i told you the user string will be different for everyone. You can as well Browse to find it (if you do that, remember to have hidden files enabled so you can actually see them).
On the " Sub Projects " field just select Android. Don't worry, you can always add the other extensions, for example if you decide to make your game compatible with Desktop. And finally on the "Extensions" field just check Tools, Controllers, Box2d, Box2dlights, Freetype and Bullet. We won't need all of these but maybe you would like to experiment with some in the future. The app after you click "Generate" and the build process ends successfully should look like the image below.
Note;; Most probably there are going to be pop - up windows after you click "Generate". Just click yes to all of them.
Note;; Most probably there are going to be pop - up windows after you click "Generate". Just click yes to all of them.
LibGDX setup app final |
LibGDX project with Android Studio
And now it's time to open Android Studio and load our project. Open Android Studio and click "Import project" like on the image below;Android studio |
Browse to the destination we previously generated our project and click " OK ".
Note;; Most probably there are going to be pop - up windows here as well, telling you to upgrade to a more recent version of Gradle. As of 6/2018 DO NOT upgrade.
After the build finishes you will be able to see our "GeTest" class.
Before we run our game i must inform you that you need a device in order to test the game. You can always use an emulator but in my personal experience that's not the way to go. The best solution is to use your Android device (well.. if you have one). In order to do that you must enable android debugging in your device and download the necessary extensions from Android studio. Both tasks you have to do are extremely well documented and with a quick Google search you can find all the details you need in order to achieve that.
If you have completed all the above, then you are ready to run the game. Simply, click the " run " button (the green arrow) or press " shift + 10 ". A Badlogic logo wildly appears.
This is it for the first How To tutorial. Next time we will setup our game to be landscape, we will remove the virtual buttons that take much of our space and we will replace the badlogic logo with a logo i created for the purpose of these tutorials. Spoiler Alert.
Feel free to ask any questions in the comments below!
Note;; Most probably there are going to be pop - up windows here as well, telling you to upgrade to a more recent version of Gradle. As of 6/2018 DO NOT upgrade.
After the build finishes you will be able to see our "GeTest" class.
Android studio interface |
If you have completed all the above, then you are ready to run the game. Simply, click the " run " button (the green arrow) or press " shift + 10 ". A Badlogic logo wildly appears.
Game screen |
This is it for the first How To tutorial. Next time we will setup our game to be landscape, we will remove the virtual buttons that take much of our space and we will replace the badlogic logo with a logo i created for the purpose of these tutorials. Spoiler Alert.
Game logo |
Feel free to ask any questions in the comments below!
Comments
Post a Comment