Vertical lines appearing in tilemap (SOLVED: tilemap.smooth = false)



  • Hello!

    I'm returning to haxepunk from a bit of an absence (wow, this place has really cleaned up since I last visited!)

    I'm having an issue with the tilemap...I'm seeing vertical lines between my tiles.

    Screenshot:

    0_1523214749919_fedbcf27-49a0-4dea-896a-1f8cfbc1c50f-image.png

    I'm not sure why exactly this is happening. I've made sure that my tileset image is the correct size, and that the proper values for grid size are being supplied.

    Any help on this would be greatly appreciated!

    (I'm on HTML5 btw)


  • administrators

    Welcome back!

    This can happen for a couple reasons, and there are two main varieties, either gaps between tiles (we've mostly eliminated these when tilemap.pixelSnapping = true which is true by default for Tilemap) or antialiasing artifacts caused by sampling pixels from bordering tiles. This looks like the latter.

    The main thing that helps is adding 1-2 pixels of padding between your tiles in the tileset (just extend the border pixels out by 2 more pixels or so like this and pass in the margin and offset width/height when you create the TIlemap)


  • administrators

    Btw - I wrote a quick utility script to add the padding to your tiles automatically.



  • @bendmorris Oh after setting smooth to false, that did indeed fix it. Thanks!

    Side note--is there any way for me to not have to write smooth = false for all my images/tilemaps? it's not a huge issue for me, but it would be nice.


  • administrators

    You can create your own NotSmoothTilemap class and extend that, but you're right, it would be nice. Can probably get that into HaxePunk 4.1.


Log in to reply
 

Looks like your connection to NodeBB was lost, please wait while we try to reconnect.