delete this account! Posted October 14, 2017 Share Posted October 14, 2017 When the character runs into the wall it sticks between the tiles. Am I doing something wrong? Wouldn't this bug happen all the time for tile-based platformers? Why hasn't it been fixed? Link to comment Share on other sites More sharing options...
WiLD11 Posted October 14, 2017 Share Posted October 14, 2017 Your player's X velocity could be way higher than the gravity. Link to comment Share on other sites More sharing options...
samme Posted October 14, 2017 Share Posted October 14, 2017 Are you using a tilemap? Link to comment Share on other sites More sharing options...
delete this account! Posted October 14, 2017 Author Share Posted October 14, 2017 2 minutes ago, samme said: Are you using a tilemap? no, just an array and adding walks to a group. Link to comment Share on other sites More sharing options...
delete this account! Posted October 14, 2017 Author Share Posted October 14, 2017 26 minutes ago, WiLD11 said: Your player's X velocity could be way higher than the gravity. I just multiplied the gravity by 10 and it's still got the same behaviour. Link to comment Share on other sites More sharing options...
samme Posted October 14, 2017 Share Posted October 14, 2017 You need to set checkCollision.up and down to false on those blocks. WiLD11 and delete this account! 1 1 Link to comment Share on other sites More sharing options...
delete this account! Posted October 14, 2017 Author Share Posted October 14, 2017 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; } } } } WiLD11 and samme 2 Link to comment Share on other sites More sharing options...
Recommended Posts