RezEnayati / SnakeGame

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Snake Game

Welcome to the classic Snake Game! This Python project utilizes the Turtle graphics library to create a simple yet addictive game where you control a snake, guiding it to eat food while avoiding collisions with walls and itself.

How to Play:

  • Use the arrow keys (Up, Down, Left, Right) to control the direction of the snake.
  • The snake will continuously move in the direction it is facing.
  • Direct the snake to eat the food represented by a small dot on the screen.
  • Each time the snake eats the food, it grows longer.
  • Avoid collisions with the walls or the snake's own body, as this will end the game.
  • Try to achieve the highest score possible!

Components:

  • Snake: The main character of the game, controlled by the player.
  • Food: Represented by a small dot on the screen. The snake must eat the food to grow.
  • Scoreboard: Keeps track of the player's score and displays it on the screen.
  • Screen: The canvas where the game is displayed.

Controls:

  • Use the arrow keys (Up, Down, Left, Right) to control the snake's direction.
  • Press 'Up' to move the snake upwards.
  • Press 'Down' to move the snake downwards.
  • Press 'Left' to move the snake leftwards.
  • Press 'Right' to move the snake rightwards.

Rules:

  • If the snake's head collides with the food, the snake grows longer, and the player earns points.
  • If the snake's head collides with the wall or its own body, the game ends.
  • The game speed increases gradually to add difficulty.

Installation:

  • Ensure you have Python installed on your system.
  • Install the required dependencies: Turtle graphics library.
  • Download the source code files (snake.py, food.py, scoreboard.py) and save them in the same directory.
  • Run the main Python script.

Have fun playing the Snake Game!

About


Languages

Language:Python 100.0%