1-star challenge – adding a score label
The goal of platform games is usually overcoming challenges to rescue someone at the end of the game, or picking up coins or another kind of object to beat some record. This will be the purpose of our game: earning as many points as possible.
In this challenge, I want you to add a label in the top-right corner of the screen that will show the points our Yeti has earned so far.
The solution
To implement this challenge, we will basically perform the same changes that we made in Chapter 1, Sprites, Sounds, and Collisions, for the same purpose.
I created a Text (.fnt)
bitmap font called font
that you will find in the Resources
folder. First of all, you need to add some font files to the project, so follow these steps:
In the navigator project, on the left, right-click on the Resources group and select Add Files to "JumpAndRun"….
Look up the
font.fnt
andfont.png
files in theResources
folder and select Add.
Then add the following declarations to GameScene.m
:
...