Ramu 0.7b doc
static bool
Rect.hasNegativeValue(rect)
Parameters
Rect
rect: Rect that will be checked.
Return
bool
: True if it has a negative value or not.
Description
Checks if a rect has a negative value.
You can test this snippet of code here.
let gameObj = new GameObj(30, 50, 3, 2);
let txt = new Text('', 10, 10, 200);
let has = false;
gameObj.update = function(){
this.y -= 2;
has = Rect.hasNegativeValue(gameObj.toRect());
txt.text = (has ? 'has a negative value, y = ' : 'hasn\'t a negative value, y = ') + this.y;
if (has){
gameObj.destroy();
}
};
Ramu.init();
See also Rect.hasNegativeValueInWH and Rect.hasNegativeValueInXY.