Umm...Trying to update tree collisions.Help!

Blitz3D Forums/Blitz3D Beginners Area/Umm...Trying to update tree collisions.Help!

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.

This is the code:
MakeTree(50,50)
MakeTree(128,128)

while not keydown(1);escape
;the while loop and movement code here, movements not the problem, so I dont put it here
	For tree.tree = Each tree
	DrawImage tree\image,tree\x,tree\y
	If ImagesCollide(boy\image,boy\x,boy\y,boy\frame,tree\image,tree\x,tree\y,0)
	IHitATree = 1
	EndIf
	If Not ImagesCollide(boy\image,boy\x,boy\y,boy\frame,tree\image,tree\x,tree\y,0)
	IHitATree = 0
	StopRight = 0
	StopUp = 0	
	StopDown = 0
 	StopLeft = 0
	EndIf
	Next

wend
Function MakeTree(x,y)
tree.tree = New tree
tree\x = x
tree\y = y
tree\image = pltree
End Function
Function TreeCollide()
	If IHitATree = 1
	If MoveRight = 1
	StopRight = 1
	EndIf

	If MoveLeft = 1
	StopLeft = 1
	EndIf

	If MoveUp = 1
	StopUp = 1
	EndIf

	If MoveDown = 1
	StopDown = 1
	EndIf
	IHitATree = 0
	EndIf
End Function


so, when I create two or more trees, only the latest one works for some reason.I can't collide with the old one????

stop vars are used to stop movement, I don't think thats the problem.

The boy and tree types:boy=player,tree=tree

Why does it only allow collisions with the new one???