Best way of doing levels for a shoot 'em up?

BlitzPlus Forums/BlitzPlus Programming/Best way of doing levels for a shoot 'em up?

elseano(Posted 2004) [#1]
Hi
What is the best way of creating levels in a shoot em up? I was thinking about opening text files and having Blitz read them, ie.

;text file
Create_An_Enemy xposition, yposition, style_of_enemy
Wait_for_A_While 5000

I think it's fairly obvious what I mean - it would be similar to a very simple scripting language, but only for levels.
The only other way I can think of doing it is by having some sort of 'part_of_level%' variable, ie.

Global part_of_level%, level_tmr#

Function UpdateLevel()

If level_tmr#<Millisecs() then
    level_tmr#=Millisecs()+3000
Endif

Select part_of_level

Case 1
CreateEnemy(....whatever....)

Case 2
CreateEnemy(....whatever....)

Case 3
etc....

End Select

End Function




Which one of these options is better, or is there a different, even better way of doing it?
By the way, I don't want random enemy creation, so that's not a possibility...

Thanks.


ralphy(Posted 2004) [#2]
You could use the 'Data' and 'restore' commands to read your level data into a multi-dimension array with the 1st dimension of the array set to each of the levels.

Within the remaining dimension of the array you can store all the data items you want, i,e

dim level(100,5)

level(1,1) - level timer in ms
level(1,2) - nos of enemies
level(1,3) - enemy fire rate
level(1,4) - enemy attack pattern
level(1,5) - enemy health

Hope this is what you were after!


Rob Farley(Posted 2004) [#3]
I think PoundlsPoundan0 is right with regards to loading in files, hard coding stuff into your game is not good practice, also, using external files allows you to add more in the future etc.

With regards to how to store this information it totally depends on what kind of shoot em up you're talking.

If it's a scrolling game then you want to store the x,y of each of the enemies and then spawn them when they're about to come onto the screen.

If it's a space invaders type game where you're spawning things to appear then you could use a counter variable as the level progresses.

Either way, external files are the way to go for future scalability and flexibility.


elseano(Posted 2004) [#4]
Well, it's of the vertical scrolling variety. I have tried (many, many times) to get esternal files working, but they never seem to work for me :(
Can you give me just a very, very, tiny example of how I could use external files? I'm sorry to take up your time here, but I really need to make sure I'm using the right commands etc.

Thanks in advance.