Object Drawing Priority on overlap? example reques

BlitzMax Forums/BlitzMax Beginners Area/Object Drawing Priority on overlap? example reques

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

I though of a way but I can't come up on how I would make it happen, basicly all objects have different Order Int that then when you click on a square it should bring it up on top of the other because it changes it's order to 0...

headache...


Graphics 800,600

Global ARect:TRect[]
ARect=New TRect[3]

For Local i:Int = 0 To ARect.Length-1
	ARect[i]=New TRect
Next
ARect[0].Create(10,10,100,100)
ARect[0].SColor(10,10,100)
ARect[0].Order=0

ARect[1].Create(60,60,100,100)
ARect[1].SColor(60,60,100)
ARect[1].Order=1

ARect[2].Create(120,120,100,100)
ARect[2].SColor(120,120,100)
ARect[2].Order=2


Repeat
	For Local i2:Int=0 To ARect.Length-1 
		ARect[i2].Update()
	Next

Cls
	For Local i3:Int=0 To ARect.Length-1
		ARect[i3].Draw()
	Next
	
	SetColor(255,255,255)
	DrawText "A = "+ARect[0].Order,10,120
	DrawText "B = "+ARect[1].Order,10,140
	DrawText "C = "+ARect[2].Order,10,160


Flip
Until KeyHit(KEY_ESCAPE)
End


Type TRect
	' Vars
	Field X:Int, Y:Int
	Field Width:Int, Height:Int
	Field Order:Int
	Field r,g,b
	' Create
	Method Create( sx:Int, sy:Int, sw:Int, sh:Int )
		X=sx
		Y=sy
		Width=sw
		Height=sh
	End Method
	' Color
	Method SColor(r2,g2,b2)
		r=r2
		g=g2
		b=b2
	End Method
	' Draw
	Method Draw()
		SetColor(r,g,b)
		DrawRect X, Y, Width, Height
	End Method
	' Update
	Method Update()
		Local mx=MouseX()
		Local my=MouseY()
		If( mx < X + Width)And( mx > X)And( my < Y + Height )And( my > Y)Then
			If MouseHit(1)Then
				Order=0
			EndIf
		EndIf
	End Method
End Type


problem is how to make it draw by order number...?