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.
Begin/Begin.cpp
- Committer:
- Wuuu
- Date:
- 2019-05-05
- Revision:
- 0:0aea7b9ba421
File content as of revision 0:0aea7b9ba421:
#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;
}