Skip to content

rabbitglauser/PySnake

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 

Repository files navigation

PySnake

Project Description

PySnake is a modern version of the classic Snake game, developed in Python with Pygame. Your goal is to collect as many fruits as possible, avoid obstacles and enemies, and achieve a high score. The game features multiple levels, attractive graphics, sound effects, and a persistent high score that is saved between play sessions.


Game Description

PySnake combines classic Snake gameplay with new elements like moving enemies (aliens) and collectible coins. You control a snake that grows longer as you eat fruit. Each level introduces new obstacles and challenges.


Rules

  • Move the snake using the arrow keys (↑, ↓, ←, →).
  • Collect as many fruits (apples) as you can to grow and score points.
  • Collect coins for bonus points.
  • Avoid running into walls, obstacles, enemies, or your own tail — any collision leads to Game Over.
  • From level 2, obstacles appear; from level 3, moving enemies are added.
  • Reach the target number of fruits (30) to win the game.

Goal / How to Win

You win the game by collecting the required number of fruits (30) without hitting the walls, obstacles, enemies, or your own body.


Controls

  • Arrow keys: Move the snake.
  • Mouse: Navigate menus and info screens.
  • Q: Quit the game instantly.

Source Code & Clean Code

  • The entire source code is clean, well-structured, and commented.
  • Main classes: Snake, Fruit, Coin, Enemy, and UI components.
  • Key functions and classes are documented with docstrings.
  • The project is available on GitHub.
  • (If required: Can be mirrored to GitLab.)

Minimum Game Requirements

  • Interactivity: Keyboard controls for gameplay, mouse for menus.
  • Movement & Collision: The snake moves and collisions are detected.
  • At least 3 moving graphical elements: Snake, coin, and enemy/alien.
  • Persistent High Score: The high score is saved and loaded automatically.
  • At least 2 Levels: Three levels with increasing difficulty and new obstacles.
  • Attractive Graphical UI: Custom menu, info, game over and win screens, colorful game board, custom sprites.
  • Sound & Sound Effects: Background music and effects when collecting fruits or coins.
  • Complexity & Graphics: Additional challenges at higher levels, animated elements, and music.
  • Hosting: Optionally, the game can be hosted online with (https://rabbitglauser.itch.io/pysnkae) (e.g., on itch.io).

How to Start the Game

  1. Make sure you have Python and Pygame installed.
  2. Start the game with:
    python game/main.py
  3. Use the mouse to navigate the menu and the arrow keys to play.

High Score Persistence

The current high score is saved to the file snake_game_data.csv after each game and loaded automatically at startup.


Sound

  • Background music: Plays automatically when the game starts.
  • Sound effects: Play when collecting fruits (eat.wav) and coins (coin.wav).

Screenshots

Gameplay Menu Game Over


Presentation & Demo

The project can be presented both locally and (optionally) online.

  • Project presentation: Explain the main code components, level logic, and sound system.
  • Live demo: Start and play the game live.
  • ** Use this command to start pygame ;python -m pygbag game/ or C:\Users\samue\AppData\Local\Programs\Python\Python313\python.exe -m pygbag game/

Have fun playing PySnake!

About

simple frute snake game made with python!

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published