Random Spawner Help


#1

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.


#2

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


#3

You can do something like this


The numbers in range must fit your game resolution


#4

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


#5

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


#6

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.


#7

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