Wrap-Up

Hands-on Rust — by Herbert Wolverson (37 / 120)

The Pragmatic Programmers
The Pragmatic Programmers
2 min readSep 23, 2021

--

👈 Creating Obstacles and Keeping Score | TOC | Part 2 Building a Dungeon Crawler 👉

Congratulations, you just wrote your first game using Rust. All of the basic elements of the original Flappy Bird are present, and you can even compete for high scores.

You have plenty of ways to improve Flappy Dragon. Here are some exercises to try:

  • Play with the gravity level, velocity changes, and game speed. Notice how different values can radically change the feel of the game.
  • See if you can add graphics for the walls and dragon.
  • Consider making the graphics bigger and the overall play area smaller to better match Flappy Bird.
  • Investigate bracket-lib’s “flexible console” and change the player coordinates to floating-point numbers for smoother movement.
  • Add color and visual flair to the menus.
  • Try animating the dragon.

A version of Flappy Dragon, including most of these enhancements, is included with the book’s source code. You can find it in the flappy_bonus directory. Thanks to Bevouliin for the dragon artwork.[39] Flappy Dragon Enhanced looks like this:

images/FirstGameFlappyAscii/FlappyEnhanced.png

In the next chapter, you’ll begin designing a more ambitious game: a roguelike dungeon crawler.

Footnotes

[34] https://flappybird.io/

[35] https://github.com/thebracket/bracket-lib

[36] https://doc.rust-lang.org/book/ch10-02-traits.html

[37] https://doc.rust-lang.org/std/macro.format.html

[38] https://doc.rust-lang.org/reference/items/constant-items.html

[39] https://opengameart.org/content/flappy-dragon-sprite-sheets

Copyright © 2021, The Pragmatic Bookshelf.

👈 Creating Obstacles and Keeping Score | TOC | Part 2 Building a Dungeon Crawler 👉

Hands-on Rust by Herbert Wolverson can be purchased in other book formats directly from the Pragmatic Programmers. If you notice a code error or formatting mistake, please let us know here so that we can fix it.

Unlisted

--

--

The Pragmatic Programmers
The Pragmatic Programmers

We create timely, practical books and learning resources on classic and cutting-edge topics to help you practice your craft and accelerate your career.