From e98c5c751c62baa01d51312b151439fa0e519d5d Mon Sep 17 00:00:00 2001 From: Ruslan Ignatov Date: Thu, 23 Oct 2025 15:05:11 +0300 Subject: [PATCH] Fixed button colors --- game/entities/ship.gd | 8 ++++++-- game/entities/weapon.gd | 2 ++ game/game.gd | 20 +++++++++++++------- images/menu_button.tres | 12 ++++++------ images/menu_buttons.png | 4 ++-- main.gd | 9 +++++++-- menu/credits.gd | 1 + menu/credits.tscn | 1 + menu/main_menu.gd | 2 ++ menu/main_menu.tscn | 6 ++++++ menu/options.gd | 1 + menu/options.tscn | 4 ++++ menu/pause_menu.gd | 1 + menu/pause_menu.tscn | 2 ++ title_screen.gd | 13 ++++++++++--- 15 files changed, 64 insertions(+), 22 deletions(-) diff --git a/game/entities/ship.gd b/game/entities/ship.gd index c92cd1a..a9ff634 100644 --- a/game/entities/ship.gd +++ b/game/entities/ship.gd @@ -1,5 +1,9 @@ extends CharacterBody2D + +const Weapon = preload("res://game/entities/weapon.tscn") + + @export var size : Vector2: set(value): size = value @@ -28,8 +32,8 @@ func _ready() -> void: $Sprite2D.texture = texture var weapons_by_offset := { - 8: preload("res://game/entities/weapon.tscn").instantiate(), - -8: preload("res://game/entities/weapon.tscn").instantiate(), + 8: Weapon.instantiate(), + -8: Weapon.instantiate(), } for offset : int in weapons_by_offset: var weapon : Node2D = weapons_by_offset[offset] diff --git a/game/entities/weapon.gd b/game/entities/weapon.gd index ff1fd71..a8683d0 100644 --- a/game/entities/weapon.gd +++ b/game/entities/weapon.gd @@ -15,6 +15,7 @@ extends Node2D @export var cooling_down_rate : int @export var explosion_size : int + @onready var _firerate_delay : float = 60.0 / firerate @onready var _firerate_delay_tenth : float = _firerate_delay / 10 @@ -22,6 +23,7 @@ extends Node2D @onready var _reload_time_tenth : float = reload_time / 10.0 + var _firerate_cooldown : float var _reload_cooldown : float diff --git a/game/game.gd b/game/game.gd index 4847c82..a3ebff3 100644 --- a/game/game.gd +++ b/game/game.gd @@ -1,37 +1,43 @@ extends Node + +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 func _ready() -> void: - _current_passage = load("res://game/passage.tscn").instantiate() + _current_passage = Passage.instantiate() add_child(_current_passage) - + func _input(event: InputEvent) -> void: if event.is_action_pressed("pause"): _pause_game() - + func _create_pause_menu() -> void: - _pause_menu = load("res://menu/pause_menu.tscn").instantiate() + _pause_menu = PauseMenu.instantiate() add_child(_pause_menu) _pause_menu.continue_game.connect(_unpause_game) _pause_menu.show_main_menu.connect(_show_main_menu) - + func _pause_game() -> void: get_tree().paused = true _create_pause_menu.call_deferred() - + func _unpause_game() -> void: get_tree().paused = false _pause_menu.queue_free() - + func _show_main_menu() -> void: get_tree().paused = false diff --git a/images/menu_button.tres b/images/menu_button.tres index edc0611..5ed3d6e 100644 --- a/images/menu_button.tres +++ b/images/menu_button.tres @@ -37,7 +37,7 @@ texture_margin_left = 8.0 texture_margin_top = 8.0 texture_margin_right = 8.0 texture_margin_bottom = 8.0 -region_rect = Rect2(48, 0, 48, 32) +region_rect = Rect2(0, 0, 48, 32) [sub_resource type="StyleBoxTexture" id="StyleBoxTexture_tkt1b"] content_margin_left = 10.0 @@ -65,14 +65,14 @@ region_rect = Rect2(0, 32, 48, 32) [resource] default_font = ExtResource("1_hwy2u") -Button/colors/font_color = Color(0.875, 0.875, 0.875, 1) -Button/colors/font_disabled_color = Color(0.8745098, 0.8745098, 0.8745098, 1) -Button/colors/font_focus_color = Color(0.95, 0.95, 0.95, 1) -Button/colors/font_hover_color = Color(0.95, 0.95, 0.95, 1) +Button/colors/font_color = Color(1, 1, 1, 1) +Button/colors/font_disabled_color = Color(1, 1, 1, 1) +Button/colors/font_focus_color = Color(1, 1, 1, 1) +Button/colors/font_hover_color = Color(1, 1, 1, 1) Button/colors/font_hover_pressed_color = Color(1, 1, 1, 1) Button/colors/font_outline_color = Color(0, 0, 0, 1) Button/colors/font_pressed_color = Color(1, 1, 1, 1) -Button/colors/icon_disabled_color = Color(1, 1, 1, 0.4) +Button/colors/icon_disabled_color = Color(1, 1, 1, 1) Button/colors/icon_focus_color = Color(1, 1, 1, 1) Button/colors/icon_hover_color = Color(1, 1, 1, 1) Button/colors/icon_hover_pressed_color = Color(1, 1, 1, 1) diff --git a/images/menu_buttons.png b/images/menu_buttons.png index c184dc8..f885fc2 100644 --- a/images/menu_buttons.png +++ b/images/menu_buttons.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9c787674a54508f14aab8a066094445c0de67ef09b9f39b15380041840139e81 -size 806 +oid sha256:35b93f06bd43cb501468cb9e6aea60bd281e59a06d805d4ee2e49c0e06b9da20 +size 808 diff --git a/main.gd b/main.gd index 27678b6..2c4a308 100644 --- a/main.gd +++ b/main.gd @@ -1,5 +1,10 @@ extends Node + +const TitleScreen = preload("res://title_screen.tscn") +const Game = preload("res://game/game.tscn") + + var _current_scene: Node @@ -11,7 +16,7 @@ func _show_main_menu() -> void: if _current_scene != null: _current_scene.queue_free() - var scene : Node = load("res://title_screen.tscn").instantiate() + var scene := TitleScreen.instantiate() add_child(scene) scene.continue_game.connect(_continue_game) scene.new_game.connect(_new_game) @@ -27,7 +32,7 @@ func _new_game() -> void: if _current_scene != null: _current_scene.queue_free() - var scene : Node = load("res://game/game.tscn").instantiate() + var scene := Game.instantiate() add_child(scene) scene.show_main_menu.connect(_show_main_menu) _current_scene = scene diff --git a/menu/credits.gd b/menu/credits.gd index e071c54..c760895 100644 --- a/menu/credits.gd +++ b/menu/credits.gd @@ -1,5 +1,6 @@ extends Node + signal show_main_menu diff --git a/menu/credits.tscn b/menu/credits.tscn index 6a9025d..96b751f 100644 --- a/menu/credits.tscn +++ b/menu/credits.tscn @@ -42,6 +42,7 @@ alignment = 2 [node name="MainMenuButton" 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" diff --git a/menu/main_menu.gd b/menu/main_menu.gd index 4e13d4f..04fa7af 100644 --- a/menu/main_menu.gd +++ b/menu/main_menu.gd @@ -1,10 +1,12 @@ extends Node + signal continue_game signal new_game signal quit_game signal show_options + func _ready() -> void: _init_focus() _setup_neighbors() diff --git a/menu/main_menu.tscn b/menu/main_menu.tscn index 67c6282..bb7f1ec 100644 --- a/menu/main_menu.tscn +++ b/menu/main_menu.tscn @@ -19,25 +19,31 @@ offset_bottom = 236.0 [node name="ContinueButton" type="Button" parent="VBoxContainer"] unique_name_in_owner = true layout_mode = 2 +mouse_filter = 2 theme = ExtResource("2_f5okj") disabled = true +button_mask = 0 text = "CONTINUE" [node name="StartButton" type="Button" parent="VBoxContainer"] unique_name_in_owner = true layout_mode = 2 +mouse_filter = 2 theme = ExtResource("2_f5okj") +button_mask = 0 text = "START" [node name="OptionsButton" type="Button" parent="VBoxContainer"] unique_name_in_owner = true layout_mode = 2 +mouse_filter = 2 theme = ExtResource("2_f5okj") text = "OPTIONS" [node name="QuitButton" type="Button" parent="VBoxContainer"] unique_name_in_owner = true layout_mode = 2 +mouse_filter = 2 theme = ExtResource("2_f5okj") text = "QUIT" diff --git a/menu/options.gd b/menu/options.gd index 7ce7a01..413a424 100644 --- a/menu/options.gd +++ b/menu/options.gd @@ -1,5 +1,6 @@ extends Node + signal show_credits signal show_main_menu diff --git a/menu/options.tscn b/menu/options.tscn index 2c25a0d..3a42d47 100644 --- a/menu/options.tscn +++ b/menu/options.tscn @@ -35,6 +35,7 @@ text = "Fullscreen" [node name="FullscreenCheckButton" type="CheckButton" parent="VBoxContainer/OptionsGridContainer"] unique_name_in_owner = true layout_mode = 2 +mouse_filter = 2 [node name="WindowFactorLabel" type="Label" parent="VBoxContainer/OptionsGridContainer"] unique_name_in_owner = true @@ -44,6 +45,7 @@ text = "Window Factor" [node name="WindowFactorOptionButton" type="OptionButton" parent="VBoxContainer/OptionsGridContainer"] unique_name_in_owner = true layout_mode = 2 +mouse_filter = 2 selected = 0 item_count = 6 popup/item_0/text = "×1" @@ -66,12 +68,14 @@ alignment = 2 [node name="CreditsButton" type="Button" parent="VBoxContainer/HBoxContainer"] unique_name_in_owner = true layout_mode = 2 +mouse_filter = 2 theme = ExtResource("2_1tdpy") text = "Credits" [node name="BackButton" type="Button" parent="VBoxContainer/HBoxContainer"] unique_name_in_owner = true layout_mode = 2 +mouse_filter = 2 theme = ExtResource("2_1tdpy") shortcut = SubResource("Shortcut_1tdpy") text = "Back" diff --git a/menu/pause_menu.gd b/menu/pause_menu.gd index efb40e9..6bb48a4 100644 --- a/menu/pause_menu.gd +++ b/menu/pause_menu.gd @@ -1,5 +1,6 @@ extends Node + signal continue_game signal show_main_menu diff --git a/menu/pause_menu.tscn b/menu/pause_menu.tscn index a6123fa..a03a7fb 100644 --- a/menu/pause_menu.tscn +++ b/menu/pause_menu.tscn @@ -29,6 +29,7 @@ offset_bottom = 166.0 [node name="ContinueButton" type="Button" parent="VBoxContainer"] unique_name_in_owner = true layout_mode = 2 +mouse_filter = 2 theme = ExtResource("2_vy7sn") shortcut = SubResource("Shortcut_lgp46") text = "CONTINUE" @@ -36,6 +37,7 @@ text = "CONTINUE" [node name="MainMenuButton" type="Button" parent="VBoxContainer"] unique_name_in_owner = true layout_mode = 2 +mouse_filter = 2 theme = ExtResource("2_vy7sn") text = "MAIN MENU" diff --git a/title_screen.gd b/title_screen.gd index a4e2337..1cd4ec1 100644 --- a/title_screen.gd +++ b/title_screen.gd @@ -1,9 +1,16 @@ 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 @@ -15,7 +22,7 @@ func _show_main_menu() -> void: if _current_scene != null: _current_scene.queue_free() - var scene : Node = load("res://menu/main_menu.tscn").instantiate() + var scene := MainMenu.instantiate() add_child(scene) scene.continue_game.connect(_continue_game) scene.new_game.connect(_new_game) @@ -40,7 +47,7 @@ func _show_options() -> void: if _current_scene != null: _current_scene.queue_free() - var scene : Node = load("res://menu/options.tscn").instantiate() + var scene := Options.instantiate() add_child(scene) scene.show_main_menu.connect(_show_main_menu) scene.show_credits.connect(_show_credits) @@ -51,7 +58,7 @@ func _show_credits() -> void: if _current_scene != null: _current_scene.queue_free() - var scene : Node = load("res://menu/credits.tscn").instantiate() + var scene := Credits.instantiate() add_child(scene) scene.show_main_menu.connect(_show_main_menu) _current_scene = scene