AlysiumX Posted June 16, 2015 Share Posted June 16, 2015 Im having a problem here. I can't seem to get a tiled map to work with arcade collision detection. Any help on this matter would be great. Thanks. Code:function create() { game.physics.startSystem(Phaser.Physics.ARCADE); mymap = game.add.tilemap('devmap01'); mymap.addTilesetImage('MyTheme'); backgroundLayer = mymap.createLayer('Background'); blockedLayer = mymap.createLayer('Collision'); mymap.setCollisionBetween(1, 100000, true, 'Collision'); backgroundLayer.resizeWorld(); player = new Player(game); game.physics.enable(player.sprite, Phaser.Physics.ARCADE); game.world.setBounds(0, 0, mymap.widthInPixels, mymap.heightInPixels); cursors = game.input.keyboard.createCursorKeys(); game.camera.follow(player.sprite);}function update() { game.physics.arcade.collide(player, blockedLayer); player.update(cursors);} Link to comment Share on other sites More sharing options...
drhayes Posted June 16, 2015 Share Posted June 16, 2015 Collide the sprite, not your player object:game.physics.arcade.collide(player.sprite, blockedLayer); MishaShapo 1 Link to comment Share on other sites More sharing options...
AlysiumX Posted June 17, 2015 Author Share Posted June 17, 2015 game.physics.arcade.collide(player.sprite, blockedLayer);So I found this issue before my post was approved unfortunately. There were two problems, one the problem you specified drhayes(thanks btw) and the second was that my collision layer was not on the bottom in tiled. Link to comment Share on other sites More sharing options...
Recommended Posts