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.
Diff: main.cpp
- Revision:
- 135:888ae932cd70
- Parent:
- 134:48c4b408868c
- Child:
- 136:04a2724f90cf
--- a/main.cpp Thu May 09 09:10:24 2019 +0000
+++ b/main.cpp Thu May 09 09:45:37 2019 +0000
@@ -102,7 +102,7 @@
void title_screen()
{
tilt = false; // reset the tilt variable so that on start, joystick is default
- breakout.set_mult_zero();
+ breakout.reset_mult();
lcd.clear();
lcd.setBrightness(1); // stops the game from dimming (hardware bug?)
@@ -139,6 +139,8 @@
void main_menu()
{
+ lcd.setBrightness(1); // fixes random screen dimming (hardware bug?)
+
lcd.clear();
lcd.printString(" START ",0,1); // start game with default as joystick
lcd.printString(" SETTINGS ",0,2); // choose between joystick and tilt
@@ -148,8 +150,9 @@
lcd.refresh();
wait(0.3); // load initial frame
- pad.reset_flags(); // fixes button bounce and prevents inputs carrying through to different menus
-
+ pad.reset_flags(); // manually resets all button flags which fixes button bounce and prevents inputs carrying through to different menus
+ pad.leds_off(); // prevents hardware bug where right most led flickers
+
int pointer = 1;
while (pad.check_event(Gamepad::A_PRESSED) == false) {
@@ -333,7 +336,7 @@
}
}
- if (breakout.get_lives() == 0) { // when all lives lost, enter loss screen
+ if (breakout.get_paddle_lives() == 0) { // when all lives lost, enter loss screen
pad.leds_off(); //turns last led off (doesnt run through and update board so last led doent turn off via lives leds
loss_screen();
}
@@ -570,7 +573,7 @@
breakout.reset_paddle_lives(); // resets lives back to 6
breakout.set_prev_score(0); // resets prev score to 0
number_of_frames = 0; // reset the number of frames
- breakout.set_mult_zero(); // reset multiplier
+ breakout.reset_mult(); // reset multiplier
breakout.reset_game(); // return game to initial positions
}