Step 8. Implemented collision detection between player and hazards layer