Skip to content

A simple Snake game built with Python and Pygame. My very first coding project!

Notifications You must be signed in to change notification settings

Anto4K/SnakeGame

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

2 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ Snake Game

Welcome to Snake Game, a simple yet fun game developed in Python using Pygame. This project marks the first milestone in my programming career, created as part of the final exam for the Fondamenti di Informatica 1 course.


๐ŸŽฎ Game Description

The game features a classic Snake-style mechanic:

  • Move the snake using arrow keys or WASD.
  • Eat the red square (apple) to grow your snake.
  • Avoid the edges of the screen to stay alive.
  • If you hit the wall, it's game over โ€” but you can press N to start a new game or C to quit.

The score is displayed in the top-left corner and increases with every apple you eat.


๐Ÿงฑ Project Structure

project-root/
โ”œโ”€โ”€ snake_game.py           # Main game logic
โ””โ”€โ”€ img/
    โ”œโ”€โ”€ schermata_iniziale.png    # Starting screen 
    โ”œโ”€โ”€ sfondo_erba.jpeg          # Grass background image
    โ””โ”€โ”€ testaSnake.png            # Snake head sprite

๐Ÿ› ๏ธ Key Features

  • Smooth Movement using frame-based updates.
  • Collision Detection for both apple and game-over conditions.
  • Custom Graphics using external image files.
  • Score Tracking with on-screen display.
  • Restart Functionality after game over.

โ–ถ๏ธ How to Run

  1. Make sure you have Python and Pygame installed.
  2. Place the required images (sfondo_erba.jpeg, testaSnake.png) inside an img/ directory located one level above snake_game.py.
  3. Run the game:
    python snake_game.py

๐Ÿ“Œ Notes

  • This game was developed as my first-ever coding project.
  • Created for the Foundations of Computer Science exam.
  • It helped me grasp key programming concepts such as loops, functions, events, and basic object management using pygame.

๐Ÿ“ท Preview

Here is the starting screen of the game:

Start Screen


About

A simple Snake game built with Python and Pygame. My very first coding project!

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages