Verse Library verse

03 Fragment

Uses an overlap event to detect players stepping on a zone and automatically respawns them.

verse-library/explore-the-devices/03-fragment.verse

# This is a simple Verse script that connects a trigger to a spawner.
# Think of this as the wiring diagram between your devices.

# 1. Define the devices we are using.
# We reference them by the names we gave them in the editor.
respawn_trigger := <RespawnTrigger>
player_spawner := <MyRespawnPoint>

# 2. Listen for the event: "Did someone step in the trigger?"
# OnBeginOverlap is an Event that fires when a player enters the volume.
respawn_trigger.OnBeginOverlap = func(overlap_player: Player) -> void:
    # 3. If a player stepped in, tell the spawner to spawn them!
    # SpawnPlayer is a Function that takes the player as input.
    player_spawner.SpawnPlayer(overlap_player)

Comments

    Sign in to vote, comment, or suggest an edit. Sign in