Game Development Reference
In-Depth Information
Figure 11-15 . A bitmap font's .bmfont folder is listed as a single item in SpriteBuilder's File View
Note In the SpriteBuilder version that I used, dragging and dropping a .bmfont
onto a stage did not create a Label BM-Font . If this occurs to you too, it doesn't
indicate a problem with the font. Bitmap fonts simply have no drag and drop
support yet.
Using the Bitmap Font
There's not a really good use for a score label in this game, but we could count the num-
ber of high-impact hits the player has experienced. Just because. And to demonstrate how
you can alter a localized label at runtime.
The first order of business is to open GameMenuLayer.ccb in SpriteBuilder. You'll find it
in the UserInterface folder. From the Node Library View , drag and drop a Label BM-Font
node onto the stage.
Edit the label's properties—specifically, you should set the position type to % and the val-
ues to 99x99 so that the label is somewhere in the top right corner. To easily align the la-
bel with the screen border, change both Anchor point values to 1. This will move the label
from partially outside the screen to fully inside the screen. The Anchor point is quite ef-
fective when it comes to aligning bitmap font labels. You may have noticed that the
CCLabelBMFont properties do not offer any kind of text-alignment properties, as you can
see in Figure 11-16 .
Search WWH ::




Custom Search