Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (these values were different)
- game_objectA.sprite.getBounds().x
- 285
- game_objectA.sprite.x
- 180
- solution I did, but it may be slow I hacked together was making my own rectangle collision detection functions, here it is:
- function intersectRect(s1, s2) {
- var r1={};
- var r2={};
- r1.top = s1.y;
- r1.left = s1.x;
- r1.right = s1.x+s1.width;
- r1.bottom = s1.y+s1.height;
- r2.top = s2.y;
- r2.left = s2.x;
- r2.right = s2.x+s2.width;
- r2.bottom = s2.y+s2.height;
- return !( r2.left > r1.right ||
- r2.right < r1.left ||
- r2.top > r1.bottom ||
- r2.bottom < r1.top);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement