Spawning enemies in a top down bullet hell game

Godot Version



I’m trying to make a top down bullet hell game, I want the enemies to spawn anywhere withing an area2d set on screen but I’m new to Godot (and gamedev as a whole )and have no clue on how to do this.
Im happy to give details if needed :slight_smile:

There are two ways I would approach it.

Way number 1
Create a spawn script that takes the area2D and checks it’s collisionShape2D child. This is what we’ll use to check what should spawn. Then depending on what the shape is (Square and Circle are the easiest), you can then either create your own function to get a random point in the rectangle, OR if it’s a more unique shape, do the same but then check if your shape is inside of your shape, perhaps by using Geomotry2D library.

Way Number 2
Create a Node2D called “Spawnpoints” and then just put a bunch of Marker2Ds in, then use the random function to get a random child of Spawnpoints and spawn to the position of the marker. Pros - Easier to set up Cons - If you move your area/areas, have to reset the markers

I would do Way Number 2, because it’s less maths.

I hope this helps!

sorry for the late reply, but i never thought of doing it the second way.
Thanks :slight_smile: