Ramu.Math.distance - HermesPasser/Ramu GitHub Wiki

static float Ramu.Math.distance(gameObjectA, gameObjectB)

Parameters

  • GameObj gameObjectA: Rect that will be checked.
  • GameObj gameObjectB: Rect that will be checked.

Return

float: The distance between the parameters.

Description

Get the distance between two GameObjs.

You can test this snippet of code here.

let player = new GameObj(3, 6);
let enemy = new GameObj(6, 6);
let distance = Ramu.Math.distance(player, enemy);

if (distance < 2){
   let t = new Text('died', 10, 10, 100);
}