Managing the Player

Learn how the player flaps its wings.

In Flappy Dragon, the player battles gravity while trying to avoid obstacles and stay alive. To keep the dragon in flight, the player needs to press the spacebar to flap the dragon’s wings and gain upward momentum. For this to work, we need to store the current game attributes of the dragon. Add a new struct to our main.rs file, after the enum declaration:

Get hands-on with 1200+ tech skills courses.