feat: Add bonus time pickup w/ logic

This commit is contained in:
Dendy 2026-03-05 19:31:28 +01:00
parent e2fc3e6638
commit f8ceccc539
6 changed files with 103 additions and 0 deletions

BIN
assets/Images/time-add-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://jc723dycmkud"
path.s3tc="res://.godot/imported/time-add-svgrepo-com.svg-74e89ddd2f8c60e8e7715f5bb5a2c57b.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://assets/Images/time-add-svgrepo-com.svg"
dest_files=["res://.godot/imported/time-add-svgrepo-com.svg-74e89ddd2f8c60e8e7715f5bb5a2c57b.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

1
cc.txt
View File

@ -1,2 +1,3 @@
Rails by dook [CC-BY] (https://creativecommons.org/licenses/by/3.0/) via Poly Pizza (https://poly.pizza/m/5JTOJuMHJw)
Jim the Linux Penguin by Rebekah Yoder is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
Drink Tea SVG Vector by Zlatko Najdenovski is licensed under a Creative COmmons Attribution International License.

View File

@ -13,6 +13,7 @@ var pedestrian_scn = preload("res://pedestrian.tscn")
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")
func dir_to_vector(dir: int) -> Vector2i:
assert(dir >= 0 and dir <= 3)
@ -49,6 +50,11 @@ func initialize_world() -> void:
$Player.position.x = spawn.x * Global.chunk_size
$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
add_child(bt)
# ---- Generate the paths ----
var paths: Array = []
for path_idx in range(path_count):

46
pickup/bonus_time.tscn Normal file
View File

@ -0,0 +1,46 @@
[gd_scene format=3 uid="uid://dhlgypwxsdvi1"]
[ext_resource type="Texture2D" uid="uid://jc723dycmkud" path="res://assets/Images/time-add-svgrepo-com.svg" id="1_rqnpm"]
[sub_resource type="GDScript" id="GDScript_rqnpm"]
script/source = "extends Node3D
func _on_area_entered(area: Area3D) -> void:
if area.name != \"Hurtbox\":
return
var parent = area.get_parent()
if parent.name == \"Player\":
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"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_cumbd"]
transparency = 1
albedo_texture = ExtResource("1_rqnpm")
[sub_resource type="CylinderShape3D" id="CylinderShape3D_rqnpm"]
height = 2.5239258
radius = 2.3896484
[node name="BonusTime" 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="BonusTimeArea" 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="BonusTimeArea" 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="BonusTimeArea" to="." method="_on_area_entered"]

View File

@ -21,6 +21,9 @@ var pedestrian_area_count = 0
var max_stamina: float = BASE_STAMINA
var stamina: float = max_stamina
const BASE_BONUS_TIME_AMOUNT = 30
var bonus_time_amount: float = BASE_BONUS_TIME_AMOUNT # seconds
var stage_counter: int = 0
var is_active: bool = true