This commit is contained in:
2022-12-10 23:31:25 +01:00
11 changed files with 92 additions and 14 deletions

View File

@@ -23,12 +23,14 @@ func interact(player):
if currentStashValue < maxStashValue:
currentStashValue += 1
player.clearInventory()
$AudioStreamPlayer2.play()
return
if player.getResource() == 1:
if currentPowderStashValue < maxPowderStashValue:
currentPowderStashValue += 1
player.clearInventory()
$AudioStreamPlayer2.play()
return
return
@@ -38,6 +40,6 @@ func shoot():
currentStashValue -= 1
currentPowderStashValue = 0
currentState = STATE.INACTIVE
print("pew")
$AudioStreamPlayer.play(0)
return true
return false

View File

@@ -22,6 +22,7 @@ func interact(player):
if (train.current_speed + refuelRate) <= maxSpeed:
train.current_speed += refuelRate
player.clearInventory()
$AudioStreamPlayer.play()
if train.current_speed >= maxSpeed:
train.current_speed = maxSpeed

View File

@@ -8,18 +8,20 @@ enum TYPE {AMMO, GUNPOWDER, COAL}
@export var currentType: TYPE
@export var audioClip : AudioStreamWAV
#------------Methods-------------#
func _ready():
var root = get_tree().root.get_child(0)
#root.ammo_pickup.connect(_on_signal_storing)
maxStashValue = 10
currentStashValue = 10
$AudioStreamPlayer.stream = audioClip
func interact(player):
if currentStashValue >= 1:
currentStashValue -= 1
player.fill_inventory(currentType)
$AudioStreamPlayer.play()
return
func _on_signal_storing():