示例#1
0
 def __init__(self):
     sprites = ResourceManagement.get_enemy_ice_sprites()
     first_sprite = next(iter(sprites.values()))[0]
     Enemy.__init__(self, first_sprite, .5,
                    EnemySettings.HandToHand.HEALTH_MAX,
                    EnemySettings.HandToHand.ATTACK_COOLDOWN_S)
     AnimatedSprite.__init__(self,
                             ResourceManagement.get_enemy_ice_sprites(), 4,
                             EnemyState.RUNNING_RIGHT)
     self.__retreat_distance_sqr: float = 0
 def __init__(self, direction: Vector2):
     sprites = ResourceManagement.get_projectile_fire_ball_sprites()
     sprite = next(iter(sprites.values()))[0]
     Projectile.__init__(self, sprite)
     AnimatedSprite.__init__(self, sprites, 3, ProjectileState.DEFAULT)
     self.__death_time = EnemyProjectile._death_time()
     self._direction = direction
 def __init__(self):
     sprites = ResourceManagement.get_enemy_stone_sprites()
     sprite = next(iter(sprites.values()))[0]
     Enemy.__init__(self, sprite, EnemySettings.HeavyRock.WEIGHT,
                    EnemySettings.HeavyRock.HEALTH_MAX,
                    EnemySettings.HeavyRock.ATTACK_COOLDOWN_S)
     AnimatedSprite.__init__(self, sprites, 2, EnemyState.RUNNING_LEFT)
 def __parse_background(self) -> Surface:
     element: ET.Element = self.root.find('background')
     if 'color' in element.attrib:
         surface: Surface = Surface(self.__parse_dimensions(element))
         surface.fill(self.__parse_color(element))
         return surface
     else:
         return ResourceManagement.get_image(element.attrib['src'])
 def __init__(self):
     sprites = ResourceManagement.get_enemy_fire_sprites()
     first_sprite = next(iter(sprites.values()))[0]
     Enemy.__init__(self, first_sprite, EnemySettings.Ranged.WEIGHT,
                    EnemySettings.Ranged.HEALTH_MAX,
                    EnemySettings.Ranged.ATTACK_COOLDOWN_S)
     AnimatedSprite.__init__(self, sprites, 3, EnemyState.RUNNING_LEFT)
     self.__cooldown_expire = 0
示例#6
0
    def __init__(self, level: int, player: GameObject):
        default_state = (TornadoProjectileState.BIG if level > 1 else TornadoProjectileState.SMALL)
        sprites = ResourceManagement.get_projectile_tornado_sprites()
        first_sprite = sprites[default_state][0]

        Projectile.__init__(self, first_sprite)
        AnimatedSprite.__init__(self, sprites, 3, default_state)
        self.___death_time = time.time() + PlayerSettings.Ability.TornadoJump.TIME_TO_LIVE
        self._player = player
        self.level = level
    def __init__(self, weight: float = .5):
        sprites = ResourceManagement.get_player_sprites()
        first_sprite = next(iter(sprites.values()))[0]

        RigidPhysicsAwareGameObject.__init__(self, first_sprite, weight)
        LivingEntity.__init__(self,
                              PlayerSettings.HEALTH_MAX,
                              invincibility_duration=1)
        AnimatedSprite.__init__(self, sprites, 3, PlayerState.IDLE)
        self.ability_tornado_jump = TornadoJumpAbility(1)
        self.ability_gust = GustAbility(0)
        self.ability_slam = SlamAbility(0)
        self.mana: float = PlayerSettings.MANA_MAX
        self._last_direction = 1
示例#8
0
    def __init__(self, level, strength: Vector2):
        sprites = ResourceManagement.get_projectile_slam_sprites(
            (
                int(PlayerSettings.Ability.Slam.AREA_SIZE[0] * {1: 1, 2: 2, 3: 3.60}[level]),
                PlayerSettings.Ability.Slam.AREA_SIZE[1]
            )
        )
        first_sprite = next(iter(sprites.values()))[0]

        Projectile.__init__(self, first_sprite)
        AnimatedSprite.__init__(self, sprites, 12, ProjectileState.DEFAULT)
        self.strength = strength
        self._level = level
        self.__death_time = self._death_time()
    def __parse_box(self, element: ET.Element) -> GameObject:
        if 'src' in element.attrib:
            surface: Surface = ResourceManagement.get_image(
                element.attrib['src'])
        else:
            surface: Surface = Surface(self.__parse_dimensions(element))
            if 'invisible' in element.attrib:
                surface = surface.convert_alpha()
                surface.fill((0, 0, 0, 0))
            else:
                surface.fill(self.__parse_color(element))

        go = GameObject(surface)
        self.__assign_transform(element, go)

        return go
    def __init__(self, on_enter: [Callable[[], None]] = None, on_stay_inside: [Callable[[], None]] = None,
                 on_exit: [Callable[[], None]] = None):
        sprites = ResourceManagement.get_environment_button_sprites()
        first_sprite = next(iter(sprites.values()))[0]

        RigidPhysicsAwareGameObject.__init__(self, first_sprite, 0)
        AnimatedSprite.__init__(self, sprites, 1, ButtonState.OFF)
        self.on_enter = on_enter if on_enter is not None else []
        self.on_enter.append(self.__hide)

        self.during_activation = on_stay_inside if on_stay_inside is not None else []

        self.on_exit = on_exit if on_exit is not None else []
        self.on_exit.append(self.__show)

        self.was_pressed = False
        self.is_pressed = False
    def __init__(self, size: (int, int), direction: Vector2, force: float):
        surface = Surface(size)

        RigidPhysicsAwareGameObject.__init__(self, surface, 0)
        AnimatedSprite.__init__(
            self,
            ResourceManagement.get_environment_wind_stream_sprites(size),
            2, WindDirection.UP)
        self._direction = direction.normalize()
        self._force = force
        if abs(direction.x) > abs(direction.y):
            if direction.x > 0:
                self._state = WindDirection.RIGHT
            else:
                self._state = WindDirection.LEFT
        else:
            if direction.y > 0:
                self._state = WindDirection.DOWN
            else:
                self._state = WindDirection.UP
示例#12
0
 def __init__(self):
     sprite: Surface = ResourceManagement.get_image('orb_slam.png')
     RigidPhysicsAwareGameObject.__init__(self, sprite, 0)
示例#13
0
 def __init__(self):
     UIIndicator.__init__(self,
                          ResourceManagement.get_ability_slam_sprite(),
                          (10, 296))
示例#14
0
 def __init__(self):
     UIIndicator.__init__(self,
                          ResourceManagement.get_ability_gust_sprite(),
                          (10, 230))
示例#15
0
 def __init__(self):
     UIIndicator.__init__(self,
                          ResourceManagement.get_ability_jump_sprite(),
                          (10, 163))
示例#16
0
 def __init__(self):
     sprites = ResourceManagement.get_projectile_gust_sprites()
     first_sprite = next(iter(sprites.values()))[0]
     Projectile.__init__(self, first_sprite)
     AnimatedSprite.__init__(self, sprites, 12, ProjectileState.DEFAULT)
     self.__death_time = time.time() + PlayerSettings.Ability.Gust.TIME_TO_LIVE