This is a simple Piston snake game.
To install and run the game, clone this repository and run the following command:
cargo run
The goal of the game is to control the snake and eat as many apples as possible without hitting itself or the edge of the screen. Use the arrow keys to move the snake.
Here is a brief overview of the game's classes:
The Game
struct represents the overall game state. It contains the following attributes:
gl
: A GlGraphics object used to render the game.snake
: A Snake object representing the snake.apple
: An Apple object representing the apple.game_update
: A bool value indicating whether the game is currently being updated.
The Snake
struct represents the snake in the game. It contains the following attributes:
body
: A LinkedList containing the coordinates of the snake's body segments.dir
: A Direction enum value indicating the direction in which the snake is moving.
The Apple
struct represents the apple in the game. It contains the following attributes:
x
: The x-coordinate of the apple.y
: The y-coordinate of the apple.
This is a simple Piston snake game. You can use the arrow keys to move the snake and try to eat as many apples as possible before the game is over.