implemented hunter

This commit is contained in:
fabianthome
2021-07-12 13:18:31 +02:00
parent 6c14f8619a
commit 58e9cd7115
5 changed files with 48 additions and 29 deletions

View File

@@ -1,4 +1,4 @@
function Card(game_board_size, question, answer_1, answer_2, answer_3, answer_4, difficulty, your_turn) {
function Card(game_board_size, question, answer_1, answer_2, answer_3, answer_4, difficulty, your_turn, game_state) {
this.card = new PIXI.Graphics();
this.question = question;
this.answer_1 = answer_1;
@@ -68,8 +68,13 @@ function Card(game_board_size, question, answer_1, answer_2, answer_3, answer_4,
this.card.addChild(header);
if (difficulty === 0) {
for (let i = 0; i < positions.length; i++) {
if (positions[i] > 15) this.question = "Gewinner: " + playerNames[i];
if (game_state == 3) {
for (let i = 0; i < positions.length; i++) {
if (positions[i] > 15) this.question = "Gewinner: " + playerNames[i];
}
}
else if (game_state == 2) {
this.question = "Unentschieden.";
}
}
@@ -123,7 +128,7 @@ function Card(game_board_size, question, answer_1, answer_2, answer_3, answer_4,
// OK-Button
if (difficulty === 0 && (positions[0] > 15 || positions[1] > 15 || positions[2] > 15 || positions[3] > 15)) {
if (game_state == 2 || game_state == 3) {
this.card.addChild(new Button(0xffffff, 0xcccccc, 0xffffff, this.card_width - 40, 100, this.card_x + 20, this.card_y + this.card_height - 120, "New Game", null, function () {
window.location.reload();
}).getButton());