About Image over Image

Blitz3D Forums/Blitz3D Beginners Area/About Image over Image

Apollonius(Posted 2003) [#1]
I mean is there a Depth thing like example:

Image1=Depth(0)
Image2=Depth(-1)
Image 1 is over Image 2

Anything like that? or its the first image drawn is under second image?


Perturbatio(Posted 2003) [#2]
The last image you draw is displayed at the front.
You just need to sort out the order in which you draw your images.


Apollonius(Posted 2003) [#3]
Okay got another question, if I want a background image to be tiled all over my map like "grass"
is there an easy way or do i need to do
the layer things with
1,1,1,1,1,1,1,... and so on?


GameCoder(Posted 2003) [#4]
Check the "TileBlock" and the "TileImage" commands


Perturbatio(Posted 2003) [#5]
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



Apollonius(Posted 2003) [#6]
thanks..