Here is some code I threw together to test this:
Rem Project: Dark Basic Pro Project
Rem Created: Sunday, February 06, 2011
Rem ***** Main Source File *****
sync on : sync rate 60
size = 500 : hills = 10 : hillheight = 100
load image "grassand2.jpg",2
make matrix 1,size,size,hills,hills
prepare matrix texture 1,2,2,2
FILL MATRIX 1,1,1
randomize matrix 1,hillheight
position matrix 1,0,0,0
update matrix 1
repeat
control camera using arrowkeys 0,3,2
sync
x# = camera position x() : z# = camera position z()
y# = get ground height(1,x#,z#) + 10.0
position camera x#,y#,z#
if spacekey() = 1 then gosub Refill
sync
UNTIL mouseclick() > 0
delete matrix 1
delete image 2
end
Refill:
for z = 0 to 9
for x = 0 to 9
set matrix tile 1,x,z,rnd(3) + 1
next x
NEXT z
update matrix 1
return
It tiles it with the green one at first. If you press the SPACEBAR, it randomly tiles it with the four images (a revised pic is attached - I colored in the black sections with red and blue).