PongEffect
Source:
PongEffect.h
PongEffect¶
src/light/effects/PongEffect.h:27Inherits:
EffectBase
Effect: two self-playing paddles rallying a ball across the grid.

The attract-mode reading of the 1972 original, so both paddles play themselves. A perfect tracker would rally forever and never look like a game. So each paddle waits out a reaction delay and aims slightly off center. That is what produces the near-misses, edge hits and occasional points.
Public Attributes¶
uint8_t rallyBpm = 40
: Rally speed in crossings per minute, so the court's width leaves it alone.
uint8_t paddle = 30
: Paddle length as a percentage of the court's height, since short paddles miss more.
uint8_t reflex = 150
: How sharply a paddle chases the ball, from sluggish to instant.
uint8_t size = 1
: Pixels per art pixel, when the ball is a sprite.
bool spriteBall = false
: Swap the square ball for a member of the shared sprite cast, re-picked on every hit.
bool audioReactive = false
: Advance the ball only on the beat, so it stands still in silence.
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 court needs a width and a height, so it is a 2D effect.
virtual inline void defineControls() override
: Publish the rally speed, the paddles, the ball's look and the audio switch.
virtual inline void setup() override
: Serve the opening ball once the module is built.
virtual inline void tick() override
: Advance the rally on its clock, step the game, then draw the court.
More info¶
The ball is the shared sprite cast¶
It is either the classic square or one member of the cast in [SpriteCast.h]. A Pacman crossing the court is the same code path as the fountain throwing one. That is why the cast lives in its own header rather than in either effect.