Search Unity

Hex Grid - need help with destroying 3 or more tiles

Discussion in 'Scripting' started by Burglebutt, Feb 13, 2020.

  1. Burglebutt

    Burglebutt

    Joined:
    Jul 24, 2014
    Posts:
    51
    I am trying to make a game like this -


    So far I have my grid, I have a way to find out which neighbors each node has. I am able to swap tiles with clicking.

    My goal is to trigger combos like in the video when I move a tile around and have it next to other tiles of the same type.

    I have it half working, if I move a jalepeno tile next to a group of other jalepeno tiles it will destroy all of the ones that are touching except the swapped tile. It just doesn't work in certain situations ><
    Hoping someone who has made a game like this before can point me in the right direction for figuring out how to handle combos correctly! Thank you.

    my bad code...
    https://gist.github.com/burglekutt/db9ad9db2258548594dedb12bb3ff159