From c1ccb13890b8b548edc5d0bef9001c59ca7174e2 Mon Sep 17 00:00:00 2001 From: Robert <152218269+PenguinRobert1@users.noreply.github.com> Date: Tue, 8 Apr 2025 14:00:47 +0000 Subject: [PATCH] skib --- .../WebGames-master/games2/rps/app.js | 69 +++++++++++++++ hihihi.jpeg | Bin 0 -> 3089 bytes index.css | 1 + index.html | 79 ++++++++++++------ setting.html | 5 +- 5 files changed, 126 insertions(+), 28 deletions(-) create mode 100644 hihihi.jpeg diff --git a/WebGames-master/WebGames-master/games2/rps/app.js b/WebGames-master/WebGames-master/games2/rps/app.js index e69de29b..96bb971a 100644 --- a/WebGames-master/WebGames-master/games2/rps/app.js +++ b/WebGames-master/WebGames-master/games2/rps/app.js @@ -0,0 +1,69 @@ +let wins = parseInt(localStorage.getItem("wins")) || 0; +let losses = parseInt(localStorage.getItem("losses")) || 0; + +const choices = document.querySelectorAll(".choice"); +const msg = document.querySelector("#msg"); + +const winsPara = document.querySelector("#wins"); +const lossesPara = document.querySelector("#losses"); + +// Initialize the UI with saved values +winsPara.innerText = wins; +lossesPara.innerText = losses; + +const genCompChoice = () => { + const options = ["rock", "paper", "scissors"]; + const randIdx = Math.floor(Math.random() * 3); + return options[randIdx]; +}; + +const drawGame = () => { + msg.innerText = "Game was Draw. Play again."; + msg.style.backgroundColor = "#081b31"; +}; + +const showWinner = (userWin, userChoice, compChoice) => { + if (userWin) { + wins++; + localStorage.setItem("wins", wins); // Save wins to localStorage + winsPara.innerText = wins; + msg.innerText = `You win! Your ${userChoice} beats ${compChoice}`; + msg.style.backgroundColor = "green"; + } else { + losses++; + localStorage.setItem("losses", losses); // Save losses to localStorage + lossesPara.innerText = losses; + msg.innerText = `You lost. ${compChoice} beats your ${userChoice}`; + msg.style.backgroundColor = "red"; + } +}; + +const playGame = (userChoice) => { + //Generate computer choice + const compChoice = genCompChoice(); + + if (userChoice === compChoice) { + //Draw Game + drawGame(); + } else { + let userWin = true; + if (userChoice === "rock") { + //scissors, paper + userWin = compChoice === "paper" ? false : true; + } else if (userChoice === "paper") { + //rock, scissors + userWin = compChoice === "scissors" ? false : true; + } else { + //rock, paper + userWin = compChoice === "rock" ? false : true; + } + showWinner(userWin, userChoice, compChoice); + } +}; + +choices.forEach((choice) => { + choice.addEventListener("click", () => { + const userChoice = choice.getAttribute("id"); + playGame(userChoice); + }); +}); \ No newline at end of file diff --git a/hihihi.jpeg b/hihihi.jpeg new file mode 100644 index 0000000000000000000000000000000000000000..e772ce5ec54a8d5e2b1e90257a45484b647a7c01 GIT binary patch literal 3089 zcmcIlc{J4P8~=`F#xjFZVJyvLEEUR z2m}D2?G0=V0k;5NFoXvJ=H-F#@bU5T!$bsOP$*1d_Z}e;l$5kIN(zaT*?&Y)MovW@ ziB!^6Qc>5$VzFoi+;N=Nu_G9)CWw!Z4+e#a3kr&B$|7Yo|Le6?4ZwMT5}<|?Bn@!D zL7Z^V788)%CddhJ{>F7@Z4>3>;^z1*dr}AhadL2Qfd#=_kl#x{0LOL`42KBsQ{mA! zzhBU`YqyB#5e>~V1jj4hKCv(NNUM`FJJrZRg=kfa;9K!^$F^~H{~iC2KEFlbf9v{Z zbP#}YZufw5!T}smZVm^*h2Z~+x!$yVvhgThJ<_$cv=JqYK`3yJ`a3j2>r%;(@3gzO zqRy}!*9b?hl)h-Q7(;`aaD+0o)x0V&?RD5?_G^qR`RT_vQD!Ygxg2MExcv-@@jI;> z!s5In0QNXtmIduJ6^r9VpamvXs_!Kes(22*4nGBMuzWo=WN9m@I`i;V3XOg7o2%I- z%*Qe!cQn4B>{Tl?>E&dhmA2x-coVhi9}Y_D@zqJM`HrHJ(jR!dDKj;_z2?9t=3v$Q zK`i#$&y+Hc>TafLdtb>uGH3N%Fh-ZEhU73cJvbfZ4Tvd;f$w2LL3q1xZdE$%BOT*6qVX-Ps?50NFOov30vA1Vm+4)j}fq4 z==Bdz_Kg7Bo>r!M336$O!-w_zYbE(Y#@Id0GtfJg{K# zxwse8JAuVm>{rN%xS0?Yibr`W7&H-AH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%hPxBooAiBG$7x=De=UI4^+E*aP}YbME|GfKdOeXb^8z zr+E)Wk!g~{IX_v>xxq0t_~MDculeCm`hF=^%~N~mc~5#G-TW27PBv`KgsFz%k;Md- z(kePr(8zv%Lr96U1n!7)4Q&w*<(Vkg$*~vm(NVM zO7!Uaj8=#_z9U@q=^7u3d`cE?6qADqv|PXlQ9f0Ey%VLpDO}1JyEIqQ!%!1bdo3x> zi}(achR4p28NT=No`B8BUllj`_AFc3)0~?Xr7V?%s7zp!%mxmG-0}=QZ5i95Ooqhz zi6{w;L`c0)oHV+Wp{uqg<78dq@#38UaL~UjO5X2ncd}+q+B-MxH+c_hDvpZ>iJboj zcrbNa{ER=u_m$eIJ~7EJr_or_KWuGmZ*K9if7sFz9<7y(G0_9mDjVrFse=+yLq0e-u=d6+9=GlKEA$^F+1|9^NPTLb?A^6Y5g literal 0 HcmV?d00001 diff --git a/index.css b/index.css index 16790e74..18041288 100644 --- a/index.css +++ b/index.css @@ -206,6 +206,7 @@ h1 { font-size: 3rem; text-transform: uppercase; animation: glow 1.5s infinite alternate; + text-shadow: 0 0 10px #00ff00, 0 0 20px #00ff00, 0 0 30px #00ff00; } @keyframes glow { diff --git a/index.html b/index.html index 5106b754..a2d98740 100644 --- a/index.html +++ b/index.html @@ -8,6 +8,59 @@ +

