distance

fun distance(l1: Locatable?, l2: Locatable?): Int

Returns the amount of steps between two locations. This will return -1 if the amount of steps was indeterminate (for example, one of the locations wasn't loaded or they are both not on the same floor).



Note: this can be resource intensive, as it generates a path between these two locations to find the distance. This should only be used if you need an accurate measurement for the amount of steps required. Please consider using Tile.distanceTo for euclidean distance for the length of a straight line between these two points.

Return

The amount of steps required to traverse between these two locations.

Parameters

l1

Location A

l2

Location B

fun distance(l: Locatable?): Int

Returns the amount of steps between the player and the location. This will return -1 if the amount of steps was indeterminate (for example, one of the locations wasn't loaded or they are both not on the same floor).



Note: this can be resource intensive, as it generates a path between these two locations to find the distance. This should only be used if you need an accurate measurement for the amount of steps required. Please consider using Tile.distanceTo for euclidean distance for the length of a straight line between these two points.

Return

The amount of steps required to traverse between the player and the location.

Parameters

l

The destination