The game I’m working on has monsters that if the player goes in their magic casting range, the player will be slowed down.
What I tried to do to accomplish this feature is adding a 2d collision box larger than my monster sprite(the 2d collision box represents their magic casting range), and the player game object already has a 2d collision box. In my player’s script, I used a OnCollisionEnter2D function, and if the player’s collision box hits the monster’s collision box, it detects!
however, this is not what I wanted, when the player hits the monster’s collision box, it gets blocked.
What I want to create is the player should be able to walk freely near the monster.