Kostadin Chakarov / Mbed 2 deprecated el17kec

Dependencies:   mbed

Revision:
6:39bda45efeed
Parent:
5:12c179da4788
Child:
7:cd3cafda3dd4
diff -r 12c179da4788 -r 39bda45efeed main.cpp
--- a/main.cpp	Tue Mar 26 09:16:35 2019 +0000
+++ b/main.cpp	Mon Apr 08 09:14:33 2019 +0000
@@ -23,9 +23,9 @@
 #include "mbed.h"
 #include "N5110.h"
 #include "Gamepad.h"
-#include "PlayerControl.h" 
-#include "Ball.h"  
-#include "Map.h" 
+#include "PlayerControl.h"
+#include "Ball.h"
+#include "Map.h"
 
 const int fps = 10; //sets the fps of the game doesn't change
 
@@ -80,21 +80,28 @@
     }
 }
 
-void render() {
-    map.setCenterpoints();
+void render() 
+{
+    map.initBricks();
+    
     while(1) 
-    {
+    {   
+        // physics, input + game logic
+        cont.controlPlayer(pad); 
+        cont.get_padPos(pad); 
+        ball.getballPos();
+        ball.move();
+        ball.hitPad(pad, cont);
+        map.checkCollision(ball);
+        ball.endCondition(pad, lcd, cont);
+        
+        // rendering
         lcd.clear(); // initialise the LCD
         map.drawMap(lcd);
         cont.drawPlayer(lcd);
-        cont.controlPlayer(pad); 
-        cont.get_padPos(pad); 
-        ball.drawBall(lcd);
-        ball.get_ballPos(pad);
-        ball.moveBall();
-        ball.hitPad(pad);
+        ball.draw(lcd);
         lcd.refresh();
-        ball.endCondition(pad, lcd);
+        
         wait(1.0f/fps);
     }
 }
\ No newline at end of file