![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
1D-Pong game based on a LED strip with 150 LPD6803-controlled pixels. Game keeps score for 'best-of-21' game. Written for KL25Z
Diff: main.cpp
- Revision:
- 15:72c494e934c8
- Parent:
- 14:5b588ea6bd8f
- Child:
- 16:f0176e9e4a9d
--- 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);