Skip to content

Checkpoint

namespace Griff.Scenes;
public sealed class Checkpoint : Component

A place to come back to: when something it accepts (see Layers) touches it, it becomes the active checkpoint, and a Health with Respawn comes back here after dying. Needs a collider, usually a trigger.

This is a component: its saved properties are on its component page.

public bool Active { get; set; }

True for the checkpoint reached last; only one is active at a time. Tick it in the Scene to start playtesting from there.

public Color ActiveTint { get; set; }

The color its sprite turns once reached, so players can see it’s been reached. Transparent leaves it alone.

public string? Layers { get; set; }

The collision layers that reach it, e.g. “Player”. Empty lets anything with a Body reach it.

public string? Message { get; set; }

A message sent with Game.Send when it’s reached, with this entity as its data.

public string? Sound { get; set; }

A sound played when it’s reached, e.g. “Sounds/checkpoint.wav”.

public bool AcceptsLayer(string? layer)

True if something on collision layer layer can reach it.

public event Action<Entity>? Reached

Raised when it’s reached (not again while it’s still the active one), with whatever reached it.