Matrix is a reserved keyword and even though matrix# is different, in that it is a float, I would suggest using a different variable name. Do you really need a dimensioned array that requires float precision?
Next, you listed makeranplatforms: as a label, which is typically done with subroutines. If you are jumping to a subroutine and then call a function, it is going to mess up, because you have no RETURN command for the subroutine.
This code:
for x = 1 to maxnum
for y = 1 to maxnum
next y
next x
does nothing at all. What is your intent here? I take it you want to create seven boxes, but maybe you want to create 49 boxes.
You really need to give object numbers for the boxes you want to create. Since it was not listed, I added it to the function/call.
Anyway, I wrote some code that creates 7 boxes and makes a small stack out of them. Take a look and see if this is anything close to what you are interested in.
Rem Project: Dark Basic Pro Project
Rem Created: Monday, April 30, 2012
Rem ***** Main Source File *****
sync on : sync rate 60
// earlier in the code list this
maxnum = 7
// I don't know what the matrix# array is for, so I didn't do anything with it
// call the MakeRanPlatforms subroutine
gosub MakeRanPlatforms : // makes seven boxes
repeat
// move the camera using the arrow keys
control camera using arrowkeys 0,2.0,1.5
sync
until mouseclick() > 0
end
MakeRanPlatforms:
// some variables will stay the same
sizeX# = 5.0 : sizeY# = 3.0 : sizeZ# = 8.5 : z# = 100.0 : ry# = 0.0 : scale# = 150.0 : ObjNum = 100
// we store the x# and y# values in data statements - set the pointer to the start
restore BoxData
for x = 1 to maxnum
// read in the data
read x#, y#
// call the function to create each box
CreateBox(ObjNum,sizeX#,sizeY#,sizeZ#,x#,y#,z#,ry#,scale#)
// we need to increment the object number, so we don't try and create the same object
inc ObjNum
//
next x
// set the camera's initial position to point at the boxes
position camera 70.0,65.0,0.0
point camera 70.0,49.5,100.0
return
BoxData:
// x# and y# coordinates for the boxes
data 52.0,45.0,60.0,45.0,70.0,45.0,80.0,45.0
// next row up
data 65.0,49.5,75.0,49.5
// top box
data 70.0,54.0
Function CreateBox(ObjNum,sizeX#,sizeY#,sizeZ#,x#,y#,z#,ry#,scale#)
make object box ObjNum,sizeX#, sizeY#, sizeZ#
position object ObjNum,x#,y#,z#
scale object ObjNum,scale#,scale#,scale#
endfunction
So many games to code.......so little time.