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)

Mouse Drag Multiple 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 is an example of how to use the mouse to select and drag multiple turtles.

NETLOGO FEATURES

We use two breeds of turtle:

  • one to represent the agents being selected and dragged
  • one to represent the sides of the selection rectangle

You might think that the sides of the selection rectangle might better be represented by links. This would work, but it would have two drawbacks:

  1. A third breed of turtles would be required in order to represent the corners of the box (because links must have turtles to connect).

  2. It would work fine in a non-wrapping world, but in a wrapping world, a large selection rectangle would be drawn incorrectly because the sides would use the shortest possible path to connect the corners, and that path would sometimes wrap around the world boundaries.

RELATED MODELS

Mouse Drag One Example

(back to the NetLogo Models Library)