Repository navigation
picogame: Sprite.add (light) and Particles fade_to / stretch - #11964
Merged
dhalbert merged 2 commits intoNov 25, 2026
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two small additions to the picogame effects, both measured on a PicoPad (RP2040):
Sprite.add = coloradds 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, throughaddandscale. It is the fifth exclusive blit effect next to shadow/flash/tint/dither. +72BParticles(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=Truekeeps 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