Add build directory to .gitignore, create export presets for Web and Windows Desktop, adjust z-index and mouse filter in level_1.tscn, add update_game_state function in level.gd, change main_scene path in project.godot, set rendering method to "gl_compatibility", add LevelSelect and related nodes in main_menu.tscn, create scene_manager.tscn with MainMenu node, implement functionality for menu button selection in main_menu.gd.
This commit is contained in:
parent
ca4788ce6f
commit
b6cdb68b4e
21 changed files with 499 additions and 10 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -1,3 +1,5 @@
|
||||||
# Godot 4+ specific ignores
|
# Godot 4+ specific ignores
|
||||||
.godot/
|
.godot/
|
||||||
.vscode/
|
.vscode/
|
||||||
|
|
||||||
|
build/
|
||||||
|
|
|
||||||
100
export_presets.cfg
Normal file
100
export_presets.cfg
Normal file
|
|
@ -0,0 +1,100 @@
|
||||||
|
[preset.0]
|
||||||
|
|
||||||
|
name="Web"
|
||||||
|
platform="Web"
|
||||||
|
runnable=true
|
||||||
|
dedicated_server=false
|
||||||
|
custom_features=""
|
||||||
|
export_filter="all_resources"
|
||||||
|
include_filter=""
|
||||||
|
exclude_filter=""
|
||||||
|
export_path=""
|
||||||
|
encryption_include_filters=""
|
||||||
|
encryption_exclude_filters=""
|
||||||
|
encrypt_pck=false
|
||||||
|
encrypt_directory=false
|
||||||
|
|
||||||
|
[preset.0.options]
|
||||||
|
|
||||||
|
custom_template/debug=""
|
||||||
|
custom_template/release=""
|
||||||
|
variant/extensions_support=false
|
||||||
|
vram_texture_compression/for_desktop=true
|
||||||
|
vram_texture_compression/for_mobile=false
|
||||||
|
html/export_icon=true
|
||||||
|
html/custom_html_shell=""
|
||||||
|
html/head_include=""
|
||||||
|
html/canvas_resize_policy=2
|
||||||
|
html/focus_canvas_on_start=true
|
||||||
|
html/experimental_virtual_keyboard=false
|
||||||
|
progressive_web_app/enabled=false
|
||||||
|
progressive_web_app/offline_page=""
|
||||||
|
progressive_web_app/display=1
|
||||||
|
progressive_web_app/orientation=0
|
||||||
|
progressive_web_app/icon_144x144=""
|
||||||
|
progressive_web_app/icon_180x180=""
|
||||||
|
progressive_web_app/icon_512x512=""
|
||||||
|
progressive_web_app/background_color=Color(0, 0, 0, 1)
|
||||||
|
|
||||||
|
[preset.1]
|
||||||
|
|
||||||
|
name="Windows Desktop"
|
||||||
|
platform="Windows Desktop"
|
||||||
|
runnable=true
|
||||||
|
dedicated_server=false
|
||||||
|
custom_features=""
|
||||||
|
export_filter="all_resources"
|
||||||
|
include_filter=""
|
||||||
|
exclude_filter=""
|
||||||
|
export_path="build/windows/Pollen Not Included.exe"
|
||||||
|
encryption_include_filters=""
|
||||||
|
encryption_exclude_filters=""
|
||||||
|
encrypt_pck=false
|
||||||
|
encrypt_directory=false
|
||||||
|
|
||||||
|
[preset.1.options]
|
||||||
|
|
||||||
|
custom_template/debug=""
|
||||||
|
custom_template/release=""
|
||||||
|
debug/export_console_wrapper=0
|
||||||
|
binary_format/embed_pck=true
|
||||||
|
texture_format/bptc=true
|
||||||
|
texture_format/s3tc=true
|
||||||
|
texture_format/etc=false
|
||||||
|
texture_format/etc2=false
|
||||||
|
binary_format/architecture="x86_64"
|
||||||
|
codesign/enable=false
|
||||||
|
codesign/timestamp=true
|
||||||
|
codesign/timestamp_server_url=""
|
||||||
|
codesign/digest_algorithm=1
|
||||||
|
codesign/description=""
|
||||||
|
codesign/custom_options=PackedStringArray()
|
||||||
|
application/modify_resources=true
|
||||||
|
application/icon=""
|
||||||
|
application/console_wrapper_icon=""
|
||||||
|
application/icon_interpolation=4
|
||||||
|
application/file_version=""
|
||||||
|
application/product_version=""
|
||||||
|
application/company_name="Happy Little Robots"
|
||||||
|
application/product_name="Pollen Not Included"
|
||||||
|
application/file_description=""
|
||||||
|
application/copyright=""
|
||||||
|
application/trademarks=""
|
||||||
|
application/export_angle=0
|
||||||
|
ssh_remote_deploy/enabled=false
|
||||||
|
ssh_remote_deploy/host="user@host_ip"
|
||||||
|
ssh_remote_deploy/port="22"
|
||||||
|
ssh_remote_deploy/extra_args_ssh=""
|
||||||
|
ssh_remote_deploy/extra_args_scp=""
|
||||||
|
ssh_remote_deploy/run_script="Expand-Archive -LiteralPath '{temp_dir}\\{archive_name}' -DestinationPath '{temp_dir}'
|
||||||
|
$action = New-ScheduledTaskAction -Execute '{temp_dir}\\{exe_name}' -Argument '{cmd_args}'
|
||||||
|
$trigger = New-ScheduledTaskTrigger -Once -At 00:00
|
||||||
|
$settings = New-ScheduledTaskSettingsSet
|
||||||
|
$task = New-ScheduledTask -Action $action -Trigger $trigger -Settings $settings
|
||||||
|
Register-ScheduledTask godot_remote_debug -InputObject $task -Force:$true
|
||||||
|
Start-ScheduledTask -TaskName godot_remote_debug
|
||||||
|
while (Get-ScheduledTask -TaskName godot_remote_debug | ? State -eq running) { Start-Sleep -Milliseconds 100 }
|
||||||
|
Unregister-ScheduledTask -TaskName godot_remote_debug -Confirm:$false -ErrorAction:SilentlyContinue"
|
||||||
|
ssh_remote_deploy/cleanup_script="Stop-ScheduledTask -TaskName godot_remote_debug -ErrorAction:SilentlyContinue
|
||||||
|
Unregister-ScheduledTask -TaskName godot_remote_debug -Confirm:$false -ErrorAction:SilentlyContinue
|
||||||
|
Remove-Item -Recurse -Force '{temp_dir}'"
|
||||||
|
|
@ -137,18 +137,20 @@ unique_name_in_owner = true
|
||||||
|
|
||||||
[node name="UiComponent" parent="." instance=ExtResource("11_ndtvv")]
|
[node name="UiComponent" parent="." instance=ExtResource("11_ndtvv")]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
z_index = 20
|
z_index = 999
|
||||||
offset_right = 1280.0
|
offset_right = 1280.0
|
||||||
offset_bottom = 720.0
|
offset_bottom = 720.0
|
||||||
|
mouse_filter = 1
|
||||||
|
|
||||||
[node name="DroneManager" parent="." instance=ExtResource("12_37aah")]
|
[node name="DroneManager" parent="." instance=ExtResource("12_37aah")]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
|
|
||||||
[node name="LevelCompleteComponent" parent="." instance=ExtResource("13_we755")]
|
[node name="LevelCompleteComponent" parent="." instance=ExtResource("13_we755")]
|
||||||
visible = false
|
visible = false
|
||||||
z_index = 999
|
z_index = 1000
|
||||||
offset_right = 1280.0
|
offset_right = 1280.0
|
||||||
offset_bottom = 720.0
|
offset_bottom = 720.0
|
||||||
|
mouse_filter = 1
|
||||||
|
|
||||||
[node name="BackgroundMusic" type="AudioStreamPlayer" parent="."]
|
[node name="BackgroundMusic" type="AudioStreamPlayer" parent="."]
|
||||||
stream = ExtResource("14_r7utx")
|
stream = ExtResource("14_r7utx")
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,9 @@ class_name Level extends Node
|
||||||
@onready var ui_controls = get_node("UiComponent") as UIComponent
|
@onready var ui_controls = get_node("UiComponent") as UIComponent
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
|
update_game_state()
|
||||||
|
|
||||||
|
func update_game_state():
|
||||||
GameState.required_nectar = rules.game_rules.nectar_required
|
GameState.required_nectar = rules.game_rules.nectar_required
|
||||||
GameState.level_par = rules.game_rules.level_par
|
GameState.level_par = rules.game_rules.level_par
|
||||||
ui_controls.update_level_text("Level : " + str(rules.game_rules.level_number))
|
ui_controls.update_level_text("Level : " + str(rules.game_rules.level_number))
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ config_version=5
|
||||||
[application]
|
[application]
|
||||||
|
|
||||||
config/name="Pollen Not Included"
|
config/name="Pollen Not Included"
|
||||||
run/main_scene="res://scenes/main_menu.tscn"
|
run/main_scene="res://scenes/scene_manager.tscn"
|
||||||
config/features=PackedStringArray("4.2", "Forward Plus")
|
config/features=PackedStringArray("4.2", "Forward Plus")
|
||||||
config/icon="res://resources/textures/collector_drone.png"
|
config/icon="res://resources/textures/collector_drone.png"
|
||||||
|
|
||||||
|
|
@ -19,6 +19,7 @@ config/icon="res://resources/textures/collector_drone.png"
|
||||||
|
|
||||||
GameState="*res://utility/game_state.gd"
|
GameState="*res://utility/game_state.gd"
|
||||||
Str="*res://utility/utility_strings.gd"
|
Str="*res://utility/utility_strings.gd"
|
||||||
|
SceneMgr="*res://utility/global_scene_manager.gd"
|
||||||
|
|
||||||
[display]
|
[display]
|
||||||
|
|
||||||
|
|
@ -45,3 +46,7 @@ theme/custom="res://resources/theme/game_theme.tres"
|
||||||
[physics]
|
[physics]
|
||||||
|
|
||||||
2d/run_on_separate_thread=true
|
2d/run_on_separate_thread=true
|
||||||
|
|
||||||
|
[rendering]
|
||||||
|
|
||||||
|
renderer/rendering_method="gl_compatibility"
|
||||||
|
|
|
||||||
Binary file not shown.
Binary file not shown.
|
|
@ -18,6 +18,7 @@ anchor_right = 1.0
|
||||||
anchor_bottom = 1.0
|
anchor_bottom = 1.0
|
||||||
grow_horizontal = 2
|
grow_horizontal = 2
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
|
mouse_filter = 2
|
||||||
metadata/_edit_use_anchors_ = true
|
metadata/_edit_use_anchors_ = true
|
||||||
|
|
||||||
[node name="MarginContainer" type="MarginContainer" parent="Control"]
|
[node name="MarginContainer" type="MarginContainer" parent="Control"]
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
[gd_scene load_steps=20 format=3 uid="uid://cdk8rrve1fe3u"]
|
[gd_scene load_steps=21 format=3 uid="uid://cdk8rrve1fe3u"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://levels/scripts/level.gd" id="1_inuhq"]
|
[ext_resource type="Script" path="res://scenes/scripts/main_menu.gd" id="1_ges7y"]
|
||||||
[ext_resource type="Resource" uid="uid://bn4qhonifxne3" path="res://levels/rules/main_menu.tres" id="2_4iepj"]
|
[ext_resource type="Resource" uid="uid://bn4qhonifxne3" path="res://levels/rules/main_menu.tres" id="2_4iepj"]
|
||||||
[ext_resource type="PackedScene" uid="uid://dn6aa6f2f4g4i" path="res://components/RulesComponent.tscn" id="2_hanec"]
|
[ext_resource type="PackedScene" uid="uid://dn6aa6f2f4g4i" path="res://components/RulesComponent.tscn" id="2_hanec"]
|
||||||
[ext_resource type="PackedScene" uid="uid://d1uawawum16b0" path="res://scenes/elements/background.tscn" id="4_nllu8"]
|
[ext_resource type="PackedScene" uid="uid://d1uawawum16b0" path="res://scenes/elements/background.tscn" id="4_nllu8"]
|
||||||
|
|
@ -19,9 +19,10 @@
|
||||||
[ext_resource type="AudioStream" uid="uid://bgcbd6xf0lyrr" path="res://resources/music/bee_background.ogg" id="15_ixwoe"]
|
[ext_resource type="AudioStream" uid="uid://bgcbd6xf0lyrr" path="res://resources/music/bee_background.ogg" id="15_ixwoe"]
|
||||||
[ext_resource type="AudioStream" uid="uid://dvsjpsh5dyixq" path="res://resources/SFX/mixkit-european-spring-forest-ambience-1219.wav" id="16_cqdjb"]
|
[ext_resource type="AudioStream" uid="uid://dvsjpsh5dyixq" path="res://resources/SFX/mixkit-european-spring-forest-ambience-1219.wav" id="16_cqdjb"]
|
||||||
[ext_resource type="Texture2D" uid="uid://15wckxixnr8y" path="res://resources/images/logo.png" id="19_jw5rd"]
|
[ext_resource type="Texture2D" uid="uid://15wckxixnr8y" path="res://resources/images/logo.png" id="19_jw5rd"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://c3tl5pihlrd8u" path="res://resources/cursors/navigation_s.png" id="20_fw4ew"]
|
||||||
|
|
||||||
[node name="MainMenu" type="Node2D"]
|
[node name="MainMenu" type="Node2D"]
|
||||||
script = ExtResource("1_inuhq")
|
script = ExtResource("1_ges7y")
|
||||||
|
|
||||||
[node name="RulesComponent" parent="." instance=ExtResource("2_hanec")]
|
[node name="RulesComponent" parent="." instance=ExtResource("2_hanec")]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
|
|
@ -182,4 +183,61 @@ autoplay = true
|
||||||
position = Vector2(640, 167)
|
position = Vector2(640, 167)
|
||||||
texture = ExtResource("19_jw5rd")
|
texture = ExtResource("19_jw5rd")
|
||||||
|
|
||||||
|
[node name="LevelSelect" type="Control" parent="."]
|
||||||
|
layout_mode = 3
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
offset_right = 1280.0
|
||||||
|
offset_bottom = 720.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
|
||||||
|
[node name="CenterContainer" type="CenterContainer" parent="LevelSelect"]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
|
||||||
|
[node name="MarginContainer" type="MarginContainer" parent="LevelSelect/CenterContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
theme_override_constants/margin_top = 100
|
||||||
|
|
||||||
|
[node name="VBoxContainer" type="VBoxContainer" parent="LevelSelect/CenterContainer/MarginContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="MenuButton" type="MenuButton" parent="LevelSelect/CenterContainer/MarginContainer/VBoxContainer"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 2
|
||||||
|
theme_override_font_sizes/font_size = 20
|
||||||
|
text = "Level Select"
|
||||||
|
icon = ExtResource("20_fw4ew")
|
||||||
|
flat = false
|
||||||
|
icon_alignment = 2
|
||||||
|
item_count = 6
|
||||||
|
popup/item_0/text = "Level One"
|
||||||
|
popup/item_0/id = 1
|
||||||
|
popup/item_1/text = "Level Two"
|
||||||
|
popup/item_1/id = 2
|
||||||
|
popup/item_2/text = "Level Three"
|
||||||
|
popup/item_2/id = 3
|
||||||
|
popup/item_3/text = "Level Four"
|
||||||
|
popup/item_3/id = 4
|
||||||
|
popup/item_4/text = "Level Five"
|
||||||
|
popup/item_4/id = 5
|
||||||
|
popup/item_5/text = "Level Six"
|
||||||
|
popup/item_5/id = 6
|
||||||
|
|
||||||
|
[node name="HighScores" type="Button" parent="LevelSelect/CenterContainer/MarginContainer/VBoxContainer"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 2
|
||||||
|
text = "High Scores"
|
||||||
|
|
||||||
|
[node name="ExitGame" type="Button" parent="LevelSelect/CenterContainer/MarginContainer/VBoxContainer"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Quit Game"
|
||||||
|
|
||||||
[editable path="DroneManager"]
|
[editable path="DroneManager"]
|
||||||
|
|
|
||||||
14
scenes/scene_manager.tscn
Normal file
14
scenes/scene_manager.tscn
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
[gd_scene load_steps=4 format=3 uid="uid://cbsqd08rb8f83"]
|
||||||
|
|
||||||
|
[ext_resource type="PackedScene" uid="uid://cdk8rrve1fe3u" path="res://scenes/main_menu.tscn" id="1_phmcp"]
|
||||||
|
[ext_resource type="Script" path="res://scenes/scripts/scene_manager.gd" id="1_py1pt"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://bhy041v5u551a" path="res://scenes/transition_scene.tscn" id="2_jhpbi"]
|
||||||
|
|
||||||
|
[node name="SceneManager" type="Node2D"]
|
||||||
|
script = ExtResource("1_py1pt")
|
||||||
|
|
||||||
|
[node name="CurrentScene" type="Node" parent="."]
|
||||||
|
|
||||||
|
[node name="MainMenu" parent="CurrentScene" instance=ExtResource("1_phmcp")]
|
||||||
|
|
||||||
|
[node name="TransitionScene" parent="." instance=ExtResource("2_jhpbi")]
|
||||||
38
scenes/scripts/main_menu.gd
Normal file
38
scenes/scripts/main_menu.gd
Normal file
|
|
@ -0,0 +1,38 @@
|
||||||
|
extends Level
|
||||||
|
class_name MainMenu
|
||||||
|
|
||||||
|
@onready var level_select = get_node("%MenuButton")
|
||||||
|
@onready var high_scores = get_node("%HighScores")
|
||||||
|
@onready var exit_button = get_node("%ExitGame")
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
level_select.get_popup().id_pressed.connect(_on_item_menu_pressed)
|
||||||
|
high_scores.connect("pressed", Callable(self, "on_high_scores_pressed"))
|
||||||
|
exit_button.connect("pressed", Callable(self, "on_exit_pressed"))
|
||||||
|
update_game_state()
|
||||||
|
|
||||||
|
|
||||||
|
func _on_item_menu_pressed(id):
|
||||||
|
## Load the appropriate level based on the selection that has been made
|
||||||
|
Log.pr(id)
|
||||||
|
|
||||||
|
match id:
|
||||||
|
1:
|
||||||
|
# Load level 1
|
||||||
|
SceneMgr.load_scene("LEVEL1")
|
||||||
|
#get_tree().change_scene_to_file("res://levels/level_1.tscn")
|
||||||
|
2:
|
||||||
|
# Load level 2
|
||||||
|
SceneMgr.load_scene("LEVEL2")
|
||||||
|
3:
|
||||||
|
# Load level 3
|
||||||
|
SceneMgr.load_scene("LEVEL3")
|
||||||
|
|
||||||
|
func on_high_scores_pressed():
|
||||||
|
## Load the high scores screen
|
||||||
|
Log.pr("High scores button pressed")
|
||||||
|
pass
|
||||||
|
|
||||||
|
func on_exit_pressed():
|
||||||
|
# Quit the game
|
||||||
|
get_tree().quit()
|
||||||
33
scenes/scripts/scene_manager.gd
Normal file
33
scenes/scripts/scene_manager.gd
Normal file
|
|
@ -0,0 +1,33 @@
|
||||||
|
extends Node2D
|
||||||
|
class_name SceneManager
|
||||||
|
|
||||||
|
const SCENES : Dictionary = {
|
||||||
|
"MAINMENU" : "res://scenes/main_menu.tscn",
|
||||||
|
"HIGHSCORES" : "res://scenes/highscores.tscn",
|
||||||
|
"LEVEL1" : "res://levels/level_1.tscn",
|
||||||
|
"LEVEL2" : "res://levels/level_2.tscn",
|
||||||
|
"LEVEL3" : "res://levels/level_3.tscn",
|
||||||
|
"LEVEL4" : "res://levels/level_4.tscn",
|
||||||
|
"LEVEL5" : "res://levels/level_5.tscn",
|
||||||
|
"LEVEL6" : "res://levels/level_6.tscn",
|
||||||
|
}
|
||||||
|
|
||||||
|
var loading_scene_res : Resource = null
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
Log.pr("SceneManager is ready.")
|
||||||
|
SceneMgr.connect("change_scene", Callable(self, "_on_change_scene"))
|
||||||
|
$TransitionScene.connect("transitioned", Callable(self, "_on_transition_scene_transitioned"))
|
||||||
|
|
||||||
|
func _on_change_scene(scene_name):
|
||||||
|
Log.pr("Going to load a scene.", scene_name)
|
||||||
|
if SCENES.has(scene_name):
|
||||||
|
loading_scene_res = load(SCENES[scene_name])
|
||||||
|
Log.pr("Loading scene: ", loading_scene_res)
|
||||||
|
$TransitionScene.transition()
|
||||||
|
else:
|
||||||
|
loading_scene_res = null
|
||||||
|
|
||||||
|
func _on_transition_scene_transitioned():
|
||||||
|
$CurrentScene.get_child(0).queue_free()
|
||||||
|
$CurrentScene.add_child(loading_scene_res.instantiate())
|
||||||
19
scenes/scripts/transition_scene.gd
Normal file
19
scenes/scripts/transition_scene.gd
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
extends CanvasLayer
|
||||||
|
|
||||||
|
signal transitioned
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
$AnimationPlayer.play("fade_to_normal")
|
||||||
|
|
||||||
|
func transition():
|
||||||
|
$AnimationPlayer.play("fade_to_black")
|
||||||
|
Log.pr("Fading to black")
|
||||||
|
|
||||||
|
func _on_animation_player_animation_finished(anim_name:StringName):
|
||||||
|
if anim_name == "fade_to_black":
|
||||||
|
Log.pr("Sending transitioned signal...")
|
||||||
|
emit_signal("transitioned")
|
||||||
|
$AnimationPlayer.play("fade_to_normal")
|
||||||
|
if anim_name == "fade_to_normal":
|
||||||
|
Log.pr("Faded to normal")
|
||||||
|
|
||||||
76
scenes/transition_scene.tscn
Normal file
76
scenes/transition_scene.tscn
Normal file
|
|
@ -0,0 +1,76 @@
|
||||||
|
[gd_scene load_steps=6 format=3 uid="uid://bhy041v5u551a"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://scenes/scripts/transition_scene.gd" id="1_pt42a"]
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_ehfi2"]
|
||||||
|
resource_name = "fade_to_black"
|
||||||
|
length = 0.5
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath("ColorRect:color")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0, 0.5),
|
||||||
|
"transitions": PackedFloat32Array(1, 1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Color(0, 0, 0, 0), Color(0, 0, 0, 1)]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_n8kpy"]
|
||||||
|
resource_name = "fade_to_normal"
|
||||||
|
length = 0.5
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath("ColorRect:color")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0, 0.5),
|
||||||
|
"transitions": PackedFloat32Array(1, 1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Color(0, 0, 0, 1), Color(0, 0, 0, 0)]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_skyqd"]
|
||||||
|
length = 0.001
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath("ColorRect:color")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Color(0, 0, 0, 1)]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="AnimationLibrary" id="AnimationLibrary_lyb8n"]
|
||||||
|
_data = {
|
||||||
|
"RESET": SubResource("Animation_skyqd"),
|
||||||
|
"fade_to_black": SubResource("Animation_ehfi2"),
|
||||||
|
"fade_to_normal": SubResource("Animation_n8kpy")
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="TransitionScene" type="CanvasLayer"]
|
||||||
|
script = ExtResource("1_pt42a")
|
||||||
|
|
||||||
|
[node name="ColorRect" type="ColorRect" parent="."]
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
mouse_filter = 2
|
||||||
|
color = Color(0, 0, 0, 1)
|
||||||
|
|
||||||
|
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||||
|
libraries = {
|
||||||
|
"": SubResource("AnimationLibrary_lyb8n")
|
||||||
|
}
|
||||||
|
|
||||||
|
[connection signal="animation_finished" from="AnimationPlayer" to="." method="_on_animation_player_animation_finished"]
|
||||||
|
|
@ -61,3 +61,24 @@ layout_mode = 2
|
||||||
size_flags_horizontal = 4
|
size_flags_horizontal = 4
|
||||||
theme_override_font_sizes/font_size = 18
|
theme_override_font_sizes/font_size = 18
|
||||||
text = "Total Points: "
|
text = "Total Points: "
|
||||||
|
|
||||||
|
[node name="MarginContainer" type="MarginContainer" parent="MarginContainer/CenterContainer/VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
theme_override_constants/margin_left = 20
|
||||||
|
theme_override_constants/margin_top = 20
|
||||||
|
theme_override_constants/margin_right = 20
|
||||||
|
theme_override_constants/margin_bottom = 20
|
||||||
|
|
||||||
|
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/CenterContainer/VBoxContainer/MarginContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="TryAgain" type="Button" parent="MarginContainer/CenterContainer/VBoxContainer/MarginContainer/VBoxContainer"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
visible = false
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Try Again"
|
||||||
|
|
||||||
|
[node name="MainMenu" type="Button" parent="MarginContainer/CenterContainer/VBoxContainer/MarginContainer/VBoxContainer"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Main Menu"
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
[gd_scene load_steps=2 format=3 uid="uid://b7eeptlk47ymd"]
|
[gd_scene load_steps=3 format=3 uid="uid://b7eeptlk47ymd"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://ui/scripts/ui_component.gd" id="1_6lnte"]
|
[ext_resource type="Script" path="res://ui/scripts/ui_component.gd" id="1_6lnte"]
|
||||||
|
[ext_resource type="Script" path="res://ui/scripts/pause_menu.gd" id="2_2qrdg"]
|
||||||
|
|
||||||
[node name="UiComponent" type="Control"]
|
[node name="UiComponent" type="Control"]
|
||||||
layout_mode = 3
|
layout_mode = 3
|
||||||
|
|
@ -11,6 +12,53 @@ grow_horizontal = 2
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
script = ExtResource("1_6lnte")
|
script = ExtResource("1_6lnte")
|
||||||
|
|
||||||
|
[node name="PauseMenu" type="Control" parent="."]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
process_mode = 2
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
mouse_filter = 1
|
||||||
|
script = ExtResource("2_2qrdg")
|
||||||
|
|
||||||
|
[node name="PauseMenuBG" type="Panel" parent="PauseMenu"]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
|
||||||
|
[node name="CenterContainer" type="CenterContainer" parent="PauseMenu"]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
offset_left = -10.0
|
||||||
|
offset_top = -10.0
|
||||||
|
offset_right = -10.0
|
||||||
|
offset_bottom = -10.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
|
||||||
|
[node name="VBoxContainer" type="VBoxContainer" parent="PauseMenu/CenterContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="ResumeButton" type="Button" parent="PauseMenu/CenterContainer/VBoxContainer"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 2
|
||||||
|
theme_override_font_sizes/font_size = 20
|
||||||
|
text = "Resume"
|
||||||
|
|
||||||
|
[node name="QuitButton" type="Button" parent="PauseMenu/CenterContainer/VBoxContainer"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 2
|
||||||
|
theme_override_font_sizes/font_size = 20
|
||||||
|
text = "Quit"
|
||||||
|
|
||||||
[node name="MarginContainer" type="MarginContainer" parent="."]
|
[node name="MarginContainer" type="MarginContainer" parent="."]
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
anchors_preset = 15
|
anchors_preset = 15
|
||||||
|
|
@ -18,6 +66,7 @@ anchor_right = 1.0
|
||||||
anchor_bottom = 1.0
|
anchor_bottom = 1.0
|
||||||
grow_horizontal = 2
|
grow_horizontal = 2
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
|
mouse_filter = 2
|
||||||
theme_override_constants/margin_left = 10
|
theme_override_constants/margin_left = 10
|
||||||
theme_override_constants/margin_top = 10
|
theme_override_constants/margin_top = 10
|
||||||
theme_override_constants/margin_right = 10
|
theme_override_constants/margin_right = 10
|
||||||
|
|
@ -29,6 +78,7 @@ layout_mode = 2
|
||||||
|
|
||||||
[node name="MarginContainer" type="MarginContainer" parent="MarginContainer"]
|
[node name="MarginContainer" type="MarginContainer" parent="MarginContainer"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
mouse_filter = 2
|
||||||
theme_override_constants/margin_left = 20
|
theme_override_constants/margin_left = 20
|
||||||
theme_override_constants/margin_top = 30
|
theme_override_constants/margin_top = 30
|
||||||
theme_override_constants/margin_right = 20
|
theme_override_constants/margin_right = 20
|
||||||
|
|
@ -45,6 +95,7 @@ text = "00:00:00"
|
||||||
[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
|
||||||
|
mouse_filter = 2
|
||||||
|
|
||||||
[node name="Help_Drone_Placement_Cancel" type="Label" parent="MarginContainer/MarginContainer/HelpTextContainer"]
|
[node name="Help_Drone_Placement_Cancel" type="Label" parent="MarginContainer/MarginContainer/HelpTextContainer"]
|
||||||
visible = false
|
visible = false
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,13 @@ extends Control
|
||||||
@onready var drones_label = get_node("%DronesUsed")
|
@onready var drones_label = get_node("%DronesUsed")
|
||||||
@onready var points_label = get_node("%TotalPoints")
|
@onready var points_label = get_node("%TotalPoints")
|
||||||
|
|
||||||
|
@onready var main_menu_button = get_node("%MainMenu")
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
visible = false
|
visible = false
|
||||||
|
|
||||||
|
main_menu_button.connect("pressed", Callable(self, "on_main_menu_pressed"))
|
||||||
|
|
||||||
func _process(_delta):
|
func _process(_delta):
|
||||||
if GameState.level_complete == true:
|
if GameState.level_complete == true:
|
||||||
update_points()
|
update_points()
|
||||||
|
|
@ -16,3 +20,7 @@ func update_points():
|
||||||
time_label.text = "Time Spent: " + Str.seconds_to_hms(GameState.level_timer)
|
time_label.text = "Time Spent: " + Str.seconds_to_hms(GameState.level_timer)
|
||||||
drones_label.text = "Drones Used: " + str(GameState.drones_used)
|
drones_label.text = "Drones Used: " + str(GameState.drones_used)
|
||||||
points_label.text = "Total Points: " + Str.format_number(GameState.level_points)
|
points_label.text = "Total Points: " + Str.format_number(GameState.level_points)
|
||||||
|
|
||||||
|
func on_main_menu_pressed():
|
||||||
|
GameState.reset()
|
||||||
|
SceneMgr.load_scene("MAINMENU")
|
||||||
12
ui/scripts/pause_menu.gd
Normal file
12
ui/scripts/pause_menu.gd
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
extends Control
|
||||||
|
class_name PauseMenu
|
||||||
|
|
||||||
|
signal resume_game
|
||||||
|
|
||||||
|
func _unhandled_input(event : InputEvent) -> void:
|
||||||
|
if event.is_action_pressed("ui_cancel"):
|
||||||
|
Log.pr("Pause Menu: ui_cancel pressed")
|
||||||
|
if get_tree().paused:
|
||||||
|
Log.pr("Sending unpause signal")
|
||||||
|
resume_game.emit()
|
||||||
|
|
||||||
|
|
@ -11,14 +11,23 @@ var last_update : float = 0
|
||||||
@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")
|
||||||
|
|
||||||
func _ready():
|
|
||||||
|
|
||||||
|
var disable_pause : bool = false
|
||||||
|
|
||||||
|
func _ready():
|
||||||
hide_help_text()
|
hide_help_text()
|
||||||
update_ui()
|
update_ui()
|
||||||
|
%PauseMenu.hide()
|
||||||
|
%PauseMenu.connect("resume_game", Callable(self, "unpause_game"))
|
||||||
|
|
||||||
|
%QuitButton.connect("pressed", Callable(self, "quit_game"))
|
||||||
|
%ResumeButton.connect("pressed", Callable(self, "unpause_game"))
|
||||||
|
|
||||||
func _process(delta):
|
func _process(delta):
|
||||||
last_update += delta
|
last_update += delta
|
||||||
|
|
||||||
|
disable_pause = false
|
||||||
|
|
||||||
if last_update > update_interval:
|
if last_update > update_interval:
|
||||||
last_update = 0
|
last_update = 0
|
||||||
update_ui()
|
update_ui()
|
||||||
|
|
@ -28,6 +37,13 @@ func _process(delta):
|
||||||
|
|
||||||
level_timer_label.text = Str.seconds_to_hms(GameState.level_timer)
|
level_timer_label.text = Str.seconds_to_hms(GameState.level_timer)
|
||||||
|
|
||||||
|
func _unhandled_input(event : InputEvent) -> void:
|
||||||
|
if event.is_action_pressed("ui_cancel"):
|
||||||
|
Log.pr("UIComponent: ui_cancel pressed")
|
||||||
|
if get_tree().paused == false && disable_pause == false:
|
||||||
|
Log.pr("Game is not paused, so pausing it...")
|
||||||
|
pause_game()
|
||||||
|
|
||||||
func update_ui():
|
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
|
||||||
|
|
@ -47,3 +63,19 @@ func update_level_text(text: String):
|
||||||
|
|
||||||
func update_par_text(text: String):
|
func update_par_text(text: String):
|
||||||
par_text_label.text = text
|
par_text_label.text = text
|
||||||
|
|
||||||
|
func quit_game():
|
||||||
|
get_tree().paused = false
|
||||||
|
GameState.reset()
|
||||||
|
SceneMgr.load_scene("MAINMENU")
|
||||||
|
|
||||||
|
func pause_game():
|
||||||
|
get_tree().paused = true
|
||||||
|
%PauseMenu.show()
|
||||||
|
|
||||||
|
func unpause_game():
|
||||||
|
Log.pr("Pause Menu: Close button pressed")
|
||||||
|
disable_pause = true
|
||||||
|
%PauseMenu.hide()
|
||||||
|
get_tree().paused = false
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -54,3 +54,10 @@ func game_win():
|
||||||
|
|
||||||
func game_lose():
|
func game_lose():
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
func reset():
|
||||||
|
level_timer = 0.0
|
||||||
|
level_started = false
|
||||||
|
level_complete = false
|
||||||
|
gathered_nectar = 0
|
||||||
|
drones_used = 0
|
||||||
|
|
|
||||||
7
utility/global_scene_manager.gd
Normal file
7
utility/global_scene_manager.gd
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
class_name GlobalSceneManager extends Node
|
||||||
|
|
||||||
|
signal change_scene(scene_name: String)
|
||||||
|
|
||||||
|
func load_scene(scene_name: String) -> void:
|
||||||
|
Log.pr("Sending signal to change scene", scene_name)
|
||||||
|
emit_signal("change_scene", scene_name)
|
||||||
Loading…
Add table
Add a link
Reference in a new issue