; MD2AnimLength 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 ; Play every frame the file contains, using the length as the last frame AnimateMD2 gargoyle,1,0.1,1,MD2AnimLength(gargoyle) While Not KeyDown(1) 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,"Arrows: camera Esc: exit" ; The total number of animation frames stored in the md2 file Text 0,20,"MD2AnimLength(gargoyle) = "+MD2AnimLength(gargoyle)+" frames" Text 0,40,"MD2AnimTime: "+MD2AnimTime(gargoyle) Flip Wend End