X-Git-Url: http://git.purplebirdman.com/frog-ninja.git/blobdiff_plain/8225ba902c437bcadc8735df85a340e8bd10ed3d..refs/heads/state-machine:/player/moves/walk.gd diff --git a/player/moves/walk.gd b/player/moves/walk.gd index 75d4403..dd707bb 100644 --- a/player/moves/walk.gd +++ b/player/moves/walk.gd @@ -4,17 +4,15 @@ class_name Walk const skin_lean_limit := PI/8 +@export var movement_speed := 10.0 + func update(input: InputPacket, delta: float): - player.velocity = get_new_velocity_from_input(input, delta, player.walk_speed) + player.velocity = get_new_velocity_from_input(input, delta, movement_speed) player.move_and_slide() update_skin(delta) -func on_enter_state(): - player.skin.transition_move() - - func update_skin(delta: float): # update skin rotation var skin_target_angle := Vector3.BACK.signed_angle_to( @@ -38,18 +36,14 @@ func update_skin(delta: float): ), player.rotation_speed * delta * 0.25 ) - - player.skin.set_walking_speed(player.velocity.length()) func get_new_velocity_from_input(input: InputPacket, delta: float, speed: float) -> Vector3: - # Get the XZ input direction based on player's input relative to the camera - var forward := camera.global_basis.z - var right := camera.global_basis.x - var movement_direction := ( - forward * input.movement_direction.y + right * input.movement_direction.x - ).normalized() - movement_direction.y = 0 + var movement_direction := Vector3( + input.player_movement_direction.x, + 0, + input.player_movement_direction.y + ) # save off last movement direction if movement_direction.length() > 0.2: