-
Notifications
You must be signed in to change notification settings - Fork 0
/
Ghost.h
40 lines (35 loc) · 863 Bytes
/
Ghost.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
#pragma once
#include <QPixmap>
#include <QWidget>
#include <QLabel>
#include <QString>
#include <QPoint>
#include <QTimer>
#include <stdio.h>
#include <stdbool.h>
#include "Character.h"
#include "Pacman.h"
#include "constants.h"
using namespace constants;
using namespace std;
class Ghost : public Character
{
Q_OBJECT
public:
Ghost(QWidget *parent = nullptr, int initialXX = 0, int initialYY = 0, QPixmap image = QPixmap(), Pacman *pacman = nullptr);
void scare();
bool isScared;
QPoint *scaredPosition;
QPoint *baseExitPosition;
Pacman *pacman;
void reverse();
protected:
int calculateDistance(const QPoint &a, const QPoint &b);
void followPoint(const QPoint &p);
bool isInBase();
private:
QPixmap scaredImage{"pacman-art/ghosts/blue_ghost.png"};
QTimer *timer;
public slots:
void finishScare();
};