Help with an enemy spawner
I am trying to make a spawner similar to something like in a Mega Man game, where when it is off screen and it hasn't spawned something yet, it creates a specified enemy, if that enemy still exists, don't spawn one.
I have that bit working, but my problem is if i destroy one enemy and its spawner is on screen, a different spawner off screen will spawn the next one in, even if it already has one spawned in, this leads to overlapping enemies and all kinds of confusion.
I know there has to be a way to give each spawned enemy an id relating to what spawner created it and to use that to make sure the right spawner creates an enemy but I can't wrap my head around it, thanks to anyone that can help
I've tried
instance_create_layer(x, y, "Instances", object, {oEnemySpawner: id})
and
if owner.id = id {oEnemySpawner.spawn = 1;}
but it still does the same thing, it might be I start from scratch and I don't mind doing that if it works, so any ideas are welcome