所以我对精灵的控制工作,直到我添加了一个随机移动精灵的代码。这是代码:
self.shape = self.canvas.create_oval(0,0,50,50,fill="grey80")
self.speedx = (10)
self.speedy = (10)
self.enemy1_list = []
for i in range(1):
self.enemy1_list.append(self.playWindow())
while True:
for self.playWindow in self.enemy1_list:
self.playWindow.update()
parent.update()
time.sleep(0.01)
def update(self):
if pos[2] >= WIDTH or pos[0] <= 0:
self.speedx *= -0.5
if pos[3] >= HEIGHT or pos[1] <= 0:
self.speedy *= -0.5
我收到此错误代码:
AttributeError: 'playWindow' object has no attribute 'playWindow'
由于