Jump to content

problem with setScale on layers


Recommended Posts

Hello, I'm trying to scale the layers of my map, but when I try it shows part of the following tiles, some idea of how to solve this ?, the map is created in tiled, the spritesheet is 16 x 16:




create function: 

map = this.make.tilemap({'key':'01'});
    const TilesPacked = map.addTilesetImage('tiles_packed', 'tiles_packed');
    const SnowExpansion = map.addTilesetImage('snow-expansion', 'snow-expansion');

    groundLayer = map.createDynamicLayer('Wall', [TilesPacked,SnowExpansion], 0, 0).setScale(2);

    const Ground = map.createStaticLayer('Ground', [TilesPacked,SnowExpansion], 0, 0).setScale(2);
    const OverGround = map.createDynamicLayer('OverGround', [TilesPacked,SnowExpansion], 0, 0).setScale(2);
    const Npc = map.createDynamicLayer('NPC', [TilesPacked,SnowExpansion], 0, 0).setScale(2);

    player = this.physics.add.sprite(16*3, 16*3, 'characters', 1).setBounce(0.2).setScale(2);

preload function:

this.load.image('tiles_packed', 'sprites/tiles_packed.png');
    this.load.spritesheet('characters', 'sprites/characters.png', {frameWidth:16, framaeHeight:16});
    this.load.image('snow-expansion', 'sprites/snow-expansion.png');
    this.load.tilemapTiledJSON('01', 'sprites/Maps/02.json');


Link to comment
Share on other sites

Hey, You mean the gaps between those tiles?
If you don't have a moving camera, it can be that the graphics aren't 100%.

note: If you later on plan to at a moving camera, I suggest, you create a margin around every tile in your graphics file. and add a bit more of the colors on the edges, because there will be small gaps on those graphics if the camera moves fast. Also tile culling doesn't fix this as of this threat:


Link to comment
Share on other sites


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...