Subversion Repositories forest

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 daniel-mar 1
sync on
2
hide mouse
3
 
4
`---------------
5
`create a matrix
6
`---------------
7
`the matrix will be 100 units square and be split up into 100 squares (10*10)
8
make matrix 1,100,100,10,10
9
 
10
`set the matrix heights
11
`I am going to use two for loops to do this
12
`the first loops through the xPoints, the second through the zPoints
13
for xPoint=0 to 10
14
   for zPoint=0 to 10
15
      `create a sinewave matrix
16
      `I just made the following bit up and it looked nice
17
      `you can just as easily use your own numbers/ math's to create terrain's
18
      `you could also use a loop like this to read values you have saved from
19
      `a text file created by an editor
20
      height=(sin(xPoint*36)+cos(zPoint*36))*5
21
      set matrix height 1,xPoint, zPoint, height
22
   next zPoint
23
next xPoint
24
 
25
`----------------------
26
`set the matrix texture
27
`----------------------
28
`load matrix texture
29
load image "floor1.bmp",1
30
`prepare the matrix texture
31
prepare matrix texture 1, 1, 2,2
32
 
33
`loop through matrix tiles
34
for xTile=0 to 9
35
   for zTile=0 to 9
36
      `set the matrix tile texture
37
      `the texture is a random value
38
      set matrix tile 1,xTile,zTile,rnd(3)+1
39
   next zTile
40
next xTile
41
 
42
`update the matrix after it has been changed
43
update matrix 1
44
 
45
`position the camera so that it has a good view
46
Position camera 50,50,-50
47
point camera 50,25,50
48
 
49
`main loop
50
do
51
 
52
   `update the screen
53
   sync
54
loop