; EntityHasTag Example ; -------------------- Graphics3D 640,480,0,2 SetBuffer BackBuffer() ; A wall with a door: the porch in front of it is a zone that opens the ; door, lights a lantern and rings a bell when the player steps onto it. ; The camera is tagged player in the world file. world=LoadWorldAsync("../../../samples/appearance/triggers.world") While Not WorldReady(world) If WorldLoadState(world)=WORLD_LOAD_FAILED Then RuntimeError WorldLoadError(world) UpdateAsyncLoads 2 Wend SetWorld world SetAudioWorld world camera=FindWorldEntity(world,"camera") ; Things the camera can tell you about when you look at them EntityPickMode FindWorldEntity(world,"door"),2 EntityPickMode FindWorldEntity(world,"wall-left"),2 EntityPickMode FindWorldEntity(world,"wall-right"),2 EntityPickMode FindWorldEntity(world,"pad"),2 EntityPickMode FindWorldEntity(world,"crate"),2 While Not KeyDown(1) ; Arrow keys walk the camera, which carries the listener 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,2,0 If KeyDown(205) Then TurnEntity camera,0,-2,0 UpdateWorld RenderWorld ; What is in the middle of the view, and whether it is loot seen=CameraPick(camera,GraphicsWidth()/2,GraphicsHeight()/2) Text 0,0,"Arrow keys: walk through the door and look at things Esc: exit" If seen<>0 Then If EntityHasTag(seen,"loot") Then Text 0,20,EntityName(seen)+" is loot: walk to it to take it" Else Text 0,20,EntityName(seen)+" is not loot" EndIf EndIf Flip Wend End