Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: main.cpp
- Revision:
- 6:39bda45efeed
- Parent:
- 5:12c179da4788
- Child:
- 7:cd3cafda3dd4
--- 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