How to make a wave system?

Hello everyone (who is reading this),

I am currently working on a top down shooter, and am trying to make a wave system. I have looked around, and have not found any games quite like mine.

I would like to randomly generate 10 enemy triangles (E - triangles) in a random position that is off the player screen (if possible), for my first wave.

Then I would like there to be 5 more triangles for the next wave, and so on.

Could someone help me by providing sample code (preferable), just tell me what to do, or provide me with a game with spawn mechanics similar to my plan.

Now that I’m on the topic, could someone explain why I can’t pass the original game screen border?

Kindest regards,

1 Like

I’m on mobile rn so I can’t really show you, but I can at least help with the camera.
Click on the Camera behavior, when you do you should see 4 sets of numbers. You can adjust these numbers to expand the screen Up, Down Left, or Right.

1 Like

I recommend not using another sprite for the cursor because its quite easy to make the game bug and quite hard to find out where the actual cursor is.

There is a behavior that outputs the X,Y of the cursor? The only reason it would “bug” is if you have a MouseClick inside of it or the sprite is too large.

1 Like

If one moves the player without moving the mouse the player can aim in a different direction than the object and when they put the cursor back onto the game screen, then the object is not directly on top of the cursor.

It sounds like “Use Game Coordinates” isn’t selected (inside the MouseMove behavior).
However, you can keep it to Screen Coordinates and get the camera X,Y output then use that to offset the cursor. This will fix the mouse to the proper spot if the camera moves while the cursor isn’t moving.

1 Like

It is. The mouse isn’t always in the same place as the object.

Cursor issue is because of this

If “Screen Coordinates” are selected you’ll need to offset it with the Camera output.

Similar issue

1 Like

I’m still on mobile, but I’ll try my best to explain a Wave System

  1. Create a Global called “Total Enemies” (or whatever else you want)

  2. Create a “Spawner” object, this object will spawn the enemies.

  3. Each time an enemy is spawned, -1 from Total Enemies. When it reaches 0, stop spawning.

  4. Whenever an enemy dies, send a message to the Wave System object (whatever you have it was).

  5. When the Message is received, +1 to number starting at 0. When that number equals Total Enemies, the wave is over.

  6. Reset the number the Message added to back to 0.
    Add 5 to the Total Enemies Global

I prefer using a Spawner object than a random position because it’s more controlled.

To choose a random one, you can assign each of the spawners their own number, then send a message to all the spawners.
If the number is equal to the assigned value, spawn enemy (unless Total Enemies is = 0)

1 Like

Thank you, I will use this, but, in the future waves, I will have 30 - 50 enemies, it would take a lot of spawn block to place them. That would take quite a while, and I don’t want all the enemies to spawn in one place, aka using the repeater. Is there anything I can do to fix this?

I will mark you message as a solution in around 8 hours, when I test it out.

Overall, Thank you

So should I scrap the custom cursor, or just turn mouse move to the game coordinates?

Also, sometimes having the target not on the cursor gives the illusion the the bullets are missing the target, when in fact, they are not.

I was think of placing the object in multiple different places, not in a single spot.
Let’s say you had 10 different spawning locations, each one would on average spawn 5 enemies (if you wanted 50 total).
If you need more clarification on this I can send a screenshot later when I’m by a computer

1 Like

Thank you, I would love to see a screen shot later.


I am also struggling a bit with spawning. When the wave starts, the global wave increases to one, which send a message to the spawner. Then it goes into a repeater, which tells the spawner to spawn an enemy on 0,0. Finally it goes into a timer set to 1.

For some reason, I it only spawns 1 enemy.

1 Like

Maybe take a look at Ewarks. It has incredible wave systems.

So I was just going to give you screenshots, but I figured that an example game would be better

1 Like