; 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)) ; Let's create two Animations using our loaded frame sheet ; create anim#1, this anim will Anim1=NewAnim(FrameSheet,1) ; create Anim#2, this anim will use a slower frame rate Anim2=NewAnim(FrameSheet,5) ; Limit the programs speed to 60 fps (or there abouts) SetFPS 60 ; Run This section of code, untila key is pressed Repeat ; Clear The Screen Cls RGB(0,0,0) ; Display the current frame this animation is at Ypos=100 ; Call the StepAnim() function to update this animation ; and return the frame to be displayed CurrentImage=StepAnim(Anim1) ; Draw This frame of the animation DrawImage CurrentImage,400,Ypos,true ; Display the current frame this animation is at Ypos=400 ; Call the StepAnim() function to update this animation ; and return the frame to be displayed CurrentImage=StepAnim(Anim2) ; Draw This frame of the animation DrawImage CurrentImage,400,Ypos,true ; 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 ; End This program End |