- Some small improvements
- Reformatting
This commit is contained in:
parent
58e9cd7115
commit
a44802fa56
@ -10,7 +10,7 @@ class Game {
|
|||||||
ONGOING: 1,
|
ONGOING: 1,
|
||||||
IS_DRAW: 2,
|
IS_DRAW: 2,
|
||||||
IS_WON: 3
|
IS_WON: 3
|
||||||
}
|
};
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.currentStatus = Game.STATUS.SETTING_UP;
|
this.currentStatus = Game.STATUS.SETTING_UP;
|
||||||
@ -102,7 +102,7 @@ class Game {
|
|||||||
}
|
}
|
||||||
|
|
||||||
removePlayerName(playerName) {
|
removePlayerName(playerName) {
|
||||||
this.playerNames.splice(this.playerNames.indexOf(playerName), 1)
|
this.playerNames.splice(this.playerNames.indexOf(playerName), 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,17 +151,6 @@ io.on('connection', socket => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
io.in(socket.room).emit('update Hunter', game[socket.room].hunter.getPosition());
|
io.in(socket.room).emit('update Hunter', game[socket.room].hunter.getPosition());
|
||||||
|
|
||||||
switch (game[socket.room].currentStatus) {
|
|
||||||
case Game.STATUS.IS_WON:
|
|
||||||
console.log("FINISHED");
|
|
||||||
break;
|
|
||||||
case Game.STATUS.IS_DRAW:
|
|
||||||
console.log("DRAW");
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -68,12 +68,11 @@ function Card(game_board_size, question, answer_1, answer_2, answer_3, answer_4,
|
|||||||
this.card.addChild(header);
|
this.card.addChild(header);
|
||||||
|
|
||||||
if (difficulty === 0) {
|
if (difficulty === 0) {
|
||||||
if (game_state == 3) {
|
if (game_state === 3) {
|
||||||
for (let i = 0; i < positions.length; i++) {
|
for (let i = 0; i < positions.length; i++) {
|
||||||
if (positions[i] > 15) this.question = "Gewinner: " + playerNames[i];
|
if (positions[i] > 15) this.question = "Gewinner: " + playerNames[i];
|
||||||
}
|
}
|
||||||
}
|
} else if (game_state === 2) {
|
||||||
else if (game_state == 2) {
|
|
||||||
this.question = "Unentschieden.";
|
this.question = "Unentschieden.";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -128,7 +127,7 @@ function Card(game_board_size, question, answer_1, answer_2, answer_3, answer_4,
|
|||||||
|
|
||||||
|
|
||||||
// OK-Button
|
// OK-Button
|
||||||
if (game_state == 2 || game_state == 3) {
|
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 () {
|
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();
|
window.location.reload();
|
||||||
}).getButton());
|
}).getButton());
|
||||||
|
@ -268,7 +268,7 @@ function start_game() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.state == 2 || data.state == 3) {
|
if (data.state === 2 || data.state === 3) {
|
||||||
card = new Card(game_board_size, "",
|
card = new Card(game_board_size, "",
|
||||||
{"text": playerNames[0] ? playerNames[0] + ": " + positions[0] : ("Kein Spieler"), "status": false},
|
{"text": playerNames[0] ? playerNames[0] + ": " + positions[0] : ("Kein Spieler"), "status": false},
|
||||||
{"text": playerNames[1] ? playerNames[1] + ": " + positions[1] : ("Kein Spieler"), "status": false},
|
{"text": playerNames[1] ? playerNames[1] + ": " + positions[1] : ("Kein Spieler"), "status": false},
|
||||||
@ -284,8 +284,8 @@ function start_game() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
socket.on('update Hunter', function (position) {
|
socket.on('update Hunter', function (position) {
|
||||||
x = sprites[position].coord_x;
|
let x = sprites[position].coord_x;
|
||||||
y = sprites[position].coord_y;
|
let y = sprites[position].coord_y;
|
||||||
red_border.clear();
|
red_border.clear();
|
||||||
red_border = generate_red_border(new PIXI.Graphics(), x, y);
|
red_border = generate_red_border(new PIXI.Graphics(), x, y);
|
||||||
app.stage.addChild(red_border);
|
app.stage.addChild(red_border);
|
||||||
|
Loading…
Reference in New Issue
Block a user