Skip to content

grantwilson38/basic-snake-game

Repository files navigation

Snake Game

A simple Snake Game implemented in Python using the Turtle graphics library. The game features a snake that grows longer as it consumes food, and the objective is to maximize the score without colliding with the game boundaries or the snake's own body.

Getting Started

  1. Clone or download the repository to your local machine:

    git clone https://github.com/your_username/your_repository.git
  2. Ensure you have Python and the required libraries installed. You can install the necessary libraries using:

    pip install pygame
  3. Run the game by executing the Python script:

    python snake_game.py

Game Controls

  • Use the arrow keys (Up, Down, Left, Right) to control the snake's direction.

Game Rules

  1. The snake starts with a single segment.
  2. Eating food increases the snake's length and score.
  3. The game ends if the snake collides with the game boundaries.
  4. The game also ends if the snake collides with its own body.

Customization

You can customize certain aspects of the game by modifying the constants defined at the beginning of the script:

  • SCREEN_WIDTH and SCREEN_HEIGHT define the dimensions of the game window.
  • SNAKE_SIZE and FOOD_SIZE determine the size of the snake segments and food items.
  • Color constants (BLACK, WHITE, RED, GREEN, BLUE) can be adjusted to change the appearance of the game elements.

Feel free to explore and modify the code to add new features or enhance existing ones.

Dependencies

  • Python 3.x
  • Pygame library

Acknowledgments

This game is inspired by classic Snake games and was created for educational purposes. It serves as a simple example of game development using Python.

License

This Snake Game is licensed under the MIT License. Feel free to use, modify, and distribute the code for your projects.# basicSnakeGame

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages