ShowEntity entity
Parameters
| entity - entity handle |
Description
|
Shows an entity - the opposite of HideEntity. Once an entity has been hidden using HideEntity, ShowEntity makes it visible and involved in collisions again. Entities are shown by default when created or loaded, so you only need ShowEntity after a HideEntity. ShowEntity affects the specified entity only - child entities are not affected. Note the asymmetry with HideEntity, which hides the whole family: an entity also stays effectively hidden while any entity above it in the hierarchy is hidden, so showing a child of a hidden parent has no visible effect until the parent is shown too. See also: HideEntity, EntityAlpha, FreeEntity. |
Example
; 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
Index