A modern, polished version of the classic Snake Game built using Python and Tkinter.
This Snake Game is a fully interactive and animated version of the classic game.
It features smooth movement, collision detection, a pixel-style background grid, a fading Game Over animation, and a glowing food effect!
โ
Smooth Movement โ The snake moves fluidly without delays.
โ
Collision Detection โ The snake dies if it hits the walls or itself.
โ
Growing Snake โ The snake grows longer every time it eats food.
โ
Glowing Food Effect โ Food glows with a yellow outline for visibility.
โ
Retro Grid Background โ Adds a cool pixel-style effect.
โ
Fading "Game Over" Animation โ Red and black flashing text when the game ends.
โ
Clean Code โ Structured with separate files for logic (main.py
, snake.py
, food.py
).
Follow these steps to run the game on your local machine.
git clone https://github.com/MhussainD4772/Snake-Game.git
cd Snake-Game
python main.py
Python's Tkinter is built-in, so no extra dependencies are required!
SnakeGame/ <-- ๐ Main project folder
|โ .gitignore <-- Ignores unnecessary files
|โ README.md <-- This file
|โ main.py <-- Main game logic (controls, movement, game loop)
|โ settings.py <-- Game constants (width, height, speed, colors)
|โ snake.py <-- Snake class (movement, growth)
|โ food.py <-- Food class (spawning, glowing effect)
|โ __pycache__/ <-- (Ignored)
|โ .venv/ <-- (Ignored)
- Arrow Keys โ Move the snake in different directions.
- Eat Food โ The snake grows in length.
- Avoid Walls & Yourself โ Game over if you crash!
"""
๐ Snake Game - Python Tkinter Edition
---------------------------------------
๐ Features:
- Smooth movement & collision detection
- Growing snake when eating food
- Glowing food effect for better visibility
- Pixel grid background for a retro feel
- Game over flashing animation
๐ฏ Future Improvements:
- ๐ต Add Sound Effects (Eating, Death)
- ๐ Add a Restart Button (Instead of closing the game)
- ๐จ Custom Snake Skins or Themes
"""
"""
๐ Snake Class - Controls the Snake's Movement & Growth
-------------------------------------------------------
โ Starts with 3 body parts
โ Moves in a fixed direction
โ Grows when eating food
โ Detects self-collision
๐ฏ Future Improvements:
- ๐จ Custom Snake Skins (Change color dynamically)
- ๐ Faster Speed Increase Over Time
"""
"""
๐ Food Class - Handles Food Spawning & Glowing Effect
-----------------------------------------------------
โ Randomly spawns food in grid positions
โ Food glows with a yellow outline
โ Snake grows upon eating food
๐ฏ Future Improvements:
- ๐ Different Types of Food (Bonus points, Speed Boost, etc.)
- ๐ Randomized Food Movement (Make food move!)
"""
โ
Improved Collision Handling โ Make walls bounce instead of killing the snake.
โ
Custom Themes & Snake Skins โ Choose different colors for the snake.
โ
Sound Effects โ Add eating, movement, and game over sounds.
โ
Leaderboard System โ Save and track high scores.
โ
Restart Button โ Allow restarting the game without closing it.
This project is open-source and free to use. Feel free to improve or modify it! ๐
M. Hussain
๐ป Python Developer | ๐ Gaming Enthusiast | ๐ฎ Building Cool Projects
๐ GitHub: MhussainD4772
If you found this game useful, please give it a star โญ on GitHub!
git clone https://github.com/MhussainD4772/Snake-Game.git
๐ฅ Enjoy your Snake Game! Happy Coding! ๐๐ฎ๐