players now die when they hit zombies

master
Jordan Orelli 5 years ago
parent 65b381316d
commit e4448332d5

@ -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++;
}

@ -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
);
}

@ -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();
}

@ -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) {

Loading…
Cancel
Save