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.
Game1/Game1.cpp
- Committer:
- Wuuu
- Date:
- 2019-05-05
- Revision:
- 0:0aea7b9ba421
File content as of revision 0:0aea7b9ba421:
#include "Game1.h"
Game1::Game1()
{
}
Game1::~Game1()
{
}
void Game1::init()
{
_m = 0;
_s = 0;
_a = 20;
_b = 20;
_Wall.init();
_Copter.init();
}
int Game1::draw(N5110 &lcd, Gamepad &pad)
{
lcd.drawRect(0,8,84,40,FILL_TRANSPARENT);
_Wall.draw(lcd);
_Copter.get_coord(pad);
_Copter.get_h();
_Copter.draw(lcd);
_s = _Copter.get_score();
char buffer1[14];
sprintf(buffer1,"score: %2d ",_s);
lcd.printString(buffer1,0,0);
int* _ab = new int[2];
_ab = _Wall.draw(lcd);
_a = _ab[0];
_b = _ab[1];
_c = _Copter.get_h();
int d = 8 + _b - _a;
int e = 8 + _b + _a;
if(d >= 21-_c | e <= 27-_c){
_m = 1;
}else{
_m = 0;
}
return _m;
}
int Game1::get_score() {
_s = _Copter.get_score();
return _s;
}