var hpp = 10; var health = 100; var agip = 10; var strp = 10; var regenp = 5; var pointsp = 5; var hcheck = hpp * hpp; function load() { document.getElementById("hpp").innerHTML = hcheck; document.getElementById("hcheck").innerHTML = hcheck; document.getElementById("hmath").innerHTML = "(" + hpp + "x" + hpp + ")"; document.getElementById("agip").innerHTML = agip; document.getElementById("strp").innerHTML = strp; document.getElementById("regenp").innerHTML = regenp; document.getElementById("pointsp").innerHTML = pointsp; var name = prompt("Hvad er dit navn?", "Name"); document.getElementById("name").innerHTML = name; } function start() { if (pointsp == 0) { gametick(); spawntick(); upgrade_option_delete(); } else { alert("Du skal bruge alle dine Ability Points") } } function gametick() { setInterval(function(){ if (health < hcheck) { health += regenp; document.getElementById("hpp").innerHTML = health; if (health > hcheck) { document.getElementById("hpp").innerHTML = hcheck; } } }, 2500); } function spawntick() { setInterval(function(){ var eRandom = (Math.floor((Math.random()*5)+2)); document.getElementById("enemy").innerHTML += "
" + "Enemy
" + "HP: "+ eRandom +"
" + "
"; }, 5000); } function upgrade_option_delete() { document.getElementById("hpplus").remove(); document.getElementById("hpminus").remove(); document.getElementById("agiplus").remove(); document.getElementById("agiminus").remove(); document.getElementById("strplus").remove(); document.getElementById("strminus").remove(); document.getElementById("startbutton").remove(); } function hpm() { if (hpp > 10) { hpp -= 1; document.getElementById("hcheck").innerHTML = hpp * hpp; document.getElementById("hmath").innerHTML = "(" + hpp + "x" + hpp + ")"; app(); } } function hpp2() { if (pointsp > 0) { hpp += 1; document.getElementById("hcheck").innerHTML = hpp * hpp; document.getElementById("hmath").innerHTML = "(" + hpp + "x" + hpp + ")"; apm(); } } function agim() { if (agip > 10) { agip -= 1; document.getElementById("agip").innerHTML = agip; app(); } } function agip2() { if (pointsp > 0) { agip += 1; document.getElementById("agip").innerHTML = agip; apm(); } } function strm() { if (strp > 10) { strp -= 1; regenp -= 0.5; document.getElementById("strp").innerHTML = strp; document.getElementById("regenp").innerHTML = regenp; app(); } } function strp2() { if (pointsp > 0) { strp += 1; regenp += 0.5; document.getElementById("strp").innerHTML = strp; document.getElementById("regenp").innerHTML = regenp; apm(); } } function apm() { pointsp -= 1; document.getElementById("pointsp").innerHTML = pointsp; } function app() { pointsp += 1; document.getElementById("pointsp").innerHTML = pointsp; }