blob: 242965b27d067a4efd9f28f069bfd93281b0d12c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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
|