object.get_distance_to
This function returns the distance between the context object and the object supplied as an argument. The distance is measured in tenths of Forge units, i.e. a value of 10 represents 1.0 units in Forge.
This function returns number. Calling this function without storing its return value in a variable is an error.
Arguments
- other
An object in the game world.
Example
global.number[0] = current_object.get_distance_to(global.object[0]) if global.number[0] < 10 then -- -- The objects are close! -- end
Notes
If this function is called on a non-existent object, or passed a non-existent object as an argument, then it returns zero. In all other cases, the value it returns will be at least 1, because it rounds up.