NewFrameSheetFromFrameSheet
NewFrameSheetFromFrameSheet FrameSheet, StartFrame, EndFrame, [RemoveSrcFrames]
 
Parameters:

    FrameSheet = The Frame Sheet you wish to delete frames from
    StartFrame = The Start of the run of frames to remove
    EndFrame = The End of the run of frames to remove
    [RemoveSrcFrames] = Optional parameter to remove the frames from the source frame sheet (defaults to False)
Returns: NONE
 

     The NewFrameSheetFromFrameSheet function copies a series of frames from a frame sheet and creates a new sheet from them. This can be very useful when loading frame sheet images that have more than one animation section stored upon them. So we can use NewFrameSheetFromFrameSheet split them up.




FACTS:


      * By default NewFrameSheetFromFrameSheet doesn't delete the source frames, can

 
Example Source: Download This Example
; include the frame sheet animation library
  #Include "FrameSheetAnims"
  
; Clear the Screen so we can see the display frames better
  Cls 255
  
; The FIlename of the frame sheet to load
  File$=ProgramDir$()+"Help/Commands/Media/Animations/explosions.png"
  
; Load the Frame sheet
  FrameSheet1=LoadFrameSheet(File$,64,64,RGB(0,0,0))
  
  
; Cut the Last 8 frames from the FrameSheet1 and create a new
; frame sheet from them.
  LastFRame=GetframeSheetCount(FrameSheet1)
  StartFrame =LastFrame-8
  
  FrameSheet2=NewFrameSheetFromFrameSheet(FrameSheet1,StartFrame,LastFrame,true)
  
; Draw the frames from the frame sheet #1 to the screen.
  DrawFrameSheet(frameSheet1)
  
; Draw the frames from the frame sheet #2 to the screen.
  DrawFrameSheet(frameSheet2)
  
; show the screen to the user and wait for a key press
  Sync
  WaitKey
  
  End
  
  
  
Psub DrawFrameSheet(ThisFrameSheet)
  
  Print "Frames in Frame Sheet:"+Str$(ThisFrameSheet)
  
; Display the number of frames in this sheet
  Print "Frames In Sheet:"+Str$(GetFrameSheetCount(ThisFrameSheet))
  
; Get the current print cursor position
  Ypos=GetCursorY()     +10
  Xpos=0
; run through this frame sheet and draw each frame to the screen
  For lp=0 To GetFrameSheetCount(ThisFrameSheet)-1
     ThisIMage=GetFrameSheetImage(ThisFrameSheet,lp)
     DrawImage ThisImage,Xpos,Ypos,false
     Width=GetImageWidth(thisImage)+2
     Xpos+=Width
     If (Xpos+Width)=>GetScreenWidth()
        Xpos=0
        Ypos+=GetImageHeight(thisImage)+2
     EndIf
  Next
  SetCursorY Ypos+100
  
EndPsub
  
  
  
  
 
Related Info: LoadFrameSheet | NewFrameSheet | RemoveFrameSheetFrames :
 


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