Compare commits

...

4 Commits

Author SHA1 Message Date
Spencer Killen f240651ef2
meat painting 2023-01-03 17:01:52 -07:00
Spencer Killen 9d9c7cd868
Guy float 2023-01-03 16:40:35 -07:00
Spencer Killen b33b754954
Merge remote-tracking branch 'origin/master' into spencer 2023-01-03 16:34:47 -07:00
Spencer Killen ff268061d9
floating 2023-01-03 16:32:59 -07:00
9 changed files with 41 additions and 16 deletions

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="0fd4b06bb4f9ac715836d05cb4e85e7b"
source_md5="36158356a783eb08fdc11e6407f104eb"
dest_md5="0dddb11d864bd4c870b083fc31fbd6d8"

Binary file not shown.

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

Binary file not shown.

View File

@ -5,7 +5,6 @@ onready var util = get_node("/root/Util")
export var gravity: float = 6.0
# When falling, gravity is artificially increased
export var gravity_downwards_factor: float = 3
export var float_factor = 0.5
export var ground_gravity: float = 3.1
# Rate of gaining speed
export var velocity_acceleration_xz: float = 3
@ -21,6 +20,8 @@ export var walk_factor: float = 2.0
export var can_glide: bool = false
export var can_float: bool = false
export var float_factor = 0.5
"public" var velocity: Vector3 = Vector3.ZERO
# Value changed by code only to add slow down or speed up effects
@ -45,11 +46,10 @@ func process_velocity(delta: float):
# Uses the input from MovementInput to compute and update this node's velocity
# velocity_acceleration controls gradual speedup whereas velocity_friction
# controls gradual slowdown
if Dialogic.get_variable("enable_glide") == "true":
can_glide = true
# Gravity
# You can buffer jumps by pressing releaseing the space bar and then pressing it again
if not is_on_floor():
$FloatFactorAnimation.advance(delta)
var grav = -gravity
if can_glide and Input.is_action_pressed("player_jump"):
grav /= 4
@ -60,6 +60,8 @@ func process_velocity(delta: float):
gdf = float_factor
target_velocity.y *= util.clamped_lerp(gdf, 1.0, velocity.y/2, 0.0)
else:
$FloatFactorAnimation.stop()
$FloatFactorAnimation.play("float_anim")
velocity.y = max(0.0, velocity.y)
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:

View File

@ -4,7 +4,6 @@ onready var active_physics_node: Spatial = $OnFootPhysics
export var can_glide: bool = false
export var can_float: bool = false
export var float_factor = 0.5
func _ready():
Util.player = self
@ -36,8 +35,10 @@ func objective_distance() -> float:
return $ObjectiveTracker.objective_distance
func _process(_delta):
if Dialogic.get_variable("enable_glide") == "true":
can_float = true
$OnFootPhysics.can_glide = can_glide
$OnFootPhysics.can_float = can_float
$OnFootPhysics.float_factor = float_factor

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=33 format=2]
[gd_scene load_steps=34 format=2]
[ext_resource path="res://player/CameraController.gd" type="Script" id=1]
[ext_resource path="res://player/OnFootPhysics.gd" type="Script" id=2]
@ -57,6 +57,22 @@ tracks/0/keys = {
[sub_resource type="CylinderShape" id=4]
[sub_resource type="Animation" id=14]
resource_name = "float_anim"
length = 5.0
tracks/0/type = "value"
tracks/0/path = NodePath(".:float_factor")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 3 ),
"transitions": PoolRealArray( 1, 1 ),
"update": 0,
"values": [ 0.5, 3.0 ]
}
[sub_resource type="SphereShape" id=5]
[sub_resource type="Animation" id=10]
@ -204,6 +220,7 @@ anims/fov = SubResource( 9 )
[node name="OnFootPhysics" type="KinematicBody" parent="."]
script = ExtResource( 2 )
float_factor = 3.0
[node name="CollisionShape" type="CollisionShape" parent="OnFootPhysics"]
transform = Transform( 0.4, 0, 0, 0, 0.440932, 0, 0, 0, 0.4, 0, 0, 0 )
@ -212,6 +229,11 @@ shape = SubResource( 4 )
[node name="Floor" type="RayCast" parent="OnFootPhysics"]
script = ExtResource( 10 )
[node name="FloatFactorAnimation" type="AnimationPlayer" parent="OnFootPhysics"]
autoplay = "float_anim"
playback_process_mode = 2
anims/float_anim = SubResource( 14 )
[node name="ElevatorPhysics" type="Spatial" parent="."]
script = ExtResource( 7 )

View File

@ -47,4 +47,4 @@ shape = SubResource( 2 )
[node name="Player" parent="." instance=ExtResource( 1 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.566872, 2.73697 )
can_glide = true
can_float = true