- Some small improvements
- Reformatting
This commit is contained in:
@@ -68,12 +68,11 @@ function Card(game_board_size, question, answer_1, answer_2, answer_3, answer_4,
|
||||
this.card.addChild(header);
|
||||
|
||||
if (difficulty === 0) {
|
||||
if (game_state == 3) {
|
||||
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) {
|
||||
} else if (game_state === 2) {
|
||||
this.question = "Unentschieden.";
|
||||
}
|
||||
}
|
||||
@@ -128,7 +127,7 @@ function Card(game_board_size, question, answer_1, answer_2, answer_3, answer_4,
|
||||
|
||||
|
||||
// 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 () {
|
||||
window.location.reload();
|
||||
}).getButton());
|
||||
|
@@ -1,7 +1,7 @@
|
||||
function Sprite(x, y, slow) {
|
||||
if(slow){
|
||||
if (slow) {
|
||||
this.sprite = PIXI.Sprite.from('/img/spriteSlow.jpg');
|
||||
}else{
|
||||
} else {
|
||||
this.sprite = PIXI.Sprite.from('/img/sprite.jpg');
|
||||
}
|
||||
this.coord_x = x;
|
||||
|
@@ -174,9 +174,9 @@ function start_game() {
|
||||
score_button.defaultCursor = 'pointer';
|
||||
score_button.on('pointerdown', function () {
|
||||
card = new Card(game_board_size, "",
|
||||
{ "text": playerNames[0] ? playerNames[0] + ": " + positions[0] : ("Kein Spieler"), "status": false },
|
||||
{ "text": playerNames[1] ? playerNames[1] + ": " + positions[1] : ("Kein Spieler"), "status": false },
|
||||
{ "text": playerNames[2] ? playerNames[2] + ": " + positions[2] : ("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[2] ? playerNames[2] + ": " + positions[2] : ("Kein Spieler"), "status": false},
|
||||
{
|
||||
"text": playerNames[3] ? playerNames[3] + ": " + positions[3] : ("Kein Spieler"),
|
||||
"status": false
|
||||
@@ -268,12 +268,12 @@ function start_game() {
|
||||
break;
|
||||
}
|
||||
|
||||
if (data.state == 2 || data.state == 3) {
|
||||
if (data.state === 2 || data.state === 3) {
|
||||
card = new Card(game_board_size, "",
|
||||
{ "text": playerNames[0] ? playerNames[0] + ": " + positions[0] : ("Kein Spieler"), "status": false },
|
||||
{ "text": playerNames[1] ? playerNames[1] + ": " + positions[1] : ("Kein Spieler"), "status": false },
|
||||
{ "text": playerNames[2] ? playerNames[2] + ": " + positions[2] : ("Kein Spieler"), "status": false },
|
||||
{ "text": playerNames[3] ? playerNames[3] + ": " + positions[3] : ("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[2] ? playerNames[2] + ": " + positions[2] : ("Kein Spieler"), "status": false},
|
||||
{"text": playerNames[3] ? playerNames[3] + ": " + positions[3] : ("Kein Spieler"), "status": false},
|
||||
0, false, data.state);
|
||||
red_border.clear();
|
||||
card.showCard();
|
||||
@@ -284,8 +284,8 @@ function start_game() {
|
||||
});
|
||||
|
||||
socket.on('update Hunter', function (position) {
|
||||
x = sprites[position].coord_x;
|
||||
y = sprites[position].coord_y;
|
||||
let x = sprites[position].coord_x;
|
||||
let y = sprites[position].coord_y;
|
||||
red_border.clear();
|
||||
red_border = generate_red_border(new PIXI.Graphics(), x, y);
|
||||
app.stage.addChild(red_border);
|
||||
|
Reference in New Issue
Block a user