Chapter 6. Adding Levels to Your Games
Until now all of our games have had only one level. This is nice for a demo or a proof of concept, but you probably want to have many levels in your game. As always there are many ways to do this, but most of them are based on the idea that each of your levels are described by their own file (or files).
We will begin this chapter by quickly exploring the different ways to combine files to create your game. We will then look at the jQuery functions that allow such techniques.
Finally, we will take the game we developed in Chapter 4, Looking Sideways, and extend it to include three levels by implementing some of the techniques described beforehand.
The following is a quick list of the topics we will cover in this chapter:
Using multiple files for your game
Loading files with
$.ajax
Executing remote JavaScript
Adding a new level to our game