nearest object

nearest object

nearestobject

Details

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

Sensors > distance to

Description

 

This is a sensor tile. It can be used on its own to determine the nearest object on the entire map (cannot identify terrain only props and characters) or paired with a sensor which defines it further (for example nearest object that the player can see, or is in the detect sphere), or a standard object set  (does not work with custom object sets).

 

Example Code

 

WHEN [nearest object] DO [display][it][above]

or

WHEN [detect][nearest object] DO [display][it][above]

or

WHEN [all collidable objects][nearest object] DO [display][it][above]

Modifiers

from: By default it will use [me] as the point of origin, however you can change it with IWP to another object

WHEN [nearest object][from][IWP:door]

Other Uses

You can use nearest object to display and pick up objects rather than use interact and highlight.

 

WHEN [see][nearest object]

…WHEN [global][objset:collectables][contains][it] DO  [objvar:target][=][it]

…/…WHEN DO [display][objvar:target][above]

…/…WHEN [A][pressed] DO [pick up][objvar:target]

and create an object set that contains all the objects that you can pick up

WHEN [once] DO [objset:collectables][=][IWP:acorn][+][IWP:apple]

or add this to the brain of each object that can be collected

WHEN [once] DO [objset:collectables][increment by][me]

Comments are closed.

Powered by WordPress.com.

Up ↑

%d bloggers like this: