Skip to content

Commit

Permalink
Add instructions. Fix stop.
Browse files Browse the repository at this point in the history
  • Loading branch information
ranbo committed May 28, 2024
1 parent ddd3bc5 commit 21472f2
Show file tree
Hide file tree
Showing 10 changed files with 185 additions and 39 deletions.
2 changes: 2 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

The Adam song is free to use as part of this game, but all other rights are reserved.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
Expand Down
47 changes: 41 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,50 @@
The Adam Game!
# The Adam Game!

## Instructions:

* Click each "Adam" as it appears.
* Clicking faster earns bonus points.
* Turbo-auto-click is enabled after clearing the Adams from the first verse,
so you can just move over the Adams to clear them.
* After 64 points, all scores are multiplied by 1000!
* The final "Adummmmmm" is worth 100,000 points, but you have to click it.

## Back story:

Isabel was our foreign exchange student from Spain.
She never had an older brother to torment, so when
we asked her to go downstairs to tell Adam it was time for dinner,
she took great delight in calling out "Adam! Adam!
A-DUM! A-DUM! Adamadamadamadamadam!!!"
She never had an older brother to torment, so when we asked her
to go downstairs to tell our son Adam that it was time for dinner,
she took great delight in calling out "Adam! Adam! A-DUM! A-DUM!
Adamadamadamadamadam!!!"

Adam was always very chill in his response to this.

One day at a dinner for the exchange students, Adam, Isabel and I
were standing in line to eat, and Isabel turned to Adam and said,
"Adamadamadamadamadam".

Meanwhile, Adam calmly replied, "Yes? May I help you?".

So I decided to make a song about it. Adam said, "You can't have too many Adams in a song."
I replied, "We'll see."

After writing the ground-breaking lyrics and recording a first draft
of the song, I had Isabel sing her part. Then I invited Adam in to
record him. "Say 'Yes?'", I told him, and he did so. Then I said,
"Say 'Oh, ok.'", and he complied. "Ok!" I told him, "That will do."

He laughed as he looked at this big complicated Logic Pro project,
and said, "Yeah, don't worry about any of the rest of this!"

When it was done, I played the song for him and the rest of the family
and ever since then, our family has often said Adam more times than
necessary when addressing him.

Instead of creating a music video to go with this song,
I thought it would be fun to make a video game out of it instead.
I thought it would be fun to make a video game out of it instead,
which I did for his 31st birthday.

## GitHub

This project is available on GitHub as open source.
Feel free to augment it and send a Pull Request.
26 changes: 24 additions & 2 deletions adam/adam.css
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,32 @@ body {
font-size: large;
}

.Randy,.Isabel,.Adam,.letter {
.Randy,.Isabel,.Adam,.letter,#button-holder,#tabs {
position: relative;
display:inline;
display: inline;
}

a:link,a:visited,#tabs {
color: #c6c6e5;
}
a:hover {
color: #e9e9ef
}
a:active {
color: #7777e5;
}
.selected-link {
background-color: #6363dc;
}

