forked from wish13yt/blahaj-simulator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathblahaj.js
77 lines (63 loc) · 2.13 KB
/
blahaj.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
let blahajdisplay = document.getElementById("blahajcount");
let blahajimg = document.getElementById("blahajimg");
let blahaj = 0;
let saved = JSON.parse(localStorage.answer);
blahaj = saved;
localStorage.answer = JSON.stringify(blahaj);
if (blahaj <= 1) {
blahajdisplay.innerHTML = "you currently have: " + blahaj + " blahaj";
}
else if (blahaj >= 2) {
blahajdisplay.innerHTML = "you currently have: " + blahaj + " blahajs";
}
function clicked() {
blahaj++;
if (blahaj == 1) {
blahajdisplay.innerHTML = "you currently have: " + blahaj + " blahaj";
}
else if (blahaj >= 2) {
blahajdisplay.innerHTML = "you currently have: " + blahaj + " blahajs";
}
blahajimg.height = 130;
setTimeout(() => {
setTimeout(() => blahajimg.height = 150, 0);
}, 100);
document.getElementById('clicksound').play();
localStorage.answer = JSON.stringify(blahaj);
}
function updatesmol() {
const smol = document.getElementById("smol-blahajs");
if(blahaj >= 1)
smol.innerHTML = "<img src=\"file (4).png\" alt=\"smol blahaj\" height=\"75\" width=\"75\">".repeat(blahaj - 1);
else
smol.innerHTML = "";
}
function gambling() {
let inputElement = document.getElementById("gamble");
let rawInput = inputElement.value;
let test2 = Number(rawInput);
let gamblerng = Math.floor(Math.random()* 2)
if (blahaj < rawInput ) {
yes.innerHTML = "You can't gamble more blahajs than you have!";
}
else {
if (gamblerng == 1) {
blahaj += test2;
yes.innerHTML = "You won " + test2 + " blahajs! You now have " + blahaj + " blahajs!";
blahajdisplay.innerHTML = "you currently have: " + blahaj + " blahajs";
localStorage.answer = JSON.stringify(blahaj);
}
else {
blahaj -= test2;
yes.innerHTML = "You lost " + test2 + " blahajs. You now have " + blahaj + " blahajs.";
blahajdisplay.innerHTML = "you currently have: " + blahaj + " blahajs";
localStorage.answer = JSON.stringify(blahaj);
}
updatesmol();
}
}
function test() {
blahaj = saved;
}
test();
updatesmol();