Browse Source

fixed despawns being broken

master
mort 8 years ago
parent
commit
68da10ec67
1 changed files with 4 additions and 4 deletions
  1. 4
    4
      js/game.js

+ 4
- 4
js/game.js View File

@@ -88,7 +88,7 @@ class Entity {

update() {}

send() {}
send(first) {}

despawn() {
this.game.players.forEach((p) => p.sock.send("despawn", {
@@ -143,13 +143,13 @@ class Player extends Entity {
req.reply({
id: this.id
});

game.entities.forEach((e) => e.send(true));
} else if (req.url == "keydown") {
this.keys[req.data.key] = true;
} else if (req.url == "keyup") {
delete this.keys[req.data.key];
}

game.entities.forEach((e) => e.send(true));
});

sock.on("close", () => this.despawn());
@@ -197,7 +197,7 @@ class Player extends Entity {
this.health -= 10;
e.despawn();
if (this.health <= 0)
this.despawn();
this.despawn();
}
}
});

Loading…
Cancel
Save