What happened to 'Data'?... =S

BlitzMax Forums/BlitzMax Beginners Area/What happened to 'Data'?... =S

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Make a text file perhaps with this format...

4
1 50 20 3 60 70 2 90 80 2 10 30
2
1 10 50 4 60 80


The first number tells you the number of asteriods on the level. Then in the list you have the type of asteriod, and its x y. It's not very readable but it doesn't have to be.

In your game open create a level counter and asteriod counter variable. Now open the file.

The first number you encounter is the number of asteriods for the first level. So set the level counter to 1 (or 0?) and the asteriod counter to that number. The very next number you read store as the asteriod type, the next number its x and the next number its y. Then reduce the asteriod counter by 1. Loop through this until the the asteriod counter reaches 0. You've now saved the data for the first level.

Increment the level counter by 1 and set the asteriod counter to the new value. Keep going through the file until you read the end of file EOF.