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.h
00001 #ifndef GAMEOBJECT_H 00002 #define GAMEOBJECT_H 00003 00004 #include "mbed.h" 00005 #include "N5110.h" 00006 #include "Gamepad.h" 00007 00008 /** StaticGameObject Class 00009 , Draws and controls the objects in the Breakout game, which are static 00010 @author Kostadin Chakarov, University of Leeds 00011 @date April 2019 00012 */ 00013 00014 class StaticGameObject 00015 { 00016 public: 00017 /** Constructor */ 00018 StaticGameObject(); 00019 /** Destructor */ 00020 ~StaticGameObject(); 00021 /** Controls the movement physics of static game objects: Does nothing but is overwritten in GameObject. */ 00022 virtual void move(); 00023 /** Draws the game object */ 00024 virtual void draw(N5110 &lcd); 00025 /** Gets the x and y coordinates of game object */ 00026 const Vector2D& getPos() const; 00027 /** Gets the width of the game object 00028 * @return the width of the game object 00029 */ 00030 int getW() { return w; }; 00031 /** Gets the height of the game object 00032 * @return the height of the game object 00033 */ 00034 int getH() { return h; }; 00035 /** Sets the width of any game object 00036 * @param value - sets the width of the game objects equal to it 00037 * @details Used for the power-up features 00038 */ 00039 void setW(int value) { w = value;} 00040 protected: 00041 int w, h; /** width and height of any game object */ 00042 Vector2D pos; /** x and y position of any game object */ 00043 }; 00044 00045 /** GameObject Class 00046 , Draws and controls the objects in the Breakout game, which are non-static, inherits from StaticGameObject 00047 @author Kostadin Chakarov, University of Leeds 00048 @date April 2019 00049 */ 00050 00051 class GameObject : public StaticGameObject 00052 { 00053 public: 00054 /** Constructor */ 00055 GameObject() : StaticGameObject() {} 00056 /** Controls the movement physics of non-static game object */ 00057 virtual void move(); 00058 /** Gets the velocity of the game object 00059 * @return the velocity of the game object 00060 */ 00061 Vector2D& getVelocity() { return velocity; } 00062 00063 protected: 00064 Vector2D velocity; /** velocity of non-static game object */ 00065 }; 00066 #endif
Generated on Thu Jul 14 2022 02:02:53 by
1.7.2