Dear Olivier (or whoever can help),
I have 4 questions:
-
How do I scale a tilemap with SVG tiles i.e. the nominal tile width is 64x32 but e.g. I want to display it (or actually everything) at double the size e.g. 128x64?
-
I’m displaying an animated sprite from an SVG spritesheet. It displays fine in Chrome. However, in Firefox, it displays as a black square. Any idea how to fix this?
-
I’m loading a tsx tileset. I can’t use tsx extension due to the conflict with Typescript tsx files so I’m using XML extension. However, it cannot load despite me setting the type to tsx in the loader. I have to manually call TMXUtils.parse instead. Is there any way to force it to detect the file type as TMX based on the type of the resource as initially passed to the loader, rather than based on the file extension?
-
I’d like to edit my tileset in tiled. However, to do so the image name has to be the filename with “.SVG” at the end. But I have to remove the extension because images loaded from the loader don’t work with file extensions in the name. Is there any way I can refer to an image specifically with the name “bla.svg” instead of “bla” when loaded with the loader (it seems to discard the file extension)?
Merry Christmas and thanks for replying! Do enjoy your holiday, I’m going to ask more questions first but please don’t feel obliged to reply until you have the spare time.
- I decided to give up on the SVG and to scale the tileset because it just doesn’t work. So now I’m going to have fixed zoom levels of 1, 2, 4 and 8 and to agglomerate multiple tiles in the tilemap as 1 actual tile (so like if the zoom level is 2 then 1 game tile is 2x2 tiles in the tilemap). But now I am having a problem removing the tilemap when I want to change the zoom. When I call tilemap.destroy it does nothing and when I call melonjs.game.world.removeChild(tilemap) it gives the error “Child is not mine”. How do I remove the whole tilemap and add a new one?
- The problem was oversized texture. This has been solved by using Free Texture Packer in optimised mode instead of packing in a grid as I did previously. I also gave up on SVG for this as the SVG rendering was very blur in WebGL mode and there’s no apparent fix (the SVGs do work nicely with the Canvas renderer but I think that’ll make things slower).
- I’ll just continue using (melonjs.TMXUtils.parse(melonjs.loader.getTMX(‘tiles.xml’) as Document) as any).tilesets[0] for now.
- If I create the tileset in Tiled it refers to the source image with the filename e.g. with PNG or SVG extension, and the tileset then doesn’t work in melonjs unless I open the tileset in a text editor and delete the PNG or SVG extension. This is the case even if I try to call preload({name:‘bla.png’,type:‘image’,…}) because even if I specify the name as bla.png melonjs will only allow me to refer to the image as “bla”.