help to make room stop restarting pls

kureoni

Member
In the game I'm developing, when you enter a room, there are monsters there, then you kill them and then you leave the room, but if you enter the room again, the room restarts and the monsters are still there, etc.

Is there any way to make the room empty forever after killing the instances of the monsters there?
 

kburkhart84

Firehammer Games
The best way is to store somewhere in global variables(or persistent objects) whether the monsters were destroyed or not. Then, each monster would check there to see if it should be alive and destroy itself right away if not. Its a complicated system but for bigger games with this requirement that is the way to go. From that point, you could even save the data to a file and reload it the next time the game is played.

There does exist the idea of making rooms persistent. It may or may not work but I understand that it is really glitchy and not a good way to go. Plus, you wouldn't be able to save that to a file later on either.
 

kureoni

Member
The best way is to store somewhere in global variables(or persistent objects) whether the monsters were destroyed or not. Then, each monster would check there to see if it should be alive and destroy itself right away if not. Its a complicated system but for bigger games with this requirement that is the way to go. From that point, you could even save the data to a file and reload it the next time the game is played.

There does exist the idea of making rooms persistent. It may or may not work but I understand that it is really glitchy and not a good way to go. Plus, you wouldn't be able to save that to a file later on either.
im kinda noob at gml etc and i have no idea how to do that LOL
 

kburkhart84

Firehammer Games
You can probably find a tutorial, its a pretty big thing to detail in a forum post. You will want to learn about things like arrays and/or data structures. You would also need to use instance creation() code so you can make each monster knows its "id" in the array or data structure or whatever you use. I suggest either finding a tutorial or reading the manual on those things. Maybe after reading the manual you will see how those things could be combined and start coming up with how to do it. After all, there isn't always a tutorial for everything so you will need to make an attempt yourself sometimes.
 
Top