Collision problems with masked images.

BlitzMax Forums/BlitzMax Beginners Area/Collision problems with masked images.

TeaVirus(Posted 2005) [#1]
I'm having some trouble with collisions between masked images. With the code listed here the tank can overlap the tiles quite a bit without regestering a hit. I've tried without the rotation and still the results are bad. The only thing that seems to fix it is to load the images without masking them. Any ideas on what could be wrong?



Here are the images I'm using:





TeaVirus(Posted 2005) [#2]
Can anyone confirm if they have the same problem when running this code? I'm still not sure what I'm doing wrong so any help would be appreciated. Thanks!


tonyg(Posted 2005) [#3]
I'm having the same problem but after my system went pear-shaped last time I haven't made the collisions changes again.


Pax(Posted 2005) [#4]
Hi, I tried your code with win 2k and got the same problem. It is until the pointer is over the tile that the msg appears. About the solution, haven't got a clue :S


TeaVirus(Posted 2005) [#5]
Thanks for checking guys.

Hmm... Seems to work fine when using a single image instead of an anim image for the "ground" images. Possible bug in CollideImage?


skidracer(Posted 2005) [#6]
Found it, it's a bug with masked anim frames, if you can rebuild modules the fix is line65-68 of image.bmx in brl.mod/max2d.mod:
			Local window:TPixmap=pixmap.Window( x,y,cell_width,cell_height ).Copy()	
			image.frames[cell-first]=blitz2d_driver.CreateFrameFromPixmap( window,flags )
			image.masks[cell-first]=window



tonyg(Posted 2005) [#7]
Good stuff Skidracer. It works fine now.
Can we have this and the imagecollide 'timage' bugfix in a new official module?


TeaVirus(Posted 2005) [#8]
Thanks Skidracer! I'll try it out later when I get home.