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

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

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