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 6:4abef55fee88, committed 2020-05-14
- Comitter:
- yangzhenye
- Date:
- Thu May 14 15:55:41 2020 +0000
- Parent:
- 5:fcad75e9b9e1
- Commit message:
- el17zy
Changed in this revision
--- a/Menu/Menu.cpp Thu May 14 14:13:03 2020 +0000
+++ b/Menu/Menu.cpp Thu May 14 15:55:41 2020 +0000
@@ -59,7 +59,7 @@
void Menu::init() {
_state = 0;
_engine.init(); }
-
+// starting the menu
void Menu::run_engine(N5110 &lcd, Gamepad &gamepad) {
get_input(gamepad.check_event(Gamepad::START_PRESSED),gamepad.check_event(Gamepad::BACK_PRESSED),gamepad.check_event(Gamepad::X_PRESSED));
@@ -85,6 +85,7 @@
run_engine(lcd, gamepad); }
else if(_output == 2) {
display_page3(lcd, gamepad); } }
+ //display the three pages
void Menu::display_page1(N5110 &lcd, Gamepad &gamepad) {
--- 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
--- a/Rooney/Rooney.h Thu May 14 14:13:03 2020 +0000 +++ b/Rooney/Rooney.h Thu May 14 15:55:41 2020 +0000 @@ -20,20 +20,25 @@ void init(); void set_palyer_x(float joy_x, int speed); -void draw_gate(N5110 &lcd); -bool collisicon_flag(); +//void draw_gate(N5110 &lcd);] +bool collision_flag(); int * get_form(rooneybody body); int get_y(); int get_x(); int get_speed(); +void add_score(); +int get_score(); private: int _player_x; int _player_y; -bool _c_flag; +bool _collision_flag; int _speed; +int _x; +int _y; +int _score; rooneybody body; }; #endif