Quellcode durchsuchen

"C" cancels the current order, i.e., destroys our target

master
Ben Kurtovic vor 13 Jahren
Ursprung
Commit
3511867b11
2 geänderte Dateien mit 40 neuen und 8 gelöschten Zeilen
  1. +28
    -0
      lobo.nlogo
  2. +12
    -8
      player.nls

+ 28
- 0
lobo.nlogo Datei anzeigen

@@ -61,6 +61,18 @@ to go
keep-time
end

to player-fire
ask player [
fire
]
end

to player-cancel-order
ask player [
cancel-order
]
end

;; ================
;; Other procedures
;; ================
@@ -320,6 +332,22 @@ word \"(\" player-target-xcor \", \" player-target-ycor \")\"
1
12

BUTTON
109
235
230
268
Cancel Order
player-cancel-order
NIL
1
T
OBSERVER
NIL
C
NIL
NIL

@#$#@#$#@
WHAT IS IT?
-----------


+ 12
- 8
player.nls Datei anzeigen

@@ -8,12 +8,6 @@ to spawn-player
]
end

to player-fire
ask player [
fire
]
end

to do-player-logic
if mouse-inside? [
if mouse-down? and not mouse-was-down? [
@@ -32,10 +26,20 @@ to do-player-logic
decelerate friction * 5
]
if dist < 0.1 [
set is-accelerating? false
set player-has-target? false
cancel-target
]
] [
tank-facexy mouse-xcor mouse-ycor
]
end

to cancel-order
if player-has-target? [
cancel-target
]
end

to cancel-target
set is-accelerating? false
set player-has-target? false
end

Laden…
Abbrechen
Speichern