Skip to content

ShanYue03/Snake-game-in-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Snake-game-in-python


🐍 Snake Game

A classic Snake game built using Python's turtle library. This project demonstrates object-oriented programming (OOP), game mechanics, and collision detection in a fun and interactive way.

🛠️ Features

Snake Movement: Control the snake using arrow keys (Up, Down, Left, Right).

Food Collection: The snake grows longer when it eats food, which randomly appears on the screen.

Score Tracking: Keeps track of your score and updates it in real-time.

Collision Detection:

Detects collisions with walls, ending the game.

Detects collisions with the snake's own tail, ending the game.

Game Reset: The game resets when the snake collides with a wall or its tail, but the high score persists.

🎮 How It Works

Snake Movement: The snake moves continuously in the direction of the arrow keys.

Food Mechanics:

Food appears at random locations on the screen.

When the snake's head touches the food, the snake grows longer, and the score increases.

Collision Detection:

If the snake hits the wall or its own tail, the game resets.

Scoreboard:

Displays the current score.

Resets the score when the game restarts but keeps track of the high score.

🧰 Technologies Used

Python

turtle module for graphics and animations.

Object-Oriented Programming (OOP) for modular and reusable code.

About

Building a snake game using python and OOP implementation

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages