-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
240 lines (219 loc) · 9.92 KB
/
index.html
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Shiny Rock Miner</title>
<style>
body {
display: flex;
height: 100vh;
margin: 0;
font-family: Arial, sans-serif;
background-image: url('https://i.ytimg.com/vi/ZqFwlWu4MLk/maxresdefault.jpg?sqp=-oaymwEmCIAKENAF8quKqQMa8AEB-AH-CYAC0AWKAgwIABABGEkgGSh_MA8=&rs=AOn4CLBZHi7uK08SYl6uVgE-mDragz0Hhg');
background-size: cover;
background-position: center;
}
#sidebar {
width: 350px;
background-color: rgba(0, 123, 255, 0.8);
color: white;
padding: 20px;
box-shadow: 2px 0 5px rgba(0, 0, 0, 0.5);
}
#main {
display: flex;
flex-direction: column;
align-items: center;
flex: 1;
}
#rock { width: 500px; cursor: pointer; }
#message { color: red; font-weight: bold; margin-top: 20px; display: none; }
h1 { color: purple; }
button {
width: 100%;
padding: 15px;
font-size: 16px;
margin: 5px 0;
cursor: pointer;
}
</style>
</head>
<body oncontextmenu="return false;">
<div id="sidebar">
<h2>Shiny Rocks: <span id="rockCount">0</span></h2>
<button id="upgradeButton">Upgrade Click (Cost: 10 shiny rocks) - Upgrades: <span id="upgradeCount">0</span></button>
<button id="autoClickerButton">Buy Auto Miner (Cost: 50 shiny rocks) - Auto Miners: <span id="autoMinerCount">0</span></button>
<button id="minigameButton">Play a Minigame (Cost: 100 shiny rocks) - Minigames: <span id="minigameCount">0</span></button>
<button id="playGameButton">Playing the Game (Cost: 200 shiny rocks) - Games: <span id="playGameCount">0</span></button>
<button id="saveButton">Save Game</button>
<button id="resetButton">Reset Progress</button>
<div id="message"></div>
</div>
<div id="main">
<h1>Shiny Rock Miner</h1>
<h2>Shiny Rocks: <span id="rockCountAbove">0</span></h2>
<img id="rock" src="https://orig00.deviantart.net/62cb/f/2011/169/1/c/365_day_168_crystals_by_korikian-d3j8n69.png" alt="Shiny Rock">
<h3>Auto Miner Output: <span id="autoClickerOutput">0</span> shiny rocks per second</h3>
</div>
<script>
let rockCount = 0;
let upgradeCost = 10;
let autoMinerCost = 50;
let minigameCost = 100;
let playGameCost = 200;
let clickValue = 1;
let autoMinerValue = 0;
let autoMinerActive = false;
let minigameActive = false;
let playGameActive = false;
let upgradeCount = 0;
let autoMinerCount = 0;
let minigameCount = 0;
let playGameCount = 0;
document.getElementById("rock").addEventListener("click", () => {
rockCount += clickValue;
updateRockCount();
});
document.getElementById("upgradeButton").addEventListener("click", () => {
if (rockCount >= upgradeCost) {
rockCount -= upgradeCost;
clickValue += 1;
upgradeCost = Math.floor(upgradeCost * 1.3);
upgradeCount++;
updateRockCount();
document.getElementById("upgradeButton").innerText = `Upgrade Click (Cost: ${upgradeCost} shiny rocks) - Upgrades: ${upgradeCount}`;
} else {
showMessage("Not enough shiny rocks!");
}
});
document.getElementById("autoClickerButton").addEventListener("click", () => {
if (rockCount >= autoMinerCost) {
rockCount -= autoMinerCost;
autoMinerValue += 1;
autoMinerCount++;
autoMinerCost = Math.floor(autoMinerCost * 1.3);
updateRockCount();
document.getElementById("autoClickerOutput").innerText = autoMinerValue;
document.getElementById("autoClickerButton").innerText = `Buy Auto Miner (Cost: ${autoMinerCost} shiny rocks) - Auto Miners: ${autoMinerCount}`;
if (!autoMinerActive) {
autoMinerActive = true;
setInterval(() => {
rockCount += autoMinerValue;
updateRockCount();
}, 1000);
}
} else {
showMessage("Not enough shiny rocks!");
}
});
document.getElementById("minigameButton").addEventListener("click", () => {
if (rockCount >= minigameCost) {
rockCount -= minigameCost;
minigameActive = true;
minigameCount++;
updateRockCount();
setInterval(() => {
if (minigameActive) {
rockCount += 5;
updateRockCount();
}
}, 1000);
minigameCost = Math.floor(minigameCost * 1.3);
document.getElementById("minigameButton").innerText = `Play a Minigame (Cost: ${minigameCost} shiny rocks) - Minigames: ${minigameCount}`;
} else {
showMessage("Not enough shiny rocks!");
}
});
document.getElementById("playGameButton").addEventListener("click", () => {
if (rockCount >= playGameCost) {
rockCount -= playGameCost;
playGameCount++;
updateRockCount();
setInterval(() => {
if (playGameActive) {
rockCount += 8; // Adds 8 shiny rocks every second
updateRockCount();
}
}, 1000);
playGameCost = Math.floor(playGameCost * 1.3);
document.getElementById("playGameButton").innerText = `Playing the Game (Cost: ${playGameCost} shiny rocks) - Games: ${playGameCount}`;
} else {
showMessage("Not enough shiny rocks!");
}
});
// Save game state to localStorage
function saveGame() {
const gameState = {
rockCount, clickValue, upgradeCost, autoMinerCost, minigameCost, playGameCost,
autoMinerValue, autoMinerCount, minigameCount, playGameCount, upgradeCount,
autoMinerActive, minigameActive, playGameActive
};
localStorage.setItem("gameState", JSON.stringify(gameState));
}
// Reset game state
document.getElementById("resetButton").addEventListener("click", () => {
if (confirm("Are you sure you want to reset your progress?")) {
resetGame();
showMessage("Game progress reset!");
}
});
function resetGame() {
rockCount = 0;
clickValue = 1;
upgradeCost = 10;
autoMinerCost = 50;
minigameCost = 100;
playGameCost = 200;
autoMinerValue = 0;
autoMinerCount = 0;
minigameCount = 0;
playGameCount = 0;
upgradeCount = 0;
localStorage.removeItem("gameState"); // Clear the saved game
updateUI();
}
function updateRockCount() {
document.getElementById("rockCount").innerText = rockCount;
document.getElementById("rockCountAbove").innerText = rockCount;
}
function updateUI() {
document.getElementById("upgradeButton").innerText = `Upgrade Click (Cost: ${upgradeCost} shiny rocks) - Upgrades: ${upgradeCount}`;
document.getElementById("autoClickerButton").innerText = `Buy Auto Miner (Cost: ${autoMinerCost} shiny rocks) - Auto Miners: ${autoMinerCount}`;
document.getElementById("autoClickerOutput").innerText = autoMinerValue;
document.getElementById("minigameButton").innerText = `Play a Minigame (Cost: ${minigameCost} shiny rocks) - Minigames: ${minigameCount}`;
document.getElementById("playGameButton").innerText = `Playing the Game (Cost: ${playGameCost} shiny rocks) - Games: ${playGameCount}`;
updateRockCount();
}
function showMessage(message) {
const messageDiv = document.getElementById("message");
messageDiv.innerText = message;
messageDiv.style.display = "block";
setTimeout(() => {
messageDiv.style.display = "none";
}, 3000);
}
setInterval(saveGame, 5000); // Auto-save every 5 seconds
window.onload = () => {
const savedGameState = JSON.parse(localStorage.getItem("gameState"));
if (savedGameState) {
rockCount = savedGameState.rockCount;
clickValue = savedGameState.clickValue;
upgradeCost = savedGameState.upgradeCost;
autoMinerCost = savedGameState.autoMinerCost;
minigameCost = savedGameState.minigameCost;
playGameCost = savedGameState.playGameCost;
autoMinerValue = savedGameState.autoMinerValue;
autoMinerCount = savedGameState.autoMinerCount;
minigameCount = savedGameState.minigameCount;
playGameCount = savedGameState.playGameCount;
upgradeCount = savedGameState.upgradeCount;
autoMinerActive = savedGameState.autoMinerActive;
minigameActive = savedGameState.minigameActive;
playGameActive = savedGameState.playGameActive;
updateUI();
}
};
</script>
</body>
</html>