players now die when they hit zombies

master
Jordan Orelli 5 years ago
parent 65b381316d
commit e4448332d5

@ -109,22 +109,28 @@ class Game {
return; return;
} }
let x = 32; let x = 16;
let y = 90; let y = 48;
let rowHeight = 32; let rowHeight = 32;
let rowWidth = 128; let rowWidth = 128;
let row = 0; let scores = [];
for (let id in this.players) { for (let id in this.players) {
let player = this.players[id]; 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); tint(Colors.Purple);
image(player.image, x, y + row * rowHeight, 32, 32); image(player.image, x, y + row * rowHeight, 32, 32);
textSize(24); textSize(24);
fill(Colors.Purple); fill(Colors.Purple);
noStroke(); noStroke();
textAlign(LEFT, CENTER); textAlign(LEFT, TOP);
text(player.score, x + 32 + 10, y + rowHeight*0.5); text(player.score, x + 42, y + row * rowHeight + 4);
row++; row++;
} }

@ -23,7 +23,7 @@ const local = false; // true if running locally, false
// Global variables here. ----> // Global variables here. ---->
const velScale = 10; const velScale = 10;
const debug = true; const debug = false;
let game; let game;
// <---- // <----
@ -70,7 +70,7 @@ function onClientConnect (data) {
if (!game.checkId(data.id)) { if (!game.checkId(data.id)) {
game.add(data.id, game.add(data.id,
random(0.25*width, 0.75*width), random(0.25*width, 0.75*width),
random(0.25*height, 0.75*height), random(0.75*height, 0.85*height),
64, 64 64, 64
); );
} }

@ -93,8 +93,9 @@ function displayAddress() {
push(); push();
fill(Colors.Eggplant); fill(Colors.Eggplant);
noStroke(); noStroke();
textSize(50); textAlign(LEFT, BOTTOM);
text(serverIp+"/?="+roomId, 10, 50); textSize(32);
text(serverIp+"/?="+roomId, 8, 40);
pop(); pop();
} }

@ -104,7 +104,11 @@ class Player {
} }
kill() { 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) { joystickInput(x, y) {

Loading…
Cancel
Save