Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.

Categories

+11 votes

This is my code that has the turtles die, but I have another button that spawns in other turtles that I want to run simultaneously, but all the turtles in that one also die when this happens.

to create-explosion
      ask turtles [
        facexyz 0 0 0
        ifelse (pxcor) = 0 and (pycor) = 0 [
          set size size + 0.1
        ]
        [
          fd 0.1
        ]
      ]
    
      ask patches [
        if ticks > 500 [set pcolor 12 + random 16]
        if ticks > 550 [ set pcolor black]
      ]
      ask turtles [
        if ticks = 650 [die]]

 
  
asked in CSC 150 January201920 by (1 point)

3 Answers

+6 votes

This was a really helpful question thank you.

answered by (1 point)
+6 votes

Maybe create different breeds. And remember that ticks is the amount of time that passes in general. You might want to try age instead.

answered by (1 point)
+4

Different breeds is definitely the best way to go, but you could also use age with an if statement to have the turtles die when they get older.

+3

so how would I set up the breeds, like what would the code be for that? I cant seem to remember what that is.

+3 votes

Maybe using random 100 = 0 [die]
or age variable could work

answered by (1 point)
...