In the runtime game engine there is no saving to level after gameplay modification. Simply put, when you die, it clears all arrays: Level(width,height) and levelgetcard$(width,height) to zero and then reload that level again:
Level 0.dat
and refill them again as if you just started from the beginning. The whole concept of loading/saving and modifying level is for the editor itself. I just want to make a complete editor and save those levels, so it is easy for me to make more levels for the main game itself.
I am not saving sprites or images or audios in the file. I am just saving single character and 1 digit variable ranging from 0 to 9 to represent walls, items, monsters, etc.
That is all.
To go back to your statement to generate levels...I need to do two loops.
This is my 1st loop for reading from file (assuming the file is already encrypted and cannot be modified by outside the engine and it is saved using the write method you showed me):
Reserve As Work bank num, (12001+total string length+3)
Reading method:
-------------------
Load "filename", bank num
For Height=0 to 49
For Width=0 to 49
offset=Leak((Height*49+Width)*4+Start(bank num))
LEVELGETCARD$(Width, Height)=Peek$(12001+Start(bank num) + Offset)
LEVEL(Width, Height)=Peek(Start(bank num)+9604+(49*Height+Width))
Next Width
Next Height
and if I print out Level(0,0) it will spit out 2, where 2 represents yellow wall?
and if I print out LevelGetCard$(5,5) it will spout out F, where F represent the Fish card?
Am I 100% correct on this?
--------------------------------------------------------------------------------------------
When it comes to saving I do this?
For Height=0 to 49
for Width=0 to 49
Poke$(start(bank num)+offset),VarPtr(LevelGetCard$(Width,Height))+2=LEVELGETCARD$(Width,Height)+Chr$(0)
Loke Start(bank num)+(49*Height+Width)*4,offset=LEVEL(Width,Height)
offset=offset+Len(s$(Width,Height))
Next Width
Next Height
Bank Code Mix.w bank num, key <-- to save in the hard drive with a filename called level 0.dat at DH1:AMOS/Code/test/
Please tell me if I made a mistake in the code and where I made a mistake? Thanks in advance.