Aego Русский

Checkpoint 2D

Sets the respawn point of a node with Respawn that enters the area.

component gameplay.Checkpoint2D
On this page

Try it

Choose a checkpoint by priority

The target starts inside two checkpoint areas and immediately requests a respawn. The gray checkpoint's priority 5 beats the blue checkpoint's priority 0.

Set the blue checkpoint's Priority to 10. The scene restarts and the real Respawn moves the target to the higher-priority blue checkpoint. Reset chooses gray again.

Starts the scene; open the example parameters to experiment.
Open in AegoDownload example project
Scene4 nodes
Editable checkpoint
Transform
position[2, 0]rotation0scale[1, 1]
Sprite Renderer
spriteTextureasset("ae900000000000000000000000000010")tintColor#38bdf8ffsizeVec2[0.5, 3]
Checkpoint 2D
areaRect[-2.1, -1, 2.1, 2]priorityint0onceboolfalse
Other checkpoint
Transform
position[-2, 0]rotation0scale[1, 1]
Sprite Renderer
spriteTextureasset("ae900000000000000000000000000010")tintColor#9ca3afffsizeVec2[0.5, 3]
Checkpoint 2D
areaRect[0, -1, 2.1, 2]priorityint5onceboolfalse
Target
Transform
position[0, 0]rotation0scale[1, 1]
Sprite Renderer
spriteTextureasset("ae900000000000000000000000000d00")tintColor#f59e0bffsizeVec2[1.5, 1.5]orderint1
Camera
Transform
position[0, 0]rotation0scale[1, 1]
Camera 2D
zoomfloat40clearColorColor#111827ffscaleenumfitVirtualvirtualVec2[960, 540]activebooltrue
Scriptmain.aes
package demo

// Both checkpoints inspect the target in their actual areas. The script only
// requests a respawn; the component priorities select its destination.
script TriggerRespawn {
    func Ready() {
        node.Get<Respawn>().Trigger()
    }
}

Fields

NameTypeDefaultDescription
AreaRect(-1, -2, 2, 4)

Rectangle in this node's space.

Priorityint0

A checkpoint does not replace one with a higher priority.

Onceboolfalse

Works for the first node only.

Spawn PointNodeRefnone

Node whose position becomes the respawn point. Empty uses this checkpoint's position.

Signals

Reached signal

signal Reached(by NodeRef)

Fires when a node takes this checkpoint.