Asteroids for MBED game with Bluetooth LE UART Friend Controller, uLCD, speaker, and uSD.

Dependencies:   4DGL-uLCD-SE mbed-rtos mbed

Asteroids for MBED game with Bluetooth LE UART Friend Controller

Revision:
3:14a2729625f6
Parent:
2:332ca4f1a3e3
Child:
4:563648944ecc
--- a/main.cpp	Sat Mar 12 01:52:01 2016 +0000
+++ b/main.cpp	Sat Mar 12 01:58:53 2016 +0000
@@ -4,9 +4,11 @@
 #include <math.h>
 #include <list>
 using namespace std;
+
 //constants
-#define ACCEL = .5
-#define ROTTA = .2
+#define ACCEL .5
+#define ROTTA .2
+
 //devices
 DigitalOut myled(LED1);
 uLCD_4DGL ulcd(p28,p27,p29);
@@ -24,7 +26,8 @@
     Movement(double xp,double yp,double xv,double yv,double a,double r,double w);
     void move();
     void accelerate();
-    void 
+    void turn_left();
+    void turn_right();
 
 };
 
@@ -46,12 +49,11 @@
     y_pos += y_vel;
     if(x_pos < 0 || x_pos > 144 && x_pos < 0 || x_pos > 144) {
         if(wrap) {
-            x_pos = 144(1 - ceil(x_pos/144)) + x_pos;
-            y_pos = 144(1 - ceil(y_pos/144)) + y_pos;
+            x_pos += 144*(1 - ceil(x_pos/144));
+            y_pos += 144*(1 - ceil(y_pos/144));
         } else {
             }
     }
-
 }
 
 void Movement::accelerate()
@@ -64,6 +66,14 @@
     }
 }
 
+void Movement::turn_left(){
+    angle -= ROTTA;
+}
+
+void Movement::turn_right(){
+    angle += ROTTA;
+}
+    
 //collisions
 bool collision(Movement p1, Movement p2)
 {
@@ -88,7 +98,7 @@
     list<Movement> bullets();
     while(1) {
         player.move();
-        calc_collisions();
+        //calc_collisions();
         //draw_objs(player, asteroids, bullets);
 
     }