Bestenliste und Scores gespeichert und beim Ende eines Spiel Rang anzeige

This commit is contained in:
2025-04-28 20:56:06 +02:00
parent 76392172b5
commit 80ae256638
12 changed files with 155 additions and 32 deletions
@@ -18,17 +18,19 @@ class GameLoop{
this.fruitManager = new FruitManager(this.io, this.game, this.playground);
}
loop(){
async loop(){
this.playground.resetPlayground();
this.snakes.forEach(snake => { snake.move()});
await Promise.all(this.snakes.map(snake => snake.move()));
this.fruitManager.updateFruits();
this.sendUpdate();
setTimeout(() => {
this.loop();
}, 125);
if(this.game.gameStarted){
setTimeout(() => {
this.loop();
}, 125);
}
}
sendUpdate(){