I'm making a simple snake game in python. I am in the earlier stages of just making the snake move at this point. So I have 3 files, main.py, Turtle_Skin.py and Turtle_Control.py The first part (In Turtle_Skin.py) is working just fine where I need to make the snake take the starting position, however even if I try migrating the code from Turtle_Control.py to main.py (to make sure it executes and doesn't get left behind while importing), it won't execute
My Code with file names:
main.py:
from Turtle_Control import *
from Turtle_Skin import *
positions_goto()
Turtle_Skin.py:
from turtle import *
screen = Screen()
screen.setup(width=600, height=600)
screen.bgcolor("black")
screen.title("Snake_Food_Game")
screen.tracer(1)
Baby_Turtle = Turtle()
Mommy_Turtle = Turtle()
Daddy_Turtle = Turtle()
All_Turtles = [Baby_Turtle, Mommy_Turtle, Daddy_Turtle]
for turtle in All_Turtles:
turtle.shape("square")
turtle.pencolor("white")
turtle.color("white")
def positions_goto():
Daddy_Turtle.penup()
Daddy_Turtle.goto(x=-40, y=0)
Mommy_Turtle.penup()
Mommy_Turtle.goto(x=-20, y=0)
Baby_Turtle.penup()
positions_goto()
screen.exitonclick()
Turtle_Control.py
from Turtle_Skin import *
import time
positions_goto()
is_on = True
while is_on:
screen.update()
time.sleep(0.1)
for part_num in range(len(All_Turtles) - 1, 0, -1):
xcord = All_Turtles[part_num - 1].xcor()
ycord = All_Turtles[part_num - 1].ycor()
All_Turtles[part_num].goto(x=xcord, y=ycord)
Baby_Turtle.forward(20)