Update cursor handling and reset functionality, improve UI elements. Reset game state cursor when needed.
This commit is contained in:
parent
6e6a231300
commit
4b5ac48e10
6 changed files with 33 additions and 4 deletions
|
|
@ -29,13 +29,15 @@ func _on_click_detection_mouse_exited():
|
||||||
if GameState.placing_drone == false:
|
if GameState.placing_drone == false:
|
||||||
Log.pr("Mouse exited the director drone!")
|
Log.pr("Mouse exited the director drone!")
|
||||||
label.visible = false
|
label.visible = false
|
||||||
Input.set_custom_mouse_cursor(null)
|
#Input.set_custom_mouse_cursor(null)
|
||||||
|
GameState.reset_cursor()
|
||||||
|
|
||||||
|
|
||||||
func _on_click_detection_input_event(_viewport:Node, event:InputEvent, _shape_idx:int):
|
func _on_click_detection_input_event(_viewport:Node, event:InputEvent, _shape_idx:int):
|
||||||
if GameState.placing_drone == false:
|
if GameState.placing_drone == false:
|
||||||
if (event is InputEventMouseButton && event.button_index == MOUSE_BUTTON_RIGHT && event.pressed):
|
if (event is InputEventMouseButton && event.button_index == MOUSE_BUTTON_RIGHT && event.pressed):
|
||||||
Input.set_custom_mouse_cursor(null)
|
#Input.set_custom_mouse_cursor(null)
|
||||||
|
GameState.reset_cursor()
|
||||||
queue_free()
|
queue_free()
|
||||||
get_parent().get_parent().update_director_drone_list()
|
get_parent().get_parent().update_director_drone_list()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -91,7 +91,8 @@ func place_drone(drone_type : String) -> void:
|
||||||
spawning_type = drone_type
|
spawning_type = drone_type
|
||||||
|
|
||||||
func cancel_spawning() -> void:
|
func cancel_spawning() -> void:
|
||||||
Input.set_custom_mouse_cursor(null)
|
#Input.set_custom_mouse_cursor(null)
|
||||||
|
GameState.reset_cursor()
|
||||||
drone_controls.reset_button_focus()
|
drone_controls.reset_button_focus()
|
||||||
drone_controls.enable_buttons()
|
drone_controls.enable_buttons()
|
||||||
spawning_drone = false
|
spawning_drone = false
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ func _ready():
|
||||||
func _on_change_scene(scene_name):
|
func _on_change_scene(scene_name):
|
||||||
Log.pr("Going to load a scene.", scene_name)
|
Log.pr("Going to load a scene.", scene_name)
|
||||||
if SCENES.has(scene_name):
|
if SCENES.has(scene_name):
|
||||||
|
GameState.reset()
|
||||||
loading_scene_res = load(SCENES[scene_name])
|
loading_scene_res = load(SCENES[scene_name])
|
||||||
Log.pr("Loading scene: ", loading_scene_res)
|
Log.pr("Loading scene: ", loading_scene_res)
|
||||||
$TransitionScene.transition()
|
$TransitionScene.transition()
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,11 @@ theme_override_constants/margin_top = 30
|
||||||
theme_override_constants/margin_right = 20
|
theme_override_constants/margin_right = 20
|
||||||
theme_override_constants/margin_bottom = 20
|
theme_override_constants/margin_bottom = 20
|
||||||
|
|
||||||
[node name="LevelTimer" type="Label" parent="MarginContainer/MarginContainer"]
|
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/MarginContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
mouse_filter = 2
|
||||||
|
|
||||||
|
[node name="LevelTimer" type="Label" parent="MarginContainer/MarginContainer/VBoxContainer"]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_horizontal = 4
|
size_flags_horizontal = 4
|
||||||
|
|
@ -94,6 +98,15 @@ theme_override_colors/font_color = Color(1, 1, 1, 1)
|
||||||
theme_override_font_sizes/font_size = 20
|
theme_override_font_sizes/font_size = 20
|
||||||
text = "00:00:00"
|
text = "00:00:00"
|
||||||
|
|
||||||
|
[node name="BeeCounter" type="Label" parent="MarginContainer/MarginContainer/VBoxContainer"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 4
|
||||||
|
size_flags_vertical = 0
|
||||||
|
theme_override_colors/font_color = Color(1, 1, 1, 1)
|
||||||
|
theme_override_font_sizes/font_size = 16
|
||||||
|
text = "Bees: 10/10"
|
||||||
|
|
||||||
[node name="HelpTextContainer" type="VBoxContainer" parent="MarginContainer/MarginContainer"]
|
[node name="HelpTextContainer" type="VBoxContainer" parent="MarginContainer/MarginContainer"]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ var last_update : float = 0
|
||||||
@onready var level_text_label = get_node("%LevelText")
|
@onready var level_text_label = get_node("%LevelText")
|
||||||
@onready var level_timer_label = get_node("%LevelTimer")
|
@onready var level_timer_label = get_node("%LevelTimer")
|
||||||
@onready var par_text_label = get_node("%ParText")
|
@onready var par_text_label = get_node("%ParText")
|
||||||
|
@onready var bee_counter = get_node("%BeeCounter")
|
||||||
|
|
||||||
|
|
||||||
var disable_pause : bool = false
|
var disable_pause : bool = false
|
||||||
|
|
@ -23,6 +24,8 @@ func _ready():
|
||||||
%QuitButton.connect("pressed", Callable(self, "quit_game"))
|
%QuitButton.connect("pressed", Callable(self, "quit_game"))
|
||||||
%ResumeButton.connect("pressed", Callable(self, "unpause_game"))
|
%ResumeButton.connect("pressed", Callable(self, "unpause_game"))
|
||||||
|
|
||||||
|
bee_counter.hide()
|
||||||
|
|
||||||
func _process(delta):
|
func _process(delta):
|
||||||
last_update += delta
|
last_update += delta
|
||||||
|
|
||||||
|
|
@ -48,6 +51,9 @@ func update_ui():
|
||||||
nectar_bar.value = GameState.gathered_nectar
|
nectar_bar.value = GameState.gathered_nectar
|
||||||
nectar_bar.max_value = GameState.required_nectar
|
nectar_bar.max_value = GameState.required_nectar
|
||||||
|
|
||||||
|
bee_counter.text = "Bees: " + str(GameState.bees_available - GameState.dead_bees) + "/" + str(GameState.bees_available)
|
||||||
|
bee_counter.show()
|
||||||
|
|
||||||
func hide_help_text():
|
func hide_help_text():
|
||||||
for item in help_text_items:
|
for item in help_text_items:
|
||||||
item.hide()
|
item.hide()
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
class_name GameStateManager extends Node
|
class_name GameStateManager extends Node
|
||||||
|
|
||||||
|
## THIS SHOULD NOT EXIST HERE BUT I AM NOT GOING TO MAKE A NEW CLASS FOR IT RIGHT NOW
|
||||||
|
@onready var default_cursor = preload("res://resources/cursors/pointer_a.png")
|
||||||
|
|
||||||
var placing_drone : bool = false
|
var placing_drone : bool = false
|
||||||
|
|
||||||
var level_timer : float = 0.0
|
var level_timer : float = 0.0
|
||||||
|
|
@ -84,3 +87,6 @@ func reset():
|
||||||
gathered_nectar = 0
|
gathered_nectar = 0
|
||||||
drones_used = 0
|
drones_used = 0
|
||||||
dead_bees = 0
|
dead_bees = 0
|
||||||
|
|
||||||
|
func reset_cursor():
|
||||||
|
Input.set_custom_mouse_cursor(default_cursor, Input.CURSOR_ARROW, Vector2(8, 8))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue