Editors are always a good idea, irrelevant of how hard they could be, the game is practically wrote just with the editor itself as most functions you simply paste across! I will try your way markus.. i am just a bit peeved that you get a choice of fixed or automatic but the former has a problem...I simply am dleteing all sprites and remaking them on load, i dont get hopw the values in the array could be wrong when the loading heavily relies on them being right and they do indeed load correctly in the correct place with the correct image!
the reset routine is this:
function clear_level
deleteallsprites()
createsprite(pointer,cursorimage)
createsprite(currentbrick,brickimage)
setspritesize(currentbrick,6,4)
setspriteposition(currentbrick,25,90)
mx# = getpointerx()
my# = getpointery()
setspriteposition(pointer,mx#,my#)
setspritesize(pointer,swidth,sheight)
createsprite(backpanelsprite,backpanelimage)
setspriteposition (backpanelsprite,60,0)
setspritesize(backpanelsprite,40,200)
brickcount = 0
mode = 0
usedel = 0
for p=1 to bricklimit
brick[p].xloc = 0
brick[p].yloc = 0
brick[p].imagenum = 0
brick[p].spritenumber = 0
deletedbricks[p] = 0
next p
print ("cleared")
sync()
endfunction
the load function this:
function load_level()
myfile = OpenToread("Test2.dat")
`brickcount = readinteger (myfile)
for n = 1 to bricklimit
xl = readinteger (myfile)
yl = readinteger (myfile)
im = readinteger (myfile)
sn= readinteger (myfile)
brick[n].xloc = xl
brick[n].yloc = yl
brick[n].imagenum = im
brick[n].spritenumber = sn
if brick[n].spritenumber <> 0
inc brickcount
createsprite (brickcount,brick[n].imagenum)
SetSpriteGroup ( brickcount,2)
setspritesize(brickcount,swidth,sheight)
setspriteposition(brickcount,brick[n].xloc,brick[n].yloc)
endif
next n
closefile (myfile)
print("loaded!!")
sync()
endfunction
and the save:
function save_level()
myfile = OpenToWrite("Test2.dat", 0)
`writeinteger (myfile,brickcount)
for n = 1 to bricklimit
writeinteger (myfile,brick[n].xloc)
writeinteger (myfile,brick[n].yloc)
writeinteger (myfile,brick[n].imagenum)
writeinteger (myfile,brick[n].spritenumber)
next n
closefile (myfile)
print ("saved !!")
endfunction
on the user pressing the load button it calls the clear_level() function then calls the load_level_function, save button simply calls the save_level()
So to me it shouldnt have a problem..yet it has!!
anyhow thanks for the help
Hail to the king, baby!