fx.module
This package holds more than this page lists. See all of its files in its world.
README.md
fx
Short-lived pixel-art effects for the twoDKit: jump dust, landing bursts, wall-kick dust, dash rings and sparkles from the kit's fx sheet; the bigger moments (death burst, gem pop, checkpoint star fountain, run-start dust, wall-slide specks, hard-landing cloud, dash speed lines) from the juice sheet; and flashing, tinted dash after-images ("ghost trail") of any sprite frame.
Each effect is a temporary entity this peer spawns and despawns itself, so effects cost no network traffic: twoDKit.juice plays them for the moments twoDKit.Sprite2D and twoDKit.Player2D see on every peer, and Level2D plays sparkles when a gem is taken or a checkpoint is reached. Effects only play in play mode, and at most 48 run at once.
API
Fx.puff(kind, x, y, facing?): play one row of thefxsheet (16 x 16) once at a world point, mirrored whenfacing < 0. Kinds (Fx.ROWS):dust,land,sparkle,ring,kick, and the looping-pickup rowsgem,goal,heart. An unknown kind does nothing.Fx.burst(kind, x, y, facing?): play one row of thejuicesheet (32 x 32) once. Kinds (Fx.BURSTS):burst(death),pop(gem),flag(checkpoint, goal),streak(dash) andslidecentred on the point;runPuffandhardLandwith their bottom at the point (feet).Fx.ghost(material, character, row, col, flipped, x, y, { r, g, b }): leave a copy of one sprite-sheet cell at (x, y), flashed and tinted toward the colour, then stepping out in four dither stages over 0.3 s, so a trail reads as distinct after-images.characteris atwoDKit.catalogcharacter entry (its frame size and grid).Fx.ROWS[kind],Fx.BURSTS[kind]={ row, frames, fps[, pivotY] }: the sheet layouts.Fx.enabled: set false to switch every effect off on this peer.
local Fx = require("twoDKit.fx")
Fx.puff("land", x, y, 1)
Fx.burst("pop", gemX, gemY + 0.5)
The sheets are twoDKit.art.fx.fx (painted by twoDKit.artgen.fx) and twoDKit.art.fx.juice (painted by twoDKit.artgen.juicefx), drawn with twoDKit.sprites.