## Sub SetSpriteZ(sprite, z)

Sets 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)
sCanvas = OpenCanvasSpriteLayer(canViewPortX, canViewPortY, winWidth, winHeight)
Canvas(sCanvas)
DIM eye
DIM eyeW
DIM eyeH
DIM sword
DIM swordW
DIM swordH
ReleaseKey = 0
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)
If Key(K_SPACE) And ReleaseKey = 0 Then
SetSpriteZ(eyeSprite, 10) 'This will cause the eye to be drawn behind the sword
ReleaseKey = 1
ElseIf Not Key(K_UP) And Not Key(K_DOWN) And ReleaseKey = 1 then
ReleaseKey = 0
End If
Update()
Wend
`

Related: SpriteZ