Kostadin Chakarov / Mbed 2 deprecated el17kec

Dependencies:   mbed

Committer:
kocemax
Date:
Thu May 09 11:24:12 2019 +0000
Revision:
11:bb36db678a6d
Parent:
9:f720f5d87420
Child:
14:4b05b5c2a355
Changed comments slightly to have a better documentation.

Who changed what in which revision?

UserRevisionLine numberNew 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 11:bb36db678a6d 8 /** StaticGameObject Class
kocemax 11:bb36db678a6d 9 Draws and controls the objects in the Breakout game, which are static
kocemax 6:39bda45efeed 10 @author Kostadin Chakarov, University of Leeds
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 8:9b77eea95088 17 /** Constructor */
kocemax 6:39bda45efeed 18 StaticGameObject();
kocemax 8:9b77eea95088 19 /** Destructor */
kocemax 6:39bda45efeed 20 ~StaticGameObject();
kocemax 9:f720f5d87420 21 /** Controls the movement physics of static game objects: Does nothing but is overwritten in GameObject. */
kocemax 6:39bda45efeed 22 virtual void move();
kocemax 9:f720f5d87420 23 /** Draws the game object */
kocemax 6:39bda45efeed 24 virtual void draw(N5110 &lcd);
kocemax 9:f720f5d87420 25 /** Gets the x and y coordinates of game object */
kocemax 8:9b77eea95088 26 const Vector2D& getPos() const;
kocemax 9:f720f5d87420 27 /** Gets the width of the game object
kocemax 9:f720f5d87420 28 * @return the width of the game object
kocemax 8:9b77eea95088 29 */
kocemax 6:39bda45efeed 30 int getW() { return w; };
kocemax 9:f720f5d87420 31 /** Gets the height of the game object
kocemax 9:f720f5d87420 32 * @return the height of the game object
kocemax 8:9b77eea95088 33 */
kocemax 6:39bda45efeed 34 int getH() { return h; };
kocemax 8:9b77eea95088 35 /** Sets the width of any game object
kocemax 8:9b77eea95088 36 * @param value - sets the width of the game objects equal to it
kocemax 8:9b77eea95088 37 * @details Used for the power-up features
kocemax 8:9b77eea95088 38 */
kocemax 8:9b77eea95088 39 void setW(int value) { w = value;}
kocemax 6:39bda45efeed 40 protected:
kocemax 8:9b77eea95088 41 int w, h; /** width and height of any game object */
kocemax 9:f720f5d87420 42 Vector2D pos; /** x and y position of any game object */
kocemax 6:39bda45efeed 43 };
kocemax 6:39bda45efeed 44
kocemax 11:bb36db678a6d 45 /** GameObject Class
kocemax 11:bb36db678a6d 46 Draws and controls the objects in the Breakout game, which are non-static, inherits from StaticGameObject
kocemax 11:bb36db678a6d 47 @author Kostadin Chakarov, University of Leeds
kocemax 11:bb36db678a6d 48 @date April 2019
kocemax 11:bb36db678a6d 49 */
kocemax 6:39bda45efeed 50
kocemax 6:39bda45efeed 51 class GameObject : public StaticGameObject
kocemax 6:39bda45efeed 52 {
kocemax 6:39bda45efeed 53 public:
kocemax 8:9b77eea95088 54 /** Constructor */
kocemax 8:9b77eea95088 55 GameObject() : StaticGameObject() {}
kocemax 9:f720f5d87420 56 /** Controls the movement physics of non-static game object */
kocemax 6:39bda45efeed 57 virtual void move();
kocemax 9:f720f5d87420 58 /** Gets the velocity of the game object
kocemax 9:f720f5d87420 59 * @return the velocity of the game object
kocemax 8:9b77eea95088 60 */
kocemax 7:cd3cafda3dd4 61 Vector2D& getVelocity() { return velocity; }
kocemax 6:39bda45efeed 62
kocemax 6:39bda45efeed 63 protected:
kocemax 9:f720f5d87420 64 Vector2D velocity; /** velocity of non-static game object */
kocemax 6:39bda45efeed 65 };
kocemax 6:39bda45efeed 66 #endif