Reworked main menu. Fixed projectiles bug
This commit is contained in:
+3
-6
@@ -5,9 +5,6 @@ const Passage = preload("res://game/passage.tscn")
|
||||
const PauseMenu = preload("res://menu/pause_menu.tscn")
|
||||
|
||||
|
||||
signal show_main_menu
|
||||
|
||||
|
||||
var _pause_menu: Node
|
||||
var _current_passage: Node
|
||||
|
||||
@@ -26,7 +23,7 @@ func _create_pause_menu() -> void:
|
||||
_pause_menu = PauseMenu.instantiate()
|
||||
add_child(_pause_menu)
|
||||
_pause_menu.continue_game.connect(_unpause_game)
|
||||
_pause_menu.show_main_menu.connect(_show_main_menu)
|
||||
_pause_menu.show_main_menu.connect(_show_title_screen)
|
||||
|
||||
|
||||
func _pause_game() -> void:
|
||||
@@ -39,6 +36,6 @@ func _unpause_game() -> void:
|
||||
_pause_menu.queue_free()
|
||||
|
||||
|
||||
func _show_main_menu() -> void:
|
||||
func _show_title_screen() -> void:
|
||||
get_tree().paused = false
|
||||
show_main_menu.emit()
|
||||
get_tree().change_scene_to_file("res://menu/title_screen.tscn")
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
extends Node
|
||||
|
||||
|
||||
const TitleScreen = preload("res://title_screen.tscn")
|
||||
const Game = preload("res://game/game.tscn")
|
||||
|
||||
|
||||
var _current_scene: Node
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
_show_main_menu()
|
||||
|
||||
|
||||
func _show_main_menu() -> void:
|
||||
if _current_scene != null:
|
||||
_current_scene.queue_free()
|
||||
|
||||
var scene := TitleScreen.instantiate()
|
||||
add_child(scene)
|
||||
scene.continue_game.connect(_continue_game)
|
||||
scene.new_game.connect(_new_game)
|
||||
scene.quit_game.connect(_quit)
|
||||
_current_scene = scene
|
||||
|
||||
|
||||
func _continue_game() -> void:
|
||||
print("continue_game")
|
||||
|
||||
|
||||
func _new_game() -> void:
|
||||
if _current_scene != null:
|
||||
_current_scene.queue_free()
|
||||
|
||||
var scene := Game.instantiate()
|
||||
add_child(scene)
|
||||
scene.show_main_menu.connect(_show_main_menu)
|
||||
_current_scene = scene
|
||||
|
||||
|
||||
func _quit() -> void:
|
||||
get_tree().quit()
|
||||
@@ -1 +0,0 @@
|
||||
uid://1aescybuf6gu
|
||||
@@ -1,6 +0,0 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://3slnk7fd7xm5"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://1aescybuf6gu" path="res://main.gd" id="1_80nbo"]
|
||||
|
||||
[node name="Game" type="Node"]
|
||||
script = ExtResource("1_80nbo")
|
||||
+11
-5
@@ -1,15 +1,21 @@
|
||||
extends Node
|
||||
extends Control
|
||||
|
||||
|
||||
signal show_main_menu
|
||||
signal back
|
||||
|
||||
|
||||
@onready var main_menu_button := $%MainMenuButton
|
||||
@onready var main_menu_button := $%BackButton
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
main_menu_button.grab_focus()
|
||||
|
||||
|
||||
func _on_main_menu_button_pressed() -> void:
|
||||
show_main_menu.emit()
|
||||
func _on_visibility_changed() -> void:
|
||||
if not is_node_ready(): return
|
||||
if not visible: return
|
||||
|
||||
main_menu_button.grab_focus()
|
||||
|
||||
func _on_back_button_pressed() -> void:
|
||||
back.emit()
|
||||
|
||||
+4
-3
@@ -39,12 +39,13 @@ text = "Ruslan Ignatov"
|
||||
layout_mode = 2
|
||||
alignment = 2
|
||||
|
||||
[node name="MainMenuButton" type="Button" parent="VBoxContainer/HBoxContainer"]
|
||||
[node name="BackButton" type="Button" parent="VBoxContainer/HBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
mouse_filter = 2
|
||||
theme = ExtResource("2_nidem")
|
||||
shortcut = SubResource("Shortcut_nidem")
|
||||
text = "Main Menu"
|
||||
text = "Back"
|
||||
|
||||
[connection signal="pressed" from="VBoxContainer/HBoxContainer/MainMenuButton" to="." method="_on_main_menu_button_pressed"]
|
||||
[connection signal="visibility_changed" from="." to="." method="_on_visibility_changed"]
|
||||
[connection signal="pressed" from="VBoxContainer/HBoxContainer/BackButton" to="." method="_on_back_button_pressed"]
|
||||
|
||||
+9
-1
@@ -1,4 +1,4 @@
|
||||
extends Node
|
||||
extends Control
|
||||
|
||||
|
||||
signal continue_game
|
||||
@@ -17,6 +17,14 @@ func _ready() -> void:
|
||||
_setup_neighbors()
|
||||
|
||||
|
||||
func _on_visibility_changed() -> void:
|
||||
if not is_node_ready(): return
|
||||
if not visible: return
|
||||
|
||||
_init_focus()
|
||||
_setup_neighbors()
|
||||
|
||||
|
||||
func _init_focus() -> void:
|
||||
if continue_button.disabled:
|
||||
start_button.grab_focus()
|
||||
|
||||
@@ -47,6 +47,7 @@ mouse_filter = 2
|
||||
theme = ExtResource("2_f5okj")
|
||||
text = "QUIT"
|
||||
|
||||
[connection signal="visibility_changed" from="." to="." method="_on_visibility_changed"]
|
||||
[connection signal="pressed" from="VBoxContainer/ContinueButton" to="." method="_on_continue_button_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/StartButton" to="." method="_on_start_button_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/OptionsButton" to="." method="_on_options_button_pressed"]
|
||||
|
||||
+12
-3
@@ -1,8 +1,8 @@
|
||||
extends Node
|
||||
extends Control
|
||||
|
||||
|
||||
signal show_credits
|
||||
signal show_main_menu
|
||||
signal back
|
||||
|
||||
|
||||
@onready var fullscreen_button := $%FullscreenCheckButton
|
||||
@@ -17,6 +17,15 @@ func _ready() -> void:
|
||||
_setup_neighbors()
|
||||
|
||||
|
||||
func _on_visibility_changed() -> void:
|
||||
if not is_node_ready(): return
|
||||
if not visible: return
|
||||
|
||||
_load_current_settings()
|
||||
_init_focus()
|
||||
_setup_neighbors()
|
||||
|
||||
|
||||
func _init_focus() -> void:
|
||||
fullscreen_button.grab_focus()
|
||||
|
||||
@@ -51,4 +60,4 @@ func _on_credits_button_pressed() -> void:
|
||||
|
||||
|
||||
func _on_back_button_pressed() -> void:
|
||||
show_main_menu.emit()
|
||||
back.emit()
|
||||
|
||||
@@ -80,6 +80,7 @@ theme = ExtResource("2_1tdpy")
|
||||
shortcut = SubResource("Shortcut_1tdpy")
|
||||
text = "Back"
|
||||
|
||||
[connection signal="visibility_changed" from="." to="." method="_on_visibility_changed"]
|
||||
[connection signal="toggled" from="VBoxContainer/OptionsGridContainer/FullscreenCheckButton" to="." method="_on_fullscreen_check_button_toggled"]
|
||||
[connection signal="item_selected" from="VBoxContainer/OptionsGridContainer/WindowFactorOptionButton" to="." method="_on_window_factor_option_button_item_selected"]
|
||||
[connection signal="pressed" from="VBoxContainer/HBoxContainer/CreditsButton" to="." method="_on_credits_button_pressed"]
|
||||
|
||||
+9
-1
@@ -1,4 +1,4 @@
|
||||
extends Node
|
||||
extends Control
|
||||
|
||||
|
||||
@onready var continue_button := $%ContinueButton
|
||||
@@ -14,6 +14,14 @@ func _ready() -> void:
|
||||
_setup_neighbors()
|
||||
|
||||
|
||||
func _on_visibility_changed() -> void:
|
||||
if not is_node_ready(): return
|
||||
if not visible: return
|
||||
|
||||
_init_focus()
|
||||
_setup_neighbors()
|
||||
|
||||
|
||||
func _init_focus() -> void:
|
||||
continue_button.grab_focus()
|
||||
|
||||
|
||||
@@ -41,5 +41,6 @@ mouse_filter = 2
|
||||
theme = ExtResource("2_vy7sn")
|
||||
text = "MAIN MENU"
|
||||
|
||||
[connection signal="visibility_changed" from="." to="." method="_on_visibility_changed"]
|
||||
[connection signal="pressed" from="VBoxContainer/ContinueButton" to="." method="_on_continue_button_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/MainMenuButton" to="." method="_on_main_menu_button_pressed"]
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
extends Control
|
||||
|
||||
|
||||
@onready var main_menu : Control = $MainMenu
|
||||
@onready var options : Control = $Options
|
||||
@onready var credits : Control = $Credits
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
_show_menu(main_menu)
|
||||
|
||||
|
||||
func _show_menu(menu: Control) -> void:
|
||||
var menus : Array[Control] = [ main_menu, options, credits ]
|
||||
|
||||
for m in menus:
|
||||
m.hide()
|
||||
|
||||
menu.show()
|
||||
|
||||
|
||||
func _on_main_menu_continue_game() -> void:
|
||||
print("continue")
|
||||
|
||||
|
||||
func _on_main_menu_new_game() -> void:
|
||||
get_tree().change_scene_to_file("res://game/game.tscn")
|
||||
|
||||
|
||||
func _on_main_menu_quit_game() -> void:
|
||||
get_tree().quit()
|
||||
|
||||
|
||||
func _on_main_menu_show_options() -> void:
|
||||
_show_menu(options)
|
||||
|
||||
|
||||
func _on_options_show_credits() -> void:
|
||||
_show_menu(credits)
|
||||
|
||||
|
||||
func _on_options_back() -> void:
|
||||
_show_menu(main_menu)
|
||||
|
||||
|
||||
func _on_credits_back() -> void:
|
||||
_show_menu(options)
|
||||
@@ -0,0 +1 @@
|
||||
uid://bqnepsuk13qo8
|
||||
@@ -0,0 +1,28 @@
|
||||
[gd_scene load_steps=5 format=3 uid="uid://2oavbr7oaihg"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bqnepsuk13qo8" path="res://menu/title_screen.gd" id="1_lxdol"]
|
||||
[ext_resource type="PackedScene" uid="uid://bxlccevt52y70" path="res://menu/main_menu.tscn" id="2_o0rbc"]
|
||||
[ext_resource type="PackedScene" uid="uid://btr60idiit4y7" path="res://menu/options.tscn" id="3_88gnj"]
|
||||
[ext_resource type="PackedScene" uid="uid://c3q3g2647qc27" path="res://menu/credits.tscn" id="4_w1y3c"]
|
||||
|
||||
[node name="TitleScreen" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 0
|
||||
script = ExtResource("1_lxdol")
|
||||
|
||||
[node name="MainMenu" parent="." instance=ExtResource("2_o0rbc")]
|
||||
layout_mode = 0
|
||||
|
||||
[node name="Options" parent="." instance=ExtResource("3_88gnj")]
|
||||
layout_mode = 0
|
||||
|
||||
[node name="Credits" parent="." instance=ExtResource("4_w1y3c")]
|
||||
layout_mode = 0
|
||||
|
||||
[connection signal="continue_game" from="MainMenu" to="." method="_on_main_menu_continue_game"]
|
||||
[connection signal="new_game" from="MainMenu" to="." method="_on_main_menu_new_game"]
|
||||
[connection signal="quit_game" from="MainMenu" to="." method="_on_main_menu_quit_game"]
|
||||
[connection signal="show_options" from="MainMenu" to="." method="_on_main_menu_show_options"]
|
||||
[connection signal="back" from="Options" to="." method="_on_options_back"]
|
||||
[connection signal="show_credits" from="Options" to="." method="_on_options_show_credits"]
|
||||
[connection signal="back" from="Credits" to="." method="_on_credits_back"]
|
||||
@@ -0,0 +1,28 @@
|
||||
[gd_scene load_steps=5 format=3 uid="uid://2oavbr7oaihg"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bqnepsuk13qo8" path="res://menu/title_screen.gd" id="1_lxdol"]
|
||||
[ext_resource type="PackedScene" uid="uid://bxlccevt52y70" path="res://menu/main_menu.tscn" id="2_o0rbc"]
|
||||
[ext_resource type="PackedScene" uid="uid://btr60idiit4y7" path="res://menu/options.tscn" id="3_88gnj"]
|
||||
[ext_resource type="PackedScene" uid="uid://c3q3g2647qc27" path="res://menu/credits.tscn" id="4_w1y3c"]
|
||||
|
||||
[node name="TitleScreen" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 0
|
||||
script = ExtResource("1_lxdol")
|
||||
|
||||
[node name="MainMenu" parent="." instance=ExtResource("2_o0rbc")]
|
||||
layout_mode = 0
|
||||
|
||||
[node name="Options" parent="." instance=ExtResource("3_88gnj")]
|
||||
layout_mode = 0
|
||||
|
||||
[node name="Credits" parent="." instance=ExtResource("4_w1y3c")]
|
||||
layout_mode = 0
|
||||
|
||||
[connection signal="continue_game" from="MainMenu" to="." method="_on_main_menu_continue_game"]
|
||||
[connection signal="new_game" from="MainMenu" to="." method="_on_main_menu_new_game"]
|
||||
[connection signal="quit_game" from="MainMenu" to="." method="_on_main_menu_quit_game"]
|
||||
[connection signal="show_options" from="MainMenu" to="." method="_on_main_menu_show_options"]
|
||||
[connection signal="back" from="Options" to="." method="_on_options_back"]
|
||||
[connection signal="show_credits" from="Options" to="." method="_on_options_show_credits"]
|
||||
[connection signal="back" from="Credits" to="." method="_on_credits_back"]
|
||||
+1
-1
@@ -13,7 +13,7 @@ config_version=5
|
||||
config/name="Scrap Frontier"
|
||||
config/description="Scroll Shooter"
|
||||
config/tags=PackedStringArray("2d")
|
||||
run/main_scene="uid://3slnk7fd7xm5"
|
||||
run/main_scene="uid://2oavbr7oaihg"
|
||||
config/features=PackedStringArray("4.5", "GL Compatibility")
|
||||
config/icon="res://icon.svg"
|
||||
|
||||
|
||||
@@ -1,64 +0,0 @@
|
||||
extends Node
|
||||
|
||||
|
||||
const MainMenu = preload("res://menu/main_menu.tscn")
|
||||
const Options = preload("res://menu/options.tscn")
|
||||
const Credits = preload("res://menu/credits.tscn")
|
||||
|
||||
|
||||
signal continue_game
|
||||
signal new_game
|
||||
signal quit_game
|
||||
|
||||
|
||||
var _current_scene: Node
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
_show_main_menu()
|
||||
|
||||
|
||||
func _show_main_menu() -> void:
|
||||
if _current_scene != null:
|
||||
_current_scene.queue_free()
|
||||
|
||||
var scene := MainMenu.instantiate()
|
||||
add_child(scene)
|
||||
scene.continue_game.connect(_continue_game)
|
||||
scene.new_game.connect(_new_game)
|
||||
scene.show_options.connect(_show_options)
|
||||
scene.quit_game.connect(_quit_game)
|
||||
_current_scene = scene
|
||||
|
||||
|
||||
func _continue_game() -> void:
|
||||
continue_game.emit()
|
||||
|
||||
|
||||
func _new_game() -> void:
|
||||
new_game.emit()
|
||||
|
||||
|
||||
func _quit_game() -> void:
|
||||
quit_game.emit()
|
||||
|
||||
|
||||
func _show_options() -> void:
|
||||
if _current_scene != null:
|
||||
_current_scene.queue_free()
|
||||
|
||||
var scene := Options.instantiate()
|
||||
add_child(scene)
|
||||
scene.show_main_menu.connect(_show_main_menu)
|
||||
scene.show_credits.connect(_show_credits)
|
||||
_current_scene = scene
|
||||
|
||||
|
||||
func _show_credits() -> void:
|
||||
if _current_scene != null:
|
||||
_current_scene.queue_free()
|
||||
|
||||
var scene := Credits.instantiate()
|
||||
add_child(scene)
|
||||
scene.show_main_menu.connect(_show_main_menu)
|
||||
_current_scene = scene
|
||||
@@ -1 +0,0 @@
|
||||
uid://b0etxb4if8lay
|
||||
@@ -1,6 +0,0 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://cdw82732vgub8"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://b0etxb4if8lay" path="res://title_screen.gd" id="1_v6p8y"]
|
||||
|
||||
[node name="TitleScreen" type="Node"]
|
||||
script = ExtResource("1_v6p8y")
|
||||
Reference in New Issue
Block a user