; MD2Animating Example ; -------------------- Graphics3D 640,480,0,2 SetBuffer BackBuffer() camera=CreateCamera() light=CreateLight() RotateEntity light,45,45,0 ; Load the md2 model and apply its texture gargoyle=LoadMD2("media/Gargoyle/Gargoyle.md2") garg_tex=LoadTexture("media/Gargoyle/Gargoyle.bmp") EntityTexture gargoyle,garg_tex ; Face the gargoyle towards the camera PositionEntity gargoyle,0,-45,100 RotateEntity gargoyle,0,180,0 ; Loop the wing-flap frames 32-46 AnimateMD2 gargoyle,1,0.1,32,46 playing=True While Not KeyDown(1) ; Space stops and restarts the md2 animation If KeyHit(57) playing=1-playing AnimateMD2 gargoyle,playing,0.1,32,46 EndIf UpdateWorld ; Arrow keys move the camera If KeyDown(200) Then MoveEntity camera,0,0,1 If KeyDown(208) Then MoveEntity camera,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: stop/start animation Arrows: camera Esc: exit" ; MD2Animating returns 1 while the md2 is animating, 0 when stopped Text 0,20,"MD2Animating(gargoyle) = "+MD2Animating(gargoyle) Flip Wend End