Регистрация | Вход
Graphics3D 640,480,24,2SetBuffer BackBuffer() camera=CreateCamera() PositionEntity camera,0,1,-5plane=CreatePlane() sphere=CreateSphere(8)EntityColor(sphere,255,0,0)PositionEntity sphere,0,1,0frameTimer=CreateTimer(25) While Not KeyDown( 1 ) If KeyDown( 205 )=True Then TurnEntity camera,0,-2,0 If KeyDown( 203 )=True Then TurnEntity camera,0,2,0 If KeyDown( 208 )=True Then MoveEntity camera,0,0,-0.1 If KeyDown( 200 )=True Then MoveEntity camera,0,0,0.1 RenderWorld WaitTimer(frameTimer)Flip Wend End
Graphics3D 640,480,24,2SetBuffer BackBuffer() camera=CreateCamera() PositionEntity camera,0,1,-5EntityType(camera,1);EntityRadius(camera,1.5)GenMap();plane=CreatePlane() EntityPickMode(plane,2)sphere=CreateSphere(8)EntityColor(sphere,255,0,0)PositionEntity sphere,0,1,0frameTimer=CreateTimer(25) ;Global trg=CreatePivot();Global pivot=CreatePivot();While Not KeyDown( 1 ) If MouseHit(1) ThenCameraPick(camera,MouseX(),MouseY());PositionEntity(trg,PickedX(),1,PickedZ());EndIf;If (EntityDistance(camera,trg)>1) ThenPointEntity(pivot,trg)TurnEntity(camera,0,DeltaYaw(camera,trg)/10,0);MoveEntity (camera,0,0,0.1 );PositionEntity(camera,EntityX(camera),1,EntityZ(camera));RotateEntity(camera,0,EntityYaw(camera),0);EndIf;Collisions(1,7,2,2);UpdateWorld()RenderWorld WaitTimer(frameTimer)Flip Wend End Function GenMap(); Main loop to create multiple random objectsFor i = 1 To 100 ; Create 50 random objects CreateRandomObject()NextEnd Function; ; Function to create a random objectFunction CreateRandomObject() x = Rnd(80) ; Random x position z = Rnd(60) ; Random z position objectType = Rand(3) ; Randomly choose an object type (0, 1, or 2) If objectType = 1 obj = CreateCube() ; Create a cube If objectType = 2 obj = CreateSphere() ; Create a sphere If objectType = 3 obj = CreateCylinder() ; Create a cylinder PositionEntity(obj,x,1,z) EntityColor(obj,Rand(255),Rand(255),Rand(255)) EntityPickMode(obj,2) EntityType(obj,7)End Function