-
Notifications
You must be signed in to change notification settings - Fork 0
/
powerup.h
58 lines (48 loc) · 1.37 KB
/
powerup.h
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
46
47
48
49
50
51
52
53
54
55
56
57
58
#ifndef POWERUP_H
#define POWERUP_H
#include "compositeentity.h"
#include "rectcollider.h"
#include "coordinate.h"
/*********************************************
* Design Pattern: Mediator *
* Concrete Colleague *
*********************************************/
/*
* Powerup class
* The class is nearly identical to obstacle class
* only new method is getter for type
* The type defined what type of powerup it is
*/
class PowerUp : public CompositeEntity {
public:
PowerUp(Coordinate* position, double width, double height,
double velocity, double loop_after,
std::string name, std::string type, QImage image);
~PowerUp() override = default;
virtual RectCollider* getCollider() override {
return &m_collider;
}
virtual void update(bool paused, double time_since_last_frame) override;
virtual void render(QPainter& painter) override;
bool isMoving() {
return m_is_moving;
}
// getter for m_type
std::string getType() {
return m_type;
}
// reset method
void resetLevel() override;
private:
QImage m_image;
RectCollider m_collider;
double m_width;
double m_height;
double m_velocity;
double m_dist_travelled;
double m_loop_after;
bool m_is_moving;
std::string m_type;
int m_initial_x;
};
#endif // POWERUP_H