feat: Add speed boost pickup

This commit is contained in:
Dendy 2026-03-05 20:05:47 +01:00
parent 31667fb73b
commit f9f98c436a
7 changed files with 115 additions and 10 deletions

BIN
assets/Images/drink-tea-svgrepo-com.svg (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,44 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cq5agx2karf0a"
path.s3tc="res://.godot/imported/drink-tea-svgrepo-com.svg-675a19c3e990ab00b5a0cb1303128a33.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://assets/Images/drink-tea-svgrepo-com.svg"
dest_files=["res://.godot/imported/drink-tea-svgrepo-com.svg-675a19c3e990ab00b5a0cb1303128a33.s3tc.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=0
svg/scale=1.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false

View File

@ -14,6 +14,7 @@ var chunk_scn = preload("res://chunk.tscn")
var station_scn = preload("res://station.tscn")
var spawn_scn = preload("res://spawn.tscn")
var bonus_time_scn = preload("res://pickup/bonus_time.tscn")
var speed_boost_scn = preload("res://pickup/speed_boost.tscn")
func dir_to_vector(dir: int) -> Vector2i:
assert(dir >= 0 and dir <= 3)
@ -51,10 +52,15 @@ func initialize_world() -> void:
$Player.position.z = spawn.y * Global.chunk_size
var bt = bonus_time_scn.instantiate()
bt.position.x = spawn.x * Global.chunk_size + 50
bt.position.z = spawn.y * Global.chunk_size + 50
bt.position.x = spawn.x * Global.chunk_size - 10
bt.position.z = spawn.y * Global.chunk_size + 20
add_child(bt)
var sb = speed_boost_scn.instantiate()
sb.position.x = spawn.x * Global.chunk_size + 10
sb.position.z = spawn.y * Global.chunk_size + 20
add_child(sb)
# ---- Generate the paths ----
var paths: Array = []
for path_idx in range(path_count):

View File

@ -15,7 +15,6 @@ func _on_area_entered(area: Area3D) -> void:
var timer: Timer = parent.get_node(\"TimeLimit\")
timer.start(timer.time_left + parent.bonus_time_amount)
queue_free()
"
[sub_resource type="PlaneMesh" id="PlaneMesh_b5fwd"]

44
pickup/speed_boost.tscn Normal file
View File

@ -0,0 +1,44 @@
[gd_scene format=3 uid="uid://ckx20kekib0od"]
[ext_resource type="Texture2D" uid="uid://cq5agx2karf0a" path="res://assets/Images/drink-tea-svgrepo-com.svg" id="1_y24h4"]
[sub_resource type="GDScript" id="GDScript_rqnpm"]
script/source = "extends Node3D
func _on_area_entered(area: Area3D) -> void:
if area.name != \"Hurtbox\":
return
var player = area.get_parent()
if player.name == \"Player\":
var timer: Timer = player.get_node(\"SpeedBoostTimer\")
timer.start()
queue_free()
"
[sub_resource type="PlaneMesh" id="PlaneMesh_b5fwd"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_cumbd"]
transparency = 1
albedo_texture = ExtResource("1_y24h4")
[sub_resource type="CylinderShape3D" id="CylinderShape3D_rqnpm"]
height = 2.5239258
radius = 2.3896484
[node name="SpeedBoost" type="Node3D" unique_id=2030295907]
script = SubResource("GDScript_rqnpm")
[node name="Cartell" type="MeshInstance3D" parent="." unique_id=1340947697]
transform = Transform3D(2.0101042, 0, 0, 0, 2.0101042, 0, 0, 0, 2.0101042, 0, 0.28158534, 0)
mesh = SubResource("PlaneMesh_b5fwd")
surface_material_override/0 = SubResource("StandardMaterial3D_cumbd")
[node name="SpeedBoostArea" type="Area3D" parent="." unique_id=2068048094]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.28158534, 0)
[node name="CollisionShape3D" type="CollisionShape3D" parent="SpeedBoostArea" unique_id=62431841]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.2619629, 0)
shape = SubResource("CylinderShape3D_rqnpm")
[connection signal="area_entered" from="SpeedBoostArea" to="." method="_on_area_entered"]

View File

@ -21,8 +21,11 @@ var pedestrian_area_count = 0
var max_stamina: float = BASE_STAMINA
var stamina: float = max_stamina
const BASE_BONUS_TIME_AMOUNT = 30
# ---- Pickups ----
const BASE_BONUS_TIME_AMOUNT = 30 # seconds
const BASE_SPEED_BOOST_FACTOR = 2
var bonus_time_amount: float = BASE_BONUS_TIME_AMOUNT # seconds
var speed_boost_factor: float = BASE_SPEED_BOOST_FACTOR
var stage_counter: int = 0
@ -54,6 +57,8 @@ func _process(delta: float) -> void:
var dir = Input.get_vector("player_move_left", "player_move_right", "player_move_up", "player_move_down")
var speed: float = BASE_SPEED
if $SpeedBoostTimer.time_left > 0:
speed *= speed_boost_factor
if (pedestrian_area_count > 0):
speed *= SLOW_MULT

View File

@ -43,6 +43,10 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.1, 0)
shape = SubResource("CylinderShape3D_i3pqv")
debug_color = Color(0.41852123, 0.4635067, 0.996484, 0.41960785)
[node name="SpeedBoostTimer" type="Timer" parent="." unique_id=1248180543]
wait_time = 3.0
one_shot = true
[node name="TimeLimit" type="Timer" parent="." unique_id=1568603467]
wait_time = 60.0
one_shot = true