godot-demo-projects/networking/simple_multiplayer/rock.gd

12 lines
290 B
GDScript

extends KinematicBody2D
# Sent to everyone else
slave func do_explosion():
get_node("anim").play("explode")
# Received by owner of the rock
master func exploded(by_who):
rpc("do_explosion") # Re-sent to slave rocks
get_node("../../score").rpc("increase_score", by_who)
do_explosion()