mirror of
https://github.com/doukutsu-rs/doukutsu-rs
synced 2024-12-02 01:53:24 +00:00
forcefield and key
This commit is contained in:
parent
3dd21e4356
commit
698127d2c2
|
@ -86,6 +86,51 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n013_forcefield(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
self.anim_counter = (self.anim_counter + 1) % 2;
|
||||
if self.anim_counter == 1 {
|
||||
self.anim_num = (self.anim_num + 1) % 4;
|
||||
self.anim_rect = state.constants.npc.n013_forcefield[self.anim_num as usize];
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n014_key(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
if self.action_num == 0 {
|
||||
self.action_num = 1;
|
||||
|
||||
if self.direction == Direction::Right {
|
||||
self.vel_y = -0x200;
|
||||
}
|
||||
}
|
||||
|
||||
if self.flags.hit_bottom_wall() {
|
||||
self.npc_flags.set_interactable(true);
|
||||
}
|
||||
|
||||
self.anim_counter += 1;
|
||||
if self.anim_counter > 1 {
|
||||
self.anim_counter = 0;
|
||||
self.anim_num += 1;
|
||||
if self.anim_num > 2 {
|
||||
self.anim_num = 0
|
||||
}
|
||||
}
|
||||
|
||||
self.vel_y += 0x40;
|
||||
|
||||
if self.vel_y > 0x5ff {
|
||||
self.vel_y = 0x5ff;
|
||||
}
|
||||
|
||||
self.y += self.vel_y;
|
||||
|
||||
self.anim_rect = state.constants.npc.n014_key[self.anim_num as usize];
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n015_chest_closed(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
|
|
|
@ -118,6 +118,8 @@ impl GameEntity<(&mut Player, &HashMap<u16, RefCell<NPC>>, &mut Stage)> for NPC
|
|||
10 => { self.tick_n010_balrog_shooting(state, player) }
|
||||
11 => { self.tick_n011_balrogs_projectile(state) }
|
||||
12 => { self.tick_n012_balrog_cutscene(state, player, map, stage) }
|
||||
13 => { self.tick_n013_forcefield(state) }
|
||||
14 => { self.tick_n014_key(state) }
|
||||
15 => { self.tick_n015_chest_closed(state) }
|
||||
16 => { self.tick_n016_save_point(state) }
|
||||
17 => { self.tick_n017_health_refill(state) }
|
||||
|
|
Loading…
Reference in a new issue