ImagesCollide ?

Monkey Archive Forums/Monkey Discussion/ImagesCollide ?

Paul - Taiphoz(Posted 2013) [#1]
anyone got a method/function for doing this over all platforms yet ?

Iv seen games written on all platforms that seem to have pixel perfect collisions so just kinda wondering why we don't have it yet in monkey.

As I understand it at the moment the best bet is filling a shape with small 3*3 or 4*4 rects and checking points within them which does yield nice results but its still not pixel perfect.


Gerry Quinn(Posted 2013) [#2]
You could use ReadPixels() etc. to do collision logic.


therevills(Posted 2013) [#3]
I started some work on this when ReadPixels was first released:

http://www.monkeycoder.co.nz/Community/posts.php?topic=3488#36692


Paul - Taiphoz(Posted 2013) [#4]
have you done any kind of speed test's with this therevills, just wondering if you think its fast enough to be used with potentially hundreds of collidable objects on screen at one time.

Also are you planning to implement it in diddy with rotation and scaling ?


therevills(Posted 2013) [#5]
Nope havent done any speed tests, it was a prototype to see if it was possible in the first place.

The pixel reading is already in Diddy, but not the collisions. Within GameImage there is a ReadPixels boolean when you load in an image, which reads in the pixels into an array.

IMO 99% of the time you dont need to check collisions at the pixel level, just check hotspot areas on your sprites.


slenkar(Posted 2013) [#6]

IMO 99% of the time you dont need to check collisions at the pixel level, just check hotspot areas on your sprites.

yes


AdamRedwoods(Posted 2013) [#7]
fast enough to be used with potentially hundreds of collidable objects on screen at one time.

A brute force strategy isn't the best way to go about it. usually pixel perfect collision is accompanied by bounds checking first (circle-to-circle), that way you'll have fewer expensive checks per frame, and you don't have to obsess over optimization.