multiplayer: added basic server and client functionality
This commit is contained in:
parent
fced905bae
commit
cf5eb5ae6e
5 changed files with 133 additions and 4 deletions
|
|
@ -16,6 +16,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():
|
||||
|
|
@ -220,8 +225,14 @@ func _ready():
|
|||
get_viewport().size_changed.connect(resize_ui)
|
||||
resize_ui()
|
||||
respawn()
|
||||
|
||||
if is_multiplayer_authority():
|
||||
$CameraGimbal/InnerGimbal/Camera3D.current = true
|
||||
else:
|
||||
$CameraGimbal/InnerGimbal/Camera3D.current = false
|
||||
|
||||
func _physics_process(delta):
|
||||
if not is_multiplayer_authority(): return
|
||||
if health() < 1 or position.y <= -1000:
|
||||
die()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue