feat: Create and integrate spawn scene

This commit is contained in:
Dendy 2026-03-04 21:14:19 +01:00
parent 6704b3e4f0
commit 195a5e619f
2 changed files with 20 additions and 1 deletions

View File

@ -8,6 +8,7 @@ extends Node3D
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")
func dir_to_vector(dir: int) -> Vector2i:
assert(dir >= 0 and dir <= 3)
@ -71,6 +72,8 @@ func _ready() -> void:
var new_chunk = null
if Vector2i(x,y) == station:
new_chunk = station_scn.instantiate()
if Vector2i(x,y) == spawn:
new_chunk = spawn_scn.instantiate()
else:
new_chunk = chunk_scn.instantiate()
new_chunk.position = Vector3(x * Global.chunk_size+1, 0, y * Global.chunk_size+1)

16
spawn.tscn Normal file
View File

@ -0,0 +1,16 @@
[gd_scene format=3 uid="uid://m45422rsfnmh"]
[ext_resource type="Script" uid="uid://e3kpo73hvthu" path="res://station.gd" id="1_3a72r"]
[sub_resource type="PlaneMesh" id="PlaneMesh_kdh3y"]
size = Vector2(150, 150)
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_eoxb4"]
albedo_color = Color(0.4, 0.3126, 0.172, 1)
[node name="Spawn" type="Node3D" unique_id=1195945545]
script = ExtResource("1_3a72r")
[node name="Mesh" type="MeshInstance3D" parent="." unique_id=651037282]
mesh = SubResource("PlaneMesh_kdh3y")
surface_material_override/0 = SubResource("StandardMaterial3D_eoxb4")