SnakeGame is a video game genre where the player maneuvers a growing line that becomes a primary obstacle to itself.
Modules : turtle, random & time Font : Courier
The snake will grow its body when the snake eats an egg. So, the score will be counted. Checking for the snake’s head collisions with the body or the wall of the window screen.
Steps:
-
Create the screen
- screen size : 600X600
- bg color : Black
-
Create a snake adding 3 square shaped turtles
- snake class
- set it to motion
- It can move forwards, back, left or right.
-
Create egg and make it appear at random position when a snake touches it
-
Detect when the snake collides with walls or its tail #1. Display "GAME OVER" at center 2. create a new snake and make the old snake disappear
-
Detect when the snake eat an egg
- increase the score +1
-
Create a score board
- keeps track of old score and new score
- write data in score_sheet
- retrieve the data on updating the score