Is there a way to have a random event always happen during a loop in GDevelopop?


Is there a way to have a random event always happen during a loop in GDevelop?
Is the only way to use random numbers?


I’m not sure what you’re asking. You can pick a random number. You can put it into a variable before the loop. You can create an array of random or shuffled numbers and cycle through it. You can pick random objects. Other than that, I’m not sure what you mean.

Also, please dont post duplicate posts

For example, a bird appears at different times.

You start a scene timer, than check if the timer reaches RandomInRange(minimun value, maximum value), and then spawn the bird. if you want to randomize its position, use same method.

I’m not sure what that has to do with loops. You can use a timer or the spawn behavior to spawn an object every so often. Set a variable to a random time and then check the elapsed time against the variable and then add an object and if you want to you can create a new random time and restart the timer.

But this will happen one time. I mean that the bird repeats several times in the level.
(Of course, after it is destroyed each time)

ok then, in that same event that spawns in teh bird, just add the start(or restart) timer again, same one that you started to begin with

Do you mean set a timer at the beginning of the scene and when the timer reaches spawn the bird and after the bird be destroyed set another variable to random time?

Yes, that would randomize the spawning. I don’t know where the bird is going. I’m assuming it would fly off the screen and get deleted or get left behind or destroyed by the player . Either way at some point the bird would be deleted or destroyed. I’m assuming before the timer goes off again. The spawn behavior allows you to set a rate and maximum objects at a time.