melonjs-plugins
O que ela faz
Explica como registrar e usar plugins e adaptadores do melonJS, e como eles diferem das configurações de física. É para desenvolvedores de jogos que estendem o próprio projeto melonJS.
Quando usar
- ✓Quando um desenvolvedor quer adicionar um painel de depuração a um jogo melonJS.
- ✓Quando um desenvolvedor quer animação esquelética Spine ou controles de toque em um jogo.
- ✓Quando um desenvolvedor recebe um erro dizendo que um plugin já está registrado.
Link da skill
https://github.com/melonjs/melonJS/blob/master/packages/melonjs/skills/melonjs-plugins/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 o plugin de painel de depuração ao meu jogo melonJS e garanta que ele funcione com o meu app.”
5 skills novas por semana. 1 minuto de leitura.
Como funciona
A skill orienta a IA a registrar cada plugin uma única vez, depois que o app é iniciado, e a passar explicitamente o app correto quando há mais de um app na página.
Conteúdo técnico (SKILL.md original)
Texto original do autor, em inglês, direto do GitHub.
Plugins and adapters
Two different mechanisms
This trips people up, so it is worth stating first:
| how it is installed | |
|---|---|
| Plugins | plugin.register(Class, name?, ...args) — after await app.init() |
| Physics adapters | an Application setting (physic:), before init() |
// the adapter is chosen at construction …
const app = new Application(800, 600, {
parent: "screen",
physic: new PlanckAdapter({ gravity, pixelsPerMeter }),
});
// … the plugin is registered once the renderer exists
await app.init();
plugin.register(DebugPanelPlugin, "debugPanel");
register in detail
plugin.register(PluginClass, "name", ...constructorArgs);
plugin.cache.name; // the instance
plugin.get(PluginClass); // by class — or by registered name string
- The name is optional — it falls back to the class name.
- The registry is global, not per-application. It is a module-level object,
so registering the same name twice throws
plugin <name> already registered. A plugin instance does hold anappreference, but it defaults togame— whichever Application most recently finishedinit(), since that is wheregameis assigned. On a multi-application page, pass the app explicitly through the constructor args:plugin.register(DebugPanelPlugin, "debugPanel", input.KEY.S, myApp). BasePlugin.versionis a floor, not an identity. It declares the minimum melonJS version the plugin needs, andregisterthrowsPlugin version mismatch, expected: <floor>, got: <engine>when the running engine is older. That gate is the real enforcement — a peer-dependency range only warns at install time, and not at all for CDN or pre-bundled use. If you see that error, upgrade the engine or pin an older plugin. The check runs after the instance is constructed, so a plugin whose constructor has side effects will already have run them when it throws.
Register after await app.init(): a plugin binds to an Application and reads
renderer and frame state that does not exist before init.
The official plugins
@melonjs/debug-plugin
An in-game panel — frame time, draw and object counts — plus toggles for hitbox/bounding-box overlays, velocity vectors and quadtree visualisation. The first thing to reach for when something is slow or a collision is not landing where you expect.
import { DebugPanelPlugin } from "@melonjs/debug-plugin";
plugin.register(DebugPanelPlugin, "debugPanel"); // default toggle key: S
@melonjs/tiled-inflate-plugin
Required, not optional, for Tiled maps using gzip, zlib or zstd layer
compression. It installs the inflate hook TMXUtils calls; without it a
compressed .tmx fails to parse — a map that opens fine in Tiled and refuses to
load in melonJS is nearly always this.
import { TiledInflatePlugin } from "@melonjs/tiled-inflate-plugin";
plugin.register(TiledInflatePlugin);
@melonjs/spine-plugin
Spine 4.x skeletal animation as a melonJS renderable, on all three backends. This is the answer for deforming animated characters — glTF import does not read vertex skinning. It also registers a Tiled object class, so Spine skeletons can be placed from a map.
@melonjs/gamepad-plugin
On-screen touch controls, reported as a gamepad: one or two sticks and any
number of buttons, drawn over the game and read by the engine as a pad in a
gamepad slot. The game's bindGamepad bindings drive it unchanged, so one set
of bindings covers a real pad and a touch screen.
import { GamepadPlugin } from "@melonjs/gamepad-plugin";
plugin.register(GamepadPlugin, "gamepad", {
buttons: [{ label: "A" }, { label: "B" }],
});
// plugin.cache.gamepad.visible — showing, to word prompts ("tap" or a key)
Shown on touch screens by default (enabled), hidden while a real pad is in
use. The left stick also presses the D-pad; a button can press a key instead
of a pad button. Since 1.1 a stick or button can be floating (shows up
under the finger anywhere in its area), hideAtRest (drawn only while
held), and a stick can take a tap (a quick touch that does not steer presses
a key or button) — so the mobile layouts, two thumbs or one thumb with
tap-to-act, need no code of their own. See melonjs-input for the bindings,
the layouts and the overlap rules.
@melonjs/capacitor-plugin
Bridges Capacitor's native lifecycle and hardware-back events into the eng
Perguntas frequentes
Por que registrar um plugin gera um erro?
A skill diz que o registro de plugins é global, então o mesmo nome não pode ser registrado duas vezes.
Adaptadores de física são plugins?
Não. A skill diz que adaptadores de física são definidos quando o app é criado, e não registrados como plugins.
Quais plugins ela menciona?
Ela menciona o painel de depuração, animação Spine, suporte a mapas compactados, controles de toque e empacotamento com Capacitor.
Detalhes
Descrição original do autor
Use this skill when adding a melonJS plugin or adapter — the debug panel, Spine skeletal animation, compressed Tiled map support, on-screen touch controls, Capacitor packaging — or when writing your own plugin. Covers plugin.register and its version gate, plugin.cache, plugin.patch, and why physics adapters are not plugins. Triggers on: plugin, plugin.register, plugin.cache, plugin.get, plugin.patch, BasePlugin, debug-plugin, DebugPanelPlugin, SpinePlugin, TiledInflatePlugin, GamepadPlugin, gamepad-plugin, touch controls, virtual joystick, floating joystick, floating button, CapacitorPlugin, a
repo: melonjs/melonJS
Popularidade
- Estrelas no GitHub
- 6,4 mil
- Posição no ranking
- #14211
- 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.