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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

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