Add sound effect to Defeat UI

This commit is contained in:
Moe Poi ~ 2023-10-21 23:35:50 +07:00
parent 75a899d41c
commit 5bc8989892
9 changed files with 31 additions and 1 deletions

BIN
assets/audio/defeat.mp3 Normal file

Binary file not shown.

View file

@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://cqbl8resqabdd"
path="res://.godot/imported/defeat.mp3-f01dad10637c8b3d020ef767028b9b11.mp3str"
[deps]
source_file="res://assets/audio/defeat.mp3"
dest_files=["res://.godot/imported/defeat.mp3-f01dad10637c8b3d020ef767028b9b11.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

View file

@ -1,7 +1,8 @@
[gd_scene load_steps=3 format=3 uid="uid://wywjvwp7ausj"]
[gd_scene load_steps=4 format=3 uid="uid://wywjvwp7ausj"]
[ext_resource type="Texture2D" uid="uid://b3sb2q80p1fbd" path="res://assets/icons/defeat.png" id="1_bioyr"]
[ext_resource type="Script" path="res://scripts/ui/defeat.gd" id="1_sbbw3"]
[ext_resource type="AudioStream" uid="uid://cqbl8resqabdd" path="res://assets/audio/defeat.mp3" id="3_xsj1k"]
[node name="Defeat" type="Control"]
process_mode = 2
@ -49,4 +50,8 @@ size_flags_horizontal = 4
size_flags_vertical = 6
text = "Main Menu"
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
stream = ExtResource("3_xsj1k")
volume_db = -30.0
[connection signal="pressed" from="Panel/MarginContainer/VBoxContainer/MainMenu" to="." method="_on_main_menu_pressed"]

View file

@ -106,6 +106,7 @@ func on_enemy_entered_base(enemy):
if data['health'] < 1:
get_tree().paused = true
$CanvasLayer/Defeat.show()
$CanvasLayer/Defeat/AudioStreamPlayer.play()
func on_enemy_reward(value: int):
data['resource'] += value

View file

@ -105,6 +105,7 @@ func on_enemy_entered_base(enemy):
if data['health'] < 1:
get_tree().paused = true
$CanvasLayer/Defeat.show()
$CanvasLayer/Defeat/AudioStreamPlayer.play()
func on_enemy_reward(value: int):
data['resource'] += value

View file

@ -105,6 +105,7 @@ func on_enemy_entered_base(enemy):
if data['health'] < 1:
get_tree().paused = true
$CanvasLayer/Defeat.show()
$CanvasLayer/Defeat/AudioStreamPlayer.play()
func on_enemy_reward(value: int):
data['resource'] += value

View file

@ -105,6 +105,7 @@ func on_enemy_entered_base(enemy):
if data['health'] < 1:
get_tree().paused = true
$CanvasLayer/Defeat.show()
$CanvasLayer/Defeat/AudioStreamPlayer.play()
func on_enemy_reward(value: int):
data['resource'] += value

View file

@ -105,6 +105,7 @@ func on_enemy_entered_base(enemy):
if data['health'] < 1:
get_tree().paused = true
$CanvasLayer/Defeat.show()
$CanvasLayer/Defeat/AudioStreamPlayer.play()
func on_enemy_reward(value: int):
data['resource'] += value

View file

@ -105,6 +105,7 @@ func on_enemy_entered_base(enemy):
if data['health'] < 1:
get_tree().paused = true
$CanvasLayer/Defeat.show()
$CanvasLayer/Defeat/AudioStreamPlayer.play()
func on_enemy_reward(value: int):
data['resource'] += value