proper economy, particle fixes

This commit is contained in:
biglyderv 2025-03-05 13:24:24 -05:00
parent a455575a64
commit e02b63f13f
Signed by: biglyderv
GPG key ID: 0E2EB0B4CD7397B5
5 changed files with 63 additions and 26 deletions

View file

@ -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();
})
}