Hi guys,
I am trying to make a simple game with unity and I am stuck.
I have 10x10 matrix fulled with red and green squares. I am trying to make a fuction deleting squares, when three in a row are the same. I think you know rules of similar games and know how it works
So, this is my code:
for (i = 0; i < 8; i++)
{
for (j = 0; j < 8; j++)
{
if ((klocki_[j].tag == klocki[i + 1][j].tag) && (klocki*[j].tag == klocki[i + 2][j].tag))*_
{
Destroy(klocki*[j].gameObject);*
Destroy(klocki[i + 1][j].gameObject);
Destroy(klocki[i + 2][j].gameObject);
}
if ((klocki[j].tag == klocki[j + 1].tag) && (klocki_[j].tag == klocki*[j + 2].tag))
{_
_Destroy(klocki[j].gameObject);_
_Destroy(klocki[j + 1].gameObject);_
_Destroy(klocki[j + 2].gameObject);
}
}
}*_
Ofc green are tagged green, and red are tagget red.
And here is result of this:
[110317-przechwytywanie.png|110317]
As You can see, 9th and 10th columns and rows are not fully cleared, and I cannot understand why.
Can somebody help me, pls?
Thanks in advance