Moon Gaming

@@ -38,32 +91,6 @@ return null; } - // Apply dark or light mode based on cookie - function applyDarkMode(enabled) { - if (enabled) { - document.body.style.setProperty('--background-color', 'var(--background-color-dark)'); - document.body.style.setProperty('--text-color', 'var(--text-color-dark)'); - document.body.style.setProperty('--button-bg', 'var(--button-bg-dark)'); - document.body.style.setProperty('--button-hover-bg', 'var(--button-hover-bg-dark)'); - document.body.style.setProperty('--button-hover-text', 'var(--button-hover-text-dark)'); - } else { - document.body.style.setProperty('--background-color', 'var(--background-color-light)'); - document.body.style.setProperty('--text-color', 'var(--text-color-light)'); - document.body.style.setProperty('--button-bg', 'var(--button-bg-light)'); - document.body.style.setProperty('--button-hover-bg', 'var(--button-hover-bg-light)'); - document.body.style.setProperty('--button-hover-text', 'var(--button-hover-text-light)'); - } - } - - // Ensure dark mode is the default - if (getCookie('darkMode') === null) { - setCookie('darkMode', 'true', 30); // Default to dark mode - } - - // Apply saved mode on load - const darkModeEnabled = getCookie('darkMode') === 'true'; - applyDarkMode(darkModeEnabled); - // Clock Functionality function updateClock() { const now = new Date(); diff --git a/setting.html b/setting.html index b1724218..eb2006b5 100644 --- a/setting.html +++ b/setting.html @@ -137,10 +137,10 @@ return null; } - // Dark Mode Toggle + // Remove the toggle button from other pages const toggleDarkModeButton = document.getElementById('toggleDarkMode'); - const darkModeEnabled = getCookie('darkMode') === 'true'; + // Ensure this button is the only one controlling dark mode function applyDarkMode(enabled) { if (enabled) { document.body.style.setProperty('--background-color', '#121212'); @@ -162,6 +162,7 @@ }); // Apply saved dark mode preference on load + const darkModeEnabled = getCookie('darkMode') === 'true'; applyDarkMode(darkModeEnabled); // Clear Cookies Button