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: ModeA/ModeA.cpp
- Revision:
- 6:f7484a2f32fd
- Parent:
- 5:1c56acecc96e
- Child:
- 7:9a30314fa41f
- Child:
- 8:d9b602e58126
diff -r 1c56acecc96e -r f7484a2f32fd ModeA/ModeA.cpp
--- a/ModeA/ModeA.cpp Wed May 08 16:19:09 2019 +0000
+++ b/ModeA/ModeA.cpp Wed May 08 17:06:02 2019 +0000
@@ -23,7 +23,7 @@
{
x_position = 5;
y_position = 18;
- speed = pad.read_pot();
+ // speed = pad.read_pot();
gravity = 1;
screen_width = 50;
@@ -50,14 +50,28 @@
if ( pad.check_event(Gamepad::Y_PRESSED) == true) {
-
+ speed = pad.read_pot();
speed = speed - gravity*5;
}
if (y_position > 42) {
- y_position = 42;
- speed = 0;
+
+ lcd.clear();
+ lcd.printString("GAME OVER",6,2);
+ lcd.printString("Press BACK",6,4);
+ pad.tone(2000.0,0.3);
+ lcd.refresh();
+ bar_speed = 0;
+ speed = 0;
+ gravity = 0;
+ y_position = 48;
+ bar_width = 0;
+ size_top = 0;
+ size_bottom = 0;
+
+ wait(0.5);
+
}
if (y_position < 0) {
@@ -91,7 +105,7 @@
}
- if (size_top == 5) {
+ if (size_top == 5 ) {
lcd.clear();
lcd.printString("GAME OVER",6,2);
lcd.printString("Press BACK",6,4);