diff --git a/public/sfx/aprilfools.mp3 b/public/sfx/aprilfools.mp3 new file mode 100644 index 0000000..d22a02b Binary files /dev/null and b/public/sfx/aprilfools.mp3 differ diff --git a/src/ts/changelogs.ts b/src/ts/changelogs.ts index 6e0b337..ad2a66c 100644 --- a/src/ts/changelogs.ts +++ b/src/ts/changelogs.ts @@ -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)", diff --git a/src/ts/clickercookie.ts b/src/ts/clickercookie.ts index 700b1b9..30b450c 100644 --- a/src/ts/clickercookie.ts +++ b/src/ts/clickercookie.ts @@ -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 @@ -552,6 +553,34 @@ export default class ClickerCookie extends Mod { 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() { diff --git a/src/ts/main.ts b/src/ts/main.ts index 85c1951..e01e1c7 100644 --- a/src/ts/main.ts +++ b/src/ts/main.ts @@ -89,12 +89,14 @@ export class Game implements SaveProvider { public static readonly GITHUB_REPO: string = "https://github.com/clickercookie/clickercookie.github.io"; public static readonly CREDITS: Record = { "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; }