/* * Method which determines if the snake has reached the item * */ public Boolean IsReached(SnakePart snake) { Boolean isReached = false; if ((snake.Get_X() == _X) && (snake.Get_Y() == _Y)) isReached = true; return isReached; }
/* * Method which determines if the snake has reached the insect */ public Boolean IsReached(SnakePart snakePart) { Boolean isReached = false; if (((snakePart.Get_X() == _X) && (snakePart.Get_Y() == _Y)) || ((snakePart.Get_X() == (_X + (_Side / 2 + 1))) && (snakePart.Get_Y() == _Y)) || ((snakePart.Get_X() == _X) && (snakePart.Get_Y() == (_Y + (_Side / 2) + 1))) || ((snakePart.Get_X() == (_X + (_Side / 2 + 1))) && (snakePart.Get_Y() == (_Y + (_Side / 2) + 1)))) isReached = true; return isReached; }