lego_brick Posted March 28, 2017 Report Share Posted March 28, 2017 Hi, I have tilest 16x16. It is exported to json format. I used Tiled app. It works fine until using scaling function. After that colission is not working. Here's my code: create: function() { this.map = this.game.add.tilemap('tiled'); this.map.addTilesetImage('tiled', 'tiles'); this.layer = this.map.createLayer('background'); this.layer.scale.setTo(3, 3); //It disables collissions this.layer.resizeWorld(); this.walls = this.map.createLayer('walls'); this.walls.scale.setTo(3, 3); //It disables collissions this.layer.resizeWorld(); .... this.map.setCollisionBetween(1, 2000, true, 'walls'); this.sprite = this.game.add.sprite(70, 70, 'soldier'); this.sprite.anchor.setTo(0.5, 0.5); this.game.physics.enable(this.sprite); this.sprite.body.setSize(8, 8, 4, 4); this.sprite.scale.setTo(3, 3); } update: function() { this.game.physics.arcade.collide(this.sprite, this.walls); ... } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.