Compare commits

..

4 Commits

Author SHA1 Message Date
Spencer Killen fc8c1e47b6
Merge branch 'spencer' 2022-12-28 10:37:55 -07:00
Spencer Killen 7bd52b4507
Add ground gravity 2022-12-28 10:37:27 -07:00
Spencer Killen ba02781ce0
sound design 2022-12-27 20:06:15 -07:00
Spencer Killen a63c8e03e9
various fixes 2022-12-27 13:24:35 -07:00
41 changed files with 1409 additions and 59 deletions

BIN
blends/levels/creek_platform.blend (Stored with Git LFS)

Binary file not shown.

BIN
blends/levels/meat_creek_cage.png (Stored with Git LFS)

Binary file not shown.

BIN
blends/levels/side_tunnel_1.blend (Stored with Git LFS)

Binary file not shown.

View File

@ -1,3 +1,3 @@
source_md5="a4b045d4090a0a01a253a33da0505cb1" source_md5="0fd4b06bb4f9ac715836d05cb4e85e7b"
dest_md5="aa0e8b90fb5b116e0726f81803c8a616" dest_md5="0dddb11d864bd4c870b083fc31fbd6d8"

View File

@ -1,3 +1,3 @@
source_md5="dc558dbf7581e287a28daca6be3a1cca" source_md5="972d81b0bd575b1c674dc10df9a572c3"
dest_md5="c542e847721acd50c307244492ab8175" dest_md5="9b133d04e1308f2e5962308f1d907e03"

View File

@ -1,3 +1,3 @@
source_md5="ace676fe7e4f24bdbf032aa00230af74" source_md5="ace676fe7e4f24bdbf032aa00230af74"
dest_md5="6221cf041bb9d666bad1929ab6455e8e" dest_md5="bd6a0176607b4ecebcd50991f6da0776"

View File

@ -1,3 +1,3 @@
source_md5="1d4ca3067ebf1c9e78e1186dc7d2bdf9" source_md5="1d4ca3067ebf1c9e78e1186dc7d2bdf9"
dest_md5="a36af739bfbe7506149dbdeb9222249b" dest_md5="1d50108642ea2e4507a85242c0e7695c"

View File

@ -0,0 +1,3 @@
source_md5="e833f38119016447d89eb1e9ba10b257"
dest_md5="b025fd110fbecc608a1db2fe72d0985e"

View File

