GetSpriteTransparent
TransparentFlag = GetSpriteTransparent(SpriteIndex)
 
Parameters:

    SpriteIndex = The iindex of the sprite you wish to set
Returns:

    TransparentFlag = The transparent state (0= solid, 1= transparent)
 

      The GetSpriteTransparent function returns the current transparent status of a sprite. The function will return a True (1) if the sprite is currently being rendered as Transparent, or a False (0) if it's being drawn solid.



FACTS:


      * Also see SpriteTransparent




Mini Tutorial:


      This example has is really 3 parts. Part 1 creates an image. Part 2 then creates 10 sprites and assigns each sprite the previously created image from part1. Then last part, renders the sprites to the screen. If the user hits the Space key, the transparent status of each sprite it toggled. So the sprites will change their rendering mode

  
  
; =========================
; Part 1 - Create an Image
; =========================
  
  Cls RGB(0,0,0)
  MyImage=GetFreeImage()
  CircleC 32,32,16,1,$ff40f0
  CircleC 32,32,8,1,$8080f0
  GetImage MyIMage,0,0,64,64
  
  
; =========================
; Part 2 - Create Some sprites
; =========================
  
  For lp=1 To 10
   ; Create a sprite
     CreateSprite lp
   ; Assign this sprite an image
     SpriteImage lp,MyIMage
   ; Randomly set the sprites transparent Flag
     SpriteTransparent lp,Rnd(1)
   ; Randomly position the sprites
     X=Rnd(GetScreenWidth()-64)
     y=Rnd(GetScreenHeight()-64)
     PositionSprite lp,x,y
  Next
  
  
; ==================================
; Part 3 - DRaw the Sprites/Screen
; ===================================
  
  Do
     
   ; Clear screen to a bright white colour
     Cls RGB(240,255,240)
   ; Display message
     Ink 0
     Print "Hit Space to Toggle the Sprites Transparent state"
     
   ; Toggle the transparent states of all the created  sprites
     If SpaceKey()=true
        For lp =1 To 10
           SpriteTransparent lp,Not GetSpriteTransparent(lp)
        Next
     EndIf
     
   ; Sprite All the created sprites
     DrawAllSprites
     
   ; Display the screen and wait for a key press
     Sync
  Loop
  




This example would output.

  
  no Text output
  

 
Related Info: ImageMaskColour | SpriteDrawmode | SpriteTransparent :
 


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