gosub setup gosub images gosub fog gosub matrix gosub lights gosub sun gosub camera gosub sky Peak(1) mpy#=-60 ink rgb(255,255,255),0 set text size 25 position matrix 1,50,mpy#,-160 position object 11,0,45,0 for t=0 to 255 step 2 ink rgb(t,t,t),0 ` inc scroll#,.000003 for f = 1 to 5 scroll object texture f+10,scroll#*f,scroll#*rnd(f) next f text 0,0,"Once upon a time, this country was a happy, bright place." sync next t for t=255 to 0 step -2 ink rgb(t,t,t),0 ` inc scroll#,.000003 for f = 1 to 5 scroll object texture f+10,scroll#*f,scroll#*rnd(f) next f text 0,0,"Once upon a time, this country was a happy, bright place." sync next t for t=0 to 255 step 2 ink rgb(t,t,t),0 ` inc scroll#,.000003 for f = 1 to 5 scroll object texture f+10,scroll#*f,scroll#*rnd(f) next f text 0,0,"Then one day, a mighty mountain rose up and blocked out the sun." sync next t for t=255 to 0 step -2 ink rgb(t,t,t),0 ` inc scroll#,.000003 for f = 1 to 5 scroll object texture f+10,scroll#*f,scroll#*rnd(f) next f text 0,0,"Then one day, a mighty mountain rose up and blocked out the sun." sync next t gp#=45 for t=0 to 120 inc scroll#,.000003 for f = 1 to 5 scroll object texture f+10,scroll#*f,scroll#*rnd(f) next f inc mpy#,0.5 position matrix 1,50,mpy#,-160 gm=255 set gamma gm,gm,gm dec gm,1 position object 11,0,gp#,0 dec gp#,0.3 sync next t end `-------------------- ` Functions `-------------------- FUNCTION Peak(m) For z = 0 to 20 For x = 0 to 20 diff#=ABS(10-x)+ABS(10-z) h#=(100-(diff#*6))-rnd(diff#^1.5) if h#<0 then h#=0 set matrix height m,x,z,h# if x=0 or z=0 or x=20 or z=20 then set matrix height m,x,z,0 Next x Next z Normalise(m) Update Matrix m ENDFUNCTION `---- `By Lee Bamber From DB Example - Adds shaded areas to matrix to give depth Function Normalise(MatNum) For z=1 to 20 For x=1 to 20 h8#=get matrix height(MatNum,x,z-1)*5 h4#=get matrix height(MatNum,x-1,z)*5 h#=get matrix height(MatNum,x,z)*5 h2#=get matrix height(MatNum,x,z)*5 x1#=(x-1)*25.0 y1#=h# x2#=(x+0)*25.0 y2#=h4# dx#=x2#-x1# dy#=y2#-y1# ax#=atanfull(dx#,dy#) ax#=wrapvalue(90-ax#) z1#=(z-1)*25.0 y1#=h2# z2#=(z+0)*25.0 y2#=h8# dz#=z2#-z1# dy#=y2#-y1# az#=atanfull(dz#,dy#) az#=wrapvalue(90-az#) nx#=sin(ax#) ny#=cos(ax#) nz#=sin(az#) Set matrix normal MatNum,x,z,nx#,ny#,nz# next x next z Update Matrix MatNum EndFunction `-------------------- ` Gosubs `-------------------- Setup: set display mode 1024,768,32 randomize timer() hide mouse sync on sync rate 30 autocam off Return `---- Matrix: make matrix 1,100,100,20,20 set matrix wireframe off 1 prepare matrix texture 1,1,20,20 for z = 0 to 19 for x = 0 to 19 set matrix tile 1,x,z,x+(z*20) next x next z Return `---- Lights: color ambient light 0 set ambient light 20 make light 1 set directional light 0,0,0,1 set directional light 1,1,-.5,1 color backdrop rgb(0,100,255) Return `---- Sun: for s = 10 to 25 make object sphere 10+s,s*3 color object 10+s,rgb(255,180,50) ghost object on 10+s position object 10+s,-210,80,200 next s `---- Camera: position camera 200,70,-200 point camera -20,60,50 set camera fov 0.8 Return `---- Images: `mountain image ink RGB(200,200,180),rgb(40,40,45) cls for n = 1 to 200 x=rnd(256):y=rnd(256) line x,y,x+rnd(64),y+rnd(64) next n get image 1,0,0,256,256 `clouds image cls rgb(255,255,255) for n = 1 to 1000 x=rnd(255) ink rgb(x,x,x),0 dot rnd(63),rnd(63) next n get image 3,0,0,64,64 `groundimage cls rgb(0,100,0) ink rgb(0,50,0),0 for t=0 to 1000 dot rnd(100),rnd(100) next t get image 2,0,0,100,100 Return `---- Sky: color backdrop 0 Return `---- Fog: for f = 1 to 6 make object plain 10+f,1000,1000 texture object 10+f,3 xrotate object 10+f,90 fix object pivot 10+f yrotate object 10+f,45 if f>1 then ghost object on 10+f,30 position object 10+f,50,10+(5*f),50 next f texture object 11,2 Return