为什么一直显示有错误啊?
找了好久也没发现哪里错了,有人能帮忙看看么
import random
import time
import pygame
from pygame.constants import *
class HeroPlane(pygame.sprite.Sprite):
def __init__(self, screen):
pygame.sprite.Sprite.__init__(self)
self.player = pygame.image.load("./fei ji/pink.png")
self.rect = self.image.get_rect()
self.rect.topleft = [400 / 2 - 200 / 2, 430]
def main():
sound = GameSound()
sound.playBackMusic()
screen = pygame.display.set_mode((400, 650), 0, 32)
background = pygame.image.load("./fei ji/bg.png")
player = HeroPlane(screen)
enemyplane = EnemyPlane(screen)
while True:
screen.blit(background, (0, 0)) # (0, 0)
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
exit()
player.key_control()
player.display()
enemyplane.display()
enemyplane.auto_move()
enemyplane.auto_fire()
pygame.display.update()
time.sleep(0.01)
if __name__ == '__main__':
main()