What it does
game.getDistanceTo reads DistanceTo on a game object. It takes otherId.
Signature
game.getDistanceTo(otherId)Arguments
otherId
Example · generated
function update(dt) { const distanceTo = game.getDistanceTo('main');}game.getDistanceTo is called with values of the shape its signature asks for. The code sits in update(dt), which the engine calls every frame: dt is the time since the last one, in seconds.