Logo Bolo: a re-envisioning of the classic tank game by Stuart Cheshire in NetLogo
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

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