added new collision detection logic for enemy and player collisions