Jump to content

Problem with collision Tilemap


thiagoboeker
 Share

Recommended Posts

Hi, i'm having such a hard time on set collision between player and tilemap

I set the setCollisionBetween with the .createLayer but i cant make the player.body.touching.down works, and the body.blocked.down, the player falls and stop at the layer as should be, but these two bool were never set to true, its like the player was laying on nothing, here is some code as i'm trying to figure it out. I tryed everything i saw at the internet but nothing worked.

at create()

     map = game.add.tilemap('mapa');
     map.addTilesetImage('tilefinal', 'tilefinal');
    layer = map.createLayer('cenario');
    layer.resizeWorld();
    map.setCollisionBetween(0,2);
    layer.debug = true;

at update()

    game.physics.arcade.collide(player,layer);

    if(player.body.touching.down){
     game.add.text(32, 300, 'Ground OK',{fill:'white'});
    }

print.png

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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