Logo Bolo: a re-envisioning of the classic tank game by Stuart Cheshire in NetLogo
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

bullet.nls 621 B

1234567891011121314151617181920212223242526272829303132333435
  1. ;; lobo: Logo Bolo
  2. ;; (c) Ben Kurtovic, 2011
  3. breed [bullets bullet]
  4. bullets-own [
  5. max-travel-distance
  6. shooter
  7. speed
  8. travel-distance
  9. ]
  10. to do-bullet-logic
  11. fd speed
  12. set travel-distance travel-distance + speed
  13. if travel-distance > max-travel-distance [
  14. die
  15. ]
  16. let mxcor xcor
  17. let mycor ycor
  18. let is-close-enough false
  19. let target min-one-of (turtles-here with [breed = tanks]) [distancexy mxcor mycor]
  20. if target != nobody [
  21. ask target [
  22. if distancexy mxcor mycor < 0.65 [
  23. set is-close-enough true
  24. shot-at myself
  25. ]
  26. ]
  27. ]
  28. if is-close-enough [
  29. die
  30. ]
  31. end