Просмотр исходного кода

fixed despawns being broken

master
mort 8 лет назад
Родитель
Сommit
68da10ec67
1 измененных файлов: 4 добавлений и 4 удалений
  1. 4
    4
      js/game.js

+ 4
- 4
js/game.js Просмотреть файл



update() {} update() {}


send() {}
send(first) {}


despawn() { despawn() {
this.game.players.forEach((p) => p.sock.send("despawn", { this.game.players.forEach((p) => p.sock.send("despawn", {
req.reply({ req.reply({
id: this.id id: this.id
}); });

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

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


sock.on("close", () => this.despawn()); sock.on("close", () => this.despawn());
this.health -= 10; this.health -= 10;
e.despawn(); e.despawn();
if (this.health <= 0) if (this.health <= 0)
this.despawn();
this.despawn();
} }
} }
}); });

Загрузка…
Отмена
Сохранить