请问为什么我的pygame粘贴不出来图片?我后面也加了update啊
以下是main.py文件:
import pygame
from plane import *
import time
pygame.init()
width = 450
height = 500
bg = pygame.image.load("img/bg.png")
screen = pygame.display.set_mode((width, height))
pygame.display.set_caption("飞机大战")
screen.blit(bg, (0, 0))
plane = Plane()
plane.draw(screen, 225, 500)
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
pygame.display.update()
以下是plane.py文件:
import pygame
pygame.init()
class Plane():
def __init__(self):
self.image = pygame.image.load("img/plane.png")
def draw(self, screen, x, y):
screen.blit(self.image, (x, y))
请问为什么我显示不出来plane,却显示的出来bg?