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:
- 8:d9b602e58126
- Parent:
- 6:f7484a2f32fd
- Child:
- 9:571f92b0211b
diff -r f7484a2f32fd -r d9b602e58126 ModeA/ModeA.cpp
--- a/ModeA/ModeA.cpp Wed May 08 17:06:02 2019 +0000
+++ b/ModeA/ModeA.cpp Wed May 08 19:15:06 2019 +0000
@@ -23,10 +23,10 @@
{
x_position = 5;
y_position = 18;
- // speed = pad.read_pot();
+ speed = 1;
gravity = 1;
- screen_width = 50;
+ screen_width = 80;
bar_width = 10;
bar_speed = 2;
@@ -50,12 +50,12 @@
if ( pad.check_event(Gamepad::Y_PRESSED) == true) {
- speed = pad.read_pot();
+
speed = speed - gravity*5;
}
- if (y_position > 42) {
+ if (y_position > 44) {
lcd.clear();
lcd.printString("GAME OVER",6,2);
@@ -88,7 +88,7 @@
lcd.drawRect(screen_width,48-size_bottom,bar_width,size_bottom,FILL_BLACK);
lcd.refresh();
- if (bar_width > 50) {
+ if (screen_width > 50) {
srand(time(NULL));
size_top = rand() % 48;
srand(time(NULL));
@@ -97,7 +97,7 @@
// bar_speed = 0;
}
- if (bar_width == 0) {
+ if (screen_width == 5) {
srand(time(NULL));
size_top = rand() % 48;
srand(time(NULL));
@@ -105,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);