蓝大伟 发表于 2020-8-22 17:20:19

新手问题1飞机大战

差在哪??
import pygame
from plane_sprites import *

pygame.init()

screen = pygame.display.set_mode((480,700))

bg = pygame.image.load("./images/background.png")

screen.blit(bg,(0,0))
#pygame.display.update()

f = pygame.image.load("./images/me1.png")
screen.blit(f, (200, 500))
pygame.display.update()

clock = pygame.time.Clock()
hero_rect = pygame.Rect(150,300,102,126)
enemy = GameSprite("./images/enemy1.png")
enemy1 = GameSprite("./images/enemy1.png",2)
enemy_group = pygame.sprite.Group(enemy)
while True:
    clock.tick(30)
    for event in pygame.event.get():
      if event.type == pygame.QUIT:
            print("游戏结束。。。")
            pygame.quit()
            exit()

    hero_rect.y -= 5
    if hero_rect.y <= -100:
      hero_rect.y = 700
    screen.blit(bg,(0,0))
    screen.blit(f,hero_rect)
    pygame.display.update()


Traceback (most recent call last):
File "C:/Users/tlan2/Desktop/真·飞机大战/01.py", line 2, in <module>
    from plane_sprites import *
ModuleNotFoundError: No module named 'plane_sprites'

Process finished with exit code 1

Twilight6 发表于 2020-8-22 17:27:07



报错写那了:没有找到 plane_sprites 模块

看看你的文件名对不对,检查检查,可能是 place_sprites 吧?

1q23w31 发表于 2020-8-22 17:27:15

没有plane_sprites.py?这个文件
页: [1]
查看完整版本: 新手问题1飞机大战