Cannon finished

This commit is contained in:
PfandBoss
2022-12-10 20:27:51 +01:00
parent fb942136bf
commit 977a451752
4 changed files with 7 additions and 7 deletions

View File

@@ -22,19 +22,17 @@ func interact(player):
if player.getResource() == 0: if player.getResource() == 0:
if currentStashValue < maxStashValue: if currentStashValue < maxStashValue:
currentStashValue += 1 currentStashValue += 1
player.clearInventory()
return return
return return
if player.getResource() == 1: if player.getResource() == 1:
if currentPowderStashValue < maxPowderStashValue: if currentPowderStashValue < maxPowderStashValue:
currentPowderStashValue += 1 currentPowderStashValue += 1
player.clearInventory()
return return
return return
func shoot(): func shoot():
if not CAN_ENGAGE:
return false
CAN_ENGAGE = false
create_tween().tween_callback(func(): CAN_ENGAGE = true).set_delay(2)
if currentStashValue >= 1 and currentPowderStashValue >= 1 and currentState == STATE.INACTIVE: if currentStashValue >= 1 and currentPowderStashValue >= 1 and currentState == STATE.INACTIVE:
currentState = STATE.SHOOTING currentState = STATE.SHOOTING
currentStashValue -= 1 currentStashValue -= 1

View File

@@ -36,3 +36,4 @@ func _process(delta):
print(train.current_speed) print(train.current_speed)

View File

@@ -34,9 +34,9 @@ func _set_currentStashValue(newValue):
func _get_currentStashValue(): func _get_currentStashValue():
return currentStashValue return currentStashValue
func _set_maxStashValue(newValue): func _set_maxStashValue(newValue):
currentStashValue = newValue maxStashValue = newValue
func _get_maxStashValue(): func _get_maxStashValue():
return currentStashValue return maxStashValue
func _set_level(newValue): func _set_level(newValue):
level = newValue level = newValue
func _get_level(): func _get_level():

View File

@@ -95,6 +95,7 @@ func getResource():
func clearInventory(): func clearInventory():
inventory = 0 inventory = 0
print("cleared")
walking = "walking" walking = "walking"
idle = "idle" idle = "idle"
$AnimatedSprite3D.play(idle)