GetFreeSprite
FreeSpriteIndex = GetFreeSprite()
 
Parameters: NONE
Returns:

    FreeSpriteIndex = The Index value of a Sprite that is currently not in use
 

     The GetFreeSprite function returns the Index of a Sprite that is currently NOT in use.


     This is particularly useful when you wish to dynamically request and use Sprites as you need. (Also See: NewSprite) This takes the burdon of managing what Sprite indexes are currently free or used, completely off the programmers shoulders, an hides it away inside PlayBASIC.



FACTS:


      * While GetFreeSprite will always return a new sprite index for you, it doesn't reserved this sprite for you.

      * Also see NewSprite



Mini Tutorial:


      Requesting a free Sprite index, then create this Sprite and quit..

  
  
; Ask PlayBASIC for the Sprite Index that is currently free for use.
  MySprite=GetFreeSprite()
  
; Create the sprite ready for use.
  CreateSprite MySprite
  
; Display the status of the sprite after it's been created.
  Print GetSpriteStatus(MySprite)
  
; Display the Screen and wait for the user to press a key
  Sync
  WaitKey
  
  


Expected output.

  
  1
  



 
Related Info: CreateSprite | DeleteSprite | GetFirstSprite | GetNextSprite | NewSprite :
 


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