ELEC2645 (2016/17) / Mbed 2 deprecated Bomb_WeixiTao_el16wt

Dependencies:   mbed

Revision:
3:dd4678a85a1a
Parent:
1:83459533ff72
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Human/human.cpp	Thu May 04 13:56:12 2017 +0000
@@ -0,0 +1,46 @@
+#include "human.h"
+extern N5110 lcd;
+extern Gamepad pad;
+
+
+double human::humanX()
+{
+    while(1) {
+    Vector2D human_x = pad.get_coord();
+    x = (int)(human_x.x*40);         //-1 to 1.
+          
+    //printf("The value of x(sight) is %i\n",x);
+    
+    return x;
+    
+    
+    }
+}
+
+
+double human::humanY()
+{
+    while(1) {
+            Vector2D human_y = pad.get_coord();
+            y = (int)(-19*human_y.y)-6; //-1 to 1 
+
+            //printf("The value of y(sight) is %i\n",y);
+            
+    return y;
+    }
+}
+
+
+void human:: print_human()
+{
+    lcd.drawRect(41+x,24+y,3,3,FILL_BLACK); //head
+    lcd.drawLine(41+x+1,24+y+3,41+x+1,24+y+6,1); //body
+    lcd.drawLine(41+x,24+y+4,41+x+2,24+y+4,1);// hands
+    lcd.drawLine(41+x+1,24+y+6,41+x,24+y+7,1);// left leg
+    lcd.drawLine(41+x+1,24+y+6,41+x+2,24+y+7,1);// right leg
+
+    lcd.refresh();
+
+
+    
+}
\ No newline at end of file