Aego Русский

Respawn

Brings the node back to its respawn point after death or Trigger. The first point is where the node starts.

component gameplay.Respawn
On this page

Try it

Change the respawn delay

The target requests a respawn to the blue marker. At Delay 60 it waits at its starting position for 60 game seconds.

Set Delay to 0. The scene restarts and the real Respawn immediately teleports the target to the marker. Reset restores the 60-second wait.

Starts the scene; open the example parameters to experiment.
Open in AegoDownload example project
Scene3 nodes
Target
Transform
position[-2, 0]rotation0scale[1, 1]
Sprite Renderer
spriteTextureasset("ae900000000000000000000000000d00")tintColor#f59e0bffsizeVec2[1.5, 1.5]orderint1
Spawn marker
Transform
position[2, 0]rotation0scale[1, 1]
Sprite Renderer
spriteTextureasset("ae900000000000000000000000000010")tintColor#38bdf8ffsizeVec2[0.5, 3]
Camera
Transform
position[0, 0]rotation0scale[1, 1]
Camera 2D
zoomfloat40clearColorColor#111827ffscaleenumfitVirtualvirtualVec2[960, 540]activebooltrue
Scriptmain.aes
package demo

// Set the destination and request one real respawn; the component controls
// the countdown and the eventual teleport.
script TriggerRespawn {
    func Ready() {
        r := node.Get<Respawn>()
        r.SetPoint(Vec2{2, 0})
        r.Trigger()
    }
}

Fields

NameTypeDefaultDescription
Delayfloat0.5

Seconds of game time before the node comes back.

≥ 0
Restore Healthbooltrue

Revives Health with full hit points.

Reset Velocitybooltrue

Stops a Motion 2D on respawn.

Persistboolfalse

Saves the respawn point with the game.

Methods

SetPoint method

func (Respawn) SetPoint(position Vec2)

Sets the respawn point.

Trigger method

func (Respawn) Trigger()

Respawns the node after Delay.

Signals

Respawned signal

signal Respawned()

Fires when the node is back at its point.