Chapter 2: Drawing Sprites

Now that we've got a working app and we're drawing to the screen, we can start making something that actually looks like a game. That means rendering sprites, which is just a fancy way of saying drawing pictures. So, in this chapter, we'll start by defining what those pictures are by doing a little bit of game design, and then we'll render a static sprite to the screen. Since a static picture is a pretty boring game, we'll even get the sprite animating too.

In this chapter, we'll do the following:

  • Design our game, Walk the Dog.
  • Render a sprite to the Canvas.
  • Use a sprite sheet to load many sprites at once.
  • Animate a character via the sprite sheet.

By the end of this chapter, you'll be drawing characters instead of ...

Get Game Development with Rust and WebAssembly now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.