Here is a very basic example. The idea is to just store the map layout in data statements and 'read' them number by number. Here I am creating a cube wherever there is a '1'. Great for pacman type games. All that is needed for extra levels is a new set of data statements and some minor code changes rather than lots of manual object positioning.
sync on : sync rate 0 : autocam off
lev=1
size=10
gosub createlevel
position camera size*3,size*3,-50
point camera size*3,0,size*3
do
set cursor 0,0
print "Press '1' for level 1"
print "Press '2' for level 2"
if keystate(2)=1
gosub deletelevel
lev=1
gosub createlevel
endif
if keystate(3)=1
gosub deletelevel
lev=2
gosub createlevel
endif
sync
loop
deletelevel:
for f=1 to obj
if object exist(f)=1 then delete object f
next f
return
createlevel:
select lev
case 1 : restore level1 : endcase
case 2 : restore level2 : endcase
endselect
obj=0
for f=0 to 5
for g=0 to 5
read v
if v=1
inc obj
make object cube obj,size
x#=g*size
y#=0
z#=(5-f)*size
position object obj,x#,y#,z#
endif
next g
next f
return
level1:
data 1,1,1,1,1,1
data 1,0,0,0,0,1
data 1,0,1,1,0,1
data 1,0,1,1,0,1
data 1,0,0,0,0,1
data 1,1,1,1,1,1
level2:
data 0,1,0,1,0,1
data 1,0,1,0,1,0
data 0,1,0,1,0,1
data 1,0,1,0,1,0
data 0,1,0,1,0,1
data 1,0,1,0,1,0
Boo!