Skip to content

Commit

Permalink
parks: can switch to different bottle cards
Browse files Browse the repository at this point in the history
  • Loading branch information
DrDr3ck committed Sep 27, 2024
1 parent b2f7179 commit e73f018
Showing 1 changed file with 32 additions and 4 deletions.
36 changes: 32 additions & 4 deletions Parks/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,9 @@ function speakerClicked() {

function startClicked() {
curGameState = GAME_PLAY_STATE;
uiManager.setUI([speakerButton]);
uiManager.setUI([speakerButton, plusButton, minusButton]);
plusButton.setTextSize(35);
minusButton.setTextSize(35);
uiManager.addLogger("Start game");

shuffleArray(parks);
Expand Down Expand Up @@ -260,6 +262,15 @@ const startButton = new BButton(
startClicked
);

const plusButton = new BFloatingButton(10, 720, "<", () => {
const g = board.gourdes.shift();
board.gourdes.push(g);
});
const minusButton = new BFloatingButton(225, 720, ">", () => {
const g = board.gourdes.pop();
board.gourdes.unshift(g);
});

const parks = [
{
name: "Isle Royale National Park",
Expand Down Expand Up @@ -754,6 +765,9 @@ function drawGame() {
}
} else if (curState === STATE.TAKE_TOKEN_FOR_RANGER) {
text("Take token for ranger card", 715, 670);
} else if (curState === STATE.BOTTLE_OR_PHOTO) {
text("Choose between bottle and photo", 715, 670);
// TODO: add bottle/photo buttons ?
}

// equipements
Expand Down Expand Up @@ -871,6 +885,11 @@ function drawBoard() {
// gourdes
if (board.gourdes.length > 0) {
spritesheet.drawSprite("gourdes", board.gourdes[0].index, 10, 730);
fill(220);
noStroke();
textAlign(CENTER, CENTER);
textSize(25);
text(`x${board.gourdes.length}`, 135, 695);
}

// garde forestier
Expand Down Expand Up @@ -962,7 +981,12 @@ function placeHiker() {
overPlace.resetTile();
curState = STATE.TAKE_TOKENS_ON_CARD;
} else if (overPlace.placeIndex === 4) {
curState = STATE.BOTTLE_OR_PHOTO;
// check first if place contains some tokens !!
if (overPlace.tokens.length > 0) {
curState = STATE.TAKE_TOKENS_ON_CARD;
} else {
curState = STATE.BOTTLE_OR_PHOTO;
}
}
}
curPlace = overPlace;
Expand Down Expand Up @@ -1067,8 +1091,12 @@ function mouseClicked() {
addTokenToBox(selectedToken.type);
// check if tokens on card otherwise move to next state
if (curPlace.tokens.length === 0) {
curState = STATE.MOVE_RANGER;
selectedEquip = equipements.pop();
if (curPlace.placeIndex === 4) {
curState = STATE.BOTTLE_OR_PHOTO;
} else {
curState = STATE.MOVE_RANGER;
selectedEquip = equipements.pop();
}
}
}

Expand Down

0 comments on commit e73f018

Please sign in to comment.