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: BreakoutEngine/BreakoutEngine.cpp
- Revision:
- 45:b1ac80481d4f
- Parent:
- 42:347c20a16ee6
- Child:
- 46:810b3a7fc387
--- a/BreakoutEngine/BreakoutEngine.cpp Fri Apr 26 15:10:18 2019 +0000
+++ b/BreakoutEngine/BreakoutEngine.cpp Fri Apr 26 16:23:47 2019 +0000
@@ -21,6 +21,7 @@
_speed = speed;
_number_left = 18;
_index = 0;
+ _cool_time = 0.0f;
// y position on screen - WIDTH is defined in N5110.h
_p1y = HEIGHT - GAP - 1;
@@ -89,7 +90,8 @@
else {
_p1.set_joy();
}
- if (pad.check_event(Gamepad::B_PRESSED)) { // max of 3 lasers on screen at once
+
+ if (pad.check_event(Gamepad::B_PRESSED) && _cool_time <= 0) { // max of 3 lasers on screen at once
Vector2D p_pos = _p1.get_pos();
it_L = listofLasers.begin();
@@ -113,7 +115,14 @@
reset_index();
break;
}
+
+
+ _cool_time = 1.0f;
}
+ else {
+ _cool_time -= 0.125; // 1/8 as fps is 8
+ }
+
}
void BreakoutEngine::inc_index() {