diff --git a/game.gd b/game.gd index f93638d..9798f3f 100644 --- a/game.gd +++ b/game.gd @@ -11,6 +11,10 @@ var current_registry onready var music_player = get_node("music_player") onready var sfx_player = get_node("sfx_player") +var master_vol setget _on_set_master_vol +var music_vol setget _on_set_music_vol +var sfx_vol setget _on_set_sfx_vol + # transition node onready var transition = get_node("trans_layer/transition") @@ -46,6 +50,7 @@ const Scenes = { # MENUS MAIN_MENU = "res://menus/main_menu.tscn", + OPTIONS_MENU = "res://menus/options_menu.tscn", # GAME INTRO = "res://scenes/intro.tscn", @@ -84,6 +89,15 @@ func _on_game_started_set(v): _on_game_start() game_started = v +func _on_set_master_vol(v): + pass + +func _on_set_music_vol(v): + pass + +func _on_set_sfx_vol(v): + pass + func _on_game_start(): # all game state here @@ -94,13 +108,19 @@ func _on_game_start(): # public interface sorta -func switch_scene_to(scene_path): - transition.start_transition() - yield(transition, "on_transition_time") +func switch_scene_to(scene_path, fade = true): + + if fade: + transition.start_transition() + yield(transition, "on_transition_time") + SceneSwitcher.goto_scene(scene_path) - yield(transition, "on_transition_completed") - if SceneSwitcher.current_scene.has_method("on_scene_start"): - SceneSwitcher.current_scene.on_scene_start() + + if fade: + yield(transition, "on_transition_completed") + if SceneSwitcher.current_scene.has_method("on_scene_start"): + SceneSwitcher.current_scene.on_scene_start() + func _ready(): pass \ No newline at end of file diff --git a/menus/main_menu.gd b/menus/main_menu.gd index e032066..3727ba8 100644 --- a/menus/main_menu.gd +++ b/menus/main_menu.gd @@ -21,7 +21,7 @@ func _on_load_pressed(): pass func _on_options_pressed(): - pass + Game.switch_scene_to(Game.Scenes.OPTIONS_MENU, false) func _on_quit_pressed(): get_tree().quit() \ No newline at end of file diff --git a/menus/options_menu.gd b/menus/options_menu.gd new file mode 100644 index 0000000..695e45a --- /dev/null +++ b/menus/options_menu.gd @@ -0,0 +1,6 @@ +extends Control + +var from_scene_name + +func _ready(): + pass diff --git a/menus/options_menu.tscn b/menus/options_menu.tscn new file mode 100644 index 0000000..527fa41 --- /dev/null +++ b/menus/options_menu.tscn @@ -0,0 +1,21 @@ +[gd_scene load_steps=2 format=2] + +[ext_resource path="res://menus/options_menu.gd" type="Script" id=1] + +[node name="options_menu" type="Control" index="0"] + +anchor_left = 0.0 +anchor_top = 0.0 +anchor_right = 0.0 +anchor_bottom = 0.0 +margin_right = 40.0 +margin_bottom = 40.0 +rect_pivot_offset = Vector2( 0, 0 ) +rect_clip_content = false +mouse_filter = 0 +mouse_default_cursor_shape = 0 +size_flags_horizontal = 1 +size_flags_vertical = 1 +script = ExtResource( 1 ) + + diff --git a/scenes/intro.tscn b/scenes/intro.tscn index be492f0..ccb813c 100644 --- a/scenes/intro.tscn +++ b/scenes/intro.tscn @@ -5,7 +5,7 @@ [ext_resource path="res://dialog_layer.gd" type="Script" id=3] [ext_resource path="res://ui/dialog_box.tscn" type="PackedScene" id=4] -[node name="intro" type="Node2D" index="0"] +[node name="intro" type="Node2D"] script = ExtResource( 1 )