Hello, I have a problem with my maze game project where the little triangle moves, but the graphical interface is not there.
the triangle moves correctly with the keyboard keys, but the maze is not visible.
and when I remove the turtle.done() there's the triangle on the maze but I can't move it
THE CODE :
import turtle
import random
Taille de la grille
GRID_SIZE = 15
Taille d'une cellule
CELL_SIZE = 20
player = turtle.Turtle()
player.color("blue")
player.shape("triangle")
player.pendown()
player.speed(0)
Fonctions pour déplacer le triangle
def move_left():
player.setheading(180) # Définir la direction vers la gauche
player.forward(10)
def move_right():
player.setheading(0) # Définir la direction vers la droite
player.forward(10)
def move_up():
player.setheading(90) # Définir la direction vers le haut
player.forward(10)
def move_down():
player.setheading(270) # Définir la direction vers le bas
player.forward(10)
Associer les touches du clavier aux fonctions de déplacement
turtle.listen()
turtle.onkeypress(move_left, "Left")
turtle.onkeypress(move_right, "Right")
turtle.onkeypress(move_up, "Up")
turtle.onkeypress(move_down, "Down")
Fermer la fenêtre Turtle
turtle.done()