瀏覽代碼

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

master
Ben Kurtovic 13 年之前
父節點
當前提交
3511867b11
共有 2 個檔案被更改,包括 40 行新增8 行删除
  1. +28
    -0
      lobo.nlogo
  2. +12
    -8
      player.nls

+ 28
- 0
lobo.nlogo 查看文件

@@ -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 查看文件

@@ -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

Loading…
取消
儲存