Oh, just a tip, 786979... When you've got a lot of code you want to post, it makes your post a lot more readable if you put it in a codebox like this:
That's the same code you entered in, but much more compact, visually speaking. If you want to know how to do that, click on the "Home" tab of this site, then click "FAQ," then click "forum codes." L8r!
Graphics3D 1024,768,32,1 Const FPS=30 Type blur Field entity Field alpha# End Type Type tower Field entity Field entityb End Type Collisions 2,1,2,2 Global sky,plane,skybox Global fighter,scraper,house Global wood_tex,redbrick,reflect_tex,building_tex,concrete_tex,sky_tex,tower_tex,ground Global piv,cam_piv,cam,camy,camz,pivspeed#,jumpspeed# Load_Textures() Create_Cameras() Load_Meshes() Setup_World() skybox=Make_Sky_Box("sky") EntityParent skybox,cam period=1000/FPS time=MilliSecs()-period WBuffer enable AntiAlias enable ;main loop While Not KeyHit(1) Cls Repeat elapsed=MilliSecs()-time Until elapsed ;how many 'frames' have elapsed ticks=elapsed/period ;fractional remainder tween#=Float(elapsed Mod period)/Float(period) For k=1 To ticks time=time+period If k=ticks Then CaptureWorld Update_Game() UpdateWorld Next RenderWorld tween RenderWorld tween Flip Wend End SetBuffer BackBuffer() Function Create_Cameras() piv=CreatePivot() EntityType piv,2 PositionEntity piv,EntityX(piv),EntityY(piv),EntityZ(piv) cam_piv=CreatePivot(piv) cam=CreateCamera(cam_piv) CameraRange cam,10,150000 CameraClsMode cam,True,True PositionEntity cam,0,80,-120 EntityPickMode(piv,1) End Function Function Make_Sky_Box( file$ ) m=CreateMesh() ;front face b=LoadBrush( file$+"_FR.bmp",49 ) s=CreateSurface( m,b ) AddVertex s,-1,+1,-1,0,0:AddVertex s,+1,+1,-1,1,0 AddVertex s,+1,-1,-1,1,1:AddVertex s,-1,-1,-1,0,1 AddTriangle s,0,1,2:AddTriangle s,0,2,3 FreeBrush b ;right face b=LoadBrush( file$+"_LF.bmp",49 ) s=CreateSurface( m,b ) AddVertex s,+1,+1,-1,0,0:AddVertex s,+1,+1,+1,1,0 AddVertex s,+1,-1,+1,1,1:AddVertex s,+1,-1,-1,0,1 AddTriangle s,0,1,2:AddTriangle s,0,2,3 FreeBrush b ;back face b=LoadBrush( file$+"_BK.bmp",49 ) s=CreateSurface( m,b ) AddVertex s,+1,+1,+1,0,0:AddVertex s,-1,+1,+1,1,0 AddVertex s,-1,-1,+1,1,1:AddVertex s,+1,-1,+1,0,1 AddTriangle s,0,1,2:AddTriangle s,0,2,3 FreeBrush b ;left face b=LoadBrush( file$+"_RT.bmp",49 ) s=CreateSurface( m,b ) AddVertex s,-1,+1,+1,0,0:AddVertex s,-1,+1,-1,1,0 AddVertex s,-1,-1,-1,1,1:AddVertex s,-1,-1,+1,0,1 AddTriangle s,0,1,2:AddTriangle s,0,2,3 FreeBrush b ;top face b=LoadBrush( file$+"_UP.bmp",49 ) s=CreateSurface( m,b ) AddVertex s,-1,+1,+1,0,1:AddVertex s,+1,+1,+1,0,0 AddVertex s,+1,+1,-1,1,0:AddVertex s,-1,+1,-1,1,1 AddTriangle s,0,1,2:AddTriangle s,0,2,3 FreeBrush b ScaleMesh m,1000,1000,1000 FlipMesh m EntityFX m,9 EntityOrder m,10 Return m End Function Function Load_Meshes() fighter=LoadMesh("newplane.b3d",piv) PositionEntity fighter,EntityX(fighter),EntityY(fighter)+40,EntityZ(fighter) RotateEntity fighter,0,180,0 EntityTexture fighter,reflect_tex scraper=LoadAnimMesh("buildingb.b3d") PositionEntity scraper,0,0.15,1000 RotateEntity scraper,0,180,0 ScaleEntity scraper,100,100,100 house=LoadMesh("house.b3d") ScaleEntity house,60,60,60 PositionEntity house,-6000,0.15,-6000 EntityType house,1 End Function Function Setup_World() plane=CreatePlane() EntityShininess plane,1 EntityTexture plane,ground light=CreateLight() For tempe=0 To 99 block.tower=New tower block\entity=CopyEntity(scraper) EntityType block\entity,1,True block\entityb=CreateCube() ScaleEntity block\entityb,2000,18200,2000 HideEntity block\entityb EntityTexture block\entityb,building_tex PositionEntity block\entity,4000+xpos,0.01,2000+zpos PositionEntity block\entityb,4000+xpos,0.01,2000+zpos zpos=zpos+15000 If zpos>=150000 zpos=zpos-150000 xpos=xpos+15000 EndIf Next FreeEntity scraper mode=1 count=0 End Function Function Load_Textures() ground=LoadTexture("ground.bmp") ScaleTexture ground,200,200 reflect_tex=LoadTexture("reflection.jpg",64) concrete_tex=LoadTexture("concrete.bmp") flame_tex=LoadTexture("flamesprite.bmp") building_tex=LoadTexture("building.bmp") ScaleTexture building_tex,1,0.05 sky_tex=LoadTexture("sky.bmp") tower_tex=CreateTexture(256,256) ScaleTexture tower_tex,1,0.2 redbrick=LoadTexture("redbrick.bmp") wood_tex=LoadTexture("wood.bmp") End Function Function Update_Player() RotateEntity piv,EntityPitch(piv),EntityYaw(piv),EntityRoll(piv) EntityRadius piv,140 If JoyDown(3)=True pivspeed#=pivspeed#+2 If pivspeed#>400 Then pivspeed#=400 If pivspeed#>0 And JoyDown(7)=True add_motion_blur(fighter) If EntityY(cam)<150 camy=camy+2 camz=camz-8 cap=cap-5 EndIf pivspeed#=pivspeed#*3 EndIf Else pivspeed#=pivspeed#-2 If EntityRoll(piv)>0 Then TurnEntity piv,0,0,-4 If EntityRoll(piv)<0 Then TurnEntity piv,0,0,4 If EntityPitch(piv)>0 Then TurnEntity piv,-4,0,0 If EntityPitch(piv)<0 Then TurnEntity piv,4,0,0 If pivspeed#<0 Then pivspeed#=0 EndIf MoveEntity piv,0,0,0+pivspeed# If JoyX()<-0.9 If EntityRoll(fighter)<180 TurnEntity fighter,0,0,-10 EndIf TurnEntity piv,0,4,0 EndIf If JoyX()>0.9 If EntityRoll(fighter)>-180 TurnEntity fighter,0,0,10 EndIf TurnEntity piv,0,-4,0 EndIf If EntityRoll(fighter)>0 TurnEntity fighter,0,0,-4 EndIf If EntityRoll(fighter)<0 TurnEntity fighter,0,0,4 EndIf If JoyY()<0.5 TurnEntity piv,4,0,0 EndIf If JoyY()>-0.5 TurnEntity piv,-4,0,0 EndIf End Function Function Update_Camera() If JoyRoll()>100 Then TurnEntity cam_piv,0,2,0 If JoyRoll()<-100 Then TurnEntity cam_piv,0,-2,0 If JoyZ()>0.9 Then TurnEntity cam_piv,2,0,0 If JoyZ()<-0.9 Then TurnEntity cam_piv,-2,0,0 If JoyHit(12) Then RotateEntity cam_piv,0,0,0 If EntityY(cam)>80 camy=camy-1 camz=camz+4 EndIf MoveEntity cam,0,camy,camz PositionEntity skybox,EntityX(cam),EntityY(cam),EntityZ(cam) RotateEntity skybox,0,0,0,True PositionEntity cam,EntityX(cam),EntityY(cam),EntityZ(cam) camy=0 camz=0 End Function Function Update_Game() Update_Camera() update_player() update_motion_blur(fighter) For block.tower=Each tower If EntityVisible (block\entity,cam) And EntityDistance(piv,block\entity)>30000 HideEntity block\entity ShowEntity block\entityb ElseIf EntityDistance(piv,block\entityb)<30000 HideEntity block\entityb ShowEntity block\entity EndIf Next End Function Function Add_Motion_Blur(ent) b.blur=New blur b\entity=CopyEntity(ent) PositionEntity b\entity,EntityX(ent,1),EntityY(ent,1),EntityZ(ent,1) RotateEntity b\entity,EntityPitch(ent,1),EntityYaw(ent,1),EntityRoll(ent,1) b\alpha#=0.5 EntityAlpha b\entity,b\alpha# ScaleEntity b\entity,0.95,0.95,0.95 End Function Function Update_Motion_Blur(ent) For b.blur=Each blur If b\alpha#>0 Then b\alpha#=b\alpha#-.02 EntityAlpha b\entity,b\alpha# Else FreeEntity b\entity Delete b End If Next End Function
That's the same code you entered in, but much more compact, visually speaking. If you want to know how to do that, click on the "Home" tab of this site, then click "FAQ," then click "forum codes." L8r!