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: N5110 mbed PowerControl
Diff: GameScreen.cpp
- Revision:
- 10:d8ef8633bd98
- Parent:
- 9:c20f11f9b310
- Child:
- 11:c6c88617f7e7
--- a/GameScreen.cpp Mon Apr 27 14:24:59 2015 +0000
+++ b/GameScreen.cpp Mon Apr 27 21:10:23 2015 +0000
@@ -139,7 +139,7 @@
else
{
allPlatforms[n]->y = maxY_ - platThickness_ + 1; //send back to bottom.
- //allPlatforms[n]->x = rand() % (maxX_-platGapSize_ + 1) - 1; //select a new random position of gap!
+ allPlatforms[n]->x = rand() % (maxX_-platGapSize_ + 1) - 1; //select a new random position of gap!
}
}
@@ -147,14 +147,16 @@
Platform GameScreen::nextClosestPlatform(int y)
{
- int closestY = 15;
+ Serial serial(USBTX,USBRX);
+ int closestY = 100;
Platform closestPlatform;
for (int i = 0; i < numPlatforms_; i++)
{
- if ((allPlatforms[i]->y - y) < closestY && (allPlatforms[i]->y - y) >= -1)
+
+ if (((allPlatforms[i]->y - y) < closestY) && ((allPlatforms[i]->y - y) > -1))
{
- closestY = allPlatforms[i]->y;
+ closestY = allPlatforms[i]->y-y;
closestPlatform = *allPlatforms[i];
}
}