diff --git a/chunk.gd b/chunk.gd new file mode 100644 index 0000000..d24c6b4 --- /dev/null +++ b/chunk.gd @@ -0,0 +1,31 @@ +extends Node3D + + +var exits: Array = [false, false, false, false] + + +func _ready() -> void: + exits = [ + randi() % 2 == 0, + randi() % 2 == 0, + randi() % 2 == 0, + randi() % 2 == 0, + ] + + update() + +func update() -> void: + var i = 0 + for exit in exits: + if not exit: + continue + if i == 0: #n + $n.get_surface_override_material(0).albedo_color = Color.GREEN + if i == 1: #s + $s.get_surface_override_material(0).albedo_color = Color.GREEN + if i == 2: #w + $w.get_surface_override_material(0).albedo_color = Color.GREEN + if i == 3: #e + $e.get_surface_override_material(0).albedo_color = Color.GREEN + + i += 1 diff --git a/chunk.gd.uid b/chunk.gd.uid new file mode 100644 index 0000000..a950372 --- /dev/null +++ b/chunk.gd.uid @@ -0,0 +1 @@ +uid://ndadug5eerju diff --git a/chunk.tscn b/chunk.tscn index 9350958..686c905 100644 --- a/chunk.tscn +++ b/chunk.tscn @@ -1,8 +1,51 @@ -[gd_scene format=3 uid="uid://x0nufa1wdu4j"] +[gd_scene format=3 uid="uid://cqbu5r5pmnhc"] -[sub_resource type="PlaneMesh" id="PlaneMesh_vonw3"] -size = Vector2(300, 300) +[ext_resource type="Script" uid="uid://ndadug5eerju" path="res://chunk.gd" id="1_kdh3y"] -[node name="MeshInstance3D" type="MeshInstance3D" unique_id=731620195] -transform = Transform3D(1.9467738, 0, 0, 0, 1.9467738, 0, 0, 0, 1.9467738, 0, 0, 0) -mesh = SubResource("PlaneMesh_vonw3") +[sub_resource type="PlaneMesh" id="PlaneMesh_kdh3y"] +size = Vector2(100, 100) + +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_kdh3y"] +albedo_color = Color(0, 0, 1, 1) + +[sub_resource type="PlaneMesh" id="PlaneMesh_eat54"] +material = SubResource("StandardMaterial3D_kdh3y") +size = Vector2(5, 5) + +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_eat54"] +albedo_color = Color(0, 0, 1, 1) + +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_a0kup"] +albedo_color = Color(0, 0, 1, 1) + +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_7yqgf"] +albedo_color = Color(0, 0, 1, 1) + +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_381vs"] +albedo_color = Color(0, 0, 1, 1) + +[node name="Chunk" type="Node3D" unique_id=1195945545] +script = ExtResource("1_kdh3y") + +[node name="Mesh" type="MeshInstance3D" parent="." unique_id=651037282] +mesh = SubResource("PlaneMesh_kdh3y") + +[node name="n" type="MeshInstance3D" parent="." unique_id=1732708017] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.2531815, -50.90088) +mesh = SubResource("PlaneMesh_eat54") +surface_material_override/0 = SubResource("StandardMaterial3D_eat54") + +[node name="s" type="MeshInstance3D" parent="." unique_id=2083422071] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.2531815, 50.541702) +mesh = SubResource("PlaneMesh_eat54") +surface_material_override/0 = SubResource("StandardMaterial3D_a0kup") + +[node name="w" type="MeshInstance3D" parent="." unique_id=518228778] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -50.98094, 1.2531815, -0.19546509) +mesh = SubResource("PlaneMesh_eat54") +surface_material_override/0 = SubResource("StandardMaterial3D_7yqgf") + +[node name="e" type="MeshInstance3D" parent="." unique_id=1202960026] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 49.071243, 1.2531815, -0.17337036) +mesh = SubResource("PlaneMesh_eat54") +surface_material_override/0 = SubResource("StandardMaterial3D_381vs") diff --git a/level.gd b/level.gd index 3f162d1..4600678 100644 --- a/level.gd +++ b/level.gd @@ -9,7 +9,12 @@ func _ready() -> void: # Populate the array with [dimension(x)][dimension(y)][4]bool for x in range(dimension): for y in range(dimension): - chunks.append([[], [], [], []]) + chunks.append([ + randi() % 2 == 0, + randi() % 2 == 0, + randi() % 2 == 0, + randi() % 2 == 0, + ]) # Decide position of station & spawn var station = Vector2i(randi() % dimension, 0) diff --git a/level.tscn b/level.tscn index 0ccd438..7d5ae69 100644 --- a/level.tscn +++ b/level.tscn @@ -3,7 +3,7 @@ [ext_resource type="Script" uid="uid://dj0cgqed5n3ys" path="res://level.gd" id="1_0b4ue"] [ext_resource type="PackedScene" uid="uid://cmb3b7xrlboy3" path="res://player.tscn" id="1_u52ul"] [ext_resource type="Script" uid="uid://b5ebibi08tjvd" path="res://camera_3d.gd" id="2_vonw3"] -[ext_resource type="PackedScene" path="res://chunk.tscn" id="3_f2txt"] +[ext_resource type="PackedScene" uid="uid://cqbu5r5pmnhc" path="res://chunk.tscn" id="3_f2txt"] [sub_resource type="Environment" id="Environment_vonw3"] ambient_light_source = 2 @@ -34,7 +34,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -7.031, 3.5, -11.78) mesh = SubResource("BoxMesh_oi3di") [node name="Camera3D" type="Camera3D" parent="." unique_id=2083164402] -transform = Transform3D(1, 0, 0, 0, -4.371139e-08, 1, 0, -1, -4.371139e-08, 0, 10, 0) +transform = Transform3D(1, 0, 0, 0, -4.371139e-08, 1, 0, -1, -4.371139e-08, 0, 25.705143, 0) current = true fov = 55.0 script = ExtResource("2_vonw3") diff --git a/player.gd b/player.gd index 65e47e9..ef99b86 100644 --- a/player.gd +++ b/player.gd @@ -1,6 +1,6 @@ extends CharacterBody3D const BASE_STAMINA = 50 -const BASE_SPEED = 4 +const BASE_SPEED = 10 const SPRINT_MULT = 1.6 const STAMINA_COST = 15 const STAMINA_RECOVER = 10 diff --git a/player.tscn b/player.tscn index 93b2804..f8729af 100644 --- a/player.tscn +++ b/player.tscn @@ -3,7 +3,7 @@ [ext_resource type="Script" uid="uid://bobw4cfg1v6gj" path="res://player.gd" id="1_4flbx"] [sub_resource type="PlaneMesh" id="PlaneMesh_sh265"] -size = Vector2(0.5, 0.5) +size = Vector2(1, 1) [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_4flbx"] albedo_color = Color(1, 0, 0, 1)