Skip to content

Commit 19b7403

Browse files
panoschagiasjadijadi
authored andcommitted
bullets do not pass through walls
1 parent 4dd26ce commit 19b7403

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/main.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -373,14 +373,12 @@ fn move_bullets(world: &mut World) {
373373
world.bullet[index].location.l -= 2;
374374
world.bullet[index].energy -= 1;
375375

376-
if world.bullet[index].location.c < world.map[world.bullet[index].location.l as usize].0
377-
|| world.bullet[index].location.c
378-
>= world.map[world.bullet[index].location.l as usize].1
379-
{
376+
if world.bullet[index].location.c < world.map[world.bullet[index].location.l as usize].0 ||
377+
world.bullet[index].location.c >= world.map[world.bullet[index].location.l as usize].1 {
380378
world.bullet.remove(index);
381-
}
382-
}
383-
}
379+
}
380+
}
381+
}
384382
}
385383

386384
fn welcome_screen(mut sc: &Stdout, world: &World) {

0 commit comments

Comments
 (0)