Why is my Pac-man character is not moving? (Turtle)
17:25 15 Jul 2023

First problem: i was making a pacman game and when i run the code it outputs an error, the error in the title. I am using Turtle module to build this game.

Second problem: Also, My Pac-man character yellow circle is not moving when i press the WASD keys. I will appreciate every help.

import turtle

# screen

wn=turtle.Turtle()
wn.width(800)
wn.height(600)
wn.color(0, 0, 0)

# pacman

pac=turtle.Turtle()
pac.size(2)
pac.shape("circle")
pac.color("yellow")
pac.goto(1, 1)

def display_screen(screen, wn):
    wn.screen_width = wn.width
    wn.screen_height = wn.height
    wn.color = wn.color(0, 0, 0)

def pacman_move_up(self, pac):
    self.move_up = pac.onkey("W")

def pacman_move_down(self, pac):
    self.move_down = pac.onkey("S")

def pacman_move_left(self, pac):
    self.move_left = pac.onkey("A")

def pacman_move_right(self, pac):
    self.move_right = pac.onkey("D")

# i need help with the next code. (current file name: spec.py) 
python turtle-graphics python-turtle