Skip to content

Abhijith14/SnakeGame-PyGame

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Snake Game - Python

A simple snake game created using Python

demo



📕 Installation

🕷️ Create an environment

Whatever you prefer (e.g. conda or venv)

mkdir myproject
$ cd myproject
$ python3 -m venv venv

🕷️ Activate it

Windows:

venv\Scripts\activate

Mac / Linux:

. venv/bin/activate

🕷️ Install Dependencies

You only need PyGame:

pip install pygame

👨‍💻 Usage

Run

python game.py

This will start the game.
Use:

Up Arrow for going UP
Right Arrow for going RIGHT
Down Arrow for going DOWN
Left Arrow for going Left

⚙️ Customize

Have a look at game.py. You can change the game variables according to your own use case.
Change the colours of the game elements over here.

# rgb colors
WHITE = (255, 255, 255)
RED = (200,0,0)
BLUE1 = (0, 0, 255)
BLUE2 = (0, 100, 255)
BLACK = (0,0,0)

Default BLOCK_SIZE (Size of a block in the game) and SPEED (speed of snake) is set to 20.

BLOCK_SIZE = 20
SPEED = 20

In the init function of class SnakeGame; the parameters w and h are the width and height of your game window.

def __init__(self, w=640, h=480):
        self.w = w
        self.h = h

🛠️ Built With

❤️ Authors

  • Abhijith Udayakumar - Design & Development - Abhijith14


🚨 Forking this repo (please read!)

yes, with attribution.

I value keeping my work open source, but as you all know, plagiarism is bad. It's always disheartening whenever I find that someone has copied my work without giving me credit. I spent a non-trivial amount of effort building and designing this project, and I am proud of it! All I ask of you all is to not claim this effort as your own.

TL;DR

Yes, you can fork this repo. Please give me proper credit by linking back to Abhijith14/SnakeGame-PyGame. Thanks!

About

A simple snake game created using Python

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages