Breed won't appear on interface - Netlogo

working on a project for varsity here and we're working in Netlogo. Basically i have a function that spawns medkits every 15 ticks, yet they don't appear on the screen. The code is basically as follows:

breed[kits kit]
kits-own [qtEner]

to Go
spawn-kits
end


to spawn-kits
  if (remainder ticks intervalo) = 0
  [
    create-kits 1
    [
      set nrg qtEner
      set shape "medkit"
      set size 1.5
      set heading 0
      setxy random-xcor random-ycor
      output-type "Created"
    ]
  ]
end

Would appreciate some feedback. Thanks a million.

1 answer

  • answered 2017-11-12 21:07 Luke C

    What is your setup procedure? Do you have a tick somewhere to increment your counter?

    Also, I think you may want set qtEner nrg if you want the kits to have their kits-own variable independently set.

    This works for me:

    breed[kits kit]
    kits-own [qtEner]
    
    to setup
      ca
      reset-ticks
    end
    
    to Go
      spawn-kits
      tick
    end
    
    
    to spawn-kits
      if (remainder ticks 10) = 0
      [
        create-kits 1
        [
          set qtEner 5
          set shape "circle"
          set size 1.5
          set heading 0
          setxy random-xcor random-ycor
          print "Created"
        ]
      ]
    end