# SpriteZ [RCBasic Doc]

## Function SpriteZ(sprite)

Returns the drawing priority for sprites.

Note: Sprites with a higher Z order are drawn first and those with lower values will be drawn on top

`isFullScreen = false
vSync = true
winWidth = 640
winHeight = 480
canViewPortX = 0
canViewPortY = 0
OpenWindow("ScaleSprite", winWidth, winHeight, isFullScreen, vSync)
pCanvas = OpenCanvas(200, 80, 0, 0, 200, 80, 1) 'Need to open a canvas for drawing the text
sCanvas = OpenCanvasSpriteLayer(canViewPortX, canViewPortY, winWidth, winHeight)
Canvas(sCanvas)
DIM eye
DIM eyeW
DIM eyeH
DIM eyeZ
DIM sword
DIM swordW
DIM swordH
DIM swordZ
ReleaseKey = 0
DIM font1
Font1 = LoadFont("DripOctober.ttf", 16)
SetFont(Font1)
SetColor(RGB(100, 200, 200))
eye = LoadImage("theEye.png")
GetImageSize(eye, eyeW, eyeH)
sword = LoadImage("sword.png")
GetImageSize(sword, swordW, swordH)
eyeSprite = CreateSprite(eye, eyeW, eyeH)
SetSpritePosition(eyeSprite, 100, 100)
SetSpriteZ(eyeSprite, 1)
swordSprite = CreateSprite(sword, swordW, swordH)
SetSpritePosition(swordSprite, 89, 75)
SetSpriteZ(swordSprite, 5)
While Not Key(K_ESCAPE)
swordZ = SpriteZ(swordSprite)
eyeZ = SpriteZ(eyeSprite)
Canvas(pCanvas) 'change to the standard drawing canvas for drawing text
DrawText("Eye Sprite Z: " + STR$(eyeZ), 10, 30)
DrawText("Sword Sprite Z: " + STR$(swordZ), 10, 50)
Update()
Wend
`

Link to Font (It's locally on your computer, your not downloading anything from the internet)

Related: SetSpriteZ