Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

🐍 Snake Game (Python + Pygame)

A classic Snake Game developed with Python and Pygame. This project includes basic game mechanics, keyboard control, score tracking, game over detection, restart function, and a custom icon image integrated into the game interface.


🎮 Features

  • 🐍 Classic Snake gameplay

  • ⌨️ Keyboard controls:

    • Arrow Keys (↑ ↓ ← →)
    • WASD keys (W A S D)
  • 🍎 Food generation system

  • 📊 Real-time score display

  • 💀 Game Over screen

  • 🔄 Press R to restart the game

  • 🚪 Press ESC to exit

  • 🖼️ Custom image/icon support


🛠️ Technologies Used

  • Python 3
  • Pygame Library

📂 Project Structure

Snake-Game/
│
├── snake.py        # Main game program
├── jim.png         # Custom game icon/image
└── README.md       # Project documentation

🚀 Installation & Running

1. Install Python

Make sure Python 3 is installed:

python3 --version

2. Install Pygame

Open the terminal in this project folder and run:

python3 -m pip install pygame

3. Run the Game

Start the game using:

python3 snake.py

The game window will open automatically.


🎯 Controls

Key Action
Move Up
Move Down
Move Left
Move Right
W Move Up
S Move Down
A Move Left
D Move Right
R Restart Game
ESC Quit Game

🧩 Customization

You can replace the image file:

jim.png

with your own image.

Make sure the new image is placed in the same folder as:

snake.py

and update the filename in the Python code if necessary.


📸 Preview

Example:


📚 Learning Objectives

Through this project, I practiced:

  • Python programming fundamentals
  • Object-oriented programming concepts
  • Game loop design
  • Event handling
  • Collision detection
  • Image loading and rendering with Pygame

👨‍💻 Author

Created by Yiming Guan

A simple project exploring Python programming and game development.

Snake-Game

About

A Python-based Snake Game built with Pygame, featuring interactive controls, scoring system, collision detection, and custom visual elements. Through this project, I explored the application of programming logic in game development, including user input handling, animation loops, and object interaction.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages