I am attempting to use setMapCollisions to make the entire area under an object impassable when it ‘spawns’ in. I had been using setImpassable to some success, but it failed when the number of tiles I was modifying went above the call rate limit, as it should.
Here is my problem:
When I use setMapCollisions, and spawn the object, I can see the impassable tiles in MapMaker, but my avatar is able to walk around as if they are not there.
The inverse is also true when I remove impassable tiles using setMapCollisions. Mapmaker shows no tiles, and yet my avatar bounces off the area like there is a wall.
Only by reposting the entire room’s JSON was I able to get the tiles to act properly. However, that is not a solution for my application.
A snippet of my code:
var wall = 0x00; //Or 0x01 for making a wall
var impass = new Array((obj.width*obj.height)).fill(wall)
var impassEncode = Buffer.from(impass).toString(“base64”);
game.setMapCollisions(MAP_ID, obj.x, obj.y, obj.width, obj.height, impassEncode);
Any help would be useful. Thanks!