Hello Guest

Author Topic: Tint Tile in TileMap  (Read 4408 times)

IndyBonez

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 3
    • View Profile
Tint Tile in TileMap
« on: May 13, 2015, 01:17:43 pm »
Hi,

I'm currently trying to implement a feature were tiles on the tile map can be selected. When selected I would like to tint the tiles a specific color. I have tried using the color channel and setting colors at position but this doesn't really achieve what I'm looking for which is to tint only the tile at that position on a certain layer, respecting transparency etc. so basically the tint is masked to the sprite on that tile.

I can achieve this by having a pre-tinted tile that I just swap with the current tile but I would really like to avoid this if possible as its not a very flexible solution.

Is this something that is possible with the 2dtoolkit tilemap? With or without having to modify too much of the toolkits source?

Thanks

-Tristan

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Tint Tile in TileMap
« Reply #1 on: May 14, 2015, 05:33:37 pm »
Hi,

Easy solution is to create a new layer with a solid color square / rectangular sprite that uses an additive shader. That way  that shader just brightens the underlying tile.

If you don't want to do that you can modify tk2d source so the vertex color doesn't get interpolated, but while this will work the solution above will be WAY more efficient.

IndyBonez

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Tint Tile in TileMap
« Reply #2 on: May 15, 2015, 01:29:37 pm »
Excellent thank you I shall give that a go!