im using dbpro, but i have an update matrix before the command, so shouldn't it update next time the loop goes around?
[edit] i fixed the sync rate, and the loading function. Apparently a file is created, but nothing is written to it, so when the map is loaded, it is just a blank matrix. Any help??
[another edit]
sync on
sync rate 40
input "Make map (1), or play (2)",p
sync
if p>2 then p=2
if p<1 then p=1
if p=1
gosub mapmaker
endif
if p=2
gosub playgame
endif
playgame:
if matrix exist(1)=0
make matrix 1,50,50,15,15
endif
make object box 1,5,5,7
make mesh from object 1,1
delete object 1
if file exist("C:\map.me")=1
open to read 1,"C:\map.me"
For x=1 to (15)
for z=1 to (15)
read float 1,g
set matrix height 1,x,z,g
next z
next x
endif
make object sphere 1,20
position camera 0,0,0,0
` make course
for b=2 to 4
make object box b,5,15,15
rotate object b,rnd(10),rnd(360),0
next b
for a=5 to 10
make object sphere a,15
add limb a,a,1
offset limb a,a,limb position x(a,a)+7.5,limb position y(a,a)+3,limb position z(a,a)+7.5
position object a,15,15,15
next a
do
control camera using arrowkeys 0,2,2
position object 1,camera position x(0),camera position y(0),camera position z(0)
sync
loop
return
mapmaker:
make matrix 1,50,50,15,15
tilex=1
tilez=1
`tile locater
make object sphere 1,4
`tile size
m=50/15
a=1
b=1
print "press spacekey to randomize"
print "press + and - to raise or lower land"
print "press 1 to smooth"
print "press 2 to save"
print "Press 3 to load"
print "press ctrl+9 to play the game"
position camera 5,20,5
do
point camera a,get matrix height(1, tilex, tilez),b
`tile selecting
if upkey()=1
inc tilex
`position of tile locater
a=a+m
endif
if downkey()=1
dec tilex
a=a-m
endif
if rightkey()=1
inc tilez
b=b+m
endif
if leftkey()=1
dec tilez
b=b-m
endif
if tilex>15 then tilex=15
if tilez>15 then tilez=15
if tilex<1 then tilex=1
if tilez<1 then tilez=1
if b>50 then b=50
if b<1 then b=1
if a>50 then a=50
if a<1 then a=1
`position tile locater
position object 1,a,get matrix height(1, tilex, tilez),b
if keystate(13)=1
set matrix height 1,tilex,tilez,get matrix height(1, tilex, tilez)+1
endif
if keystate(12)=1
set matrix height 1,tilex,tilez,get matrix height(1, tilex, tilez)-1
endif
if keystate(2)=1
for x=1 to ((15)-2)
for z=1 to ((15)-2)
set matrix height 1,x,z,(get matrix height(1,x-1,z)+get matrix height(1,x+1,z)+get matrix height(1,x,z-1)+get matrix height(1,x,z+1))/4
next z
next x
endif
if spacekey()=1
randomize matrix 1,50
endif
update matrix 1
if keystate(3)=1
if file exist("c:\map.me")=1
delete file "c:\map.me"
endif
if file exist("c:\map.me")=0
make file "c:\map.me"
endif
open to write 1, "C:\map.me"
for x=1 to (15)
for z=1 to (15)
g=get matrix height(1, x, z)
write float 1,g
next z
next x
close file 1
endif
if keystate (4)=1
if file exist("C:\map.me")=1
open to read 1,"C:\map.me"
For x=1 to (15)
for z=1 to (15)
read float 1,g
set matrix height 1,x,z,g
next z
next x
close file 1
endif
endif
if controlkey()=1
if keystate(10)=1
delete object 1
gosub playgame
endif
endif
sync
loop
return
The map editor still has its problems, but here is a new problem since i tried to add a choice to either play or make a map.
playgame:
if matrix exist(1)=0
make matrix 1,50,50,15,15
endif
make object box 1,5,5,7
make mesh from object 1,1
delete object 1
if file exist("C:\map.me")=1
open to read 1,"C:\map.me"
For x=1 to (15)
for z=1 to (15)
read float 1,g
set matrix height 1,x,z,g
next z
next x
endif
make object sphere 1,20
position camera 0,0,0,0
` make course
for b=2 to 4
make object box b,5,15,15
rotate object b,rnd(10),rnd(360),0
next b
for a=5 to 10
make object sphere a,15
add limb a,a,1
offset limb a,a,limb position x(a,a)+7.5,limb position y(a,a)+3,limb position z(a,a)+7.5
position object a,15,15,15
next a
do
control camera using arrowkeys 0,2,2
position object 1,camera position x(0),camera position y(0),camera position z(0)
sync
loop
return
Apparently there is a problem with the limb commands, any help?
parrot