08.10
This commit is contained in:
20
Game.~ava
20
Game.~ava
@@ -42,13 +42,13 @@ public class Game {
|
||||
if (game_state == 0) {
|
||||
Chip newChip;
|
||||
if (currentTurnPlayer == "White") {
|
||||
newChip = addChip(button.relativeX,button.relativeY,button.absoluteX,button.absoluteY,Color.WHITE);
|
||||
newChip = addChip(button.ring,button.relativeX,button.relativeY,button.absoluteX,button.absoluteY,Color.WHITE);
|
||||
white_chips--;
|
||||
setChipCount(white_chips,"White");
|
||||
|
||||
}
|
||||
else {
|
||||
newChip = addChip(button.relativeX,button.relativeY,button.absoluteX,button.absoluteY,Color.BLACK);
|
||||
newChip = addChip(button.ring,button.relativeX,button.relativeY,button.absoluteX,button.absoluteY,Color.BLACK);
|
||||
black_chips--;
|
||||
setChipCount(white_chips,"Black");
|
||||
}
|
||||
@@ -64,8 +64,8 @@ public class Game {
|
||||
}
|
||||
|
||||
}
|
||||
public Chip addChip(int relX, int relY,double absX, double absY, Color color) {
|
||||
Chip chip = new Chip(relX,relY,absX,absY,color,this);
|
||||
public Chip addChip(int ring,int relX, int relY,double absX, double absY, Color color) {
|
||||
Chip chip = new Chip(ring,relX,relY,absX,absY,color,this);
|
||||
chips.add(chip);
|
||||
addShape(chip.getShape());
|
||||
return chip;
|
||||
@@ -98,10 +98,10 @@ public class Game {
|
||||
LTop.setText(value);
|
||||
}
|
||||
public boolean checkCombo(Chip chip) {
|
||||
return checkCombo(chip.relativeX, chip.relativeY);
|
||||
return checkCombo(chip.relativeX, chip.relativeY, chip.ring);
|
||||
}
|
||||
public boolean checkCombo(int relX, int relY) {
|
||||
ArrayList<Chip> hChips = getHorizontalCloseChips(relX,relY);
|
||||
public boolean checkCombo(int relX, int relY, int ring) {
|
||||
ArrayList<Chip> hChips = getHorizontalCloseChips(relX,relY,ring);
|
||||
ArrayList<Chip> vChips = getVerticalCloseChips(relX,relY);
|
||||
|
||||
Chip start_chip = getChipByPos(relX,relY);
|
||||
@@ -119,8 +119,9 @@ public class Game {
|
||||
return false;
|
||||
}
|
||||
|
||||
public ArrayList<Chip> getHorizontalCloseChips(int relX, int relY) {
|
||||
public ArrayList<Chip> getHorizontalCloseChips(int relX, int relY, int ring) {
|
||||
ArrayList<Chip> result = new ArrayList<Chip>();
|
||||
System.out.println("Target: " + relY);
|
||||
if (relX == 0) {
|
||||
result.add(getChipByPos(1,relY));
|
||||
result.add(getChipByPos(2,relY));
|
||||
@@ -132,7 +133,8 @@ public class Game {
|
||||
else {
|
||||
result.add(getChipByPos(0,relY));
|
||||
result.add(getChipByPos(1,relY));
|
||||
} // end of if-else
|
||||
} // end of if-else
|
||||
System.out.println("Result: " + result.toString());
|
||||
return result;
|
||||
}
|
||||
public ArrayList<Chip> getVerticalCloseChips(int relX, int relY) {
|
||||
|
||||
Reference in New Issue
Block a user