Sync On: Sync Rate 60:AutoCam Off Color Backdrop RGB(50,50,180) Set Camera Range .02,15000 Fog Distance 4000,8000 Fog Color Rgb(50,50,180) Fog On Null=Make Vector3(1) Null=MAke Vector3(2) #Constant _Gravity .02 #Constant _Lift .02 #Constant _Friction .98 Make_Angle_Indicator() Cls Make_Plane() Create_Heightmap(20,20) Grass() Make_Terrain() Place_Houses() Sync Position Camera 100,100,100 x#=Camera Position X() z#=Camera Position Z() y#=Get Terrain Ground Height(1,x#,z#)+.5 Position Camera x#,y#,z# Turn Camera Right 45 Do Control_Plane() Draw_Altitude() Position_Instruments() Set Cursor 0,0 Print Screen FPS() Print "Speed: ";Int(Speed(0)*15.0) Print "Altitude: ";Int(Height(0)) Fog Distance 4000,8000 Fog Color Rgb(50,50,180) Sync Loop Function Control_Plane() Dim Speed(0) as Float Dim Thrust(0) as Float Dim Height(0) as Float Dim Lift(0) Dim OnGroundFlag(0) Set Vector3 1,Camera Position X(),Camera Position Y(),Camera Position Z() Thrust(0)=Thrust(0)+(UpKey()-DownKey())*.0001 If Thrust(0)>.1 Then Thrust(0)=.1 If Thrust(0)<0 Then Thrust(0)=0 Pitch Camera Up .1*(KeyState(31)-KeyState(17)) Roll Camera Left .1*(KeyState(30)-KeyState(32)) Turn Camera Left .05*(LeftKey()-RightKey()) Move Camera Thrust(0) Lift(0)=Speed(0)*_Lift Pitch Camera Up 90 Move Camera Lift(0) Pitch Camera Down 90 x#=Camera Position X() z#=Camera Position Z() ground#=Get Terrain Ground Height(1,x#,z#)+.5 Height(0)=Camera Position Y()-_Gravity x#=x#+X Vector3(2):Height(0)=Height(0)+Y Vector3(2):z#=z#+Z Vector3(2) If Height(0)<ground# Height(0)=ground# `If Y Vector3(2)<-.1 and OnGroundFlag(0)=0 Then Crash() OnGroundFlag(0)=1 Else OnGroundFlag(0)=0 Endif Position Camera x#,Height(0),z# Set Vector3 2,x#-X Vector3(1),Height(0)-Y Vector3(1),z#-Z Vector3(1) Multiply Vector3 2,_Friction Speed(0)=Length Vector3(2) EndFunction Function Crash() Get Image 555,0,0,Screen Width(),Screen Height() Sprite 555,-2000,0,555 Set Sprite Diffuse 555,255,0,0 Set Sprite Alpha 555,80 Paste Sprite 555,0,0 Size Sprite 555,Sprite Width(555)-4,Sprite Height(555)-4 Paste Sprite 555,2,2 Size Sprite 555,Sprite Width(555)-8,Sprite Height(555)-8 Paste Sprite 555,6,6 Size Sprite 555,Sprite Width(555)-16,Sprite Height(555)-16 Paste Sprite 555,12,14 Sync Do Loop Endfunction Function Draw_Altitude() y1#=Get Terrain Ground Height(1,Camera Position X(),Camera Position Z()) y2#=Height(0) d#=y2#-y1# Ink RGB(255,0,0),0 y=Screen Height()-5 Line 0,y,20,y Ink RGB(255,0,0),0 If d#>100 Ink RGB(255,255,0),0 d#=d#/10 Endif If d#>100 Ink RGB(255,255,255),0 d#=d#/10 Endif y=y-(d#/2) Line 0,y,20,y Ink RGB(255,255,255),0 Endfunction Function Make_Terrain() `If Not File Exist("Temp_Terrain.dbo") File$="Heightmap.bmp" Load Image File$,101,1 Make Object Terrain 1 Set Terrain Heightmap 1,File$ Set Terrain Texture 1,4,4 Set Terrain Tiling 1,4 Set Terrain Scale 1,1000,100,1000 Set Terrain Split 1,16 Build Terrain 1 Set Object Fog 1,1 Set OBject Light 1,0 `Save Terrain "Temp_Terrain.dbo",1 `EndIf Endfunction Function Place_Houses() tx=Object Size X(1) tz=Object Size Z(1) Make Object Box 1000,2,4,2 For i = 1 to 3000 Instance Object 1000+i,1000 x#=Rnd(tx):z#=Rnd(tz) y#=Get Terrain Ground Height(1,x#,z#)+1.0 Position Object 1000+i,x#,y#,z# Next i Endfunction Function Make_Angle_Indicator() Ink RGB(255,255,0),0 Box 0,0,7,7 Ink RGB(0,0,255),0 Box 8,0,16,7 Ink RGB(255,0,0),0 Box 0,8,16,16 Ink 0,0 Line 0,0,0,16 Line 4,0,4,16 Line 8,0,8,16 Line 12,0,12,16 Get Image 99,0,0,16,16,1 Make Object Sphere 99,.25,20,20 Texture Object 99,99 Set Object Light 99,0 Disable Object ZDepth 99 Ink RGB(255,255,255),0 EndFunction Function Make_Plane() Ink RGB(64,64,64),0 Box 0,0,64,64 Get Image 98,0,0,64,64,1 Ink RGB(255,255,255),0 Make Object Cylinder 98,9 Scale Object 98,100,30,100 Set Object Cull 98,0 `Set Object Light 98,0 Texture Object 98,98 Color Object 98,RGB(32,32,32) Disable Object ZDepth 98 Make Object Cylinder 97,9 Scale Object 97,100,30,100 Set Object Cull 97,0 `Set Object Light 97,0 Texture Object 97,98 Color Object 97,RGB(32,32,32) Disable Object ZDepth 97 Endfunction Function Position_Instruments() Align_Object_With_Camera(99) Move Object 99,3 Move Object Down 99,1.6 Move Object Right 99,2 Rotate Object 99,0,0,0 Align_Object_With_Camera(98) Move Object Down 98,2.5 Pitch Object Down 98,10 Align_Object_With_Camera(97) Move Object Up 97,3 Endfunction Function Align_Object_With_Camera(ObjID) Position Object ObjID,Camera Position X(),Camera Position Y(),Camera Position Z() Rotate Object ObjID,Camera Angle X(),Camera Angle Y(),Camera Angle Z() EndFunction Function Splotch(ImageID,h,s) Set Cursor 500,0 Print s `Lock Pixels Ink 0,0 Box 200,200,230+s,230+s c=rnd(7)+h-3 Ink Rgb(c,c,c),0 r=rnd(s/2)+s/4 For i# = 0.0 to 360.0 step 2 x=sin(i#)*r+215+s/2 y=cos(i#)*r+215+s/2 line 207+s/2,207+s/2,x,y r=r+(rnd(2)-1) if r>s+15 then r=s+15 m=s-15:If m<2 then m=2 if r<m then r=m Next i# `Unlock Pixels Get Image ImageID,200,200,230+s,230+s,1 Endfunction Function Create_Heightmap(x,y) Ink rgb(128,128,128),0 Box 0,0,199,199 For ny=0 to 5 For nx=0 to 5 Randomize Timer() TileHeight=10+rnd(6)+rnd(6)+rnd(6) ox=32+(nx*32):oy=32+(ny*32) mx=32+((nx+1)*32):my=32+((ny+1)*32) Splotch(1,TileHeight,34) Sprite 1,200,200,1 Size Sprite 1,84,84 Set Sprite 1,0,1 Set Sprite Alpha 1,100 Paste Sprite 1,ox+rnd(32)-26,oy+rnd(32)-26 Size Sprite 1,64,64 Paste Sprite 1,ox+rnd(32)-16,oy+rnd(32)-16 Box ox,oy,mx,my Next nx Next ny For ny=0 to 5 For nx=0 to 5 Randomize Timer() ox=32+(nx*32):oy=32+(ny*32) For i = 1 to rnd(3)+2 sx=ox+rnd(32)-16:sy=oy+rnd(32)-16 h=point(sx,sy)+Rnd(5)-Rnd(5) Splotch(1,h,15) Sprite 1,200,200,1 Set Sprite 1,0,1 Set Sprite Alpha 1,128 Paste Sprite 1,sx,sy Next i Randomize Timer() ox=32+(nx*32):oy=32+(ny*32) for noise=1 to rnd(50)+rnd(50)+rnd(50)+50 noisex=rnd(32)+ox noisey=rnd(32)+oy c=point(noisex,noisey) c=rgbr(c)+(rnd(5)-2) if c<0 then c=0 if c>255 then c=255 ink rgb(c,c,c),0 dot noisex,noisey Next noise Next nx Next ny Blur Bitmap 0,2 if file exist("Heightmap.bmp") Then Delete File "Heightmap.bmp" Get Image 2,32,32,32+x*5,32+y*5,0 Save Image "Heightmap.bmp",2 If Sprite Exist(1) Then Delete Sprite 1 Ink Rgb(255,255,255),0 Print "Heightmap Done" Sync Endfunction Function Grass() If Bitmap Exist(1) Then Delete Bitmap 1 Create Bitmap 1,512,512 Set Current Bitmap 1 Ink Rgb(0,90,0),0 Box 0,0,511,511 g=0 Do Splotch(1,180,15) Sprite 1,200,200,1 Size Sprite 1,rnd(3)+1,Rnd(3)+1 Set Sprite Alpha 1,128 Set Sprite Diffuse 1,0,255,0 Paste Sprite 1,rnd(67)-2,rnd(67)-2 g=g+1 If rnd(500)+500<g Then Exit Loop Get Image 3,1,1,64,64,0 Ink Rgb(0,90,0),0 Box 0,0,511,511 g=0 Do Splotch(1,rnd(80)+130,30) Sprite 1,200,200,1 Size Sprite 1,rnd(10)+10,Rnd(10)+10 Set Sprite Alpha 1,64 Set Sprite Diffuse 1,0,255,0 Paste Sprite 1,rnd(75)-10,rnd(75)-10 g=g+1 If rnd(1000)+200<g Then Exit Loop Sprite 2,-1000,0,2 Set Sprite Alpha 2,50 Size Sprite 2,512,512 Paste Sprite 2,0,0 Get Image 4,1,1,64,64,0 Set Current Bitmap 0 Delete Bitmap 1 Delete Sprite 1 Endfunction