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: Paddle/Paddle.cpp
- Revision:
- 9:f6f0f39538c7
- Parent:
- 1:e18615d46071
- Child:
- 15:b867a6620f96
--- a/Paddle/Paddle.cpp Sun Apr 21 19:40:05 2019 +0000
+++ b/Paddle/Paddle.cpp Sun Apr 21 20:44:24 2019 +0000
@@ -19,6 +19,7 @@
_width = width;
_speed = 1; // default speed
_score = 0; // start score from zero
+ _lives = 6;
}
@@ -58,6 +59,16 @@
return _score;
}
+int Paddle::get_lives()
+{
+ return _lives;
+}
+
+void Paddle::lose_life()
+{
+ _lives--;
+}
+
Vector2D Paddle::get_pos() {
Vector2D p = {_x,_y};
return p;