1
0
Fork 0
mirror of https://github.com/doukutsu-rs/doukutsu-rs synced 2024-09-29 13:38:51 +00:00
doukutsu-rs/src/npc/ai/maze.rs

35 lines
1.1 KiB
Rust
Raw Normal View History

use ggez::GameResult;
use num_traits::clamp;
2020-11-01 19:05:29 +00:00
use crate::caret::CaretType;
2020-11-01 19:05:29 +00:00
use crate::common::Direction;
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
}