2
0
Эх сурвалжийг харах

Merge pull request #66 from aaronfranke/node-names

Standardize node names and cache node references
Aaron Franke 5 жил өмнө
parent
commit
184c28d281

+ 3 - 1
door/door.gd

@@ -2,7 +2,9 @@ extends Area
 
 var open = false
 
+onready var animation_player = $DoorModel/AnimationPlayer
+
 func _on_door_body_entered(body):
 	if not open and body is preload("res://player/player.gd"):
-		$"Scene Root/AnimationPlayer".play("doorsimple_opening")
+		animation_player.play("doorsimple_opening")
 		open = true

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 0
enemies/red_robot/model/Walk-cycle.tres


+ 83 - 67
enemies/red_robot/red_robot.gd

@@ -27,6 +27,22 @@ var player = null
 var velocity = Vector3()
 var orientation = Transform()
 
+onready var animation_tree = $AnimationTree
+onready var shoot_animation = $ShootAnimation
+
+onready var model = $RedRobotModel
+onready var ray_from = model.get_node(@"Armature/Skeleton/RayFrom")
+onready var ray_mesh = ray_from.get_node(@"RayMesh")
+onready var explosion_particles = ray_from.get_node(@"ExplosionParticles")
+
+onready var explosion_sound = $SoundEffects/Explosion
+onready var hit_sound = $SoundEffects/Hit
+
+onready var death = $Death
+onready var shield1 = death.get_node(@"PartShield1")
+onready var shield2 = death.get_node(@"PartShield2")
+onready var shield3 = death.get_node(@"PartShield3")
+
 onready var gravity = ProjectSettings.get_setting("physics/3d/default_gravity") * ProjectSettings.get_setting("physics/3d/default_gravity_vector")
 
 func _ready():
@@ -43,53 +59,53 @@ func resume_approach():
 func hit():
 	if dead:
 		return
-	$AnimationTree["parameters/hit" + ["1", "2", "3"][randi() % 3] + "/active"] = true
-	$sfx/hit.play()
+	animation_tree["parameters/hit" + str(randi() % 3 + 1) + "/active"] = true
+	hit_sound.play()
 	health -= 1
 	if health == 0:
 		dead = true
 		var base_xf = global_transform.basis
-		$AnimationTree.active = false
-		#$Death/explosion.play("kaboom")
-		$RedRobotModel.visible = false
-		$Death.visible = true
+		animation_tree.active = false
+		#$Death/Explosion.play("kaboom")
+		model.visible = false
+		death.visible = true
 		$CollisionShape.disabled = true
-		$Death/particles.emitting = true
+		death.get_node(@"Particles").emitting = true
 		
-		$Death/PartShield1/Col1.disabled = false
-		$Death/PartShield1/Col2.disabled = false
-		$Death/PartShield1.mode = RigidBody.MODE_RIGID
-		$Death/PartShield2/Col1.disabled = false
-		$Death/PartShield2/Col2.disabled = false
-		$Death/PartShield2.mode = RigidBody.MODE_RIGID
-		$Death/PartShield3/Col1.disabled = false
-		$Death/PartShield3/Col2.disabled = false
-		$Death/PartShield3.mode = RigidBody.MODE_RIGID
+		shield1.get_node(@"Col1").disabled = false
+		shield1.get_node(@"Col2").disabled = false
+		shield1.mode = RigidBody.MODE_RIGID
+		shield2.get_node(@"Col1").disabled = false
+		shield2.get_node(@"Col2").disabled = false
+		shield2.mode = RigidBody.MODE_RIGID
+		shield3.get_node(@"Col1").disabled = false
+		shield3.get_node(@"Col2").disabled = false
+		shield3.mode = RigidBody.MODE_RIGID
 		
-		$Death/PartShield2.linear_velocity = 3 * (Vector3.UP + base_xf.x).normalized()
-		$Death/PartShield3.linear_velocity = 3 * (Vector3.UP).normalized()
-		$Death/PartShield1.linear_velocity = 3 * (Vector3.UP - base_xf.x).normalized()
-		$Death/PartShield2.angular_velocity = (Vector3(randf(), randf(), randf()).normalized() * 2 - Vector3.ONE) * 10
-		$Death/PartShield1.angular_velocity = (Vector3(randf(), randf(), randf()).normalized() * 2 - Vector3.ONE) * 10
-		$Death/PartShield3.angular_velocity = (Vector3(randf(), randf(), randf()).normalized() * 2 - Vector3.ONE) * 10
-		$sfx/explosion.play()
+		shield2.linear_velocity = 3 * (Vector3.UP + base_xf.x).normalized()
+		shield3.linear_velocity = 3 * (Vector3.UP).normalized()
+		shield1.linear_velocity = 3 * (Vector3.UP - base_xf.x).normalized()
+		shield2.angular_velocity = (Vector3(randf(), randf(), randf()).normalized() * 2 - Vector3.ONE) * 10
+		shield1.angular_velocity = (Vector3(randf(), randf(), randf()).normalized() * 2 - Vector3.ONE) * 10
+		shield3.angular_velocity = (Vector3(randf(), randf(), randf()).normalized() * 2 - Vector3.ONE) * 10
+		explosion_sound.play()
 
 
 func shoot():
-	var gt = $RedRobotModel/Armature/Skeleton/ray_from.global_transform
-	var ray_from = gt.origin
+	var gt = ray_from.global_transform
+	var ray_origin = ray_from.global_transform.origin
 	var ray_dir = -gt.basis.z
 	var max_dist = 1000
 	
-	var col = get_world().direct_space_state.intersect_ray(ray_from, ray_from + ray_dir * max_dist, [self])
+	var col = get_world().direct_space_state.intersect_ray(ray_origin, ray_origin + ray_dir * max_dist, [self])
 	if not col.empty():
-		max_dist = ray_from.distance_to(col.position)
+		max_dist = ray_origin.distance_to(col.position)
 		if col.collider == player:
 			pass # Kill.
 	# Clip ray in shader.
-	$RedRobotModel/Armature/Skeleton/ray_from/ray.get_surface_material(0).set_shader_param("clip", max_dist)
+	ray_mesh.get_surface_material(0).set_shader_param("clip", max_dist)
 	# Position explosion.
-	$RedRobotModel/Armature/Skeleton/ray_from/explosion.transform.origin.z = -max_dist
+	explosion_particles.transform.origin.z = -max_dist
 
 
 func _physics_process(delta):
@@ -101,7 +117,7 @@ func _physics_process(delta):
 		return
 	
 	if not player:
-		$AnimationTree["parameters/state/current"] = 0 # Go idle.
+		animation_tree["parameters/state/current"] = 0 # Go idle.
 		return
 	
 	if state == State.APPROACH:
@@ -109,69 +125,69 @@ func _physics_process(delta):
 			aim_preparing -= delta
 			if aim_preparing < 0:
 				aim_preparing = 0
-			$AnimationTree["parameters/aiming/blend_amount"] = aim_preparing / AIM_PREPARE_TIME
+			animation_tree["parameters/aiming/blend_amount"] = aim_preparing / AIM_PREPARE_TIME
 		
 		var to_player_local = global_transform.xform_inv(player.global_transform.origin)
 		# The front of the robot is +Z, and atan2 is zero at +X, so we need to use the Z for the X parameter (second one).
 		var angle_to_player = atan2(to_player_local.x, to_player_local.z)
 		var tolerance = deg2rad(PLAYER_AIM_TOLERANCE_DEGREES)
 		if angle_to_player > tolerance:
-			$AnimationTree["parameters/state/current"] = 1
+			animation_tree["parameters/state/current"] = 1
 		elif angle_to_player < -tolerance:
-			$AnimationTree["parameters/state/current"] = 2
+			animation_tree["parameters/state/current"] = 2
 		else:
-			$AnimationTree["parameters/state/current"] = 3
+			animation_tree["parameters/state/current"] = 3
 			# Facing player, try to shoot.
 			shoot_countdown -= delta
 			if shoot_countdown < 0:
 				# See if player can be killed because in they're sight.
-				var ray_from = $RedRobotModel/Armature/Skeleton/ray_from.global_transform.origin
+				var ray_origin = ray_from.global_transform.origin
 				var ray_to = player.global_transform.origin + Vector3.UP # Above middle of player.
-				var col = get_world().direct_space_state.intersect_ray(ray_from, ray_to, [self])
+				var col = get_world().direct_space_state.intersect_ray(ray_origin, ray_to, [self])
 				if not col.empty() and col.collider == player:
 					state = State.AIM
 					aim_countdown = AIM_TIME
 					aim_preparing = 0
-					$AnimationTree["parameters/state/current"] = 0
+					animation_tree["parameters/state/current"] = 0
 				else:
 					# Player not in sight, do nothing.
 					shoot_countdown = SHOOT_WAIT
 	
 	elif state == State.AIM or state == State.SHOOTING:
-			if aim_preparing < AIM_PREPARE_TIME:
-				aim_preparing += delta
-				if aim_preparing > AIM_PREPARE_TIME:
-					aim_preparing = AIM_PREPARE_TIME
-			
-			$AnimationTree["parameters/aiming/blend_amount"] = clamp(aim_preparing / AIM_PREPARE_TIME, 0, 1)
-			aim_countdown -= delta
-			if aim_countdown < 0 and state == State.AIM:
-				var ray_from = $RedRobotModel/Armature/Skeleton/ray_from.global_transform.origin
-				var ray_to = player.global_transform.origin + Vector3.UP # Above middle of player.
-				var col = get_world().direct_space_state.intersect_ray(ray_from, ray_to, [self])
-				if not col.empty() and col.collider == player:
-					state = State.SHOOTING
-					$shoot_anim.play("shoot")
-				else:
-					resume_approach()
+		if aim_preparing < AIM_PREPARE_TIME:
+			aim_preparing += delta
+			if aim_preparing > AIM_PREPARE_TIME:
+				aim_preparing = AIM_PREPARE_TIME
+		
+		animation_tree["parameters/aiming/blend_amount"] = clamp(aim_preparing / AIM_PREPARE_TIME, 0, 1)
+		aim_countdown -= delta
+		if aim_countdown < 0 and state == State.AIM:
+			var ray_origin = ray_from.global_transform.origin
+			var ray_to = player.global_transform.origin + Vector3.UP # Above middle of player.
+			var col = get_world().direct_space_state.intersect_ray(ray_origin, ray_to, [self])
+			if not col.empty() and col.collider == player:
+				state = State.SHOOTING
+				shoot_animation.play("shoot")
+			else:
+				resume_approach()
+		
+		if animation_tree.active:
+			var to_cannon_local = ray_mesh.global_transform.xform_inv(player.global_transform.origin + Vector3.UP)
+			var h_angle = rad2deg(atan2( to_cannon_local.x, -to_cannon_local.z ))
+			var v_angle = rad2deg(atan2( to_cannon_local.y, -to_cannon_local.z ))
+			var blend_pos = animation_tree["parameters/aim/blend_position"]
+			var h_motion = BLEND_AIM_SPEED * delta * -h_angle
+			blend_pos.x += h_motion
+			blend_pos.x = clamp(blend_pos.x, -1, 1)
 			
