summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
authorJonas Bernard <public.jbernard@web.de>2021-04-26 22:20:38 +0200
committerJonas Bernard <public.jbernard@web.de>2021-04-26 22:20:38 +0200
commit518ad95f5a8d9406a8010c22537343493005dc01 (patch)
treed5728a22e87aa99e71a603c85461fc0fe69db89a /components
parent6fb5e447659efe06045b22a8cac7ef4d7a4445db (diff)
downloadldjam48-518ad95f5a8d9406a8010c22537343493005dc01.tar.gz
ldjam48-518ad95f5a8d9406a8010c22537343493005dc01.tar.bz2
ldjam48-518ad95f5a8d9406a8010c22537343493005dc01.zip
Sound effercts
Diffstat (limited to 'components')
-rw-r--r--components/button.gd6
-rw-r--r--components/button.tscn1
-rw-r--r--components/textreveal.gd2
3 files changed, 7 insertions, 2 deletions
diff --git a/components/button.gd b/components/button.gd
index 734e048..e3d12b8 100644
--- a/components/button.gd
+++ b/components/button.gd
@@ -5,7 +5,7 @@ export var text = "Hello, Button"
export var fixed_width = -1
signal on_click()
var is_hovered = false
-
+var disabled = false
#############
@@ -59,6 +59,9 @@ func _on_ButtonTest_input_event(viewport, event, shape_idx):
_set_pressed(true)
if not (event.button_index == BUTTON_LEFT):
return
+ if disabled:
+ return
+ BackgroundMusic.click_sound()
emit_signal("on_click")
func _set_all_textures(l, m, r):
@@ -77,6 +80,7 @@ func _set_pressed(press: bool):
func _on_ButtonTest_mouse_entered():
if not is_hovered:
_set_all_textures(left_hover, middle_hover, right_hover)
+ BackgroundMusic.hover_sound()
is_hovered = true
diff --git a/components/button.tscn b/components/button.tscn
index e3d784a..153f469 100644
--- a/components/button.tscn
+++ b/components/button.tscn
@@ -24,7 +24,6 @@ scale = Vector2( 4, 4 )
texture = ExtResource( 1 )
[node name="Hitbox" type="CollisionShape2D" parent="."]
-
[connection signal="input_event" from="." to="." method="_on_ButtonTest_input_event"]
[connection signal="mouse_entered" from="." to="." method="_on_ButtonTest_mouse_entered"]
[connection signal="mouse_exited" from="." to="." method="_on_ButtonTest_mouse_exited"]
diff --git a/components/textreveal.gd b/components/textreveal.gd
index 7b96eb3..9b5bfaa 100644
--- a/components/textreveal.gd
+++ b/components/textreveal.gd
@@ -32,6 +32,8 @@ func _process(delta):
var additional = int(t)
t -= additional
revealed += additional
+ if additional >= 1:
+ BackgroundMusic.type_sound()
text = to_render.substr(0, revealed)
rect_position = -rect_size / 2 + Vector2(xpos, ypos)
if to_render.length() <= revealed: