Spawn xx number of objects per level gdevelop 5

Hello Community,

I’m trying to make a topdown shooter, where the player resides in the center of the layout. Surrounded by attacking zombie sprites. Player moves mouse and shoots to survive.
After watching How To Make A Game with GDevelop - Levels (E09) … I changed my current_level to a global variable. but my spawn_num (variable) remains a scene variable = only because the scene never changes (is this correct?)
HOW DO I set the number of zombies to spawn per level?


currently this doesn’t work.

example: Level#1 = 10 zombies / Level#2 = 20 zombies / etc …
Any help would sure be appreciated.

try this - use Repeat. don’t forget to add the trigger once

hello @The_Gem_Dev,

Where is this Repeat?
image

click this

image

and click repeat

image

There is extension called ObjectSpawner
Which spawns whatever objects wherever you want with frequency you want and you can adjust all that via events
You can even control how many objects each spawner can spawn

For example you can set that spawner can’t spawn another object if there are already exist 5 objects spawned by that spawner

Very easy to use
So all you would need to care about now is to setting up variables
Where you simply could count how many objects you deleted to change wave

Like when you have event where you delete enemy object you add action to it to add +1 to some variable for example GlobalVariable(EnemyKillCount)

And now you prepare events with condition that if GlobalVariable(EnemyKillCount) is less than < 21
You are at wave 1
And do all your spawning logic for wave one

Then if enemy same variable is grater than > 20
but less than < 41
You are at wave 2
And so go on

Eureka! @The_Gem_Dev
That’s done the trick.

If I may ask one more think (it’s in my code snippet above)… the zombie sprites just fail to rotate towards the turret. Any ideas?

Thanks a million.
also thanks @ZeroX4 for your contribution.

try this

In addition to the recommendations already given to you, I suggest crafting an external events sheet to encompass all the unchanging level mechanics. Link this events sheet to the events within each level. This will enable you to tweak scene variables that wield influence over global events defined in the external events sheet.

:point_up_2: :point_right: Here’s an exampleof that: external events example

Thanks @erdo,

I will surely look into this :slight_smile: