create-template-html-css 2.0.2 → 2.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cli.js +1 -1
- package/package.json +1 -1
- package/src/generator.js +16 -0
- package/templates/blackjack/script.js +9 -9
- package/templates/breakout/script.js +6 -6
- package/templates/connect-four/script.js +5 -5
- package/templates/dice-game/script.js +20 -20
- package/templates/flappy-bird/script.js +10 -10
- package/templates/pong/script.js +8 -8
- package/templates/slot-machine/script.js +6 -6
- package/templates/tetris/script.js +5 -5
package/bin/cli.js
CHANGED
package/package.json
CHANGED
package/src/generator.js
CHANGED
|
@@ -241,6 +241,22 @@ const VALID_COMPONENTS = [
|
|
|
241
241
|
"login",
|
|
242
242
|
"register",
|
|
243
243
|
"skeleton",
|
|
244
|
+
"tic-tac-toe",
|
|
245
|
+
"memory-game",
|
|
246
|
+
"snake-game",
|
|
247
|
+
"guess-number",
|
|
248
|
+
"game-2048",
|
|
249
|
+
"whack-a-mole",
|
|
250
|
+
"simon-says",
|
|
251
|
+
"rock-paper-scissors",
|
|
252
|
+
"breakout",
|
|
253
|
+
"tetris",
|
|
254
|
+
"flappy-bird",
|
|
255
|
+
"connect-four",
|
|
256
|
+
"blackjack",
|
|
257
|
+
"slot-machine",
|
|
258
|
+
"dice-game",
|
|
259
|
+
"pong",
|
|
244
260
|
];
|
|
245
261
|
|
|
246
262
|
// Security: Sanitize filename to prevent path traversal
|
|
@@ -156,7 +156,7 @@ document.querySelectorAll('.bet-btn').forEach(btn => {
|
|
|
156
156
|
updateDisplay();
|
|
157
157
|
document.getElementById('dealBtn').disabled = false;
|
|
158
158
|
} else {
|
|
159
|
-
showMessage('
|
|
159
|
+
showMessage('Not enough credits!', 'error');
|
|
160
160
|
}
|
|
161
161
|
});
|
|
162
162
|
});
|
|
@@ -166,7 +166,7 @@ document.getElementById('dealBtn').addEventListener('click', startGame);
|
|
|
166
166
|
|
|
167
167
|
function startGame() {
|
|
168
168
|
if (gameState.currentBet === 0) {
|
|
169
|
-
showMessage('
|
|
169
|
+
showMessage('Choose a bet first!', 'error');
|
|
170
170
|
return;
|
|
171
171
|
}
|
|
172
172
|
|
|
@@ -261,7 +261,7 @@ document.getElementById('doubleBtn').addEventListener('click', () => {
|
|
|
261
261
|
stand();
|
|
262
262
|
}
|
|
263
263
|
} else {
|
|
264
|
-
showMessage('
|
|
264
|
+
showMessage('Not enough credits to double down!', 'error');
|
|
265
265
|
}
|
|
266
266
|
});
|
|
267
267
|
|
|
@@ -301,23 +301,23 @@ function endGame(result) {
|
|
|
301
301
|
switch (result) {
|
|
302
302
|
case 'blackjack':
|
|
303
303
|
winAmount = Math.floor(gameState.currentBet * 2.5); // 3:2 payout
|
|
304
|
-
message = '🎉 BLACKJACK!
|
|
304
|
+
message = '🎉 BLACKJACK! You win!';
|
|
305
305
|
gameState.wins++;
|
|
306
306
|
break;
|
|
307
307
|
case 'win':
|
|
308
308
|
winAmount = gameState.currentBet * 2;
|
|
309
|
-
message = '🎉
|
|
309
|
+
message = '🎉 You won!';
|
|
310
310
|
gameState.wins++;
|
|
311
311
|
break;
|
|
312
312
|
case 'lose':
|
|
313
|
-
message = '😢
|
|
313
|
+
message = '😢 You lost!';
|
|
314
314
|
break;
|
|
315
315
|
case 'push':
|
|
316
316
|
winAmount = gameState.currentBet;
|
|
317
|
-
message = '🤝
|
|
317
|
+
message = '🤝 Push!';
|
|
318
318
|
break;
|
|
319
319
|
case 'bust':
|
|
320
|
-
message = '💥
|
|
320
|
+
message = '💥 Busted! You lost!';
|
|
321
321
|
break;
|
|
322
322
|
}
|
|
323
323
|
|
|
@@ -337,7 +337,7 @@ function endGame(result) {
|
|
|
337
337
|
// Check if out of credits
|
|
338
338
|
if (gameState.credits < 10) {
|
|
339
339
|
setTimeout(() => {
|
|
340
|
-
alert('
|
|
340
|
+
alert('Out of credits! Receiving 1000 new credits.');
|
|
341
341
|
gameState.credits = 1000;
|
|
342
342
|
updateDisplay();
|
|
343
343
|
saveGame();
|
|
@@ -263,11 +263,11 @@ function gameOver() {
|
|
|
263
263
|
ctx.fillStyle = '#FFFFFF';
|
|
264
264
|
ctx.font = 'bold 48px Arial';
|
|
265
265
|
ctx.textAlign = 'center';
|
|
266
|
-
ctx.fillText('
|
|
266
|
+
ctx.fillText('Game Over!', canvas.width / 2, canvas.height / 2 - 40);
|
|
267
267
|
|
|
268
268
|
ctx.font = '24px Arial';
|
|
269
|
-
ctx.fillText(
|
|
270
|
-
ctx.fillText('
|
|
269
|
+
ctx.fillText(`Final Score: ${gameState.score}`, canvas.width / 2, canvas.height / 2 + 20);
|
|
270
|
+
ctx.fillText('Click "Reset" to restart', canvas.width / 2, canvas.height / 2 + 60);
|
|
271
271
|
|
|
272
272
|
document.getElementById('startBtn').disabled = false;
|
|
273
273
|
document.getElementById('pauseBtn').disabled = true;
|
|
@@ -306,7 +306,7 @@ function draw() {
|
|
|
306
306
|
ctx.fillStyle = '#FFFFFF';
|
|
307
307
|
ctx.font = 'bold 36px Arial';
|
|
308
308
|
ctx.textAlign = 'center';
|
|
309
|
-
ctx.fillText('
|
|
309
|
+
ctx.fillText('Game Paused', canvas.width / 2, canvas.height / 2);
|
|
310
310
|
}
|
|
311
311
|
}
|
|
312
312
|
|
|
@@ -349,7 +349,7 @@ function startGame() {
|
|
|
349
349
|
// Pause game
|
|
350
350
|
function pauseGame() {
|
|
351
351
|
gameState.paused = !gameState.paused;
|
|
352
|
-
document.getElementById('pauseBtn').textContent = gameState.paused ? '
|
|
352
|
+
document.getElementById('pauseBtn').textContent = gameState.paused ? 'Resume' : 'Pause';
|
|
353
353
|
}
|
|
354
354
|
|
|
355
355
|
// Reset game
|
|
@@ -372,7 +372,7 @@ function resetGame() {
|
|
|
372
372
|
|
|
373
373
|
document.getElementById('startBtn').disabled = false;
|
|
374
374
|
document.getElementById('pauseBtn').disabled = true;
|
|
375
|
-
document.getElementById('pauseBtn').textContent = '
|
|
375
|
+
document.getElementById('pauseBtn').textContent = 'Pause';
|
|
376
376
|
}
|
|
377
377
|
|
|
378
378
|
// Event listeners
|
|
@@ -331,15 +331,15 @@ function endGame(winner) {
|
|
|
331
331
|
gameState.score1++;
|
|
332
332
|
localStorage.setItem('connect4Score1', gameState.score1);
|
|
333
333
|
updateScore();
|
|
334
|
-
showMessage('🎉
|
|
334
|
+
showMessage('🎉 Player 1 wins!', 'player1');
|
|
335
335
|
} else if (winner === PLAYER2) {
|
|
336
336
|
gameState.score2++;
|
|
337
337
|
localStorage.setItem('connect4Score2', gameState.score2);
|
|
338
338
|
updateScore();
|
|
339
|
-
const message = gameState.gameMode === 'pvc' ? '🤖
|
|
339
|
+
const message = gameState.gameMode === 'pvc' ? '🤖 Computer wins!' : '🎉 Player 2 wins!';
|
|
340
340
|
showMessage(message, 'player2');
|
|
341
341
|
} else {
|
|
342
|
-
showMessage('🤝
|
|
342
|
+
showMessage('🤝 Draw!', 'draw');
|
|
343
343
|
}
|
|
344
344
|
}
|
|
345
345
|
|
|
@@ -354,10 +354,10 @@ function showMessage(text, type) {
|
|
|
354
354
|
function updateTurnIndicator() {
|
|
355
355
|
const turnIndicator = document.getElementById('turnIndicator');
|
|
356
356
|
if (gameState.currentPlayer === PLAYER1) {
|
|
357
|
-
turnIndicator.textContent = '
|
|
357
|
+
turnIndicator.textContent = 'Player 1\'s Turn';
|
|
358
358
|
turnIndicator.className = 'player1-turn';
|
|
359
359
|
} else {
|
|
360
|
-
const text = gameState.gameMode === 'pvc' ? '
|
|
360
|
+
const text = gameState.gameMode === 'pvc' ? 'Computer\'s Turn' : 'Player 2\'s Turn';
|
|
361
361
|
turnIndicator.textContent = text;
|
|
362
362
|
turnIndicator.className = 'player2-turn';
|
|
363
363
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// Game state
|
|
2
2
|
let gameState = {
|
|
3
3
|
players: [
|
|
4
|
-
{ total: 0, current: 0, name: '
|
|
5
|
-
{ total: 0, current: 0, name: '
|
|
4
|
+
{ total: 0, current: 0, name: 'Player 1' },
|
|
5
|
+
{ total: 0, current: 0, name: 'Player 2' }
|
|
6
6
|
],
|
|
7
7
|
currentPlayer: 0,
|
|
8
8
|
gameActive: true,
|
|
@@ -34,13 +34,13 @@ function updateDisplay() {
|
|
|
34
34
|
if (gameState.currentPlayer === 0) {
|
|
35
35
|
player1Card.classList.add('active');
|
|
36
36
|
player2Card.classList.remove('active');
|
|
37
|
-
player1Card.querySelector('.current-turn').textContent = '
|
|
38
|
-
player2Card.querySelector('.current-turn').textContent = '
|
|
37
|
+
player1Card.querySelector('.current-turn').textContent = 'Your Turn!';
|
|
38
|
+
player2Card.querySelector('.current-turn').textContent = 'Wait...';
|
|
39
39
|
} else {
|
|
40
40
|
player1Card.classList.remove('active');
|
|
41
41
|
player2Card.classList.add('active');
|
|
42
|
-
player1Card.querySelector('.current-turn').textContent = '
|
|
43
|
-
player2Card.querySelector('.current-turn').textContent = gameState.gameMode === 'pvc' ? '
|
|
42
|
+
player1Card.querySelector('.current-turn').textContent = 'Wait...';
|
|
43
|
+
player2Card.querySelector('.current-turn').textContent = gameState.gameMode === 'pvc' ? 'Computer\'s Turn...' : 'Your Turn!';
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
|
|
@@ -96,7 +96,7 @@ document.getElementById('rollBtn').addEventListener('click', async () => {
|
|
|
96
96
|
if (roll === 1) {
|
|
97
97
|
// Lost turn
|
|
98
98
|
gameState.players[gameState.currentPlayer].current = 0;
|
|
99
|
-
showMessage(`💥
|
|
99
|
+
showMessage(`💥 Rolled 1! You lost all turn points!`, 'error');
|
|
100
100
|
|
|
101
101
|
await new Promise(resolve => setTimeout(resolve, 1500));
|
|
102
102
|
switchPlayer();
|
|
@@ -104,7 +104,7 @@ document.getElementById('rollBtn').addEventListener('click', async () => {
|
|
|
104
104
|
// Add to current
|
|
105
105
|
gameState.players[gameState.currentPlayer].current += roll;
|
|
106
106
|
updateDisplay();
|
|
107
|
-
showMessage(`🎲
|
|
107
|
+
showMessage(`🎲 Rolled ${roll}!`, 'info');
|
|
108
108
|
}
|
|
109
109
|
});
|
|
110
110
|
|
|
@@ -115,7 +115,7 @@ document.getElementById('holdBtn').addEventListener('click', () => {
|
|
|
115
115
|
const player = gameState.players[gameState.currentPlayer];
|
|
116
116
|
|
|
117
117
|
if (player.current === 0) {
|
|
118
|
-
showMessage('
|
|
118
|
+
showMessage('Nothing to save! Roll the dice first.', 'error');
|
|
119
119
|
return;
|
|
120
120
|
}
|
|
121
121
|
|
|
@@ -128,7 +128,7 @@ document.getElementById('holdBtn').addEventListener('click', () => {
|
|
|
128
128
|
if (player.total >= 100) {
|
|
129
129
|
endGame();
|
|
130
130
|
} else {
|
|
131
|
-
showMessage(`✅
|
|
131
|
+
showMessage(`✅ Saved! ${player.total} points total.`, 'success');
|
|
132
132
|
setTimeout(() => {
|
|
133
133
|
switchPlayer();
|
|
134
134
|
}, 1000);
|
|
@@ -161,7 +161,7 @@ async function computerTurn() {
|
|
|
161
161
|
|
|
162
162
|
if (roll === 1) {
|
|
163
163
|
player.current = 0;
|
|
164
|
-
showMessage(`🤖
|
|
164
|
+
showMessage(`🤖 Computer rolled 1! Lost the turn!`, 'error');
|
|
165
165
|
await new Promise(resolve => setTimeout(resolve, 1500));
|
|
166
166
|
switchPlayer();
|
|
167
167
|
return;
|
|
@@ -169,7 +169,7 @@ async function computerTurn() {
|
|
|
169
169
|
|
|
170
170
|
player.current += roll;
|
|
171
171
|
updateDisplay();
|
|
172
|
-
showMessage(`🤖
|
|
172
|
+
showMessage(`🤖 Computer rolled ${roll}!`, 'info');
|
|
173
173
|
|
|
174
174
|
// AI decision logic
|
|
175
175
|
const shouldHold =
|
|
@@ -189,7 +189,7 @@ async function computerTurn() {
|
|
|
189
189
|
return;
|
|
190
190
|
}
|
|
191
191
|
|
|
192
|
-
showMessage(`🤖
|
|
192
|
+
showMessage(`🤖 Computer saves ${player.total} points!`, 'success');
|
|
193
193
|
await new Promise(resolve => setTimeout(resolve, 1500));
|
|
194
194
|
switchPlayer();
|
|
195
195
|
return;
|
|
@@ -203,10 +203,10 @@ function endGame() {
|
|
|
203
203
|
|
|
204
204
|
const winner = gameState.players[gameState.currentPlayer];
|
|
205
205
|
const winnerName = gameState.currentPlayer === 0 ?
|
|
206
|
-
'
|
|
207
|
-
(gameState.gameMode === 'pvc' ? '
|
|
206
|
+
'Player 1' :
|
|
207
|
+
(gameState.gameMode === 'pvc' ? 'Computer' : 'Player 2');
|
|
208
208
|
|
|
209
|
-
showMessage(`🎉 ${winnerName}
|
|
209
|
+
showMessage(`🎉 ${winnerName} won with ${winner.total} points!`, 'success');
|
|
210
210
|
|
|
211
211
|
// Celebrate
|
|
212
212
|
celebrate();
|
|
@@ -217,8 +217,8 @@ document.getElementById('newGameBtn').addEventListener('click', newGame);
|
|
|
217
217
|
|
|
218
218
|
function newGame() {
|
|
219
219
|
gameState.players = [
|
|
220
|
-
{ total: 0, current: 0, name: '
|
|
221
|
-
{ total: 0, current: 0, name: '
|
|
220
|
+
{ total: 0, current: 0, name: 'Player 1' },
|
|
221
|
+
{ total: 0, current: 0, name: 'Player 2' }
|
|
222
222
|
];
|
|
223
223
|
gameState.currentPlayer = 0;
|
|
224
224
|
gameState.gameActive = true;
|
|
@@ -241,9 +241,9 @@ document.querySelectorAll('.mode-btn').forEach(btn => {
|
|
|
241
241
|
|
|
242
242
|
// Update player 2 name
|
|
243
243
|
if (gameState.gameMode === 'pvc') {
|
|
244
|
-
document.querySelector('#player2Card h3').textContent = '🤖
|
|
244
|
+
document.querySelector('#player2Card h3').textContent = '🤖 Computer';
|
|
245
245
|
} else {
|
|
246
|
-
document.querySelector('#player2Card h3').textContent = '👤
|
|
246
|
+
document.querySelector('#player2Card h3').textContent = '👤 Player 2';
|
|
247
247
|
}
|
|
248
248
|
|
|
249
249
|
newGame();
|
|
@@ -279,15 +279,15 @@ function gameOver() {
|
|
|
279
279
|
ctx.fillText('Game Over!', canvas.width / 2, canvas.height / 2 - 50);
|
|
280
280
|
|
|
281
281
|
ctx.font = '24px Arial';
|
|
282
|
-
ctx.strokeText(
|
|
283
|
-
ctx.fillText(
|
|
282
|
+
ctx.strokeText(`Score: ${gameState.score}`, canvas.width / 2, canvas.height / 2 + 10);
|
|
283
|
+
ctx.fillText(`Score: ${gameState.score}`, canvas.width / 2, canvas.height / 2 + 10);
|
|
284
284
|
|
|
285
|
-
ctx.strokeText(
|
|
286
|
-
ctx.fillText(
|
|
285
|
+
ctx.strokeText(`High Score: ${gameState.highScore}`, canvas.width / 2, canvas.height / 2 + 50);
|
|
286
|
+
ctx.fillText(`High Score: ${gameState.highScore}`, canvas.width / 2, canvas.height / 2 + 50);
|
|
287
287
|
|
|
288
288
|
ctx.font = '18px Arial';
|
|
289
|
-
ctx.strokeText('
|
|
290
|
-
ctx.fillText('
|
|
289
|
+
ctx.strokeText('Click "Reset" to restart', canvas.width / 2, canvas.height / 2 + 100);
|
|
290
|
+
ctx.fillText('Click "Reset" to restart', canvas.width / 2, canvas.height / 2 + 100);
|
|
291
291
|
|
|
292
292
|
document.getElementById('startBtn').disabled = false;
|
|
293
293
|
}
|
|
@@ -318,11 +318,11 @@ function drawStartScreen() {
|
|
|
318
318
|
ctx.fillText('🐦 Flappy Bird', canvas.width / 2, canvas.height / 2 - 40);
|
|
319
319
|
|
|
320
320
|
ctx.font = '20px Arial';
|
|
321
|
-
ctx.strokeText('
|
|
322
|
-
ctx.fillText('
|
|
321
|
+
ctx.strokeText('Click "Start Game"', canvas.width / 2, canvas.height / 2 + 20);
|
|
322
|
+
ctx.fillText('Click "Start Game"', canvas.width / 2, canvas.height / 2 + 20);
|
|
323
323
|
|
|
324
|
-
ctx.strokeText('
|
|
325
|
-
ctx.fillText('
|
|
324
|
+
ctx.strokeText('to begin!', canvas.width / 2, canvas.height / 2 + 50);
|
|
325
|
+
ctx.fillText('to begin!', canvas.width / 2, canvas.height / 2 + 50);
|
|
326
326
|
}
|
|
327
327
|
|
|
328
328
|
// Game loop
|
package/templates/pong/script.js
CHANGED
|
@@ -89,10 +89,10 @@ document.querySelectorAll('.mode-btn').forEach(btn => {
|
|
|
89
89
|
|
|
90
90
|
// Update player 2 name
|
|
91
91
|
if (gameState.gameMode === 'pvc') {
|
|
92
|
-
document.getElementById('player2Name').textContent = '🤖
|
|
92
|
+
document.getElementById('player2Name').textContent = '🤖 Computer';
|
|
93
93
|
document.querySelector('.difficulty-selector').style.display = 'flex';
|
|
94
94
|
} else {
|
|
95
|
-
document.getElementById('player2Name').textContent = '👤
|
|
95
|
+
document.getElementById('player2Name').textContent = '👤 Player 2';
|
|
96
96
|
document.querySelector('.difficulty-selector').style.display = 'none';
|
|
97
97
|
}
|
|
98
98
|
});
|
|
@@ -251,7 +251,7 @@ function draw() {
|
|
|
251
251
|
ctx.fillStyle = '#FFFFFF';
|
|
252
252
|
ctx.font = 'bold 36px Arial';
|
|
253
253
|
ctx.textAlign = 'center';
|
|
254
|
-
ctx.fillText('
|
|
254
|
+
ctx.fillText('Game Paused', canvas.width / 2, canvas.height / 2);
|
|
255
255
|
}
|
|
256
256
|
}
|
|
257
257
|
|
|
@@ -288,10 +288,10 @@ function endGame(winner) {
|
|
|
288
288
|
gameState.running = false;
|
|
289
289
|
|
|
290
290
|
const winnerName = winner === 1 ?
|
|
291
|
-
'
|
|
292
|
-
(gameState.gameMode === 'pvc' ? '
|
|
291
|
+
'Player 1' :
|
|
292
|
+
(gameState.gameMode === 'pvc' ? 'Computer' : 'Player 2');
|
|
293
293
|
|
|
294
|
-
showMessage(`🎉 ${winnerName}
|
|
294
|
+
showMessage(`🎉 ${winnerName} wins ${gameState.winningScore} - ${winner === 1 ? gameState.score2 : gameState.score1}!`, 'success');
|
|
295
295
|
|
|
296
296
|
document.getElementById('startBtn').disabled = false;
|
|
297
297
|
document.getElementById('pauseBtn').disabled = true;
|
|
@@ -325,7 +325,7 @@ document.getElementById('pauseBtn').addEventListener('click', pauseGame);
|
|
|
325
325
|
|
|
326
326
|
function pauseGame() {
|
|
327
327
|
gameState.paused = !gameState.paused;
|
|
328
|
-
document.getElementById('pauseBtn').textContent = gameState.paused ? '
|
|
328
|
+
document.getElementById('pauseBtn').textContent = gameState.paused ? 'Resume' : 'Pause';
|
|
329
329
|
}
|
|
330
330
|
|
|
331
331
|
// Reset game
|
|
@@ -347,7 +347,7 @@ function resetGame() {
|
|
|
347
347
|
|
|
348
348
|
document.getElementById('startBtn').disabled = false;
|
|
349
349
|
document.getElementById('pauseBtn').disabled = true;
|
|
350
|
-
document.getElementById('pauseBtn').textContent = '
|
|
350
|
+
document.getElementById('pauseBtn').textContent = 'Pause';
|
|
351
351
|
document.getElementById('resultMessage').textContent = '';
|
|
352
352
|
}
|
|
353
353
|
|
|
@@ -72,7 +72,7 @@ async function spin() {
|
|
|
72
72
|
if (gameState.spinning) return;
|
|
73
73
|
|
|
74
74
|
if (gameState.credits < gameState.bet) {
|
|
75
|
-
showMessage('
|
|
75
|
+
showMessage('Not enough credits!', 'error');
|
|
76
76
|
return;
|
|
77
77
|
}
|
|
78
78
|
|
|
@@ -105,7 +105,7 @@ async function spin() {
|
|
|
105
105
|
// Check if out of credits
|
|
106
106
|
if (gameState.credits < 10) {
|
|
107
107
|
setTimeout(() => {
|
|
108
|
-
alert('
|
|
108
|
+
alert('Out of credits! Receiving 1000 new credits.');
|
|
109
109
|
gameState.credits = 1000;
|
|
110
110
|
updateDisplay();
|
|
111
111
|
saveGame();
|
|
@@ -171,18 +171,18 @@ function checkWin(results) {
|
|
|
171
171
|
let type = 'success';
|
|
172
172
|
|
|
173
173
|
if (first.icon === '💰') {
|
|
174
|
-
message = `🎉
|
|
174
|
+
message = `🎉 Jackpot! You won ${winAmount} credits! 🎉`;
|
|
175
175
|
type = 'jackpot';
|
|
176
176
|
celebrate();
|
|
177
177
|
} else {
|
|
178
|
-
message = `🎊
|
|
178
|
+
message = `🎊 You Win! +${winAmount} credits!`;
|
|
179
179
|
}
|
|
180
180
|
|
|
181
181
|
showMessage(message, type);
|
|
182
182
|
} else if (first.icon === second.icon || second.icon === third.icon || first.icon === third.icon) {
|
|
183
|
-
showMessage('
|
|
183
|
+
showMessage('Almost! Two matching symbols!', 'info');
|
|
184
184
|
} else {
|
|
185
|
-
showMessage('
|
|
185
|
+
showMessage('Try again!', 'info');
|
|
186
186
|
}
|
|
187
187
|
|
|
188
188
|
updateDisplay();
|
|
@@ -273,10 +273,10 @@ function gameOver() {
|
|
|
273
273
|
ctx.fillStyle = '#FFFFFF';
|
|
274
274
|
ctx.font = 'bold 36px Arial';
|
|
275
275
|
ctx.textAlign = 'center';
|
|
276
|
-
ctx.fillText('
|
|
276
|
+
ctx.fillText('Game Over!', canvas.width / 2, canvas.height / 2 - 30);
|
|
277
277
|
|
|
278
278
|
ctx.font = '20px Arial';
|
|
279
|
-
ctx.fillText(
|
|
279
|
+
ctx.fillText(`Score: ${gameState.score}`, canvas.width / 2, canvas.height / 2 + 10);
|
|
280
280
|
|
|
281
281
|
document.getElementById('startBtn').disabled = false;
|
|
282
282
|
document.getElementById('pauseBtn').disabled = true;
|
|
@@ -324,7 +324,7 @@ function draw() {
|
|
|
324
324
|
ctx.fillStyle = '#FFFFFF';
|
|
325
325
|
ctx.font = 'bold 28px Arial';
|
|
326
326
|
ctx.textAlign = 'center';
|
|
327
|
-
ctx.fillText('
|
|
327
|
+
ctx.fillText('Game Paused', canvas.width / 2, canvas.height / 2);
|
|
328
328
|
}
|
|
329
329
|
}
|
|
330
330
|
|
|
@@ -408,7 +408,7 @@ function startGame() {
|
|
|
408
408
|
// Pause game
|
|
409
409
|
function pauseGame() {
|
|
410
410
|
gameState.paused = !gameState.paused;
|
|
411
|
-
document.getElementById('pauseBtn').textContent = gameState.paused ? '
|
|
411
|
+
document.getElementById('pauseBtn').textContent = gameState.paused ? 'Resume' : 'Pause';
|
|
412
412
|
}
|
|
413
413
|
|
|
414
414
|
// Reset game
|
|
@@ -432,7 +432,7 @@ function resetGame() {
|
|
|
432
432
|
|
|
433
433
|
document.getElementById('startBtn').disabled = false;
|
|
434
434
|
document.getElementById('pauseBtn').disabled = true;
|
|
435
|
-
document.getElementById('pauseBtn').textContent = '
|
|
435
|
+
document.getElementById('pauseBtn').textContent = 'Pause';
|
|
436
436
|
}
|
|
437
437
|
|
|
438
438
|
// Event listeners
|