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.
GameObject/GameObject.h@6:39bda45efeed, 2019-04-08 (annotated)
- Committer:
- kocemax
- Date:
- Mon Apr 08 09:14:33 2019 +0000
- Revision:
- 6:39bda45efeed
- Child:
- 7:cd3cafda3dd4
Finally had more time during the holiday, reedited lots of the code to make it simpler, more readable, more robust, and better structured.Also added collision detection with the bricks, but no deflection yet.(Took the algorithm from an online forum).
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
kocemax | 6:39bda45efeed | 1 | #ifndef GAMEOBJECT_H |
kocemax | 6:39bda45efeed | 2 | #define GAMEOBJECT_H |
kocemax | 6:39bda45efeed | 3 | |
kocemax | 6:39bda45efeed | 4 | #include "mbed.h" |
kocemax | 6:39bda45efeed | 5 | #include "N5110.h" |
kocemax | 6:39bda45efeed | 6 | #include "Gamepad.h" |
kocemax | 6:39bda45efeed | 7 | |
kocemax | 6:39bda45efeed | 8 | /** GameObject Class |
kocemax | 6:39bda45efeed | 9 | @author Kostadin Chakarov, University of Leeds |
kocemax | 6:39bda45efeed | 10 | @brief Draws and controls the objects in the Breakout game, which can either be static or non-static |
kocemax | 6:39bda45efeed | 11 | @date April 2019 |
kocemax | 6:39bda45efeed | 12 | */ |
kocemax | 6:39bda45efeed | 13 | |
kocemax | 6:39bda45efeed | 14 | class StaticGameObject |
kocemax | 6:39bda45efeed | 15 | { |
kocemax | 6:39bda45efeed | 16 | public: |
kocemax | 6:39bda45efeed | 17 | StaticGameObject(); |
kocemax | 6:39bda45efeed | 18 | ~StaticGameObject(); |
kocemax | 6:39bda45efeed | 19 | |
kocemax | 6:39bda45efeed | 20 | virtual void move(); |
kocemax | 6:39bda45efeed | 21 | virtual void draw(N5110 &lcd); |
kocemax | 6:39bda45efeed | 22 | const Vector2D& getballPos(); |
kocemax | 6:39bda45efeed | 23 | int getW() { return w; }; |
kocemax | 6:39bda45efeed | 24 | int getH() { return h; }; |
kocemax | 6:39bda45efeed | 25 | |
kocemax | 6:39bda45efeed | 26 | protected: |
kocemax | 6:39bda45efeed | 27 | int w, h; |
kocemax | 6:39bda45efeed | 28 | Vector2D ballpos; |
kocemax | 6:39bda45efeed | 29 | }; |
kocemax | 6:39bda45efeed | 30 | |
kocemax | 6:39bda45efeed | 31 | |
kocemax | 6:39bda45efeed | 32 | class GameObject : public StaticGameObject |
kocemax | 6:39bda45efeed | 33 | { |
kocemax | 6:39bda45efeed | 34 | public: |
kocemax | 6:39bda45efeed | 35 | virtual void move(); |
kocemax | 6:39bda45efeed | 36 | |
kocemax | 6:39bda45efeed | 37 | protected: |
kocemax | 6:39bda45efeed | 38 | Vector2D velocity; |
kocemax | 6:39bda45efeed | 39 | |
kocemax | 6:39bda45efeed | 40 | }; |
kocemax | 6:39bda45efeed | 41 | #endif |