Jump to content

Collision faces in tiles with 1.1.4


rafaholiveira
 Share

Recommended Posts

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

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

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

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

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

 Share

  • Recently Browsing   0 members

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