Skip to content

Latest commit

 

History

History
 
 

snake_game

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Snake Game

Rules

  1. The snake starts at the center of the screen and moves in any direction using the 'w', 's', 'a', 'd' keys to move up, down, left, or right respectively.
  2. A food item appears randomly on the screen.
  3. The snake grows in length and the score increases each time the snake eats the food item.
  4. The game ends when the snake hits the boundary or collides with its own body.
  5. The game can be paused and unpaused by pressing the 'p' key.

Features

Pause/Unpause

The game can be paused and unpaused using the 'p' key. This lets you take a break without having to stop the game entirely.

Sound Effects

The game includes sound effects to enhance the playing experience. When the snake eats a food item, an eating sound effect (eat.wav) plays. When the snake dies, a dying sound effect (die.wav) plays.

Difficulty Levels

The game offers two difficulty levels: Easy and Hard. You can choose the difficulty level by clicking on the respective buttons on the screen. The difficulty level affects the speed of the snake, making the game more challenging on the Hard level.

How to play

  1. Fork the repo by clicking the fork logo the on top right
  2. Clone the repo git clone [email protected]:AseanK/beginner-python-games.git
  3. Head to the snake_game folder
  4. Ensure that you have the required sound files (eat.wav and die.wav) in the snake_game directory.
  5. Run the game using python command python game.py