diff --git a/Main Menu.gd b/Main Menu.gd index 27132c6..92230d1 100644 --- a/Main Menu.gd +++ b/Main Menu.gd @@ -4,10 +4,30 @@ signal complete(option) func _on_new_game_button_pressed() -> void: - emit_signal('complete', 'new game') - return + emit_signal('complete', 'new game') + return func _on_quit_button_pressed() -> void: - emit_signal('complete', 'quit') - return + emit_signal('complete', 'quit') + return + + +func _on_Quit_Button_mouse_entered() -> void: + get_node("Menu-Select").play(0.0) + return + + +func _on_Credits_Button_mouse_entered() -> void: + get_node("Menu-Select").play(0.0) + return + + +func _on_Settings_Button_mouse_entered() -> void: + get_node("Menu-Select").play(0.0) + return + + +func _on_New_Game_Button_mouse_entered() -> void: + get_node("Menu-Select").play(0.0) + return diff --git a/Main Menu.tscn b/Main Menu.tscn index 01f1acd..794913b 100644 --- a/Main Menu.tscn +++ b/Main Menu.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=16 format=2] +[gd_scene load_steps=18 format=2] [ext_resource path="res://Sprites/Settings_Button_Normal.png" type="Texture" id=1] [ext_resource path="res://Sprites/Continue_Button_Hover.png" type="Texture" id=2] @@ -14,6 +14,8 @@ [ext_resource path="res://Sprites/Main_Menu_Background.png" type="Texture" id=12] [ext_resource path="res://Resources/Ash.tres" type="DynamicFontData" id=13] [ext_resource path="res://Main Menu.gd" type="Script" id=14] +[ext_resource path="res://Music/Interface/main-menu.mp3" type="AudioStream" id=15] +[ext_resource path="res://Sounds/Interface/menu-select.wav" type="AudioStream" id=16] [sub_resource type="DynamicFont" id=1] size = 20 @@ -120,5 +122,19 @@ margin_bottom = 15.0 texture_normal = ExtResource( 8 ) texture_hover = ExtResource( 11 ) +[node name="BGM" type="AudioStreamPlayer" parent="."] +pause_mode = 2 +stream = ExtResource( 15 ) +volume_db = -14.136 +autoplay = true + +[node name="Menu-Select" type="AudioStreamPlayer" parent="."] +stream = ExtResource( 16 ) +volume_db = -15.146 + +[connection signal="mouse_entered" from="Menu Items/VBoxContainer/CenterContainer/Menu Options/CenterContainer2/New Game Button" to="." method="_on_New_Game_Button_mouse_entered"] [connection signal="pressed" from="Menu Items/VBoxContainer/CenterContainer/Menu Options/CenterContainer2/New Game Button" to="." method="_on_new_game_button_pressed"] +[connection signal="mouse_entered" from="Menu Items/VBoxContainer/CenterContainer/Menu Options/CenterContainer3/Settings Button" to="." method="_on_Settings_Button_mouse_entered"] +[connection signal="mouse_entered" from="Menu Items/VBoxContainer/CenterContainer/Menu Options/CenterContainer4/Credits Button" to="." method="_on_Credits_Button_mouse_entered"] +[connection signal="mouse_entered" from="Menu Items/VBoxContainer/CenterContainer/Menu Options/CenterContainer5/Quit Button" to="." method="_on_Quit_Button_mouse_entered"] [connection signal="pressed" from="Menu Items/VBoxContainer/CenterContainer/Menu Options/CenterContainer5/Quit Button" to="." method="_on_quit_button_pressed"] diff --git a/Main.gd b/Main.gd index 9d139b2..7c115c1 100644 --- a/Main.gd +++ b/Main.gd @@ -6,56 +6,56 @@ export var world_path: String func _ready() -> void: - var splash_screen: Node = play_splash_screen() - yield(splash_screen, 'complete') - splash_screen = null + var splash_screen: Node = play_splash_screen() + yield(splash_screen, 'complete') + splash_screen = null - var main_menu: Node = play_main_menu() - yield(main_menu, 'complete') - free_connected_node(main_menu, 'main_menu_option') - main_menu = null - return + var main_menu: Node = play_main_menu() + yield(main_menu, 'complete') + free_connected_node(main_menu, 'main_menu_option') + main_menu = null + return func play_splash_screen() -> Node: - var splash_screen: Node = load(splash_screen_path).instance() - if splash_screen.connect('complete', self, 'free_connected_node', [splash_screen, 'free_connected_node']) != OK: - print('ERROR: Splash Screen "complete" signal already connected.') + var splash_screen: Node = load(splash_screen_path).instance() + if splash_screen.connect('complete', self, 'free_connected_node', [splash_screen, 'free_connected_node']) != OK: + print('ERROR: Splash Screen "complete" signal already connected.') - add_child(splash_screen) - return splash_screen + add_child(splash_screen) + return splash_screen func play_main_menu() -> Node: - var main_menu: Node = load(main_menu_path).instance() - if main_menu.connect('complete', self, 'main_menu_option') != OK: - print('ERROR: Main Menu "quit" signal already connected.') + var main_menu: Node = load(main_menu_path).instance() + if main_menu.connect('complete', self, 'main_menu_option') != OK: + print('ERROR: Main Menu "quit" signal already connected.') - add_child(main_menu) - return main_menu + add_child(main_menu) + return main_menu func main_menu_option(option: String) -> void: - if option == 'new game': - new_game() - elif option == 'quit': - quit_game() - return + if option == 'new game': + new_game() + elif option == 'quit': + quit_game() + return func free_connected_node(node: Node, connected_function: String) -> void: - node.disconnect('complete', self, connected_function) - remove_child(node) - node.queue_free() - return + node.disconnect('complete', self, connected_function) + remove_child(node) + node.queue_free() + return func new_game() -> void: - if get_tree().change_scene(world_path) != OK: - print('ERROR: Main failed to change scene to World.') - return + if get_tree().change_scene(world_path) != OK: + print('ERROR: Main failed to change scene to World.') + return func quit_game() -> void: - get_tree().quit() - return + get_tree().quit() + return diff --git a/Music/Interface/main-menu.mp3 b/Music/Interface/main-menu.mp3 new file mode 100644 index 0000000..fcab1e7 Binary files /dev/null and b/Music/Interface/main-menu.mp3 differ diff --git a/Music/Interface/main-menu.mp3.import b/Music/Interface/main-menu.mp3.import new file mode 100644 index 0000000..1ebd30c --- /dev/null +++ b/Music/Interface/main-menu.mp3.import @@ -0,0 +1,15 @@ +[remap] + +importer="mp3" +type="AudioStreamMP3" +path="res://.import/main-menu.mp3-aab7bca33746995bd827b1be5c058ba3.mp3str" + +[deps] + +source_file="res://Music/Interface/main-menu.mp3" +dest_files=[ "res://.import/main-menu.mp3-aab7bca33746995bd827b1be5c058ba3.mp3str" ] + +[params] + +loop=true +loop_offset=0 diff --git a/Music/Interface/splash.wav b/Music/Interface/splash.wav new file mode 100644 index 0000000..52b83cc Binary files /dev/null and b/Music/Interface/splash.wav differ diff --git a/Music/Interface/splash.wav.import b/Music/Interface/splash.wav.import new file mode 100644 index 0000000..fad9591 --- /dev/null +++ b/Music/Interface/splash.wav.import @@ -0,0 +1,21 @@ +[remap] + +importer="wav" +type="AudioStreamSample" +path="res://.import/splash.wav-56b87e9c12b1da11cd6e9b9b251c6bbe.sample" + +[deps] + +source_file="res://Music/Interface/splash.wav" +dest_files=[ "res://.import/splash.wav-56b87e9c12b1da11cd6e9b9b251c6bbe.sample" ] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop=false +compress/mode=0 diff --git a/Player.gd b/Player.gd index 2865a3b..3f7da1f 100644 --- a/Player.gd +++ b/Player.gd @@ -8,17 +8,17 @@ var velocity: Vector2 = Vector2.ZERO func _physics_process(delta) -> void: - var input_vector: Vector2 = Vector2.ZERO + var input_vector: Vector2 = Vector2.ZERO - input_vector.x = Input.get_action_strength('player_right') - Input.get_action_strength('player_left') - input_vector.y = Input.get_action_strength('player_down') - Input.get_action_strength('player_up') - input_vector = input_vector.normalized() + input_vector.x = Input.get_action_strength('player_right') - Input.get_action_strength('player_left') + input_vector.y = Input.get_action_strength('player_down') - Input.get_action_strength('player_up') + input_vector = input_vector.normalized() - if input_vector != Vector2.ZERO: - $AnimationTree.set('parameters/Idle/blend_position', input_vector) - velocity = velocity.move_toward(input_vector * MAX_SPEED, ACCELERATION * delta) - else: - velocity = velocity.move_toward(Vector2.ZERO, FRICTION * delta) + if input_vector != Vector2.ZERO: + $AnimationTree.set('parameters/Idle/blend_position', input_vector) + velocity = velocity.move_toward(input_vector * MAX_SPEED, ACCELERATION * delta) + else: + velocity = velocity.move_toward(Vector2.ZERO, FRICTION * delta) - velocity = move_and_slide(velocity) - return + velocity = move_and_slide(velocity) + return diff --git a/Sounds/Interface/menu-select.wav b/Sounds/Interface/menu-select.wav new file mode 100644 index 0000000..c3de148 Binary files /dev/null and b/Sounds/Interface/menu-select.wav differ diff --git a/Sounds/Interface/menu-select.wav.import b/Sounds/Interface/menu-select.wav.import new file mode 100644 index 0000000..f1df4ed --- /dev/null +++ b/Sounds/Interface/menu-select.wav.import @@ -0,0 +1,21 @@ +[remap] + +importer="wav" +type="AudioStreamSample" +path="res://.import/menu-select.wav-0365203aec745be2bb480afa89696728.sample" + +[deps] + +source_file="res://Sounds/Interface/menu-select.wav" +dest_files=[ "res://.import/menu-select.wav-0365203aec745be2bb480afa89696728.sample" ] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop=false +compress/mode=0 diff --git a/Splash Screen.gd b/Splash Screen.gd index c205b99..af414e3 100644 --- a/Splash Screen.gd +++ b/Splash Screen.gd @@ -4,26 +4,26 @@ signal complete func _ready() -> void: - # Fade in - if not $Tween.interpolate_property(self, 'self_modulate:a', 0, 1, 3, Tween.TRANS_LINEAR, Tween.EASE_IN): - print('ERROR: Splash Screen fade in animation has errors.') - if not $Tween.start(): - print('ERROR: Splash Screen fade in animation failed to start.') + # Fade in + if not $Tween.interpolate_property(self, 'self_modulate:a', 0, 1, 3, Tween.TRANS_LINEAR, Tween.EASE_IN): + print('ERROR: Splash Screen fade in animation has errors.') + if not $Tween.start(): + print('ERROR: Splash Screen fade in animation failed to start.') - yield($Tween, 'tween_completed') # Wait for fade in to complete + yield($Tween, 'tween_completed') # Wait for fade in to complete - # Fade out - if not $Tween.interpolate_property(self, 'self_modulate:a', 1, 0, 3, Tween.TRANS_LINEAR, Tween.EASE_OUT, 2): - print('ERROR: Splash Screen fade out animation has errors.') - if not $Tween.start(): - print('ERROR: Splash Screen fade out animation failed to start.') + # Fade out + if not $Tween.interpolate_property(self, 'self_modulate:a', 1, 0, 3, Tween.TRANS_LINEAR, Tween.EASE_OUT, 2): + print('ERROR: Splash Screen fade out animation has errors.') + if not $Tween.start(): + print('ERROR: Splash Screen fade out animation failed to start.') - yield($Tween, 'tween_completed') # Wait for fade out to complete - emit_signal('complete') - return + yield($Tween, 'tween_completed') # Wait for fade out to complete + emit_signal('complete') + return func _input(event: InputEvent) -> void: - if event.is_action_pressed('ui_accept'): - emit_signal('complete') - return + if event.is_action_pressed('ui_accept'): + emit_signal('complete') + return diff --git a/Splash Screen.tscn b/Splash Screen.tscn index 53f739c..1c464d2 100644 --- a/Splash Screen.tscn +++ b/Splash Screen.tscn @@ -1,7 +1,8 @@ -[gd_scene load_steps=3 format=2] +[gd_scene load_steps=4 format=2] [ext_resource path="res://Sprites/Splash_Screen.png" type="Texture" id=1] [ext_resource path="res://Splash Screen.gd" type="Script" id=2] +[ext_resource path="res://Music/Interface/splash.wav" type="AudioStream" id=3] [node name="Splash Screen" type="Sprite"] self_modulate = Color( 1, 1, 1, 0 ) @@ -10,3 +11,8 @@ centered = false script = ExtResource( 2 ) [node name="Tween" type="Tween" parent="."] + +[node name="BGM" type="AudioStreamPlayer" parent="."] +stream = ExtResource( 3 ) +volume_db = -15.146 +autoplay = true