ImagesCollide Replacement

Blitz3D Forums/Blitz3D Programming/ImagesCollide Replacement

maverick69(Posted 2007) [#1]
Probably some of you know that ImagesCollide command causes randomly MAVs on some hardware. I also expierence it on my new PC.

Does somebody of you have a function that replaces the ImagesCollide-Command (pixel perfect coliision). It should be possible using the LockBuffer/ReadPixelFast Commands. I know it would be much slower than the original Blitz3D Function, but that doesn't matter to me at the moment.


Sledge(Posted 2007) [#2]
Does the ImagesCollide example code from the help system also MAV? At any rate I wouldn't use ReadPixelFast as a replacement -- consign the image data to arrays (or banks) and compare those instead.


maverick69(Posted 2007) [#3]
No, it does only occur when a lot of images are loaded in. Its not my code, the "Memory Access Violation" (debug mode) does occur in the following lines. It only occurs on one of my pcs (latest directx and graphics drivers), and it occurs randomly.:
...
...

DrawImage Player\Sprite,Player\X,Player\Y,Player\Frame
DrawImage PlayerExtras\Sprite,PlayerExtras\X+temp_x,PlayerExtras\Y+temp_y,PlayerExtras\CurrentFrame
		
If ImagesCollide(Player\Sprite,Player\X,Player\Y,Player\Frame,PlayerExtras\Sprite,PlayerExtras\X+temp_x,PlayerExtras\Y+temp_y,PlayerExtras\CurrentFrame)

...
...


If you do a search on this forums it seems like a known bug of Blitz3D.

@Sledge: Do you have a code example? I don't know how to consign image data to an array or bank!


Sledge(Posted 2007) [#4]
it does only occur when a lot of images are loaded in

Have you tried dumping in-built animimages and using arrays of single images instead? Also (and I'm sure you've probaly done this but let's be thorough) do check that the type fields you pass to DrawImage are ints and that the requested image isn't of the bounds of the animstrip. I know you're probably right and it isn't working properly, but I can't discount the possibility that the 'working' PCs are actually failing improperly from my comfy sofa.

But yeah, before writing your own pixel collision routines it would be a good idea to see if you can keep ImagesCollide by losing animstrips.