Skip to content

Commit

Permalink
Change score to green if cur player is winning that location
Browse files Browse the repository at this point in the history
  • Loading branch information
luis-c465 committed Jan 8, 2023
1 parent a5fa33e commit ffeadc0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
15 changes: 14 additions & 1 deletion Location.pde
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ public class Location extends Clickable {
protected int p1Scor = 0;
protected int p2Scor = 0;

public static final color bigger_score_col = #4ade80;

public static final int space = 200;
public static final int gap = 100;

Expand Down Expand Up @@ -47,10 +49,22 @@ public class Location extends Clickable {
textAlign(CENTER);
textSize(40);
if (curTurn == 1) {
push();
if (p1Scor > p2Scor) {
fill(bigger_score_col);
}
text("" + p1Scor, x, y_score_bellow);
pop();

text("" + p2Scor, x, y_score_above);
} else if (curTurn == 2) {
push();
if (p2Scor > p1Scor) {
fill(bigger_score_col);
}
text("" + p2Scor, x, y_score_bellow);
pop();

text("" + p1Scor, x, y_score_above);
}

Expand Down Expand Up @@ -140,7 +154,6 @@ public class Location extends Clickable {
Location loc = randLocation();
// This card cannot be placed
// because there is nowhere to the card to move to!
println(loc);
if (loc == null) {
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion Snap.pde
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ void dealCards() {
dealer.deal(p2.deck, 7);

// Print out the cards of the player for debuggging
printCards();
// printCards();
}

// Print out the cards of the player for debuggging
Expand Down

0 comments on commit ffeadc0

Please sign in to comment.