Hands-on Rust Bonus Content

From Flappy Dragon to Flappy Bonus

Herbert Wolverson
The Pragmatic Programmers
4 min readJul 28, 2021

--

Flappy Dragon is the first example game in Hands-on Rust. Chapter 2 walks you through the basics of Rust syntax and control flow, using a treehouse guest list management program to build your skills. That’s all you need to know to make your first game. Flappy Dragon is only 217 lines of Rust, designed to get you started with the Rust language.

Flappy Dragon (left), and Flappy Dragon — Bonus Edition (right)

In the “Build Your First Game With Rust chapter of Hands-On Rust I finished by suggesting some improvements to the game — and provided the source code for an improved version in the flappy-bonus directory of the book’s source code. As you may have guessed, I originally planned to include some of these enhancements in the book itself, but we cut it due to page count concerns.

In this article, I’ll walk you through the changes involved in creating the bonus content.

Play Flappy Bonus in your Browser (Chrome or Firefox preferred).

Just Add Graphics

I started by creating a tile-set. Taking original graphics from Bevoulin.com’s OpenGameArt page, I modified them to fit a sprite-sheet. The completed sprite-sheet looks like this:

--

--