View on GitHub

Snake game

Snake Game using Python and Pygame.



Snake-game Using Python and Pygame

Who has not played the historic Snake game on Nokia mobile phones. Still, to this very day, people of all ages will have heard of Snake – they might have even played the original, or know an older person who has. I myself was addicted to the game back in my childhood. Though modern games have advanced user interfaces and better graphics, I still miss that excitement while playing them. I wanted to recreate that excitement and feeling, Thanks to the programming languages which allow us to build such cool stuffs.

Description


The project aims to build a simple snake game using Python and an Open-source cross-platform library called Pygame. Though the project does not include all the functionalities of the game, It develops a simple game which is controlled by arrow keys on the keyboard. The game also records the users best score. It displays users current score on the window. Though its just a basic game it is good for beginners to get hands on experience with python and the pygame library.

Uniqueness of the project


Though there are plenty of tutorials on the Internet on building the Snake Game, One unique feature of this project is that the game is made capable to store users best score. This feature makes use of a txt file which is read and overwritten each time the user’s current game score is higher than previous best score. Initially the score is set to 0 in a txt file. This txt file has to be in the same folder/directory where the .py file is stored. I took the game prototype form here. The author has given a detailed explanation on how to implement a snake game using python from scratch. I recommend you to check it once.

Structure of the repository


Structure of my github repository for snake game is as follows,

Here's a glimpse of the game