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@7:cd3cafda3dd4, 2019-04-10 (annotated)
- Committer:
- kocemax
- Date:
- Wed Apr 10 09:18:25 2019 +0000
- Revision:
- 7:cd3cafda3dd4
- Parent:
- 6:39bda45efeed
- Child:
- 8:9b77eea95088
Made a working collision and added 2 levels, can add more later. Also started doing power-ups but haven't finished yet. Need to think of some of them and also thinking of adding some randomisation to the ball<->pad collision.
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 | 7:cd3cafda3dd4 | 22 | const Vector2D& getPos(); |
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 | 7:cd3cafda3dd4 | 28 | Vector2D pos; |
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 | 7:cd3cafda3dd4 | 36 | Vector2D& getVelocity() { return velocity; } |
kocemax | 6:39bda45efeed | 37 | |
kocemax | 6:39bda45efeed | 38 | protected: |
kocemax | 6:39bda45efeed | 39 | Vector2D velocity; |
kocemax | 6:39bda45efeed | 40 | |
kocemax | 6:39bda45efeed | 41 | }; |
kocemax | 6:39bda45efeed | 42 | #endif |