4
Diff: Ball.cpp
- Revision:
- 3:8ec14becdf83
- Parent:
- 2:3c92f5ae0502
- Child:
- 4:d3f87c8e4027
--- a/Ball.cpp Sun Mar 05 21:16:03 2017 +0000 +++ b/Ball.cpp Sun Mar 05 21:21:52 2017 +0000 @@ -10,12 +10,12 @@ } -void Ball::init(int radius,int speed) +void Ball::init(int size,int speed) { - _radius = radius; + _size = size; - _x = WIDTH/2 - _radius/2; - _y = HEIGHT/2 - _radius/2; + _x = WIDTH/2 - _size/2; + _y = HEIGHT/2 - _size/2; srand(time(NULL)); int direction = rand() % 4; // randomise initial direction. @@ -38,7 +38,7 @@ void Ball::draw(N5110 &lcd) { - lcd.drawRect(_x,_y,_radius,_radius,FILL_BLACK); + lcd.drawRect(_x,_y,_size,_size,FILL_BLACK); } void Ball::update() @@ -71,10 +71,7 @@ _y = p.y; } -int Ball::get_radius() +int Ball::get_size() { - return _radius; -} - -// Private Methods - + return _size; +} \ No newline at end of file