From e44a5abe7df0687beb20209cc83c3afe3c1004e4 Mon Sep 17 00:00:00 2001 From: Bald-gordon <129743515+Bald-gordon@users.noreply.github.com> Date: Sun, 11 Oct 2026 18:00:32 -0400 Subject: [PATCH 1/2] Sprig App - Simon says --- games/Simon-says.js | 579 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 579 insertions(+) create mode 100644 games/Simon-says.js diff --git a/games/Simon-says.js b/games/Simon-says.js new file mode 100644 index 0000000000..033971c820 --- /dev/null +++ b/games/Simon-says.js @@ -0,0 +1,579 @@ +/* +@title: Simon says +@description: This is a remage of the simple game Simon. Most of the inspiration was from https://sprig.hackclub.com/gallery/play/nomis +@author: Sebastien Depenweiller, Credits to the person who made Nomis +@tags: ['casual', 'simple'] +@addedOn: 2026-10-11 +*/ + +const green = "a"; +const greenRed = "b" +const greennoRed = "c" +const nogreenRed = "d" +const red = "e"; +const redBlue = "f" +const rednoBlue = "g" +const noredBlue = "h" +const blue = "i"; +const blueYellow = "j" +const bluenoYellow = "k" +const noblueYellow = "l" +const yellow = "m"; +const yellowGreen = "n" +const yellownoGreen = "o" +const noyellowGreen = "p" +const center = "q" +const centerGreen = "r" +const centerRed = "s" +const centerBlue = "t" +const centerYellow = "u" +const black = "v" + +const beep = tune` +100: B4-100, +100: B4-100, +3000` +const beep2 = tune` +500: B4^500, +15500` + +const next = tune` +200: F4/200 + E4^200, +200: G4/200 + F4^200, +200: A4/200 + G4^200, +200: B4/200 + A4^200 + G4~200, +200: B4/200 + A4^200 + G4~200, +5400` +const click = tune` +75: B4~75, +75: B4~75, +2250` + +const loose = tune` +250: G4-250, +250: F4-250, +250: E4-250, +250: C4/250, +250: C4/250, +250: C4/250, +500, +250: C4^250, +250: C4^250, +5500` + + +setLegend( + [ green, bitmap` +4444444444444444 +4444444444444444 +4444444444444444 +4444444444444444 +4444444444444444 +4444444444444444 +4444444444444444 +4444444444444444 +4444444444444444 +4444444444444444 +4444444444444444 +4444444444444444 +4444444444444444 +4444444444444444 +4444444444444444 +4444444444444444`], + + [ greenRed, bitmap` +4444444444444444 +4444444444444443 +4444444444444433 +4444444444444333 +4444444444443333 +4444444444433333 +4444444444333333 +4444444443333333 +4444444433333333 +4444444333333333 +4444443333333333 +4444433333333333 +4444333333333333 +4443333333333333 +4433333333333333 +4333333333333333`], + [ greennoRed, bitmap` +4444444444444444 +444444444444444. +44444444444444.. +4444444444444... +444444444444.... +44444444444..... +4444444444...... +444444444....... +44444444........ +4444444......... +444444.......... +44444........... +4444............ +444............. +44.............. +4...............`], + [ nogreenRed, bitmap` +................ +...............3 +..............33 +.............333 +............3333 +...........33333 +..........333333 +.........3333333 +........33333333 +.......333333333 +......3333333333 +.....33333333333 +....333333333333 +...3333333333333 +..33333333333333 +.333333333333333`], + + [ red, bitmap` +3333333333333333 +3333333333333333 +3333333333333333 +3333333333333333 +3333333333333333 +3333333333333333 +3333333333333333 +3333333333333333 +3333333333333333 +3333333333333333 +3333333333333333 +3333333333333333 +3333333333333333 +3333333333333333 +3333333333333333 +3333333333333333`], + [ redBlue, bitmap` +3333333333333333 +5333333333333333 +5533333333333333 +5553333333333333 +5555333333333333 +5555533333333333 +5555553333333333 +5555555333333333 +5555555533333333 +5555555553333333 +5555555555333333 +5555555555533333 +5555555555553333 +5555555555555333 +5555555555555533 +5555555555555553`], + [ rednoBlue, bitmap` +3333333333333333 +.333333333333333 +..33333333333333 +...3333333333333 +....333333333333 +.....33333333333 +......3333333333 +.......333333333 +........33333333 +.........3333333 +..........333333 +...........33333 +............3333 +.............333 +..............33 +...............3`], + [ noredBlue, bitmap` +................ +5............... +55.............. +555............. +5555............ +55555........... +555555.......... +5555555......... +55555555........ +555555555....... +5555555555...... +55555555555..... +555555555555.... +5555555555555... +55555555555555.. +555555555555555.`], + + [ blue, bitmap` +5555555555555555 +5555555555555555 +5555555555555555 +5555555555555555 +5555555555555555 +5555555555555555 +5555555555555555 +5555555555555555 +5555555555555555 +5555555555555555 +5555555555555555 +5555555555555555 +5555555555555555 +5555555555555555 +5555555555555555 +5555555555555555`], + [ blueYellow, bitmap` +6666666666666665 +6666666666666655 +6666666666666555 +6666666666665555 +6666666666655555 +6666666666555555 +6666666665555555 +6666666655555555 +6666666555555555 +6666665555555555 +6666655555555555 +6666555555555555 +6665555555555555 +6655555555555555 +6555555555555555 +5555555555555555`], + [ bluenoYellow, bitmap` +...............5 +..............55 +.............555 +............5555 +...........55555 +..........555555 +.........5555555 +........55555555 +.......555555555 +......5555555555 +.....55555555555 +....555555555555 +...5555555555555 +..55555555555555 +.555555555555555 +5555555555555555`], + [ noblueYellow, bitmap` +666666666666666. +66666666666666.. +6666666666666... +666666666666.... +66666666666..... +6666666666...... +666666666....... +66666666........ +6666666......... +666666.......... +66666........... +6666............ +666............. +66.............. +6............... +................`], + + [ yellow, bitmap` +6666666666666666 +6666666666666666 +6666666666666666 +6666666666666666 +6666666666666666 +6666666666666666 +6666666666666666 +6666666666666666 +6666666666666666 +6666666666666666 +6666666666666666 +6666666666666666 +6666666666666666 +6666666666666666 +6666666666666666 +6666666666666666`], + [ yellowGreen, bitmap` +6444444444444444 +6644444444444444 +6664444444444444 +6666444444444444 +6666644444444444 +6666664444444444 +6666666444444444 +6666666644444444 +6666666664444444 +6666666666444444 +6666666666644444 +6666666666664444 +6666666666666444 +6666666666666644 +6666666666666664 +6666666666666666`], + [ yellownoGreen, bitmap` +6............... +66.............. +666............. +6666............ +66666........... +666666.......... +6666666......... +66666666........ +666666666....... +6666666666...... +66666666666..... +666666666666.... +6666666666666... +66666666666666.. +666666666666666. +6666666666666666`], + [ noyellowGreen, bitmap` +.444444444444444 +..44444444444444 +...4444444444444 +....444444444444 +.....44444444444 +......4444444444 +.......444444444 +........44444444 +.........4444444 +..........444444 +...........44444 +............4444 +.............444 +..............44 +...............4 +................`], + + [ center, bitmap` +6444444444444444 +6644444444444443 +6664444444444433 +6666444444444333 +6666644444443333 +6666664444433333 +6666660000333333 +6666660000333333 +6666660000333333 +6666660000333333 +6666655555333333 +6666555555533333 +6665555555553333 +6655555555555333 +6555555555555533 +5555555555555553`], + [ centerGreen, bitmap` +6............... +66.............3 +666...........33 +6666.........333 +66666.......3333 +666666.....33333 +6666660000333333 +6666660000333333 +6666660000333333 +6666660000333333 +6666655555333333 +6666555555533333 +6665555555553333 +6655555555555333 +6555555555555533 +5555555555555553`], + [ centerRed, bitmap` +6444444444444444 +664444444444444. +66644444444444.. +6666444444444... +666664444444.... +66666644444..... +6666660000...... +6666660000...... +6666660000...... +6666660000...... +6666655555...... +66665555555..... +666555555555.... +6655555555555... +65555555555555.. +555555555555555.`], + [ centerBlue, bitmap` +6444444444444444 +6644444444444443 +6664444444444433 +6666444444444333 +6666644444443333 +6666664444433333 +6666660000333333 +6666660000333333 +6666660000333333 +6666660000333333 +66666.....333333 +6666.......33333 +666.........3333 +66...........333 +6.............33 +...............3`], + [ centerYellow, bitmap` +.444444444444444 +..44444444444443 +...4444444444433 +....444444444333 +.....44444443333 +......4444433333 +......0000333333 +......0000333333 +......0000333333 +......0000333333 +.....55555333333 +....555555533333 +...5555555553333 +..55555555555333 +.555555555555533 +5555555555555553`], + + [ black, bitmap` +0000000000000000 +0000000000000000 +0000000000000000 +0000000000000000 +0000000000000000 +0000000000000000 +0000000000000000 +0000000000000000 +0000000000000000 +0000000000000000 +0000000000000000 +0000000000000000 +0000000000000000 +0000000000000000 +0000000000000000 +0000000000000000`] +); + +let maps = { + default: map` +nab +mqe +jif`, + red: map` +nac +ms. +jih`, + blue: map` +nab +mte +l.g`, + yellow: map` +pab +.ue +kif`, + green: map` +o.d +mre +jif`, + blank: map` +... +... +...` +}; + +setMap(maps.default); + + +function flashColor(colorName) { + setMap(maps[colorName]); + + setTimeout(() => { + setMap(maps.default); + }, 300); +} + +const colors = ["green", "yellow", "blue", "red"]; + +let sequence = []; +let position = 0; +let phase = "waiting"; +let score = 0; + +function updateStats() { + clearText(); + + + + addText(`SCORE ${score}`, { + x: 6, + y: 14, + color: color`1` + }); +} + +function startRound() { + phase = "showing"; + position = 0; + + + const randomIndex = Math.floor(Math.random() * colors.length); + const nextColor = colors[randomIndex]; + + sequence.push(nextColor); + playTune(click) + updateStats(); + + setTimeout(() => { + showSequence(0); + }, 600); +} + +function showSequence(index) { + if (index >= sequence.length) { + phase = "input"; + playTune(beep2) + return; + } + + flashColor(sequence[index]); +//beep when color appears + playTune(beep) + + setTimeout(() => { + showSequence(index + 1); + }, 650); +} + +function checkInput(colorName) { + if (phase !== "input") { + return; + } + + const expectedColor = sequence[position]; + + if (colorName !== expectedColor) { + phase = "over"; + setMap(maps.blank); + clearText(); + + addText("Game Over!", { y: 4 }); + addText(`Score: ${score}`, { y: 6 }); + playTune(loose) + + return; + } + + phase = "feedback"; + flashColor(colorName); + position += 1; + + if (position === sequence.length) { + score += 1; + + setTimeout(() => { + startRound(); + }, 800); + } else { + setTimeout(() => { + phase = "input"; + }, 350); + } +} + +onInput("w", () => checkInput("green")); +onInput("a", () => checkInput("yellow")); +onInput("s", () => checkInput("blue")); +onInput("d", () => checkInput("red")); + +startRound(); \ No newline at end of file From e6f2bb50c2b3319c3ca3d25213db1e205236fa17 Mon Sep 17 00:00:00 2001 From: Bald-gordon <129743515+Bald-gordon@users.noreply.github.com> Date: Sat, 17 Oct 2026 14:41:15 -0400 Subject: [PATCH 2/2] Sprig App - Simon says --- games/Simon-says.js | 772 ++++++++++++++++++++++++++------------------ 1 file changed, 456 insertions(+), 316 deletions(-) diff --git a/games/Simon-says.js b/games/Simon-says.js index 033971c820..3e1f13a9d9 100644 --- a/games/Simon-says.js +++ b/games/Simon-says.js @@ -1,41 +1,45 @@ /* @title: Simon says @description: This is a remage of the simple game Simon. Most of the inspiration was from https://sprig.hackclub.com/gallery/play/nomis -@author: Sebastien Depenweiller, Credits to the person who made Nomis +@author: Bald Seb, Credits to the person who made Nomis @tags: ['casual', 'simple'] @addedOn: 2026-10-11 */ + // btw theres nothin here only boring ahh color thing. + // So if u wanna actually see the code its at 460 or sum + const green = "a"; -const greenRed = "b" -const greennoRed = "c" -const nogreenRed = "d" +const greenRed = "b"; +const greennoRed = "c"; +const nogreenRed = "d"; const red = "e"; -const redBlue = "f" -const rednoBlue = "g" -const noredBlue = "h" +const redBlue = "f"; +const rednoBlue = "g"; +const noredBlue = "h"; const blue = "i"; -const blueYellow = "j" -const bluenoYellow = "k" -const noblueYellow = "l" +const blueYellow = "j"; +const bluenoYellow = "k"; +const noblueYellow = "l"; const yellow = "m"; -const yellowGreen = "n" -const yellownoGreen = "o" -const noyellowGreen = "p" -const center = "q" -const centerGreen = "r" -const centerRed = "s" -const centerBlue = "t" -const centerYellow = "u" -const black = "v" +const yellowGreen = "n"; +const yellownoGreen = "o"; +const noyellowGreen = "p"; +const center = "q"; +const centerGreen = "r"; +const centerRed = "s"; +const centerBlue = "t"; +const centerYellow = "u"; +const black = "v"; const beep = tune` 100: B4-100, 100: B4-100, -3000` +3000`; + const beep2 = tune` 500: B4^500, -15500` +15500`; const next = tune` 200: F4/200 + E4^200, @@ -43,27 +47,26 @@ const next = tune` 200: A4/200 + G4^200, 200: B4/200 + A4^200 + G4~200, 200: B4/200 + A4^200 + G4~200, -5400` +5400`; + const click = tune` 75: B4~75, 75: B4~75, -2250` +2250`; const loose = tune` -250: G4-250, -250: F4-250, -250: E4-250, -250: C4/250, -250: C4/250, -250: C4/250, -500, -250: C4^250, -250: C4^250, -5500` - +187.5: G4-187.5, +187.5: F4-187.5, +187.5: E4-187.5, +187.5: C4/187.5, +187.5: C4/187.5, +187.5: C4/187.5, +375, +187.5: C4~187.5 + D4~187.5, +4312.5`; setLegend( - [ green, bitmap` + [green, bitmap` 4444444444444444 4444444444444444 4444444444444444 @@ -80,25 +83,26 @@ setLegend( 4444444444444444 4444444444444444 4444444444444444`], - - [ greenRed, bitmap` + + [greenRed, bitmap` 4444444444444444 -4444444444444443 -4444444444444433 -4444444444444333 -4444444444443333 -4444444444433333 -4444444444333333 -4444444443333333 -4444444433333333 -4444444333333333 -4444443333333333 -4444433333333333 -4444333333333333 -4443333333333333 -4433333333333333 -4333333333333333`], - [ greennoRed, bitmap` +4444444444444449 +4444444444444499 +4444444444444999 +4444444444449999 +4444444444499999 +4444444444999999 +4444444449999999 +4444444499999999 +4444444999999999 +4444449999999999 +4444499999999999 +4444999999999999 +4449999999999999 +4499999999999999 +4999999999999999`], + + [greennoRed, bitmap` 4444444444444444 444444444444444. 44444444444444.. @@ -115,76 +119,80 @@ setLegend( 444............. 44.............. 4...............`], - [ nogreenRed, bitmap` + + [nogreenRed, bitmap` ................ -...............3 -..............33 -.............333 -............3333 -...........33333 -..........333333 -.........3333333 -........33333333 -.......333333333 -......3333333333 -.....33333333333 -....333333333333 -...3333333333333 -..33333333333333 -.333333333333333`], - - [ red, bitmap` -3333333333333333 -3333333333333333 -3333333333333333 -3333333333333333 -3333333333333333 -3333333333333333 -3333333333333333 -3333333333333333 -3333333333333333 -3333333333333333 -3333333333333333 -3333333333333333 -3333333333333333 -3333333333333333 -3333333333333333 -3333333333333333`], - [ redBlue, bitmap` -3333333333333333 -5333333333333333 -5533333333333333 -5553333333333333 -5555333333333333 -5555533333333333 -5555553333333333 -5555555333333333 -5555555533333333 -5555555553333333 -5555555555333333 -5555555555533333 -5555555555553333 -5555555555555333 -5555555555555533 -5555555555555553`], - [ rednoBlue, bitmap` -3333333333333333 -.333333333333333 -..33333333333333 -...3333333333333 -....333333333333 -.....33333333333 -......3333333333 -.......333333333 -........33333333 -.........3333333 -..........333333 -...........33333 -............3333 -.............333 -..............33 -...............3`], - [ noredBlue, bitmap` +...............9 +..............99 +.............999 +............9999 +...........99999 +..........999999 +.........9999999 +........99999999 +.......999999999 +......9999999999 +.....99999999999 +....999999999999 +...9999999999999 +..99999999999999 +.999999999999999`], + + [red, bitmap` +9999999999999999 +9999999999999999 +9999999999999999 +9999999999999999 +9999999999999999 +9999999999999999 +9999999999999999 +9999999999999999 +9999999999999999 +9999999999999999 +9999999999999999 +9999999999999999 +9999999999999999 +9999999999999999 +9999999999999999 +9999999999999999`], + + [redBlue, bitmap` +9999999999999999 +5999999999999999 +5599999999999999 +5559999999999999 +5555999999999999 +5555599999999999 +5555559999999999 +5555555999999999 +5555555599999999 +5555555559999999 +5555555555999999 +5555555555599999 +5555555555559999 +5555555555555999 +5555555555555599 +5555555555555559`], + + [rednoBlue, bitmap` +9999999999999999 +.999999999999999 +..99999999999999 +...9999999999999 +....999999999999 +.....99999999999 +......9999999999 +.......999999999 +........99999999 +.........9999999 +..........999999 +...........99999 +............9999 +.............999 +..............99 +...............9`], + + [noredBlue, bitmap` ................ 5............... 55.............. @@ -202,7 +210,7 @@ setLegend( 55555555555555.. 555555555555555.`], - [ blue, bitmap` + [blue, bitmap` 5555555555555555 5555555555555555 5555555555555555 @@ -219,24 +227,26 @@ setLegend( 5555555555555555 5555555555555555 5555555555555555`], - [ blueYellow, bitmap` -6666666666666665 -6666666666666655 -6666666666666555 -6666666666665555 -6666666666655555 -6666666666555555 -6666666665555555 -6666666655555555 -6666666555555555 -6666665555555555 -6666655555555555 -6666555555555555 -6665555555555555 -6655555555555555 -6555555555555555 + + [blueYellow, bitmap` +HHHHHHHHHHHHHHH5 +HHHHHHHHHHHHHH55 +HHHHHHHHHHHHH555 +HHHHHHHHHHHH5555 +HHHHHHHHHHH55555 +HHHHHHHHHH555555 +HHHHHHHHH5555555 +HHHHHHHH55555555 +HHHHHHH555555555 +HHHHHH5555555555 +HHHHH55555555555 +HHHH555555555555 +HHH5555555555555 +HH55555555555555 +H555555555555555 5555555555555555`], - [ bluenoYellow, bitmap` + + [bluenoYellow, bitmap` ...............5 ..............55 .............555 @@ -253,76 +263,80 @@ setLegend( ..55555555555555 .555555555555555 5555555555555555`], - [ noblueYellow, bitmap` -666666666666666. -66666666666666.. -6666666666666... -666666666666.... -66666666666..... -6666666666...... -666666666....... -66666666........ -6666666......... -666666.......... -66666........... -6666............ -666............. -66.............. -6............... + + [noblueYellow, bitmap` +HHHHHHHHHHHHHHH. +HHHHHHHHHHHHHH.. +HHHHHHHHHHHHH... +HHHHHHHHHHHH.... +HHHHHHHHHHH..... +HHHHHHHHHH...... +HHHHHHHHH....... +HHHHHHHH........ +HHHHHHH......... +HHHHHH.......... +HHHHH........... +HHHH............ +HHH............. +HH.............. +H............... ................`], - [ yellow, bitmap` -6666666666666666 -6666666666666666 -6666666666666666 -6666666666666666 -6666666666666666 -6666666666666666 -6666666666666666 -6666666666666666 -6666666666666666 -6666666666666666 -6666666666666666 -6666666666666666 -6666666666666666 -6666666666666666 -6666666666666666 -6666666666666666`], - [ yellowGreen, bitmap` -6444444444444444 -6644444444444444 -6664444444444444 -6666444444444444 -6666644444444444 -6666664444444444 -6666666444444444 -6666666644444444 -6666666664444444 -6666666666444444 -6666666666644444 -6666666666664444 -6666666666666444 -6666666666666644 -6666666666666664 -6666666666666666`], - [ yellownoGreen, bitmap` -6............... -66.............. -666............. -6666............ -66666........... -666666.......... -6666666......... -66666666........ -666666666....... -6666666666...... -66666666666..... -666666666666.... -6666666666666... -66666666666666.. -666666666666666. -6666666666666666`], - [ noyellowGreen, bitmap` + [yellow, bitmap` +HHHHHHHHHHHHHHHH +HHHHHHHHHHHHHHHH +HHHHHHHHHHHHHHHH +HHHHHHHHHHHHHHHH +HHHHHHHHHHHHHHHH +HHHHHHHHHHHHHHHH +HHHHHHHHHHHHHHHH +HHHHHHHHHHHHHHHH +HHHHHHHHHHHHHHHH +HHHHHHHHHHHHHHHH +HHHHHHHHHHHHHHHH +HHHHHHHHHHHHHHHH +HHHHHHHHHHHHHHHH +HHHHHHHHHHHHHHHH +HHHHHHHHHHHHHHHH +HHHHHHHHHHHHHHHH`], + + [yellowGreen, bitmap` +H444444444444444 +HH44444444444444 +HHH4444444444444 +HHHH444444444444 +HHHHH44444444444 +HHHHHH4444444444 +HHHHHHH444444444 +HHHHHHHH44444444 +HHHHHHHHH4444444 +HHHHHHHHHH444444 +HHHHHHHHHHH44444 +HHHHHHHHHHHH4444 +HHHHHHHHHHHHH444 +HHHHHHHHHHHHHH44 +HHHHHHHHHHHHHHH4 +HHHHHHHHHHHHHHHH`], + + [yellownoGreen, bitmap` +H............... +HH.............. +HHH............. +HHHH............ +HHHHH........... +HHHHHH.......... +HHHHHHH......... +HHHHHHHH........ +HHHHHHHHH....... +HHHHHHHHHH...... +HHHHHHHHHHH..... +HHHHHHHHHHHH.... +HHHHHHHHHHHHH... +HHHHHHHHHHHHHH.. +HHHHHHHHHHHHHHH. +HHHHHHHHHHHHHHHH`], + + [noyellowGreen, bitmap` .444444444444444 ..44444444444444 ...4444444444444 @@ -340,93 +354,97 @@ setLegend( ...............4 ................`], - [ center, bitmap` -6444444444444444 -6644444444444443 -6664444444444433 -6666444444444333 -6666644444443333 -6666664444433333 -6666660000333333 -6666660000333333 -6666660000333333 -6666660000333333 -6666655555333333 -6666555555533333 -6665555555553333 -6655555555555333 -6555555555555533 -5555555555555553`], - [ centerGreen, bitmap` -6............... -66.............3 -666...........33 -6666.........333 -66666.......3333 -666666.....33333 -6666660000333333 -6666660000333333 -6666660000333333 -6666660000333333 -6666655555333333 -6666555555533333 -6665555555553333 -6655555555555333 -6555555555555533 -5555555555555553`], - [ centerRed, bitmap` -6444444444444444 -664444444444444. -66644444444444.. -6666444444444... -666664444444.... -66666644444..... -6666660000...... -6666660000...... -6666660000...... -6666660000...... -6666655555...... -66665555555..... -666555555555.... -6655555555555... -65555555555555.. + [center, bitmap` +H444444444444444 +HH44444444444449 +HHH4444444444499 +HHHH444444444999 +HHHHH44444449999 +HHHHHH4444499999 +HHHHHH0000999999 +HHHHHH0000999999 +HHHHHH0000999999 +HHHHHH0000999999 +HHHHH55555999999 +HHHH555555599999 +HHH5555555559999 +HH55555555555999 +H555555555555599 +5555555555555559`], + + [centerGreen, bitmap` +H............... +HH.............9 +HHH...........99 +HHHH.........999 +HHHHH.......9999 +HHHHHH.....99999 +HHHHHH0000999999 +HHHHHH0000999999 +HHHHHH0000999999 +HHHHHH0000999999 +HHHHH55555999999 +HHHH555555599999 +HHH5555555559999 +HH55555555555999 +H555555555555599 +5555555555555559`], + + [centerRed, bitmap` +H444444444444444 +HH4444444444444. +HHH44444444444.. +HHHH444444444... +HHHHH4444444.... +HHHHHH44444..... +HHHHHH0000...... +HHHHHH0000...... +HHHHHH0000...... +HHHHHH0000...... +HHHHH55555...... +HHHH5555555..... +HHH555555555.... +HH55555555555... +H5555555555555.. 555555555555555.`], - [ centerBlue, bitmap` -6444444444444444 -6644444444444443 -6664444444444433 -6666444444444333 -6666644444443333 -6666664444433333 -6666660000333333 -6666660000333333 -6666660000333333 -6666660000333333 -66666.....333333 -6666.......33333 -666.........3333 -66...........333 -6.............33 -...............3`], - [ centerYellow, bitmap` + + [centerBlue, bitmap` +H444444444444444 +HH44444444444449 +HHH4444444444499 +HHHH444444444999 +HHHHH44444449999 +HHHHHH4444499999 +HHHHHH0000999999 +HHHHHH0000999999 +HHHHHH0000999999 +HHHHHH0000999999 +HHHHH.....999999 +HHHH.......99999 +HHH.........9999 +HH...........999 +H.............99 +...............9`], + + [centerYellow, bitmap` .444444444444444 -..44444444444443 -...4444444444433 -....444444444333 -.....44444443333 -......4444433333 -......0000333333 -......0000333333 -......0000333333 -......0000333333 -.....55555333333 -....555555533333 -...5555555553333 -..55555555555333 -.555555555555533 -5555555555555553`], - - [ black, bitmap` +..44444444444449 +...4444444444499 +....444444444999 +.....44444449999 +......4444499999 +......0000999999 +......0000999999 +......0000999999 +......0000999999 +.....55555999999 +....555555599999 +...5555555559999 +..55555555555999 +.555555555555599 +5555555555555559`], + + [black, bitmap` 0000000000000000 0000000000000000 0000000000000000 @@ -445,27 +463,35 @@ setLegend( 0000000000000000`] ); + // yeah i did change the color but frogot the names but doin dat would take too long for me and im kinda lazy. + // i changed it for half of the things so like by the time it works ig. -_- + let maps = { default: map` nab mqe jif`, - red: map` + + orange: map` nac ms. jih`, + blue: map` nab mte l.g`, + yellow: map` pab .ue kif`, + green: map` o.d mre jif`, + blank: map` ... ... @@ -474,47 +500,139 @@ jif`, setMap(maps.default); +// This tells the game at what spped do i start at and up to how fast does it go. +let flashSpeed = 650; +const minSpeed = 250; function flashColor(colorName) { setMap(maps[colorName]); setTimeout(() => { setMap(maps.default); - }, 300); + }, Math.min(300, flashSpeed * 0.6)); } -const colors = ["green", "yellow", "blue", "red"]; +const colors = ["green", "yellow", "blue", "orange"]; let sequence = []; let position = 0; let phase = "waiting"; let score = 0; +let highScore = 0; +let soundEnabled = true; +let paused = false; +let gameID = 0; + + // so like this remplaces PLayTune into playSound for a sound toggle + // Like that u can turn off sound ir u a bum or if ur tryna take ur sprig to class +function playSound(sound) { + if (soundEnabled) { + playTune(sound); + } +} function updateStats() { clearText(); - - addText(`SCORE ${score}`, { - x: 6, + x: 3, + y: 14, + color: color`2` + }); + + addText(`BEST ${highScore}`, { + x: 11, y: 14, - color: color`1` + color: color`2` }); + + addText(`SPD ${Math.floor(score / 3) + 1}`, { + x: 12, + y: 1, + color: color`2` + }); + + if (!soundEnabled) { + addText("MUTE", { + x: 3, + y: 0, + color: color`C` + }); + } + + if (paused) { + addText("PAUSED", { + x: 7, + y: 7, + color: color`2` + }); + } +} + +function restartGame() { + gameID++; + + sequence = []; + position = 0; + score = 0; + + flashSpeed = 650; + + paused = false; + phase = "waiting"; + + setMap(maps.default); + updateStats(); + + startRound(); +} + + //soo like this pauses the game and +function gameTimeout(callback, delay) { + const currentGame = gameID; + let remaining = delay; + let lastTime = Date.now(); + + function checkTimer() { + if (currentGame !== gameID) return; + + const now = Date.now(); + + if (!paused) { + remaining -= now - lastTime; + } + + lastTime = now; + + if (remaining <= 0) { + callback(); + } else { + setTimeout(checkTimer, Math.min(remaining, 50)); + } + } + + setTimeout(checkTimer, Math.min(delay, 50)); } function startRound() { phase = "showing"; position = 0; - + + // So the fancy math thing makes the speed faster and faster so its a bit more of a challenge + flashSpeed = Math.max( + minSpeed, + 650 - Math.floor(score / 2) * 40 + ); const randomIndex = Math.floor(Math.random() * colors.length); const nextColor = colors[randomIndex]; sequence.push(nextColor); - playTune(click) + + playSound(click); updateStats(); - setTimeout(() => { + gameTimeout(() => { showSequence(0); }, 600); } @@ -522,35 +640,38 @@ function startRound() { function showSequence(index) { if (index >= sequence.length) { phase = "input"; - playTune(beep2) + playSound(beep2); return; } flashColor(sequence[index]); -//beep when color appears - playTune(beep) + playSound(beep); - setTimeout(() => { + gameTimeout(() => { showSequence(index + 1); - }, 650); + }, flashSpeed); } function checkInput(colorName) { - if (phase !== "input") { - return; - } + if (phase !== "input" || paused) { + return; +} const expectedColor = sequence[position]; if (colorName !== expectedColor) { phase = "over"; + paused = false; + gameID++; setMap(maps.blank); clearText(); addText("Game Over!", { y: 4 }); addText(`Score: ${score}`, { y: 6 }); - playTune(loose) + addText(`BEST ${highScore}`, { y: 8 }); + addText("J TO RESTART", { y: 13 }); + playSound(loose); return; } @@ -560,12 +681,15 @@ function checkInput(colorName) { if (position === sequence.length) { score += 1; + if (score > highScore) { + highScore = score; +} - setTimeout(() => { + gameTimeout(() => { startRound(); }, 800); } else { - setTimeout(() => { + gameTimeout(() => { phase = "input"; }, 350); } @@ -574,6 +698,22 @@ function checkInput(colorName) { onInput("w", () => checkInput("green")); onInput("a", () => checkInput("yellow")); onInput("s", () => checkInput("blue")); -onInput("d", () => checkInput("red")); +onInput("d", () => checkInput("orange")); + //fancy feature keybinds +onInput("l", () => { + soundEnabled = !soundEnabled; + updateStats(); +}); +onInput("k", () => { + if (phase === "over") return; + + paused = !paused; + updateStats(); +}); +onInput("j", () => { + if (phase === "over") { + restartGame(); + } +}); -startRound(); \ No newline at end of file +startRound();