fixed chaingame and made simpleled game follow idx
This commit is contained in:
@@ -10,6 +10,8 @@ uint8_t patternIndex = 0;
|
||||
uint8_t nextPatternIndex = 1;
|
||||
bool patternFlag = false;
|
||||
bool firstpattern = false;
|
||||
e_ledcolor cheatbutton = NONE;
|
||||
bool cheatButtonFlag = false;
|
||||
|
||||
// uint8_t ledpattern[4][3] = {
|
||||
// {1, 0, 0},
|
||||
@@ -45,19 +47,39 @@ void HandleChainGame(void)
|
||||
{
|
||||
turnOnLed(ledpattern[patternIndex]);
|
||||
patternFlag = true;
|
||||
cheatbutton = NONE;
|
||||
}
|
||||
else if (!buttonIsPressed(ledpattern[patternIndex]))
|
||||
else if (buttonIsPressed(cheatbutton))
|
||||
{
|
||||
turnOnLed(cheatbutton);
|
||||
cheatButtonFlag = true;
|
||||
}
|
||||
else if (!anybutton())
|
||||
{
|
||||
turnOffAllLed();
|
||||
if (patternFlag)
|
||||
{
|
||||
patternFlag = false;
|
||||
nextPattern();
|
||||
}
|
||||
turnOffLed(ledpattern[patternIndex]);
|
||||
if(cheatButtonFlag)
|
||||
{
|
||||
cheatButtonFlag = false;
|
||||
cheatbutton = NONE;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
if(buttonIsPressed(YELLOW2))
|
||||
{
|
||||
turnOffAllLed();
|
||||
cheatbutton = YELLOW;
|
||||
}
|
||||
else if(buttonIsPressed(RED2))
|
||||
{
|
||||
cheatbutton = RED;
|
||||
}
|
||||
else if(buttonIsPressed(GREEN2))
|
||||
{
|
||||
cheatbutton = GREEN;
|
||||
}
|
||||
|
||||
// if (buttonIsPressed(YELLOW) | buttonIsPressed(RED) | buttonIsPressed(GREEN))
|
||||
|
||||
Reference in New Issue
Block a user