Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Fork of el17dg by
Diff: main/main.cpp
- Revision:
- 19:b78fa41d04a9
- Parent:
- 18:6becc9f9de5e
- Child:
- 20:557e84189a57
--- a/main/main.cpp Tue Mar 19 12:43:01 2019 +0000
+++ b/main/main.cpp Thu Mar 21 15:12:07 2019 +0000
@@ -12,6 +12,7 @@
#include "main.h"
#include "game.h"
#include "menu.h"
+#include "models.h"
@@ -27,6 +28,14 @@
Menu menu;
Game game;
+struct IntroMove {
+ int x;
+ int y;
+};
+
+IntroMove lineOne;
+IntroMove lineTwo;
+
//static const unsigned int MAX_LINE_LENGTH = 14;
@@ -55,8 +64,9 @@
lcd.clear();
if (current_screen == ScreenOption_Game) {
- bool gameIsPaused = game.updateAndDraw();
- if (gameIsPaused) {
+ bool game_is_paused = game.updateAndDraw();
+
+ if (game_is_paused) {
current_screen = ScreenOption_Menu;
}
}
@@ -66,20 +76,49 @@
current_screen = menu.getCurrentScreenSelection();
}
}
+ bool game_over = game.checkGameOver();
+ if (game_over){
+ lcd.clear();
+ lcd.printString("GameOver",0,1);
+ lcd.refresh();
+ wait(1);
+ lcd.printString("Press Y",0,4);
+ lcd.printString("to restart",0,5);
+ lcd.refresh();
+ bool led_state = false;
+ while (!gamepad.check_event(gamepad.Y_PRESSED)){//////////////////////////////
+ gamepad.led(1,(float)led_state);
+ gamepad.led(2,(float)!led_state);
+ gamepad.led(3,(float)led_state);
+ gamepad.led(4,(float)!led_state);
+ gamepad.led(5,(float)led_state);
+ gamepad.led(6,(float)!led_state);
+ wait(0.5);
+ led_state = !led_state;
+ }
+ current_screen = ScreenOption_Menu;
+ }
lcd.refresh();
wait_ms(1000/fps);
}
}
-void intro(){ // This just will be an intro for the game.
- lcd.clear();
- lcd.printString(" StarBarians",1,1);
+void intro(){
+ lineOne.x = -63;
+ lineOne.y = 2; // This just will be an intro for the game.//////////////////
+
+ for (int i = 0; i < 67; i++){
+ lcd.clear();
+ lcd.drawSprite(lineOne.x + i, lineOne.y, 11, 63, (int*)introLineOne);
+ lcd.refresh();
+ wait(0.00001);
+ }
+ /*lcd.printString(" StarBarians",1,1);
lcd.refresh();
wait(0.5);
lcd.printString(" And the quest ",1,2);
lcd.printString(" of the Princess Spacecate",1,3);
- lcd.printString(" Spacecate",1,4);
- lcd.refresh();
- wait(0.5);
+ lcd.printString(" Spacecate",1,4);*/
+
}
\ No newline at end of file
