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.h
- Revision:
- 13:fd290d2fd917
- Parent:
- 8:10eb578dd754
--- a/Ball/Ball.h Tue May 26 18:16:31 2020 +0000 +++ b/Ball/Ball.h Tue May 26 22:41:23 2020 +0000 @@ -6,28 +6,57 @@ #include "Gamepad.h" /** Ball Class -@author Dr Craig A. Evans, University of Leeds -@brief Controls the ball in the Pong game -@date Febraury 2017 +@author Lewis Cheadle +@brief Controls the ball in the Impossible game +@date May 2020 */ class Ball { public: + + /** Constructor */ Ball(); + + /** Destructor */ ~Ball(); + + /** Initialises the ball + * @param x initial X position of ball + * @param y initial Y position of ball + */ void init(int x,int y); + + /** Draws the ball + * @param lcd N5110 object + */ void draw(N5110 &lcd); + + /** Updates position of the ball + * @param d Direction of the joystick + * @param pad object + */ void update(Direction d,Gamepad &pad); + + /** Resets ball position of level is complete + */ void level_finish(); + + /** Returns ball X co-ordinate + */ int get_ball_x_pos(); + + /** Returns ball Y co-ordinate + */ int get_ball_y_pos(); - /// accessors and mutators private: + /* sprite to store ball drawing */ int ball; + /* Stores ball X co-ordinate */ int ball_x_pos; + /* Stores ball Y co-ordinate */ int ball_y_pos; };