NetLogo banner

 Home
 Download
 Help
 Resources
 Extensions
 FAQ
 NetLogo Publications
 Contact Us
 Donate

 Models:
 Library
 Community
 Modeling Commons

 User Manuals:
 Web
 Printable
 Chinese
 Czech
 Farsi / Persian
 Japanese
 Spanish

  Donate

NetLogo Models Library:
Code Examples

(back to the library)

Halo Example

[screen shot]

If you download the NetLogo application, this model is included. You can also Try running it in NetLogo Web

WHAT IS IT?

This example shows how to give a turtle a "halo", to make it stand out. The halo travels with the turtle.

The same technique might be useful in other ways as well. For example, you might use it to show the radius a turtle can sense things in.

Also, in this example, the halo is a circle, but you could use any shape you can draw in the shapes editor. You could vary the size, color, and shape of the halos however you want, to make many different kinds of indicators.

THINGS TO NOTICE

Note that the watch command has a somewhat similar effect visually: it puts a "spotlight" on a turtle. But using the spotlight as an indicator is limited. You can only have one spotlight. You can't control the color of the spotlight. The size of the spotlight is determined by the size of the turtle being watched, and isn't otherwise adjustable. So if the spotlight isn't flexible enough for your needs, you may want to use the technique shown in this code example instead.

One thing the spotlight does that the technique in this code example can't do is darken everything outside the spotlight.

EXTENDING THE MODEL

Improve the buttons in the Interface tab that create and destroy halos to include sanity/safety checks. The button that creates halos shouldn't put a halo on a turtle that already has one; the button that destroys halos shouldn't blow up if there are no halos left.

NETLOGO FEATURES

Note the use of the tie primitive.

Note the use of an RGB color with an alpha value to make partially transparent halos.

RELATED MODELS

Label Position Example

(back to the NetLogo Models Library)