project_teddy/scripts/death_collider.gd

23 lines
558 B
GDScript3
Raw Normal View History

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"):
2023-05-25 21:26:16 -06:00
var player = body.get_multiplayer_authority()
2023-05-29 15:46:12 -06:00
if Global.teddyAuthorityID == 1:
kill()
else:
rpc_id(player, "kill")
print("Player collided with a death zone!")
2023-05-25 21:26:16 -06:00
@rpc("any_peer", "call_remote")
func kill():
Global.player_dead()