tweaked and maybe broke ledge grab

This commit is contained in:
derek
2025-06-17 14:09:44 -05:00
parent a33f493a04
commit 227fcd7b2a
4 changed files with 14 additions and 30 deletions

View File

@@ -34,6 +34,8 @@ func standard_jump():
if character.jumps_remaining > 0:
character.jumps_remaining -= 1
jump_with_weight_mod()
elif is_grabbing_ledge():
jump_with_weight_mod()
func apply_gravity(delta):
character.velocity.y -= 9.8 * 1.25 * delta

View File

@@ -3,39 +3,16 @@ class_name PlayerClamber
var clamber_point
const CLAMBER_Y_OFFSET = .4
func Enter():
clamber_point = character.get_clamber_point()
character.velocity = Vector3.ZERO
func Physics_Update(delta):
character.global_position.y = lerp(character.global_position.y,clamber_point.y - CLAMBER_Y_OFFSET,delta * 2)
if !is_still_on_ledge():
Transitioned.emit(self,"in air")
apply_gravity(delta)
if Input.is_action_just_pressed("jump"):
jump_with_weight_mod()
Transitioned.emit(self,"in air")
if Input.is_action_just_pressed("crouch"):
Transitioned.emit(self,"in air")
ledge_movement(delta)
func is_still_on_ledge():
if character.clamber_point_ray.is_colliding():
return true
else:
return false
func ledge_movement(delta):
var direction = character.movement_input()
character.velocity.x = lerp(character.velocity.x,direction.x * move_speed,delta * move_transition_speed)
#if direction.x < 0:
#if character.ledge_l_ray.is_colliding():
#character.velocity.x += direction.x * delta * move_speed
#if direction.x > 0:
#if character.ledge_r_ray.is_colliding():
#character.velocity.x += direction.x * delta * move_speed
func Exit():
character.ledge_collision.disabled = true

View File

@@ -13,7 +13,7 @@ func Physics_Update(delta):
standard_movement(delta)
apply_gravity(delta)
if character.is_on_floor() and !is_grabbing_ledge():
if character.is_on_floor():
Transitioned.emit(self,"on foot")
if Input.is_action_just_pressed("sprint") and air_dash_left > 0:
@@ -23,13 +23,18 @@ func Physics_Update(delta):
if Input.is_action_just_pressed("crouch"):
Transitioned.emit(self,"ground pound")
if Input.is_action_just_pressed("interact"):
character.ledge_collision.disabled = false
Transitioned.emit(self,"ledge grab")
enable_wall_rays()
if can_wall_run():
start_wall_running()
standard_jump()
ledge_grab()
func Exit():
character.ledge_collision.disabled = true