added sounds to ui and game, prepared interaction with character

This commit is contained in:
Luca 2024-10-12 14:30:39 +02:00
parent b5ace17da9
commit 21d7cf417a
42 changed files with 450 additions and 155 deletions

View file

@ -27,9 +27,11 @@ func _process(delta: float) -> void:
save_timer += delta
func _on_menu_button_pressed() -> void:
SoundManager.play_sound_effect("ui_click", "UI")
menu_button_clicked.emit()
func _on_settings_button_pressed() -> void:
SoundManager.play_sound_effect("ui_click", "UI")
settings_button_clicked.emit()
# the save function should work as follows:
@ -38,10 +40,12 @@ func _on_settings_button_pressed() -> void:
# during holding down, the percentage increases until 100%
# a finishing animation plays, the game is saved and the countdown disappears again
func _on_save_button_button_down() -> void:
SoundManager.play_sound_effect("ui_click", "UI")
save_button_held_down = true
save_button_clicked.emit()
func _on_save_button_button_up() -> void:
SoundManager.play_sound_effect("ui_click", "UI")
save_button_held_down = false
save_button_released.emit()
save_timer = 0.0

View file

@ -1,5 +1,7 @@
extends Panel
signal on_interact
@onready var talk_a_texture: CompressedTexture2D = preload("res://assets/textures/Xbox Series/Vector/xbox_button_a.svg")
@onready var drag_texture: CompressedTexture2D = preload("res://assets/textures/Generic/Vector/generic_button_circle.svg")
@onready var thumbstick: TextureRect = %Thumbstick
@ -30,7 +32,8 @@ func _on_gui_input(event: InputEvent) -> void:
thumbstick.texture = talk_a_texture
if event is InputEventScreenTouch and pressed == true:
Input.action_press("ui_select")
SoundManager.play_sound_effect("ui_click", "UI")
on_interact.emit()
pressed = false
if event is InputEventScreenTouch and event.is_pressed():
@ -46,8 +49,10 @@ func _on_gui_input(event: InputEvent) -> void:
# visual thumbstick movement
var thumbstick_position: Vector2 = touch_position - thumbstick.size / 2.0
#var clamped_thumbstick_position = thumbstick_position.clampf(-40.0, 40.0)
thumbstick.position = thumbstick_position
var thumbstick_center: Vector2 = middle - thumbstick.size / 2.0
var clamped_thumbstick_position: Vector2 = thumbstick_position.clamp(thumbstick_center - Vector2(50.0, 50.0), thumbstick_center + Vector2(50.0, 50.0))
thumbstick.position = clamped_thumbstick_position
# actual value
var _delta: Vector2 = middle - touch_position