Leo - Train pickup function

This commit is contained in:
2022-12-10 20:44:43 +01:00
parent 977a451752
commit 8ef7cc2507
2 changed files with 20 additions and 5 deletions

View File

@@ -34,27 +34,27 @@ grow_horizontal = 2
grow_vertical = 2
[node name="Start" type="Button" parent="VBoxContainer"]
offset_right = 72.0
offset_right = 87.0
offset_bottom = 31.0
text = "Start
"
[node name="Tutorial" type="Button" parent="VBoxContainer"]
offset_top = 35.0
offset_right = 72.0
offset_right = 87.0
offset_bottom = 66.0
text = "Tutorial
"
[node name="Settings" type="Button" parent="VBoxContainer"]
offset_top = 70.0
offset_right = 72.0
offset_right = 87.0
offset_bottom = 101.0
text = "Volume:"
[node name="VolSlider" type="HSlider" parent="VBoxContainer"]
offset_top = 105.0
offset_right = 72.0
offset_right = 87.0
offset_bottom = 121.0
min_value = -30.0
max_value = 0.0
@@ -62,11 +62,14 @@ script = ExtResource("2_h85ei")
[node name="Quit" type="Button" parent="VBoxContainer"]
offset_top = 125.0
offset_right = 72.0
offset_right = 87.0
offset_bottom = 156.0
text = "Quit"
[node name="FullScreen" type="Button" parent="VBoxContainer"]
offset_top = 160.0
offset_right = 87.0
offset_bottom = 191.0
text = "Fullscreen"
[connection signal="pressed" from="VBoxContainer/Start" to="." method="_on_start_pressed"]

View File

@@ -33,3 +33,15 @@ func is_dead():
game_over.emit()
return true
return false
func on_pickup(type, amount):
for s in STORAGES:
if s.currentType == type:
if s.currentStashValue + amount <= s.maxStashValue:
s.currentStashValue += amount
else:
s.currentStashValue = s.maxStashValue
return