proper economy, particle fixes
This commit is contained in:
parent
a455575a64
commit
e02b63f13f
5 changed files with 63 additions and 26 deletions
|
@ -1,7 +1,30 @@
|
|||
document.querySelector('.buy').addEventListener('click', () => {
|
||||
if (nothingness < 10) return;
|
||||
nothingness -= 10;
|
||||
function addCube() {
|
||||
cubePos.push([Math.random() * 1000 - 500, Math.random() * 1000 - 500, Math.random() * 30 - 200,
|
||||
Math.random() * 2 - 1, Math.random() * 2 - 1, Math.random() * 2 - 1
|
||||
])
|
||||
})
|
||||
}
|
||||
|
||||
let upgrades = [
|
||||
{
|
||||
'name': 'Set',
|
||||
'price': 10,
|
||||
'exec': addCube
|
||||
}
|
||||
]
|
||||
|
||||
let hud2 = document.querySelector('.hud');
|
||||
|
||||
for (let upgrade of upgrades) {
|
||||
let button = document.createElement("div");
|
||||
button.classList.add('item');
|
||||
button.textContent = `Buy ${upgrade.name} for ${upgrade.price} nil`
|
||||
hud2.appendChild(button);
|
||||
|
||||
button.addEventListener('click', () => {
|
||||
if (nothingness < upgrade.price) return;
|
||||
nothingness -= upgrade.price;
|
||||
upgrade.price *= 1.02;
|
||||
button.textContent = `Buy ${upgrade.name} for ${upgrade.price} nil`
|
||||
upgrade.exec();
|
||||
})
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue