distance to

distance to



Kode wheel segment Sensors
Style Sensor and Number variable
Modifiers None
Primarily WHEN/DO Both
Pre-made brains that use it Enemy brains

Sensors > distance to


This is a sensor tile. It calculates the distance between one object and another. This number can be used in calculation, it can be used as a sensor for much larger distances than the other sensors can cope with, it can be displayed.

Its most common use is in the goblin brain, where the distance to their enemy makes a difference to the actions of the goblin – he moves toward the enemy or he attacks.



Example Code

WHEN [distance to] [IWP: door][<][3] DO [IWP:door][boolvar:inrange][=][true]

WHEN DO [display][distance to][IWP:door][above]







Other Uses

Because this sensor has no real limits to how far an object can be to register it is very useful for managing brain activity in whole scenes. You can use the distance to sensor to control what will be created, what is visible and what brains are active. So whole villages can be created and destroyed depending on the position of the player and their distance to the scene. Brains can be turned off so they do not interfere with the action until the player is in the correct position on your map.

Comments are closed.

Website Powered by WordPress.com.

Up ↑

%d bloggers like this: