Collision help! (possibly image-heavy)
BlitzMax Forums/BlitzMax Programming/Collision help! (possibly image-heavy)| 
 | ||
| Alright. So, I have two images. One image is the background:  (white is the walls, black is the floor) One is the player/object:  (white is the player/object, black is the mask) I am using the ImagesCollide2() function as my collision function. My problem is that the player/object always seems to get "hooked" onto the background:  I would like for it to not do this. Is there anyway I can get collision detection like this?:  Thanks in advance! | 
| 
 | ||
| Test with a different image that has no mask | 
| 
 | ||
| Test with a different image that has no mask Or make your specific function. You can optimize it a lot more than ImagesCollide2. Like pick 4 pixels (corners) from the level image. If any of them is a white pixel, then you have collision. If not, then check the 4 lines. Unless the movement is too fast and you have section that are too small into the level (so that a small piece can be "outside" of the player bounding box and the next frame it's 100% inside), then this should cover all your collision needs. :) | 
| 
 | ||
| Aren't bounding box tests quicker anyway? | 
| 
 | ||
| Aren't bounding box tests quicker anyway? I was thinking maybe his level has weird shapes, but the player is checked like a bounding box. Like a hybrid :-) | 
| 
 | ||
| Thanks everyone for your help! I decided to go with suggestion number one though:  Test with a different image that has no mask  All of my map tiles are square. The only weird-shaped tile is the player. | 
| 
 | ||
| All of my map tiles are square. The only weird-shaped tile is the player. Then Brucey's suggestion is actually the best performance-wise: AABBs (Axis-Aligned Bounding Box) | 
| 
 | ||
| Give your player image an alpha channel and alphablend it rather than maskblend? | 
| 
 | ||
|  Give your player image an alpha channel and alphablend it rather than maskblend?  I always give alpha channels and use alphablend. The "error" is still there. But it's fixed now with _Skully's suggestion. |