飞机图片、事件调用

This commit is contained in:
206530333 2021-06-14 21:48:11 +08:00
parent ebd9fc7266
commit 5c9bf0355a
1 changed files with 39 additions and 0 deletions

39
boss.py Normal file
View File

@ -0,0 +1,39 @@
import pygame
from enemyplane import *
class BossPlane(EnemyPlane):
def __init__(self, scene):
# 加载飞机资源
self.images = [pygame.image.load(
"./images/boss/" + str(v) + ".png") for v in range(0, 11)]
self.image = self.images[0]
self.mask = pygame.mask.from_surface(self.image)
# 缓存主场景对象
self.main_scene = scene
# 设置当前BOSS图片播放索引
self.index = 0
# 图片BOSS图片播放间隔
self.interval = 20
self.interval_index = 0
# 飞机矩形
self.rect = pygame.image.load('images/boss/0.png').get_rect()
self.size = self.rect.bottomright
# 子弹列表
self.bullets = [Bullet(self.main_scene, enemy=True, type=0)
for v in range(0, 21)]
# 飞机速度
self.speed = 3
# 飞机血量
self.HP = 1000
self.score = 100
# BOSS 是否可见
self.visible = False
# 飞机子弹发射间隔 毫秒
self.interval = 1500
# 飞机子弹发射当前时间
self.endtime = pygame.time.get_ticks()
# 飞机动作