Search Unity

Using an Atlas to replace "farmed" tiles, instead of a square tile

Discussion in 'Scripting' started by mrCharli3, Nov 22, 2017.

  1. mrCharli3

    mrCharli3

    Joined:
    Mar 22, 2017
    Posts:
    976
    I have a game where you can hoe ground and it turn into farmable soil, however, at the moment I only replace the 64x64 tile with another 64x64 tile, which of course looks really square. What I want is this effect:



    The above is what I get when I paint with this Atlas:



    It's also a feature in Stardew Valley, so I know it is possible somehow.
    Basically I need to change my simple farming method that just replaces one tile with another, and turn it into a method that checks:

    Code (CSharp):
    1. if(tileLeftIsFarmable && AllOtherConnectingTilesAreGrass) -> tile = tile_that_connects_to_left;
    2. //...
    3. if(tileLeftIsFarmable && tileRightIsFarmable && AllOtherConnectingTilesAreGrass) -> tile = tile_that_connects_to_left_and_right;
    Hopefully that makes some sense. Does anyone have any ideas on how to accomplish this?