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.
Dependencies: mbed
Diff: Game/Game.cpp
- Revision:
- 19:ec4cb22accb0
- Parent:
- 18:8256546a3cbf
- Child:
- 20:3ca430241df0
--- a/Game/Game.cpp Sun Mar 31 22:05:54 2019 +0000 +++ b/Game/Game.cpp Mon Apr 01 14:43:18 2019 +0000 @@ -1,6 +1,8 @@ #include "Game.h" + Serial pc(USBTX, USBRX); // tx, rx + Game::Game(){ homeSelection = 0; gamepad.init(); @@ -17,10 +19,10 @@ score = 0; selection = true; playing = true; + timer.reset(); while(1) { Vector2D coord = gamepad.get_coord(); renderer.clear(); - renderer.drawHorizon(coord.x/15); for (int c = 0; c< cubeVector.size(); c++) { @@ -35,9 +37,10 @@ faceVector.push_back(cubeVector[c].getFace(i)); } if (cubeVector[c].despawn()){ - cubeVector.erase(cubeVector.begin() + c); + //cubeVector.erase(cubeVector.begin() + c); Cube cube(rand()%100-50,0,90,5); - cubeVector.push_back(cube); + //cubeVector.push_back(cube); + cubeVector[c] = cube; } if (cubeVector[c].tooClose()){ cubeVector.erase(cubeVector.begin() + c); @@ -132,6 +135,5 @@ renderer.refresh(); wait_ms(1000/30); } - } \ No newline at end of file