In particular I made it so every time you save the following takes place:
- The array that holds the current level structure is bubble sorted to move all the 'deleted' items to the top
- The save routine skips over the deleted elements
- The save routine re-numbers the items as they are saved out to have a new in-order numeral (this is important because I am limiting my levels to 20,000 sprites at the moment, therefore I need to make sure there are not gaps in the order, nor a jump in numbers)
- Once saved out the current level is deleted from memory and the screen.
- The array that holds the level is zeroed out
- The save routine calls the load routine to load the freshly saved , newly ordered level into memory.

There were a few bugs , such as when I was deleting sprites manually I was not zeroing the array # that held the sprite; therefore I had 'magic' blocks that would come back all by themselves!
That was a fun one to figure out!
Also because I was bubble sorting, the zeroed out "empty' blocks were getting bubble sorted to the top of the array ( position 0,1,2,3 if there were 4 0's for example) and I had to do a function to count how many zeroes there actually were and subtract that from the total before saving.
- punchy out
No comments:
Post a Comment