; EntityName Example ; ------------------ Graphics3D 640,480,0,2 SetBuffer BackBuffer() camera=CreateCamera() PositionEntity camera,0,0,-6 light=CreateLight() RotateEntity light,45,45,0 ; Three pickup crates, each given a name with NameEntity Dim crates(3) For i=1 To 3 crate=CreateCube() ScaleEntity crate,0.5,0.5,0.5 PositionEntity crate,(i-2)*2.5,0,0 crates(i)=crate Next NameEntity crates(1),"health pack" NameEntity crates(2),"ammo box" NameEntity crates(3),"gold crate" selected=1 While Not KeyDown(1) ; Space selects the next crate If KeyHit(57) selected=selected+1 If selected>3 Then selected=1 EndIf ; Spin all the crates and highlight the selected one For i=1 To 3 TurnEntity crates(i),0,1,0 EntityColor crates(i),150,150,150 Next EntityColor crates(selected),0,255,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: select next crate Arrow keys: move camera Esc: exit" ; EntityName returns the name given to the entity by NameEntity Text 0,20,"EntityName(selected crate) = "+EntityName(crates(selected)) Flip Wend End