Reputation: 27
I am working on a evacuation simulation, my turtles represent vehicles that leave an area, I currently do this by having the turtle die when it reaches the evacuation point, however I would like to have the vehicle return show up elsewhere on the map and return to the original point of origin (to pick up more passengers to evacuate) I am unsure hide turtle will do this properly, because I don't want the turtle interacted with while it is "off the map" Is there a way to do what I want?
Upvotes: 1
Views: 49
Reputation: 4168
Jon,
Two ways I can think of.
One would be to indeed make the vehicle hidden and then have all your normal interactions with turtles be instead with vehicles with [not hidden?]
. You could then refer to the hidden vehicles as vehicles with [hidden?]
. I'm assuming that you have a vehicles
breed, but if all turtles are vehicles, then it would be turtles with [not hidden?]
, etc.
But breeds suggests a different approach. Turtles can change their breeds, so if you have a breed vehicles
, then you could create another breed (say) inactive-vehicles
. When a vehicle has reached the evacuation point, you could ask it to set breed inactive-vehicle
and set hidden? true
. You could then continue to refer to active cars as vehicles
and these inactive cars as inactive-vehicles
. So, ask vehicles ...
will just refer to those that are still active. You could then ask inactive-vehicles
to go wherever you wish and then reset their breed to vehicles
. (I'm not sure inactive-vehicles
is great breed name, but it can be anything you want.)
Hope this helps, Charles
Upvotes: 2