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
Bat/Bat.h@6:3e50f2cf4366, 2019-04-18 (annotated)
- Committer:
- shahidsajid
- Date:
- Thu Apr 18 09:31:52 2019 +0000
- Revision:
- 6:3e50f2cf4366
- Parent:
- 4:55a0509c4874
- Child:
- 13:924891519a95
Checks for collision (ball hitting bat)
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| shahidsajid | 4:55a0509c4874 | 1 | #ifndef BAT_H |
| shahidsajid | 4:55a0509c4874 | 2 | #define BAT_H |
| shahidsajid | 4:55a0509c4874 | 3 | |
| shahidsajid | 4:55a0509c4874 | 4 | #include "mbed.h" |
| shahidsajid | 4:55a0509c4874 | 5 | #include "N5110.h" |
| shahidsajid | 4:55a0509c4874 | 6 | #include "Gamepad.h" |
| shahidsajid | 4:55a0509c4874 | 7 | |
| shahidsajid | 4:55a0509c4874 | 8 | /** Ball Class |
| shahidsajid | 4:55a0509c4874 | 9 | @author Dr Craig A. Evans, University of Leeds |
| shahidsajid | 4:55a0509c4874 | 10 | @brief Controls the ball in the Pong game |
| shahidsajid | 4:55a0509c4874 | 11 | @date Febraury 2017 |
| shahidsajid | 4:55a0509c4874 | 12 | */ |
| shahidsajid | 4:55a0509c4874 | 13 | class Bat |
| shahidsajid | 4:55a0509c4874 | 14 | { |
| shahidsajid | 4:55a0509c4874 | 15 | |
| shahidsajid | 4:55a0509c4874 | 16 | public: |
| shahidsajid | 4:55a0509c4874 | 17 | Bat(); |
| shahidsajid | 4:55a0509c4874 | 18 | ~Bat(); |
| shahidsajid | 4:55a0509c4874 | 19 | void init(int x,int y); |
| shahidsajid | 4:55a0509c4874 | 20 | void draw(N5110 &lcd); |
| shahidsajid | 4:55a0509c4874 | 21 | void update(); |
| shahidsajid | 6:3e50f2cf4366 | 22 | int get_hitBall(); |
| shahidsajid | 6:3e50f2cf4366 | 23 | Direction Bat::get_ballDirection(); |
| shahidsajid | 4:55a0509c4874 | 24 | /// accessors and mutators |
| shahidsajid | 4:55a0509c4874 | 25 | //Vector2D get_velocity(); |
| shahidsajid | 4:55a0509c4874 | 26 | //Vector2D get_pos(); |
| shahidsajid | 4:55a0509c4874 | 27 | //void set_pos(Vector2D p); |
| shahidsajid | 4:55a0509c4874 | 28 | //void start(N5110 &lcd); |
| shahidsajid | 4:55a0509c4874 | 29 | //void get_direction(Gamepad &pad); |
| shahidsajid | 4:55a0509c4874 | 30 | |
| shahidsajid | 4:55a0509c4874 | 31 | private: |
| shahidsajid | 4:55a0509c4874 | 32 | //Gamepad pad; |
| shahidsajid | 4:55a0509c4874 | 33 | /*struct Fielder{ |
| shahidsajid | 4:55a0509c4874 | 34 | int x; |
| shahidsajid | 4:55a0509c4874 | 35 | int y; |
| shahidsajid | 4:55a0509c4874 | 36 | int position; |
| shahidsajid | 4:55a0509c4874 | 37 | }; |
| shahidsajid | 4:55a0509c4874 | 38 | */ |
| shahidsajid | 4:55a0509c4874 | 39 | |
| shahidsajid | 4:55a0509c4874 | 40 | //Vector2D _velocity; |
| shahidsajid | 4:55a0509c4874 | 41 | //Fielder field[5]; |
| shahidsajid | 4:55a0509c4874 | 42 | //Direction _d; |
| shahidsajid | 6:3e50f2cf4366 | 43 | Gamepad batPad; |
| shahidsajid | 6:3e50f2cf4366 | 44 | int _hitBall; |
| shahidsajid | 4:55a0509c4874 | 45 | int d; |
| shahidsajid | 6:3e50f2cf4366 | 46 | Direction _d; |
| shahidsajid | 4:55a0509c4874 | 47 | int _size; |
| shahidsajid | 4:55a0509c4874 | 48 | int _x; |
| shahidsajid | 4:55a0509c4874 | 49 | int _y; |
| shahidsajid | 4:55a0509c4874 | 50 | }; |
| shahidsajid | 4:55a0509c4874 | 51 | #endif |