import pygame
import time
from pygame.locals import *
class HeroPlane(object):
def __init__(self,screen_temp):
self.x = 250
self.y = 520
self.screen = screen_temp #游戏窗口
self.image = pygame.image.load('images/飞机2.png')
self.bullet_list = [] #存储发射出去的子弹
def display(self):
# 加载玩家飞机到窗口
self.screen.blit(self.image,(self.x,self.y))
for bullet in self.bullet_list:
bullet.display()
bullet.move()
def move_left(self):
self.x -= 20
def move_right(self):
self.x += 20
def move_up(self):
self.y -= 20
def move_down(self):
self.y += 20
def fire(self):
self.bullet_list.append(Bullet(self.screen,self.x,self.y))
class Bullet(object):
def __init__(self,screen_temp,x,y):
sel