Skip to content

udeese/snake-game

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Snake Game
A classic Snake game built with Python and Pygame. Control the snake, eat food, and avoid collisions to achieve the highest score!

snake-game/
│── snake_game.py         # Main game script
│── highscore.txt         # Stores the highest score
│── chomp.wav             # Sound effect when eating food
│── game_over.wav         # Game over sound effect
│── background_music.wav  # Background music
│── README.txt            # Game instructions & setup guide

How to Play

Move the snake using the Arrow keys (↑ ↓ ← →)
Eat food (red block) to grow longer and score points
Avoid colliding with walls or yourself
Game Over: If you hit the wall or yourself
Press R to restart after game over
Press Q to quit the game

Setup & Installation

1️. Install Python
Make sure Python 3.x is installed. Check by running:

python --version
or
python3 --version

Download Python if not installed.

2️. Install Pygame
Run this command in Command Prompt or Terminal:

pip install pygame

If using Mac/Linux, use:

python3 -m pip install pygame

3. Running the Game
Open a terminal (Command Prompt / Terminal)
Navigate to the project folder:

cd path/to/snake-game

Run the game:

python snake_game.py

or if using Python 3:

python3 snake_game.py

4. Sound & Music
Chomp Sound: Plays when the snake eats food
Game Over Sound: Plays when the game ends
Background Music: Loops while playing
You can replace background_music.wav with any other .wav or .mp3 file

5. Features
Classic Snake Gameplay
Smooth Controls (Arrow keys)
High Score System (Saves to highscore.txt)
Restart & Quit Options (Press R or Q)
Customizable Colors & Speed
Sound Effects & Background Music

6. Customization
Change Colors

Modify the colors in snake_game.py:

SNAKE_COLOR = (0, 255, 0)  # Green
FOOD_COLOR = (255, 0, 0)   # Red

Adjust Speed

Increase/decrease game speed in clock.tick(10):

clock.tick(15)  # Faster Snake
clock.tick(5)   # Slower Snake

7.To-Do / Future Features
Levels (Increase speed as score increases)
Obstacles (Walls or random blocks to avoid)
Bonus Food (Food that gives extra points)
2-Player Mode (Control a second snake)
Themes & Skins (Change background/snake appearance)

8. Credits & Acknowledgments
Game Created By: Ursula Deese
Built using Python 3 & Pygame
Inspired by the Classic Snake Game
Sound files from freesound.org
 Author: BloodPixelHero (background music)
 Author: AceOfSpadesProduc100 (game over sound)
 Author: TheDragonsSpark (chop sound)

About

A classic snake game using Python

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages