rybaqs Posted July 20, 2018 Share Posted July 20, 2018 So, i've got topdown game i'm working on, and I use tiled to make JSON tilemap which then I load in phaser 3. Everything works great, I've got collision (which I set between range of tiles), but here's the problem: some of tiles have round edges or are should be only partially blocking player from moving, yet in phaser I set collision on whole tile (which has one number). Is there a way (and as I recall from past there should be, couse I already toyed with phaser 2 some years ago) to set collision per tile? Here's what I would love to fix (character standing on water, couse tile he's on has no collsion, couse it's partially a DIRT, and partially a WATER): And maybe I could somehow use this information (that as I presume is already in JSON file, made by TILED): Link to comment Share on other sites More sharing options...
rich Posted July 20, 2018 Share Posted July 20, 2018 There is no way to make a tile partially blocking in v3 (or in v2 actually) Link to comment Share on other sites More sharing options...
rybaqs Posted July 20, 2018 Author Share Posted July 20, 2018 Thx for reply, I will make such tiles collide with player then... Link to comment Share on other sites More sharing options...
nkholski Posted July 20, 2018 Share Posted July 20, 2018 You could set a callback for the tiles, make a collision test of your own in the callback function. If all sides of the tile should be collidable, return true immediately, otherwise check where the tile is overlapped and return true only if it's where it's solid (maybe just check for collisions, and if it reach the end of the function return false). I never used Tiled in that way but you should be able to navigate through the tilemap object (or cache) to find the information you refer to and implement that in your callback. Link to comment Share on other sites More sharing options...
Recommended Posts