Commit ad8e008c authored by AlaskaLinuxUser's avatar AlaskaLinuxUser

Game State 2, how to play.

parent e44c2662
......@@ -128,7 +128,9 @@ void loop(){
gameLineNum = 1;
}
int gameDelay = 0;
while (gameDelay < 8000){
while (gameDelay < 2000){
// Add a delay in the loop.
delay(1);
gameDelay++;
lcd_key = read_LCD_buttons(); // read the buttons
......@@ -146,8 +148,6 @@ void loop(){
}
}
}
// Add a delay in the loop.
delay(100);
} // End gameState 0, asteroids start screen.
if (gameState == 1) { // Credits state.
......@@ -184,7 +184,9 @@ void loop(){
gameLineNum = 1;
}
int gameDelay = 0;
while (gameDelay < 10000){
while (gameDelay < 2000){
// Add a delay in the loop.
delay(1);
gameDelay++;
lcd_key = read_LCD_buttons(); // read the buttons
......@@ -207,45 +209,62 @@ void loop(){
}
}
}
// Add a delay in the loop.
delay(100);
} // End gameState 1, credits.
if (gameState == 2) { // How to info state.
// The player wants to know how to play, let's tell them.
lcd.setCursor(9,1); // move cursor to second line "1" and 9 spaces over
lcd.print(millis()/1000); // display seconds elapsed since power-up
lcd.setCursor(0,1); // move to the begining of the second line
lcd.setCursor(0,0); // set the LCD cursor position
lcd.print("Avoid asteroids ");
lcd.setCursor(0,1); // move to the begining of the second line
lcd.print("by up/down bttns");
if (gameLineNum > 2) {
lcd.setCursor(0,0); // set the LCD cursor position
lcd.print(" Select = Start ");
lcd.setCursor(0,1); // move to the begining of the second line
lcd.print(" Left = credits ");
gameLineNum = 0;
} else if (gameLineNum == 2) {
lcd.setCursor(0,0); // set the LCD cursor position
lcd.print("Select to go to ");
lcd.setCursor(0,1); // move to the begining of the second line
lcd.print("main menu screen");
gameLineNum = 3;
} else if (gameLineNum == 1) {
lcd.setCursor(0,0); // set the LCD cursor position
lcd.print("Right will shoot");
lcd.setCursor(0,1); // move to the begining of the second line
lcd.print("Left will pause ");
gameLineNum = 2;
} else if (gameLineNum == 0){
lcd.setCursor(0,0); // set the LCD cursor position
lcd.print("Avoid asteroids ");
lcd.setCursor(0,1); // move to the begining of the second line
lcd.print("by up/down bttns");
gameLineNum = 1;
}
int gameDelay = 0;
while (gameDelay < 2000){
// Add a delay in the loop.
delay(1);
gameDelay++;
lcd_key = read_LCD_buttons(); // read the buttons
switch (lcd_key){ // depending on which button was pushed, we perform an action
case btnRIGHT:{ // push button "RIGHT" and show the word on the screen
lcd.print("RIGHT ");
break;
}
case btnLEFT:{
lcd.print("LEFT "); // push button "LEFT" and show the word on the screen
break;
}
case btnUP:{
lcd.print("UP "); // push button "UP" and show the word on the screen
break;
}
case btnDOWN:{
lcd.print("DOWN "); // push button "DOWN" and show the word on the screen
break;
}
case btnSELECT:{
lcd.print("SELECT"); // push button "SELECT" and show the word on the screen
break;
}
case btnNONE:{
lcd.print("NONE "); // No action will show "None" on the screen
break;
}
}
switch (lcd_key){ // depending on which button was pushed, we perform an action
case btnLEFT:{
gameState = 1;
gameLineNum = 0;
break;
}
case btnSELECT:{
gameState = 3;
gameLineNum = 0;
break;
}
}
}
} // End gameState 2, How to info.
if (gameState == 3) { // Play state.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment