From 6964b8d16792adfa40ecaa8a929748e69bcda398 Mon Sep 17 00:00:00 2001 From: Alula Date: Mon, 2 Nov 2020 11:54:17 +0100 Subject: [PATCH] fix bullets breaking multiple snack blocks in a single hit --- src/bullet.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/bullet.rs b/src/bullet.rs index 0689950..9611b99 100644 --- a/src/bullet.rs +++ b/src/bullet.rs @@ -572,7 +572,7 @@ impl PhysicalEntity for Bullet { } for (idx, (&ox, &oy)) in OFF_X.iter().zip(OFF_Y.iter()).enumerate() { - if idx == 4 { + if idx == 4 || !self.cond.alive() { break; } @@ -595,13 +595,13 @@ impl PhysicalEntity for Bullet { state.create_caret(self.x, self.y, CaretType::ProjectileDissipation, Direction::Left); state.sound_manager.play_sfx(12); - for _ in 0..4 { - let mut npc = NPCMap::create_npc(4, &state.npc_table); + let mut npc = NPCMap::create_npc(4, &state.npc_table); + npc.cond.set_alive(true); + npc.direction = Direction::Left; + npc.x = x * 16 * 0x200; + npc.y = y * 16 * 0x200; - npc.cond.set_alive(true); - npc.direction = Direction::Left; - npc.x = x * 16 * 0x200; - npc.y = y * 16 * 0x200; + for _ in 0..4 { npc.vel_x = state.game_rng.range(-0x200..0x200) as isize; npc.vel_y = state.game_rng.range(-0x200..0x200) as isize;