SpriteFountainEffect
Source:
SpriteFountainEffect.h
SpriteFountainEffect¶
src/light/effects/SpriteFountainEffect.h:28Inherits:
EffectBase
Effect: a fountain of sprites, thrown up from the floor and falling back under gravity.
![]()
A fountain is a particle system, and the sprite effects already own a cast. This effect draws that cast through [SpriteCast.h] rather than copying the pixel art. A fix to a fish fixes it here and in FishTankEffect alike.
Public Attributes¶
uint8_t lift = 45
: How hard the nozzle throws. Scales with the grid, so one setting suits a panel and a wall.
uint8_t pull = 3
: How hard gravity pulls back. Gentle enough that a 12x8 sprite stays legible for its whole arc.
uint8_t rate = 2
: Sprites launched per beat of the emit clock, so the frame rate leaves the rate alone.
uint8_t emitBpm = 120
: Launches per minute: the nozzle's own tempo, and the plume's density with it.
uint8_t size = 1
: Pixels per art pixel. 1 on a small panel, and a wall can afford 2.
bool audioReactive = false
: Let the music decide what comes out: a loud band launches a sprite, and picks which one.
Public Methods¶
virtual inline const char * tags() const override
: Catalog tags: the audio glyph applies when audioReactive is set.
virtual inline Dim dimensions() const override
: A fountain needs a floor and a height, so it is a 2D effect.
virtual inline void defineControls() override
: Publish the nozzle, the emit clock, the sprite scale and the audio switch.
virtual inline void prepare() override
: Size the pool's storage, wire the view over it, and reset both beat clocks.
virtual inline void tick() override
: The hot tick, which by default ticks every enabled child and times each.
More info¶
The hue byte carries the sprite kind¶
The pool holds one byte per particle, a palette index in every other particle effect. Here it picks the sprite, chosen once at launch so a particle keeps its species for its flight. A sprite id of its own would cost every particle system memory for a field only this effect reads. The color index comes from the particle's slot instead, stable and spread across the palette.