Made the Snake Game!

Added Snake Game demo.
This commit is contained in:
rzmk 2021-08-12 17:45:13 -04:00
parent 735ff97d0d
commit 9e21e4dbdd
5 changed files with 165 additions and 0 deletions

18
Day 21/food.py Normal file
View file

@ -0,0 +1,18 @@
from turtle import Turtle
import random
class Food(Turtle):
def __init__(self):
super().__init__()
self.shape("circle")
self.penup()
self.shapesize(stretch_len=0.5, stretch_wid=0.5)
self.color("red")
self.speed("fastest")
self.refresh()
def refresh(self):
random_x = random.randint(-280, 280)
random_y = random.randint(-280, 255)
self.goto(random_x, random_y)