Contracts in navagent, UI fixes, begin test contract

This commit is contained in:
ToasterPanic 2025-12-08 10:20:28 -05:00
parent 71e42c0372
commit 051c46d40d
12 changed files with 147 additions and 36 deletions

View file

@ -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].)

20
scenes/contract_item.tscn Normal file
View file

@ -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"]

View file

@ -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"]

View file

@ -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

14
scripts/contract_item.gd Normal file
View file

@ -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()

View file

@ -0,0 +1 @@
uid://c3m22vi3fsimq

View file

@ -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())

View file

@ -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")

View file

@ -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()

View file

@ -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,

View file

@ -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()

View file

@ -1 +0,0 @@
uid://b6xubbxfsaqby