Inspiration

The inspiration for Falling Bananas came from the desire to create a fun, simple, and engaging game that could be played directly on the command line and with a programming language i've never written before. The idea was to bring some light-hearted fun to the often serious world of programming!

What it does

In the command-line game Falling Bananas, the player (a cat emoji) tries to avoid falling bananas. The player's health decreases if they collide with a banana. The game ends when the player's health reaches zero.

How it was built

The game was built using Rust, a language known for its performance and safety and with the help of Github Copilot! We used the crossterm crate to handle terminal-based user interfaces, allowing us to create a game that runs directly in the command line. The game logic is handled in a main loop, where the player's position is updated, and the game state is redrawn.

Challenges

One of the main challenges was handling user input (arrow key presses) and game updates concurrently. Rust's potent concurrency features helped to solve this. Another challenge was creating a game that could be played on a variety of terminal sizes. To fix this, the gaming area was dynamically adjusted to fit the size of the terminal.

Accomplishments that we're proud of

We took great pride in making a game that adds some lightheartedness to command line operations. It illustrates the strength of plain text-based user interfaces and the flexibility of Rust.

What we learned

Through this project, we learned more about Rust's concurrency model, how to create terminal-based user interfaces with crossterm, how to handle user input in a command-line application, and most importantly, how to move items in a terminal through key presses.

What's next for Falling Bananas (Command Line Game)

There are many potential improvements for Falling Bananas. One idea is to add different types of falling objects with different effects. Another is to implement a high-score system. I'm excited to see where this project goes next!

Built With

Share this project:

Updates