ok hello i have this very weird problem in my towerdefence game:
i have two UDT arrays, one stores the locations and states of the nodes that make up the map ( x/y/walls/...) and another that contains the data of the towers (x/y/angle/damage/...) then i use this piece of code :
input "MAP NAME : ",mapname$
set dir "maps/"
make directory mapname$
set dir mapname$
open datafile to write 1,mapname$+".map"
save array to datafile n(),1
close datafile 1
open datafile to write 1,mapname$+".tow"
save array to datafile t(),1
close datafile 1
open datafile to write 1,"HQlocation.loc"
write datafile float 1,node_targetx
write datafile float 1,node_targety
close datafile 1
end
to save the two arrays n() and t() into the files map1.map and map1.tow and i also store the HQlocation in Hqlocation.loc
all of this works fine i have a directory map1 and the correct files that seem to have correct sizes are in it.
but then i use this code :
dir$ = expand path$("")
set dir "maps/map1"
open datafile to read 1,"map1.map"
load array from datafile n(),1
close datafile 1
open datafile to read 1,"map1.tow"
load array from datafile t(),1
close datafile 1
if file exist("HQlocation.loc")
open datafile to read 1,"HQlocation.loc"
node_targetx = datafile float(1)
node_targety = datafile float(1)
close datafile 1
endif
load image "zombiemap.jpg",1
set dir dir$
to load the arrays, HQ location and background image.
everything works fine except the array t() which doesnt seem to load at all??
the arrays are declared like this ( prior to loading )
node_xcount = w/node_dist : node_ycount = h/node_dist
global dim n(node_xcount,node_ycount) as UDTnode
tower_max = 1000
global dim t(tower_max) as UDTdeffender
gosub _loadmap:
the gosub _loadmap: contains the loadings
the UDTs cant be important? neither contain anything really weird.
the result i get with this is that only the n() array seems to have loaded correctly??