How do you start a timer when two objects touch each other(without pixels ever overlapping (simply side by side))?

92 Views Asked by At

I'm using imgData to check if the alpha value of the pixels that surround any object = 255 ( and is therefore opaque) and then if so my moving objects (2 rectangles) cannot move into them (i.e. a wall). Because of this I can't use the rectsCollide function to check if they touch (because that requires an instance where the pixels overlap which my method does not allow). So in a 2 step question I need to know how to check if these two rectangles are touching and 2 if they are how to start a timer when they touch. I'll show you my jsfiddle so that you can see how I check for collision detection...

`http://jsfiddle.net/22r0L6a4/ 
0

There are 0 best solutions below