def move_stair(self, input_key): if not self.is_in_stair: if input_key == Player2.KEY_W: if self.moving_body is not None: self.cancel_move_body() return actor, distance = Actor.get_shortest_actor(self.pos) if actor.is_die_anim_end: if distance < 150 * 150: actor.move_body(self) self.movebody_sound.play() self.moving_body = actor self.anim.play(Player2.MOVEBODY) else: if self.anim.anim_idx is not Player2.ATTACK: self.attack_sound.play() self.anim.play(Player2.ATTACK, Player2.IDLE) return i = 0 t_count = len(stair_list) while i < t_count: if stair_list[i].check_player_pos(self.pos): stair_list[i].send_player(input_key, i) return i += 1
def attack(self): attack_pos = cp.copy(self.pos) if self.anim.flip is 'h': dir = 1 else: dir = -1 dis = 100 attack_pos[0] += dir * dis attack_pos[1] += 50 self.debug_attack_pos = attack_pos actor, distance = Actor.get_shortest_actor(attack_pos) if actor is not None: if distance < 150 * 150: actor.take_damage(False)