Best way to trigger next sequence
fmarkus
Member Posts: 42
Hi All,
I'm trying to spawn enemy generators in sequence without a timeline: Spawn an object that will create enemies, then when it is done, it destroy itself and the main game loop moves on to the next enemy generator. I'm trying to do so without having to put rules in the main loop like 'if next level = 2, spawn 'big enemies generator' and so on so I can keep moving them around and tune the entire sequence. Can't seem to find a way to do that. If you understood what I meant, do you have a solution?
Thanks!
I'm trying to spawn enemy generators in sequence without a timeline: Spawn an object that will create enemies, then when it is done, it destroy itself and the main game loop moves on to the next enemy generator. I'm trying to do so without having to put rules in the main loop like 'if next level = 2, spawn 'big enemies generator' and so on so I can keep moving them around and tune the entire sequence. Can't seem to find a way to do that. If you understood what I meant, do you have a solution?
Thanks!
Comments
The enemy waves will have to be identified by some sort of index number. With that said, if you want an easier way to try out different sequences, set up a series of index game level attributes and call them:
`
EnemyWave01
EnemyWave02
EnemyWave03
.
.
.
`
Then add another index game level attribute for keeping track of the current scene's current wave of enemies:
`
CurrentEnemyWave
`
In your "SceneController" actor, you have one large (and nasty because, hey, it is GS without arrays and switch/case statements) nested rule set to get the value from the correct "EnemyWaveXX" attribute based on the current value of "CurrentEnemyWave". Then in another nested rule, use the value from the rule set above to spawn the correct enemy wave generator actor that then spawns that enemy type how you like it (i.e. quantity, timing, etc.). When the current enemy wave generator senses end of its enemies (e.g. timer or enemy count attribute or?), have it increment "CurrentEnemyWave" and then destroy itself shortly (hint: timer) after incrementing.
With that mechanism, you can just then edit the wave index value of the "EnemyWaveXX" game level attributes to try out different scenarios.
Once you get the patterns down, you can then just edit the "EnemyWaveXX" values with the sequence you want in each scene's "SceneController" actor in the scene controller's "InitializeActor" rule that runs once (and if you don't have such a thing, add it based on an actor level boolean attribute).
Too bad GS currently doesn't have arrays and switch/case statements.
Edit: I just clarified it a little bit more about 10 mins after initial post.
Any idea of what that post was?
It would be great if GS supported arrays, then you could definitely have something similar to what you are thinking.
There is a post about how a bunch of actors can be an array and while technically true, you are using a bunch of actors (a complex data type) in lieu of a typical array of a simple data type. Also, you are then making each actor test to see if it is the indexed one needing to do anything. Sort of a sledgehammer approach.