jopcode

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:

1472950008_Screenshotat2018-10-2609-05-50.thumb.png.7b995a8f1fb96c961ca83e1b75d0e08f.png

 

CODE

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');

 

Share this post


Link to post
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:

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.