[Sprig App] Simon Says Button Edition! - #4099
Open
prakhar-gamer wants to merge 1 commit into
Open
Conversation
|
@prakhar-gamer is attempting to deploy a commit to the Hack Club Team on Vercel. A member of the Team first needs to authorize it. |
|
[Auto Triage] PR detected. Apply |
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new Sprig game implementing a “Simon Says” memory sequence using a 3×3 button grid navigated by WASD and selected with i.
Changes:
- Introduces sprites/bitmaps for button states (base, hover, guessed, clicked, wrong, won).
- Generates a random-length sequence and plays it back as an animation.
- Implements hover navigation + guessing logic with win/lose handling.
Comments suppressed due to low confidence (3)
games/Simon-Says-Button-Edition!.js:238
playSequence()callssetMap(buttonGrid)afterbuttons/chosenButtonsare built from sprites created by the initialsetMap. In Sprig,setMaprecreates sprites, so later.typechanges (clicked/wrong) are applied to stale sprite objects and won’t visually update the grid. Avoid resetting the map here (or rebuildbuttons/chosenButtonsfrom the new map).
function playSequence() {
//plays the animation at the start and on mistake of the blue sprites
setMap(buttonGrid)
start = false
for (let r = 0; r < chosenButtons.length; r++){
games/Simon-Says-Button-Edition!.js:167
- The
else {}block after checkingpickedButtonis empty; removing it avoids dead code and makes the intent clearer.
if (pickedButton) {
chosenButtons.push(pickedButton)
} else {
}
games/Simon-Says-Button-Edition!.js:174
hoveringButtonandbuttonValare declared but never used; removing unused variables reduces confusion and prevents lint warnings.
let start = false
var hoveringButton
var buttonVal = 0
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+146
to
+162
| //per round buttons | ||
| const avaliableButtons = buttons.slice() | ||
| const chosenButtons = [] | ||
|
|
||
|
|
||
| //picks the buttons that are gonna be the goal | ||
| for (let i = 0; i < randRounds; i++) { | ||
| if (avaliableButtons.length === 0) { | ||
| console.log("No buttons left to pick.") | ||
| break | ||
| } | ||
|
|
||
| //rand amount of buttons | ||
| const randIndex = Math.floor(Math.random() * avaliableButtons.length) | ||
|
|
||
| const pickedButton = avaliableButtons.splice(randIndex, 1)[0] | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Author name
Author: prakhar-gamer
About your game
What is your game about?
The game has a random amount of rounds that you have to predict the right order, if you get it wrong it plays the sequence animation again, and marks that as wrong for a split secound. When u win it shows you only the correct buttons, and a little celeberation Text!
How do you play your game?
W A S D - To control the hovered buttons
i - to select a button!