ebraheeemz Posted June 25, 2014 Share Posted June 25, 2014 hi guystoday i made simple tile map with tow layer, first layer is background, second layer is the road, i want my sprite can walk on the road and collide with backgroundwhen i make my sprite collide with the road layer my code is work, but when i make sprite collide with background it doesn't collidethis i smy codecreate: function () { game.physics.startSystem(Phaser.Physics.ARCADE);map = game.add.tilemap('tilemap_lev1'); map.addTilesetImage('Shaw-Floors-Piazza-13-x-13-Mosaic-Tile-Accent-in-Multi-color'); layer1 = map.createLayer('bg_layer'); // i want it to collide layer1.resizeWorld();layer2 = map.createLayer('road_layer');layer2.resizeWorld(); map.setCollisionByExclusion([], true, 'bg_layer');and in update functin i use thisgame.physics.arcade.collide(greens, layer1);thanks in advance Link to comment Share on other sites More sharing options...
ebraheeemz Posted June 25, 2014 Author Share Posted June 25, 2014 ok no answers, so i answer my self, i found where is my proplem nowthe code is correct 100% but when create tile map by (tile) softwarei filled all the map by first tile set then i added new layer, then i put the road overwrite the background, this is the problemwhen create the road layer you should to erase the background tiles where you want to put your road, and dont put one tile over onei hope i explain well my english so badhere is the steps againin tile softwarenew mapadd your tile setok now we want to create the background layer, and fill all the map with background tilesnow we want to make small road on the map soerase any background tile you want to put the road on,click add new layerok now put your road, but remember dont put any road tile on any background tile, you should to erase background then put the roadnow every thing work Link to comment Share on other sites More sharing options...
Recommended Posts