Yang Zhenye 201199680
Dependencies: mbed
Diff: Rooney/Rooney.cpp
- Revision:
- 6:4abef55fee88
- Parent:
- 5:fcad75e9b9e1
- Child:
- 7:a69ae964412c
diff -r fcad75e9b9e1 -r 4abef55fee88 Rooney/Rooney.cpp --- a/Rooney/Rooney.cpp Thu May 14 14:13:03 2020 +0000 +++ b/Rooney/Rooney.cpp Thu May 14 15:55:41 2020 +0000 @@ -61,26 +61,34 @@ _speed = 0;} } -void player::draw_gate(N5110 &lcd) { - lcd.drawLine(unsigned int const x0, - unsigned int const y0, - unsigned int const x1, - unsigned int const y1, - FullBlack) +//void player::draw_gate(N5110 &lcd) { +// lcd.drawLine(unsigned int const x0, +// unsigned int const y0, +// unsigned int const x1, +// unsigned int const y1, +// FullBlack) +//} +void player::add_score() +{ + _score++; } - -bool player::collisicon_flag() { - if ((_player_x == _x() - 2) && (_player_y == _y() - 5)) { +int player::get_score() +{ + return _score; +} +bool player::collision_flag() { + if ((_player_x == _x - 2) && (_player_y == _y - 5)) { _collision_flag = true; - _player_score++; + _score++; } + } int * player::get_form(rooneybody body){ if (body == left){ return *left} else if (body == right){ return *right} else if (body == stand){ - return *stand} + return *stand}} lcd.drawSprite(_player_x, _player_y, 5, 10, (int *)get_form(body)); int player::get_x(){ return _player_x; @@ -90,4 +98,5 @@ } int player::get_speed(){ return _speed; - } \ No newline at end of file + } + \ No newline at end of file