crouch fixed
This commit is contained in:
parent
7bbeebdd2e
commit
276ff0252b
11 changed files with 167 additions and 115 deletions
|
|
@ -8,10 +8,10 @@ extends State
|
|||
@export var crouch_time: float = 0.1
|
||||
|
||||
func enter() -> void:
|
||||
animation_player.play("Crouch",-1,1/crouch_time)
|
||||
animation_player.play("crouch",-1,1/crouch_time)
|
||||
|
||||
func exit() -> void:
|
||||
animation_player.play("Crouch",-1,-1/crouch_time,true)
|
||||
animation_player.play("crouch",-1,-1/crouch_time,true)
|
||||
|
||||
func physics_update(_delta: float) -> void:
|
||||
if not is_multiplayer_authority():
|
||||
|
|
@ -33,9 +33,7 @@ func physics_update(_delta: float) -> void:
|
|||
player.velocity.x = move_toward(player.velocity.x, 0, SPEED)
|
||||
player.velocity.z = move_toward(player.velocity.z, 0, SPEED)
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if not is_multiplayer_authority():
|
||||
return
|
||||
func state_input(event: InputEvent) -> void:
|
||||
if (toggle == true and event.is_action_pressed("plr_crouch")) or (toggle == false and event.is_action_released("plr_crouch")):
|
||||
if stand_up_area.has_overlapping_bodies() == false:
|
||||
transition.emit("Stand")
|
||||
|
|
|
|||
|
|
@ -31,10 +31,7 @@ func physics_update(_delta: float) -> void:
|
|||
player.velocity.x = move_toward(player.velocity.x, 0, SPEED)
|
||||
player.velocity.z = move_toward(player.velocity.z, 0, SPEED)
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if not is_multiplayer_authority():
|
||||
return
|
||||
|
||||
func state_input(event: InputEvent) -> void:
|
||||
if event.is_action_pressed("plr_crouch"):
|
||||
transition.emit("Crouch")
|
||||
|
||||
|
|
|
|||
|
|
@ -31,9 +31,7 @@ func physics_update(_delta: float) -> void:
|
|||
player.velocity.x = move_toward(player.velocity.x, 0, SPEED)
|
||||
player.velocity.z = move_toward(player.velocity.z, 0, SPEED)
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if not is_multiplayer_authority():
|
||||
return
|
||||
func state_input(event: InputEvent) -> void:
|
||||
if event.is_action_released("plr_walk"):
|
||||
transition.emit("Stand")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue