Skip to content

Ramu.Utils.isOutOfCanvas

Douglas Lacerda edited this page Aug 4, 2018 · 5 revisions

static bool Ramu.Utils.isOutOfCanvas(gameObject)

Parameters

  • gameObject gameObject: gameObject to be checked.

Return

bool: Return true if the gameObj is outside of the canvas and false if not.

Description

Checks if the gameObject position (x,y) is out of the canvas.

You can test this snippet of code here.

if (Ramu.Utils.isOutOfCanvas(gameobj)){
   new Text('gameobj not', 10, 10, 100);
} else {
  new Text('gameobj is inside', 10, 10, 100);
}

let gameobj2 = new GameObj(-5, -5, 4, 4);
if (Ramu.Utils.isOutOfCanvas(gameobj2)){
   new Text('gameobj2 not', 10, 50, 100);
} else {
  new Text('gameobj2 is inside', 10, 50, 100);
}

See also Ramu.Utils.isInsideOfCanvas

Clone this wiki locally