@ -11,5 +11,5 @@ dest_files=[ "res://.import/high_whale.ogg-48d354f55ee014cb0a5286b1f3370c6c.oggs
[params] [params]
loop=true loop=false
loop_offset=0 loop_offset=0

View File

@ -11,5 +11,5 @@ dest_files=[ "res://.import/low_whale_one.ogg-a0d08574bcb169191faa5efc68b2178c.o
[params] [params]
loop=true loop=false
loop_offset=0 loop_offset=0

Binary file not shown.

BIN
godot/assets/meat_creek/UpperShelfMaterial.material (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,34 @@
extends AudioStreamPlayer
export var base_volume: float = -7.0
export var base_pitch: float = 1.0
export var submerged_volume: float = 10.0
export var submerged_pitch: float = 0.75
export var pit_volume: float = 0
export var pit_pitch: float = 0.25
func _ready():
var _ignore = GlobalEventBus.connect("player_entered_meat_sink", self, "enter_water")
_ignore = GlobalEventBus.connect("player_exited_meat_sink", self, "exit_water")
volume_db = base_volume
var water = 0
func enter_water():
water += 1
func exit_water():
water -= 1
func _process(delta):
var target_volume = base_volume
var target_pitch = base_pitch
if water:
target_volume = submerged_volume
target_pitch = submerged_pitch
if Util.player.camera_position().y <= -18:
target_volume = pit_volume
target_pitch = pit_pitch
volume_db = Util.clamped_lerp(volume_db, target_volume, delta*5, 0.01)
pitch_scale = Util.clamped_lerp(pitch_scale, target_pitch, delta*5, 0.01)

View File

@ -0,0 +1,21 @@
extends AudioStreamPlayer
export var min_wait: float
export var max_wait: float
func start_timer():
var wait = rand_range(min_wait, max_wait)
$Timer.start(wait)
func _on_Timer_timeout():
play()
func _on_sound_finished():
start_timer()
var needs_bootstrap = true
func _process(_delta):
if needs_bootstrap and Util.player.camera_position().y < -18:
needs_bootstrap = false
start_timer()

BIN
godot/assets/meat_creek/creek_cage.glb (Stored with Git LFS)

Binary file not shown.

File diff suppressed because one or more lines are too long

BIN
godot/assets/meat_creek/creek_platform.glb (Stored with Git LFS)

Binary file not shown.

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=13 format=2] [gd_scene load_steps=21 format=2]
[ext_resource path="res://assets/meat_creek/side_tunnel_1.glb" type="PackedScene" id=1] [ext_resource path="res://assets/meat_creek/side_tunnel_1.glb" type="PackedScene" id=1]
[ext_resource path="res://player/player.tscn" type="PackedScene" id=2] [ext_resource path="res://player/player.tscn" type="PackedScene" id=2]
@ -10,6 +10,14 @@
[ext_resource path="res://assets/meat_creek/StaticBody.tscn" type="PackedScene" id=8] [ext_resource path="res://assets/meat_creek/StaticBody.tscn" type="PackedScene" id=8]
[ext_resource path="res://assets/meat_creek/creek_cage.tscn" type="PackedScene" id=9] [ext_resource path="res://assets/meat_creek/creek_cage.tscn" type="PackedScene" id=9]
[ext_resource path="res://assets/models/meat_creek_elevator.tscn" type="PackedScene" id=10] [ext_resource path="res://assets/models/meat_creek_elevator.tscn" type="PackedScene" id=10]
[ext_resource path="res://assets/audio/walkie_talkie/high_whale.ogg" type="AudioStream" id=11]
[ext_resource path="res://assets/models/walkie_talkie/signal_generator.tscn" type="PackedScene" id=12]
[ext_resource path="res://assets/meat_creek/upper_shelf.glb" type="PackedScene" id=13]
[ext_resource path="res://assets/audio/walkie_talkie/white_noise_static.ogg" type="AudioStream" id=14]
[ext_resource path="res://assets/meat_creek/WaterSound.gd" type="Script" id=15]
[ext_resource path="res://assets/audio/walkie_talkie/buzz_static.ogg" type="AudioStream" id=16]
[ext_resource path="res://assets/audio/walkie_talkie/low_whale_one.ogg" type="AudioStream" id=17]
[ext_resource path="res://assets/meat_creek/WhaleSounds.gd" type="Script" id=18]
[sub_resource type="PanoramaSky" id=2] [sub_resource type="PanoramaSky" id=2]
panorama = ExtResource( 4 ) panorama = ExtResource( 4 )
@ -53,7 +61,7 @@ transform = Transform( 0.0716538, 0, 0.99743, 0, 1, 0, -0.99743, 0, 0.0716538, -
environment = SubResource( 3 ) environment = SubResource( 3 )
[node name="SinkBlock" parent="." index="4" instance=ExtResource( 5 )] [node name="SinkBlock" parent="." index="4" instance=ExtResource( 5 )]
transform = Transform( 80, 0, 0, 0, 1.22944, 0, 0, 0, 80, 0, 0.00184107, -43.3626 ) transform = Transform( 80, 0, 0, 0, 3.87358, 0, 0, 0, 80, 0, -3.3489, -43.3626 )
[node name="platforms" type="Spatial" parent="." index="5"] [node name="platforms" type="Spatial" parent="." index="5"]
@ -122,4 +130,43 @@ transform = Transform( 0.65383, 0, 0.756641, 0, 1, 0, -0.756641, 0, 0.65383, 18.
[node name="creek_cage" parent="." index="7" instance=ExtResource( 9 )] [node name="creek_cage" parent="." index="7" instance=ExtResource( 9 )]
[node name="elevator" parent="." index="8" instance=ExtResource( 10 )] [node name="elevator" parent="." index="8" instance=ExtResource( 10 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -0.0735546, -35.4611, -41.1766 ) transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -0.0735546, -123.027, -41.1766 )
[node name="SignalGenerator" parent="." index="9" instance=ExtResource( 12 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.489914, -122.635, -41.5684 )
stream = ExtResource( 16 )
max_db = 6.0
max_distance = 200.0
[node name="upper_shelf" parent="." index="10" instance=ExtResource( 13 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 3.09789, 0 )
[node name="AmbientSounds" type="Node" parent="." index="11"]
[node name="WaterSound" type="AudioStreamPlayer" parent="AmbientSounds" index="0"]
stream = ExtResource( 14 )
autoplay = true
script = ExtResource( 15 )
[node name="BottomWhale1" type="AudioStreamPlayer" parent="AmbientSounds" index="1"]
stream = ExtResource( 17 )
script = ExtResource( 18 )
min_wait = 10.0
max_wait = 30.0
[node name="Timer" type="Timer" parent="AmbientSounds/BottomWhale1" index="0"]
one_shot = true
[node name="BottomWhale2" type="AudioStreamPlayer" parent="AmbientSounds" index="2"]
stream = ExtResource( 11 )
script = ExtResource( 18 )
min_wait = 10.0
max_wait = 30.0
[node name="Timer" type="Timer" parent="AmbientSounds/BottomWhale2" index="0"]
one_shot = true
[connection signal="finished" from="AmbientSounds/BottomWhale1" to="AmbientSounds/BottomWhale1" method="_on_sound_finished"]
[connection signal="timeout" from="AmbientSounds/BottomWhale1/Timer" to="AmbientSounds/BottomWhale1" method="_on_Timer_timeout"]
[connection signal="finished" from="AmbientSounds/BottomWhale2" to="AmbientSounds/BottomWhale2" method="_on_sound_finished"]
[connection signal="timeout" from="AmbientSounds/BottomWhale2/Timer" to="AmbientSounds/BottomWhale2" method="_on_Timer_timeout"]

BIN
godot/assets/meat_creek/upper_shelf.glb (Stored with Git LFS) Normal file

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,11 @@
extends AudioStreamPlayer3D
func _ready():
var _ignore = GlobalEventBus.connect("player_walkie_talkie_state_change", self, "state")
func state(is_active: bool):
stream_paused = not is_active
func _process(_delta):
var distance = (transform.origin - Util.player.camera_position()).length()
GlobalEventBus.emit_signal("player_objective_ping", self, distance)

View File

@ -0,0 +1,8 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://assets/models/walkie_talkie/signal_generator.gd" type="Script" id=1]
[node name="SignalGenerator" type="AudioStreamPlayer3D"]
autoplay = true
stream_paused = true
script = ExtResource( 1 )

View File

@ -5,9 +5,10 @@ onready var fsm: AnimationNodeStateMachinePlayback = $Animations/AnimationTree.g
export var default_screen_color = Color(0.886275, 1, 0, 1) export var default_screen_color = Color(0.886275, 1, 0, 1)
export var screen_off_color = Color(0.0, 0.0, 0.0) export var screen_off_color = Color(0.0, 0.0, 0.0)
var is_screen_on: bool var is_screen_on: bool
export var screen_flicker_fastest: float = 0.1
export var screen_flicker_slowest: float = 1.0
onready var util = get_node("/root/Util") onready var util = get_node("/root/Util")
onready var player = util.player
func _ready(): func _ready():
is_screen_on = false is_screen_on = false
@ -35,18 +36,16 @@ func toggle_screen():
func make_active(): func make_active():
if active: if active:
return return
if fsm.is_playing(): fsm.travel("WalkieTalkieEnter")
fsm.travel("WalkieTalkieEnter") #$StaticBuzz.play()
else: #$StaticFizz.play()
fsm.start("WalkieTalkieEnter") #$Talk.play()
$StaticBuzz.play() #$Whale1.play()
$StaticFizz.play() #$Whale2.play()
$Talk.play()
$Whale1.play()
$Whale2.play()
turn_screen_on() turn_screen_on()
$Click.play() $Click.play()
active = true active = true
GlobalEventBus.emit_signal("player_walkie_talkie_state_change", true)
func make_inactive(): func make_inactive():
if not active: if not active:
@ -60,24 +59,20 @@ func make_inactive():
turn_screen_off() turn_screen_off()
$Click.play() $Click.play()
active = false active = false
GlobalEventBus.emit_signal("player_walkie_talkie_state_change", false)
func toggle_active(): func toggle_active():
if active: if active:
make_inactive() make_inactive()
else: else:
make_active() make_active()
func put_away():
fsm.travel("WalkieTalkieLeave")
if $DestroyTimer.is_stopped():
$DestroyTimer.start(1)
func _process(_delta): func _process(_delta):
if Input.is_action_just_pressed("toggle_walkie_talkie"): if Input.is_action_just_pressed("toggle_walkie_talkie"):
toggle_active() toggle_active()
if not active or not fsm.is_playing(): if not active or not fsm.is_playing():
return return
if player.is_ground_walking(): if Util.player.is_ground_walking():
fsm.travel("WalkieTalkieWalking") fsm.travel("WalkieTalkieWalking")
else: else:
fsm.travel("WalkieTalkieIdle") fsm.travel("WalkieTalkieIdle")
@ -85,3 +80,6 @@ func _process(_delta):
func _on_ScreenFlicker_timeout(): func _on_ScreenFlicker_timeout():
if active: if active:
toggle_screen() toggle_screen()
var weight = Util.player.objective_distance() / 115.0
var time = Util.clamped_lerp(screen_flicker_fastest, screen_flicker_slowest, weight, 0.0)
$Animations/walkie_talkie/Body/ScreenFlicker.start(time)

View File

@ -273,6 +273,7 @@ omni_range = 0.449905
[node name="ScreenFlicker" type="Timer" parent="Animations/walkie_talkie/Body"] [node name="ScreenFlicker" type="Timer" parent="Animations/walkie_talkie/Body"]
wait_time = 0.3 wait_time = 0.3
one_shot = true
autostart = true autostart = true
[node name="BigKnob" type="MeshInstance" parent="Animations/walkie_talkie"] [node name="BigKnob" type="MeshInstance" parent="Animations/walkie_talkie"]
@ -302,5 +303,6 @@ volume_db = -2.0
[node name="Click" type="AudioStreamPlayer" parent="."] [node name="Click" type="AudioStreamPlayer" parent="."]
stream = ExtResource( 11 ) stream = ExtResource( 11 )
volume_db = -20.0
[connection signal="timeout" from="Animations/walkie_talkie/Body/ScreenFlicker" to="." method="_on_ScreenFlicker_timeout"] [connection signal="timeout" from="Animations/walkie_talkie/Body/ScreenFlicker" to="." method="_on_ScreenFlicker_timeout"]

View File

@ -1,15 +1,67 @@
[gd_scene load_steps=5 format=2] [gd_scene load_steps=8 format=2]
[ext_resource path="res://effects/tiled_sink_material.material" type="Material" id=1] [ext_resource path="res://effects/sink_block_wavy_meat_part2.tres" type="Material" id=1]
[ext_resource path="res://effects/SinkBlock.gd" type="Script" id=2] [ext_resource path="res://effects/SinkBlock.gd" type="Script" id=2]
[ext_resource path="res://effects/sink_block_tiled_texture.png" type="Texture" id=3]
[sub_resource type="CubeMesh" id=3] [sub_resource type="CubeMesh" id=3]
[sub_resource type="Shader" id=5]
code = "// NOTE: Shader automatically converted from Godot Engine 3.5.1.stable's SpatialMaterial.
shader_type spatial;
render_mode async_visible,blend_mix,depth_draw_opaque,cull_back,diffuse_burley,specular_schlick_ggx;
uniform vec4 albedo : hint_color;
uniform sampler2D texture_albedo : hint_albedo;
uniform float specular;
uniform float metallic;
uniform float roughness : hint_range(0,1);
uniform float point_size : hint_range(0,128);
uniform vec3 uv1_scale;
uniform vec3 uv1_offset;
uniform vec3 uv2_scale;
uniform vec3 uv2_offset;
void vertex() {
float offset = TIME / 100.0;
UV=UV*uv1_scale.xy+vec2(offset, offset);
}
void fragment() {
vec2 base_uv = UV;
vec4 albedo_tex = texture(texture_albedo,base_uv);
albedo_tex *= COLOR;
ALBEDO = albedo.rgb * albedo_tex.rgb;
METALLIC = metallic;
ROUGHNESS = roughness;
SPECULAR = specular;
}
"
[sub_resource type="ShaderMaterial" id=7]
resource_name = "tiled_sink_material"
next_pass = ExtResource( 1 )
shader = SubResource( 5 )
shader_param/albedo = Color( 1, 1, 1, 1 )
shader_param/specular = 0.5
shader_param/metallic = 0.0
shader_param/roughness = 0.5
shader_param/point_size = 1.0
shader_param/uv1_scale = Vector3( 10, 10, 1 )
shader_param/uv1_offset = Vector3( 0, -99, 0 )
shader_param/uv2_scale = Vector3( 1, 1, 1 )
shader_param/uv2_offset = Vector3( 0, 0, 0 )
shader_param/texture_albedo = ExtResource( 3 )
[sub_resource type="BoxShape" id=4] [sub_resource type="BoxShape" id=4]
[node name="SinkBlock" type="MeshInstance"] [node name="SinkBlock" type="MeshInstance"]
mesh = SubResource( 3 ) mesh = SubResource( 3 )
material/0 = ExtResource( 1 ) material/0 = SubResource( 7 )
script = ExtResource( 2 ) script = ExtResource( 2 )
[node name="SinkRegion" type="Area" parent="."] [node name="SinkRegion" type="Area" parent="."]

View File

@ -7,7 +7,7 @@ var measure = 0.0
func jump(): func jump():
var phys = $"../OnFootPhysics" var phys = $"../OnFootPhysics"
var on_floor = $"../OnFootPhysics/Floor".is_on_floor var on_floor = $"../OnFootPhysics/Floor".is_on_floor or $"../OnFootPhysics".is_on_floor()
var jump_intent = $"../MovementInput".jump_intent var jump_intent = $"../MovementInput".jump_intent
if jump_intent and not on_floor and not played_takeoff: if jump_intent and not on_floor and not played_takeoff:
@ -15,15 +15,14 @@ func jump():
played_takeoff = true played_takeoff = true
if phys.just_landed: if phys.just_landed:
$Jump.stop()
played_takeoff = false played_takeoff = false
if phys.just_landed_medium and not $CameraAnimation.is_playing(): if phys.just_landed_medium and not $CameraAnimation.is_playing():
$CameraAnimation.play("jump_landing") $CameraAnimation.play("jump_landing")
var landing_playing = $JumpLanding.playing or $JumpLandingHardCrunch.playing or $JumpLandingHardOuch.playing var landing_playing = $JumpLanding.playing or $JumpLandingHardCrunch.playing or $JumpLandingHardOuch.playing
if not landing_playing: if not landing_playing:
if not phys.just_landed_terminally: if not phys.just_landed_terminally and phys.just_landed_medium:
$JumpLanding.play() $JumpLanding.play()
else: elif phys.just_landed_terminally:
$JumpLandingHardCrunch.play() $JumpLandingHardCrunch.play()
$JumpLandingHardOuch.play() $JumpLandingHardOuch.play()
@ -35,11 +34,10 @@ func jump():
func footsteps(): func footsteps():
var on_floor = $"../OnFootPhysics/Floor".is_on_floor var on_floor = $"../OnFootPhysics/Floor".is_on_floor or $"../OnFootPhysics".is_on_floor()
var velocity = $"../MovementInput".input_xz var velocity = $"../MovementInput".input_xz
if not on_floor or velocity.length() == 0: if not on_floor or velocity.length() == 0:
$Footsteps.stop()
return return
if $Footsteps/Timer.time_left > 0.0: if $Footsteps/Timer.time_left > 0.0:
return return

View File

@ -0,0 +1,20 @@
[gd_resource type="ShaderMaterial" load_steps=3 format=2]
[ext_resource path="res://effects/sink_block_tiled_texture.png" type="Texture" id=1]
[sub_resource type="Shader" id=12]
code = "shader_type spatial;
render_mode unshaded, cull_front;
uniform sampler2D texture_albedo : hint_albedo;
void fragment() {
vec2 uv = SCREEN_UV;
uv.x += sin((TIME + SCREEN_UV.y) * 5.0)/5.0;
ALBEDO = texture(texture_albedo, uv).rgb;
}
"
[resource]
shader = SubResource( 12 )
shader_param/texture_albedo = ExtResource( 1 )

View File

@ -0,0 +1,20 @@
[gd_resource type="ShaderMaterial" load_steps=3 format=2]
[ext_resource path="res://effects/sink_block_tiled_texture.png" type="Texture" id=1]
[sub_resource type="Shader" id=12]
code = "shader_type spatial;
render_mode unshaded, cull_front;
uniform sampler2D texture_albedo : hint_albedo;
void fragment() {
vec2 uv = SCREEN_UV;
uv.x += sin((TIME + SCREEN_UV.y) * 5.0)/5.0;
ALBEDO = texture(texture_albedo, uv).rgb;
}
"
[resource]
shader = SubResource( 12 )
shader_param/texture_albedo = ExtResource( 1 )

BIN
godot/effects/tiled_sink_material.material (Stored with Git LFS)

Binary file not shown.

View File

@ -3,9 +3,13 @@ extends Node
# Player enters or leaves an area for a block where they should start slowly sinking into it # Player enters or leaves an area for a block where they should start slowly sinking into it
signal player_entered_meat_sink signal player_entered_meat_sink
signal player_exited_meat_sink signal player_exited_meat_sink
signal player_walkie_talkie_state_change(is_active)
signal player_objective_ping(who, distance)
# This is only here to remove warnings about these signals not getting called (they get called by other nodes # This is only here to remove warnings about these signals not getting called (they get called by other nodes)
func never_called(): func never_called():
emit_signal("player_entered_meat_sink") emit_signal("player_entered_meat_sink")
emit_signal("player_exited_meat_sink") emit_signal("player_exited_meat_sink")
emit_signal("player_walkie_talkie_state_change", false)
emit_signal("player_objective_ping", null, 0.0)

View File

@ -0,0 +1,13 @@
extends Node
var objective_who: WeakRef = weakref(null)
var objective_distance: float = 0.0
func _ready():
var _ignored = GlobalEventBus.connect("player_objective_ping", self, "update_objective_distance")
func update_objective_distance(who: Node, distance: float):
var node = objective_who.get_ref()
if node == null or node == who or distance < objective_distance:
objective_who = weakref(who)
objective_distance = distance

View File

@ -5,6 +5,7 @@ onready var util = get_node("/root/Util")
export var gravity: float = 6.0 export var gravity: float = 6.0
# When falling, gravity is artificially increased # When falling, gravity is artificially increased
export var gravity_downwards_factor: float = 3 export var gravity_downwards_factor: float = 3
export var ground_gravity: float = 3.1
# Rate of gaining speed # Rate of gaining speed
export var velocity_acceleration_xz: float = 3 export var velocity_acceleration_xz: float = 3
export var velocity_acceleration_y: float = 5 export var velocity_acceleration_y: float = 5
@ -51,6 +52,8 @@ func process_velocity(delta: float):
else: else:
velocity.y = max(0.0, velocity.y) velocity.y = max(0.0, velocity.y)
target_velocity.y = max(0.0, max(target_velocity.y, jump_power * $"../MovementInput".jump_intent * jump_permission)) target_velocity.y = max(0.0, max(target_velocity.y, jump_power * $"../MovementInput".jump_intent * jump_permission))
if target_velocity.y == 0.0 and velocity.y == 0.0:
velocity.y = -ground_gravity
if not is_jumping and $"../MovementInput".jump_intent != 0.0 and is_on_floor(): if not is_jumping and $"../MovementInput".jump_intent != 0.0 and is_on_floor():
jump_permission = 0.0 jump_permission = 0.0
is_jumping = true is_jumping = true
@ -92,7 +95,7 @@ func process_velocity(delta: float):
func process_falling(): func process_falling():
if not $Floor.is_on_floor: if not $Floor.is_on_floor and not is_on_floor():
is_falling = true is_falling = true
just_landed = false just_landed = false
just_landed_medium = false just_landed_medium = false
@ -118,5 +121,5 @@ func decrease_velocity_factor(by: Vector3):
func _physics_process(delta): func _physics_process(delta):
process_velocity(delta) process_velocity(delta)
velocity = move_and_slide(velocity, Vector3.UP, true, 4, 0.785398) velocity = move_and_slide(velocity, Vector3.UP, true, 4, 1.3217304764)
process_falling() process_falling()

View File

@ -5,13 +5,26 @@ extends CanvasLayer
onready var OnFootPhysics = get_node("../OnFootPhysics") onready var OnFootPhysics = get_node("../OnFootPhysics")
var will_fall_hard = false var will_fall_hard = false
var in_water: int = 0
func _ready(): func _ready():
$HurtScreen.modulate.a = 0.0 $HurtScreen.modulate.a = 0.0
var _ignore = GlobalEventBus.connect("player_entered_meat_sink", self, "enter_water")
_ignore = GlobalEventBus.connect("player_exited_meat_sink", self, "exit_water")
func _process(_delta): func enter_water():
in_water += 1
func exit_water():
in_water -= 1
func _process(delta):
if OnFootPhysics.is_falling_velocity_terminal(): if OnFootPhysics.is_falling_velocity_terminal():
will_fall_hard = true will_fall_hard = true
if will_fall_hard and OnFootPhysics.is_on_floor(): if will_fall_hard and OnFootPhysics.is_on_floor():
will_fall_hard = false will_fall_hard = false
$HurtScreen/HurtScreenOpacityAnimation.play("opacity") $HurtScreen/HurtScreenOpacityAnimation.play("opacity")
if in_water:
$WaterScreen.color.a = Util.clamped_lerp($WaterScreen.color.a, 0.55, delta, 0.05)
else:
$WaterScreen.color.a = Util.clamped_lerp($WaterScreen.color.a, 0.0, delta*5, 0.05)

View File

@ -1,8 +1,10 @@
extends Spatial extends Spatial
onready var util = get_node("/root/Util")
onready var active_physics_node: Spatial = $OnFootPhysics onready var active_physics_node: Spatial = $OnFootPhysics
func _ready():
Util.player = self
func is_on_foot(): func is_on_foot():
return active_physics_node == $OnFootPhysics return active_physics_node == $OnFootPhysics
@ -26,3 +28,5 @@ func set_physics_node(node: Spatial):
node.global_transform = active_physics_node.global_transform node.global_transform = active_physics_node.global_transform
active_physics_node = node active_physics_node = node
func objective_distance() -> float:
return $ObjectiveTracker.objective_distance

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=29 format=2] [gd_scene load_steps=33 format=2]
[ext_resource path="res://player/CameraController.gd" type="Script" id=1] [ext_resource path="res://player/CameraController.gd" type="Script" id=1]
[ext_resource path="res://player/OnFootPhysics.gd" type="Script" id=2] [ext_resource path="res://player/OnFootPhysics.gd" type="Script" id=2]
@ -20,6 +20,8 @@
[ext_resource path="res://assets/audio/404327__pfranzen__male-grunts-and-groans.ogg" type="AudioStream" id=18] [ext_resource path="res://assets/audio/404327__pfranzen__male-grunts-and-groans.ogg" type="AudioStream" id=18]
[ext_resource path="res://effects/player/MovementSoundsAnimations.gd" type="Script" id=19] [ext_resource path="res://effects/player/MovementSoundsAnimations.gd" type="Script" id=19]
[ext_resource path="res://screens/PauseScreen.tscn" type="PackedScene" id=20] [ext_resource path="res://screens/PauseScreen.tscn" type="PackedScene" id=20]
[ext_resource path="res://player/ObjectiveTracker.gd" type="Script" id=21]
[ext_resource path="res://effects/sink_block_tiled_texture.png" type="Texture" id=22]
[sub_resource type="Animation" id=8] [sub_resource type="Animation" id=8]
length = 0.001 length = 0.001
@ -149,6 +151,22 @@ tracks/0/keys = {
"values": [ Color( 1, 1, 1, 0 ), Color( 1, 1, 1, 1 ), Color( 1, 1, 1, 1 ), Color( 1, 1, 1, 0 ) ] "values": [ Color( 1, 1, 1, 0 ), Color( 1, 1, 1, 1 ), Color( 1, 1, 1, 1 ), Color( 1, 1, 1, 0 ) ]
} }
[sub_resource type="Shader" id=12]
code = "shader_type canvas_item;
uniform sampler2D texture_albedo : hint_albedo;
void fragment() {
vec2 uv = SCREEN_UV;
uv.x += sin((TIME + SCREEN_UV.y) * 5.0)/5.0;
COLOR.rgb = texture(texture_albedo, uv).rgb;
}
"
[sub_resource type="ShaderMaterial" id=13]
shader = SubResource( 12 )
shader_param/texture_albedo = ExtResource( 22 )
[node name="Player" type="Spatial"] [node name="Player" type="Spatial"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.750395, 0 ) transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.750395, 0 )
script = ExtResource( 3 ) script = ExtResource( 3 )
@ -214,7 +232,7 @@ script = ExtResource( 19 )
[node name="Footsteps" type="AudioStreamPlayer" parent="MovementSoundsAnimations"] [node name="Footsteps" type="AudioStreamPlayer" parent="MovementSoundsAnimations"]
stream = ExtResource( 17 ) stream = ExtResource( 17 )
volume_db = -1.0 volume_db = -15.0
[node name="Timer" type="Timer" parent="MovementSoundsAnimations/Footsteps"] [node name="Timer" type="Timer" parent="MovementSoundsAnimations/Footsteps"]
one_shot = true one_shot = true
@ -254,6 +272,15 @@ anims/opacity = SubResource( 7 )
[node name="PauseScreen" parent="Overlay" instance=ExtResource( 20 )] [node name="PauseScreen" parent="Overlay" instance=ExtResource( 20 )]
[node name="WaterScreen" type="ColorRect" parent="Overlay"]
material = SubResource( 13 )
anchor_right = 1.0
anchor_bottom = 1.0
color = Color( 1, 1, 1, 0 )
[node name="ObjectiveTracker" type="Node" parent="."]
script = ExtResource( 21 )
[connection signal="area_entered" from="ElevatorPhysics/Area" to="ElevatorPhysics" method="_on_Area_area_entered"] [connection signal="area_entered" from="ElevatorPhysics/Area" to="ElevatorPhysics" method="_on_Area_area_entered"]
[connection signal="area_exited" from="ElevatorPhysics/Area" to="ElevatorPhysics" method="_on_Area_area_exited"] [connection signal="area_exited" from="ElevatorPhysics/Area" to="ElevatorPhysics" method="_on_Area_area_exited"]
[connection signal="timeout" from="MovementInput/VerticalTimer" to="MovementInput" method="_on_VerticalTimer_timeout"] [connection signal="timeout" from="MovementInput/VerticalTimer" to="MovementInput" method="_on_VerticalTimer_timeout"]

View File

@ -1,6 +1,7 @@
extends Node extends Node
onready var player = $"/root".find_node("Player", true, false) # Updated by player
onready var player = null
func vec3_componentwise_clamp(vec: Vector3, lower: float, upper: float) -> Vector3: func vec3_componentwise_clamp(vec: Vector3, lower: float, upper: float) -> Vector3:
return Vector3( return Vector3(