From 051c46d40dc5c90cb681ef8994fa6d95effd3c52 Mon Sep 17 00:00:00 2001 From: ToasterPanic Date: Mon, 8 Dec 2025 10:20:28 -0500 Subject: [PATCH] Contracts in navagent, UI fixes, begin test contract --- README.md | 7 ++-- scenes/contract_item.tscn | 20 +++++++++++ scenes/game.tscn | 61 +++++++++++++++++++++++++++++++++ scenes/mission_objectives.tscn | 3 ++ scripts/contract_item.gd | 14 ++++++++ scripts/contract_item.gd.uid | 1 + scripts/enterable.gd | 4 +++ scripts/game.gd | 31 +++++++++++++++++ scripts/game_ground.gd | 2 ++ scripts/global.gd | 6 ++++ scripts/player_ground_v2.gd | 33 ------------------ scripts/player_ground_v2.gd.uid | 1 - 12 files changed, 147 insertions(+), 36 deletions(-) create mode 100644 scenes/contract_item.tscn create mode 100644 scripts/contract_item.gd create mode 100644 scripts/contract_item.gd.uid delete mode 100644 scripts/player_ground_v2.gd delete mode 100644 scripts/player_ground_v2.gd.uid diff --git a/README.md b/README.md index 7579f33..3d332e0 100644 --- a/README.md +++ b/README.md @@ -4,12 +4,15 @@ A full remake of my previous Space Game with far more features, content and functionality. The only borrowed assets from the original game are sound effects, and also the code for stars. Turns out that's hard to do right. +I likely will finish this game after siege, although it will not be immediately. + ## Hints for testers I bit off a bit more than I could chew, and therefore this project got bigger than intended. Treat this as a very early alpha build of sorts. -- In your ship, you can press the SELECT/SHARE/- button on your controller to open the navagent. You can fast travel and pick up contracts. -- The only real content is in the intro and contracts. +- In your ship, you can press the SELECT/SHARE/BACK/- button on your controller (or CAPS LOCK on PC) to open the navpanel. You can fast travel and pick up contracts. +- The only real content is in the intro and first contract. - In the intro, you probably shouldn't fight the enemies that chase you. They are very beefy. +- The first contract is not finished. The following hints require the console, which can be opened with the TILDE key (the key with ~ on it, usually below [ESC].) diff --git a/scenes/contract_item.tscn b/scenes/contract_item.tscn new file mode 100644 index 0000000..8ad8962 --- /dev/null +++ b/scenes/contract_item.tscn @@ -0,0 +1,20 @@ +[gd_scene load_steps=2 format=3 uid="uid://b28c58tdwi3k5"] + +[ext_resource type="Script" uid="uid://c3m22vi3fsimq" path="res://scripts/contract_item.gd" id="1_y4oga"] + +[node name="ContractItem" type="VBoxContainer"] +script = ExtResource("1_y4oga") + +[node name="Label" type="RichTextLabel" parent="."] +layout_mode = 2 +bbcode_enabled = true +text = "[font size=24]space station 1[/font] +1000u away" +fit_content = true +scroll_active = false + +[node name="Button" type="Button" parent="."] +layout_mode = 2 +text = "select" + +[connection signal="pressed" from="Button" to="." method="_on_button_pressed"] diff --git a/scenes/game.tscn b/scenes/game.tscn index 78f2610..83ce41d 100644 --- a/scenes/game.tscn +++ b/scenes/game.tscn @@ -173,6 +173,7 @@ position = Vector2(0, -20000) scale = Vector2(2, 2) texture = ExtResource("12_dinhu") script = ExtResource("13_trtic") +active_mission_requirement = "test_contract" [node name="Collision" type="TileMapLayer" parent="Orbits/SpaceStation2/space_station_2"] visible = false @@ -382,6 +383,12 @@ layout_mode = 2 size_flags_horizontal = 3 text = "navigation" +[node name="Contracts" type="Button" parent="UI/Control/Navpanel/Start"] +custom_minimum_size = Vector2(256, 0) +layout_mode = 2 +size_flags_horizontal = 3 +text = "contracts" + [node name="Quit" type="Button" parent="UI/Control/Navpanel/Start"] custom_minimum_size = Vector2(256, 0) layout_mode = 2 @@ -459,6 +466,56 @@ layout_mode = 2 size_flags_horizontal = 3 text = "back" +[node name="ContractsList" type="HFlowContainer" parent="UI/Control/Navpanel"] +visible = false +layout_mode = 2 +theme_override_constants/v_separation = 0 + +[node name="Label3" type="Label" parent="UI/Control/Navpanel/ContractsList"] +layout_mode = 2 +size_flags_horizontal = 3 +text = "PICK ROUTE" +label_settings = SubResource("LabelSettings_5newe") +horizontal_alignment = 1 + +[node name="Scroll" type="ScrollContainer" parent="UI/Control/Navpanel/ContractsList"] +custom_minimum_size = Vector2(256, 512) +layout_mode = 2 + +[node name="Box" type="VBoxContainer" parent="UI/Control/Navpanel/ContractsList/Scroll"] +custom_minimum_size = Vector2(256, 0) +layout_mode = 2 + +[node name="ContractsBack" type="Button" parent="UI/Control/Navpanel/ContractsList"] +custom_minimum_size = Vector2(256, 0) +layout_mode = 2 +size_flags_horizontal = 3 +text = "back" + +[node name="Contracts" type="HFlowContainer" parent="UI/Control/Navpanel"] +visible = false +layout_mode = 2 +theme_override_constants/v_separation = 0 + +[node name="Label3" type="Label" parent="UI/Control/Navpanel/Contracts"] +layout_mode = 2 +size_flags_horizontal = 3 +text = "CONTRACTS" +label_settings = SubResource("LabelSettings_5newe") +horizontal_alignment = 1 + +[node name="NewContract" type="Button" parent="UI/Control/Navpanel/Contracts"] +custom_minimum_size = Vector2(256, 0) +layout_mode = 2 +size_flags_horizontal = 3 +text = "new route" + +[node name="NavpanelBack" type="Button" parent="UI/Control/Navpanel/Contracts"] +custom_minimum_size = Vector2(256, 0) +layout_mode = 2 +size_flags_horizontal = 3 +text = "back" + [node name="NavigationRoutes" type="HFlowContainer" parent="UI/Control/Navpanel"] visible = false layout_mode = 2 @@ -698,11 +755,15 @@ color = Color(1, 1, 1, 0) [connection signal="body_entered" from="Orbits/SpaceStation2/space_station_2/EnterHitbox" to="Orbits/SpaceStation2/space_station_2" method="_on_enter_hitbox_body_entered"] [connection signal="body_shape_entered" from="Player/Hitbox" to="Player" method="_on_hitbox_body_shape_entered"] [connection signal="pressed" from="UI/Control/Navpanel/Start/Navigation" to="." method="_on_navigation_pressed"] +[connection signal="pressed" from="UI/Control/Navpanel/Start/Contracts" to="." method="_on_contracts_pressed"] [connection signal="pressed" from="UI/Control/Navpanel/Start/Quit" to="." method="_on_quit_pressed"] [connection signal="pressed" from="UI/Control/Navpanel/Navigation/NewRoute" to="." method="_on_new_route_pressed"] [connection signal="pressed" from="UI/Control/Navpanel/Navigation/Hyperboost" to="." method="_on_hyperboost_pressed"] [connection signal="pressed" from="UI/Control/Navpanel/Navigation/CancelRoute" to="." method="_on_cancel_route_pressed"] [connection signal="pressed" from="UI/Control/Navpanel/Navigation/NavpanelBack" to="." method="_on_navpanel_back_pressed"] +[connection signal="pressed" from="UI/Control/Navpanel/ContractsList/ContractsBack" to="." method="_on_contracts_back_pressed"] +[connection signal="pressed" from="UI/Control/Navpanel/Contracts/NewContract" to="." method="_on_new_contract_pressed"] +[connection signal="pressed" from="UI/Control/Navpanel/Contracts/NavpanelBack" to="." method="_on_navpanel_back_pressed"] [connection signal="pressed" from="UI/Control/Navpanel/NavigationRoutes/NavigationBack" to="." method="_on_navigation_back_pressed"] [connection signal="pressed" from="UI/Control/Navpanel/NavigationHyperboost/EnableHyperboost" to="." method="_on_enable_hyperboost_pressed"] [connection signal="pressed" from="UI/Control/Navpanel/NavigationHyperboost/NavigationBack" to="." method="_on_navigation_back_pressed"] diff --git a/scenes/mission_objectives.tscn b/scenes/mission_objectives.tscn index 5fe817b..c483827 100644 --- a/scenes/mission_objectives.tscn +++ b/scenes/mission_objectives.tscn @@ -11,6 +11,8 @@ shadow_color = Color(0, 0, 0, 1) [sub_resource type="LabelSettings" id="LabelSettings_e3s4u"] font_size = 18 +shadow_size = 4 +shadow_color = Color(0, 0, 0, 1) [node name="MissionObjectives" type="VBoxContainer"] custom_minimum_size = Vector2(256, 0) @@ -32,3 +34,4 @@ horizontal_alignment = 1 layout_mode = 2 text = "- RUN!" label_settings = SubResource("LabelSettings_e3s4u") +autowrap_mode = 3 diff --git a/scripts/contract_item.gd b/scripts/contract_item.gd new file mode 100644 index 0000000..6e7cd7b --- /dev/null +++ b/scripts/contract_item.gd @@ -0,0 +1,14 @@ +extends VBoxContainer + +var contract = null +var game = null + +func update() -> void: + $Label.text = """[font size=24]%s[/font] +%s""" % [global.missions[contract].name, global.missions[contract].desc] + +func _on_button_pressed() -> void: + game._contracts_item_pressed(contract) + +func _ready() -> void: + update() diff --git a/scripts/contract_item.gd.uid b/scripts/contract_item.gd.uid new file mode 100644 index 0000000..2c5332e --- /dev/null +++ b/scripts/contract_item.gd.uid @@ -0,0 +1 @@ +uid://c3m22vi3fsimq diff --git a/scripts/enterable.gd b/scripts/enterable.gd index 4532b85..0dd722e 100644 --- a/scripts/enterable.gd +++ b/scripts/enterable.gd @@ -1,7 +1,11 @@ extends Sprite2D @onready var game = get_owner() +@export var active_mission_requirement: String = "" func _on_enter_hitbox_body_entered(body: Node2D) -> void: + if active_mission_requirement != "": + if global.stats.active_mission != active_mission_requirement: return + if body.get_name() == "Player": game.enter_physical(get_name()) diff --git a/scripts/game.gd b/scripts/game.gd index 2bd51c0..f5e9664 100644 --- a/scripts/game.gd +++ b/scripts/game.gd @@ -102,6 +102,14 @@ func _ready() -> void: $UI/Control/Navpanel/NavigationRoutes/Scroll/Box.add_child(navigation_item) + for n in global.contracts: + var contract_item = preload("res://scenes/contract_item.tscn").instantiate() + + contract_item.contract = n + contract_item.game = self + + $UI/Control/Navpanel/ContractsList/Scroll/Box.add_child(contract_item) + var i = 0 while i < 1024 / 3: var star = star_scene.instantiate() @@ -319,6 +327,8 @@ func _input(event: InputEvent) -> void: if ($UI/Control/Navpanel/NavigationRoutes.visible) or ($UI/Control/Navpanel/NavigationHyperboost.visible): _set_navpanel_menu("Navigation") + elif $UI/Control/Navpanel/ContractsList.visible: + _set_navpanel_menu("Contracts") elif $UI/Control/Navpanel/Start.visible: $UI/Control/Navpanel.visible = false else: @@ -360,6 +370,15 @@ func _navigation_item_pressed(goal) -> void: $UiSelect.play() _set_navpanel_menu("Navigation") +func _contracts_item_pressed(contract) -> void: + if global.stats.active_mission: return + + global.stats.active_mission = contract + global.stats.mission_progress = 0 + + $UiSelect.play() + _set_navpanel_menu("Contracts") + func _on_navigation_back_pressed() -> void: $UiBack.play() @@ -375,3 +394,15 @@ func _on_enable_hyperboost_pressed() -> void: $UiSelect.play() _set_navpanel_menu("Navigation") $Player.hyperboosting = true + +func _on_new_contract_pressed() -> void: + $UiSelect.play() + _set_navpanel_menu("ContractsList") + +func _on_contracts_pressed() -> void: + $UiSelect.play() + _set_navpanel_menu("Contracts") + +func _on_contracts_back_pressed() -> void: + $UiBack.play() + _set_navpanel_menu("Contracts") diff --git a/scripts/game_ground.gd b/scripts/game_ground.gd index ee95fe9..299ab21 100644 --- a/scripts/game_ground.gd +++ b/scripts/game_ground.gd @@ -74,6 +74,8 @@ func _ready() -> void: $PlayerGround.global_position.y = global.stats.position.y global.stats.position = null + else: + $PlayerGround.global_position = $PlayerSpawn.global_position if global.stats.loaded: save_game() diff --git a/scripts/global.gd b/scripts/global.gd index fa88c30..6818292 100644 --- a/scripts/global.gd +++ b/scripts/global.gd @@ -4,6 +4,7 @@ func _ready() -> void: load_settings() LimboConsole.register_command(set_story_progress, "set_story_progress", "Sets the current story_progress variable") + LimboConsole.register_command(set_active_mission, "set_active_mission", "Sets the current active_mission variable") var ground_location = null @@ -59,6 +60,8 @@ var missions = { }, } +var contracts = [ "test_contract" ] + var ground_guns = { "pistol": { "name": "Oni", @@ -148,6 +151,9 @@ func delete_game(): func set_story_progress(value: int) -> void: stats.story_progress = value + +func set_active_mission(value = null) -> void: + stats.active_mission = value var default_stats = { "loaded": false, diff --git a/scripts/player_ground_v2.gd b/scripts/player_ground_v2.gd deleted file mode 100644 index 35cf43e..0000000 --- a/scripts/player_ground_v2.gd +++ /dev/null @@ -1,33 +0,0 @@ -extends CharacterBody2D - -## Is the player busy in an interaction? -var busy = false - -func _ready() -> void: - $Sprite.play() - -func _process(delta: float) -> void: - if "_process_2" in self: _process_2(delta) - - var horizontial_movement = Input.get_axis("ground_left", "ground_right") - var vertical_movement = Input.get_axis("ground_up", "ground_down") - - if busy: - velocity = Vector2() - else: - velocity = Vector2(256 * horizontial_movement, 256 * vertical_movement) - - if horizontial_movement > 0.1: - $Sprite.scale.x = -2 - if horizontial_movement < -0.1: - $Sprite.scale.x = 2 - - if velocity.length() > 8: - $Sprite.animation = "walk" - if abs(horizontial_movement) > abs(vertical_movement): $Sprite.speed_scale = abs(horizontial_movement) - else: $Sprite.speed_scale = abs(vertical_movement) - else: - $Sprite.animation = "idle" - - - move_and_slide() diff --git a/scripts/player_ground_v2.gd.uid b/scripts/player_ground_v2.gd.uid deleted file mode 100644 index 7cc8158..0000000 --- a/scripts/player_ground_v2.gd.uid +++ /dev/null @@ -1 +0,0 @@ -uid://b6xubbxfsaqby