here is the jsfiddle i am working on so far : http://jsfiddle.net/TLYZS/
if you debug the code and check the collision function you can see that the collision is working fine when the user overlap with the other character wish in a fighting game the collision should not work like this :
- you can see that when i punch or kick the character from a little distance the collision detection function does not work even if you can see it on the screen that the user is punishing the character
how can i fix this collision detection function to make it work fine ?
function Collision(r1, r2) { return !(r1.x > r2.x + r2.w || r1.x + r1.w < r2.x || r1.y > r2.y + r2.h || r1.y + r1.h < r2.y); }
!(r1.x > r2.x + r2.w)
orr1.x < r2.x + r2.w
? ;) – Timothy Groote Apr 2 '14 at 7:55