update swim animation

This commit is contained in:
AleaJactaEst 2022-02-06 01:55:11 +01:00
parent 68b701bb83
commit 058b965329

View file

@ -63,14 +63,14 @@ var anim_fly_strafe_right_walk:String = "CHAR_sitting_ground_idle"
var anim_fly_walk:String = "CHAR_sitting_ground_idle" var anim_fly_walk:String = "CHAR_sitting_ground_idle"
var anim_fly_walk_backward:String = "CHAR_sitting_ground_idle" var anim_fly_walk_backward:String = "CHAR_sitting_ground_idle"
var anim_swim_idle:String = "CHAR_walk" var anim_swim_idle:String = "CHAR_swim_idle"
var anim_swim_run:String = "CHAR_run" var anim_swim_run:String = "CHAR_swim_slow"
var anim_swim_run_backward:String = "CHAR_run backward" var anim_swim_run_backward:String = "CHAR_swim_idle"
var anim_swim_sitting_ground_idle:String = "CHAR_walk" var anim_swim_sitting_ground_idle:String = "CHAR_swim_idle"
var anim_swim_strafe_left_walk:String = "CHAR_walk" var anim_swim_strafe_left_walk:String = "CHAR_swim_idle"
var anim_swim_strafe_right_walk:String = "CHAR_walk" var anim_swim_strafe_right_walk:String = "CHAR_swim_idle"
var anim_swim_walk:String = "CHAR_walk" var anim_swim_walk:String = "CHAR_swim_slow"
var anim_swim_walk_backward:String = "CHAR_walk_backward" var anim_swim_walk_backward:String = "CHAR_swim_idle"
var current_anim:String = anim_idle var current_anim:String = anim_idle
var player_sit:bool = false var player_sit:bool = false
@ -570,53 +570,53 @@ func _physics_process_swim(delta):
if move_strafe: if move_strafe:
if move_up: if move_up:
speed = SPEED_RUN_UP_STRAFE speed = SPEED_RUN_UP_STRAFE
switch_animation(anim_fly_run) switch_animation(anim_swim_run)
elif move_down: elif move_down:
speed = SPEED_RUN_DOWN_STRAFE speed = SPEED_RUN_DOWN_STRAFE
switch_animation(anim_fly_run_backward) switch_animation(anim_swim_run_backward)
else: else:
speed = SPEED_RUN_STRAFE speed = SPEED_RUN_STRAFE
if input_x > 0.0: if input_x > 0.0:
switch_animation(anim_fly_strafe_left_walk) switch_animation(anim_swim_strafe_left_walk)
else: else:
switch_animation(anim_fly_strafe_right_walk) switch_animation(anim_swim_strafe_right_walk)
elif move_up: elif move_up:
speed = SPEED_RUN_UP speed = SPEED_RUN_UP
switch_animation(anim_fly_run) switch_animation(anim_swim_run)
else: else:
speed = SPEED_RUN_DOWN speed = SPEED_RUN_DOWN
if move_down: if move_down:
switch_animation(anim_fly_run_backward) switch_animation(anim_swim_run_backward)
else: else:
switch_animation(anim_fly_idle) switch_animation(anim_swim_idle)
else: else:
if move_strafe: if move_strafe:
if move_up: if move_up:
speed = SPEED_WALK_UP_STRAFE speed = SPEED_WALK_UP_STRAFE
switch_animation(anim_fly_walk) switch_animation(anim_swim_walk)
elif move_down: elif move_down:
speed = SPEED_WALK_DOWN_STRAFE speed = SPEED_WALK_DOWN_STRAFE
switch_animation(anim_fly_walk_backward) switch_animation(anim_swim_walk_backward)
else: else:
speed = SPEED_WALK_STRAFE speed = SPEED_WALK_STRAFE
if input_x > 0.0: if input_x > 0.0:
switch_animation(anim_fly_strafe_left_walk) switch_animation(anim_swim_strafe_left_walk)
else: else:
switch_animation(anim_fly_strafe_right_walk) switch_animation(anim_swim_strafe_right_walk)
elif move_up: elif move_up:
speed = SPEED_WALK_UP speed = SPEED_WALK_UP
switch_animation(anim_fly_walk) switch_animation(anim_swim_walk)
else: else:
speed = SPEED_WALK_DOWN speed = SPEED_WALK_DOWN
if move_down: if move_down:
switch_animation(anim_fly_walk_backward) switch_animation(anim_swim_walk_backward)
else: else:
switch_animation(anim_fly_idle) switch_animation(anim_swim_idle)
if input_x == 0.0 and input_y == 0.0: if input_x == 0.0 and input_y == 0.0:
if player_sit: if player_sit:
switch_animation(anim_fly_sitting_ground_idle) switch_animation(anim_swim_sitting_ground_idle)
else: else:
switch_animation(anim_fly_idle) switch_animation(anim_swim_idle)
var direction = (transform.basis * Vector3(input_x, input_z, input_y)).normalized() var direction = (transform.basis * Vector3(input_x, input_z, input_y)).normalized()
if direction: if direction: