Jump to content

Setting a collision group to a tilemap tile layer


DazZ
 Share

Recommended Posts

Is there any way to give this...

map = this.add.tilemap('map');map.addTilesetImage('map_tilesheet', 'maptiles');map.setCollisionByExclusion([6, 9, 18], 'platforms');    layer = map.createLayer('platforms');layer.resizeWorld();

a collision group? Or do I have to have an object layer and draw out each part by hand if I'm going to use collision groups?

 

As this does work fine

collisionLayer = game.physics.p2.convertCollisionObjects(map,'collision');for(var tile in collisionLayer){		collisionLayer[tile].setCollisionGroup(platformCG);		collisionLayer[tile].collides([playerCG, crateCG]);	}

but I'd like to not have to draw out each map by hand as I have some boxes that fit exactly into one tile and if I slip up they don't go into the gap perfectly like I want them to. That and it's just time consuming but I can't figure out a way of making the tiles collide like they did before I set collision groups.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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