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: Begin/Begin.cpp
- Revision:
- 0:0aea7b9ba421
diff -r 000000000000 -r 0aea7b9ba421 Begin/Begin.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Begin/Begin.cpp Sun May 05 16:27:50 2019 +0000
@@ -0,0 +1,76 @@
+#include "Begin.h"
+
+Begin::Begin()
+{
+
+}
+
+Begin::~Begin()
+{
+
+}
+
+void Begin::init()
+{
+ _m = 0;
+ _s = 0;
+ _a1 = 0;
+ _b1 = 0;
+ _a2 = 0;
+ _b2 = 0;
+ _a3 = 0;
+ _b3 = 0;
+ _h = 0;
+ _Bird.init();
+ _Wall1.init();
+}
+
+int Begin::draw(N5110 &lcd, Gamepad &pad)
+{
+ lcd.drawRect(0,8,84,40,FILL_TRANSPARENT);
+ int* _ab = new int[7];
+ _ab = _Wall1.draw(lcd);
+ _a1 = _ab[0];
+ _b1 = _ab[1];
+ _a2 = _ab[2];
+ _b2 = _ab[3];
+ _a3 = _ab[4];
+ _b3 = _ab[5];
+ _s = _ab[6];
+ _h = _Bird.draw(lcd, pad);
+ char buffer1[14];
+ sprintf(buffer1,"score: %2d ",_s);
+ lcd.printString(buffer1,0,0);
+ if(_a1 == 0){
+ if(_h+2 <= _b1+1 | _h+8 >= _b1+15){
+ _m = 1;
+ }else{
+ _m = 0;
+ }
+ }
+ if(_a2 == 0){
+ if(_h+2 <= _b2+1 | _h+8 >= _b2+15){
+ _m = 1;
+ }else{
+ _m = 0;
+ }
+ }
+ if(_a3 == 0){
+ if(_h+2 <= _b3+1 | _h+8 >= _b3+15){
+ _m = 1;
+ }else{
+ _m = 0;
+ }
+ }
+ if(_h+2 <= 0 | _h+8 >= 48){
+ _m = 1;
+ }
+ return _m;
+}
+
+int Begin::get_score(N5110 &lcd){
+ int* _ab = new int[7];
+ _ab = _Wall1.draw(lcd);
+ _s = _ab[6];
+ return _s;
+}