HTML and CSS Reference
In-Depth Information
stage.follow(player);
Q.input.bind('action',stage,function() {
stage.viewport.scale = stage.viewport.scale == 1 ? 0.25 : 1;
});
}, { sort: true }));
The final result should look like Figure 16-2 depending on the device or size of the browser.
Figure 16-2: The final result.
Summary
You built a simple animation system that allows the use of named, timed animation to control character anima-
tion. Abstracting away the details of which frame is playing on a character at any given time makes it easier to
add more complicated behaviors to your characters. In preparation for Chapter 18's platform game, this chapter
also covered adding in an animated camera that follows the player along with support for scrolling parallax
backgrounds.
 
 
Search WWH ::




Custom Search