From d4e5c476931bfc4c6e5b75ffd0e0e5cfafe9e4b9 Mon Sep 17 00:00:00 2001 From: ToasterPanic Date: Sat, 6 Dec 2025 17:53:47 -0500 Subject: [PATCH] Hyperboosting --- scenes/game.tscn | 65 ++++++++++++++++++++++++++++++++++-- scenes/ground.tscn | 2 ++ scenes/navigation_item.tscn | 2 +- scripts/game.gd | 42 ++++++++++++++++++++--- scripts/navigation_item.gd | 8 +++++ scripts/player.gd | 24 +++++++++++++ sounds/ui_back.mp3 | Bin 0 -> 2609 bytes sounds/ui_back.mp3.import | 19 +++++++++++ 8 files changed, 154 insertions(+), 8 deletions(-) create mode 100644 sounds/ui_back.mp3 create mode 100644 sounds/ui_back.mp3.import diff --git a/scenes/game.tscn b/scenes/game.tscn index ab4a5eb..4dd5f3d 100644 --- a/scenes/game.tscn +++ b/scenes/game.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=39 format=4 uid="uid://bauklhpieuivd"] +[gd_scene load_steps=41 format=4 uid="uid://bauklhpieuivd"] [ext_resource type="Script" uid="uid://d0qswyhwbhdua" path="res://scripts/game.gd" id="1_u5sy4"] [ext_resource type="Texture2D" uid="uid://dtwo7g0ipc4k" path="res://textures/ship_1.png" id="1_uwrxv"] @@ -9,6 +9,7 @@ [ext_resource type="AudioStream" uid="uid://b6tyof2j3ytbv" path="res://sounds/concrete_halls.mp3" id="3_0tnpc"] [ext_resource type="AudioStream" uid="uid://b1ung55xg31l3" path="res://sounds/boost_finish.mp3" id="3_p57ef"] [ext_resource type="AudioStream" uid="uid://cwidt34ehvre4" path="res://sounds/ui_select.mp3" id="4_5newe"] +[ext_resource type="AudioStream" uid="uid://bff3l15ivkcyi" path="res://sounds/ui_back.mp3" id="5_37s47"] [ext_resource type="PackedScene" uid="uid://gofibd3kwx3r" path="res://scenes/navigation_marker.tscn" id="5_264po"] [ext_resource type="AudioStream" uid="uid://y7lhonymtk3t" path="res://sounds/fire.mp3" id="8_vtaks"] [ext_resource type="Texture2D" uid="uid://dsdd1830ilu1" path="res://textures/navigation_ring.png" id="10_dinhu"] @@ -73,6 +74,9 @@ font_size = 12 [sub_resource type="LabelSettings" id="LabelSettings_bt5mj"] font_size = 14 +[sub_resource type="LabelSettings" id="LabelSettings_pl11u"] +font_size = 14 + [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_264po"] bg_color = Color(0, 0, 0, 1) border_color = Color(0.53333336, 0.53333336, 0.53333336, 1) @@ -112,6 +116,9 @@ bus = &"Music" [node name="UiSelect" type="AudioStreamPlayer" parent="."] stream = ExtResource("4_5newe") +[node name="UiBack" type="AudioStreamPlayer" parent="."] +stream = ExtResource("5_37s47") + [node name="Stars" type="Node2D" parent="."] [node name="Unloadables" type="Node2D" parent="."] @@ -394,6 +401,12 @@ layout_mode = 2 size_flags_horizontal = 3 text = "new route" +[node name="Hyperboost" type="Button" parent="UI/Control/Navpanel/Navigation"] +custom_minimum_size = Vector2(256, 0) +layout_mode = 2 +size_flags_horizontal = 3 +text = "hyperboost" + [node name="CancelRoute" type="Button" parent="UI/Control/Navpanel/Navigation"] custom_minimum_size = Vector2(256, 0) layout_mode = 2 @@ -426,7 +439,50 @@ layout_mode = 2 custom_minimum_size = Vector2(256, 0) layout_mode = 2 -[node name="NavpanelBack" type="Button" parent="UI/Control/Navpanel/NavigationRoutes"] +[node name="NavigationBack" type="Button" parent="UI/Control/Navpanel/NavigationRoutes"] +custom_minimum_size = Vector2(256, 0) +layout_mode = 2 +size_flags_horizontal = 3 +text = "back" + +[node name="NavigationHyperboost" 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/NavigationHyperboost"] +layout_mode = 2 +size_flags_horizontal = 3 +text = "HYPERBOOST?" +label_settings = SubResource("LabelSettings_5newe") +horizontal_alignment = 1 + +[node name="Description" type="Label" parent="UI/Control/Navpanel/NavigationHyperboost"] +custom_minimum_size = Vector2(256, 0) +layout_mode = 2 +size_flags_horizontal = 3 +text = "hyperboosting will allow you to reach your destination quicker. it uses your fuel." +label_settings = SubResource("LabelSettings_pl11u") +horizontal_alignment = 1 +autowrap_mode = 3 + +[node name="FuelRequired" type="Label" parent="UI/Control/Navpanel/NavigationHyperboost"] +custom_minimum_size = Vector2(256, 0) +layout_mode = 2 +size_flags_horizontal = 3 +text = "FUEL REQUIRED: +100%" +label_settings = SubResource("LabelSettings_37s47") +horizontal_alignment = 1 +autowrap_mode = 3 + +[node name="EnableHyperboost" type="Button" parent="UI/Control/Navpanel/NavigationHyperboost"] +custom_minimum_size = Vector2(256, 0) +layout_mode = 2 +size_flags_horizontal = 3 +text = "boost now" + +[node name="NavigationBack" type="Button" parent="UI/Control/Navpanel/NavigationHyperboost"] custom_minimum_size = Vector2(256, 0) layout_mode = 2 size_flags_horizontal = 3 @@ -565,7 +621,10 @@ color = Color(1, 1, 1, 0) [connection signal="pressed" from="UI/Control/Navpanel/Start/Navigation" to="." method="_on_navigation_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/NavigationRoutes/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"] [connection signal="pressed" from="UI/Control/PauseMenu/Panel/Flow/Resume" to="UI/Control/PauseMenu" method="_on_resume_pressed"] diff --git a/scenes/ground.tscn b/scenes/ground.tscn index 9a14aeb..517c7f8 100644 --- a/scenes/ground.tscn +++ b/scenes/ground.tscn @@ -86,6 +86,8 @@ shader_parameter/vignette_color = Color(0, 0, 0, 1) [sub_resource type="LabelSettings" id="LabelSettings_5vwr8"] font_size = 32 +outline_size = 4 +outline_color = Color(0, 0, 0, 1) [sub_resource type="ShaderMaterial" id="ShaderMaterial_jo68p"] shader = ExtResource("7_vuhkc") diff --git a/scenes/navigation_item.tscn b/scenes/navigation_item.tscn index c9f1172..76a36fc 100644 --- a/scenes/navigation_item.tscn +++ b/scenes/navigation_item.tscn @@ -5,7 +5,7 @@ [node name="NavigationItem" type="VBoxContainer"] script = ExtResource("1_vuhx2") -[node name="RichTextLabel" type="RichTextLabel" parent="."] +[node name="Label" type="RichTextLabel" parent="."] layout_mode = 2 bbcode_enabled = true text = "[font size=24]space station 1[/font] diff --git a/scripts/game.gd b/scripts/game.gd index fcc7542..b76972a 100644 --- a/scripts/game.gd +++ b/scripts/game.gd @@ -125,11 +125,19 @@ func _process(delta: float) -> void: $Navring.add_child(navigation_marker) + if $UI/Control/Navpanel/NavigationHyperboost.visible: + var distance_to_hyperboost = (global.stats.navigation_goal.point.global_position - $Player.global_position).length() - 3000 + var fuel_cost = floori((distance_to_hyperboost / 4096) * 7) + + $UI/Control/Navpanel/NavigationHyperboost/FuelRequired.text = "FUEL REQUIRED:\n"+ str(fuel_cost) + "%" + if $UI/Control/Navpanel/Navigation.visible: $UI/Control/Navpanel/Navigation/CurrentRoute.visible = true $UI/Control/Navpanel/Navigation/Destination.visible = true + $UI/Control/Navpanel/Navigation/Hyperboost.visible = true + var goal_distance = (global.stats.navigation_goal.point.position - $Player.position).length() $UI/Control/Navpanel/Navigation/Destination.text = global.stats.navigation_goal.name + " (" + str(floori(goal_distance)) + "u)" @@ -140,6 +148,12 @@ func _process(delta: float) -> void: if $UI/Control/Navpanel/Navigation.visible: $UI/Control/Navpanel/Navigation/CurrentRoute.visible = false $UI/Control/Navpanel/Navigation/Destination.visible = false + + $UI/Control/Navpanel/Navigation/Hyperboost.visible = false + + if $UI/Control/Navpanel/NavigationRoutes.visible: + for n in $UI/Control/Navpanel/NavigationRoutes/Scroll/Box.get_children(): + n.update() $Navring.position = $Player.position @@ -240,16 +254,20 @@ func _input(event: InputEvent) -> void: get_tree().paused = true elif event.is_action_pressed("navpanel"): if $UI/Control/Navpanel.visible: + $UiBack.play() + $UI/Control/Navpanel.visible = false else: + $UiSelect.play() + $UI/Control/Navpanel.visible = true _set_navpanel_menu("Start") elif event.is_action_pressed("ui_back"): if $UI/Control/Navpanel.visible: - $UiSelect.play() + $UiBack.play() - if $UI/Control/Navpanel/NavigationRoutes.visible: + if ($UI/Control/Navpanel/NavigationRoutes.visible) or ($UI/Control/Navpanel/NavigationHyperboost.visible): _set_navpanel_menu("Navigation") elif $UI/Control/Navpanel/Start.visible: $UI/Control/Navpanel.visible = false @@ -268,7 +286,7 @@ func _on_navigation_pressed() -> void: func _on_navpanel_back_pressed() -> void: - $UiSelect.play() + $UiBack.play() _set_navpanel_menu("Start") @@ -283,7 +301,7 @@ func _on_cancel_route_pressed() -> void: func _on_quit_pressed() -> void: - $UiSelect.play() + $UiBack.play() $UI/Control/Navpanel.visible = false @@ -291,3 +309,19 @@ func _navigation_item_pressed(goal) -> void: global.stats.navigation_goal = goal $UiSelect.play() _set_navpanel_menu("Navigation") + + +func _on_navigation_back_pressed() -> void: + $UiBack.play() + _set_navpanel_menu("Navigation") + + +func _on_hyperboost_pressed() -> void: + $UiSelect.play() + _set_navpanel_menu("NavigationHyperboost") + + +func _on_enable_hyperboost_pressed() -> void: + $UiSelect.play() + _set_navpanel_menu("Navigation") + $Player.hyperboosting = true diff --git a/scripts/navigation_item.gd b/scripts/navigation_item.gd index 7dd497f..b7ca30e 100644 --- a/scripts/navigation_item.gd +++ b/scripts/navigation_item.gd @@ -3,5 +3,13 @@ extends VBoxContainer var goal = null var game = null +func update() -> void: + var player = game.get_node("Player") + + var distance = floori((goal.point.global_position - player.position).length()) + + $Label.text = """[font size=24]%s[/font] +%su away""" % [goal.name, str(distance)] + func _on_button_pressed() -> void: game._navigation_item_pressed(goal) diff --git a/scripts/player.gd b/scripts/player.gd index 26f5ae1..ca87ea6 100644 --- a/scripts/player.gd +++ b/scripts/player.gd @@ -6,6 +6,7 @@ var time_since_last_fire = 0 var time_since_last_collision = 1 var camera_shake_power = 0 var boosting = false +var hyperboosting = false var laser_scene = preload("res://scenes/laser.tscn") @@ -76,6 +77,10 @@ func _process(delta: float) -> void: if time_since_last_collision <= 1: time_since_last_collision += delta + + if hyperboosting: + if (global.stats.navigation_goal.point.global_position - global_position).length() < 3000: + hyperboosting = false func _physics_process(delta: float) -> void: var axis = Input.get_axis("turn_left", "turn_right") @@ -88,6 +93,25 @@ func _physics_process(delta: float) -> void: if boosting: movement_axis = -1 final_speed = 1024 + + if hyperboosting: + movement_axis = -1 + final_speed = 4096 + + angular_velocity = 0 + + look_at(global.stats.navigation_goal.point.global_position) + + rotation_degrees += 90 + + global.stats.fuel -= delta * 7 + + $CollisionShape.disabled = true + $Hitbox.monitoring = false + else: + $CollisionShape.disabled = false + $Hitbox.monitoring = true + # Slow down on collision and gradually speed up if time_since_last_collision < 0.85: final_speed *= (time_since_last_collision + 0.15) diff --git a/sounds/ui_back.mp3 b/sounds/ui_back.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..0d72c57679a02a896b88c790b5c0ab20047ee5c8 GIT binary patch literal 2609 zcmd^>`8V6?9>>2SBqAl2SZ{-blqzB;N<$+Ow3d#D?Y2#+y`_v=s*?(7qP9{+q+?A6 z!%*8*x3*eJs#>Kpwo}1v2W?GJohoidf0%pD^#|N@=G@mg&v`!2=lS9De$Mkg=kpQo zMsL|=6@on86z=f(faF5c2#y0hn}iL$SpM0noEq`@|YqW+31&gf=N# z!iDu;CZ z^yj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869763 --- /dev/null +++ b/sounds/ui_back.mp3.import @@ -0,0 +1,19 @@ +[remap] + +importer="mp3" +type="AudioStreamMP3" +uid="uid://bff3l15ivkcyi" +path="res://.godot/imported/ui_back.mp3-bf66999dc419b2d6276594976ab37a57.mp3str" + +[deps] + +source_file="res://sounds/ui_back.mp3" +dest_files=["res://.godot/imported/ui_back.mp3-bf66999dc419b2d6276594976ab37a57.mp3str"] + +[params] + +loop=false +loop_offset=0 +bpm=0 +beat_count=0 +bar_beats=4