/snake-game

This project provides a playable and interactive version of the snake game 🐍 with features such as player control ⬆️⬇️⬅️➡️, snake growth upon consuming food 🍎, and collision detection 💥.

Primary LanguagePython

Snake Game in Python with Turtle Graphics

EN | PT

This is a simple Snake game built in Python using the Turtle Graphics library. The game allows you to control a snake that grows every time it eats "food" and keeps track of your score based on the amount of food consumed. The game ends when the snake collides with the window's edges or itself.

🎮 How to Play

Clone the repository to your computer:

git clone https://github.com/rafael-s-santos/snake-game.git

Ensure you have Python installed on your system. If not, download and install it from python.org.

Navigate to the game directory:

cd snake-game

Run the game:

python main.py

Use the arrow keys (up, down, left, and right) to control the snake's direction.

Snake Game in Python with Turtle Graphics

  • The snake must collect food to score points.
  • The snake grows one segment each time it eats food.
  • The game ends when the snake collides with the window's edges or itself.

How It Works

  • The game is built in Python using the Turtle Graphics library to render the screen and control the movement of the snake and food.
  • The snake is represented by a series of segments forming its body.
  • Food is randomly generated on the screen.
  • On each frame, the snake's position is updated based on the direction it's moving.
  • Collision checks are made to determine whether the snake has collided with the window's edges or itself.
  • The score is displayed at the top of the screen and is updated every time the snake eats food.

Game Over Situations

Collided with the window's edges

Collided with the window's edges

collided itself

Enjoy the game and have fun! 🕹️🐍