Yeah, it's really simple to get a ground moulding system in place. I'm not gonna give you the code because I could'nt be sure it would work as I don't have DBPro handy, but I'll explain it as best I can.
Firstly, we need to know what 2D coordinate has been clicked and has been edited. I like to standardise the mouse with complex GUI stuff, so store the mouse position:
MUSX=mousex()
MUSY=mousey()
MUSC=mouseclick()
Do this at the start of the loop.
Now, for each edit point or node of the matrix you need to ascertain it's screen location. This is straightforward, but you'll need a dummy object, just a hidden cube that you can throw about without affecting anything. You also need a global return variable for X and Y coordinates, so lets call them RETX and RETY, if your using DBC then you would have to use an array instead. Assuming object number 1000 is not taken, that can be the dummy object:
MAKE OBJECT CUBE 1000,1 : HIDE OBJECT 1000
Then, you can easily make a 3D to 2D screen converter.
FUNCTION 3D2D(x#,y#,z#)
POSITION OBJECT 1000,x#,y#,z#
RETX=screen position x(1000)
RETY=screen position y(1000)
ENDFUNCTION
So now you can quickly grab the screen coordinates of any point in space, including matrice nodes (Assuming height data is in array called MATHEIGHT# and selected node signified by SELX and SELZ):
For Z=0 to 99
For X=0 to 99
3D2D(x*100,MATHEIGHT#(X,Y),z*100)
If object in screen(1000)=1
ink rgb(255,0,0),0
If RETX-3<MUSX and RETX+3>MUSX and RETY-3<MUSY and RETY+3>MUSY
ink rgb(255,255,0),0
if MUSC=1 then SELX=X : SELZ=Z
endif
box RETX-3,RETY-3,RETX+3,RETY+3
endif
endif
Next X
Next Z
The above code can be called in the main loop or in an editing mode - it simply draws all the nodes on screen and stores the node under the mouse in SELX and SELZ if the mouse is clicked.
You'll need to adjust the height array once the mouse is dragging the heights, something like:
If MUSC=1 and SELX>-1
If clicking=0 then void=Mousemovey() : clicking=1 : `Note, this will dampen that mouse movement first
MATHEIGHT#(SELX,SELZ)=MATHEIGHT#(SELX,SELZ)+Mousemovey()
Gosub UPDATEMATRIX
Else
clicking=0
Endif
The above code should be called after the node drawing routine. The routine UPDATEMATRIX should just set the heights from MATHEIGHT# and update the matrice.
For texturing, all you really need to do is store the tile numbers in an array and affect them in the same way. I like to put the matrix texture as a sprite onto the screen but scaled down - then make a little clicking thing for selecting textures, really easy to do, just remember that if your drawing boxes or lines over a sprite, you'd have to make it translucent with the alpha setting. You could draw the nodes in the middle of the tiles easily enough, it can be quite disorienting having to texture when your not 100% which tile out of 4 your affecting.
Van-B
I laugh in the face of fate!