Javascript Bindings on Ouya Error in cc.rectIntersectsRect()

Javascript Bindings on Ouya Error in cc.rectIntersectsRect()
0.0 0


I’m trying to get cocos2d-x to work on the Ouya. I am using the javascript bindings to some html5 code that I have.

The HTML5 code runs fine in the browser, and returns what I would expect.

However it is failing on the Ouya and I’m lost as to why this might be happening. I suspect that there may be an issue with the way the code is being interpreted by SpiderMonkey, but who knows…

var collisionRect = cc.rect(

for (var i = 0; i < objects.getObjects().length; i++) {
var obj = objects.getObjects()[i];
var rect = cc.rect(obj.x, obj.y, obj.width, obj.height);
var intersectsRect = cc.rectIntersectsRect(rect, collisionRect);

rectIntersectsRect is returning true when by my math it should not be

rectA - {x:224 y:352 width: 96 height:160}
rectB - {x:256 y:671 width: 25 height:35}
insersection = true

by my math rectA.y+rectA.height < rectB.y should evaluate to true, and therefore the intersection should be false. However it is evaluating to true.

Here’s the code in cc.rectINtersectsRect

cc.rectIntersectsRect = function( rectA, rectB )
var bool = ! ( rectA.x > rectB.x + rectB.width ||
rectA.x + rectA.width < rectB.x ||
rectA.y > rectB.y rectB.height ||
rectA.height < rectB.y );
return bool;

Anyways I’m totally stumped as to what’s going on here.

Any help would be appreciated.