summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Scenes/Dungeon.gd4
-rw-r--r--Scenes/Dungeon.tscn10
2 files changed, 10 insertions, 4 deletions
diff --git a/Scenes/Dungeon.gd b/Scenes/Dungeon.gd
index d20fcc4..2deafe0 100644
--- a/Scenes/Dungeon.gd
+++ b/Scenes/Dungeon.gd
@@ -4,6 +4,7 @@ const Player = preload("res://Scenes/Player.tscn")
const Obstacle = preload("res://Scenes/Obstacle.tscn")
onready var player = null
+onready var camera = $Pitch
onready var tiles_entities = {
}
@@ -16,6 +17,7 @@ func _ready():
randomize()
build_floor()
+
func build_floor():
player = Player.instance()
add_child(player)
@@ -35,6 +37,8 @@ func build_floor():
if tiles_entities[key].get("target_position") != null:
tiles_entities[key].target_position = tile_to_pos(key)
+ camera.follow(player)
+
func tile_to_pos(tile : Vector2):
return Vector3(tile.x, 0, -tile.y)
diff --git a/Scenes/Dungeon.tscn b/Scenes/Dungeon.tscn
index 7ccf666..45887e1 100644
--- a/Scenes/Dungeon.tscn
+++ b/Scenes/Dungeon.tscn
@@ -1,6 +1,7 @@
-[gd_scene load_steps=5 format=2]
+[gd_scene load_steps=6 format=2]
[ext_resource path="res://Scenes/Dungeon.gd" type="Script" id=1]
+[ext_resource path="res://Scenes/CameraControl.gd" type="Script" id=2]
[sub_resource type="PlaneMesh" id=1]
@@ -24,12 +25,14 @@ material/0 = null
environment = SubResource( 3 )
[node name="Pitch" type="Spatial" parent="."]
-transform = Transform( 0.837957, 0, -0.545736, 0, 1, 0, 0.545736, 0, 0.837957, 0, 0, 0 )
+transform = Transform( 0.766044, 0, 0.642788, 0, 1, 0, -0.642788, 0, 0.766044, 0, 0, 0 )
+script = ExtResource( 2 )
[node name="Yaw" type="Spatial" parent="Pitch"]
-transform = Transform( 1, 0, 0, 0, 0.665856, 0.746081, 0, -0.746081, 0.665856, 1.90735e-06, 27.9035, 24.1124 )
+transform = Transform( 1, 0, 0, 0, 0.665856, 0.746081, 0, -0.746081, 0.665856, 0, 0, 0 )
[node name="Camera" type="Camera" parent="Pitch/Yaw"]
+transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 30 )
projection = 1
fov = 24.0
size = 7.35
@@ -37,4 +40,3 @@ size = 7.35
[node name="DirectionalLight" type="DirectionalLight" parent="."]
transform = Transform( 0.73644, 0.441272, -0.512773, 0, 0.757975, 0.652284, 0.676503, -0.480367, 0.558203, 0, 35.1428, 0 )
light_energy = 0.5
-shadow_enabled = true