Netlogo - How to move a turtle to top? -



Netlogo - How to move a turtle to top? -

for example, have 10 turtles @ 1 patch, how move specific turtle (turtle [color = red]) top? give thanks help!

i assume question "z-order" of turtles , "moving turtle top", means "have painted on top of other ones".

there 2 factors determine painting order in netlogo: breeds, , ẁho numbers. breeds have precedence. per the breeds section in programming guide:

the order in breeds declared order in layered in view. breeds defined later appear on top of breeds defined earlier;

turtles within same breed painted in order of creation (inferable in netlogo who number): older ones painted first, , newer ones painted on top.

the order of creation not modifiable, if nil in code holding on turtle references or who numbers (the latter beingness inadvisable anyway), utilize hatch create clone of turtle , kill old 1 immediately. example:

to setup clear-all create-ordered-turtles 10 [ set size 10 ] inquire turtles [ color = reddish ] [ hatch 1 die ] end

the lastly line bring reddish turtles (only 1 in case) on top.

what if can't that, reason? can utilize breeds:

breed [ background-turtles background-turtle ] breed [ foreground-turtles foreground-turtle ] setup clear-all create-ordered-background-turtles 10 [ set size 10 ] inquire turtles [ color = reddish ] [ set breed foreground-turtles ] end

you need many breeds want "layers" of turtles. may or may not convenient. best approach depend on specific utilize case.

netlogo

Comments

Popular posts from this blog

assembly - What is the addressing mode for ld, add, and rjmp instructions? -

vowpalwabbit - Interpreting Vowpal Wabbit results: Why are some lines appended by "h"? -

Is there a way to convert an HTML page styled with Bootstrap CSS into email-compatible html? -