Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

How to do this ??

Discussion in '2D' started by KevG, Jan 8, 2016.

  1. KevG

    KevG

    Joined:
    Oct 4, 2015
    Posts:
    20
    Hi all

    How can I ' dig ' through a 2d tiled scene made up of sprites, please see drawing below.

    The player would be able to move only along the yellow road, the black area is the room the player needs to get to, the only way to get to the room the player must be able to ' dig ' through the grey marked with the red hash lines.

    Can some one please give me a clue on how this may be done.

    It would be a ' digdug ' style, I don't have any set up yet as being able to ' dig ' through walls is part of the game hence the bad drawing

    Thanks

    KevG

    image.png
     
  2. tedthebug

    tedthebug

    Joined:
    May 6, 2015
    Posts:
    2,570
    Can they dig through any grey material or only that specific spot? Thing is, if they can only dig that spot how will the player know if it looks the same as the other areas they can't dig in?

    Either way, you can use tags to check if they can dig that spot. Check it when you are attempting to dig it.
     
  3. KevG

    KevG

    Joined:
    Oct 4, 2015
    Posts:
    20
    The player shouldn't be able to dig through the other grey areas.
    There would be ' clues ' as to the fact the player could ' dig ' there, i.e. Slightly different colour.

    The main things I would like to know how to do is.
    how to make the area that is able to be dug disappear just like digdug style.
    make the new ' floor ' walkable
    Would it be better using 2d Sprite tiles with box collider or 3d cubes and fake the 2d view.

    I haven't been able to find any ' digging ' style tutorials, I have found some ray casting tutorials that destroy the terrain but these are not really ' digdug ' style. Are there any ???
     
  4. tedthebug

    tedthebug

    Joined:
    May 6, 2015
    Posts:
    2,570
    2d or 3D would work.

    You could destroy the dug block & replace it with the walkable back or you could change the colour & tag once it has been dug to match the walkable tiles.
     
  5. KevG

    KevG

    Joined:
    Oct 4, 2015
    Posts:
    20
    After doing a lot of digging via Google I have found that a mixture of 2D colliders and tags will do the job, but still trying to figure out how it's done