Spawning system

For my rougelike, I have made a system for spawning. When the player would trigger the ‘wave’ block, it will send a message to the spawners to spawn zombies, and invisible doors that stop the player from escaping. Then, depending on the name of the wave block (1-3), a different system would start. The system got the total number of zombies spawned in the room, and when a zombie would be killed, a message would be sent to the system and subtract from the total of zombies. When the total number of zombies would be reduced to 0, the program would end, and the walls will dissapear so the player can move on. I have done this with 2 rooms without error, but things went wrong with the third room and I can’t seem to figure out why.

Game: Flowlab Game Creator - Rougelike 


I’m having a hard time understanding exactly what’s wrong and where since the rooms seem to be based on a grid layout and there’s not a “room #1, room #2” etc. I would recommend to have the code open while playing the game as this allows you to debug easier.


I don’t know how to make a “room #1” so I just did things the way I knew. After relentless searching, I have found the root of the problem.

The ‘wave’ variable turns into -1 before it’s supposed to, and the only code that turns wave to -1 isn’t activated. This is mind-bending and perplexing.

Basically, the game starts with wave value 0, where nothing is spawned. Then It is set to 1 when colliding with the wave blocks. Now the enemies spawn, and the invisible door become visible. After all enemies (in the room) are killed, it sets wave to -1. After teleporting to another room, the wave value is set to 0, and we are back to the start. That is, in theory. Thing are not working that way right now.

There is only one of these controllers, correct? Multiple of an object can make code viewing difficult.

… there is more than one controller…

There is only 1 way to turn wave to -1, and that code isn’t activated when it randomly turns to 0.

1 Like