Collisions

BlitzMax Forums/BlitzMax Beginners Area/Collisions

Telemental(Posted 2005) [#1]
I confess to being very confused by the new collision model in blitzmax. Since I prefer designing strategy game models to action games, my biggest concern is that I can't find a suitable explanation of how to manage a clickable/hoverable button (other than dealing with the screen coordinates). I'd really like to know how to check for a collision between an image and a 1x1 rect at mousex/y: any help is appreciated.


FlameDuck(Posted 2005) [#2]
Ripped from current project:
For Local i:TTarget = EachIn targetList
	ResetCollisions
	i.update
	i.draw
	If CollideRect (mx,my,1,1,1,0) And mh
		temp = i
	End If
Next
A TTarget is a base type that any objects can extend, mh is defined as the value of MouseHit() before entering into the loop. As the loop exits, temp will contain the LAST TTarget, (that was drawn) that collided.


Telemental(Posted 2005) [#3]
Neat! Thanks.