Check collision for image in the same layer??

BlitzMax Forums/BlitzMax Programming/Check collision for image in the same layer??

You will need to collect player to player collisions as you write to the playerlayer:

hitplayers=CollideImage(image1,x1,y1,0,layerPlayer,layerPlayer)

As CollideImage first tests for any read collisions b4 writing to the target layers.

This will only return a collision with the players already drawn so you want to be using some sort of object pointers to set a collided field like so:

For player=EachIn playerlist
	Local hitplayers:Object[]=CollideImage(x,y,frame,playerlayer,playerlayer,player)
	If hitplayers
		player.collided=True
		For hitplayer=EachIn hitplayers
			hitplayer.collided=True
		Next
	EndIf
Next