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
Revision 15:0a55e0ac8421, committed 2018-04-23
- Comitter:
- RickYu
- Date:
- Mon Apr 23 22:36:11 2018 +0000
- Parent:
- 14:a4176da69b49
- Child:
- 16:75122d14153c
- Commit message:
- add score while not work.....
Changed in this revision
| engine/engine.cpp | Show annotated file Show diff for this revision Revisions of this file |
| rec/rect.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/engine/engine.cpp Mon Apr 23 22:18:33 2018 +0000
+++ b/engine/engine.cpp Mon Apr 23 22:36:11 2018 +0000
@@ -142,6 +142,7 @@
money_pos.y = 0;
money_pos.x = rand()%84;
pad.tone(750.0,0.1);
+ _rect.add_score();
//engine::print_scores(lcd);
}
@@ -153,8 +154,13 @@
void engine::print_scores(N5110 &lcd)
{
-
+ int rect_score = _rect.get_score();
+ char buffer1[14];
+
lcd.clear();
+ sprintf(buffer1,"%2d",rect_score);
+ lcd.printString(buffer1,WIDTH/2 - 20,1);
+
lcd.printString(" Game Over",0,1);
lcd.refresh();
wait(2);
--- a/rec/rect.cpp Mon Apr 23 22:18:33 2018 +0000
+++ b/rec/rect.cpp Mon Apr 23 22:36:11 2018 +0000
@@ -13,6 +13,7 @@
{
//set the rect move speed
rect_speed = 0.5; // default speed
+ rect_score = 10;
}
void rect::draw(N5110 &lcd)
@@ -55,7 +56,6 @@
void rect::set_pos(Vector2D p)
{
rect_x = p.x;
- //rect_y = p.y;
}