Fix score display
This commit is contained in:
parent
187bfe12ac
commit
314622ea0b
1 changed files with 5 additions and 1 deletions
|
@ -8,6 +8,7 @@ LiquidCrystal lcd(9, 8, 4, 5, 6, 7);
|
|||
byte sequence[MAX_GAME] = {};
|
||||
int8_t currentPosition = -1;
|
||||
bool win = true;
|
||||
bool over = false;
|
||||
|
||||
void setup() {
|
||||
pinMode(LED_BUILTIN, OUTPUT);
|
||||
|
@ -24,6 +25,9 @@ void setup() {
|
|||
|
||||
void loop() {
|
||||
if (currentPosition + 1 >= MAX_GAME) {
|
||||
over = true;
|
||||
}
|
||||
if (over) {
|
||||
endGame(lcd, win, currentPosition);
|
||||
return;
|
||||
}
|
||||
|
@ -35,7 +39,7 @@ void loop() {
|
|||
playSequence(sequence, currentPosition);
|
||||
if (!userSequence(sequence, currentPosition)) {
|
||||
win = false;
|
||||
currentPosition = MAX_GAME;
|
||||
over = true;
|
||||
}
|
||||
|
||||
delay(2000);
|
||||
|
|
Loading…
Reference in a new issue