Create

From StarLogo Nova Wiki
Revision as of 15:30, 16 August 2023 by Admin (talk | contribs) (Marked this version for translation)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Other languages:
The create block

Creates the specified number of agents of the selected breed.

The created agents have the default shape, color, and size specified in their breed’s ‘Show Traits’ area. They are created in the middle of the terrain, on the ground (x = 0, y = 0, z = 0), with their headings evenly distributed, starting at 0 degrees (e.g. if 4 are created, one will start out facing toward each of the 4 sides of spaceland.)

create [_] [▼](s) is a code block part of the agents drawer.

Usage

create [_] [▼](s) is used to populate Spaceland with agents.

Syntax

The Create Each Do Block

Inputs in this block:

  1. a number in the socket
  2. a breed from the dropdown menu

Example

Create Example gif
Create Example code

When the setup button is pushed, The World first deletes all the agents, then uses the create block to to create 100 Turtles. Because the Turtles’ defaults have not been changed, they appear as white cubes of size 1. The Turtles also have the default location of (x= 0, y = 0, z = 0) when created, but then The World uses the scatter everyone block, which scatters the Turtles that now exist.

Nuances

An important difference between create [_] [▼](s) and create [_] [▼](s) each do is that create [_] [▼](s) each do allows a section of code to run individually for each agent that is created. create [_] [▼](s) only creates agents with the default traits in the center of Spaceland.

create [_] [▼](s) each do can be useful for randomizing traits and scattering agents without effecting others.

Related Blocks

Relevant Video Resources

Relevant Activities