Logo Bolo: a re-envisioning of the classic tank game by Stuart Cheshire in NetLogo
Nevar pievienot vairāk kā 25 tēmas
Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
|
- ;; lobo: Logo Bolo
- ;; (c) Ben Kurtovic, 2011
-
- to spawn-player
- create-tanks 1 [
- set player tank who
- set-tank-vars 0 true
- ]
- end
-
- to player-fire
- ask player [
- fire
- ]
- end
-
- to do-player-logic
- if mouse-inside? [
- if mouse-down? and not mouse-was-down? [
- set player-accelerate-for player-accelerate-for + 10
- if player-accelerate-for > 60 [
- set player-accelerate-for 60
- ]
- ]
- set mouse-was-down? mouse-down?
- let old-heading heading
-
- ; Slow down the tank a bit more than usual if we're
- ; very close to the mouse:
- let mouse-dist distancexy mouse-xcor mouse-ycor
- if mouse-dist < 3 [
- decelerate friction
- ]
- if mouse-dist < 1.5 [
- decelerate friction * 6.5
- ]
- if mouse-dist < 0.35 [
- set speed 0
- set player-accelerate-for 0
- ]
-
- facexy mouse-xcor mouse-ycor
- if subtract-headings old-heading heading > max-turn [
- set heading old-heading - max-turn
- ]
- if subtract-headings old-heading heading < 0 - max-turn [
- set heading old-heading + max-turn
- ]
- ]
-
- ifelse player-accelerate-for > 0 [
- set player-accelerate-for player-accelerate-for - 1
- set is-accelerating? true
- ] [
- set is-accelerating? false
- ]
- end
|