level files and variables
I have created a program that plays a little game and the level is stored in a file. the data in that file is extracted and seperated into an array of different varaibles. How should I declare that aray so that there is enough space for big complicated variables(more numbers to extract) and to save space when using a small level(less numbers)?
The game is here it is not all that reliable and uses a aray declared with like 500 slots or something
Game
Game Level Maker
Re: level files and variables
Quote:
Originally posted by canine
I have created a program that plays a little game and the level is stored in a file. the data in that file is extracted and seperated into an array of different varaibles. How should I declare that aray so that there is enough space for big complicated variables(more numbers to extract) and to save space when using a small level(less numbers)?
The game is here it is not all that reliable and uses a aray declared with like 500 slots or something
Game
Game Level Maker
I didn't have time to look at your game. The obvious suggestion would to be dynmically allocate your arrays. Read in the first byte to tell you how many items follow it , then allocate enough room to store it. Remember to free the memory also!!