I'm trying to work out how to implement enemy spawning and behaviors into my game.
For spawning, I want the enemy to be spawned when its spawner is on-screen and there is no instance of the enemy that corresponds with its specific spawner. When I've tried this, it ends up spawning multiple instances of the enemy if the spawner leaves the screen but the enemy is still visible, which I do not want. Basically I am trying to make spawning work like it did in the old mega man games.
For its behaviors, I want to be able to specify which instance of an enemy will be affected (since the enemy is just a copy/paste)
As an example, whenever the player is on the same y-coordinate as the enemy, the enemy speeds up. When I've tried this, it ends up affecting all of the enemies instead of just one.
With all of that said, what is the best way to go about achieving this?