示例#1
0
文件: ship.py 项目: T1GIT/SpaceBattle
 def update_texture(self):
     normal = Img.get_ship(False)
     fire = Img.get_ship(True)
     w0, h0 = normal.get_size()
     scale = Conf.Ship.SIZE / max((w0, h0))
     w1, h1 = map(lambda x: round(x * scale), [w0, h0])
     self.texture_num = Conf.Image.SHIP
     self.texture_normal = pg.transform.scale(normal, (w1, h1))
     self.texture_fire = pg.transform.scale(fire, (w1, h1))
示例#2
0
文件: ship.py 项目: T1GIT/SpaceBattle
 def __init__(self):
     super().__init__()
     # Texture wearing
     normal = Img.get_ship(False)
     fire = Img.get_ship(True)
     w0, h0 = normal.get_size()
     scale = Conf.Ship.SIZE / max((w0, h0))
     w1, h1 = map(lambda x: round(x * scale), [w0, h0])
     self.texture_num = Conf.Image.SHIP
     self.texture_normal = pg.transform.scale(normal, (w1, h1))
     self.texture_fire = pg.transform.scale(fire, (w1, h1))
     # Variables
     self.half_width = self.texture_normal.get_width() / 2
     self.half_height = self.texture_normal.get_height() / 2
     self.image = self.texture_normal
     self.speed_x, self.speed_y = 0, 0
     self.pos_x, self.pos_y = 0, 0
     self.angle = 90
     self.with_fire = False