O'Reilly logo

Learn Pixi.js: Create Great Interactive Graphics for Games and the Web by Rex van der Spuy

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

CHAPTER 2

image

Moving Sprites

You now know how to make sprites, but how do you make them move? That’s what this chapter is all about. We’re going to take a close look at all the code you have to write to start making your sprites move around the stage. You’ll learn about

  • Making a game loop
  • Using velocity properties
  • Modularizing your animation code by using game states
  • Making a sprite move by using the keyboard
  • Containing a sprite’s movement inside the canvas
  • Applying physics to a sprite’s movement

At the end of this chapter, you’ll be well prepared to apply these techniques to all kinds of interactive games and applications, so let’s get started! ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required