Gládio Cítrico

Ramu 0.7b doc

doc homeRamu

static bool Rect.hasNegativeValue(rect)

Parameters

Return

bool: True if it has a negative value or not x or y.

Description

Checks if a rect has a negative value x or y.

You can test this snippet of code here.

let gameObj = new GameObj(30, 50, 3, 2);
let txt = new Text('', 10, 10, 200);

gameObj.update = function(){
  this.y -= 2;
  
  const has = Rect.hasNegativeValueInXY(gameObj.toRect());
  txt.text = (has ? 'hasn\'t a negative value, y = ' : 'is inside, y = ') + this.y;
  if (has){
	  gameObj.destroy();
  }
};

Ramu.init();

See also Rect.hasNegativeValue and Rect.hasNegativeValueInWH.