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. Dismiss Notice

At a standstill and need help for grid based game

Discussion in 'Scripting' started by RayDawg, Jul 14, 2014.

  1. RayDawg

    RayDawg

    Joined:
    Mar 19, 2013
    Posts:
    108
    I have a large grid of blocks and underneath that grid are a few 2x2 blocks. In order to destroy those large 2x2 blocks, I have to make sure the 4 blocks (all 1x1) on top of the 2x2 block is destroyed. Currently, all I can do is destroy the entire 2x2 block on mouse click even if I only have a single 1x1 block above it destroyed. Could anyone give me advice on what to do?
     
  2. Magiichan

    Magiichan

    Joined:
    Jan 5, 2014
    Posts:
    403
    You should use a voxel solution instead.
     
  3. SteveJ

    SteveJ

    Joined:
    Mar 26, 2010
    Posts:
    3,066
    Make the 1x1's children of the 2x2's and then check child count == 0 before destroying a 2x2?
     
  4. RayDawg

    RayDawg

    Joined:
    Mar 19, 2013
    Posts:
    108
    A voxel based solution would indicate 3D, right? I'm currently tinkering around in 2D so would that work?
     
  5. Magiichan

    Magiichan

    Joined:
    Jan 5, 2014
    Posts:
    403
    Yes, my bad.
    I don't think there's much of a use for a 2D version of it.