Closed 5alidshammout closed 2 years ago
here is my code:
(async () => {
const x = await k.loadTiledMap(map);
console.log(x);
})();
note that map
is a parsed tiled json file
I think I would need to see your actual code/map to help. I don't think that error comes directly from my lib (like I don't see it here: https://notnullgames.github.io/tiled-kaboom/) Can you point me to a github project, or zip the map and attach here? I'd be happy to take a look. My guess, without looking at code/map, is there is a format issue, or maybe it has too many tiles defined (a uncommon problem caused by a deficiency of the kaboom map system, which uses single characters to represent tiles, and you can "run out" of characters to use.) I could probaby still help work around it, if I know what we're dealing with.
I actually found addLevel
method by kaboom, I think it would be easier to have the map in the code, but I may try tiled later, thanks!
Definitely. I like the addLevel
and this uses that to make maps. tiled-kaboom is basically for the situation where you already have a map made in Tiled, and want to load it, or want a more advanced editor, but for most things, I think addLevel
is pretty great, and easier to read, in code.
If you want to use both, you can do soemthing liek in the README:
const { sprites, levels, key } = await k.loadTiledMap(YOUR_MAP_OBJECT, ASSET_LOCATION)
console.log('sprites: ' + JSON.stringify(sprites, null, 2))
for (let level of levels) {
// k.addLevel(level, { width: 32, height: 32, ...key })
console.log(level)
}
This will log the maps out.
ok, thanks
I was trying to import a json but this error was always happening: can't access property 0, r3[a6] is undefined how can I solve it?