BenClarkson Posted July 9, 2014 Share Posted July 9, 2014 Hey, I am hard at work on my game "Space Cat" and I have some questions about one way collision on tilemaps. Like, is there a way to do this without making the one way colliding tiles into immovable objects (which I assume isn't TERRIBLE, it still uses the quadtree but it has to update more variables).I have a collision tilemap in two layers, one with "ground" and "walls" and one for one way platforms. The problem is how the tilemap body is handled isn't super clear.I was thinking of writing an extension of the collide function to specifically deal with this. Any help would be groovy. Link to comment Share on other sites More sharing options...
lewster32 Posted July 9, 2014 Share Posted July 9, 2014 Not sure on this one but this seems to suggest you can set collisions per-face: http://docs.phaser.io/Phaser.Tile.html#setCollision Link to comment Share on other sites More sharing options...
wayfinder Posted July 9, 2014 Share Posted July 9, 2014 yup! tile.collideLeft = false;tile.collideRight = false;tile.collideUp = true;tile.collideDown = false;tile.faceUp = true;tile.faceDown = false;tile.faceLeft = false;tile.faceRight = false; lewster32 1 Link to comment Share on other sites More sharing options...
owen Posted August 7, 2014 Share Posted August 7, 2014 yup!tile.collideLeft = false;tile.collideRight = false;tile.collideUp = true;tile.collideDown = false;tile.faceUp = true;tile.faceDown = false;tile.faceLeft = false;tile.faceRight = false; I am curious to know if there is any difference/preference between this and setCollision? http://docs.phaser.io/Phaser.Tile.html#setCollisionCurrently I'm having problems getting collideDown to work at all. Link to comment Share on other sites More sharing options...
lewster32 Posted August 7, 2014 Share Posted August 7, 2014 No, setCollision is just a convenience method: setCollision: function (left, right, up, down) { this.collideLeft = left; this.collideRight = right; this.collideUp = up; this.collideDown = down; }, Link to comment Share on other sites More sharing options...
Recommended Posts