hey, I know the code might look complicated at first, but it’s not! I figured out everything, and I`m trying to get working the very last feature of the game.
First of all the game is based on the real game called Checkers. almost everything is working except one thing :
After I destroied an opponent checker, I want to check if it’s possible to destroy another checker with the same conditions. ( which means, the conditional is that if there’s a checker in one of the 4 diagonal +1 + 1, -1 + 1 , +1 - 1, -1 -1. an opponent checker, it’ll check in the chosen newX,newY which is “replacing” all the “1” numbers above to 2. like jumping over them… my explanation is awful for people who never played this game before, this is a simple game btw. google it for more info.
so first of all I want to check if it’s possible to eat(destroy) again with normal(there’re also king) checkers, and then, with king checkers which is a bit harder because I need to loop all the 7 squares and to check the first element array that it found and to also check that there’re more of them before the newX,newY opponent checkers.
Anyways, Here’s the code :
http://pastie.org/778586
http://www.pasteit4me.com/99079
What I`m trying to do which also gives a bug starts from line 356.
the bug it gives me is simple :
after I destroied the opponent checker with my checker, it still keeps that checker selected and also, I must go with it once more even if the conditions that are set-uped aren’t true, which means, even if there’re no opponent checkers surronding it,etc… why? how to fix that so it’ll move again only if there’re opponent checkers surronding it and it’s possible to do a destroy opponent move.
*Note :No errors! It’s just a non-completed code, and I tried for many hours to finish that code, but everything I tried to add from the current code has failed.
I hope Ill get some help from you guys.. also, you'll be credited in the tutorial Ill release to the unity community. thank you!