2020-12-03 21:06:26 +00:00
|
|
|
use ggez::GameResult;
|
2020-12-25 22:39:41 +00:00
|
|
|
use num_traits::clamp;
|
2020-11-01 19:05:29 +00:00
|
|
|
|
2020-12-25 22:39:41 +00:00
|
|
|
use crate::caret::CaretType;
|
2020-11-01 19:05:29 +00:00
|
|
|
use crate::common::Direction;
|
2020-12-25 22:39:41 +00:00
|
|
|
use crate::npc::list::NPCList;
|
2020-10-02 23:53:32 +00:00
|
|
|
use crate::npc::NPC;
|
2020-11-01 19:05:29 +00:00
|
|
|
use crate::player::Player;
|
|
|
|
use crate::shared_game_state::SharedGameState;
|
2020-10-02 23:53:32 +00:00
|
|
|
|
|
|
|
impl NPC {
|
2020-11-01 19:05:29 +00:00
|
|
|
pub(crate) fn tick_n154_gaudi_dead(&mut self, state: &mut SharedGameState) -> GameResult {
|
|
|
|
let dir_offset = if self.direction == Direction::Left { 0 } else { 3 };
|
|
|
|
self.anim_rect = state.constants.npc.n154_gaudi_dead[self.anim_num as usize + dir_offset];
|
|
|
|
|
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
|
2020-12-15 22:09:14 +00:00
|
|
|
pub(crate) fn tick_n156_gaudi_projectile(&mut self, state: &mut SharedGameState) -> GameResult {
|
|
|
|
if self.action_counter > 300 || (self.flags.0 & 0xff) != 0 {
|
|
|
|
self.cond.set_alive(false);
|
|
|
|
state.create_caret(self.x, self.y, CaretType::ProjectileDissipation, Direction::Left);
|
|
|
|
}
|
|
|
|
|
|
|
|
self.x += self.vel_x;
|
|
|
|
self.y += self.vel_y;
|
|
|
|
|
|
|
|
self.anim_num = (self.anim_num + 1) % 3;
|
|
|
|
|
|
|
|
self.anim_rect = state.constants.npc.n156_gaudi_projectile[self.anim_num as usize];
|
|
|
|
|
|
|
|
Ok(())
|
|
|
|
}
|
2020-10-02 23:53:32 +00:00
|
|
|
}
|