-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
151 lines (132 loc) · 4.83 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Game Selection Screen</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" type="image/png" href="favicon.png">
<link rel="stylesheet" href="style.css">
<style>
.game-description {
opacity: 0;
position: absolute;
top: 70%;
left: 50%;
transform: translate(-50%, -50%);
background-color: rgba(255, 255, 255, 0.9);
padding: 15px;
border-radius: 5px;
font-size: 18px;
color: #333;
transition: all 0.3s;
z-index: 1;
}
button {
transition: background-color 0.3s, color 0.3s, transform 0.3s;
}
button:hover {
background-color: #aaa;
color: #111;
transform: scale(1.05);
}
button:hover + .game-description {
opacity: 1;
}
body {
animation: bg-animation 10s infinite;
background-size: 400% 400%;
}
@keyframes bg-animation {
0% { background-position: 0% 50%; }
50% { background-position: 100% 50%; }
100% { background-position: 0% 50%; }
}
#last-played {
text-align: center;
margin-bottom: 20px;
}
</style>
</head>
<body>
<header>
<h1>Choose a Game</h1>
</header>
<section id="last-played">
<h2>Last Played: <span id="last-played-game">None</span></h2>
<button id="play-again" onclick="playAgain()" disabled>Play Again</button>
</section>
<section class="game-selection">
<div class="row">
<button onclick="loadSnakeGame()">Snake Game</button>
<button onclick="loadMoneyTycoonGame()">Money Tycoon Game</button>
<button onclick="loadPaintingGame()">Painting Game</button>
<button onclick="loadNumberGuessingGame()">Number Guessing Game</button>
</div>
<div class="row">
<button onclick="loadBlackjack()">Blackjack</button>
<button onclick="loadRockPaperScissors()">Rock Paper Scissors</button>
<button onclick="loadMinesweeper()">Minesweeper</button>
<button onclick="loadSimonGame()">Simon Game</button>
</div>
</section>
<script>
const lastPlayedGame = localStorage.getItem("lastPlayed");
if (lastPlayedGame) {
document.getElementById("last-played-game").textContent = lastPlayedGame;
document.getElementById("play-again").disabled = false;
}
function loadSnakeGame() {
localStorage.setItem("lastPlayed", "Snake Game");
window.location.href = "Snake Game/SnakeGame.html";
}
function loadMoneyTycoonGame() {
localStorage.setItem("lastPlayed", "Money Tycoon Game");
window.location.href = "Money Tycoon Game/MoneyTycoonGame.html";
}
function loadPaintingGame() {
localStorage.setItem("lastPlayed", "Painting Game");
window.location.href = "Painting Game/PaintingGame.html";
}
function loadNumberGuessingGame() {
localStorage.setItem("lastPlayed", "Number Guessing Game");
window.location.href = "Number Guessing Game/NumberGuessingGame.html";
}
function loadBlackjack() {
localStorage.setItem("lastPlayed", "Blackjack");
window.location.href = "Blackjack/Blackjack.html";
}
function loadRockPaperScissors() {
localStorage.setItem("lastPlayed", "Rock Paper Scissors");
window.location.href = "Rock Paper Scissors/RockPaperScissors.html";
}
function loadMinesweeper() {
localStorage.setItem("lastPlayed", "Minesweeper");
window.location.href = "Minesweeper/Minesweeper.html";
}
function loadSimonGame() {
localStorage.setItem("lastPlayed", "Simon Game");
window.location.href = "Simon game/SimonGame.html";
}
function playAgain() {
const lastPlayed = localStorage.getItem("lastPlayed");
if (lastPlayed === "Snake Game") {
loadSnakeGame();
} else if (lastPlayed === "Money Tycoon Game") {
loadMoneyTycoonGame();
} else if (lastPlayed === "Painting Game") {
loadPaintingGame();
} else if (lastPlayed === "Number Guessing Game") {
loadNumberGuessingGame();
} else if (lastPlayed === "Blackjack") {
loadBlackjack();
} else if (lastPlayed === "Rock Paper Scissors") {
loadRockPaperScissors();
} else if (lastPlayed === "Minesweeper") {
loadMinesweeper();
} else if (lastPlayed === "Simon Game") {
loadSimonGame();
}
}
</script>
</body>
</html>