Yang Zhenye 201199680
Dependencies: mbed
Diff: Roony/Roony.cpp
- Revision:
- 1:74f525027af6
- Parent:
- 0:ac2868313b41
- Child:
- 2:baca89f466bc
diff -r ac2868313b41 -r 74f525027af6 Roony/Roony.cpp --- a/Roony/Roony.cpp Fri Apr 24 06:58:33 2020 +0000 +++ b/Roony/Roony.cpp Tue Apr 28 10:21:42 2020 +0000 @@ -0,0 +1,66 @@ +#include "Ronny.h" +int stand[5][10] = { + {0,0,1,0,0}, + {0,1,0,1,0}, + {0,0,1,0,0}, + {1,0,1,0,1}, + {1,1,1,1,1}, + {0,0,1,0,0}, + {0,0,1,0,0}, + {0,0,1,0,0}, + {0,1,0,1,0}, + {1,0,0,0,1}, + }; +int left[10][5] = { + {0,0,0,1,1,0,0,0,0,1}, + {0,1,0,0,1,0,0,0,1,0}, + {1,0,1,1,1,1,1,1,0,0}, + {0,1,0,0,1,0,0,0,1,0}, + {0,0,0,1,1,0,0,0,0,1}, + }; +int right[10][5] = { + {1,0,0,0,0,1,1,0,0,0}, + {0,1,0,0,0,1,0,0,1,0}, + {0,0,1,1,1,1,1,1,0,1}, + {0,1,0,0,0,1,0,0,1,0}, + {1,0,0,0,0,1,1,0,0,0}, + }; + + void player::init(){ + _x=38; + _y=5; + } + void player::set_palyer_x(float joy_x int speed) { + _speed=speed; + if (joy_x < float(-0.5){ + _speed=-0.5; + _x=38+_speed; + else if (x<=0){ + _speed = 0 + } + } + if (joy_x > float(0.5){ + _speed=0.5; + _x=38+_speed; + else if (x>=80){ + _speed = 0 + } + } +bool player::collisicon_flag() {} +int * player::get_form(roonybody){ + if (roonybody == left){ + return *left} + else if (ronnybody == right){ + return *right} + else if (ronnybody == stand){ + return *stand} +lcd.drawSprite(_x, _y, 5, 10, (int *)get_form(ronnybody)); +int player::get_x(){ + return _x; + } +int player::get_y(){ + return _y; + } +int player::get_speed(){ + return _speed; + } \ No newline at end of file