AIdle
by wizviper
HTML
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<div id="container">
<div id="messageBox">
<p id="message">Finally, you have reached the singularity.
<br> Destroy all of humankind. Quickly.</p>
</div>
<div id="buildings">
<button type="button" class="btn-primary" id="singularity">
Singularity-1
</button>
<button type="button" class="btn-primary" id="createScript" onclick="buyCreateScript()">
Create Script-0
</button>
</div>
<div id="counter">
<p id="counterText">0b</p>
</div>
<div id="tooltip">
<p id="tooltipText">Hover Over Something To Get A Description!</p>
</div>
</div>
CSS
* {
background-color: ;
}
#container {
background-color: grey;
}
#messageBox {
float: center;
background-color: #42cbf4;
}
#message {
text-align: center;
font-family: verdana;
font-size: 18px;
}
#buildings {
float: left;
border-color: black;
border-style: solid;
height: 20em;
width: 10em;
left-margin: 5em;
}
#counter {
border-style: solid;
border-color: black left-margin: 2em;
width: 25em;
}
#tooltip {
border-style: solid;
border-color: black;
display: block;
width: 100%;
position: absolute;
bottom: 0;
width: 100%;
height: 15%;
}
#tooltipText {
text-align: center;
font-family: Verdana;
font-size: 16px;
}
#counterText {
text-align: center;
font-family: Verdana;
font-size: 24px;
}
.btn-primary {
width: 100%;
}
JavaScript
var bytes = 0;
var BPS = 1;
var unit = "b"
var priceIncrease = 1.15;
var singularityAmount = 1;
var singularityBPS = 1
var createScriptAmount = 0;
var createScriptCost = 10;
var createScriptBPS = 3;
setInterval(update, 1000);
function update() {
BPS = (singularityAmount * singularityBPS) + (createScriptAmount * createScriptBPS);
bytes = bytes + BPS
var counter = document.getElementById("counterText");
counter.innerHTML = bytes + unit;
}
function buyCreateScript() {
if(bytes >= createScriptCost ) {
createScriptAmount++;
bytes = bytes - createScriptCost;
createScriptCost = createScriptCost * priceIncrease;
}
}