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))
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