Jump to content

Phaser arcade collision detection with tiled.


AlysiumX
 Share

Recommended Posts

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

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

 Share

  • Recently Browsing   0 members

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