From e1b33aa0e9afc7566e6d7f7275a5a46747534644 Mon Sep 17 00:00:00 2001 From: dawnDus <96957561+dawndus@users.noreply.github.com> Date: Sun, 23 Jan 2022 19:29:41 -0500 Subject: [PATCH] Persistent damage numbers --- src/npc/mod.rs | 2 -- src/npc/utils.rs | 2 +- src/scene/game_scene.rs | 9 +++++++++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/npc/mod.rs b/src/npc/mod.rs index 8fcf6a7..990a99d 100644 --- a/src/npc/mod.rs +++ b/src/npc/mod.rs @@ -657,8 +657,6 @@ impl GameEntity<([&mut Player; 2], &NPCList, &mut Stage, &mut BulletManager, &mu ); batch.draw(ctx)?; - self.popup.draw(state, ctx, frame)?; - Ok(()) } } diff --git a/src/npc/utils.rs b/src/npc/utils.rs index 4ae250b..94ff694 100644 --- a/src/npc/utils.rs +++ b/src/npc/utils.rs @@ -215,6 +215,7 @@ impl NPC { npc.cond.set_alive(true); npc.x = self.x; npc.y = self.y; + npc.popup = self.popup; *self = npc; } @@ -313,7 +314,6 @@ impl NPCList { state.game_flags.set(npc.flag_num as usize, true); if npc.npc_flags.show_damage() { - // todo show damage if vanish { npc.vanish(state); } diff --git a/src/scene/game_scene.rs b/src/scene/game_scene.rs index 7eca106..2fb79c1 100644 --- a/src/scene/game_scene.rs +++ b/src/scene/game_scene.rs @@ -206,6 +206,13 @@ impl GameScene { Ok(()) } + fn draw_npc_popup(&self, state: &mut SharedGameState, ctx: &mut Context) -> GameResult { + for npc in self.npc_list.iter_alive() { + npc.popup.draw(state, ctx, &self.frame)?; + } + Ok(()) + } + fn draw_bullets(&self, state: &mut SharedGameState, ctx: &mut Context) -> GameResult { let batch = state.texture_set.get_or_load_batch(ctx, &state.constants, "Bullet")?; let mut x: i32; @@ -1771,6 +1778,8 @@ impl Scene for GameScene { self.whimsical_star.draw(state, ctx, &self.frame)?; } + self.draw_npc_popup(state, ctx)?; + self.water_renderer.draw(state, ctx, &self.frame)?; self.tilemap.draw(state, ctx, &self.frame, TileLayer::Foreground, stage_textures_ref, &self.stage)?; self.tilemap.draw(state, ctx, &self.frame, TileLayer::Snack, stage_textures_ref, &self.stage)?;