9/26/2025 free friday

import turtle

wn = turtle.Screen()

wn.title(“Snake Game by @TokyoEdTech”)

wn.bgcolor(“green”)

wn.setup(width=600, height=600)

wn.tracer(0)

# Snake head

head = turtle.Turtle()

head.speed(0)

head.shape(“square”)

head.color(“black”)

head.penup()

head.goto(0,0)

head.direction = “stop”

# Funtions

def move():

    if head.direction ==”up”:

         y = head.ycor()

         head.sety(y + 20)

    if head.direction ==”down”:

         y = head.ycor()

         head.sety(y – 20)

    if head.direction ==”left”:

         x = head.xcor()

         head.sety(y – 20)

         if head.direction ==”roght”:

         x = head.xcor()

         head.sety(y – 20)

#main game look

while True:

    wn.update()

    move()

    wn.mainloop()

that is the code i did it restarted i think https://youtu.be/BP7KMlbvtOo?si=K8joC6OQFhtu0KWK is how to make it

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top