【发布时间】:2021-04-21 20:58:02
【问题描述】:
我在 pygame 中制作游戏,我希望橡子从天上掉下来。
class Acorn:
def __init__(self):
self.x = random.randrange(0, 450)
self.y = 0
self.image = pygame.image.load("Images/acorn.png")
def create(self, screen):
screen.blit(self.image, (self.x, self.y))
self.y += 1
acorns.append(Acorn)
在我的游戏循环中,我尝试创建多个橡子
for x in acorns:
x.create(screen, screen)
acorns.append(Acorn)
【问题讨论】:
-
多个对象不是无限对象。
-
怎么了?你有什么需要帮助的?请说明。
标签: python python-3.x pygame