- Notifications
You must be signed in to change notification settings - Fork9
This is a basic version of snake game. As it moves forward, it leaves a trail behind, resembling a moving snake. The player loses when the snake runs into the screen border or itself. A sole player attempts to eat apples by running into them. Each apple eaten makes the snake longer.
TkhiienLok/Snake-Pygame
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This is a basic version of snake game. As it moves forward, it leaves a trail behind, resembling a moving snake.The player loses when the snake runs into the screen border (there are four walls around the screen) or itself. Snake has 5 lives.A sole player attempts to eat apples by running into them. Each apple eaten makes the snake longer and adds points. Big apples give more points.
As you run a program first the popup window shows up asking to enter the name of the player.By the end of the game the results (player's name, apples amount, points) are written to the .txt file.
The control keys are:
- "up"
- "down"
- "left"
- "right".
Double press makes the snake to speed up.
Used libraries:
- pygame
- kivy
Pre-requirements:
- python 3.9 >
- virtualenv
Install virtualenv
pip install virtualenv
On Windows OS you need to add virtualenv installation path intoPATH environment variable of the system.Example tutorial on that
Create virtual environment.From the root directory run.
virtualenv snakegameenv
where "snakegameenv" is the custom name of the environment
Activate the environment
On Windows you need this command:
<environment name>\Scripts\activate
in our case:
snakegameenv\Scripts\activate
On Unix system
source snakegameenv/bin/activate
Install requirements
pip install -r requirements.txt
Create and activate environment:
conda create --name Snake-Pygame python=3.10conda activate Snake-Pygame
Install packages:
conda install --file requirements.txt
Save all installed packages to the list of requirements:
With pip
pip freeze> requirements.txt
With conda
conda list --export> requirements.txt
In the terminal run
python ./src/main.py
In PyCharm with Run button in the top menu
About
This is a basic version of snake game. As it moves forward, it leaves a trail behind, resembling a moving snake. The player loses when the snake runs into the screen border or itself. A sole player attempts to eat apples by running into them. Each apple eaten makes the snake longer.
Topics
Resources
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors2
Uh oh!
There was an error while loading.Please reload this page.