"Goldmine" - an idle game in 200 lines of pure JavaScript (slicker.me)
from monica_b1998@programming.dev to programming@programming.dev on 03 Aug 2024 11:55
https://programming.dev/post/17671419

#programming

threaded - newest

v9CYKjLeia10dZpz88iU@programming.dev on 03 Aug 2024 12:49 next collapse

cheat codes for console

Infinite wealth javascript score = 100_000_000_000; Open all shafts javascript shaftsOpen = 10; Add 1 worker to all shafts javascript Array(shaftsOpen).fill(0).map((_, i) => (shafts[i].workers.push(new Worker())));

key@lemmy.keychat.org on 03 Aug 2024 13:22 next collapse

It takes like 5 minutes to beat…

v9CYKjLeia10dZpz88iU@programming.dev on 03 Aug 2024 13:50 collapse

but do you have zombie mode?

zombie mode

javascript spritesheetImg.src=“https://i.imgur.com/Frt8JKU.png”

monica_b1998@programming.dev on 03 Aug 2024 14:05 collapse

i’m relieved to see that zombies are willing to perform the same slave labor as humans :-)

MrLLM@ani.social on 03 Aug 2024 20:58 collapse

More cheat codes for console

Instant travel speed for the lift lift.y = 0; lift.speed = 30; Allow up to 100 workers on the first floor shafts[0].max_workers = 100; Allow up to 10 workers per shaft for (let i = 1; i < max_shafts; i++) shafts[i].max_workers = 10; Despawn all workers shafts.forEach((shaft) => { shaft.workers = []; }); Accelerate the game x10 (this might be more power hungry) Array.from(Array(10)).forEach(() => animate()); Get paid $10 for hiring a worker (you pay $5 and receive $10) shafts.forEach((shaft) => shaft.workers.push = function () { score += 10; return Array.prototype.push.apply(this, arguments); }); Cool game OP :)

monica_b1998@programming.dev on 03 Aug 2024 23:43 collapse

thanks!

key@lemmy.keychat.org on 03 Aug 2024 13:23 next collapse

There’s a bug! You can click buttons once after they disappear.

agentsac@lemmy.world on 03 Aug 2024 13:28 next collapse

There’s a weird bug where you can get four workers per shaft. The ‘hire worker’ button at the end of the shaft disappears after you hire your third worker, but if you click where the button was, you will get a fourth worker for free.

monica_b1998@programming.dev on 03 Aug 2024 13:43 next collapse

thanks for letting me know! i’ll have to fix it when i get a chance.

monica_b1998@programming.dev on 04 Aug 2024 03:15 collapse

I found the problem - there should be no “=” in this part of line 222: shaft.workers.length <= shaft.max_workers

i’ll update it on the website tomorrow. thanks for catching that! Somehow I hadn’t tested clicking an invisible button…

PixeIOrange@lemmy.world on 03 Aug 2024 16:17 next collapse

I did it!

<img alt="" src="https://lemmy.world/pictrs/image/9278fbfc-b83e-4e20-a6f2-39f2abea45b0.png">

monica_b1998@programming.dev on 03 Aug 2024 17:01 collapse

congrats!

alqloe@lemmy.dbzer0.com on 03 Aug 2024 17:29 collapse

I put 3000 workers in each shaft and now it lags. pls fix

<img alt="" src="https://lemmy.dbzer0.com/pictrs/image/a3100245-462a-49ed-9936-75407f799c25.webp">

monica_b1998@programming.dev on 03 Aug 2024 17:41 collapse

i see on the screenshot you have a lot of cash, maybe buy a faster processor? ;-)