Skip to main content

A simple snake game written in python.

Project description

Snakey

A simple snake game made with pygame with multiplayer option.

Running the game

To install Snakey, run the following command:

python -m pip install snakey

Then, to run the game, execute:

python -m snakey

A new window should appear where you and your friend can play a game of snake. Default keys for player one are , , and . Keys for player two are W, S, D and A.

Game configuration

Game configuration is defined with a json configuration file, by default, this configuration is set like this:

{
    "main_window_size": [640, 480],
	"block_size": 10,
    "refresh_rate": 100,
    "num_snakes": 2,
    "start_pos": [[300, 100],
			   [300, 200],
			   [300, 300],
			   [300, 400]],
    "keys": [["K_UP", "K_RIGHT", "K_DOWN", "K_LEFT"],
		     ["K_w", "K_d", "K_s", "K_a"],
		     ["K_t", "K_h", "K_g", "K_f"],
		     ["K_i", "K_l", "K_k", "K_j"]],
	"initial_snake_length": 10,
	"num_cherries": 2
}

In order to run the game with different configuration, create a new .json file, and modify the configuration there. Then, provide the path to the created file with --config option, like this

python -m snakey --config {path to configuration file}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

snakey-2.1.0.tar.gz (17.0 kB view hashes)

Uploaded Source

Built Distribution

snakey-2.1.0-py3-none-any.whl (7.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page