; CameraZoom Example ; ------------------ Graphics3D 640,480,0,2 SetBuffer BackBuffer() camera=CreateCamera() PositionEntity camera,0,2,0 light=CreateLight() RotateEntity light,45,45,0 ; Textured ground plane gives a sense of distance plane=CreatePlane() ground_tex=LoadTexture("media/MossyGround.BMP") ScaleTexture ground_tex,4,4 EntityTexture plane,ground_tex ; Two gate pillars close to the camera pillar=CreateCylinder() ScaleEntity pillar,0.5,3,0.5 PositionEntity pillar,-3,3,10 pillar=CreateCylinder() ScaleEntity pillar,0.5,3,0.5 PositionEntity pillar,3,3,10 ; A distant treasure chest on the horizon - zoom in to spot it chest=CreateCube() ScaleEntity chest,2,2,2 EntityColor chest,255,200,0 PositionEntity chest,0,2,200 zoom#=1 While Not KeyDown(1) ; Up / Down raise and lower the camera zoom factor If KeyDown(200) And zoom<100 Then zoom=zoom+0.1 If KeyDown(208) And zoom>1 Then zoom=zoom-0.1 ; Left / Right turn the camera If KeyDown(203) Then TurnEntity camera,0,1,0 If KeyDown(205) Then TurnEntity camera,0,-1,0 ; Apply the zoom factor to the camera CameraZoom camera,zoom TurnEntity chest,0,1,0 RenderWorld Text 0,0,"Up / Down: zoom Left / Right: turn Esc: exit" Text 0,20,"A golden chest sits far ahead between the pillars - zoom in to see it" Text 0,40,"CameraZoom camera,"+zoom Flip Wend End