Skip to content

Add April Fools event w/ epic music #64

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added public/sfx/aprilfools.mp3
Binary file not shown.
1 change: 1 addition & 0 deletions src/ts/changelogs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ export const versionChangelogs: Changelog[] = [
added: [
"\"Cookies Per Click\" statistic.",
"A button in Options to toggle auto-saving (#29)",
"April Fools event",
"GitHub issues in changelogs work as hyperlinks, like this one: #13",
"A \"removed\" section in changelogs",
"Advanced popups now have options (#32)",
Expand Down
29 changes: 29 additions & 0 deletions src/ts/clickercookie.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Upgrade, UpgradeData, UpgradeSave } from "./upgrades.js";
import { SimplePopup } from "./popup.js";
import { Identifier } from "./handler.js";
import { Handlers } from "./handlers.js";
import { Game } from "./main.js";

// the description of almost every upgrade is the same, but just in case we want to add more upgrades in the future
// a "desc" field has been added to the upgrades array. Most upgrade will just reference a this array, though
Expand Down Expand Up @@ -552,6 +553,34 @@ export default class ClickerCookie extends Mod<ClickerCookieSaveData> {
title: "woo hoo!"
});
}

if (date.getMonth() === 3 && date.getDate() == 1) {
Mod.registerKooh("click", () => {
if (Game.backgroundMusic.src.split("/").at(-1) === "aprilfools.mp3") return; // todo: can we make this a bit less janky or smth
Game.backgroundMusic = new Audio("/sfx/aprilfools.mp3");
console.log();
Game.backgroundMusic.volume = 0.5;
Game.backgroundMusic.play();
Game.backgroundMusic.addEventListener("ended", () => {
Game.backgroundMusic.play();
});
});

const filter = document.createElement("div");
filter.style.position = "absolute";
filter.style.width = "100%";
filter.style.height = "100%";
filter.style.pointerEvents = "none";
filter.style.backgroundColor = "red";
filter.style.opacity = "70%";

document.body.appendChild(filter);

const message = document.createElement("h3");
message.innerText = "happy april fools";
message.style.marginLeft = "auto"; // centers it the way god intended
document.getElementsByClassName("left-middle-buttons")[0].after(message);
}
}

gameLoop() {
Expand Down
4 changes: 3 additions & 1 deletion src/ts/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,14 @@ export class Game implements SaveProvider<GameSaveData> {
public static readonly GITHUB_REPO: string = "https://github.com/clickercookie/clickercookie.github.io";
public static readonly CREDITS: Record<string, string> = {
"FifthTundraG": "Creation",
"potatman4": "Playtesting",
"potatman4": "Supreme Musical Overlord",
"Wolfsarecool44": "Playtesting, Emotional Support"
}
public static readonly DEFAULT_BACKGROUND: string = "clickercookie:blue";
public static readonly DEFAULT_CURRENTLY_CLICKED_OBJECT: string = "clickercookie:cookie";

public static backgroundMusic: HTMLAudioElement = new Audio(); // todo: can we make this better or this fine

public static getMousePosition(): MousePosition {
return mousePos;
}
Expand Down