DrawOrderedSprites
DrawOrderedSprites
 
Parameters: NONE
Returns: NONE
 

      DrawOrderedSprites will render all existing sprites to the current surface. The sprites are drawn based upon their Z position (their depth). So sprites with a higher Z depth will be drawn first.



FACTS:


      * You may see a toggle effect if two or more sprites share the same depth and overlap each other. This occurs as the DrawOrderedSprites command makes no distinction between two sprites that share the same space.

      * DrawOrderedSprites will render all sprite images to current surface, except when the user has enabled CaptureToScene or CaptureToWorld. In either situation the render requests will be added to the scene or world ques respectively.

      * See PositionSpriteZ, PositionSpriteXYZ for change sprite depths



 
Example Source: Download This Example
; Programs Main (Do/loop)
; ---------------------------
  
  Do
     
   ; Clear the Screen
     Cls RGB(25,30,45)
     
     
   ; Check what Sprite drawing mode to use
     If Sprites_DRaw_mode=0
        
      ; Render The Sprites using their depths
        DrawOrderedSprites
        
     Else
      ; Tell PB to render All the Sprites now,
      ;and ignore their Z depths.
        DrawAllSprites
     EndIf
     
     
     
   ; Display a message
     Ink $ffffff
     Print "Rendering Ordered Sprites"
     Print "===================================="
     Print "Press Space Key to toggle Sprite Rendering"
     Print "===================================="
     
     If Sprites_DRaw_mode=0
        Print "Sprites render mode: DrawOrderedSprites"
     Else
        Print "Sprites render mode: DrawAllSprites"
     EndIf
     
     
   ; Check if the Space key was pressed
     If SpaceKey()=true
        Sprites_DRaw_mode=1-Sprites_DRaw_mode
        FlushKeys
     EndIf
     
     
   ; Display the screen and loop back to the DO statement
   ; to continue the loop
     Sync
  Loop
  
  
  
  
; =========================================================
; Create an Image with a shaded circle pattern on it.
; =========================================================
  
Function CreateBallImage(Size)
  ThisImage=NewImage(size,size)
  RenderToImage ThisImage
  Colour=RGB(128+Rnd(127),128+Rnd(127),128+Rnd(127))
  RenderPhongImage ThisIMage,size/2,size/2,Colour,200,255.0/(size/2)
  RenderToScreen
EndFunction ThisImage
  
  
 
Related Info: DrawAllSprites | DrawSprite | DrawSpriteRange :
 


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