Skip to content

Commit

Permalink
Players will not send input updates when dead.
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexnortung committed Jul 13, 2021
1 parent 3184a6b commit 08e956c
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions client/game/ClientPlayer.gd
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
extends "res://common/game/Player.gd"

func _physics_process(delta):
if is_network_master():
var axis = get_input_axis()
if axis != Vector2.ZERO:
apply_movement(axis * acc * delta)
apply_friction(acc * delta, axis)
motion = move_and_slide(motion)
rpc_unreliable_id(1, "network_update", axis)
if !is_network_master() or dead:
return
var axis = get_input_axis()
if axis != Vector2.ZERO:
apply_movement(axis * acc * delta)
apply_friction(acc * delta, axis)
motion = move_and_slide(motion)
rpc_unreliable_id(1, "network_update", axis)

var normalizedDirection = get_normalized_direction()
set_look_direction(normalizedDirection)
rpc_unreliable_id(1, "on_player_change_direction", normalizedDirection)
var normalizedDirection = get_normalized_direction()
set_look_direction(normalizedDirection)
rpc_unreliable_id(1, "on_player_change_direction", normalizedDirection)

func update_health(newHealth: int):
health = newHealth
Expand Down

0 comments on commit 08e956c

Please sign in to comment.