Random Spawner Help

I’m very new to GDevelop. I made this simple spawner line but I don’t know how to make the Enemy1 object spawn randomly within certain coordinates.

My goal is to spawn enemy ships and asteroids outside of the purple background randomly.

Use RandomInRange(rangeMinumum, rangeMaximum) for each x & y co-ordinate.

You can do something like this


The numbers in range must fit your game resolution

Great! I’ll give these a try. Thank you for the tips

I remember there are explanations for this in the tank shooter tutorial, check it.

thanks guys for your comments! I managed to pull off the spawning but I realized that my camera and background are moving so the spawner is spawning the enemies off screen behind it after the camera moves past the coordinates.

How should I solve this issue? I tried spawning them in accordance to the players position but this only kept spawning the enemies in the same position in accordance to the player.

Alright! I figured it out. I made one coordinate spawn X amount distance from player and spawn random Y coordinates. Perfect!

1 Like