summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
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: