Jump to content

Scale tiled map


bdekk
 Share

Recommended Posts

Hello everyone. I am trying to load my map made in tiled into my game. However, the map does not scale properly and I cannot see all the objects. Could someone perhaps point me in the right direction? The map does load, it only scales wrong.


Shooter.game = new Phaser.Game(window.innerWidth * window.devicePixelRatio, window.innerHeight * window.devicePixelRatio, Phaser.AUTO, '');


 

 this.map = this.game.add.tilemap('level3');

    //the first parameter is the tileset name as specified in Tiled, the second is the key to the asset
    this.map.addTilesetImage('tiles_spritesheet', 'gameTiles');

    //create layers
    this.backgroundlayer = this.map.createLayer('background');
    this.blockedlayer = this.map.createLayer('blocked');

    //collision on blockedLayer
    this.map.setCollisionBetween(1, 5000, true, 'blocked');

    // this.backgroundlayer.scale.set(2);
    //resizes the game world to match the layer dimensions
    this.backgroundlayer.wrap = true;
    this.backgroundlayer.resizeWorld();

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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