HTML and CSS Reference
In-Depth Information
Chapter 11
Bootstrapping the Quintus Engine: Part III
What's in this chapter?
• Creating sprite sheets
• Adding sprites
• Building a Stage class
• Using Quintus to build a simple game Code Downloads for this Chapter
The code downloads for this chapter are found at
title.cgi?isbn=9781118301326 on the Download Code tab. The code is in the chapter 11 download and individu-
ally named according to the names throughout the chapter.
The first two chapters on building the Quintus engine laid the groundwork for building a game. This chapter
rounds out the engine by adding support for sprites and stages. Sprites are the primary visual GameObject used
in the engine to display graphics and elements on the screen. Sprites use either basic assets or SpriteSheets
to draw themselves onto the game. Scenes provide a way to package up a discrete piece of your game, such as
a level, into a nice reusable package. Lastly, Stages are the primary containers for the state of your game and
are responsible for tracking lists of GameObjects and ensuring they are updated and drawn on each frame.
Defining SpriteSheets
Before tackling sprites, the engine is going to add support for sprite sheets. Sprite Sheets, as you've seen in pre-
vious chapters, allow any number of images to be stored in a single image, making your game quicker to load
and animations easier to work with. The sprite sheet functionality ties into the code from Chapter 8, “Running
JavaScript on the Command Line,” that generated spritesheets from the command line so you don't need to spend
your time multiplying sprite x and y positions in your head.
Search WWH ::

Custom Search