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:
- 18:a260ce8db9e7
- Parent:
- 15:81a3aaf52647
- Child:
- 20:9d21599fe350
--- a/Ball/Ball.cpp Wed Apr 24 21:17:22 2019 +0000 +++ b/Ball/Ball.cpp Sat Apr 27 15:42:36 2019 +0000 @@ -17,11 +17,20 @@ _y1=3; _x = 42; _y = 15; + _ball_count=0; set_tone=0; bat.init(3,4); bowled=0; + _ball_count=0; } +void Ball::increment_ball_count(){ + _ball_count++; +} +int Ball::get_ball_count(){ + return _ball_count; +} + Vector2D Ball::get_pos() { Vector2D p = {_x,_y}; @@ -47,6 +56,7 @@ } } int Ball::ball_start(Gamepad &pad){ + int bowler_start_check=bowler_start(pad); if (bowler_start_check==1){ if (_y!=36){ @@ -62,6 +72,10 @@ void Ball::draw(N5110 &lcd) { + char buffer[5]; + int c=get_ball_count(); + int length=sprintf(buffer,"B%i",c); + lcd.printString(buffer,0,0); lcd.drawCircle(_x1,_y1,2,FILL_TRANSPARENT); lcd.drawCircle(_x,_y,2,FILL_BLACK); //lcd.drawRect(_x,_y,_size,_size,FILL_BLACK); @@ -93,9 +107,9 @@ } } - - - +void Ball::reset_ball_count(){ + _ball_count=0; +} void Ball::reset(){ @@ -106,6 +120,7 @@ _x = 42; _y = 15; set_tone=0; + //_ball_count=0; }