• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

enemy' ID

V

Vlintex

Guest
Hi! i'm working on a game about killing lots of dudes in a building (with multiple rooms) and i'd like to make checkpoints but the space in the game is pretty open. I need to save all the player's stats (health and number of kills) and I know how to do it in an INI.file. what I don't know is how to save the position of all the ennemies in the game and save witch ones are deads and witch ones are alives. am I dreaming too big or is it possible? I'm a beginner with gamemaker and I think I'll need to work with enemy ID and things like that but I don't know how!

thanks a lot!
 
This isnt something ive done before, so there might be an easier way - but as no other replies yet I'll give a suggestion :)

Each enemy instance will have an id. If you use a controller object to create all your enemies in the room, you can save their individual ids to variables or in a data structure. Then when they die, let the controller/grid know. When it comes to saving, use the controller/grid to grab each ones x and y, then you can replicate their positions on player loading.

Ps this should probably be in programming.
 
V

Vlintex

Guest
I don't have a controller object, I placed the ennemies in every rooms. should I like create a different controler object in each room and then use your tip?
 

TheouAegis

Member
You have a couple options.

1) If the enemies are set spawns (same enemies from game to game), then you need to assign a custom "ID" to each enemy and save the life-or-death state of each ID.

2) If the enemies are randomly spawned (so no two games are alike), then you need to store the x, y, and object_index of each and every enemy.
 

johnwo

Member
Try the "persistent" option in room settings.
Might require some checking to avoid two player instances being present simultaneously etc.

Cheers!
 
Top