SpriteImage
SpriteImage SpriteIndex, ImageIndex
 
Parameters:

    SpriteIndex = The identifier of the sprite you wish to create
    ImageIndex = The identifier of image you wish to assign to this sprite
Returns: NONE
 

      SpriteImage assigns an sprites and image. The sprite will then use this image each time this sprite is rendered. The image will be drawn using the sprites current draw mode (see SpriteDrawMode). This allows many different sprites to share the same image, all with unique draw mode settings and effects.

      To animate a sprite, we simply assign new images (from a sequence) each update.




FACTS:


      * Before a sprite can be drawn, it must be assigned an Image.

      * You can assign the same image to more than one sprite, each sprite can have it's own draw mode properties without effecting the sprite also.

      * You can not assign a sprite an image that does not exist.

      * Note: We highly recommended you read the Images tutorials also!






Mini Tutorial:


      Create a sprite, assign it an image and display a sprites image property.

  
; Create an blank Image 100x by 50y pixels in size.
  CreateImage 2,100,50
  
; Create sprite #1
  CreateSprite 1
  
; Assign sprite #1 to render image #2.
  SpriteImage 1,2
  
; Display the Image Property
  Print "This Sprite is set set to render image #"+Str$(GetSpriteImage(1))
  
; Display the Screen and wait for the user to press a key
  Sync
  WaitKey
  



This example would output.

  
  This Sprite is set To render image #2
  

 
Related Info: DrawAllSprites | DrawOrderedSprites | DrawSprite | GetSpriteDrawMode | GetSpriteImage | LoadIMage | SpriteCollision | SpriteDrawMode :
 


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