I know, third post today right? lol, But here is the problem, After learning the last 2 things I needed there was nothing else to do for this game but add new levals but before this i figured add some save and load code now before I add more stuff to it.
But. it does not work like it used to and Im confused, please help.
this code used to work fine, I belive its the saving part of the code messing up, but when i load everything loads funny and out of place.
edit: this is how my game loads with this code
edit:2 and this is how I am testing the code in a loop
if keystate(31)=1 then SaveGame():load=0
if load=0 then lgame=0
if keystate(38)=1 and load=0 then lgame=1
if lgame=1
loadGame()
load=1
endif
FUNCTION SaveGame()
if file exist(name$+".dat")=1 then delete file name$+".dat"
open to write 1,name$+".dat"
xc#=camera position x(0)
yc#=camera position y(0)
zc#=camera position z(0)
acx#=camera angle x(0)
ayc#=camera angle y(0)
azc#=camera angle z(0)
write float 1,xc#
write float 1,yc#
write float 1,zc#
write float 1,axc#
write float 1,ayc#
write float 1,azc#
for x=1 to 38
x#=object position x(x)
y#=object position y(x)
z#=object position z(x)
ax#=object angle x(x)
ay#=object angle y(x)
az#=object angle z(x)
next x
write float 1,x#
write float 1,y#
write float 1,z#
write float 1,ax#
write float 1,ay#
write float 1,az#
close file 1
CENTER TEXT 500, 160, "Save Succesfull! Press enter key to continue."
ENDFUNCTION SaveGame
FUNCTION loadGame()
open to read 1,name$+".dat"
read float 1,xc#
read float 1,yc#
read float 1,zc#
read float 1,axc#
read float 1,ayc#
read float 1,azc#
read float 1,x#
read float 1,y#
read float 1,z#
read float 1,ax#
read float 1,ay#
read float 1,az#
for x=1 to 38
position object x,x#,y#,z#
xrotate object x,ax#
yrotate object x,ay#
zrotate object x,az#
next x
position camera 0,xc#,yc#,zc#
close file 1
endfunction
my signature keeps being erased by a mod So this is my new signature.