-			if $AnimationTree.active:
-				var to_cannon_local = $RedRobotModel/Armature/Skeleton/ray_from/ray.global_transform.xform_inv(player.global_transform.origin + Vector3.UP)
-				var h_angle = rad2deg(atan2( to_cannon_local.x, -to_cannon_local.z ))
-				var v_angle = rad2deg(atan2( to_cannon_local.y, -to_cannon_local.z ))
-				var blend_pos = $AnimationTree["parameters/aim/blend_position"]
-				var h_motion = BLEND_AIM_SPEED * delta * -h_angle
-				blend_pos.x += h_motion
-				blend_pos.x = clamp(blend_pos.x, -1, 1)
+			var v_motion = BLEND_AIM_SPEED * delta * v_angle
+			blend_pos.y += v_motion
+			blend_pos.y = clamp(blend_pos.y, -1, 1)
 				
-				var v_motion = BLEND_AIM_SPEED * delta * v_angle
-				blend_pos.y += v_motion
-				blend_pos.y = clamp(blend_pos.y, -1, 1)
-					
-				$AnimationTree["parameters/aim/blend_position"] = blend_pos
+			animation_tree["parameters/aim/blend_position"] = blend_pos
 	
 	# Apply root motion to orientation.
-	orientation *= $AnimationTree.get_root_motion_transform()
+	orientation *= animation_tree.get_root_motion_transform()
 	
 	var h_velocity = orientation.origin / delta
 	velocity.x = h_velocity.x

+ 34 - 35
enemies/red_robot/red_robot.tscn

@@ -23,10 +23,10 @@
 [sub_resource type="ShaderMaterial" id=1]
 resource_local_to_scene = true
 shader = ExtResource( 4 )
-shader_param/deform = 2.0
+shader_param/deform = 0.0
 shader_param/transparency = 0.0
 shader_param/energy = 1.0
-shader_param/smoke = 1.0
+shader_param/smoke = 0.0
 shader_param/clip = 20.0
 shader_param/ray_texture = ExtResource( 5 )
 shader_param/smoke_texture = ExtResource( 6 )
@@ -192,18 +192,18 @@ nodes/hit3/position = Vector2( 980, 240 )
 nodes/output/position = Vector2( 1180, 200 )
 nodes/state/node = SubResource( 25 )
 nodes/state/position = Vector2( 60, 100 )
-node_connections = [ "output", 0, "hit3", "state", 0, "Animation", "state", 1, "Animation 3", "state", 2, "Animation 2", "state", 3, "Animation 4", "hit2", 0, "hit1", "hit2", 1, "Animation 6", "hit3", 0, "hit2", "hit3", 1, "Animation 7", "aiming", 0, "state", "aiming", 1, "aim", "hit1", 0, "aiming", "hit1", 1, "Animation 5" ]
+node_connections = [ "output", 0, "hit3", "state", 0, "Animation", "state", 1, "Animation 3", "state", 2, "Animation 2", "state", 3, "Animation 4", "aiming", 0, "state", "aiming", 1, "aim", "hit1", 0, "aiming", "hit1", 1, "Animation 5", "hit2", 0, "hit1", "hit2", 1, "Animation 6", "hit3", 0, "hit2", "hit3", 1, "Animation 7" ]
 
 [sub_resource type="SphereShape" id=27]
 radius = 1.11815
 
 [sub_resource type="SphereShape" id=28]
-radius = 18.1337
+radius = 20.0
 
 [sub_resource type="Animation" id=29]
 length = 4.0
 tracks/0/type = "value"
-tracks/0/path = NodePath("RedRobotModel/Armature/Skeleton/ray_from/ray:material/0:shader_param/energy")
+tracks/0/path = NodePath("RedRobotModel/Armature/Skeleton/RayFrom/RayMesh:material/0:shader_param/energy")
 tracks/0/interp = 1
 tracks/0/loop_wrap = true
 tracks/0/imported = false
@@ -215,7 +215,7 @@ tracks/0/keys = {
 "values": [ 1.0, 1.0, 5.0, 1.0, 1.0 ]
 }
 tracks/1/type = "value"
-tracks/1/path = NodePath("RedRobotModel/Armature/Skeleton/ray_from/ray:material/0:shader_param/transparency")
+tracks/1/path = NodePath("RedRobotModel/Armature/Skeleton/RayFrom/RayMesh:material/0:shader_param/transparency")
 tracks/1/interp = 1
 tracks/1/loop_wrap = true
 tracks/1/imported = false
@@ -227,7 +227,7 @@ tracks/1/keys = {
 "values": [ 0.0, 0.0, 1.0, 1.0, 0.0 ]
 }
 tracks/2/type = "value"
-tracks/2/path = NodePath("RedRobotModel/Armature/Skeleton/ray_from/ray:material/0:shader_param/deform")
+tracks/2/path = NodePath("RedRobotModel/Armature/Skeleton/RayFrom/RayMesh:material/0:shader_param/deform")
 tracks/2/interp = 1
 tracks/2/loop_wrap = true
 tracks/2/imported = false
@@ -239,7 +239,7 @@ tracks/2/keys = {
 "values": [ 0.0, 0.0, 0.0, 2.0 ]
 }
 tracks/3/type = "value"
-tracks/3/path = NodePath("RedRobotModel/Armature/Skeleton/ray_from/ray:material/0:shader_param/smoke")
+tracks/3/path = NodePath("RedRobotModel/Armature/Skeleton/RayFrom/RayMesh:material/0:shader_param/smoke")
 tracks/3/interp = 1
 tracks/3/loop_wrap = true
 tracks/3/imported = false
@@ -251,7 +251,7 @@ tracks/3/keys = {
 "values": [ 0.0, 0.0, 0.0, 1.0 ]
 }
 tracks/4/type = "value"
-tracks/4/path = NodePath("shoot_light:visible")
+tracks/4/path = NodePath("ShootLight:visible")
 tracks/4/interp = 1
 tracks/4/loop_wrap = true
 tracks/4/imported = false
@@ -263,7 +263,7 @@ tracks/4/keys = {
 "values": [ true, false, true, false ]
 }
 tracks/5/type = "value"
-tracks/5/path = NodePath("shoot_light:light_energy")
+tracks/5/path = NodePath("ShootLight:light_energy")
 tracks/5/interp = 1
 tracks/5/loop_wrap = true
 tracks/5/imported = false
@@ -275,7 +275,7 @@ tracks/5/keys = {
 "values": [ 0.0, 0.0, 1.0, 0.0, 0.0, 5.0, 0.0 ]
 }
 tracks/6/type = "value"
-tracks/6/path = NodePath("RedRobotModel/Armature/Skeleton/ray_from/Particles:emitting")
+tracks/6/path = NodePath("RedRobotModel/Armature/Skeleton/RayFrom/BuildupParticles:emitting")
 tracks/6/interp = 1
 tracks/6/loop_wrap = true
 tracks/6/imported = false
@@ -287,7 +287,7 @@ tracks/6/keys = {
 "values": [ false, true, false ]
 }
 tracks/7/type = "value"
-tracks/7/path = NodePath("RedRobotModel/Armature/Skeleton/ray_from/explosion:emitting")
+tracks/7/path = NodePath("RedRobotModel/Armature/Skeleton/RayFrom/ExplosionParticles:emitting")
 tracks/7/interp = 1
 tracks/7/loop_wrap = true
 tracks/7/imported = false
@@ -328,7 +328,7 @@ tracks/9/keys = {
 } ]
 }
 tracks/10/type = "audio"
-tracks/10/path = NodePath("sfx/cannon")
+tracks/10/path = NodePath("SoundEffects/Cannon")
 tracks/10/interp = 1
 tracks/10/loop_wrap = true
 tracks/10/imported = false
@@ -515,7 +515,7 @@ tracks/8/keys = {
 "values": [ true, false ]
 }
 tracks/9/type = "value"
-tracks/9/path = NodePath("particles:one_shot")
+tracks/9/path = NodePath("Particles:one_shot")
 tracks/9/interp = 1
 tracks/9/loop_wrap = true
 tracks/9/imported = false
@@ -527,7 +527,7 @@ tracks/9/keys = {
 "values": [ true ]
 }
 tracks/10/type = "value"
-tracks/10/path = NodePath("particles:emitting")
+tracks/10/path = NodePath("Particles:emitting")
 tracks/10/interp = 1
 tracks/10/loop_wrap = true
 tracks/10/imported = false
@@ -550,19 +550,19 @@ script = ExtResource( 1 )
 [node name="RedRobotModel" parent="." instance=ExtResource( 2 )]
 
 [node name="Skeleton" parent="RedRobotModel/Armature" index="0"]
-bones/14/bound_children = [ NodePath("ray_from") ]
+bones/14/bound_children = [ NodePath("RayFrom") ]
 
-[node name="ray_from" type="BoneAttachment" parent="RedRobotModel/Armature/Skeleton" index="4"]
-transform = Transform( -0.999999, -3.84405e-05, -0.00153932, -3.90035e-05, 1, 0.000365729, 0.0015393, 0.000365788, -0.999999, -0.0237867, 1.94358, 0.194639 )
+[node name="RayFrom" type="BoneAttachment" parent="RedRobotModel/Armature/Skeleton" index="4"]
+transform = Transform( -0.999994, -0.00279503, -0.00183882, -0.00279578, 0.999996, 0.000401379, 0.0018377, 0.000406517, -0.999998, -0.0288596, 1.94004, 0.194757 )
 bone_name = "CannonAnimRecoil"
 
