melonjs-tilemaps
O que ela faz
Explica como carregar níveis feitos no editor de mapas Tiled e conectar os objetos do mapa ao código do jogo. É para desenvolvedores de jogos que constroem níveis com o Tiled.
Quando usar
- ✓Quando um desenvolvedor quer carregar um nível construído no editor de mapas Tiled.
- ✓Quando um desenvolvedor quer que inimigos ou itens apareçam onde foram colocados no Tiled.
- ✓Quando o mapa de um desenvolvedor não carrega porque um tileset ou uma imagem não foi pré-carregado.
Link da skill
https://github.com/melonjs/melonJS/blob/master/packages/melonjs/skills/melonjs-tilemaps/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
“Carregue meu nível do Tiled no jogo e crie as moedas que coloquei no mapa.”
5 skills novas por semana. 1 minuto de leitura.
Como funciona
A skill orienta a IA a pré-carregar o mapa, seus tilesets externos e as imagens, depois carregar o nível e registrar as classes de objetos do jogo para que apareçam a partir dos objetos do Tiled.
Conteúdo técnico (SKILL.md original)
Texto original do autor, em inglês, direto do GitHub.
Tiled maps
melonJS's flagship content pipeline. Maps are authored in Tiled and loaded through the
leveldirector — you rarely touch theTMX*classes directly.
Loading a level
Preload the map and everything it references — the .tmx, any external
.tsx tilesets, and the tileset images:
await loader.preload([
{ name: "map1", type: "tmx", src: "data/map/map1.tmx" },
{ name: "tileset", type: "tsx", src: "data/map/tileset.tsx" },
{ name: "tiles", type: "image", src: "data/img/tiles.png" },
]);
level.load("map1"); // inside Stage.onResetEvent
Asset type is "tmx" for maps and "tsx" for external tilesets — those are
the only two type strings the loader knows. The file can be .tmx / .tsx
(XML), or .json / .tmj / .tsj; the parser branches on the extension, not
on the type. type: "tmj" throws unknown or invalid resource type. You can
also skip src and pass the map inline via data (with format: "json" or
"xml").
level.load(levelId, options) accepts container (default game.world),
onLoaded (default game.onLevelLoaded), flatten (default game.mergeGroup),
setViewportBounds (default true) and async (default false). It throws
level <id> not found for an unknown id — synchronously, in both forms, because
that is a typo rather than a load failure.
Those game. defaults are the engine's own, and game is whichever
Application finished init() last. Pass container explicitly from a
Stage, which has the right one: level.load("map", { container: this.app.world }).
level.load is deferred while the game loop is running. It calls
state.stop() and finishes the load on a timer, after the current frame, so by
default it returns true before anything is in the world. Two ways to sequence
work after it:
// await it
await level.load("map1", { async: true });
// the world is populated here
// ...or use the callback / event, which fire in both forms
level.load("map1", { onLoaded: () => this.spawnPlayer() });
async: true is the only thing that changes the return value — everything else
behaves identically, onLoaded included. Without it the call returns a boolean,
so await level.load("map1") is not an error and does not await the load:
await true resolves immediately, while the load is still sitting on a timer.
Pass the flag when you mean to await.
level.reload(), level.next() and level.previous() take the same async
option and resolve the same value they return — so if (level.next()) becomes
if (await level.next({ async: true })). Running out of levels reports false
either way rather than throwing. level.getCurrentLevelId() and
level.levelCount() round out the namespace. flatten: false wraps each Tiled
object group in its own Container named after the group.
Spawning entities from Tiled objects
Objects are matched against a factory registry, in this order: the object's
Tiled class, then its name, then, for a tile object with no class of
its own, its tile's class, then the structural fallbacks "text",
"tile" and "shape".
import { registerTiledObjectClass, registerTiledObjectFactory } from "melonjs";
registerTiledObjectClass("Enemy", Enemy); // ← matches Tiled class OR name
registerTiledObjectFactory("Spine", (settings, map) => { /* → Renderable */ });
level.load("map1");
These are the entry points to use. The registry is Tiled's own, held by the object factory, and has nothing to do with object pooling.
pool.register(className, classObj) also works and registers a Tiled
factory as a side effect, under the name and again under an me.-prefixed
alias, unless you set pool.autoRegisterTiled = false. That is the older
spelling, kept working for maps and games written against it, and it now
prints a one-off deprecation notice: me.pool is deprecated since 18.0.0.
Its third argument no longer buys anything here. It used to make Tiled
objects recyclable; they are constructed directly now, and the container
returns children to typed pools rather than to the name-keyed one. To pool a
class you spawn constantly, give it a createPool and register it for Tiled
separately:
registerTiledObjectClass("mainPlayer", PlayerEntity);
Register before loading. With no match the object falls through to the
structural factory and becomes a plain Renderable with a static body — it does
not e
Perguntas frequentes
Por que meu nível não carrega?
A skill diz que o mapa e todos os tilesets e imagens que ele usa precisam ser pré-carregados antes.
Quais tipos de arquivo de mapa funcionam?
A skill diz que o mapa pode estar na forma XML ou JSON do Tiled.
Ela lida com mapas compactados?
A skill diz que mapas compactados precisam de um plugin extra de descompressão.
Detalhes
Descrição original do autor
Use this skill for Tiled maps in melonJS — loading TMX/TSX levels, spawning entities from Tiled objects, collision shapes authored in Tiled, isometric and hexagonal maps, and image layers, and reading or changing tiles while the game runs. Covers registerTiledObjectClass and the pool.register name contract, camera bounds, compressed maps needing the inflate plugin, and the level director API. Triggers on: Tiled, TMX, TSX, tilemap, setTile, clearTile, cellAt, getTile, getTileById, change a tile, tile at run time, game board, grid, tile properties at run time, getTileProperties, map properties,
repo: melonjs/melonJS
Popularidade
- Estrelas no GitHub
- 6,4 mil
- Posição no ranking
- #14216
- 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.