Skip to content

Trail

namespace Griff.Scenes;
public sealed class Trail : Component, IDrawable

Leaves fading copies of its entity’s Sprite behind as it moves: dashes, speed, ghosts, bullets with streaks. Copies are left every Interval seconds while it moves at least MinSpeed.

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

public Color Color { get; set; }

A color painted over the copies, e.g. a cyan dash. Transparent keeps the sprite’s own look.

public IReadOnlyList<TrailCopy> Copies { get; }

The copies on screen, oldest first.

public bool Emitting { get; set; }

Untick it (from a script, say at the end of a dash) to stop leaving copies; those already left still fade.

public float Fade { get; set; }

Seconds each copy takes to fade away.

public float Interval { get; set; }

Seconds between copies.

public float MinSpeed { get; set; }

Only leave copies while moving at least this fast, in world units per second: just the dash, not the walk.

public float Opacity { get; set; }

How see-through a fresh copy is, from 0 (invisible) to 1 (as solid as the sprite).

public float OpacityOf(TrailCopy copy)

How solid a copy is now: Opacity fading to nothing over Fade.