bullet lifetime fix

This commit is contained in:
Alula 2020-09-13 02:39:43 +02:00
parent 82511ca6b7
commit 9a7ea5be42
No known key found for this signature in database
GPG Key ID: 3E00485503A1D8BA
2 changed files with 8 additions and 1 deletions

View File

@ -25,6 +25,11 @@ impl BulletManager {
pub fn tick_bullets(&mut self, state: &mut SharedGameState, player: &dyn PhysicalEntity, stage: &mut Stage) {
for bullet in self.bullets.iter_mut() {
if bullet.life < 1 {
bullet.cond.set_alive(false);
continue;
}
bullet.tick(state, player);
bullet.hit_flags.0 = 0;
bullet.tick_map_collisions(state, stage);

View File

@ -637,7 +637,9 @@ impl GameScene {
// todo show damage
}
}
} else if !bullet.flags.hit_right_slope() {
} else if !bullet.flags.hit_right_slope()
&& bullet.btype != 13 && bullet.btype != 14 && bullet.btype != 15
&& bullet.btype != 28 && bullet.btype != 29 && bullet.btype != 30 {
state.create_caret((bullet.x + npc.x) / 2, (bullet.y + npc.y) / 2, CaretType::ProjectileDissipation, Direction::Right);
// todo play sound 31
bullet.life = 0;