Bouncer
namespace Griff.Scenes;
public sealed class Bouncer : ComponentA spring, jump pad or bumper, with no code: bodies touching it from the Direction side are sent flying that way at Strength. Works on solid colliders (land on it) and triggers (pass through it). A PlatformerMovement launched by it gets its air jumps and dash back.
This is a component: its saved properties are on its component page.
Properties
Section titled “Properties”Direction
Section titled “Direction”public Vector2 Direction { get; set; }Which way it sends them: (0, 1) is up, (1, 0) right, (1, 1) up and to the right.
Layers
Section titled “Layers”public string? Layers { get; set; }The collision layers it launches, e.g. “Player”. Empty launches any body.
public string? Sound { get; set; }A sound played on each bounce, e.g. “Sounds/boing.wav”.
Squash
Section titled “Squash”public bool Squash { get; set; }Squash and stretch its entity with each bounce.
Strength
Section titled “Strength”public float Strength { get; set; }How fast it sends things off, in units per second.
public Vector2 Way { get; }The Direction as a unit vector (up if it’s zero).
Methods
Section titled “Methods”AcceptsLayer
Section titled “AcceptsLayer”public bool AcceptsLayer(string? layer)True if it launches things on collision layer layer.
Events
Section titled “Events”Bounced
Section titled “Bounced”public event Action<Entity>? BouncedRaised with whatever it launched.