Jump to content

Scaling problem (layer)


Ytyse
 Share

Recommended Posts

Hi everyone,

I'm trying to make a platformer who can run on any smartphone.
I have a tilemap with theses features :
- 40 Tiles heights
-100 Tiles widths
- Each tiles is 64x64px.

To calculate my scale I simply use that as reference :

var SCALE = window.innerHeight/ 2560; 
//64*40 = 2560px, the height of my tilemap

I already made a platformer with 16x16px tiles and every scale worked very well, so i just copy paste that simple code :

map = that.game.add.tilemap('objects');
        map.addTilesetImage('items', 'tiles');
        map.setCollisionBetween(0, 16); 
        that.game.scale.scaleMode = Phaser.ScaleManager.RESIZE;

layer = map.createLayer('mario_niveau_1');
        layer.debug = true;
        layer.setScale(SCALE,SCALE);
        layer.resizeWorld();

That's work when my SCALE is better than 1 but not when it's less.
My collision are always good, but the map don't show up like you can see below
 

mario 64x64 bug.PNG

mario 64x64.PNG

Any ideas ?

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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