diff --git a/public/game.js b/public/game.js index 7c7cdca..ef3cd31 100644 --- a/public/game.js +++ b/public/game.js @@ -109,22 +109,28 @@ class Game { return; } - let x = 32; - let y = 90; + let x = 16; + let y = 48; let rowHeight = 32; let rowWidth = 128; - let row = 0; + let scores = []; for (let id in this.players) { let player = this.players[id]; + scores.push(player); + } + scores.sort((p1, p2) => { return p2.score - p1.score; }); + + let row = 0; + for (let player of scores) { tint(Colors.Purple); image(player.image, x, y + row * rowHeight, 32, 32); textSize(24); fill(Colors.Purple); noStroke(); - textAlign(LEFT, CENTER); - text(player.score, x + 32 + 10, y + rowHeight*0.5); + textAlign(LEFT, TOP); + text(player.score, x + 42, y + row * rowHeight + 4); row++; } diff --git a/public/host.js b/public/host.js index 87e5420..2b3a830 100644 --- a/public/host.js +++ b/public/host.js @@ -23,7 +23,7 @@ const local = false; // true if running locally, false // Global variables here. ----> const velScale = 10; -const debug = true; +const debug = false; let game; // <---- @@ -70,7 +70,7 @@ function onClientConnect (data) { if (!game.checkId(data.id)) { game.add(data.id, random(0.25*width, 0.75*width), - random(0.25*height, 0.75*height), + random(0.75*height, 0.85*height), 64, 64 ); } diff --git a/public/lib/p5.multiplayer.js b/public/lib/p5.multiplayer.js index fbde79a..312a8d4 100644 --- a/public/lib/p5.multiplayer.js +++ b/public/lib/p5.multiplayer.js @@ -93,8 +93,9 @@ function displayAddress() { push(); fill(Colors.Eggplant); noStroke(); - textSize(50); - text(serverIp+"/?="+roomId, 10, 50); + textAlign(LEFT, BOTTOM); + textSize(32); + text(serverIp+"/?="+roomId, 8, 40); pop(); } diff --git a/public/player.js b/public/player.js index 52174c4..514a539 100644 --- a/public/player.js +++ b/public/player.js @@ -104,7 +104,11 @@ class Player { } kill() { - // something here + this.score = 0; + this.moneys = 0; + this.burgers = 0; + this.position.x = random(width * 0.25, width * 0.75); + this.position.y = random(height * 0.75, height * 0.85); } joystickInput(x, y) {