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
Diff: main.cpp
- Revision:
- 12:660458c41c8e
- Parent:
- 11:4723e7f3f1d2
- Child:
- 13:c3c58d50a571
diff -r 4723e7f3f1d2 -r 660458c41c8e main.cpp
--- a/main.cpp Thu May 09 03:49:59 2019 +0000
+++ b/main.cpp Thu May 09 04:26:16 2019 +0000
@@ -39,6 +39,7 @@
void introduction();
void fingersnap();
+///////////// Images ///////////////
const int Avenger0[25][32] = {
{ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
{ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0 },
@@ -152,7 +153,7 @@
init(); // initialise and then display welcome screen...
welcome();
- introduction();
+ introduction(); // The intro of the story
render();
wait(1.0f/fps); // and wait for one frame period
@@ -161,19 +162,22 @@
eng.update(pad);
render();
wait(1.0f/fps);
+ if (eng.get_score() < 3) { // setting diffculty regarding the current stone number
+ fps = 6;
+ }
if (eng.get_score() == 3) {
fps = 9;
}
- if (eng.get_score() >= 4) {
+ if (eng.get_score() == 4) {
fps = 12;
}
- if (eng.get_score() >= 5) {
+ if (eng.get_score() == 5) {
fps = 15;
}
- if (eng.get_score() == 6) {
+ if (eng.get_score() == 6) { // you win!!
fingersnap();
break;
- } else if (eng.get_score() < 0) {
+ } else if (eng.get_score() < 0) { // you lose :(
endgame();
break;
}
@@ -193,11 +197,11 @@
void welcome() {
lcd.clear();
- lcd.printString("Eternity Stone",0,0);
+ lcd.printString("Eternity Stone",0,0); //play messages
lcd.printString("Start story",9,4);
lcd.drawSprite(25,8,25,32,(int *)Avenger0);
lcd.refresh();
- pad.tone(440.00,0.21);
+ pad.tone(440.00,0.21); // adding avenger music
wait(0.21);
pad.tone(587.3,0.63);
wait(0.63);
@@ -223,7 +227,7 @@
wait(0.70);
pad.tone(587.3,0.63);
wait(0.70);
- while (pad.check_event(Gamepad::START_PRESSED) == false) {
+ while (pad.check_event(Gamepad::START_PRESSED) == false) { // add animation
lcd.clear();
lcd.printString("Eternity Stone",0,0);
lcd.printString("Start story",9,4);
@@ -249,7 +253,7 @@
lcd.printString("of all life",9,4);
lcd.printString("on Earth",18,5);
lcd.refresh();
- wait(2.0);
+ wait(1.0);
lcd.printString("(Press start)",3,1);
wait(1.0);
while (pad.check_event(Gamepad::START_PRESSED) == false) {
@@ -264,7 +268,7 @@
lcd.printString("time travel in",0,4);
lcd.printString("Quantum realm",3,5);
lcd.refresh();
- wait(3.0);
+ wait(1.0);
while ( pad.check_event(Gamepad::START_PRESSED) == false) {
lcd.refresh();
wait(0.5);