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: Ball/Ball.cpp
- Revision:
- 14:122eaa3b7a50
- Parent:
- 13:924891519a95
- Child:
- 15:81a3aaf52647
--- a/Ball/Ball.cpp Tue Apr 23 14:35:39 2019 +0000 +++ b/Ball/Ball.cpp Tue Apr 23 20:57:15 2019 +0000 @@ -62,20 +62,16 @@ //lcd.drawRect(_x,_y,_size,_size,FILL_BLACK); } -void Ball::update_ball_y(int expected_y){ +int Ball::update_ball(int expected_x,int expected_y){ if (_y!=expected_y){ - printf("IN HERE \n"); if (_y>expected_y){ - printf("MADE IT \n"); _y--; } else{ _y++; + } } -} -} -void Ball::update_ball_x(int expected_x){ - if (_x!=expected_x){ + if (_x!=expected_x){ if (_x>expected_x){ _x--; } @@ -83,7 +79,14 @@ _x++; } } +if (_x==expected_x && _y==expected_y){ + return 1; } +else{ + return 0; +} +} + @@ -92,6 +95,10 @@ void Ball::reset(){ bowled=0; ballHit=0; + _x1=42; + _y1=3; + _x = 42; + _y = 15; }