; dxCopyEntity Example ; This example creates an entity and ; allows you to make copies of it. dxGraphics3D 640,480 dxApptitle "dxCopyEntity Example" Cam = dxCreateCamera() Lit = dxCreateLight() dxPositionEntity Lit,-5,-5,0 dxPositionEntity Cam,0,0,-5 AnEntity = dxCreateCube() ; This is our Test Entity dxScaleMesh anEntity,0.4,0.4,0.4 While Not dxKeyDown(1) ; Until we press ESC If dxKeyHit(57) Then ; When we hit Space, a new Entity is created ; These share the same internal mesh structure though! ; Hence although we are only Rotating the original MESH ; Linked to the original Entity, since it is a Mesh command, ; all the Entity Copies are linked to it.. NewEntity = dxCopyEntity(AnEntity) ; Hit Space to Copy! ; Change the dxColor of the Entity. Since this is an entity ; Property, it doesn't effect the other copies. dxEntityColor NewEntity,dxRand(255),dxRand(255),dxRand(255) dxPositionEntity NewEntity,dxRand(4)-2,dxRand(4)-2,0 EndIf dxSeedRnd MilliSecs() dxRotateMesh AnEntity,.25,.35,.45 dxRenderWorld ; Draw the Scene dxFlip ; dxFlip it into View Wend End