Refactored loops and getHealth method in enemy.