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.
Scene3 nodes
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
| Name | Type | Default | Description |
|---|---|---|---|
| Delay | float | 0.5 | Seconds of game time before the node comes back. ≥ 0 |
| Restore Health | bool | true | Revives Health with full hit points. |
| Reset Velocity | bool | true | Stops a Motion 2D on respawn. |
| Persist | bool | false | 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.
Related guides
- Health and damage Health holds hit points.
- Respawn Respawn brings its node back after death, after a kill zone, or when a script calls
Trigger(). - Gameplay kit The gameplay module adds the parts most 2D games rebuild by hand: a character controller, hit points, hitboxes and hurtboxes, kill zones, checkpoints with respawn, pickups and timed removal.