diff --git a/assets/Images/Xenia Drawing 6.svg b/assets/Images/Xenia Drawing 6.svg index 42ef4f4..043807f 100644 --- a/assets/Images/Xenia Drawing 6.svg +++ b/assets/Images/Xenia Drawing 6.svg @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9a9b57eb7f3ef125ab9561d08ccdf555b369210837c8a2e0f19f17f3973938d4 -size 246359 +oid sha256:f0b6e08ffbd9574c8ae804b661a4d019c18a2cb231e4faf30c358d7e2e05987c +size 244737 diff --git a/level.gd b/level.gd index 969168a..bb3864b 100644 --- a/level.gd +++ b/level.gd @@ -8,6 +8,8 @@ var dimension: int = BASE_DIMENSION @export var ped_spawn_rate: int = 20 # Spawn Rate = rate - floor(stage_count * stage_mod) @export var ped_spawn_rate_stage_modifier: float = 0.5 +@export var speed_boost_spawn_rate = 1 +@export var bonus_time_spawn_rate = 1 var pedestrian_scn = preload("res://pedestrian.tscn") var chunk_scn = preload("res://chunk.tscn") @@ -51,16 +53,6 @@ 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 - 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): @@ -91,15 +83,34 @@ func initialize_world() -> void: var row: Array for y in range(dimension): var new_chunk = null + var can_spawn_pickup = false if Vector2i(x,y) == station: new_chunk = station_scn.instantiate() elif Vector2i(x,y) == spawn: new_chunk = spawn_scn.instantiate() + can_spawn_pickup = true else: new_chunk = chunk_scn.instantiate() + can_spawn_pickup = true + new_chunk.position = Vector3(x * Global.chunk_size+1, 0, y * Global.chunk_size+1) row.append(new_chunk) $ChunkContainer.add_child(new_chunk) + + if not can_spawn_pickup: + continue + + if randi() % bonus_time_spawn_rate == 0: + var bonus_time = bonus_time_scn.instantiate() + bonus_time.position.x = new_chunk.position.x + randf_range(-Global.chunk_size/2, Global.chunk_size/2) + bonus_time.position.z = new_chunk.position.z + randf_range(-Global.chunk_size/2, Global.chunk_size/2) + $ChunkContainer.add_child(bonus_time) + if randi() % speed_boost_spawn_rate == 0: + var speed_boost = speed_boost_scn.instantiate() + speed_boost.position.x = new_chunk.position.x + randf_range(-Global.chunk_size/2, Global.chunk_size/2) + speed_boost.position.z = new_chunk.position.z + randf_range(-Global.chunk_size/2, Global.chunk_size/2) + $ChunkContainer.add_child(speed_boost) + chunks.append(row) # ---- Set exits based on paths ---- diff --git a/pickup/bonus_time.tscn b/pickup/bonus_time.tscn index bcbfd10..34ea875 100644 --- a/pickup/bonus_time.tscn +++ b/pickup/bonus_time.tscn @@ -31,7 +31,7 @@ radius = 2.3896484 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) +transform = Transform3D(2.0101042, 0, 0, 0, 2.0101042, 0, 0, 0, 2.0101042, 0, 1, 0) mesh = SubResource("PlaneMesh_b5fwd") surface_material_override/0 = SubResource("StandardMaterial3D_cumbd") diff --git a/pickup/speed_boost.tscn b/pickup/speed_boost.tscn index 5417ce3..34652b1 100644 --- a/pickup/speed_boost.tscn +++ b/pickup/speed_boost.tscn @@ -30,7 +30,7 @@ radius = 2.3896484 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) +transform = Transform3D(2.0101042, 0, 0, 0, 2.0101042, 0, 0, 0, 2.0101042, 0, 1, 0) mesh = SubResource("PlaneMesh_b5fwd") surface_material_override/0 = SubResource("StandardMaterial3D_cumbd") diff --git a/player.gd b/player.gd index 8d449da..15a264d 100644 --- a/player.gd +++ b/player.gd @@ -82,6 +82,7 @@ func _on_area_area_entered(area: Area3D) -> void: if area.name == "StationArea": $FinishControl.visible = true $HUD.visible = false + var scoreLbl = $FinishControl/ScoreLabel for letter in SCORE_RANK: var rank = SCORE_RANK[letter] @@ -93,6 +94,13 @@ func _on_area_area_entered(area: Area3D) -> void: scoreLbl.text = letter scoreLbl.add_theme_color_override("font_color", rank["color"]) + + $FinishControl/DescLabel.text = """ + Diners guanyat: %s pessetes + Diners total: %d pessetes + 🥘s guanyat: %d 🥘 + 🥘s totals: %d 🥘 + """ % [rank["money"], $Shop.available_money, rank["special"], $Shop.special_currency] break $TimeLimit.stop()