project_teddy/scripts/death_collider.gd
2023-05-29 15:46:12 -06:00

22 lines
558 B
GDScript

extends Area3D
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
for body in get_overlapping_bodies():
if body.is_in_group("human"):
var player = body.get_multiplayer_authority()
if Global.teddyAuthorityID == 1:
kill()
else:
rpc_id(player, "kill")
print("Player collided with a death zone!")
@rpc("any_peer", "call_remote")
func kill():
Global.player_dead()