PacmanEffect
Source:
PacmanEffect.h
PacmanEffect¶
src/light/effects/PacmanEffect.h:116Inherits:
EffectBase
Effect: Pacman and the ghosts cross the wall, chomping.

The characters move independently and do not yet notice each other. Inspired by Namco's Pac-Man, with the pixel art drawn fresh at a size of its own.
Public Attributes¶
uint8_t pacmen = 1
: How many Pacmen cross the wall.
uint8_t ghosts = 4
: How many ghosts cross it, the arcade cast being four.
uint8_t speed = 96
: How fast the cast travels, in body lengths a second.
uint8_t spriteSize = 0
: Pixels per art pixel, where 0 scales with the grid.
bool audioReactive = false
: Move to the music, each sprite on its own band, holding 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 wall needs a width and a height, so it is a 2D effect.
virtual inline void defineControls() override
: Publish both counts, the speed, the sprite scale and the audio switch.
virtual inline void prepare() override
: Size the pool's storage, wire the view over it, and put the cast on the wall.
inline uint8_t spriteScale() const
: The sprite magnification, grid-proportional when spriteSize is 0, as the other sprite effects do.
virtual inline void tick() override
: Step the cast, re-enter whoever walked off, and draw each through its own palette.
Public Static Attributes¶
constexpr uint8_t kPool = 12
: The pool size: both count controls at their maxima.
More info¶
The construction, and what comes next¶
Movement is a particles::Pool entry per character, and appearance is [draw::sprite]. The chomp and the ghosts' shuffle share one BeatPhase, offset so the cast never pulses together. The maze, the pellets and the chase are the next iteration, built on these shapes and lanes.