A classic Snake game implementation using Rust and the Bevy game engine.
In this game, players control a snake that grows longer as it eats food while avoiding collisions with walls and itself. The original Snake game concept dates back to the 1976 arcade game Blockade, and it gained popularity in the late 1990s when it was pre-loaded on Nokia mobile phones and used as a demo application for Microsoft QBasic. Read more about Snake's history on Wikipedia.
- Snake movement using WASD or arrow keys
- Growing snake mechanics when eating food
- Score tracking
- Wall collision detection
- Self-collision detection
- Pause functionality (Press P)
- Game over state with restart option (Press SPACE)
- Rust (latest stable version)
- Cargo (comes with Rust)
- Clone the repository:
git clone https://github.com/eliheuer/bevy-snake.git
cd bevy-snake- Build and run the game:
cargo run- Use WASD or arrow keys to move the snake.
- Eat the red food to grow.
- Don't hit walls or yourself.
- Press P to pause the game.
- Press SPACE to restart the game after it ends.
The game includes several configurable constants that can be adjusted in the source code src/main.rs:
This project is free and open-source under the MIT License - see the LICENSE file for details.