From 53e0e535f06829b79aa79b3431eb957c6d484128 Mon Sep 17 00:00:00 2001 From: ToasterPanic Date: Mon, 1 Dec 2025 19:34:27 -0500 Subject: [PATCH] Boost improvements --- project.godot | 2 +- scenes/game.tscn | 28 +++++++++++++++++++++++- scripts/game.gd | 4 ++++ scripts/game.gd.uid | 1 + scripts/player.gd | 38 ++++++++++++++++++++++++++++----- sounds/2050_bass.mp3.import | 19 +++++++++++++++++ sounds/2050_drums.mp3.import | 19 +++++++++++++++++ sounds/2050_music.mp3.import | 19 +++++++++++++++++ sounds/boost.mp3.import | 19 +++++++++++++++++ sounds/boost_finish.mp3 | Bin 0 -> 8688 bytes sounds/boost_finish.mp3.import | 19 +++++++++++++++++ sounds/explode.mp3.import | 19 +++++++++++++++++ sounds/fire.mp3.import | 19 +++++++++++++++++ 13 files changed, 199 insertions(+), 7 deletions(-) create mode 100644 scripts/game.gd create mode 100644 scripts/game.gd.uid create mode 100644 sounds/2050_bass.mp3.import create mode 100644 sounds/2050_drums.mp3.import create mode 100644 sounds/2050_music.mp3.import create mode 100644 sounds/boost.mp3.import create mode 100644 sounds/boost_finish.mp3 create mode 100644 sounds/boost_finish.mp3.import create mode 100644 sounds/explode.mp3.import create mode 100644 sounds/fire.mp3.import diff --git a/project.godot b/project.godot index dcbee72..9ad690c 100644 --- a/project.godot +++ b/project.godot @@ -76,7 +76,7 @@ switch_weapons={ "events": [Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":10,"pressure":0.0,"pressed":false,"script":null) ] } -dash={ +boost={ "deadzone": 0.2, "events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":32,"key_label":0,"unicode":32,"location":0,"echo":false,"script":null) , Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":7,"pressure":0.0,"pressed":true,"script":null) diff --git a/scenes/game.tscn b/scenes/game.tscn index 43a0101..686b580 100644 --- a/scenes/game.tscn +++ b/scenes/game.tscn @@ -1,9 +1,12 @@ -[gd_scene load_steps=7 format=3 uid="uid://bauklhpieuivd"] +[gd_scene load_steps=10 format=3 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"] [ext_resource type="Script" uid="uid://bfxfkrkaebxk0" path="res://scripts/player.gd" id="1_yqjtg"] +[ext_resource type="AudioStream" uid="uid://brqjxveo53kco" path="res://sounds/boost.mp3" id="2_iywne"] [ext_resource type="AudioStream" uid="uid://5tr30e1tmdp6" path="res://sounds/collision.mp3" id="2_lbhrr"] [ext_resource type="PackedScene" uid="uid://dgng5vdhn6anc" path="res://scenes/asteroid.tscn" id="3_lnu2h"] +[ext_resource type="AudioStream" uid="uid://b1ung55xg31l3" path="res://sounds/boost_finish.mp3" id="3_p57ef"] [sub_resource type="CircleShape2D" id="CircleShape2D_uwrxv"] radius = 16.0 @@ -12,11 +15,18 @@ radius = 16.0 radius = 20.0 [node name="Game" type="Node2D"] +script = ExtResource("1_u5sy4") [node name="Player" type="RigidBody2D" parent="."] linear_damp = 6.247 script = ExtResource("1_yqjtg") +[node name="Boost" type="AudioStreamPlayer" parent="Player"] +stream = ExtResource("2_iywne") + +[node name="BoostFinish" type="AudioStreamPlayer" parent="Player"] +stream = ExtResource("3_p57ef") + [node name="Collision" type="AudioStreamPlayer" parent="Player"] stream = ExtResource("2_lbhrr") @@ -51,4 +61,20 @@ position = Vector2(-216, 134) [node name="Asteroid4" parent="." instance=ExtResource("3_lnu2h")] position = Vector2(-192, -427) +[node name="UI" type="CanvasLayer" parent="."] + +[node name="Control" type="Control" parent="UI"] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="BoostText" type="Label" parent="UI/Control"] +layout_mode = 0 +offset_right = 40.0 +offset_bottom = 24.0 +text = "BOOST: 100" + [connection signal="body_shape_entered" from="Player/Hitbox" to="Player" method="_on_hitbox_body_shape_entered"] diff --git a/scripts/game.gd b/scripts/game.gd new file mode 100644 index 0000000..daf1abd --- /dev/null +++ b/scripts/game.gd @@ -0,0 +1,4 @@ +extends Node2D + +func _process(delta: float) -> void: + $UI/Control/BoostText.text = "BOOST: " + str($Player.boost) diff --git a/scripts/game.gd.uid b/scripts/game.gd.uid new file mode 100644 index 0000000..4a2b6e3 --- /dev/null +++ b/scripts/game.gd.uid @@ -0,0 +1 @@ +uid://d0qswyhwbhdua diff --git a/scripts/player.gd b/scripts/player.gd index 6dbde7d..407bbd8 100644 --- a/scripts/player.gd +++ b/scripts/player.gd @@ -1,13 +1,35 @@ extends RigidBody2D var health = 1000 +var boost = 100 var time_since_last_collision = 1 var camera_shake_power = 0 +var boosting = false func _process(delta: float) -> void: $Camera.offset.x = randi_range(-camera_shake_power, camera_shake_power) $Camera.offset.y = randi_range(-camera_shake_power, camera_shake_power) + if boosting: + if Input.is_action_pressed("boost"): + boost -= delta * 40 + + if boost <= 0: + boost = 0 + boosting = false + $BoostFinish.play() + else: + boosting = false + $BoostFinish.play() + else: + boost += delta * 25 + if boost > 100: boost = 100 + + $Boost.stop() + if Input.is_action_just_pressed("boost") and (boost > 33): + boosting = true + $Boost.play() + if camera_shake_power > 0: camera_shake_power -= delta * 20 @@ -22,12 +44,18 @@ func _physics_process(delta: float) -> void: angular_velocity = deg_to_rad(180 * axis) - var new_velocity = transform.y * Input.get_axis("forward", "backward") * 512 + var final_speed = 512 - if (new_velocity.length() > linear_velocity.length() - 12) : - linear_velocity = transform.y * Input.get_axis("forward", "backward") * 512 - if time_since_last_collision < 1: - linear_velocity *= (time_since_last_collision + 0.15) * 2 + if boosting: + final_speed = 1024 + + # Slow down on collision and gradually speed up + if time_since_last_collision < 1: final_speed *= (time_since_last_collision + 0.15) * 2 + + var new_velocity = transform.y * Input.get_axis("forward", "backward") * final_speed + + if (new_velocity.length() > linear_velocity.length() - 12): + linear_velocity = new_velocity func _on_hitbox_body_shape_entered(body_rid: RID, body: Node2D, body_shape_index: int, local_shape_index: int) -> void: diff --git a/sounds/2050_bass.mp3.import b/sounds/2050_bass.mp3.import new file mode 100644 index 0000000..b10ffc4 --- /dev/null +++ b/sounds/2050_bass.mp3.import @@ -0,0 +1,19 @@ +[remap] + +importer="mp3" +type="AudioStreamMP3" +uid="uid://cdi7o5r4y3jpm" +path="res://.godot/imported/2050_bass.mp3-c0e821cf8314cd27ac0ff57d7b69ce25.mp3str" + +[deps] + +source_file="res://sounds/2050_bass.mp3" +dest_files=["res://.godot/imported/2050_bass.mp3-c0e821cf8314cd27ac0ff57d7b69ce25.mp3str"] + +[params] + +loop=false +loop_offset=0 +bpm=0 +beat_count=0 +bar_beats=4 diff --git a/sounds/2050_drums.mp3.import b/sounds/2050_drums.mp3.import new file mode 100644 index 0000000..9c5e911 --- /dev/null +++ b/sounds/2050_drums.mp3.import @@ -0,0 +1,19 @@ +[remap] + +importer="mp3" +type="AudioStreamMP3" +uid="uid://dklt4lfyqp2c" +path="res://.godot/imported/2050_drums.mp3-bb466a17b0f21890ffac6024700bc7fc.mp3str" + +[deps] + +source_file="res://sounds/2050_drums.mp3" +dest_files=["res://.godot/imported/2050_drums.mp3-bb466a17b0f21890ffac6024700bc7fc.mp3str"] + +[params] + +loop=false +loop_offset=0 +bpm=0 +beat_count=0 +bar_beats=4 diff --git a/sounds/2050_music.mp3.import b/sounds/2050_music.mp3.import new file mode 100644 index 0000000..efe1352 --- /dev/null +++ b/sounds/2050_music.mp3.import @@ -0,0 +1,19 @@ +[remap] + +importer="mp3" +type="AudioStreamMP3" +uid="uid://gf01n1oediuk" +path="res://.godot/imported/2050_music.mp3-a0fe9e1226f9749db65bebe92870c677.mp3str" + +[deps] + +source_file="res://sounds/2050_music.mp3" +dest_files=["res://.godot/imported/2050_music.mp3-a0fe9e1226f9749db65bebe92870c677.mp3str"] + +[params] + +loop=false +loop_offset=0 +bpm=0 +beat_count=0 +bar_beats=4 diff --git a/sounds/boost.mp3.import b/sounds/boost.mp3.import new file mode 100644 index 0000000..876d54a --- /dev/null +++ b/sounds/boost.mp3.import @@ -0,0 +1,19 @@ +[remap] + +importer="mp3" +type="AudioStreamMP3" +uid="uid://brqjxveo53kco" +path="res://.godot/imported/boost.mp3-c798be6ee26d6992b2c525033a00927f.mp3str" + +[deps] + +source_file="res://sounds/boost.mp3" +dest_files=["res://.godot/imported/boost.mp3-c798be6ee26d6992b2c525033a00927f.mp3str"] + +[params] + +loop=false +loop_offset=0 +bpm=0 +beat_count=0 +bar_beats=4 diff --git a/sounds/boost_finish.mp3 b/sounds/boost_finish.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..ec8b4970990cbf6dea0565f4b20b1cccedd8e360 GIT binary patch literal 8688 zcmeH~do<2V+;o4J|V_6cf+_u7enq*F1ZyM3KtgM=vzP^cxxw)mKr>AFVXk=u3{N>BP{Z>#=RCMFU zjj}Q-wW_MNw!XfxvAMamwe|PkJ36|%dwTl&2M33TA3b_BHumhY8{w;`U#+B#e_|%ZUZB$shX|U0tgG>%{+) zk+nLy!5=xCZP%a)a0>Tb zk>rF!qgXL|Y}$Rs(vA@09*(*IdS9Z%^`5L;f1);uM|F3-(KYTlF2@u87*&m~2^>O+ zI2^U*L)e7}R%j+1az39Y^$;&}?wNIq>XPPUe=n}d775^}&=cv?!hWMW;)Y!b(TrH1 z*f2pRqE-iRDa!VBy(K&Fy2Ku!-nLdlr|)ix-ebEDiReXPO;K@5T4RAav7SlgW(4;p z7phSX)B75WwQeRXh`&Z4;{8}GX3(rD^I97N;a|NQ0gx#P2QLmK7A6T&POCcVd!Ejh zlb0&}y{7AqR!NVT_qSW(nLICuVRKp6rSG)d)Wk`PUlXD{SHGy(n@i#SP<%ZgDWm=t zzKyCO4m1-9@(xa(b0N`O3dcsd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