Skip to content

Commit 4c501ae

Browse files
author
Brigit Murtaugh
committed
Initial jokes
1 parent 9e35738 commit 4c501ae

1 file changed

Lines changed: 33 additions & 8 deletions

File tree

frogger-game.html

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,39 +30,49 @@ <h2 class="mb-4"><a href="#frogger-game" id="frogger-game">Frogger Game</a></h2>
3030
road: '#252540',
3131
safe: '#222c37',
3232
line: '#0078D4',
33-
desc: 'Setting up your dev container...'
33+
desc: 'Setting up your dev container...',
34+
joke: 'Why did the dev container break up with the old environment?',
35+
punchline: 'Because it needed more space!'
3436
},
3537
{
3638
name: 'Install',
3739
bg: '#1e2f1e',
3840
road: '#2a4025',
3941
safe: '#234022',
4042
line: '#4CAF50',
41-
desc: 'Installing dependencies...'
43+
desc: 'Installing dependencies...',
44+
joke: 'Why do dev containers love npm install?',
45+
punchline: 'Because they like to keep their packages contained!'
4246
},
4347
{
4448
name: 'Build',
4549
bg: '#2f1e1e',
4650
road: '#402525',
4751
safe: '#402222',
4852
line: '#FF9800',
49-
desc: 'Building your project...'
53+
desc: 'Building your project...',
54+
joke: 'Why did the build step get invited to the party?',
55+
punchline: 'Because it always brings everything together!'
5056
},
5157
{
5258
name: 'Test',
5359
bg: '#1e2f2f',
5460
road: '#254040',
5561
safe: '#224040',
5662
line: '#00BCD4',
57-
desc: 'Running tests...'
63+
desc: 'Running tests...',
64+
joke: 'Why did the test runner sit in the dev container?',
65+
punchline: 'To make sure everything was isolated!'
5866
},
5967
{
6068
name: 'Deploy',
6169
bg: '#2f2f1e',
6270
road: '#404025',
6371
safe: '#404022',
6472
line: '#FFC107',
65-
desc: 'Deploying to production!'
73+
desc: 'Deploying to production!',
74+
joke: 'Why was the dev container so calm during deployment?',
75+
punchline: 'Because it knew it could always roll back!'
6676
}
6777
];
6878

@@ -219,14 +229,17 @@ <h2 class="mb-4"><a href="#frogger-game" id="frogger-game">Frogger Game</a></h2>
219229
}
220230

221231
let advancingLevel = false;
232+
let showPunchline = false;
222233
function checkWin() {
223234
if (frog.y === 0 && !advancingLevel) {
224235
if (level < maxLevel) {
225236
advancingLevel = true;
237+
showPunchline = true;
226238
setTimeout(() => {
239+
showPunchline = false;
227240
resetGame(level + 1);
228241
advancingLevel = false;
229-
}, 800);
242+
}, 1500); // Show punchline for 1.5s
230243
} else {
231244
win = true;
232245
gameOver = true;
@@ -280,13 +293,25 @@ <h2 class="mb-4"><a href="#frogger-game" id="frogger-game">Frogger Game</a></h2>
280293
// Draw theme description
281294
ctx.font = 'italic 14px sans-serif';
282295
ctx.fillText(levelTheme.desc, 48, 54);
296+
// Draw dev container joke setup in the empty space within the game board (row 2)
297+
ctx.font = 'bold 15px sans-serif';
298+
ctx.fillStyle = '#FFD700';
299+
ctx.textAlign = 'center';
300+
// Place the joke in the center of the second row (not at the very top)
301+
ctx.fillText(levelTheme.joke, canvas.width / 2, grid + grid / 2);
283302
drawFrog();
284303
drawCars();
285-
if (gameOver) {
304+
if (gameOver || showPunchline) {
286305
ctx.fillStyle = win ? 'lime' : 'red';
287306
ctx.font = 'bold 32px sans-serif';
288307
ctx.textAlign = 'center';
289-
ctx.fillText(win ? 'You Win!' : 'Game Over', canvas.width / 2, canvas.height / 2);
308+
ctx.fillText(win ? 'You Win!' : (showPunchline ? 'Level Complete!' : 'Game Over'), canvas.width / 2, canvas.height / 2);
309+
// Show the punchline below the win/level complete message
310+
if (win || showPunchline) {
311+
ctx.font = 'bold 18px sans-serif';
312+
ctx.fillStyle = '#FFD700';
313+
ctx.fillText(levelTheme.punchline, canvas.width / 2, canvas.height / 2 + 40);
314+
}
290315
}
291316
}
292317

0 commit comments

Comments
 (0)