What is this condition testing for?
if (player.bounds.intersects(enemy.bounds)) onHit(enemy);
- Player and enemy colliding
- Player winning the game
- Enemy dropping loot
- Level completed
The code checks whether the player and enemy hitboxes overlap.
Play Game Dev ▸