; ShowEntity Example ; ------------------ Graphics3D 640,480,0,2 SetBuffer BackBuffer() camera=CreateCamera() PositionEntity camera,0,1,-5 light=CreateLight() RotateEntity light,45,45,0 ; A spinning power-up sitting on a pedestal powerup=CreateSphere(16) ScaleEntity powerup,0.5,0.5,0.5 PositionEntity powerup,0,1.5,0 EntityColor powerup,0,255,100 pedestal=CreateCube() ScaleEntity pedestal,0.75,0.5,0.75 PositionEntity pedestal,0,0,0 EntityColor pedestal,120,120,120 ; The power-up starts hidden - press Space to reveal it HideEntity powerup hidden=1 While Not KeyDown(1) ; Space toggles between ShowEntity and HideEntity If KeyHit(57) If hidden ; ShowEntity makes a hidden entity visible again ShowEntity powerup hidden=0 Else HideEntity powerup hidden=1 EndIf EndIf TurnEntity powerup,0,2,0 ; Arrow keys move the camera If KeyDown(200) Then MoveEntity camera,0,0,0.1 If KeyDown(208) Then MoveEntity camera,0,0,-0.1 If KeyDown(203) Then TurnEntity camera,0,1,0 If KeyDown(205) Then TurnEntity camera,0,-1,0 RenderWorld Text 0,0,"Space: show/hide the power-up Arrow keys: move camera Esc: exit" If hidden Text 0,20,"The power-up is hidden - press Space to call ShowEntity" Else Text 0,20,"ShowEntity powerup - visible again" EndIf Flip Wend End