Hey, so I’ve actually finished this whole section, but this seemed the best place to put this. Once I’ve got this working I think I’ll be done! So I want to put in a second enemy type. I want keep things simple and get it to spawn when I kill the first enemy type, and vice versa. So I created another enemy prefab and attached it to my EnemySpawner script. For best context here’s the script:
I went back through the relevant lectures and put in the code needed for the second enemy type. In the game it spawns and behaves exactly as expected. The only problem is getting the first and second enemy types to spawn after each other. The bit to focus on is the AllDead method. Not even sure if this is the best way to do it but it seems the most logical to me! Anyway, what happens is the first enemy type spawns… first, then when they’re destroyed the second enemy type spawns, but from then on, when they’re destroyed, it’s only the second enemy type that spawns and the first doesn’t spawn anymore.
Also, as you can see, I put an “Invoke” in an attempt to get it to repeat. The problem here is that I get a CS1501 error that says: “No overload for method ‘Invoke’ takes ‘1’ arguments”. I would of course like help with that as well but first I want to get the spawn order fixed.
Hope that all makes sense!