Skip to content

The Snake game programmed using my Python Game Development Module and the PyGame library

Notifications You must be signed in to change notification settings

MaherMuhtadi/Snake-Game

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Snake Game

image

Description

This is a version of the Snake game programmed with Python using my Python Game Development Module and the PyGame library.

This project was my attempt at simple 2-D game development using object oriented programming. In addition, I used it to help build my game development module and demonstrate its application.

Features

  1. The snake can move around the screen using the arrow keys or W, A, S, D keys.
  2. The snake grows in length every time it devours a mouse by colliding with it.
  3. After a mouse is devoured, a new one spawns at a random location on the field.
  4. The game can be paused and resumed using the esc key.
  5. The game ends if the snake touches the edges of the screen or its own body.
  6. The player has the option to replay the game after it is over by pressing the enter key.
  7. The game can track and display the snake's length and the highest length so far. The highest length is updated in an external text file every time the game window is quit.

Installation

Prerequisites

  1. Download and install the latest version of Python that is compatible with PyGame.
  2. Check if python is properly installed along with its package installer using the following commands in your terminal:
$ python --version
$ python -m pip --version
  1. If the Python package installer, pip, is not installed, get it installed using the pip documentation.

  2. Install the PyGame module by running the following command in your terminal:

    pip install pygame

Usage

  1. Download the repository as a ZIP or clone the repository to your local device.

  2. On your terminal, change directory to the repository folder using the cd command.

  3. Run the main.py file using the command:

    python main.py


Last Updated: January 09, 2023

About

The Snake game programmed using my Python Game Development Module and the PyGame library

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages