forward
is a turtle primitive that makes the asked turtle move forward on a straight patch for a provided number of units. The shorthand version of this primitive is fd
.
ask turtles [
forward 2
]
ask turtle 0 [
fd 3.35
]
Things to keep in mind when using forward
:
ask turtles [ forward speed]
.forward
primitive. right
or left
primitives or by using the set
primitive to change its heading
parameter. In the model example below, we have a road represented with gray patches and a car on the road. We use the set heading 90
code in our setup procedure to make sure that our car is heading towards east. Our model has 3 different go buttons: go-slow
, go-fast
, and go-back
, each doing exactly what the name suggests.
Once you mastered the forward
primitive, don't stop there. Check out the resources below to improve your NetLogo skills.
forward
primitive: