Logo Bolo: a re-envisioning of the classic tank game by Stuart Cheshire in NetLogo
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 rivejä
911 B

  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 fire-bullet
  11. hatch-bullets 1 [
  12. set max-travel-distance 8
  13. set shooter [who] of myself
  14. set speed 1
  15. set travel-distance 0
  16. set color white
  17. set shape "bullet"
  18. set size 0.5
  19. ; Bullets shouldn't travel perfectly straight:
  20. lt random 10
  21. rt random 10
  22. ]
  23. end
  24. to do-bullet-logic
  25. fd speed
  26. set travel-distance travel-distance + speed
  27. if travel-distance > max-travel-distance [
  28. die
  29. ]
  30. let mxcor xcor
  31. let mycor ycor
  32. let is-close-enough false
  33. let target min-one-of (turtles-here with [breed = tanks]) [distancexy mxcor mycor]
  34. if target != nobody [
  35. ask target [
  36. if distancexy mxcor mycor < 0.65 [
  37. set is-close-enough true
  38. shot-at
  39. ]
  40. ]
  41. ]
  42. if is-close-enough [
  43. die
  44. ]
  45. end