A guide to enemy waves!

greetings! I have recently decided to help the forums via guides, in which you probably can tell sense your read the title.

in this guide, I will be telling you how to make an enemy wave system, based off a system i used in my most recent game.

the first thing you need to do is make a function. this function will be used to help spawn each new wave of enemies.

the second step is understanding what the system we will be making needs.
good wave systems have a few important things in them. one is controlling the difficulty of the waves. I did that by using a point system. the point system, works by having a certain amount of points to spend. by doing this, we can control how difficult the waves are by lowering or adding points for the system to spend. however, we cant do this directly, sense if we make the points the system spends the same as the amount of points we want the system to use, then the system would forget how difficult the last wave was each time.

so, we use two variables. the first is added points, or wave extra in this case. this is the added points the system can use, and can be added to in addition to the base amount of points the system can spend. however, in this case, the points extra is but simply, the amount spendable.
we then add the points we are spending, and set that to the added points, or add the added points with a base number.


now that we have the amount the system can spend, we need to actually spend this total.

to do this, we need to repeat a spending function until this total is 0.
we start by setting up thew loop, through a block like this.


we then need to set the enemies we want to be able to spawn.

but this doesn’t end the loop, so we need to spend points based off what the system is spawning. for this example, 1 point.

now this is great, but we don’t want a 2-point enemy to spawn when we don’t have 2 points to spend, so we add a check like this.


finally, we need be able to detect when we have defeated the wave. for that, we need to add a third variable. this variable is how we can track if we have killed all the enemies from the wave. we do this by first setting the third variable to the difficulty.

we then can have a on game update check, so we know if this variable has been turned to 0.

when this become true, we set the enemies killed to 0, to avoid repeat commands.

we then can have every enemy we kill add that enemies point cost to the enemies killed variable.

by doing this, we can now spawn enemy waves, and detect when the enemy wave has been defeated.

I hope this guide has helped you!

4 Likes

No way community made guides in makecode we need more like this!!!

2 Likes

don’t worry, I plan to make more! and or I hope me doing this will inspire others to do the same, in order to help remove a portion of the “how do you do this” topics.

1 Like

I have a way for if you want to spawn set amounts of enemies


this is how

A classic method! I’ve used that many times myself, and I’m glad you added it! While it is more limited, usually only good for a level, it is simpler and still good to know!

1 Like