multiplayer: added basic server and client functionality
This commit is contained in:
parent
54967e570b
commit
fa6a64fbaa
5 changed files with 138 additions and 6 deletions
|
|
@ -18,6 +18,11 @@ var target_velocity = Vector3.ZERO
|
|||
|
||||
var _health = 100
|
||||
|
||||
# Multiplayer
|
||||
|
||||
func _enter_tree():
|
||||
set_multiplayer_authority(str(name).to_int())
|
||||
|
||||
# Player UI
|
||||
|
||||
func resize_ui():
|
||||
|
|
@ -239,8 +244,18 @@ func _ready():
|
|||
resize_ui()
|
||||
respawn()
|
||||
|
||||
if is_multiplayer_authority():
|
||||
$CameraGimbal/InnerGimbal/Camera3D.current = true
|
||||
else:
|
||||
$CameraGimbal/InnerGimbal/Camera3D.current = false
|
||||
|
||||
func _physics_process(delta):
|
||||
if dead:
|
||||
if dead or not is_multiplayer_authority():
|
||||
return
|
||||
if health() < 1 or position.y <= -1000:
|
||||
die()
|
||||
|
||||
if suspended:
|
||||
return
|
||||
|
||||
if health() < 1 or position.y <= -1000:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue