-
Notifications
You must be signed in to change notification settings - Fork 7
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
shift plus moving moves character as far as it can #1071
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1071 +/- ##
=======================================
Coverage 83.46% 83.46%
=======================================
Files 222 222
Lines 6386 6386
Branches 1360 1360
=======================================
Hits 5330 5330
Misses 1015 1015
Partials 41 41 ☔ View full report in Codecov by Sentry. |
let timesToMove = 1; | ||
|
||
// if code starts with arrow | ||
if (shiftKeyDown.current && code.startsWith('Arrow')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This logic should be moved to within the setGameState
of handleKeyDown
Need a condition around this section of code:
if (!makeMove(newGameState, direction, !disableAutoUndo)) {
return prevGameState;
}
to check if the shift key is pressed, and if so call makeMove in a loop until it fails
Would need to double check that the makeMove
function doesn't mess up the gameState object when the function returns false (since it updates in-place)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I was doing this first but then realized that undo may not work as expected. I can try it and see but I think that we wouldn't be storing the intermediate state
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting... I wonder what would be best there. Maybe it's nice if a single undo removes all the moves at once? Since the shift + move is kind of like one "move"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think it is less confusing if you can undo one at a time and not be in a batch...
@@ -335,28 +335,28 @@ export default function Game({ | |||
onNext(); | |||
} | |||
|
|||
return; | |||
return false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't need to return a boolean here, or if we do it should be more clear what the boolean means
No description provided.