; dxFreeEntity Example ; This example creates an entity and ; allows you to move it, but shows ; that a handle is no longer valid after ; dxFreeEntity is used on it. ; Run in Debug Mode dxGraphics3D 640,480 dxApptitle "dxFreeEntity Example" Cam = dxCreateCamera() Lit = dxCreateLight() dxPositionEntity Lit,-5,-5,0 dxPositionEntity Cam,0,0,-5 AnEntity = dxCreateCube() ; This is our Test Entity dxRotateMesh AnEntity,45,45,45 While Not dxKeyDown(1) ; Until we press ESC ; Use the Left or Right Arrows to Move the Entity If dxKeyDown(203) Then dxMoveEntity AnEntity,-0.1,0,0 If dxKeyDown(205) Then dxMoveEntity AnEntity,0.1,0,0 ; Use the Space Key to Free the Entity. It will disappear ; The next time you try to move it, you will get an error ; Notice that the Handle Variable doesn't change after the ; Entity is free. It simply becomes invalid. If dxKeyHit(57) Then dxFreeEntity AnEntity ; Hit Space to Free! dxRenderWorld ; Draw the Scene ; What is in the AnEntity handle? dxText 10,10,"Entity Handle: "+AnEntity dxFlip ; dxFlip it into View Wend End