diff options
Diffstat (limited to 'source/logic/LimitedTimeObject.h')
-rw-r--r-- | source/logic/LimitedTimeObject.h | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/source/logic/LimitedTimeObject.h b/source/logic/LimitedTimeObject.h new file mode 100644 index 0000000..242965b --- /dev/null +++ b/source/logic/LimitedTimeObject.h @@ -0,0 +1,45 @@ +#ifndef LIMITEDTIMEOBJECT_H +#define LIMITEDTIMEOBJECT_H + +#include "../logic/GameObject.h" +#include "../logic/Maze.h" +#include "../presentation/BitmapStore.h" + +/** +* @brief Parent class for GameObjects that are created, exist for a given time, and are then destroyed. +* +* @author Justin Wernick +* @author David Schneider +*/ +class LimitedTimeObject: public GameObject +{ + public: + /** + * @brief Creates a LimitedTimeObject with the given parameters. + * + * @param [in] x The x coordinate of the new object. + * @param [in] y The y coordinate of the new object. + * @param [in] image The image that is drawn to represent the object. + * @param [in] time The number of times that the update function is run before the object is destroyed. + */ + LimitedTimeObject(double x, double y, BitmapStore::Image image, int time); + + //assignment and copy constructors have been left with the compiler generated versions + + /** + * @brief Function that should be run on every iteration of the gameloop. + * + * The time remaining is decremented, and the object is marked for destruction when it reaches zero. + */ + void update(); + + private: + /** + * @brief The number of times that update still needs to be run before the object is marked for destruction. + * + * For example, if the remaining time is 1, then the object is marked on the next update. + */ + int _remainingTime; +}; + +#endif // LIMITEDTIMEOBJECT_H |