Your scripting approach is very good. It's a very simple to parse and simple to write format.
One idea....
The way vertical shooters (or I guess in your case, horizontal shooters) often work is they have enemies approach in "waves". A wave can be defined by a few things:
1) A placement position
2) An enemy type
3) Time between each enemy's appearance
4) Number of enemies.
Then instead of defining your levels in terms of individual enemy spawns, you could define them in waves:
1 2 3
|
enemy_type num_of_enemies Y_pos time_between_enemies
'wait' time_to_wait
enemy_type etc etc etc (next wave)
|
This makes it easier to design levels, but is a bit trickier to implement because you now have to keep track of individual waves. There's also the possibility of multiple waves happening at once, (ie, a 2nd or 3rd wave starts while the 1st one is still spawning enemies).
cause i found out that random generated levels are very bad and boring if you dont make an algoritm that is way over my knowledge. |
Randomly generating levels is a HUGE plus. It adds so much to the replay value of a game!
With the above "waves" approach, it isn't very hard to do, either. I would approach it something like this:
1) keep track of how many waves have passed to get an idea of how far along in the game the player has gotten.
2) randomly generate a wave (randomly choose enemy type, Y position, time between spawns, etc)
3) wait for a randomly chosen time.
4) repeat from #2
To make it reasonable, you have to give constraints. For example... when generating the time between individual enemy spawns for a wave, you will want to say it has to be between 15 and 25 frames... or something to that effect.
And when determining the time between waves, you'll want to say it has to be between 100-150 frames, or something. Play around with the numbers until you get it to feel right.
Now to keep the game challenging... you'll want it to get more difficult as time goes on. This is where #1 above comes in.
You'll want the number of waves to give 'bias' to your random numbers. Really, this just means changing the restraints.
For example... if the player has cleared 0-5 waves... you can use restraints like...
- 15-25 frames between individual enemy spawnings
- 3-6 enemies per wave
- 100-150 frames between waves
Once the player gets to 6-10 waves... make the restraints different... like....
- 10-15 frames between individual spawnings
- 5-8 enemies per wave
- 75-100 frames between waves
I'm betting the "time between waves" restraint is really going to be what makes the game difficult. When that number gets really low, the player is just going to get hammered with endless streams of enemies.
To prevent an impossible situation, you might want to give the player the occasional "breather". This is common in many games in this genre. Like say... every 20 or so waves... don't spawn any more waves until all on-screen enemies are gone. This gives the player a chance to catch up.
You might also want to add bias for certain enemy types based on how many waves have passed. For example, you might want to have some easier enemy types more frequent in the first few waves... and introduce harder enemy types later. All that can be done by altering the restraints based on waves passed.