-[node name="ray" type="MeshInstance" parent="RedRobotModel/Armature/Skeleton/ray_from"]
+[node name="RayMesh" type="MeshInstance" parent="RedRobotModel/Armature/Skeleton/RayFrom"]
 transform = Transform( 1, 8.40737e-09, -9.31323e-10, -6.55928e-09, 1, -9.31323e-10, 4.65661e-10, 0, 1, 1.67638e-08, 0, -1.21376 )
 mesh = ExtResource( 3 )
 skeleton = NodePath("")
 material/0 = SubResource( 1 )
 
-[node name="Particles" type="CPUParticles" parent="RedRobotModel/Armature/Skeleton/ray_from"]
+[node name="BuildupParticles" type="CPUParticles" parent="RedRobotModel/Armature/Skeleton/RayFrom"]
 transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -1.07273 )
 emitting = false
 amount = 64
@@ -577,7 +577,7 @@ radial_accel = -1.0
 tangential_accel = 1.0
 color_ramp = SubResource( 4 )
 
-[node name="explosion" type="CPUParticles" parent="RedRobotModel/Armature/Skeleton/ray_from"]
+[node name="ExplosionParticles" type="CPUParticles" parent="RedRobotModel/Armature/Skeleton/RayFrom"]
 transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.0332087, -10.283 )
 emitting = false
 amount = 32
@@ -608,20 +608,20 @@ parameters/state/current = 0
 transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.11655, -0.0212681 )
 shape = SubResource( 27 )
 
-[node name="area" type="Area" parent="."]
+[node name="PlayerDetectionArea" type="Area" parent="."]
 collision_layer = 2
 collision_mask = 2
 
-[node name="CollisionShape" type="CollisionShape" parent="area"]
+[node name="CollisionShape" type="CollisionShape" parent="PlayerDetectionArea"]
 shape = SubResource( 28 )
 
 [node name="RootMotionView" type="RootMotionView" parent="."]
 animation_path = NodePath("../AnimationTree")
 
-[node name="shoot_anim" type="AnimationPlayer" parent="."]
+[node name="ShootAnimation" type="AnimationPlayer" parent="."]
 anims/shoot = SubResource( 29 )
 
-[node name="shoot_light" type="OmniLight" parent="."]
+[node name="ShootLight" type="OmniLight" parent="."]
 transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.82358, 2.06607 )
 visible = false
 light_color = Color( 0.992157, 0.713726, 0.713726, 1 )
@@ -749,12 +749,11 @@ angular_velocity = 84.86
 angular_velocity_random = 1.0
 color_ramp = SubResource( 35 )
 
-[node name="explosion" type="AnimationPlayer" parent="Death"]
+[node name="Explosion" type="AnimationPlayer" parent="Death"]
 anims/kaboom = SubResource( 43 )
 
-[node name="particles" type="CPUParticles" parent="Death"]
+[node name="Particles" type="CPUParticles" parent="Death"]
 transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -0.213713, 0.763735, 0 )
-emitting = false
 amount = 32
 one_shot = true
 explosiveness = 1.0
@@ -767,27 +766,27 @@ angular_velocity_random = 1.0
 linear_accel = 1.0
 color_ramp = SubResource( 7 )
 
-[node name="sfx" type="Spatial" parent="."]
+[node name="SoundEffects" type="Spatial" parent="."]
 
-[node name="cannon" type="AudioStreamPlayer3D" parent="sfx"]
+[node name="Cannon" type="AudioStreamPlayer3D" parent="SoundEffects"]
 stream = ExtResource( 10 )
 unit_size = 15.0
 
-[node name="explosion" type="AudioStreamPlayer3D" parent="sfx"]
+[node name="Explosion" type="AudioStreamPlayer3D" parent="SoundEffects"]
 stream = ExtResource( 17 )
 unit_db = 12.0
 unit_size = 15.0
 
-[node name="hit" type="AudioStreamPlayer3D" parent="sfx"]
+[node name="Hit" type="AudioStreamPlayer3D" parent="SoundEffects"]
 stream = SubResource( 44 )
 unit_db = 3.0
 unit_size = 15.0
 
-[node name="walk" type="AudioStreamPlayer3D" parent="sfx"]
+[node name="Walk" type="AudioStreamPlayer3D" parent="SoundEffects"]
 stream = ExtResource( 19 )
 unit_db = 3.0
 unit_size = 15.0
-[connection signal="body_entered" from="area" to="." method="_on_area_body_entered"]
-[connection signal="body_exited" from="area" to="." method="_on_area_body_exited"]
+[connection signal="body_entered" from="PlayerDetectionArea" to="." method="_on_area_body_entered"]
+[connection signal="body_exited" from="PlayerDetectionArea" to="." method="_on_area_body_exited"]
 
 [editable path="RedRobotModel"]

+ 16 - 15
level/level.gd

@@ -5,42 +5,43 @@ signal quit
 #warning-ignore:unused_signal
 signal replace_main_scene # Useless, but needed as there is no clean way to check if a node exposes a signal
 
+onready var world_environment = $WorldEnvironment
 
 func _ready():
-	if settings.gi_quality == settings.GIQuality.HIGH:
+	if Settings.gi_quality == Settings.GIQuality.HIGH:
 		ProjectSettings["rendering/quality/voxel_cone_tracing/high_quality"] = true
-	elif settings.gi_quality == settings.GIQuality.LOW:
+	elif Settings.gi_quality == Settings.GIQuality.LOW:
 		ProjectSettings["rendering/quality/voxel_cone_tracing/high_quality"] = false
 	else:
 		$GIProbe.hide()
 		$ReflectionProbes.show()
 	
-	if settings.aa_quality == settings.AAQuality.AA_8X:
+	if Settings.aa_quality == Settings.AAQuality.AA_8X:
 		get_node("/root").msaa = Viewport.MSAA_8X
-	elif settings.aa_quality == settings.AAQuality.AA_4X:
+	elif Settings.aa_quality == Settings.AAQuality.AA_4X:
 		get_node("/root").msaa = Viewport.MSAA_4X
-	elif settings.aa_quality == settings.AAQuality.AA_2X:
+	elif Settings.aa_quality == Settings.AAQuality.AA_2X:
 		get_node("/root").msaa = Viewport.MSAA_2X
 	else:
 		get_node("/root").msaa = Viewport.MSAA_DISABLED
 	
-	if settings.ssao_quality == settings.SSAOQuality.HIGH:
-		$WorldEnvironment.environment.ssao_quality = $WorldEnvironment.environment.SSAO_QUALITY_HIGH
-	elif settings.ssao_quality == settings.SSAOQuality.LOW:
-		$WorldEnvironment.environment.ssao_quality = $WorldEnvironment.environment.SSAO_QUALITY_LOW
+	if Settings.ssao_quality == Settings.SSAOQuality.HIGH:
+		world_environment.environment.ssao_quality = world_environment.environment.SSAO_QUALITY_HIGH
+	elif Settings.ssao_quality == Settings.SSAOQuality.LOW:
+		world_environment.environment.ssao_quality = world_environment.environment.SSAO_QUALITY_LOW
 	else:
-		$WorldEnvironment.environment.ssao_enabled = false
+		world_environment.environment.ssao_enabled = false
 	
-	if settings.resolution == settings.Resolution.NATIVE:
+	if Settings.resolution == Settings.Resolution.NATIVE:
 		pass
-	elif settings.resolution == settings.Resolution.RES_1080:
+	elif Settings.resolution == Settings.Resolution.RES_1080:
 		var minsize = Vector2(OS.window_size.x * 1080 / OS.window_size.y, 1080.0)
 		get_tree().set_screen_stretch(SceneTree.STRETCH_MODE_VIEWPORT, SceneTree.STRETCH_ASPECT_KEEP_HEIGHT, minsize)
-	elif settings.resolution == settings.Resolution.RES_720:
+	elif Settings.resolution == Settings.Resolution.RES_720:
 		var minsize = Vector2(OS.window_size.x * 720 / OS.window_size.y, 720.0)
 		get_tree().set_screen_stretch(SceneTree.STRETCH_MODE_VIEWPORT, SceneTree.STRETCH_ASPECT_KEEP_HEIGHT, minsize)
-	elif settings.resolution == settings.Resolution.RES_576:
-		var minsize = Vector2(OS.window_size.x * 576 / OS.window_size.y, 576.0)
+	elif Settings.resolution == Settings.Resolution.RES_540:
+		var minsize = Vector2(OS.window_size.x * 540 / OS.window_size.y, 540.0)
 		get_tree().set_screen_stretch(SceneTree.STRETCH_MODE_VIEWPORT, SceneTree.STRETCH_ASPECT_KEEP_HEIGHT, minsize)
 
 

+ 8 - 8
level/level.tscn

