Heres a example of using two 2d arrays to make a grid, a collision map and move a square around it.
i think tdk has a tutorial on the forums about arrays though.
Sync on
Sync rate 0
WinX=(640/2)/2+25
WinY=(480/2)/2+25
Set window on
Set window position WinX,WinY
Ink rgb(0,0,255),0
box 0,0,32,32
get image 1,0,0,32,32
cls
Ink rgb(255,0,0),0
box 0,0,32,32
get image 2,0,0,32,32
cls
Rem a 2d array
Rem 20 grid spaces on the each row(X)
rem 15 grid spaces in each column(Y)
Dim Col(20,15)
For X=1 to 20
Col(RND(20),RND(15))=1
next x
Rem another 2d array
Rem max of 20 grid spaces
Rem 1,0 is 1 on the x
rem 1,1 is 1 on the y
rem so 0 is x 1 is y
Dim way(20,1)
Rem Setup grid positions
for X=1 to 20
Rem set each space equal to the last space +32 (the space size)
way(X,0)=way(X-1,0)+32
way(X,1)=way(X-1,1)+32
next x
Rem Draw A grid for visual effect
DrawGrid()
Do
paste image 3,0,0
Paste image 1,way(PX,0),way(PY,0)
For Y=0 to 15
For X=0 to 20
Rem if collision X,Y then put a red box on that square
If Col(X,Y)=1
Paste image 2,way(X,0),way(Y,0)
endif
next x
next y
Rem Movement
If upkey() and PY>0 and Down=0
if Col(pX,PY-1)=0 then PY=PY-1 : down=1
endif
if downkey() and PY<15 and Down=0
if Col(PX,PY+1)=0 then PY=PY+1 : down=1
endif
If leftkey() and PX>0 and Down=0
if Col(PX-1,PY)=0 then PX=PX-1 : down=1
endif
If Rightkey() and PX<20 and Down=0
if Col(PX+1,PY)=0 then PX=PX+1 : down=1
endif
If upkey()=0 and Downkey()=0 and Leftkey()=0 and Rightkey()=0 then down=0
Sync
Cls
Loop
Function DrawGrid()
ink rgb(255,255,255),0
Rem cycle through all the spaces and draw a box around all of them
For Y=0 to 15
For X=0 to 20
Line Way(X,0),Way(Y,1),Way(X,0)+32,Way(Y,1)
Line Way(X,0),Way(Y,1),Way(X,0),Way(Y,1)+32
Line Way(X,0)+32,Way(Y,1),Way(X,0)+32,Way(Y,1)+32
Line Way(X,0),Way(Y,1)+32,Way(X,0)+32,Way(Y,1)+32
next x
next y
Get image 3,0,0,640,480
endfunction
hope that helps but i think you should look up the tdk tutorial
oh and the dbc examples arn't that great i didnt get how to use arrays till i got on the forums

but they are needed! hahaha
New Site! Check it out \/