import pygame
import bullet
class plane:
def __init__(self,ck):
self.x = 200
self.y = 200
self.picture = pygame.image.load("图片/hero1.png")
self.chuang_kou = ck
self.zidan = [ ]
def move_up(self):
self.y -= 10
if self.y < -124:
self.y = 700
def move_down(self):
self.y += 10
if self.y > 700:
self.y = -120
def move_right(self):
self.x += 10
if self.x > 350:
self.x = 295
def move_left(self):
self.x -= 10
if self.x < -90:
self.x = 5
def show(self):
self.chuang_kou.blit(self.picture, (self.x, self.y))
for dan_ge_bullet in self.zidan:
dan_ge_bullet.show()
dan_ge_bullet.move_up()
def fire(self):
for y in range(10):
self.zidan.append(bullet.bullet(self.x+y*10, self.y, self.chuang_kou))
"""
AO3
子弹打到敌机,敌机爆炸
肖战粉丝铭牌,
# 战机爆炸功能
"""
import pygame
class bullet:
def __init__(self,x,y,ck):
self.x = x
self.y = y
self.picture = pygame.image.load('图片/bullet-3.gif')
self.chuang_kou = ck
def move_up(self):
self.y -= 10
def show(self):
self.chuang_kou.blit(self.picture, (self.x, self.y))