This commit is contained in:
SyntaX 2019-11-21 13:31:59 +01:00
commit fb5b6da3d3
15 changed files with 1201 additions and 21 deletions

View File

@ -7,4 +7,5 @@ onready var steps = [
func play_footstep():
Logger.trace("Footstep")
steps[0].play()

View File

@ -5,4 +5,6 @@ onready var screen_texture = get_node("ScreenTexture") as ColorRect
func _process(delta: float) -> void:
screen_texture.material.set_shader_param("mask_factor", Pills.get_level() / Pills.get_max())
# The factor is 0 when the level is between 0% and 25%; 1 when the level is between 75% and 100%; lerp inbetween
var factor = clamp((Pills.get_level() / Pills.get_max() * 1.5 - 0.25), 0.0, 1.0)
screen_texture.material.set_shader_param("mask_factor", factor)

View File

@ -54,6 +54,7 @@ func _ready():
func _physics_process(delta):
process_input()
process_movement(delta)
process_collision_layers()
func _process(_delta):
check_interact()
@ -102,6 +103,17 @@ func process_animations():
_animation.playback_speed = _vel.length() / MOVE_SPEED
func process_collision_layers():
var new_layer: int = 6
if Pills.get_level() >= Pills.LEVELS.VERY_LOW:
# If the masked view is almost invisible, collision with masked objects is disabled
new_layer -= 1 # See collision layer names in editor
collision_layer = new_layer
collision_mask = new_layer
func check_interact():
if _lookCast.is_colliding():
var collider = _lookCast.get_collider()

View File

@ -104,8 +104,8 @@ random_pitch = 1.3
[node name="Player" type="KinematicBody" groups=[
"Player",
]]
collision_layer = 5
collision_mask = 5
collision_layer = 7
collision_mask = 7
script = ExtResource( 1 )
body_nodepath = NodePath("Body")
lookingAt_nodepath = NodePath("Body/PillCameras/LookingAt")
@ -130,20 +130,26 @@ current = true
[node name="TrueView" type="Viewport" parent="Body/PillCameras"]
size = Vector2( 1024, 600 )
render_target_update_mode = 3
shadow_atlas_size = 4
[node name="TrueCamera" type="Camera" parent="Body/PillCameras/TrueView"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 7.45058e-009, 1.8, 0 )
cull_mask = 2
current = true
fov = 80.0
far = 2000.0
[node name="MaskedView" type="Viewport" parent="Body/PillCameras"]
size = Vector2( 1024, 600 )
render_target_update_mode = 3
shadow_atlas_size = 4
[node name="MaskedCamera" type="Camera" parent="Body/PillCameras/MaskedView"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 7.45058e-009, 1.8, 0 )
cull_mask = 1
current = true
fov = 80.0
far = 2000.0
[node name="ScreenTexture" type="ColorRect" parent="Body/PillCameras"]
material = SubResource( 3 )

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=3 format=2]
[gd_scene load_steps=4 format=2]
[sub_resource type="CubeMesh" id=1]
size = Vector3( 26, 12, 14 )
@ -6,9 +6,17 @@ size = Vector3( 26, 12, 14 )
[sub_resource type="SpatialMaterial" id=2]
albedo_color = Color( 1, 0.917647, 0.537255, 1 )
[sub_resource type="ConcavePolygonShape" id=3]
data = PoolVector3Array( -13, 6, 7, 13, 6, 7, -13, -6, 7, 13, 6, 7, 13, -6, 7, -13, -6, 7, 13, 6, -7, -13, 6, -7, 13, -6, -7, -13, 6, -7, -13, -6, -7, 13, -6, -7, 13, 6, 7, 13, 6, -7, 13, -6, 7, 13, 6, -7, 13, -6, -7, 13, -6, 7, -13, 6, -7, -13, 6, 7, -13, -6, -7, -13, 6, 7, -13, -6, 7, -13, -6, -7, 13, 6, 7, -13, 6, 7, 13, 6, -7, -13, 6, 7, -13, 6, -7, 13, 6, -7, -13, -6, 7, 13, -6, 7, -13, -6, -7, 13, -6, 7, 13, -6, -7, -13, -6, -7 )
[node name="BuildingBlock" type="Spatial"]
[node name="MeshInstance" type="MeshInstance" parent="."]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 6, 0 )
mesh = SubResource( 1 )
material/0 = SubResource( 2 )
[node name="StaticBody" type="StaticBody" parent="MeshInstance"]
[node name="CollisionShape" type="CollisionShape" parent="MeshInstance/StaticBody"]
shape = SubResource( 3 )

View File

@ -1,6 +1,6 @@
[gd_scene load_steps=2 format=2]
[sub_resource type="CylinderMesh" id=4]
[sub_resource type="CylinderMesh" id=1]
top_radius = 20.0
bottom_radius = 35.0
height = 100.0
@ -10,15 +10,15 @@ transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -185, 0, -191 )
[node name="MeshInstance" type="MeshInstance" parent="."]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 50, 0 )
mesh = SubResource( 4 )
mesh = SubResource( 1 )
material/0 = null
[node name="MeshInstance2" type="MeshInstance" parent="."]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 30, 50, 60 )
mesh = SubResource( 4 )
mesh = SubResource( 1 )
material/0 = null
[node name="MeshInstance3" type="MeshInstance" parent="."]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 30, 50, -60 )
mesh = SubResource( 4 )
mesh = SubResource( 1 )
material/0 = null

File diff suppressed because one or more lines are too long

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@ -0,0 +1,21 @@
[remap]
importer="wav"
type="AudioStreamSample"
path="res://.import/DoorClose.wav-a42279a23e15223438fad3653a5f11d2.sample"
[deps]
source_file="res://Resources/Audio/DoorClose.wav"
dest_files=[ "res://.import/DoorClose.wav-a42279a23e15223438fad3653a5f11d2.sample" ]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=true
edit/normalize=true
edit/loop=false
compress/mode=0

Binary file not shown.

View File

@ -0,0 +1,21 @@
[remap]
importer="wav"
type="AudioStreamSample"
path="res://.import/DoorOpen.wav-053df945fc1e6b8ed535511515244f05.sample"
[deps]
source_file="res://Resources/Audio/DoorOpen.wav"
dest_files=[ "res://.import/DoorOpen.wav-053df945fc1e6b8ed535511515244f05.sample" ]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=true
edit/normalize=true
edit/loop=false
compress/mode=0

43
Things/pills/Pills.tscn Normal file

File diff suppressed because one or more lines are too long

View File

@ -63,7 +63,7 @@ _global_script_class_icons={
[application]
config/name="retrace"
run/main_scene="res://Level/PathTestWorld.tscn"
run/main_scene="res://Level/World.tscn"
config/icon="res://icon.png"
[autoload]