clamber still a bit weird but getting better

This commit is contained in:
derek
2025-06-17 11:09:20 -05:00
parent daf0cf9c80
commit 8af4bdd6f6
6 changed files with 22 additions and 15 deletions

View File

@@ -14,13 +14,18 @@ func standard_movement(delta):
character.velocity.x = lerp(character.velocity.x, character.movement_input().x * move_speed * character.speed_modifiers(),delta * move_transition_speed)
character.velocity.z = lerp(character.velocity.z, character.movement_input().z * move_speed * character.speed_modifiers(),delta * move_transition_speed)
func jump_with_weight_mod():
character.velocity.y += character.JUMP_VELOCITY * character.speed_modifiers()
func standard_jump():
#first check for clamber, otherwise jump
print("CAN CLAMBER? - ",character.can_clamber())
if character.can_clamber():
Transitioned.emit(self,"clamber")
else:
character.velocity.y += character.JUMP_VELOCITY * character.speed_modifiers()
if Input.is_action_just_pressed("jump"):
#first check for clamber, otherwise jump
if character.can_clamber():
Transitioned.emit(self,"clamber")
else:
if character.jumps_remaining > 0:
character.jumps_remaining -= 1
jump_with_weight_mod()
func apply_gravity(delta):
character.velocity.y -= 9.8 * 1.25 * delta

View File

@@ -393,11 +393,15 @@ func speed_modifiers():
func can_clamber():
var clamber_ray_collided = false
const CHECK_RESOLUTION = .1
const CHECK_RESOLUTION = .01
const MAX_RAY_POSITION = .607
const MIN_RAY_POSITION = -.9
clamber_check_ray.position.y = MAX_RAY_POSITION
while clamber_check_ray.position.y > MIN_RAY_POSITION:
print("CLAMBER RAY POS : ", clamber_check_ray.position.y)
print("COLLISION : ",clamber_check_ray.is_colliding())
if clamber_check_ray.is_colliding():
clamber_ray_collided = true
break

View File

@@ -32,7 +32,7 @@ func Physics_Update(delta):
if Input.is_action_just_pressed("jump"):
if !character.crouch_check.is_colliding():
character.recoil.add_recoil(Vector3(-.2,.03,.03),5,10)
standard_jump()
jump_with_weight_mod()
transition_out_of_crouch()

View File

@@ -13,14 +13,13 @@ func Physics_Update(delta):
standard_movement(delta)
apply_gravity(delta)
standard_jump()
if character.is_on_floor():
Transitioned.emit(self,"on foot")
enable_wall_rays()
if Input.is_action_just_pressed("jump") and (character.jumps_remaining > 0 or character.can_clamber()):
character.jumps_remaining -= 1
standard_jump()
if Input.is_action_just_pressed("sprint") and air_dash_left > 0:
air_dash_left -= 1

View File

@@ -14,6 +14,4 @@ func Physics_Update(delta):
if Input.is_action_just_pressed("crouch"):
Transitioned.emit(self,"crouched")
if Input.is_action_just_pressed("jump"):
character.jumps_remaining -= 1
standard_jump()
standard_jump()