Add some sounds

This commit is contained in:
Daniel Snider 2022-08-13 21:48:17 -07:00
parent d67fde5f0b
commit 8097a28cf8
4 changed files with 32 additions and 2 deletions

BIN
assets/sound/error_008.ogg Normal file

Binary file not shown.

View File

@ -0,0 +1,15 @@
[remap]
importer="ogg_vorbis"
type="AudioStreamOGGVorbis"
path="res://.import/error_008.ogg-8e35fe844dea9a9ba58ee9b53471dbce.oggstr"
[deps]
source_file="res://assets/sound/error_008.ogg"
dest_files=[ "res://.import/error_008.ogg-8e35fe844dea9a9ba58ee9b53471dbce.oggstr" ]
[params]
loop=false
loop_offset=0

View File

@ -1,7 +1,9 @@
[gd_scene load_steps=4 format=2]
[gd_scene load_steps=6 format=2]
[ext_resource path="res://scripts/power_station.gd" type="Script" id=1]
[ext_resource path="res://scenes/coin_machine.tscn" type="PackedScene" id=2]
[ext_resource path="res://assets/sound/forceField_004.ogg" type="AudioStream" id=3]
[ext_resource path="res://assets/sound/error_008.ogg" type="AudioStream" id=4]
[sub_resource type="CubeMesh" id=1]
@ -21,4 +23,12 @@ mesh = SubResource( 1 )
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.0275149, 0.721019, 1.58046 )
billboard = 1
[node name="sounds" type="Node" parent="."]
[node name="charge_get" type="AudioStreamPlayer" parent="sounds"]
stream = ExtResource( 3 )
[node name="error" type="AudioStreamPlayer" parent="sounds"]
stream = ExtResource( 4 )
[connection signal="coin_requirement_met" from="coin_machine" to="." method="_on_coin_machine_coin_requirement_met"]

View File

@ -32,4 +32,9 @@ func collect_charges_from_station():
func _on_coin_machine_coin_requirement_met(player):
assert(player.has_method("modify_inventory"))
player.modify_inventory("coins", collect_charges_from_station())
var charges = collect_charges_from_station()
player.modify_inventory("coins", charges)
if charges > 0:
$sounds/charge_get.play()
else:
$sounds/error.play()