AttributeError: ‘NoneType’ object has no attribute ‘virtual’
Написал вот такой код, но выдает ошибку:
image = games.load_image( r“C:\GameProject\Characters\zip files\run\adventurer-run3-00.png”) File “C:\Python 3.8\lib\site-packages\superwires\games.py”, line 836, in load_image if not screen.virtual: AttributeError: ‘NoneType’ object has no attribute ‘virtual’`
Помогите исправить, код предоставлен ниже
from superwires import games,color
class Character(games.Sprite):
image = games.load_image( r“C:\GameProject\Characters\zip files\run\adventurer-run3-00.png”)
def __init__(self, speed = 15):
super(Character,self).__init__(Character.image, x = 16, y = 600, dx = speed)
def update(self):
if games.keyboard.is_pressed(games.keyboard.K_d):
self.x += self.dx
elif games.keyboard.is_pressed(games.keyboard.K_a):
self.x -= self.dx
def main():
games.init(screen_width= 1360, screen_height= 680, fps= 50,)
background = (r“C:\GameProject\Background\pixel clouds.jpg ”)
welcome = games.Text(value = ‘The Last Hero part 1’, color = color.red, size = 100, x = 680, y = 100)
background_image = games.load_image(background, transparent=False)
games.screen.background = background_image
the_adventurer = Character.image
games.screen.add(the_adventurer)
games.screen.add(welcome)
games.screen.mainloop()