Merge remote-tracking branch 'refs/remotes/origin/main'
This commit is contained in:
commit
f442613e85
BIN
assets/Images/Xenia Drawing 6.svg (Stored with Git LFS)
BIN
assets/Images/Xenia Drawing 6.svg (Stored with Git LFS)
Binary file not shown.
31
level.gd
31
level.gd
|
|
@ -8,6 +8,8 @@ var dimension: int = BASE_DIMENSION
|
||||||
@export var ped_spawn_rate: int = 20
|
@export var ped_spawn_rate: int = 20
|
||||||
# Spawn Rate = rate - floor(stage_count * stage_mod)
|
# Spawn Rate = rate - floor(stage_count * stage_mod)
|
||||||
@export var ped_spawn_rate_stage_modifier: float = 0.5
|
@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 pedestrian_scn = preload("res://pedestrian.tscn")
|
||||||
var chunk_scn = preload("res://chunk.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.x = spawn.x * Global.chunk_size
|
||||||
$Player.position.z = spawn.y * 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 ----
|
# ---- Generate the paths ----
|
||||||
var paths: Array = []
|
var paths: Array = []
|
||||||
for path_idx in range(path_count):
|
for path_idx in range(path_count):
|
||||||
|
|
@ -91,15 +83,34 @@ func initialize_world() -> void:
|
||||||
var row: Array
|
var row: Array
|
||||||
for y in range(dimension):
|
for y in range(dimension):
|
||||||
var new_chunk = null
|
var new_chunk = null
|
||||||
|
var can_spawn_pickup = false
|
||||||
if Vector2i(x,y) == station:
|
if Vector2i(x,y) == station:
|
||||||
new_chunk = station_scn.instantiate()
|
new_chunk = station_scn.instantiate()
|
||||||
elif Vector2i(x,y) == spawn:
|
elif Vector2i(x,y) == spawn:
|
||||||
new_chunk = spawn_scn.instantiate()
|
new_chunk = spawn_scn.instantiate()
|
||||||
|
can_spawn_pickup = true
|
||||||
else:
|
else:
|
||||||
new_chunk = chunk_scn.instantiate()
|
new_chunk = chunk_scn.instantiate()
|
||||||
|
can_spawn_pickup = true
|
||||||
|
|
||||||
new_chunk.position = Vector3(x * Global.chunk_size+1, 0, y * Global.chunk_size+1)
|
new_chunk.position = Vector3(x * Global.chunk_size+1, 0, y * Global.chunk_size+1)
|
||||||
row.append(new_chunk)
|
row.append(new_chunk)
|
||||||
$ChunkContainer.add_child(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)
|
chunks.append(row)
|
||||||
|
|
||||||
# ---- Set exits based on paths ----
|
# ---- Set exits based on paths ----
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ radius = 2.3896484
|
||||||
script = SubResource("GDScript_rqnpm")
|
script = SubResource("GDScript_rqnpm")
|
||||||
|
|
||||||
[node name="Cartell" type="MeshInstance3D" parent="." unique_id=1340947697]
|
[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")
|
mesh = SubResource("PlaneMesh_b5fwd")
|
||||||
surface_material_override/0 = SubResource("StandardMaterial3D_cumbd")
|
surface_material_override/0 = SubResource("StandardMaterial3D_cumbd")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ radius = 2.3896484
|
||||||
script = SubResource("GDScript_rqnpm")
|
script = SubResource("GDScript_rqnpm")
|
||||||
|
|
||||||
[node name="Cartell" type="MeshInstance3D" parent="." unique_id=1340947697]
|
[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")
|
mesh = SubResource("PlaneMesh_b5fwd")
|
||||||
surface_material_override/0 = SubResource("StandardMaterial3D_cumbd")
|
surface_material_override/0 = SubResource("StandardMaterial3D_cumbd")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -82,6 +82,7 @@ func _on_area_area_entered(area: Area3D) -> void:
|
||||||
if area.name == "StationArea":
|
if area.name == "StationArea":
|
||||||
$FinishControl.visible = true
|
$FinishControl.visible = true
|
||||||
$HUD.visible = false
|
$HUD.visible = false
|
||||||
|
|
||||||
var scoreLbl = $FinishControl/ScoreLabel
|
var scoreLbl = $FinishControl/ScoreLabel
|
||||||
for letter in SCORE_RANK:
|
for letter in SCORE_RANK:
|
||||||
var rank = SCORE_RANK[letter]
|
var rank = SCORE_RANK[letter]
|
||||||
|
|
@ -93,6 +94,13 @@ func _on_area_area_entered(area: Area3D) -> void:
|
||||||
|
|
||||||
scoreLbl.text = letter
|
scoreLbl.text = letter
|
||||||
scoreLbl.add_theme_color_override("font_color", rank["color"])
|
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
|
break
|
||||||
|
|
||||||
$TimeLimit.stop()
|
$TimeLimit.stop()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue