Skip to content

picogame: Sprite.add (light) and Particles fade_to / stretch - #11964

Merged
dhalbert merged 2 commits into
adafruit:mainfrom
MakerClassCZ:picogame-sprite-add-particles
Nov 25, 2026
Merged

dhalbert merged 2 commits into
adafruit:mainfrom
MakerClassCZ:picogame-sprite-add-particles

Conversation

@lynt-smitka

Copy link
Copy Markdown

Two small additions to the picogame effects, both measured on a PicoPad (RP2040):

  • Sprite.add = color adds the sprite's opaque pixels, times the color, to what is under them with per-channel saturation, so a sprite becomes light. One white soft-disc bitmap is then a torch glow, a muzzle flash or a pool of light on the floor, in any color, through add and scale. It is the fifth exclusive blit effect next to shadow/flash/tint/dither. +72B
  • Particles(fade_to=color) ends the fade in a color instead of black (white sparks cool through red into embers, smoke dissolves into the background); fade=True keeps its exact result. Particles(stretch=N) draws each particle N more times back along its velocity, a streak one tick long that shortens as the particle slows. +312B
additive_demo

sprite.add = color adds the sprite's opaque pixels, multiplied by the
color, to what is under them with per-channel saturation. One white soft
disc bitmap is then every light in a scene: a torch glow, a muzzle
flash, a pool of light on the floor, in any color, through scale and the
color alone. It is the fifth exclusive blit effect; the flag word grows
to 16 bits for it. A PAL8 sprite gets the color baked into a stack
palette like tint, so the per-pixel work is one saturating add in one
non-inlined function. ADD is tested before the effect switch: as a sixth
case it turned every inlined copy of the switch into a jump table.
PicoPad text grows by 72 B.
fade_to=color ends the fade at that color instead of black, so white
sparks cool through red into embers and smoke dissolves into the
background; fade=True keeps its exact result as fade_to=0. stretch=N
draws each particle N more times spread back along its velocity, a
streak one tick long that shortens as the particle slows; the dirty
rect includes the tail. Both fields fit the struct's padding. PicoPad
text grows by 312 B.

@dhalbert dhalbert left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure!

@dhalbert
dhalbert merged commit 008bc69 into adafruit:main Nov 25, 2026
29 of 30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants