Creating a Framework for a Reusable HTML5 Engine
Although the game built in Chapters 1 through 3 is perfectly acceptable for a one-off game, the code is fairly brittle and specific to the game itself. In the next few chapters, you put together a more general engine that allows for better code reuse from game to game.
This engine is going to be called Quintus. Quintus means “fifth” in Latin (which seemed appropriate) and will be used for the rest of the games built in this book. As mentioned in Chapter 6, “Being a Good Mobile Citizen,” the engine has two dependencies: jQuery and Underscore.js. You’ve seen that you can build a game in HTML5 without any dependencies; doing so, however, means that this book would contain more nongame-related code and spend less time on actual game development.
Designing the Basic Engine API
The primary guts of the engine are housed in a single file called quintus.js. To make the engine do anything useful, additional modules need to be pulled in for functions such as rendering and input. The Quintus engine ...