(Solved) Top down enemies spawn when player a certain distance

Is there any way to make enemies only spawn when player is a certain distance from a spawn area ?

What I would like is a small drain sprite to change to open when the player is a certain distance from the sprite. Which would be change the animation to something like drain open.

portal spider

portal spider 2

And the drain would be the spawn area for enemies like spiders.

The only way I can think of is having several invisible sprites named something like trap and activate the in collision event.

Is there a better or cleaner way to achieve this ?

Thanks

Hi,

there is a condition called ‘distance between two objects’.

1 Like

Thank you perfect never knew that condition existed. A brilliant way to add a little AI to enemies.

1 Like