Game Development Reference
In-Depth Information
Note The .sbpack folder is a so-called package and looks like a file rather than
a folder. Finder allows you to browse into package contents by right-clicking
the package and then selecting Show Package Contents from the context menu.
You can then just duplicate the Level1.ccb (by copying and pasting) eight more times and
rename the copies so that they are called Level2.ccb , Level3.ccb , and so on, up to
Level9.ccb .
This won't make the game very interesting to play through, but at least you can confirm
that it works technically. Don't forget to publish it in SpriteBuilder before you try it out.
You can then start modifying each duplicated level as you see fit. If you prefer to start
each level from scratch, here's a checklist of things that a level has to have in order to
function technically:
Create a CCB using the Level#.ccb naming scheme. The CCB must be of
type Layer .
The CCB's root node defines the level's size. The default level size is
4000x500.
Optionally, add a parallaxing background—for instance, Background1.ccb .
Add a Physics Node whose name property must be set to “physics.”
Add one Player.ccb prefab instance to the Physics node. The player's name
property must be set to “player.”
Add an Exit.ccb prefab instance to the Physics node.
You may want to consider adding special code for the very last level. Obviously, it can't
load another level yet. So in the collision delegate method with the player and exit
parameters, check if currentLevel is equal to or greater than the GameState level
count. You will have to create a levelCount property in GameState with a custom
property getter that just returns a constant value.
The alternative would be to not have an exit in the last level, and instead add a different
type of exit that runs a different kind of physics collision delegate method. That way, you
can most easily handle this special case and present a Game Won popover.
Counting Level Files
Search WWH ::




Custom Search