Jump to content

[Fixed] Sticking to tiles with arcade physics. What am I doing wrong?


delete this account!
 Share

Recommended Posts

35 minutes ago, samme said:

You need to set checkCollision.up and down to false on those blocks. 

Bingo! Cheers for that. This was the fix:

for (var i = 0; i < map.length; i++) {
    for (var j = 0; j < map[i].length; j++) {

        if (map[i][j] == 1) {

            var wall = walls.create(j * 32, i * 32, 'wall');
            wall.body.immovable = true;

            if (i > 0 && map[i - 1][j] == 1) {
                wall.body.checkCollision.up = false;
            }

            if (i < map.length - 1 && map[i + 1][j] == 1) {
                wall.body.checkCollision.down = false;
            }
        }

    }
}

 

Link to comment
Share on other sites

  • delete this account! changed the title to [Fixed] Sticking to tiles with arcade physics. What am I doing wrong?
 Share

  • Recently Browsing   0 members

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