Something like this perhaps (for the Depth question), I don't have B+ but it works in Blitz3D:
Graphics 640,480,32,2
SetBuffer BackBuffer()
Const MAXDEPTH = 3
Type zImage
Field Image
Field Depth%
Field X
Field Y
End Type
imgCow.zImage = New zImage
imgCow\Image = LoadImage("cow.bmp")
imgCow\Depth = 0
imgCow\X = 50
imgCow\Y = 50
imgHorse.zImage = New zImage
imgHorse\Image = LoadImage("horse.bmp")
imgHorse\Depth = 1
imgHorse\X = 55
imgHorse\Y = 55
imgDog.zImage = New zImage
imgDog\Image = LoadImage("doggy.bmp")
imgDog\Depth = 2
imgDog\X = 60
imgDog\Y = 60
;MAIN GAME LOOP
While Not KeyDown(1)
DrawImageByDepth()
Flip
Cls
Wend
End
;END MAIN GAME LOOP
Function DrawImageByDepth()
;VARS
Local iDepthLoop
;MAIN FUNCTION CODE
For iDepthLoop = 0 To MAXDEPTH
For tempImg.zImage = Each zImage
If tempImg\Depth = iDepthLoop Then DrawImage tempImg\Image, tempImg\X,tempImg\Y
Next
Next
End Function
|