melonjs-particles-and-trails
O que ela faz
Explica como configurar emissores de partículas e rastros no melonJS, incluindo efeitos de rajada e contínuos. É para desenvolvedores de jogos que adicionam efeitos visuais como explosões ou escapamentos.
Quando usar
- ✓Quando um desenvolvedor quer um efeito de faíscas ou de explosão em um jogo melonJS.
- ✓Quando um desenvolvedor adiciona um emissor de partículas, mas nada aparece na tela.
- ✓Quando um desenvolvedor quer um rastro de movimento atrás de um objeto em movimento.
Link da skill
https://github.com/melonjs/melonJS/blob/master/packages/melonjs/skills/melonjs-particles-and-trails/SKILL.mdCopie e cole na sua IA (Claude, ChatGPT ou Cursor) pedindo para seguir as instruções.
Como usar
O jeito mais fácil: copie a mensagem e cole na sua IA. Ela lê a skill e segue as instruções.
Mensagem pronta para colar
Para Claude Code, Codex ou Cursor: rode na pasta do projeto e a skill fica instalada.
Baixe o SKILL.md e coloque na pasta de skills do seu agente.
Exemplo do que pedir para a IA
“Adicione uma rajada de faíscas ao meu jogo quando o jogador bater em uma parede e garanta que ela realmente apareça.”
5 skills novas por semana. 1 minuto de leitura.
Como funciona
A skill explica que um emissor precisa receber a ordem de começar a emitir, usando uma rajada ou um fluxo contínuo. Também cobre as configurações de velocidade, vida e quantidade.
Conteúdo técnico (SKILL.md original)
Texto original do autor, em inglês, direto do GitHub.
Particles and trails
An emitter does nothing until you tell it to emit
Adding a ParticleEmitter to the world is not enough. Nothing appears, and
nothing warns you.
const emitter = new ParticleEmitter(x, y, {
image: loader.getImage("spark"),
totalParticles: 60,
speed: 4,
minLife: 200, maxLife: 800,
});
world.addChild(emitter);
emitter.streamParticles(); // continuous — or:
emitter.burstParticles(); // one shot
streamParticles(ms) takes an optional run time; without one it uses the
duration setting, which defaults to Infinity — a stream runs until
stopStream(). burstParticles(n) launches n, or totalParticles.
Without an image, particles are white squares of textureSize pixels (8 by
default), coloured by tint. Every such emitter draws the renderer's one
shared white pixel, stretched, so an emitter per explosion or a reset() on
every tweak costs no texture.
Tuning an effect: the Particle Editor
Settings are easier to find by eye than by reasoning. The
Particle Editor
runs one emitter live, with every setting on a slider, from a preset (fire,
smoke, rain, explosions, 3D bursts and rings…), a built-in texture or a sprite
(sheet) of your own, under a 2D camera or an orbiting 3D one. It writes out the
matching new ParticleEmitter(...) call, listing only what differs from the
defaults, and the same settings as JSON, in the emitter's own units, to load at
run time:
// preloaded with { name: "smoke-fx", type: "json", src: "data/fx/smoke.json" }
const effect = loader.getJSON("smoke-fx");
const emitter = new ParticleEmitter(x, y, {
...effect.settings,
// no `image` for the plain square: `getImage` would give null
...(effect.image ? { image: loader.getImage(effect.image) } : {}),
});
Point a user there when they are tuning numbers by trial and error.
It covers every setting that changes how one emitter looks, but not:
- Layered effects. It shows one emitter at a time. A campfire (flames,
sparks, smoke) or an explosion (flash, debris, smoke) is several emitters
at the same spot: tune each in the editor, then add them side by side,
the one drawn on top last (or with a higher
z). - Trails.
TrailandTrail3dare separate renderables; see below. - Code-only settings.
onComplete,autoDestroyOnComplete,accurateBounds, and aContainerasreferenceSpace(it offers"local"and"world").textureAdditiveis left out:blendModereplaces it. - Changes at run time. Calling
burstParticles()when something happens, or assigningemitter.blendModewhile particles are alive, is game code. Its "moving emitter" option previews the common case: an emitter attached to something that moves.
Sprite-sheet particles
Use framewidth and frameheight (the same names as on Sprite) to divide
image into a regular grid. Each omitted dimension defaults to that of the
image. Frames are numbered from zero left-to-right, then top-to-bottom; only
whole cells count, so partial cells along the right/bottom edges are ignored.
Margins and spacing are not supported.
const explosion = new ParticleEmitter(x, y, {
image: loader.getImage("explosion-sheet"),
framewidth: 32, frameheight: 32,
frames: [0, 1, 2, 3],
minLife: 400, maxLife: 800,
});
world.addChild(explosion);
explosion.burstParticles();
Omit frames to use every cell. Each particle traverses the sequence once
over its own lifetime, with equal time for each entry; repeated indices hold
a frame longer. Existing scale, opacity and rotation still apply. Bounds and
the rotation pivot use one frame's dimensions, rather than the whole sheet.
Set randomFrame: true for debris: a particle chooses one entry at birth and
keeps it until it dies. Different frames share the same image and GPU batch.
Without sheet settings, particles still draw the whole image as before, and
that includes randomFrame on its own: it needs a grid to choose from, so
pair it with framewidth/frameheight or it does nothing.
Note the variety is in SHAPE, not colour. tint belongs to the emitter, so
every particle from one emitter is tinted alike however many frames it picks
between. For a colour that changes over each particle's life, use
tintOverLife (below) rather than drawing one frame per colour.
Frame dimensions must be positive integers that fit inside the image, and an ex
Perguntas frequentes
Por que meu emissor não mostra nada?
A skill diz que adicionar um emissor não basta; é preciso chamar um método de rajada ou de fluxo.
Posso usar minha própria imagem?
Sim. Sem uma imagem, as partículas são pequenos quadrados coloridos.
Há uma ferramenta visual para ajustar?
Sim. A skill menciona um Particle Editor que gera o código de configuração correspondente.
Detalhes
Descrição original do autor
Use this skill for particle effects and motion trails in melonJS — ParticleEmitter configuration, burst versus stream emission, the referenceSpace frame of reference introduced in 20.2, 3D particle motion through elevation and minSpread/maxSpread in 20.8, and the Trail renderable. Covers the emitter that silently does nothing until you call an emit method. Triggers on: Trail3d, ribbon, exhaust trail, speed streak, ski track, tyre mark, ribbonNormal, ParticleEmitter, particles, particle editor, tune particles, spawn depth, volume, burstParticles, streamParticles, referenceSpace, ParticleEmitter
repo: melonjs/melonJS
Popularidade
- Estrelas no GitHub
- 6,4 mil
- Posição no ranking
- #14208
- Licença
- MIT
- Atualizada em
- 02/11/2026
Comentários
- …
Mais skills deste repositório
melonjs-20-migration
6,4 milAjuda seu agente a escrever código de jogo em melonJS para a versão 20 e a evitar métodos desatualizados de versões antigas, como a inicialização assíncrona obrigatória.
melonjs-3d-assets
6,4 milAjuda seu agente a carregar modelos 3D, como arquivos glTF, GLB e OBJ, em um jogo melonJS para navegador, com opções de escala e iluminação.
melonjs-3d
6,4 milAjuda seu agente a criar cenas 3D ou 2,5D em um jogo melonJS para navegador, cobrindo câmeras, malhas, luzes e profundidade, usando as regras de eixos do próprio motor.
melonjs-audio
6,4 milAjuda seu agente a adicionar efeitos sonoros e músicas a um jogo melonJS, incluindo a configuração de áudio, faixas de fundo, controle de volume e som espacial.
Skills parecidas
diffs
394 milPermite que seu agente gere um diff real e compartilhável das edições, como link de visualização ou arquivo de imagem, em vez de um resumo escrito à mão.
coding-agent
394 milAjuda seu agente a passar um trabalho grande de programação para o Codex, Claude Code ou OpenCode em segundo plano e acompanhar o andamento.
gh-issues
394 milAjuda seu agente a encontrar issues do GitHub, escolher quais resolver e abrir pull requests com correções, acompanhando os comentários de revisão.