Yang Zhenye 201199680

Dependencies:   mbed

Committer:
yangzhenye
Date:
Tue Apr 28 10:21:42 2020 +0000
Revision:
1:74f525027af6
Parent:
0:ac2868313b41
Child:
2:baca89f466bc
Ball model

Who changed what in which revision?

UserRevisionLine numberNew contents of line
yangzhenye 1:74f525027af6 1 #include "Ronny.h"
yangzhenye 1:74f525027af6 2 int stand[5][10] = {
yangzhenye 1:74f525027af6 3 {0,0,1,0,0},
yangzhenye 1:74f525027af6 4 {0,1,0,1,0},
yangzhenye 1:74f525027af6 5 {0,0,1,0,0},
yangzhenye 1:74f525027af6 6 {1,0,1,0,1},
yangzhenye 1:74f525027af6 7 {1,1,1,1,1},
yangzhenye 1:74f525027af6 8 {0,0,1,0,0},
yangzhenye 1:74f525027af6 9 {0,0,1,0,0},
yangzhenye 1:74f525027af6 10 {0,0,1,0,0},
yangzhenye 1:74f525027af6 11 {0,1,0,1,0},
yangzhenye 1:74f525027af6 12 {1,0,0,0,1},
yangzhenye 1:74f525027af6 13 };
yangzhenye 1:74f525027af6 14 int left[10][5] = {
yangzhenye 1:74f525027af6 15 {0,0,0,1,1,0,0,0,0,1},
yangzhenye 1:74f525027af6 16 {0,1,0,0,1,0,0,0,1,0},
yangzhenye 1:74f525027af6 17 {1,0,1,1,1,1,1,1,0,0},
yangzhenye 1:74f525027af6 18 {0,1,0,0,1,0,0,0,1,0},
yangzhenye 1:74f525027af6 19 {0,0,0,1,1,0,0,0,0,1},
yangzhenye 1:74f525027af6 20 };
yangzhenye 1:74f525027af6 21 int right[10][5] = {
yangzhenye 1:74f525027af6 22 {1,0,0,0,0,1,1,0,0,0},
yangzhenye 1:74f525027af6 23 {0,1,0,0,0,1,0,0,1,0},
yangzhenye 1:74f525027af6 24 {0,0,1,1,1,1,1,1,0,1},
yangzhenye 1:74f525027af6 25 {0,1,0,0,0,1,0,0,1,0},
yangzhenye 1:74f525027af6 26 {1,0,0,0,0,1,1,0,0,0},
yangzhenye 1:74f525027af6 27 };
yangzhenye 1:74f525027af6 28
yangzhenye 1:74f525027af6 29 void player::init(){
yangzhenye 1:74f525027af6 30 _x=38;
yangzhenye 1:74f525027af6 31 _y=5;
yangzhenye 1:74f525027af6 32 }
yangzhenye 1:74f525027af6 33 void player::set_palyer_x(float joy_x int speed) {
yangzhenye 1:74f525027af6 34 _speed=speed;
yangzhenye 1:74f525027af6 35 if (joy_x < float(-0.5){
yangzhenye 1:74f525027af6 36 _speed=-0.5;
yangzhenye 1:74f525027af6 37 _x=38+_speed;
yangzhenye 1:74f525027af6 38 else if (x<=0){
yangzhenye 1:74f525027af6 39 _speed = 0
yangzhenye 1:74f525027af6 40 }
yangzhenye 1:74f525027af6 41 }
yangzhenye 1:74f525027af6 42 if (joy_x > float(0.5){
yangzhenye 1:74f525027af6 43 _speed=0.5;
yangzhenye 1:74f525027af6 44 _x=38+_speed;
yangzhenye 1:74f525027af6 45 else if (x>=80){
yangzhenye 1:74f525027af6 46 _speed = 0
yangzhenye 1:74f525027af6 47 }
yangzhenye 1:74f525027af6 48 }
yangzhenye 1:74f525027af6 49 bool player::collisicon_flag() {}
yangzhenye 1:74f525027af6 50 int * player::get_form(roonybody){
yangzhenye 1:74f525027af6 51 if (roonybody == left){
yangzhenye 1:74f525027af6 52 return *left}
yangzhenye 1:74f525027af6 53 else if (ronnybody == right){
yangzhenye 1:74f525027af6 54 return *right}
yangzhenye 1:74f525027af6 55 else if (ronnybody == stand){
yangzhenye 1:74f525027af6 56 return *stand}
yangzhenye 1:74f525027af6 57 lcd.drawSprite(_x, _y, 5, 10, (int *)get_form(ronnybody));
yangzhenye 1:74f525027af6 58 int player::get_x(){
yangzhenye 1:74f525027af6 59 return _x;
yangzhenye 1:74f525027af6 60 }
yangzhenye 1:74f525027af6 61 int player::get_y(){
yangzhenye 1:74f525027af6 62 return _y;
yangzhenye 1:74f525027af6 63 }
yangzhenye 1:74f525027af6 64 int player::get_speed(){
yangzhenye 1:74f525027af6 65 return _speed;
yangzhenye 1:74f525027af6 66 }