adding sound to menu

This commit is contained in:
Fabio 2024-08-20 18:01:25 +02:00
parent 5a278ca062
commit d255435c93
8 changed files with 190 additions and 7 deletions

View file

@ -25,6 +25,8 @@ var is_typing = true
var current_button_index = 0
var buttons = []
@onready var typing_sound_player = $TypingSoundPlayer
func _ready():
for hbox in $VBoxContainer/Buttons.get_children():
hbox.visible = false
@ -92,6 +94,10 @@ func _update_text() -> void:
if char_index < display_text.length():
current_text += display_text[char_index]
$VBoxContainer/VBoxContainer2/Label.text = current_text
if typing_sound_player and not typing_sound_player.is_playing():
typing_sound_player.play()
char_index += 1
await get_tree().create_timer(typing_speed).timeout
_update_text()
@ -99,6 +105,7 @@ func _update_text() -> void:
is_typing = false
_show_menu_options()
func _show_menu_options() -> void:
for hbox in $VBoxContainer/Buttons.get_children():
hbox.visible = true

View file

@ -3,6 +3,8 @@ extends CharacterBody2D
@export var sfx : AudioStreamPlayer2D
@export var sfx_large : AudioStreamPlayer2D
@onready var animation = $AnimationPlayer
@export var speed = 340
@export var gravity = 50
var jump_count = 1
@ -58,10 +60,13 @@ func get_input(delta):
if left and right:
input_direction = 0
elif left:
animation.play("RESET")
input_direction = -1
elif right:
animation.play("RESET")
input_direction = 1
else:
animation.play("idle")
input_direction = 0
velocity.x = input_direction * speed