An open source Python library for the Snake retro game.

Overview

🐍 Snek

An Open Source Python library for the retro Snake game.

📰 Installation:

Pre-requisites: pygame - can be installed by running pip install pygame

  1. Grab the latest release of snek here.
  2. Place it in your project's local directory.

🗞️ Usage

The snek.Snek object:

from snek import Snek
import pygame

width = 600
height = 450
win = pygame.display.set_mode((width, height))
pygame.display.set_caption("Client")

player = Snek(600, 450, 15) #initialise the window boundaries for the Snek object(required for detecting collisions at the boundary) and delta(increment/decrement value for moving the Snek per frame)

Methods for manipulating the snek.Snek object:

  1. snek.Snek.move(foodPos:list)
player.move([150,150]) #moves the Snek object by the delta value initialised earlier.
  1. snek.Snek.draw(win:pygame.display)
player.draw(win) #draws the Snek object on the specified screen.
  1. snek.Snek.headCollidesWith(collideList:list)
player.headCollidesWith([[0,15], [15,30], [30,225], [90,60]]) #checks if the Snek object's head collides with the co-ordinates given in collideList
You might also like...
A simple yet powerful Snake Game made with myPygameWorkflow

snakeGame A simple yet powerful Snake Game made with myPygameWorkflow. Requirments python3 Python.org myPygameWorkflow Github Ripo Usage $ cd main $ p

learn and have fun developing 2D retro games using python and pygame
learn and have fun developing 2D retro games using python and pygame

Retro 2D Game Development Using Python + PyGame Skill up your programming skills with a walk down the memory lane. Learn how to create a retro 2D game

Blender Game Engine Game Type Templates Logic Bricks (and Python script) based Game Templates for Blender

Blender-Game-Engine-Templates Blender Game Engine Game Type Templates Logic Bric

Snake (PyGame-based) port for Minecraft:Bedrock Edition using PEWSAPI

Snake_PEWSAPI Snake (PyGame-based) port for Minecraft:Bedrock Edition using PEWSAPI And we are not going to make any change to the original Snake sour

Yo-Snake - A blend of yolov5 and deepsnake
Yo-Snake - A blend of yolov5 and deepsnake

Yo-Snake A blend of yolov5 and deepsnake 结合了yolov5和Deepsnake模型 Deepsnake 模型代码比较复

pygame is a Free and Open Source python programming language library for making multimedia applications like games built on top of the excellent SDL library. C, Python, Native, OpenGL.

pygame is a Free and Open Source python programming language library for making multimedia applications like games built on top of the excellent SDL library. C, Python, Native, OpenGL.

Text-Adventure-Game [Open Source] A group project by the Python TASK Force

Text-Adventure-Game [Open Source] A group project by the Python TASK Force

A minimal open source mtg-like tcg game made in python that can be played on a terminal emulator using a keyboard.
A minimal open source mtg-like tcg game made in python that can be played on a terminal emulator using a keyboard.

A minimal open source mtg-like tcg game made in python that can be played on a terminal emulator using a keyboard.

Vitrix is an open-source FPS video game coded in python

Vitrix is an open-source FPS video game coded in python Table of contents Usage Game Server Installing Requirements Hardware Requirements Software Req

Owner
null
Snake game mixed with Conway's Game of Life

SnakeOfLife Snake game mixed with Conway's Game of Life The rules are the same than a normal snake game but you have to avoid cells created by Conway'

Aidan 5 May 26, 2022
Pyxel is a retro game engine for Python.

Pyxel is open source and free to use. Let's start making a retro game with Pyxel!

Takashi Kitao 11.2k Jan 9, 2023
Snake game made in python with the pygame library.

Pygame snake Snake game made in python with the pygame library. Requirements pip pygame Pygame Installation On the command line, type: pip install pyg

Ayza 3 Oct 2, 2022
A Snake Game built by Python Turtle Module 🐍

Snake-Game A Snake Game built with Python Turtle Module ?? Icons made by Freepik from www.flaticon.com Intro Control the direction of snake by simply

Megan 1 Oct 24, 2021
Snake Game in Python

Snake game is one of the most popular arcade games of all time. In this game, the main objective of the player is to catch the maximum number of fruits without hitting the wall or itself.

Pavan Ananth Sharma 4 Jul 5, 2022
A python snake game based on pygame.

PySnake A python snake game based on pygame. Requirements Package version pygame >= 2.1.2 opencv-python >= 4.5.1.48 Run Windows python main.py Linux &

null 2 Jan 31, 2022
Un semplice Snake game , come negli anni 90!

Project-SnakeGame Un semplice Snake game , come negli anni 90! ITA VI porto un semplice giochino per i nostalgini degli anni 90 , ispirato al vecchio

Matt K Lawrence 1 Oct 17, 2021
This is a two player snake game

Trake This is a two player snake game How to play the game There is food and two players. You try to eat food to become large and gain points. Player

Grrub 1 Dec 19, 2021
This is a text-based snake and ladder game .

This is a text-based snake and ladder game .

AKSHAI KRISHNA A 1 Nov 1, 2021
Simple implementation of the classic Snake Game in under 100 lines of code

Snake_Game Simple python implementation of the classic Snake Game in under 100 lines of code. Printscreen of the game: Imported Libraries: random; pyg

Raffaele Fiorillo 2 Jun 13, 2022