added wall running

This commit is contained in:
derek
2025-06-16 14:46:03 -05:00
parent 50d8935b4b
commit d1bc5d28d5
7 changed files with 67 additions and 16 deletions

View File

@@ -0,0 +1,21 @@
extends PlayerState
class_name PlayerWallRunning
func Physics_Update(delta):
if character.is_on_floor():
Transitioned.emit(self,"on foot")
else:
wall_run_movement(delta)
apply_gravity(delta)
if !can_wall_run():
Transitioned.emit(self,"in air")
func wall_jump():
character.velocity += (Vector3(0,1,0) + character.wall_run_surface_normal).normalized() * 10
func wall_run_movement(delta):
if Input.is_action_pressed("move_up"):
character.velocity.x = lerp(character.velocity.x,character.wall_run_direction.x * move_speed,delta * 7)
character.velocity.z = lerp(character.velocity.z,character.wall_run_direction.z * move_speed,delta * 7)