rafaholiveira Posted February 6, 2014 Share Posted February 6, 2014 With Phaser 1.1.4, how I set up wich sides of a tile will collide in tilemaps? jpdev 1 Link to comment Share on other sites More sharing options...
jpdev Posted February 6, 2014 Share Posted February 6, 2014 Let me join you in asking this. Rich posted there will be n-way collision (in the 1.1.4 announcement thread) but the only thing I found in the examples so far was "One Way Collision", which does not help since it's only for sprites. Link to comment Share on other sites More sharing options...
jcs Posted February 7, 2014 Share Posted February 7, 2014 have you tried 'Tile.setCollision( left, right, up, down);' ? Link to comment Share on other sites More sharing options...
jpdev Posted February 7, 2014 Share Posted February 7, 2014 Hi jcs, Even if that works (couldn't get it to work right away, but i will try some more) it is not what rafaholiveira and I were expecting, since you were able to set these options on tile-indexes in phaser 1.1.3.(So for example every tile with index 6 in the map only collides from above, because it's a bridge tile you can walk upon, but jump on it from below) If now the function is only available on the tile-data we would have to run a x/y scan over the hole map to fix every tile with tile index 6. (SetCollisionRange had those up/down/left/right parameters) At least setting it for all tiles in my map: var x, y, tile; for (x = 0; x < this.map.width; x++) { for (y = 1; y < this.map.height; y++) { tile = this.map.getTile(x,y); if (tile !== null) { tile.setCollision(false, false, false, true); } } } Before or after calling SetCollisionBetween has no visible (noticeable) effect. Every tile still collides from all sides. Link to comment Share on other sites More sharing options...
rafaholiveira Posted February 7, 2014 Author Share Posted February 7, 2014 I confirm that Tile.setCollision( left, right, up, down) is not working. Link to comment Share on other sites More sharing options...
jcs Posted February 7, 2014 Share Posted February 7, 2014 too bad, it looked promising. it may be related to issue #371 (though a completely different scenario, it seems that updating collision info after it is created doesn't "take" properly...). or not. @jpdev - yes, I understand. the API for tiles, tilemaps and tilemaplayers changed significantly in 1.1.4 - sometimes good, sometimes less good Link to comment Share on other sites More sharing options...
jpdev Posted February 7, 2014 Share Posted February 7, 2014 jcs: most changes are great (multi layer support and stuff like that). I hope given a little time there will be n-way for tiles (be it for single tiles or a tile index). If not it will be complicated to continue with my mario inspired game. (As I said, beeing able to jump through platforms from below is kind of a standard thing to do in platformers). Link to comment Share on other sites More sharing options...
jcs Posted February 7, 2014 Share Posted February 7, 2014 indeed. it seems to me that Tile.setCollision() was intended to do just that, but it didn't get implemented (the flags that it sets don't seem to be used, that I can tell). I would enter a github issue on this. maybe Rich can get to it for 1.1.5 Link to comment Share on other sites More sharing options...
rafaholiveira Posted February 8, 2014 Author Share Posted February 8, 2014 I opened a issue.https://github.com/photonstorm/phaser/issues/388 jpdev 1 Link to comment Share on other sites More sharing options...
Recommended Posts