Пример #1
0
    def update(self):
        super().update()

        self.angle += self.rotation
        x, y = cell_to_raw(self.action.holder.cell)
        self.center_x = x + math.cos(self.angle) * self.radius
        self.center_y = y + math.sin(self.angle) * self.radius
Пример #2
0
    def __init__(self, aura, radius, sprite_pic, sprite_scale):
        super().__init__(aura, sprite_pic, sprite_scale)

        self.radius = radius
        self.angle = math.pi / 2
        self.rotation = config.AURA_ROTATION_SPEED
        x, y = cell_to_raw(aura.holder.cell)
        self.center_x, self.center_y = x, y + radius
Пример #3
0
    def __init__(self, bolt, start_cell, end_cell, angle, rotation,
                 speed_factor_x, speed_factor_y, sprite_pic, sprite_scale):
        super().__init__(bolt, sprite_pic, sprite_scale)

        a, b = vector(end_cell.x - start_cell.x, end_cell.y - start_cell.y)
        self.end_cell = end_cell
        x, y = cell_to_raw(start_cell)
        self.center_x = x + config.ACTION_DELTA * a
        self.center_y = y + config.ACTION_DELTA * b
        self.change_x = config.BOLT_SPEED * a
        self.change_y = config.BOLT_SPEED * b
        self.angle = angle
        self.rotation = rotation
        self.speed_factor_x = speed_factor_x
        self.speed_factor_y = speed_factor_y
Пример #4
0
 def __init__(self, unit):  # should supply cell as an argument in the end
     super().__init__(unit.pic, config.SPRITE_SCALING_UNIT)
     self.unit = unit
     self.center_x, self.center_y = cell_to_raw(unit.cell)
Пример #5
0
 def update(self):
     if not self.unit.is_alive():
         self.kill()
     self.center_x, self.center_y = cell_to_raw(self.unit.cell)