Libgdx tutorial beginner Part 2 – Player

In this second part we will add the player and cube which will interact with the world/level we are going to create in the next part.

  • Here we have the player Bob and cube that we’re going to control
  • Yes the Map is not there, I want to focus on these 2 for now
  • Most important thing to note is that Bob and Cube are very similar, but cube is not effected by gravity
  • fetchCollidableRects will get collision tiles and trytoMove will check if there is a collison when we are moving, pretty clear actually
  • If you are familiar with java it should be clear, but if you are completely new to game programming just ask anything and I’ll explain it, will add more explanation later

  • Bryan Herrera

    How did you create the pack file that’s used in loadPlayerTextures()method?

  • Farhod

    I can’t do:
    spriteBatch = renderer.getSpriteBatch();
    it says it can’t resolve method with this name.
    Is my libGDX is different or something?

    • metin

      Yes, definitely. this guide is a bit old. Try getBatch instead. I’m thinking of updating this guide seeing people still have intresest in it 🙂

      • Gabriel

        Hello, It would be very nice if you could update the guide 🙂

        • metin

          Why did you ask, now I will have to update it. I will also refactor some stuff. I’m going to do it on the weekend.

          • Gabriel

            thanks!!!, it would be possible to later add the menu screen and the game screen over and pause

Recent Posts

Recent Comments