I have this section of code that every 10 seconds it checks if the player has enough Xp to level up if they do it will add 1 to there level, double the neededXp and rest there Xp to 0.
but for some reason every 10 seconds it doubles needed Xp even when i don't have enough Xp it doesn't do any of the other things though. Also level up does work. (if i can get enough XP quick enough before it doubles its way to a large number)
window.setInterval(
function levelup() {
if (Xp >= neededXP)
level = level + 1;
neededXP = neededXP * 2;
Xp = 0;
document.getElementById("level").innerHTML = level
document.getElementById("neededXP").innerHTML = neededXP
document.getElementById("Xp").innerHTML = Xp
}, 10000);
Aucun commentaire:
Enregistrer un commentaire