Skip to content

vinodkp007/Snake-Game-Using-Python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hello, The title does not seem anything different than others right, but let me tell you what is!

The Project root folder consists of 4 python files and each hold different fuctionalities of this project, Let us discuss about these files so you don't have to GPT it to understand.

The first file, "main.py" --> The main.py as we know the base file of any project even here it doen not change its function, Here it is responsible for 1) Creating Black screen 2) Creating snake body 3) Moving snake body continuosly, All of the above functions have been done using turtle module (for more use python turtle documentation )

Secondly, "food.py" --> This file is responsible for creating food in random locations on the screen of the board, it uses turtle python builtin module to do it. and random.randint() to create random loactions, So first the food is created then it is placed in a random location.

Third file, "snake.py" --> This file is responsible for the snake created to be moved in all the directions using the arrow keys on our keyboard (simple right)

fourth file, "scoreboard.py" --> yeah the last file I don't trouble you more, This file performs the operation of updating the score when the snake eats the food there is a simple logic behind it, when the snake is around the food with less distance from the center of the food then it is considered as it has eaten the food that means we can increment the score

Yep! that is all there to know, but yeah there is a .txt file to store the score in .txt file (not so professional) but yet I do not want to lose my highscore so that when I come back to play again the Highscore remains. Just an addition

The Question is HOW TO RUN IT?

download the zip file, extract all | then "pip install turtle" without quotes you are good to go, which means run "main.py"

I tried to explain the project in a brief, yeah in a brief ther is lot to know try understanding through the code and comments given around it THANK YOU!!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages