saumanahaii Posted August 28, 2016 Share Posted August 28, 2016 I'm having a bit of trouble with tilemap collisions. I'm using P2 and a json tiled tilemap. Strangely, it seems to work with small, simple tilemaps but as soon as I boost the complexity it seems to stop working. I've got a simple car being driven by physics that turns one way when you touch and the other when you don't. Help? Here's the create code: create: function(){ game.physics.startSystem(Phaser.Physics.P2JS); //!THIS STUFF WORKS WITH TEST MAP this.map = this.add.tilemap('city'); this.map.addTilesetImage('roguecity'); this.decorationLayer = this.map.createLayer('decoration'); this.collisionLayer = this.map.createLayer('collision'); this.collisionLayer.resizeWorld(); this.map.setCollisionBetween(0, 12); this.physics.p2.convertTilemap(this.map, this.collisionLayer); this.stage.backgroundColor = "#d3d3ff"; this.cursors = game.input.keyboard.createCursorKeys(); game.input.keyboard.addKeyCapture([ Phaser.Keyboard.SPACEBAR ]); //map stuff //create the layer //this.backgroundLayer = this.map.createLayer("background"); //car stuff this.car = game.add.sprite(60,35,"car"); game.physics.p2.enable(this.car); this.car.anchor.set(0.1,0.5); this.car.body.allowRotation = true; }, Thanks! Link to comment Share on other sites More sharing options...
Recommended Posts