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:
- 22:69d7fe739872
- Parent:
- 20:9d21599fe350
diff -r a0904159e183 -r 69d7fe739872 Ball/Ball.h --- a/Ball/Ball.h Tue Apr 30 13:17:14 2019 +0000 +++ b/Ball/Ball.h Tue Apr 30 20:36:42 2019 +0000 @@ -6,9 +6,9 @@ #include "Gamepad.h" #include "Bat.h" /** Ball Class -@author Dr Craig A. Evans, University of Leeds -@brief Controls the ball in the Pong game -@date Febraury 2017 +@author Shahid Zubin Sajid +@brief Controls the ball in the Hero Cricket Game +@date May 2019 */ class Ball { @@ -18,33 +18,29 @@ ~Ball(); void init(int size,int speed); void draw(N5110 &lcd); - Vector2D get_pos(); - void set_pos(Vector2D p); + + //reset functions void reset(); + void reset_ball_count(); /// accessors and mutators - int ball_start(Gamepad &pad); void get_direction(Gamepad &pad); int get_ball_count(); - void reset_ball_count(); - + + + //gameplay methods //void update_ball(int checkHit, Direction dir); + int ball_start(Gamepad &pad); int update_ball(int expected_x,int expected_y); int bowler_start(Gamepad &pad); void increment_ball_count(); private: - struct Fielder{ - Direction dir; - int x; - int y; - int position; - }; + int fieldNumbers[10]; Bat bat; int ballHit; int _ball_count; - Vector2D _velocity; Direction ball_direction; Direction _d; int bowled;