Yang Zhenye 201199680

Dependencies:   mbed

Revision:
5:fcad75e9b9e1
Parent:
4:eb8dca1dc341
Child:
6:4abef55fee88
--- a/Rooney/Rooney.cpp	Wed May 13 14:55:07 2020 +0000
+++ b/Rooney/Rooney.cpp	Thu May 14 14:13:03 2020 +0000
@@ -1,5 +1,21 @@
-#include "Ronney.h"
-int stand[5][10] = {
+/* 
+ELEC2645 Embedded Systems Project
+School of Electronic & Electrical Engineering
+University of Leeds
+2019/20
+
+Name:Yang Zhenye
+Username:el17zy
+Student ID Number:201199680
+Date:2020/5/12
+*/
+
+#include "Rooney.h"
+
+player::player(){}
+player::~player(){}
+
+int _stand[10][5] = {
     {0,0,1,0,0},
     {0,1,0,1,0},
     {0,0,1,0,0},
@@ -11,14 +27,14 @@
     {0,1,0,1,0},
     {1,0,0,0,1},
     };
-int left[10][5] = {
+int _left[5][10] = {
     {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] = {
+int _right[5][10] = {
     {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},
@@ -30,42 +46,42 @@
      _player_x=38;
      _player_y=5;
      }
- void player::set_palyer_x(float joy_x int speed) {
+ void player::set_palyer_x(float joy_x, int speed) {
      _speed=speed;
-     if (joy_x < float(-0.5){ 
+     if (joy_x < float(-0.5)){ 
      _speed=-0.5;
-     _player_x=38+_speed;
-     else if (x<=0){
-         _speed = 0
+     _player_x=38+_speed;}
+     else if (_player_x<=0){
+         _speed = 0;
          }
-     }
-     if (joy_x > float(0.5){ 
+     if (joy_x > float(0.5)){ 
      _speed=0.5;
-     _player_x=38+_speed;
-     else if (x>=80){
-         _speed = 0
-         }
+     _player_x=38+_speed;}
+     else if (_player_x>=80){
+         _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)
-{
+}
+
 bool player::collisicon_flag() {
     if ((_player_x == _x() - 2) && (_player_y == _y() - 5)) {  
     _collision_flag = true;
     _player_score++;
     }
-int * player::get_form(rooneybody){
-    if (rooneybody == left){
+int * player::get_form(rooneybody body){
+    if (body == left){
         return *left}
-        else if (ronneybody == right){
+        else if (body == right){
             return *right}
-            else if (ronneybody == stand){
+            else if (body == stand){
                 return *stand}
-lcd.drawSprite(_player_x, _player_y, 5, 10, (int *)get_form(ronneybody));
+lcd.drawSprite(_player_x, _player_y, 5, 10, (int *)get_form(body));
 int player::get_x(){
     return _player_x;
     }