2014 | OriginalPaper | Chapter
5. Knowing What the Player Is Doing
Published in:
Building JavaScript Games
Abstract
In this chapter, you start to create a game called Painter. In this game, you need to show sprites that move on the screen. You’ve already seen a few examples of loading and displaying sprites. Also, you’ve seen that it’s possible to use the current time information to change the position of a sprite. You build on these examples to begin creating Painter. Furthermore, you learn how to deal with player input in your game. You see how to retrieve what the player is doing and how the game world changes depending on that information. You start with a simple extension of the FlyingSprite program that draws a balloon at the position of the mouse pointer. The next chapter examines other types of input, such as keyboard and touch input.