Derek Wong
Derek Wong

Reputation: 11

How can you assign a variable in one turtle to a variable in another turtle?

I'm trying to have turtles go around and eat each other. I have a variable that tracks each of their energy. I want it so that when a turtle eats another turtle the energy gained by the first turtle is based off of the energy of the second turtle. Is this possible? If so, how do you do that?

Upvotes: 0

Views: 197

Answers (1)

JenB
JenB

Reputation: 17678

It would be helpful if you included the code you already have. But you will need a statement something like:

ask this-turtle [ set energy energy + [energy] of that-turtle ]

Upvotes: 1

Related Questions