Luke Pierson
Member
hey all! In my game, enemies will respawn if you use a checkpoint.
Otherwise, enemies stay dead.
Initially, I was using persistent rooms, but decided to go another route because I like to have control over the things happening within my game.
Anyways, I decided to create a DS_list which contains a value unique to each enemy (I'm numbering each enemy in their create code starting with 0 and going up)
And when you use a checkpoint, the list is cleared and the enemies exit their death state and go back to being alive. Works great.
So when I load a room, each enemy runs a line of code using ds_list_find_index to see if their enemy number is in the list. If it is, they enter their death state upon loading the room. Otherwise, they remain alive.
This is done by creating a variable that = the return value of ds_list_find_index(death_list, enemy_num), which means the be enemy running the code is searching the list for their specific number
And then checking if that variable = the enemy_num of the enemy running the code
The problem is that it seems I have to kill them in order of their enemy number to make them stay dead.
It seems that ds_list_find_index finds the value AND position?
I don't want to find the position in the list, only the value. Because I don't want it to matter what order the player kills the enemies. How can I do this?
Otherwise, enemies stay dead.
Initially, I was using persistent rooms, but decided to go another route because I like to have control over the things happening within my game.
Anyways, I decided to create a DS_list which contains a value unique to each enemy (I'm numbering each enemy in their create code starting with 0 and going up)
And when you use a checkpoint, the list is cleared and the enemies exit their death state and go back to being alive. Works great.
So when I load a room, each enemy runs a line of code using ds_list_find_index to see if their enemy number is in the list. If it is, they enter their death state upon loading the room. Otherwise, they remain alive.
This is done by creating a variable that = the return value of ds_list_find_index(death_list, enemy_num), which means the be enemy running the code is searching the list for their specific number
And then checking if that variable = the enemy_num of the enemy running the code
The problem is that it seems I have to kill them in order of their enemy number to make them stay dead.
It seems that ds_list_find_index finds the value AND position?
I don't want to find the position in the list, only the value. Because I don't want it to matter what order the player kills the enemies. How can I do this?