Jump to content

Scaling tilemap disables collision


Pupolajshu
 Share

Recommended Posts

Hello, it is me again.
I have a tileset(16x16 each square)
I made a tiled map with it and exported as .json
After importing it into Phaser game it works fine, collision works... But when I scale the layer by two, the collision is not working(Debugging the layer shows tile body)

Please help me!
Also, I am not sure how the values should be in - map.setCollisionBetween(n,m);

The code for that:

//This goes into create function
map = this.game.add.tilemap('map');
map.addTilesetImage('tiles');
map.setCollisionBetween(1, 400);

layer = map.createLayer('normal');
layer.scale.set(2);
layer.resizeWorld();


this.sprite = myGame.game.add.sprite(200,400,"player");
this.sprite.smoothed=false;
this.sprite.scale.setTo(2);
this.game.physics.enable(this.sprite);

this.game.physics.arcade.gravity.y = 200;


//This goes into update function
this.game.physics.arcade.collide(this.sprite, layer);

 

Link to comment
Share on other sites

  • 3 months later...
 Share

  • Recently Browsing   0 members

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