class MarioState_Dead(MarioState): def __init__(self, _mario): MarioState.__init__(self, _mario) self._dead1_clock = Clock(2.0) self._dead2_clock = Clock(4.0) pass def enter(self): self._mario.set_animation('anim_mario_dying') self._mario.animations.set_pause(False) self._mario.rigidbody.enabled = False # Kill all barrels/fires GameData.get_singleton().global_dk.kill_all_barrels() GameData.get_singleton().global_oil.reset() # Disable DK and oil GameData.get_singleton().global_dk.pause_logic = True GameData.get_singleton().global_oil.pause_logic = True # Audio AudioPlayer.get_singleton().stop_all_audio() self._mario.sfx_dying.play() pass def exit(self): pass def update(self, delta_time: float): if self._dead1_clock.is_finished(): self._mario.set_animation('anim_mario_dead') if self._dead2_clock.is_finished(): GameData.get_singleton().increase_lives(-1) self._mario.alive = False pass
def __init__(self, _dk): DK_State.__init__(self, _dk) self.id = DK_State_Enum.TOSS_BARREL_RIGHT self.clocks: List[Clock] = (Clock(0.5), Clock(1.0), Clock(1.5)) # Left, hold barrel, Right, (return to still) self.spawned: bool = False pass
def __init__(self, entity_name: str, _pos: Vector3): # Base Constructor Entity.__init__(self, entity_name) self.transform.set_position(_pos) # Physics self.collision = self.add_component( Collider_AABB_2D(self.transform.get_position())) self.collision.offset = Vector2(-6, 8) self.collision.type = Collision_Type.TRIGGER self.collision.id = Engine.Config.TRIGGER_ID_OIL_BARREL self._ray_left: Raycast_2D = None self._ray_right: Raycast_2D = None # Animations self.animations = SpriteAnimation('anim_oil_barrel_empty') self.animations.set_speed(8.0) # Data self.pause_logic: bool = False self._lit: bool = False self._fire: Enemy_Fire = None self._flame_effect: bool = False self._flame_effect_timer: Clock = Clock(2.0)
def __init__(self, _mario): MarioState.__init__(self, _mario) self.ladder_top_has_block: bool = False self.ladder_bot: float = self._mario._ladder_ref.collision.get_down() self.ladder_top: float = self._mario._ladder_ref.collision.get_up() self.can_exit_down: bool = True # Audio self.walk_sfx_clock: Clock = Clock(0.35) # Check for additional block _ents: List[Entity] = Engine.Raycast.Raypoint_2D_Static(Vector2( self._mario._ladder_ref.collision.get_position().x, self._mario._ladder_ref.collision.get_up() + Engine.Config.TILE_SIZE - 2.0 ), Engine.Config.TRIGGER_ID_FLOOR ) for e in _ents: if e.collision.type is Collision_Type.PLATFORM: self.ladder_top_has_block: bool = True self.ladder_top += Engine.Config.TILE_SIZE break # If floating top portion of a ladder, add additional slack _ents: List[Entity] = Engine.Raycast.Raypoint_2D_Static(Vector2( self._mario._ladder_ref.collision.get_position().x, self._mario._ladder_ref.collision.get_down() - 2.0 ), Engine.Config.TRIGGER_ID_FLOOR ) _nothing_below_ladder: bool = True for e in _ents: if e.collision.type is Collision_Type.PLATFORM: _nothing_below_ladder = False break if _nothing_below_ladder: self.can_exit_down = False self.ladder_bot -= Engine.Config.TILE_SIZE pass
def __init__(self, _dk): DK_State.__init__(self, _dk) self.id = DK_State_Enum.STILL self.timer: Clock = Clock(0.5) pass
def __init__(self, _mario): MarioState.__init__(self, _mario) self._dead1_clock = Clock(2.0) self._dead2_clock = Clock(4.0) pass
def __init__(self, _mario): MarioState.__init__(self, _mario) # Audio self.walk_sfx_clock: Clock = Clock(0.18) pass