#instructions,#backstory {
display: inline;
color: #e7e3ec;
font-size: large;
}
#backstory {
display: none;
}
.Isabel {
color: #fa5ca3;
}
Expand Down Expand Up @@ -68,3 +89,4 @@ body {
.isa {
background-color: #fa5ca3;
}

81 changes: 54 additions & 27 deletions adam/adam.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,30 +28,62 @@ const rebound = .8;
const maxV = 300 / (1000 / animationInterval);

function theAdamShow() {
song = new Audio("Adam.mp3");
song = new Audio("sounds/Adam.mp3");
song.load();
let tinyPop = new Audio("tiny-pop.mp3");
let bup = new Audio("bup.mp3");
let jpop = new Audio("JPop.mp3");
let boip = new Audio("boip.mp3");
let tinyPop = new Audio("sounds/tiny-pop.mp3");
let bup = new Audio("sounds/bup.mp3");
let jpop = new Audio("sounds/JPop.mp3");
let boip = new Audio("sounds/boip.mp3");
sounds = [tinyPop, bup, jpop, boip];
for (let i = 0; i < 10; i++) {
sounds.push(new Audio("tiny-pop.mp3"));
for (let i = 0; i < 40; i++) {
sounds.push(new Audio("sounds/tiny-pop.mp3"));
}
for (let sound of sounds) {
sound.load();
}
startGame(lines);
}

function showInstructions() {
$("#adam").hide();
$("#adams").hide();
$("#backstory").hide();
$("#instructions").show();
$("#story-link").removeClass("selected-link");
$("#instructions-link").addClass("selected-link");
}

function showBackstory() {
$("#adam").hide();
$("#adams").hide();
$("#instructions").hide();
$("#backstory").show();
$("#story-link").addClass("selected-link");
$("#instructions-link").removeClass("selected-link");
}

function startGame() {
lines = parseAdamTiming();
$("#adam").html("");
console.log("Playing song.");
$("#instructions").hide();
$("#backstory").hide();
$("#tabs").hide();
$("#story-link").removeClass("selected-link");
$("#instructions-link").removeClass("selected-link");

let $adam = $("#adam");
$adam.html("");
$adam.show();
let $adams = $("#adams");
$adams.html("");
$adams.show();

$("#button-holder").html("<button type='button' onclick='stopSong()'>Stop</button><br>");

lines = parseAdamTiming();

let promise = song.play();
promise.then();
timer = setInterval(adamsDot, tempo140);

score = 0;
speedBonus = 0;
currentLine = 0;
Expand All @@ -72,21 +104,7 @@ function updateScore() {
$("#total-score").text(Math.round(score + speedBonus));
}

function stopSong() {
clearInterval(timer);
song.pause();
}

function isDumm(line) {
return line.pieces[currentPiece + 1].text.startsWith("dumm");
}

function adamsDot() {
if (currentLine >= lines.length) {
console.log("Error: Too many lines. Stopping.");
clearInterval(timer);
return;
}
// Adam's Dot --------
let line = lines[currentLine];
let piece = line.pieces[currentPiece];
Expand Down Expand Up @@ -121,13 +139,14 @@ function adamsDot() {
if (piece.isAdam) {
let displayTime = Date.now(); // time at which Adam was displayed.
let adamId = getAdamId(currentLine, currentPiece);
let isDumm = line.pieces[currentPiece + 1].text.startsWith("dumm");
let $a = $("<div id='" + adamId + "' class='target" +
(piece.who === "Isabel" ? " isa" : (isDumm(line) ? " dumm" : "")) + "'" +
(piece.who === "Isabel" ? " isa" : (isDumm ? " dumm" : "")) + "'" +
" onclick='clickAdam(event, " + currentLine + ", " + currentPiece + ", " + displayTime + ");'" +
" onmouseover='hoverAdam(event, " + currentLine + ", " + currentPiece + ", " + displayTime + ");'>" +
"<div class='letter' id='" + (adamId + "-a") + "'>A</div>" +
"<span class='dum'>" +
(isDumm(line) ? line.pieces[currentPiece + 1].text :
(isDumm ? line.pieces[currentPiece + 1].text :
"<div class='letter' id='" + (adamId + '-d') + "'>d</div>" +
"<div class='letter' id='" + (adamId + '-u') + "'>a</div>" +
"<div class='letter' id='" + (adamId + '-m') + "'>m</div>") +
Expand Down Expand Up @@ -163,14 +182,22 @@ function adamsDot() {
}
}

function stopSong() {
song.pause();
song.currentTime = 0;
endGame();
}

function endGame() {
// Finished with the song and animation.
console.log("Clearing timer");
clearInterval(timer);
clearInterval(floaterTimer);
gameOver = true;
$(".target").remove();
$("#button-holder").html("<button type='button' onclick='startGame()'>Again! Again!</button><br>");
$("#adams").html("");
$("#button-holder").html("<button type='button' onclick='startGame()'>Again! Again!</button>");
$("#tabs").show();
}

function getAdamId(lineIndex, pieceIndex) {
Expand Down
68 changes: 64 additions & 4 deletions adam/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,72 @@
</head>
<body>
<div id="scoreboard">The Adam Game! <span class="score-label">Score:&nbsp;</span><span id='score'>0</span>
<span class="score-label">Speed bonus:&nbsp;</span><span id="speed-bonus"></span>
<span class="score-label">Total score:&nbsp;</span><span id="total-score"></span>
<br>
<div id="button-holder"><button id="adam-button" type="button" onclick="theAdamShow()">Start</button></div>
<span class="score-label">Speed bonus:&nbsp;</span><span id="speed-bonus">0</span>
<span class="score-label">Total score:&nbsp;</span><span id="total-score">0</span>
</div>
<div id="button-holder"><button id="adam-button" type="button" onclick="theAdamShow()">Start</button></div>
<div id="tabs"> &nbsp;
<a id="instructions-link" class="selected-link" onclick="showInstructions()">Instructions</a> &nbsp;
<a id="story-link" onclick="showBackstory()">Back Story</a>
</div>
<p>
<div id="adam"></div>

<div id="instructions">
Welcome to the Adam Game!
<ul>
<li> Click each "Adam" as it appears.
<ul>
<li> Clicking faster earns bonus points.</li>
<li> Isabel's Adams are worth double.</li>
</ul></li>
<li> Turbo-auto-click is enabled after clearing the Adams from the first verse, so you can just move over the Adams to clear them.</li>
<li> After 64 points, all scores are multiplied by 1000!</li>
<li> The final "Adummmmmm" is worth 100,000 points, but you have to click it.</li>
</ul>
</div>

<div id="backstory">

When COVID first hit, our oldest son Adam happened to be staying with us
for a few months while he was waiting for his next apartment to be ready.<p>

Isabel was our wonderful foreign exchange student from Spain, and she was
staying with us at that same time.<p>

She never had an older brother to torment, so when we asked her
to go downstairs to tell our son Adam that it was time for dinner,
she took great delight in calling out "Adam! Adam! A-DUM! A-DUM!
Adamadamadamadamadam!!!"<p>

Adam was always very chill in his response to this.<p>

One day at a dinner for the exchange students, Adam, Isabel and I
were standing in line to get some food, and Isabel turned to Adam and said,
"Adamadamadamadamadam".<p>

Meanwhile, Adam calmly replied, "Yes? May I help you?".<p>

So I decided to make a song about it.<p>

Adam said, "You can't have too many Adams in a song." I replied, "We'll see."<p>

After writing the ground-breaking lyrics and recording a first draft
of the song, I had Isabel sing her part. Then I invited Adam in to
record him. "Say 'Yes?'", I told him, and he did so. Then I said,
"Say 'Oh, ok.'", and he complied. "Ok!" I told him, "That will do."<p>

He laughed as he looked at this big complicated Logic Pro project,
and said, "Yeah, don't worry about any of the rest of this!"<p>

When it was done, I played the song for him and the rest of the family
and ever since then, our family has often said Adam more times than
necessary when addressing him.<p>

Instead of creating a music video to go with this song,
I thought it would be fun to make a video game out of it instead,
which I did for Adam's 31st birthday.
</div>
<div id="adams"></div>
</body>
</html>
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 21472f2

Please sign in to comment.