Skip to content

Commit

Permalink
update names
Browse files Browse the repository at this point in the history
  • Loading branch information
stutxo committed Mar 28, 2024
1 parent c305447 commit 930b418
Showing 1 changed file with 0 additions and 5 deletions.
5 changes: 0 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,19 +253,14 @@ fn update_enemy_pos() {

for enemy_entity in ENEMIES.iter_mut() {
if let Some(enemy) = enemy_entity {
// Iterate through all WALL to check for collisions.
let mut enemy_hit = false;
for wall_entity in WALL.iter_mut() {
if let Some(wall) = wall_entity {
// Check for overlap in both the X and Y directions.
// Considering the size of the enemy and the wall for collision detection.

if enemy.x < wall.x + WALL_SIZE
&& enemy.x + ENEMY_SIZE > wall.x
&& enemy.y < wall.y + WALL_SIZE
&& enemy.y + ENEMY_SIZE > wall.y
{
// Collision detected, remove the wall by setting it to None.
*wall_entity = None;
enemy_hit = true;
}
Expand Down

0 comments on commit 930b418

Please sign in to comment.