Libgdx tutorial beginner Part 1 – Setup

This is a complete rewrite of my previous tutorial, it needed an update so I decided to redo it. Instead of using super koalio as an example I will be using cuboc. We will see how to create the cuboc game step by step. Now go create a new project and lets start.

  • The first class we see is DesktopLauncher, we can adjust some configurations for the desktop version here. Like setting the width and height of the window
  • Platformer is like a controller which will help us switch between screens and we need it to start our game
  • AbstractScreen represents the other 3 classes MainMenu, Intro and Game Screen. Implementing this interface we can do different things with each screen and is easy to manage. It really helps when implementing for mobile because you will want to do different things on each screen when the back button is pressed for example. also notice that there is a reference to Game instance to switch Scenes.
  • Okay, after the game loads we will be in the MainMenu, the render loop will start rendering the image title.png using a sprite batch.
  • The image will get stretched, honestly wasn’t expecting that got used to cocos too much, but the doc for draw(TextureRegion, x, y) says it will draw it having the width and height of the region. I guess region is the screen size in this case. Will look into this later
  • Time field is there to wait a second before we start listening for input events, if you click you will get the intro screen and then to the game screen which will be blank right now
  • Get the asset files from here cuboc

Why this game? Well I enjoyed the web version and would like to see more levels for it, I would play the s@#% out of it on mobile, rather than paid platformers which all look like candy crush and the free ones that have awful controls. After this tutorial is finished I’m planning on to add a tutorial how to create levels and maybe more features for this game.

Recent Posts