; include the frame sheet animation library #Include "FrameSheetAnims" ; The file name of the example frame sheet we're going ; to load Filename$=ProgramDir$()+"Help/Commands/Media/Animations/explosions.png" ; Load the Frame sheet FrameSheet=LoadFrameSheet(Filename$,64,64,RGB(0,0,0)) ; Create some animations using the various anim methods Dim Anim(6) Anim(0) = MakeMyAnim(frameSheet,1,AnimMethod_Idle) Anim(1) = MakeMyAnim(frameSheet,1,AnimMethod_Forward) Anim(2) = MakeMyAnim(frameSheet,1,AnimMethod_BackWard) Anim(3) = MakeMyAnim(frameSheet,1,AnimMethod_ForwardOnce) Anim(4) = MakeMyAnim(frameSheet,1,AnimMethod_BackWardOnce) Anim(5) = MakeMyAnim(frameSheet,1,AnimMethod_PingPongForward) Anim(6) = MakeMyAnim(frameSheet,1,AnimMethod_PingPongBackward) ; Limit the programs speed to 5 fps (or there abouts) SetFPS 5 ; Run This section of code, until a key is pressed Repeat ; Clear The Screen Cls RGB(0,0,0) For lp=0 To 6 x#=100 y#=50+(lp*50) ; Draw the current state of this animation. DrawAnim( Anim(lp),x#,y#,true) Next ; show the screen to the user and wait for a key press Sync ; If no key is pressed, jump back to the repeat ; run this section of code again. Until ScanCode()<>0 Psub MakeMyAnim(FrameSheet,FrameRate,Method) Anim =NewAnim(FrameSheet) AnimFrameRate Anim,Framerate AnimMethod Anim, Method EndPsub Anim |