James Heavey
/
EL17JH
FINAL VERSION
Ball/Ball.h@0:7d4d2023ed9c, 2019-04-16 (annotated)
- Committer:
- jamesheavey
- Date:
- Tue Apr 16 18:58:18 2019 +0000
- Revision:
- 0:7d4d2023ed9c
- Child:
- 76:52410264a72d
Game changed to breakout form space invaders (new folder) template initialised, edited paddle, edited direction of movement, edited collision boundaries
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jamesheavey | 0:7d4d2023ed9c | 1 | #ifndef BALL_H |
jamesheavey | 0:7d4d2023ed9c | 2 | #define BALL_H |
jamesheavey | 0:7d4d2023ed9c | 3 | |
jamesheavey | 0:7d4d2023ed9c | 4 | #include "mbed.h" |
jamesheavey | 0:7d4d2023ed9c | 5 | #include "N5110.h" |
jamesheavey | 0:7d4d2023ed9c | 6 | #include "Gamepad.h" |
jamesheavey | 0:7d4d2023ed9c | 7 | #include "Paddle.h" |
jamesheavey | 0:7d4d2023ed9c | 8 | |
jamesheavey | 0:7d4d2023ed9c | 9 | /** Ball Class |
jamesheavey | 0:7d4d2023ed9c | 10 | @author Dr Craig A. Evans, University of Leeds |
jamesheavey | 0:7d4d2023ed9c | 11 | @brief Controls the ball in the Pong game |
jamesheavey | 0:7d4d2023ed9c | 12 | @date Febraury 2017 |
jamesheavey | 0:7d4d2023ed9c | 13 | */ |
jamesheavey | 0:7d4d2023ed9c | 14 | class Ball |
jamesheavey | 0:7d4d2023ed9c | 15 | { |
jamesheavey | 0:7d4d2023ed9c | 16 | |
jamesheavey | 0:7d4d2023ed9c | 17 | public: |
jamesheavey | 0:7d4d2023ed9c | 18 | Ball(); |
jamesheavey | 0:7d4d2023ed9c | 19 | ~Ball(); |
jamesheavey | 0:7d4d2023ed9c | 20 | void init(int size,int speed); |
jamesheavey | 0:7d4d2023ed9c | 21 | void draw(N5110 &lcd); |
jamesheavey | 0:7d4d2023ed9c | 22 | void update(); |
jamesheavey | 0:7d4d2023ed9c | 23 | /// accessors and mutators |
jamesheavey | 0:7d4d2023ed9c | 24 | void set_velocity(Vector2D v); |
jamesheavey | 0:7d4d2023ed9c | 25 | Vector2D get_velocity(); |
jamesheavey | 0:7d4d2023ed9c | 26 | Vector2D get_pos(); |
jamesheavey | 0:7d4d2023ed9c | 27 | void set_pos(Vector2D p); |
jamesheavey | 0:7d4d2023ed9c | 28 | |
jamesheavey | 0:7d4d2023ed9c | 29 | private: |
jamesheavey | 0:7d4d2023ed9c | 30 | |
jamesheavey | 0:7d4d2023ed9c | 31 | Vector2D _velocity; |
jamesheavey | 0:7d4d2023ed9c | 32 | int _size; |
jamesheavey | 0:7d4d2023ed9c | 33 | int _x; |
jamesheavey | 0:7d4d2023ed9c | 34 | int _y; |
jamesheavey | 0:7d4d2023ed9c | 35 | }; |
jamesheavey | 0:7d4d2023ed9c | 36 | #endif |