Libgdx tutorial beginner Part 8 – Score

In this part we are going to add a simple score counter, when ever we get to a new check point it should add 1 point to the score.

  • We start by adding a new integer field score to the Map class
  • Each time the dispenser changes it will increment this field
  • I also added another check to see if the actual dispenser is the same one we are colliding

  • To add a Label we will need to create a stage, since Label is a widget and we add widgets using stage
  • We also need to create a skin, download these files skin and extract it to your data folder
  • To learn more about skins you can check this link or ask meah
  • Stage also has draw method which we call it like batchs draw, we also call it at the end of the render loop so it stays above everything else
  • There is a lot more to stage but we will leave it at this point for sake of simplicity


Recent Posts

Recent Comments

Categories