@@ -104,29 +104,29 @@ transform = Transform( -0.164432, 0, 0.986389, 0, 1, 0, -0.986389, 0, -0.164432,
 [node name="RedRobot4" parent="." instance=ExtResource( 7 )]
 transform = Transform( -0.164432, 0, 0.986389, 0, 1, 0, -0.986389, 0, -0.164432, -9.15526, -11.6923, -16.9238 )
 
-[node name="sound_outside" type="Area" parent="."]
+[node name="Music" type="AudioStreamPlayer" parent="."]
+stream = ExtResource( 8 )
+autoplay = true
+
+[node name="SoundOutside" type="Area" parent="."]
 collision_mask = 0
 audio_bus_override = true
 audio_bus_name = "Outside"
 
-[node name="CollisionPolygon" type="CollisionPolygon" parent="sound_outside"]
+[node name="CollisionPolygon" type="CollisionPolygon" parent="SoundOutside"]
 transform = Transform( 1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 0, 0 )
 depth = 100.0
 polygon = PoolVector2Array( -75.798, 98.0935, -18.4854, 34.621, -6.1658, 39.1739, 6.95718, 39.4417, 23.0262, 32.7463, 36.9526, 17.7486, 31.5629, 13.7491, 33.7076, 6.64486, 40.9698, 3.55431, 36.417, -21.6204, 26.5078, -30.1905, 93.7297, -71.4343, 118.637, 0.608329, 70.4297, 120.322, -36.9647, 128.089 )
 
-[node name="sound_reactor_room" type="Area" parent="."]
+[node name="SoundReactorRoom" type="Area" parent="."]
 collision_mask = 0
 audio_bus_override = true
 audio_bus_name = "Reactor"
 
-[node name="CollisionShape" type="CollisionShape" parent="sound_reactor_room"]
+[node name="CollisionShape" type="CollisionShape" parent="SoundReactorRoom"]
 transform = Transform( 1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 0, 0 )
 shape = SubResource( 1 )
 
-[node name="music" type="AudioStreamPlayer" parent="."]
-stream = ExtResource( 8 )
-autoplay = true
-
 [node name="FlyingForklifts" type="Spatial" parent="."]
 
 [node name="FlyingForklift1" parent="FlyingForklifts" instance=ExtResource( 12 )]

+ 1 - 7
main/main.gd

@@ -1,7 +1,7 @@
 extends Node
 
 func _ready():
-	OS.window_fullscreen = settings.fullscreen
+	OS.window_fullscreen = Settings.fullscreen
 	go_to_main_menu()
 
 
@@ -23,9 +23,3 @@ func change_scene(resource : Resource):
 	
 	node.connect("quit", self, "go_to_main_menu")
 	node.connect("replace_main_scene", self, "replace_main_scene")
-
-
-func _input(event : InputEvent):
-	if event.is_action_pressed("toggle_fullscreen"):
-		OS.window_fullscreen = !OS.window_fullscreen
-		get_tree().set_input_as_handled()

+ 127 - 84
menu/menu.gd

@@ -7,32 +7,75 @@ signal replace_main_scene
 #warning-ignore:unused_signal
 signal quit # Useless, but needed as there is no clean way to check if a node exposes a signal
 
+onready var ui = $UI
+onready var main = ui.get_node(@"Main")
+onready var play_button = main.get_node(@"Play")
+onready var settings_button = main.get_node(@"Settings")
+onready var quit_button = main.get_node(@"Quit")
+
+onready var settings_menu = ui.get_node(@"Settings")
+onready var settings_actions = settings_menu.get_node(@"Actions")
+onready var settings_action_apply = settings_actions.get_node(@"Apply")
+onready var settings_action_cancel = settings_actions.get_node(@"Cancel")
+
+onready var gi_menu = settings_menu.get_node(@"GI")
+onready var gi_high = gi_menu.get_node(@"High")
+onready var gi_low = gi_menu.get_node(@"Low")
+onready var gi_disabled = gi_menu.get_node(@"Disabled")
+
+onready var aa_menu = settings_menu.get_node(@"AA")
+onready var aa_8x = aa_menu.get_node(@"8X")
+onready var aa_4x = aa_menu.get_node(@"4X")
+onready var aa_2x = aa_menu.get_node(@"2X")
+onready var aa_disabled = aa_menu.get_node(@"Disabled")
+
+onready var ssao_menu = settings_menu.get_node(@"SSAO")
+onready var ssao_high = ssao_menu.get_node(@"High")
+onready var ssao_low = ssao_menu.get_node(@"Low")
+onready var ssao_disabled = ssao_menu.get_node(@"Disabled")
+
+onready var resolution_menu = settings_menu.get_node(@"Resolution")
+onready var resolution_native = resolution_menu.get_node(@"Native")
+onready var resolution_1080 = resolution_menu.get_node(@"1080")
+onready var resolution_720 = resolution_menu.get_node(@"720")
+onready var resolution_540 = resolution_menu.get_node(@"540")
+
+onready var fullscreen_menu = settings_menu.get_node(@"Fullscreen")
+onready var fullscreen_yes = fullscreen_menu.get_node(@"Yes")
+onready var fullscreen_no = fullscreen_menu.get_node(@"No")
+
+onready var loading = ui.get_node(@"Loading")
+onready var loading_progress = loading.get_node(@"Progress")
+onready var loading_done_timer = loading.get_node(@"DoneTimer")
+
 func _ready():
 	get_tree().set_screen_stretch(SceneTree.STRETCH_MODE_2D, SceneTree.STRETCH_ASPECT_KEEP, Vector2(1920, 1080))
-	$ui/main/play.grab_focus()
+	play_button.grab_focus()
 
 
 func interactive_load(loader):
 	while true:
 		var status = loader.poll()
 		if status == OK:
-			$ui/loading/progress.value = (loader.get_stage() * 100) / loader.get_stage_count()
+			loading_progress.value = (loader.get_stage() * 100) / loader.get_stage_count()
 			continue
 		elif status == ERR_FILE_EOF:
-			$ui/loading/progress.value = 100
-			$ui/loading/loading_done_timer.start()
+			loading_progress.value = 100
+			loading_done_timer.start()
 			break
 		else:
 			print("Error while loading level: " + str(status))
-			$ui/main.show()
-			$ui/loading.hide()
+			main.show()
+			loading.hide()
 			break
 
 
 func loading_done(loader):
 	loading_thread.wait_to_finish()
 	emit_signal("replace_main_scene", loader.get_resource())
-	res_loader = null # Weirdly, this is needed as otherwise loading the resource again is not possible
+	res_loader = null
+	# Weirdly, "res_loader = null" is needed as otherwise
+	# loading the resource again is not possible.
 
 
 func _on_loading_done_timer_timeout():
@@ -40,8 +83,8 @@ func _on_loading_done_timer_timeout():
 
 
 func _on_play_pressed():
-	$ui/main.hide()
-	$ui/loading.show()
+	main.hide()
+	loading.show()
 	var path = "res://level/level.tscn"
 	if ResourceLoader.has_cached(path):
 		emit_signal("replace_main_scene", ResourceLoader.load(path))
@@ -53,46 +96,46 @@ func _on_play_pressed():
 
 
 func _on_settings_pressed():
-	$ui/main.hide()
-	$ui/settings.show()
-	$ui/settings/actions/cancel.grab_focus()
+	main.hide()
+	settings_menu.show()
+	settings_action_cancel.grab_focus()
 	
-	if settings.gi_quality == settings.GIQuality.HIGH:
-		$ui/settings/gi/gi_high.pressed = true
-	elif settings.gi_quality == settings.GIQuality.LOW:
-		$ui/settings/gi/gi_low.pressed = true
-	elif settings.gi_quality == settings.GIQuality.DISABLED:
-		$ui/settings/gi/gi_disabled.pressed = true
-
-	if settings.aa_quality == settings.AAQuality.AA_8X:
-		$ui/settings/aa/aa_8x.pressed = true
-	elif settings.aa_quality == settings.AAQuality.AA_4X:
-		$ui/settings/aa/aa_4x.pressed = true
-	elif settings.aa_quality == settings.AAQuality.AA_2X:
-		$ui/settings/aa/aa_2x.pressed = true
-	elif settings.aa_quality == settings.AAQuality.DISABLED:
-		$ui/settings/aa/aa_disabled.pressed = true
-
-	if settings.ssao_quality == settings.SSAOQuality.HIGH:
-		$ui/settings/ssao/ssao_high.pressed = true
-	elif settings.ssao_quality == settings.SSAOQuality.LOW:
-		$ui/settings/ssao/ssao_low.pressed = true
-	elif settings.ssao_quality == settings.SSAOQuality.DISABLED:
-		$ui/settings/ssao/ssao_disabled.pressed = true
+	if Settings.gi_quality == Settings.GIQuality.HIGH:
+		gi_high.pressed = true
+	elif Settings.gi_quality == Settings.GIQuality.LOW:
+		gi_low.pressed = true
+	elif Settings.gi_quality == Settings.GIQuality.DISABLED:
+		gi_disabled.pressed = true
+
+	if Settings.aa_quality == Settings.AAQuality.AA_8X:
+		aa_8x.pressed = true
+	elif Settings.aa_quality == Settings.AAQuality.AA_4X:
+		aa_4x.pressed = true
+	elif Settings.aa_quality == Settings.AAQuality.AA_2X:
+		aa_2x.pressed = true
+	elif Settings.aa_quality == Settings.AAQuality.DISABLED:
+		aa_disabled.pressed = true
+
+	if Settings.ssao_quality == Settings.SSAOQuality.HIGH:
+		ssao_high.pressed = true
+	elif Settings.ssao_quality == Settings.SSAOQuality.LOW:
+		ssao_low.pressed = true
+	elif Settings.ssao_quality == Settings.SSAOQuality.DISABLED:
+		ssao_disabled.pressed = true
 		
-	if settings.resolution == settings.Resolution.NATIVE:
-		$ui/settings/resolution/resolution_native.pressed = true
-	elif settings.resolution == settings.Resolution.RES_1080:
-		$ui/settings/resolution/resolution_1080.pressed = true
-	elif settings.resolution == settings.Resolution.RES_720:
-		$ui/settings/resolution/resolution_720.pressed = true
-	elif settings.resolution == settings.Resolution.RES_576:
-		$ui/settings/resolution/resolution_576.pressed = true
-
-	if settings.fullscreen:
-		$ui/settings/fullscreen/fullscreen_yes.pressed = true
+	if Settings.resolution == Settings.Resolution.NATIVE:
+		resolution_native.pressed = true
+	elif Settings.resolution == Settings.Resolution.RES_1080:
+		resolution_1080.pressed = true
+	elif Settings.resolution == Settings.Resolution.RES_720:
+		resolution_720.pressed = true
+	elif Settings.resolution == Settings.Resolution.RES_540:
+		resolution_540.pressed = true
+
+	if Settings.fullscreen:
+		fullscreen_yes.pressed = true
 	else:
-		$ui/settings/fullscreen/fullscreen_no.pressed = true
+		fullscreen_no.pressed = true
 
 
 func _on_quit_pressed():
@@ -100,51 +143,51 @@ func _on_quit_pressed():
 
 
 func _on_apply_pressed():
-	$ui/main.show()
-	$ui/main/play.grab_focus()
-	$ui/settings.hide()
+	main.show()
+	play_button.grab_focus()
+	settings_menu.hide()
 	
-	if $ui/settings/gi/gi_high.pressed:
-		settings.gi_quality = settings.GIQuality.HIGH
-	elif $ui/settings/gi/gi_low.pressed:
-		settings.gi_quality = settings.GIQuality.LOW
-	elif $ui/settings/gi/gi_disabled.pressed:
-		settings.gi_quality = settings.GIQuality.DISABLED
+	if gi_high.pressed:
+		Settings.gi_quality = Settings.GIQuality.HIGH
+	elif gi_low.pressed:
+		Settings.gi_quality = Settings.GIQuality.LOW
+	elif gi_disabled.pressed:
+		Settings.gi_quality = Settings.GIQuality.DISABLED
 	
-	if $ui/settings/aa/aa_8x.pressed:
-		settings.aa_quality = settings.AAQuality.AA_8X
-	elif $ui/settings/aa/aa_4x.pressed:
-		settings.aa_quality = settings.AAQuality.AA_4X
-	elif $ui/settings/aa/aa_2x.pressed:
-		settings.aa_quality = settings.AAQuality.AA_2X
-	elif $ui/settings/aa/aa_disabled.pressed:
-		settings.aa_quality = settings.AAQuality.DISABLED
+	if aa_8x.pressed:
+		Settings.aa_quality = Settings.AAQuality.AA_8X
+	elif aa_4x.pressed:
+		Settings.aa_quality = Settings.AAQuality.AA_4X
+	elif aa_2x.pressed:
+		Settings.aa_quality = Settings.AAQuality.AA_2X
+	elif aa_disabled.pressed:
+		Settings.aa_quality = Settings.AAQuality.DISABLED
 	
-	if $ui/settings/ssao/ssao_high.pressed:
-		settings.ssao_quality = settings.SSAOQuality.HIGH
-	elif $ui/settings/ssao/ssao_low.pressed:
-		settings.ssao_quality = settings.SSAOQuality.LOW
-	elif $ui/settings/ssao/ssao_disabled.pressed:
-		settings.ssao_quality = settings.SSAOQuality.DISABLED
+	if ssao_high.pressed:
+		Settings.ssao_quality = Settings.SSAOQuality.HIGH
+	elif ssao_low.pressed:
+		Settings.ssao_quality = Settings.SSAOQuality.LOW
+	elif ssao_disabled.pressed:
+		Settings.ssao_quality = Settings.SSAOQuality.DISABLED
 	
-	if $ui/settings/resolution/resolution_native.pressed:
-		settings.resolution = settings.Resolution.NATIVE
-	elif $ui/settings/resolution/resolution_1080.pressed:
-		settings.resolution = settings.Resolution.RES_1080
-	elif $ui/settings/resolution/resolution_720.pressed:
-		settings.resolution = settings.Resolution.RES_720
-	elif $ui/settings/resolution/resolution_576.pressed:
-		settings.resolution = settings.Resolution.RES_576
-
-	settings.fullscreen = $ui/settings/fullscreen/fullscreen_yes.pressed
+	if resolution_native.pressed:
+		Settings.resolution = Settings.Resolution.NATIVE
+	elif resolution_1080.pressed:
+		Settings.resolution = Settings.Resolution.RES_1080
+	elif resolution_720.pressed:
+		Settings.resolution = Settings.Resolution.RES_720
+	elif resolution_540.pressed:
+		Settings.resolution = Settings.Resolution.RES_540
+
+	Settings.fullscreen = fullscreen_yes.pressed
 	
 	# Apply the setting directly
-	OS.window_fullscreen = settings.fullscreen
+	OS.window_fullscreen = Settings.fullscreen
 
-	settings.save_settings()
+	Settings.save_settings()
 
 
 func _on_cancel_pressed():
-	$ui/main.show()
-	$ui/main/play.grab_focus()
-	$ui/settings.hide()
+	main.show()
+	play_button.grab_focus()
+	settings_menu.hide()

+ 101 - 101
menu/menu.tscn

@@ -1,4 +1,4 @@
-[gd_scene load_steps=38 format=2]
+[gd_scene load_steps=37 format=2]
 
 [ext_resource path="res://menu/menu.gd" type="Script" id=1]
 [ext_resource path="res://menu/experiment.hdr" type="Texture" id=2]
@@ -18,14 +18,13 @@
 [ext_resource path="res://menu/button_focus.tres" type="StyleBox" id=16]
 [ext_resource path="res://menu/button_hover.tres" type="StyleBox" id=17]
 [ext_resource path="res://menu/button_action_pressed.tres" type="StyleBox" id=18]
-[ext_resource path="res://player/audio/step.wav" type="AudioStream" id=19]
 
-[sub_resource type="PanoramaSky" id=1]
+[sub_resource type="PanoramaSky" id=9]
 panorama = ExtResource( 2 )
 
-[sub_resource type="Environment" id=2]
+[sub_resource type="Environment" id=10]
 background_mode = 3
-background_sky = SubResource( 1 )
+background_sky = SubResource( 9 )
 glow_enabled = true
 glow_levels/7 = true
 glow_intensity = 0.4
@@ -33,9 +32,9 @@ glow_blend_mode = 1
 glow_hdr_threshold = 0.34
 glow_bicubic_upscale = true
 
-[sub_resource type="QuadMesh" id=3]
+[sub_resource type="QuadMesh" id=11]
 
-[sub_resource type="SpatialMaterial" id=4]
+[sub_resource type="SpatialMaterial" id=12]
 albedo_texture = ExtResource( 4 )
 metallic = 0.78
 
@@ -54,7 +53,7 @@ animation = "eyes-cycle"
 
 [sub_resource type="AnimationNodeBlendTree" id=8]
 resource_local_to_scene = true
-graph_offset = Vector2( -349.781, 55.0218 )
+graph_offset = Vector2( -260.487, 63.5 )
 nodes/Blend/node = SubResource( 5 )
 nodes/Blend/position = Vector2( 180, 120 )
 nodes/CombatRest/node = SubResource( 6 )
@@ -64,7 +63,7 @@ nodes/Eyes/position = Vector2( -40, 220 )
 nodes/output/position = Vector2( 420, 120 )
 node_connections = [ "output", 0, "Blend", "Blend", 0, "CombatRest", "Blend", 1, "Eyes" ]
 
-[sub_resource type="Theme" id=9]
+[sub_resource type="Theme" id=13]
 Button/colors/font_color = Color( 1, 1, 1, 1 )
 Button/colors/font_color_disabled = Color( 0.9, 0.9, 0.9, 0.2 )
 Button/colors/font_color_hover = Color( 1, 1, 1, 1 )
@@ -86,24 +85,24 @@ Label/constants/shadow_offset_y = 1
 Label/fonts/font = ExtResource( 13 )
 Label/styles/normal = null
 
-[sub_resource type="ButtonGroup" id=10]
+[sub_resource type="ButtonGroup" id=14]
 
-[sub_resource type="ButtonGroup" id=11]
+[sub_resource type="ButtonGroup" id=15]
 
-[sub_resource type="ButtonGroup" id=12]
+[sub_resource type="ButtonGroup" id=16]
 
-[sub_resource type="ButtonGroup" id=13]
+[sub_resource type="ButtonGroup" id=17]
 
-[sub_resource type="ButtonGroup" id=14]
+[sub_resource type="ButtonGroup" id=18]
 
-[sub_resource type="DynamicFontData" id=15]
+[sub_resource type="DynamicFontData" id=19]
 font_path = "res://menu/font/PT_Sans-Web-Bold.ttf"
 
-[sub_resource type="DynamicFont" id=16]
+[sub_resource type="DynamicFont" id=20]
 size = 40
-font_data = SubResource( 15 )
+font_data = SubResource( 19 )
 
-[sub_resource type="StyleBoxFlat" id=17]
+[sub_resource type="StyleBoxFlat" id=21]
 bg_color = Color( 0.278431, 0.278431, 0.360784, 1 )
 border_width_left = 5
 border_width_top = 5
@@ -115,7 +114,7 @@ corner_radius_top_right = 10
 corner_radius_bottom_right = 10
 corner_radius_bottom_left = 10
 
-[sub_resource type="StyleBoxFlat" id=18]
+[sub_resource type="StyleBoxFlat" id=22]
 bg_color = Color( 0.0901961, 0.0784314, 0.117647, 1 )
 border_width_left = 3
 border_width_top = 3
@@ -127,26 +126,31 @@ corner_radius_top_right = 10
 corner_radius_bottom_right = 10
 corner_radius_bottom_left = 10
 
-[node name="menu" type="Spatial"]
+[node name="Menu" type="Spatial"]
 script = ExtResource( 1 )
 
 [node name="WorldEnvironment" type="WorldEnvironment" parent="."]
-environment = SubResource( 2 )
+environment = SubResource( 10 )
 
 [node name="PlayerModel" parent="." instance=ExtResource( 3 )]
 
 [node name="Robot_Skeleton" parent="PlayerModel" index="0"]
 transform = Transform( 0.803991, 0, 0, 0, 0.803991, 0, 0, 0, 0.803991, 0, 0, 0 )
 
-[node name="sfx" type="Node" parent="PlayerModel"]
+[node name="SoundEffects" type="Node" parent="."]
+__meta__ = {
+"_editor_description_": "There must be an AudioStreamPlayer node at the path \"SoundEffects/Step\" next to the player model, anywhere that the player model is instanced. This is to prevent the animation from deleting the step from the track."
+}
 
-[node name="step" type="AudioStreamPlayer" parent="PlayerModel/sfx"]
-stream = ExtResource( 19 )
+[node name="Step" type="AudioStreamPlayer" parent="SoundEffects"]
+__meta__ = {
+"_editor_description_": "There must be an AudioStreamPlayer node at the path \"SoundEffects/Step\" next to the player model, anywhere that the player model is instanced. This is to prevent the animation from deleting the step from the track."
+}
 
-[node name="MeshInstance" type="MeshInstance" parent="."]
+[node name="Floor" type="MeshInstance" parent="."]
 transform = Transform( 15, 0, 0, 0, 0, 15, 0, -15, 0, 0, 0, 0 )
-mesh = SubResource( 3 )
-material/0 = SubResource( 4 )
+mesh = SubResource( 11 )
+material/0 = SubResource( 12 )
 
 [node name="SpotLight" type="SpotLight" parent="."]
 transform = Transform( 0.967027, 0, 0.254675, -0.225291, 0.466312, 0.855452, -0.118758, -0.88462, 0.450936, 0.557445, 2.31204, 0.556668 )
@@ -156,7 +160,7 @@ shadow_bias = 0.01
 [node name="Camera" type="Camera" parent="."]
 transform = Transform( 0.871624, -0.0363083, 0.488828, 0, 0.997253, 0.0740721, -0.490175, -0.064563, 0.86923, 0.0702285, 1.22404, 2.09675 )
 
-[node name="music" type="AudioStreamPlayer" parent="."]
+[node name="Music" type="AudioStreamPlayer" parent="."]
 stream = ExtResource( 5 )
 autoplay = true
 
@@ -166,11 +170,6 @@ anim_player = NodePath("../PlayerModel/AnimationPlayer")
 active = true
 parameters/Blend/blend_amount = 1.0
 
-[node name="sfx" type="Node" parent="."]
-
-[node name="step" type="AudioStreamPlayer" parent="sfx"]
-stream = ExtResource( 19 )
-
 [node name="TextureRect" type="TextureRect" parent="."]
 margin_left = 20.1403
 margin_top = 5.03506
@@ -181,16 +180,16 @@ __meta__ = {
 "_edit_use_anchors_": false
 }
 
-[node name="ui" type="Control" parent="."]
+[node name="UI" type="Control" parent="."]
 anchor_left = 0.00106799
 anchor_right = 1.00107
 anchor_bottom = 1.0
-theme = SubResource( 9 )
+theme = SubResource( 13 )
 __meta__ = {
 "_edit_use_anchors_": false
 }
 
-[node name="main" type="Control" parent="ui"]
+[node name="Main" type="Control" parent="UI"]
 anchor_left = -0.000673103
 anchor_top = -0.00189865
 anchor_right = 0.999327
@@ -203,7 +202,7 @@ __meta__ = {
 "_edit_use_anchors_": false
 }
 
-[node name="play" type="TextureButton" parent="ui/main"]
+[node name="Play" type="TextureButton" parent="UI/Main"]
 margin_left = 100.0
 margin_top = 390.0
 margin_right = 400.0
@@ -215,7 +214,7 @@ __meta__ = {
 "_edit_use_anchors_": false
 }
 
-[node name="settings" type="TextureButton" parent="ui/main"]
+[node name="Settings" type="TextureButton" parent="UI/Main"]
 margin_left = 100.0
 margin_top = 490.0
 margin_right = 400.0
@@ -224,7 +223,7 @@ texture_normal = ExtResource( 9 )
 texture_pressed = ExtResource( 9 )
 texture_hover = ExtResource( 10 )
 
-[node name="quit" type="TextureButton" parent="ui/main"]
+[node name="Quit" type="TextureButton" parent="UI/Main"]
 margin_left = 100.0
 margin_top = 590.0
 margin_right = 400.0
@@ -233,7 +232,7 @@ texture_normal = ExtResource( 11 )
 texture_pressed = ExtResource( 11 )
 texture_hover = ExtResource( 12 )
 
-[node name="settings" type="VBoxContainer" parent="ui"]
+[node name="Settings" type="VBoxContainer" parent="UI"]
 visible = false
 anchor_left = 0.109896
 anchor_top = 0.32037
@@ -244,7 +243,7 @@ __meta__ = {
 "_edit_use_anchors_": true
 }
 
-[node name="gi" type="HBoxContainer" parent="ui/settings"]
+[node name="GI" type="HBoxContainer" parent="UI/Settings"]
 margin_right = 1342.0
 margin_bottom = 57.0
 custom_constants/separation = 30
@@ -253,7 +252,7 @@ __meta__ = {
 "_edit_use_anchors_": false
 }
 
-[node name="gi_label" type="Label" parent="ui/settings/gi"]
+[node name="Label" type="Label" parent="UI/Settings/GI"]
 margin_top = 2.0
 margin_right = 400.0
 margin_bottom = 55.0
@@ -261,35 +260,35 @@ rect_min_size = Vector2( 400, 0 )
 custom_colors/font_color = Color( 1, 1, 1, 1 )
 text = "Global Illumination:"
 
-[node name="gi_high" type="Button" parent="ui/settings/gi"]
+[node name="High" type="Button" parent="UI/Settings/GI"]
 margin_left = 430.0
 margin_right = 714.0
 margin_bottom = 57.0
 size_flags_horizontal = 3
 toggle_mode = true
 pressed = true
-group = SubResource( 10 )
+group = SubResource( 14 )
 text = "High"
 
-[node name="gi_low" type="Button" parent="ui/settings/gi"]
+[node name="Low" type="Button" parent="UI/Settings/GI"]
 margin_left = 744.0
 margin_right = 1028.0
 margin_bottom = 57.0
 size_flags_horizontal = 3
 toggle_mode = true
-group = SubResource( 10 )
+group = SubResource( 14 )
 text = "Low"
 
-[node name="gi_disabled" type="Button" parent="ui/settings/gi"]
+[node name="Disabled" type="Button" parent="UI/Settings/GI"]
 margin_left = 1058.0
 margin_right = 1342.0
 margin_bottom = 57.0
 size_flags_horizontal = 3
 toggle_mode = true
-group = SubResource( 10 )
+group = SubResource( 14 )
 text = "Disabled"
 
-[node name="aa" type="HBoxContainer" parent="ui/settings"]
+[node name="AA" type="HBoxContainer" parent="UI/Settings"]
 margin_top = 87.0
 margin_right = 1342.0
 margin_bottom = 144.0
@@ -299,7 +298,7 @@ __meta__ = {
 "_edit_use_anchors_": false
 }
 
-[node name="aa_label" type="Label" parent="ui/settings/aa"]
+[node name="Label" type="Label" parent="UI/Settings/AA"]
 margin_right = 400.0
 margin_bottom = 57.0
 rect_min_size = Vector2( 400, 0 )
@@ -307,44 +306,44 @@ size_flags_vertical = 1
 custom_colors/font_color = Color( 1, 1, 1, 1 )
 text = "Anti Aliasing:"
 
-[node name="aa_8x" type="Button" parent="ui/settings/aa"]
+[node name="8X" type="Button" parent="UI/Settings/AA"]
 margin_left = 430.0
 margin_right = 635.0
 margin_bottom = 57.0
 size_flags_horizontal = 3
 toggle_mode = true
 pressed = true
-group = SubResource( 11 )
+group = SubResource( 15 )
 text = "8x"
 
-[node name="aa_4x" type="Button" parent="ui/settings/aa"]
+[node name="4X" type="Button" parent="UI/Settings/AA"]
 margin_left = 665.0
 margin_right = 870.0
 margin_bottom = 57.0
 size_flags_horizontal = 3
 toggle_mode = true
-group = SubResource( 11 )
+group = SubResource( 15 )
 text = "4x"
 
-[node name="aa_2x" type="Button" parent="ui/settings/aa"]
+[node name="2X" type="Button" parent="UI/Settings/AA"]
 margin_left = 900.0
 margin_right = 1105.0
 margin_bottom = 57.0
 size_flags_horizontal = 3
 toggle_mode = true
-group = SubResource( 11 )
+group = SubResource( 15 )
 text = "2x"
 
-[node name="aa_disabled" type="Button" parent="ui/settings/aa"]
+[node name="Disabled" type="Button" parent="UI/Settings/AA"]
 margin_left = 1135.0
 margin_right = 1342.0
 margin_bottom = 57.0
 size_flags_horizontal = 3
 toggle_mode = true
-group = SubResource( 11 )
+group = SubResource( 15 )
 text = "Disabled"
 
-[node name="ssao" type="HBoxContainer" parent="ui/settings"]
+[node name="SSAO" type="HBoxContainer" parent="UI/Settings"]
 margin_top = 174.0
 margin_right = 1342.0
 margin_bottom = 231.0
@@ -353,7 +352,7 @@ __meta__ = {
 "_edit_group_": true
 }
 
-[node name="ssao_label" type="Label" parent="ui/settings/ssao"]
+[node name="Label" type="Label" parent="UI/Settings/SSAO"]
 margin_right = 400.0
 margin_bottom = 57.0
 rect_min_size = Vector2( 400, 0 )
@@ -364,35 +363,35 @@ __meta__ = {
 "_edit_use_anchors_": false
 }
 
-[node name="ssao_high" type="Button" parent="ui/settings/ssao"]
+[node name="High" type="Button" parent="UI/Settings/SSAO"]
 margin_left = 430.0
 margin_right = 714.0
 margin_bottom = 57.0
 size_flags_horizontal = 3
 toggle_mode = true
 pressed = true
-group = SubResource( 12 )
+group = SubResource( 16 )
 text = "High"
 
-[node name="ssao_low" type="Button" parent="ui/settings/ssao"]
+[node name="Low" type="Button" parent="UI/Settings/SSAO"]
 margin_left = 744.0
 margin_right = 1028.0
 margin_bottom = 57.0
 size_flags_horizontal = 3
 toggle_mode = true
-group = SubResource( 12 )
+group = SubResource( 16 )
 text = "Low"
 
-[node name="ssao_disabled" type="Button" parent="ui/settings/ssao"]
+[node name="Disabled" type="Button" parent="UI/Settings/SSAO"]
 margin_left = 1058.0
 margin_right = 1342.0
 margin_bottom = 57.0
 size_flags_horizontal = 3
 toggle_mode = true
-group = SubResource( 12 )
+group = SubResource( 16 )
 text = "Disabled"
 
-[node name="resolution" type="HBoxContainer" parent="ui/settings"]
+[node name="Resolution" type="HBoxContainer" parent="UI/Settings"]
 margin_top = 261.0
 margin_right = 1342.0
 margin_bottom = 318.0
@@ -401,7 +400,7 @@ __meta__ = {
 "_edit_group_": true
 }
 
-[node name="resolution_label" type="Label" parent="ui/settings/resolution"]
+[node name="Label" type="Label" parent="UI/Settings/Resolution"]
 margin_top = 2.0
 margin_right = 400.0
 margin_bottom = 55.0
@@ -412,50 +411,50 @@ __meta__ = {
 "_edit_use_anchors_": false
 }
 
-[node name="resolution_native" type="Button" parent="ui/settings/resolution"]
+[node name="Native" type="Button" parent="UI/Settings/Resolution"]
 margin_left = 430.0
 margin_right = 635.0
 margin_bottom = 57.0
 size_flags_horizontal = 3
 toggle_mode = true
 pressed = true
-group = SubResource( 13 )
+group = SubResource( 17 )
 text = "Native"
 
-[node name="resolution_1080" type="Button" parent="ui/settings/resolution"]
+[node name="1080" type="Button" parent="UI/Settings/Resolution"]
 margin_left = 665.0
 margin_right = 870.0
 margin_bottom = 57.0
 size_flags_horizontal = 3
 toggle_mode = true
-group = SubResource( 13 )
+group = SubResource( 17 )
 text = "1080"
 
-[node name="resolution_720" type="Button" parent="ui/settings/resolution"]
+[node name="720" type="Button" parent="UI/Settings/Resolution"]
 margin_left = 900.0
 margin_right = 1105.0
 margin_bottom = 57.0
 size_flags_horizontal = 3
 toggle_mode = true
-group = SubResource( 13 )
+group = SubResource( 17 )
 text = "720"
 
-[node name="resolution_576" type="Button" parent="ui/settings/resolution"]
+[node name="540" type="Button" parent="UI/Settings/Resolution"]
 margin_left = 1135.0
 margin_right = 1342.0
 margin_bottom = 57.0
 size_flags_horizontal = 3
 toggle_mode = true
-group = SubResource( 13 )
-text = "576"
+group = SubResource( 17 )
+text = "540"
 
-[node name="fullscreen" type="HBoxContainer" parent="ui/settings"]
+[node name="Fullscreen" type="HBoxContainer" parent="UI/Settings"]
 margin_top = 348.0
 margin_right = 1342.0
 margin_bottom = 405.0
 custom_constants/separation = 30
 
-[node name="fullscreen_label" type="Label" parent="ui/settings/fullscreen"]
+[node name="Label" type="Label" parent="UI/Settings/Fullscreen"]
 margin_top = 2.0
 margin_right = 400.0
 margin_bottom = 55.0
@@ -466,44 +465,45 @@ __meta__ = {
 "_edit_use_anchors_": false
 }
 
-[node name="fullscreen_yes" type="Button" parent="ui/settings/fullscreen"]
+[node name="Yes" type="Button" parent="UI/Settings/Fullscreen"]
 margin_left = 430.0
 margin_right = 871.0
 margin_bottom = 57.0
 size_flags_horizontal = 3
 toggle_mode = true
 pressed = true
-group = SubResource( 14 )
+group = SubResource( 18 )
 text = "Yes"
 
-[node name="fullscreen_no" type="Button" parent="ui/settings/fullscreen"]
+[node name="No" type="Button" parent="UI/Settings/Fullscreen"]
 margin_left = 901.0
 margin_right = 1342.0
 margin_bottom = 57.0
 size_flags_horizontal = 3
 toggle_mode = true
-group = SubResource( 14 )
+group = SubResource( 18 )
 text = "No"
 
-[node name="sep" type="Control" parent="ui/settings"]
+[node name="HSeparator" type="HSeparator" parent="UI/Settings"]
+modulate = Color( 1, 1, 1, 0 )
 margin_top = 435.0
 margin_right = 1342.0
 margin_bottom = 455.0
 rect_min_size = Vector2( 0, 20 )
 
-[node name="actions" type="HBoxContainer" parent="ui/settings"]
+[node name="Actions" type="HBoxContainer" parent="UI/Settings"]
 margin_top = 485.0
 margin_right = 1342.0
 margin_bottom = 542.0
 custom_constants/separation = 50
 
-[node name="apply" type="Button" parent="ui/settings/actions"]
+[node name="Apply" type="Button" parent="UI/Settings/Actions"]
 margin_right = 646.0
 margin_bottom = 57.0
 size_flags_horizontal = 3
 custom_styles/hover = ExtResource( 18 )
 custom_styles/pressed = ExtResource( 18 )
-custom_fonts/font = SubResource( 16 )
+custom_fonts/font = SubResource( 20 )
 custom_colors/font_color = Color( 1, 1, 1, 1 )
 custom_colors/font_color_hover = Color( 1, 1, 1, 1 )
 custom_colors/font_color_pressed = Color( 1, 1, 1, 1 )
@@ -512,20 +512,20 @@ __meta__ = {
 "_edit_use_anchors_": false
 }
 
-[node name="cancel" type="Button" parent="ui/settings/actions"]
+[node name="Cancel" type="Button" parent="UI/Settings/Actions"]
 margin_left = 696.0
 margin_right = 1342.0
 margin_bottom = 57.0
 size_flags_horizontal = 3
 custom_styles/hover = ExtResource( 18 )
 custom_styles/pressed = ExtResource( 18 )
-custom_fonts/font = SubResource( 16 )
+custom_fonts/font = SubResource( 20 )
 custom_colors/font_color = Color( 1, 1, 1, 1 )
 custom_colors/font_color_hover = Color( 1, 1, 1, 1 )
 custom_colors/font_color_pressed = Color( 1, 1, 1, 1 )
 text = "Cancel"
 
-[node name="loading" type="HBoxContainer" parent="ui"]
+[node name="Loading" type="HBoxContainer" parent="UI"]
 visible = false
 anchor_top = 1.0
 anchor_right = 1.0
@@ -540,32 +540,32 @@ __meta__ = {
 "_edit_use_anchors_": false
 }
 
-[node name="label" type="Label" parent="ui/loading"]
+[node name="Label" type="Label" parent="UI/Loading"]
 margin_right = 168.0
 margin_bottom = 53.0
 custom_fonts/font = ExtResource( 13 )
 text = "Loading..."
 
-[node name="progress" type="ProgressBar" parent="ui/loading"]
+[node name="Progress" type="ProgressBar" parent="UI/Loading"]
 margin_left = 268.0
 margin_right = 1690.0
 margin_bottom = 53.0
 size_flags_horizontal = 3
 size_flags_vertical = 1
-custom_styles/fg = SubResource( 17 )
-custom_styles/bg = SubResource( 18 )
+custom_styles/fg = SubResource( 21 )
+custom_styles/bg = SubResource( 22 )
 __meta__ = {
 "_edit_use_anchors_": false
 }
 
-[node name="loading_done_timer" type="Timer" parent="ui/loading"]
+[node name="DoneTimer" type="Timer" parent="UI/Loading"]
 wait_time = 0.5
 one_shot = true
-[connection signal="pressed" from="ui/main/play" to="." method="_on_play_pressed"]
-[connection signal="pressed" from="ui/main/settings" to="." method="_on_settings_pressed"]
-[connection signal="pressed" from="ui/main/quit" to="." method="_on_quit_pressed"]
-[connection signal="pressed" from="ui/settings/actions/apply" to="." method="_on_apply_pressed"]
-[connection signal="pressed" from="ui/settings/actions/cancel" to="." method="_on_cancel_pressed"]
-[connection signal="timeout" from="ui/loading/loading_done_timer" to="." method="_on_loading_done_timer_timeout"]
+[connection signal="pressed" from="UI/Main/Play" to="." method="_on_play_pressed"]
+[connection signal="pressed" from="UI/Main/Settings" to="." method="_on_settings_pressed"]
+[connection signal="pressed" from="UI/Main/Quit" to="." method="_on_quit_pressed"]
+[connection signal="pressed" from="UI/Settings/Actions/Apply" to="." method="_on_apply_pressed"]
+[connection signal="pressed" from="UI/Settings/Actions/Cancel" to="." method="_on_cancel_pressed"]
+[connection signal="timeout" from="UI/Loading/DoneTimer" to="." method="_on_loading_done_timer_timeout"]
 
 [editable path="PlayerModel"]

+ 8 - 1
menu/settings.gd

@@ -20,7 +20,7 @@ enum SSAOQuality {
 }
 
 enum Resolution {
-	RES_576 = 0
+	RES_540 = 0
 	RES_720 = 1
 	RES_1080 = 2
 	NATIVE = 3
@@ -36,6 +36,12 @@ func _ready():
 	load_settings()
 
 
+func _input(event):
+	if event.is_action_pressed("toggle_fullscreen"):
+		OS.window_fullscreen = !OS.window_fullscreen
+		get_tree().set_input_as_handled()
+
+
 func load_settings():
 	var f = File.new()
 	var error = f.open("user://settings.json", File.READ)
@@ -62,6 +68,7 @@ func load_settings():
 	if "fullscreen" in d:
 		fullscreen = bool(d.fullscreen)
 
+
 func save_settings():
 	var f = File.new()
 	var error = f.open("user://settings.json", File.WRITE)

+ 6 - 3
player/bullet/bullet.gd

@@ -6,6 +6,9 @@ var time_alive = 5
 var direction = Vector3()
 var hit = false
 
+onready var animation_player = $AnimationPlayer
+onready var collision_shape = $CollisionShape
+
 func _process(delta):
 	if hit:
 		return
@@ -13,11 +16,11 @@ func _process(delta):
 	time_alive -= delta
 	if time_alive < 0:
 		hit = true
-		$AnimationPlayer.play("explode")
+		animation_player.play("explode")
 	var col = move_and_collide(delta * direction * BULLET_VELOCITY)
 	if col:
 		if col.collider and col.collider.has_method("hit"):
 			col.collider.hit()
-		$CollisionShape.disabled = true
-		$AnimationPlayer.play("explode")
+		collision_shape.disabled = true
+		animation_player.play("explode")
 		hit = true

+ 1 - 1
player/model/running_nogun-cycle.tres

@@ -798,7 +798,7 @@ tracks/112/imported = true
 tracks/112/enabled = true
 tracks/112/keys = PoolRealArray( 0, 1, -0.0248204, -0.0159708, -0.0117721, -0.0582614, 0.0995405, -0.0127766, 0.993244, 1, 1, 1, 0.0666667, 1, -0.0349451, -0.0176627, -0.00216161, -0.0500997, 0.153333, -0.0251298, 0.986584, 1, 1, 1, 0.133333, 1, -0.0404033, -0.0189479, 0.00360031, -0.0452481, 0.183706, -0.0315525, 0.981432, 1, 1, 1, 0.2, 1, -0.0298408, -0.0157961, -0.00503962, -0.0493294, 0.127432, -0.0185194, 0.990447, 1, 1, 1, 0.266667, 1, -0.0163722, -0.0140715, -0.0159636, -0.0574815, 0.0593736, -0.00490101, 0.996567, 1, 1, 1, 0.333333, 1, -0.00397725, -0.0156929, -0.0273373, -0.0695652, -1.08189e-15, -3.63679e-15, 0.997577, 1, 1, 1, 0.466667, 1, 0.029398, -0.0123048, -0.0353661, -0.0457198, -0.125025, -0.00522868, 0.991086, 1, 1, 1, 0.533333, 1, 0.044884, -0.010919, -0.040057, -0.0363866, -0.179054, -0.0099225, 0.983116, 1, 1, 1, 0.6, 1, 0.0337657, -0.0119701, -0.0367707, -0.0432544, -0.140468, -0.00626093, 0.98912, 1, 1, 1, 0.733333, 1, -0.000457153, -0.0151782, -0.0277864, -0.0663097, -0.0138049, -0.000515402, 0.997703, 1, 1, 1, 0.8, 1, -0.0159644, -0.0149233, -0.018067, -0.0620086, 0.0562381, -0.00467177, 0.996479, 1, 1, 1, 0.833333, 1, -0.0248204, -0.0159711, -0.0117716, -0.0582614, 0.0995405, -0.0127766, 0.993244, 1, 1, 1 )
 tracks/113/type = "audio"
-tracks/113/path = NodePath("../sfx/step")
+tracks/113/path = NodePath("../SoundEffects/Step")
 tracks/113/interp = 1
 tracks/113/loop_wrap = true
 tracks/113/imported = false

+ 33 - 21
player/player.gd

@@ -26,11 +26,22 @@ onready var initial_position = transform.origin
 onready var gravity = ProjectSettings.get_setting("physics/3d/default_gravity") * ProjectSettings.get_setting("physics/3d/default_gravity_vector")
 
 onready var animation_tree = $AnimationTree
+onready var player_model = $PlayerModel
+onready var shoot_from = player_model.get_node(@"Robot_Skeleton/Skeleton/GunBone/ShootFrom")
+onready var color_rect = $ColorRect
+onready var crosshair = $Crosshair
+onready var fire_cooldown = $FireCooldown
+
 onready var camera_base = $CameraBase
-onready var camera_animation = $CameraBase/Animation
-onready var camera_rot = $CameraBase/CameraRot
-onready var camera_spring_arm = $CameraBase/CameraRot/SpringArm
-onready var camera = $CameraBase/CameraRot/SpringArm/Camera
+onready var camera_animation = camera_base.get_node(@"Animation")
+onready var camera_rot = camera_base.get_node(@"CameraRot")
+onready var camera_spring_arm = camera_rot.get_node(@"SpringArm")
+onready var camera_camera = camera_spring_arm.get_node(@"Camera")
+
+onready var sound_effects = $SoundEffects
+onready var sound_effect_jump = sound_effects.get_node(@"Jump")
+onready var sound_effect_land = sound_effects.get_node(@"Land")
+onready var sound_effect_shoot = sound_effects.get_node(@"Shoot")
 
 func _init():
 	Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
@@ -38,7 +49,7 @@ func _init():
 
 func _ready():
 	# Pre-initialize orientation transform.
-	orientation = $PlayerModel.global_transform
+	orientation = player_model.global_transform
 	orientation.origin = Vector3()
 
 
@@ -47,10 +58,10 @@ func _process(_delta):
 	# the lowest valid position on the map (which is a bit under -16).
 	# At 15 units below -17 (so -32), the screen turns fully black.
 	if transform.origin.y < -17:
-		$ColorRect.modulate.a = min((-17 - transform.origin.y) / 15, 1)
+		color_rect.modulate.a = min((-17 - transform.origin.y) / 15, 1)
 		# If we're below -40, respawn (teleport to the initial position).
 		if transform.origin.y < -40:
-			$ColorRect.modulate.a = 0
+			color_rect.modulate.a = 0
 			transform.origin = initial_position
 
 
@@ -89,7 +100,7 @@ func _physics_process(delta):
 	airborne_time += delta
 	if is_on_floor():
 		if airborne_time > 0.5:
-			$sfx/land.play()
+			sound_effect_land.play()
 		airborne_time = 0
 	
 	var on_air = airborne_time > MIN_AIRBORNE_TIME
@@ -98,7 +109,7 @@ func _physics_process(delta):
 		velocity.y = JUMP_SPEED
 		on_air = true
 		animation_tree["parameters/state/current"] = 2
-		$sfx/jump.play()
+		sound_effect_jump.play()
 	
 	if on_air:
 		if (velocity.y > 0):
@@ -117,7 +128,7 @@ func _physics_process(delta):
 		
 		# Convert orientation to quaternions for interpolating rotation.
 		var q_from = orientation.basis.get_rotation_quat()
-		var q_to = $CameraBase.global_transform.basis.get_rotation_quat()
+		var q_to = camera_base.global_transform.basis.get_rotation_quat()
 		# Interpolate current rotation with desired one.
 		orientation.basis = Basis(q_from.slerp(q_to, delta * ROTATION_INTERPOLATE_SPEED))
 		
@@ -126,12 +137,12 @@ func _physics_process(delta):
 		
 		root_motion = animation_tree.get_root_motion_transform()
 		
-		if Input.is_action_pressed("shoot") and $FireCooldown.time_left == 0:
-			var shoot_from = $PlayerModel/Robot_Skeleton/Skeleton/GunBone/ShootFrom.global_transform.origin
+		if Input.is_action_pressed("shoot") and fire_cooldown.time_left == 0:
+			var shoot_origin = shoot_from.global_transform.origin
 			
-			var ch_pos = $Crosshair.rect_position + $Crosshair.rect_size * 0.5
-			var ray_from = camera.project_ray_origin(ch_pos)
-			var ray_dir = camera.project_ray_normal(ch_pos)
+			var ch_pos = crosshair.rect_position + crosshair.rect_size * 0.5
+			var ray_from = camera_camera.project_ray_origin(ch_pos)
+			var ray_dir = camera_camera.project_ray_normal(ch_pos)
 			
 			var shoot_target
 			var col = get_world().direct_space_state.intersect_ray(ray_from, ray_from + ray_dir * 1000, [self], 0b11)
@@ -139,15 +150,15 @@ func _physics_process(delta):
 				shoot_target = ray_from + ray_dir * 1000
 			else:
 				shoot_target = col.position
-			var shoot_dir = (shoot_target - shoot_from).normalized()
+			var shoot_dir = (shoot_target - shoot_origin).normalized()
 			
 			var bullet = preload("res://player/bullet/bullet.tscn").instance()
 			get_parent().add_child(bullet)
-			bullet.global_transform.origin = shoot_from
+			bullet.global_transform.origin = shoot_origin
 			bullet.direction = shoot_dir
 			bullet.add_collision_exception_with(self)
-			$FireCooldown.start()
-			$sfx/shoot.play()
+			fire_cooldown.start()
+			sound_effect_shoot.play()
 	else: # Not in air or aiming, idle.
 		# Convert orientation to quaternions for interpolating rotation.
 		var target = camera_x * motion.x + camera_z * motion.y
@@ -178,7 +189,7 @@ func _physics_process(delta):
 	orientation.origin = Vector3() # Clear accumulated root motion displacement (was applied to speed).
 	orientation = orientation.orthonormalized() # Orthonormalize orientation.
 	
-	$PlayerModel.global_transform.basis = orientation.basis
+	player_model.global_transform.basis = orientation.basis
 
 
 func _input(event):
@@ -191,7 +202,8 @@ func _input(event):
 
 func rotate_camera(move):
 	camera_base.rotate_y(-move.x)
-	camera_base.orthonormalize() # After relative transforms, camera needs to be renormalized.
+	# After relative transforms, camera needs to be renormalized.
+	camera_base.orthonormalize()
 	camera_x_rot += move.y
 	camera_x_rot = clamp(camera_x_rot, deg2rad(CAMERA_X_ROT_MIN), deg2rad(CAMERA_X_ROT_MAX))
 	camera_rot.rotation.x = camera_x_rot

+ 7 - 7
player/player.tscn

@@ -152,7 +152,7 @@ nodes/strafe/node = SubResource( 16 )
 nodes/strafe/position = Vector2( -400, -120 )
 nodes/walk/node = SubResource( 21 )
 nodes/walk/position = Vector2( -400, 40 )
-node_connections = [ "output", 0, "eye_blend", "state", 0, "strafe", "state", 1, "walk", "state", 2, "jumpup", "state", 3, "jumpdown", "aim", 0, "aimdown", "aim", 1, "land", "aim", 2, "aimup", "eye_blend", 0, "aim", "eye_blend", 1, "eyes", "land", 0, "state", "land", 1, "hardland" ]
+node_connections = [ "output", 0, "eye_blend", "state", 0, "strafe", "state", 1, "walk", "state", 2, "jumpup", "state", 3, "jumpdown", "land", 0, "state", "land", 1, "hardland", "aim", 0, "aimdown", "aim", 1, "land", "aim", 2, "aimup", "eye_blend", 0, "aim", "eye_blend", 1, "eyes" ]
 
 [sub_resource type="CapsuleShape" id=23]
 radius = 0.5
@@ -229,7 +229,7 @@ transform = Transform( 0.803991, 0, 0, 0, 0.803991, 0, 0, 0, 0.803991, 0, 0, 0 )
 bones/46/bound_children = [ NodePath("GunBone") ]
 
 [node name="GunBone" type="BoneAttachment" parent="PlayerModel/Robot_Skeleton/Skeleton" index="5"]
-transform = Transform( 0.918466, -0.262051, 0.296549, -0.240686, -0.964677, -0.107372, 0.314249, 0.0272598, -0.948962, -0.207504, 1.38366, 0.480875 )
+transform = Transform( 0.916368, -0.24167, 0.319464, -0.240673, -0.969661, -0.0435164, 0.320323, -0.0369838, -0.946598, -0.207126, 1.38922, 0.483314 )
 bone_name = "hand.R"
 
 [node name="ShootFrom" type="Position3D" parent="PlayerModel/Robot_Skeleton/Skeleton/GunBone"]
@@ -310,18 +310,18 @@ __meta__ = {
 "_edit_use_anchors_": false
 }
 
-[node name="sfx" type="Node" parent="."]
+[node name="SoundEffects" type="Node" parent="."]
 
-[node name="step" type="AudioStreamPlayer" parent="sfx"]
+[node name="Step" type="AudioStreamPlayer" parent="SoundEffects"]
 stream = ExtResource( 4 )
 
-[node name="jump" type="AudioStreamPlayer" parent="sfx"]
+[node name="Jump" type="AudioStreamPlayer" parent="SoundEffects"]
 stream = ExtResource( 5 )
 
-[node name="land" type="AudioStreamPlayer" parent="sfx"]
+[node name="Land" type="AudioStreamPlayer" parent="SoundEffects"]
 stream = ExtResource( 6 )
 
-[node name="shoot" type="AudioStreamPlayer" parent="sfx"]
+[node name="Shoot" type="AudioStreamPlayer" parent="SoundEffects"]
 stream = SubResource( 27 )
 
 [node name="FireCooldown" type="Timer" parent="."]

+ 1 - 1
project.godot

@@ -21,7 +21,7 @@ config/icon="res://icon.png"
 
 [autoload]
 
-settings="*res://menu/settings.gd"
+Settings="*res://menu/settings.gd"
 
 [display]
 

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно