distanceBetween(source, target, world) → {number}
Find the distance between two display objects (like Sprites).
The optional world
argument allows you to return the result based on the Game Objects world
property,
instead of its x
and y
values. This is useful of the object has been nested inside an offset Group,
or parent Game Object.
Parameters
Name | Type | Argument | Default | Description |
---|---|---|---|---|
source | any | The Display Object to test from. | ||
target | any | The Display Object to test to. | ||
world | boolean | <optional> | false | Calculate the distance using World coordinates (true), or Object coordinates (false, the default) |
Returns
number -
The distance between the source and target objects.
- Source code: physics/arcade/World.js (Line 1918)
Please login to continue.