AnimFrameSheet
AnimFrameSheet AnimIndex, FrameSheet
 
Parameters:

    AnimIndex = The Index of the Animation you want to query
    FrameSheet = The Frame Sheet this animation is using
Returns: NONE
 

     The AnimFrameSheet command allows use to change the frame sheet of an animation. This can be useful when chaining different animation sequences together. Such as linking a Walking Animation to a Jump, Jump to a fall, a Walk to a Run Animation etc etc. It just saves us having to constantly destroy & recreate the animation controller.




FACTS:


      * AnimFrameSheet will fail if the frame sheet you're changing this animation to doesn't exist.

      * AnimFrameSheet resets the Animations Position Index. (See AnimPos)



 
Example Source: Download This Example
; 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
     DrawAnim Anim1,400,Ypos,true
     ShowAnimInfo(Anim1,100,Ypos)
     
   ; Display the current frame this animation is at
     Ypos=400
     DrawAnim Anim2,400,Ypos,true
     ShowAnimInfo(Anim2,100,Ypos)
     
   ; 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
  
  
  
; Delete the Animations
  DeleteAnim Anim1
  DeleteAnim Anim2
  
; Delete the Frame Sheet
  DeleteFrameSheet FrameSheet
  
; End This program
  End
  
  
  
  
; This Sub displays some basic info about the anim
Psub ShowAnimInfo(ThisANim,Xpos,Ypos)
  If GetAnimStatus(ThisANim)
     th=20
     Text Xpos,ypos,"     Frame:"+Str$(GetAnimPos(ThisAnim))
     Ypos+=th
     Text Xpos,ypos,"Frame Rate:"+Str$(GetAnimFrameRate(ThisAnim))
     Ypos+=th
     Text Xpos,ypos,"Anim Method:"+Str$(GetAnimMethod(ThisAnim))
     Ypos+=th
     Text Xpos,ypos," Anim Image:"+Str$(GetAnimImage(ThisAnim))
     Ypos+=th
     Text Xpos,ypos,"Frame Sheet:"+Str$(GetAnimFrameSheet(ThisAnim))
     Ypos+=th
     
  EndIf
EndPsub
  
  
  
 
Related Info: AnimFrameRate | GetFrameSheetCount | GetFrameSheetImage | GetFrameSheetStatus | LoadFrameSheet | NewAnim :
 


(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com