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.
Diff: GameObject/GameObject.h
- Revision:
- 8:9b77eea95088
- Parent:
- 7:cd3cafda3dd4
- Child:
- 9:f720f5d87420
--- a/GameObject/GameObject.h Wed Apr 10 09:18:25 2019 +0000 +++ b/GameObject/GameObject.h Wed May 08 13:49:01 2019 +0000 @@ -14,29 +14,49 @@ class StaticGameObject { public: + /** Constructor */ StaticGameObject(); + /** Destructor */ ~StaticGameObject(); - + /** Controls the movement physics of static game objects */ virtual void move(); + /** Draws the game objects */ virtual void draw(N5110 &lcd); - const Vector2D& getPos(); + /** Gets the x and y coordinates of game objects */ + const Vector2D& getPos() const; + /** Gets the width of the game objects + * @return the width of the game objects + */ int getW() { return w; }; + /** Gets the height of the game objects + * @return the height of the game objects + */ int getH() { return h; }; - + /** Sets the width of any game object + * @param value - sets the width of the game objects equal to it + * @details Used for the power-up features + */ + void setW(int value) { w = value;} protected: - int w, h; - Vector2D pos; + int w, h; /** width and height of any game object */ + Vector2D pos; /** x and y position of any game objects */ }; class GameObject : public StaticGameObject { public: + /** Constructor */ + GameObject() : StaticGameObject() {} + /** Controls the movement physics of non-static game objects */ virtual void move(); + /** Gets the velocity of the game objects + * @return the velocity of the game objects + */ Vector2D& getVelocity() { return velocity; } protected: - Vector2D velocity; + Vector2D velocity; /** velocity of non-static game objects */ }; #endif \ No newline at end of file