Score: 0
@@ -123,7 +139,12 @@
}
function addLog(text) {
- log.textContent = log.textContent + '\n' + text;
+ const entry = document.createElement("div");
+ entry.textContent = text;
+ log.appendChild(entry);
+
+ // Scroll automatique vers le bas
+ log.scrollTop = log.scrollHeight;
}
const attacksDiv = document.getElementById("attacksDiv");
@@ -171,7 +192,7 @@
addRandomItemToInventory();
score += 1;
setCombat();
- addLog("Un nouvel ennemi sauvage apparaît !\n");
+ addLog("\nUn nouvel ennemi sauvage apparaît !");
return;
}