quality update and sound

This commit is contained in:
2024-01-26 18:28:18 +01:00
parent 6c30e59eaa
commit e31fd502ae
30 changed files with 232 additions and 14 deletions

View File

@@ -1,5 +1,7 @@
extends Node
signal level_switched
@onready var transition: CanvasLayer = $Transition
@export var levels: Array[PackedScene]
@@ -12,17 +14,19 @@ func _ready() -> void:
progress_save.load(PROGRESS_SAVE_PATH)
func next_level() -> void:
level_pointer += 1
if level_pointer < levels.size():
transition.show()
get_tree().paused = true
await get_tree().create_timer(1).timeout
get_tree().change_scene_to_packed(levels[level_pointer])
await get_tree().create_timer(2).timeout
level_switched.emit()
get_tree().paused = false
transition.hide()
else:
get_tree().change_scene_to_file("res://scenes/gui/menus/game_finished.tscn")
level_switched.emit()
level_pointer += 1
func start_last_level() -> void:
pass

View File

@@ -0,0 +1,15 @@
extends Node
@onready var soundeffect: SoundEffect = $SoundEffect
func _ready() -> void:
_on_level_switched()
LevelManager.level_switched.connect(_on_level_switched)
func _on_level_switched() -> void:
print(get_tree().current_scene.name)
match get_tree().current_scene.name:
"MainMenu":
soundeffect.play_key("main")
"LVL1":
soundeffect.play_key("lvl1")

View File

@@ -42,7 +42,7 @@ func uncapture_mouse() -> void:
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
func _input(event: InputEvent) -> void:
if event.is_action_pressed("pause"):
if event.is_action_pressed("pause") && !get_tree().current_scene is MainMenu:
show_pause_menu()
func toggle_fullscreen() -> void: