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:
- 134:48c4b408868c
- Parent:
- 133:05bb8de3c630
- Child:
- 135:888ae932cd70
--- a/main.cpp Thu May 09 09:02:23 2019 +0000
+++ b/main.cpp Thu May 09 09:10:24 2019 +0000
@@ -111,6 +111,8 @@
lcd.refresh();
pad.leds_off();
wait(0.5);
+
+ pad.reset_flags();
while (pad.check_event(Gamepad::START_PRESSED) == false) { // while start is not pressed alternate sprites
@@ -146,7 +148,7 @@
lcd.refresh();
wait(0.3); // load initial frame
- pad.reset_flags(); // fixes button bounce?
+ pad.reset_flags(); // fixes button bounce and prevents inputs carrying through to different menus
int pointer = 1;
@@ -199,7 +201,7 @@
lcd.refresh();
wait(0.1);
- pad.reset_flags(); // fixes button bounce?
+ pad.reset_flags(); // fixes button bounce
int pointer = 1; // init the pointer
@@ -256,7 +258,7 @@
lcd.refresh();
wait(0.1); // load initial frame
- pad.reset_flags(); // fixes button bounce?
+ pad.reset_flags(); // fixes button bounce
while (pad.check_event(Gamepad::B_PRESSED) == false) { // while B is not pressed to return to main menu, display instruction on how to interact with the game
@@ -288,7 +290,7 @@
void main_game() // the Game loop
{
- pad.reset_flags(); // fixes button bounce?
+ pad.reset_flags(); // fixes button bounce
int fps = 8; // frames per second
bool pause = false; // set pause screen to false
@@ -362,6 +364,8 @@
pad.tone(300.0,0.3);
wait(0.4);
+
+ pad.reset_flags();
while (pad.check_event(Gamepad::START_PRESSED) == false) { // flashes the score, waits for START to return to title screen
lcd.clear();
@@ -422,6 +426,8 @@
pad.tone(4000.0,0.6);
wait(0.6);
+
+ pad.reset_flags();
while (pad.check_event(Gamepad::START_PRESSED) || pad.check_event(Gamepad::BACK_PRESSED) == false) { // while neither START or BACK is pressed, flash the score and display options
lcd.clear();