Game Development Reference
In-Depth Information
You should now cover up the walls with borders as you see fit by copying and arranging
them until there aren't any “holes” left where the player might be able to squeeze out,
eventually leaving the level area.
You can also rotate the borders freely to make up the bottom and side borders. The phys-
ics shapes will be rotated accordingly and behave correctly in the game. The same goes
for scaling, though this will blur the images, especially if the scale factor for at least one
axis is 2 or more.
Caution I mentioned earlier that physics shapes can't be scaled. Now I'm say-
ing you can scale them. So which is it? Well, the scale property of a node with a
physics body truly can't be animated or changed at runtime. Still, you can set
the initial scale of a physics-enabled node in SpriteBuilder, so it will create an
appropriately scaled version of the physics collision shape when the project is
published.
If you are impatient and want to quickly get back to reading this topic, just scale up the
borders significantly along the x axis so that you need only a few border nodes to com-
pletely surround the level with impenetrable borders. You can go back and create a
decent-looking level at a later time, something like what you see in Figure 4-11 .
Figure 4-11 . Don't count the calories: Level1.ccb with delicious chocolate borders
Publish, build, and run the project. If you can't see or move the player, make sure the
player isn't overlapping with a border.
Search WWH ::




Custom Search