; DebugBox Example ; ---------------- ; Requires Extended mode. Graphics3D 640,480,0,2 SetBuffer BackBuffer() camera=CreateCamera() PositionEntity camera,0,2,-8 light=CreateLight() RotateEntity light,45,45,0 ; A patrolling enemy for the debug overlay to track enemy=CreateCube() EntityColor enemy,220,60,60 show=True While Not KeyDown(1) ; Space toggles the debug overlay If KeyHit(57) Then show=Not show ; The enemy patrols left and right while spinning angle#=angle+2 PositionEntity enemy,4*Sin(angle),0,2 TurnEntity enemy,0,3,0 ; DebugBox queues a wireframe box around the enemy for the next RenderWorld If show Then DebugBox EntityX(enemy),EntityY(enemy),EntityZ(enemy),3,3,3,255,220,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,"Arrow keys: move camera Space: toggle overlay Esc: exit" If show Then Text 0,20,"DebugBox tracks the enemy every frame" Else Text 0,20,"Overlay off - press Space" Flip Wend End