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.
Revision 15:72c494e934c8, committed 2013-08-23
- Comitter:
- vsluiter
- Date:
- Fri Aug 23 08:03:51 2013 +0000
- Parent:
- 14:5b588ea6bd8f
- Child:
- 16:f0176e9e4a9d
- Commit message:
- Corrected paddle for right position againg. Position NUMBER_OF_PIXELS-1 is where a hit is registered.
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Fri Aug 23 07:52:12 2013 +0000
+++ b/main.cpp Fri Aug 23 08:03:51 2013 +0000
@@ -184,11 +184,11 @@
{
//printf("\n\rright pushed");
rightpushed = false;
- if(rightpushpos >= NUMBER_OF_PIXELS )
+ if(rightpushpos >= NUMBER_OF_PIXELS-1 ) //also count when hit at last pixel = NUMBER_OF_PIXELS-1
{
paddle.direction = 0;
- paddle.setSpeed(25+(-NUMBER_OF_PIXELS+rightpushpos)*4);
- paddle.position = NUMBER_OF_PIXELS;
+ paddle.setSpeed(25+(rightpushpos-(NUMBER_OF_PIXELS-1))*4);
+ paddle.position = NUMBER_OF_PIXELS-1;
}
pc.printf("\n\rright pushed. Paddle position: %d, registered: %d", paddle.position, rightpushpos);
}
@@ -230,13 +230,13 @@
paddle.position = NUMBER_OF_PIXELS;
}
}
- if(gametimer.read()>6 && !naglevel1)
+ if(gametimer.read()>10 && !naglevel1)
{
naglevel1 = 1;
paddle.setSize(4);
//paddle.setSpeed(40);
}
- if(gametimer.read()>10 && !naglevel2)
+ if(gametimer.read()>15 && !naglevel2)
{
naglevel2 = 1;
paddle.setSize(2);