diff --git a/level.gd b/level.gd index 5826c61..e77c04a 100644 --- a/level.gd +++ b/level.gd @@ -8,10 +8,11 @@ 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) - var polarity = dir % 2 # 0: negative, 1: positive + var polarity = dir % 2 # 0: negative, 1: positive var axis = floor(dir / 2) # 0: vertical, 1: horizontal return Vector2i( axis * (polarity * 2 - 1), @@ -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) diff --git a/spawn.tscn b/spawn.tscn new file mode 100644 index 0000000..1983551 --- /dev/null +++ b/spawn.tscn @@ -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")