-
Notifications
You must be signed in to change notification settings - Fork 0
/
Pinky.cpp
40 lines (35 loc) · 1.35 KB
/
Pinky.cpp
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
#include "Game.h"
#include "Pinky.h"
extern Game *game;
Pinky::Pinky()
: Ghost()
{
getFrames();
setPixmap(up[0]);
}
void Pinky::getFrames()
{
up.append(QPixmap("resources/sprites/Pinky/UP_1.png"));
up.append(QPixmap("resources/sprites/Pinky/UP_2.png"));
down.append(QPixmap("resources/sprites/Pinky/DOWN_1.png"));
down.append(QPixmap("resources/sprites/Pinky/DOWN_2.png"));
left.append(QPixmap("resources/sprites/Pinky/LEFT_1.png"));
left.append(QPixmap("resources/sprites/Pinky/LEFT_2.png"));
right.append(QPixmap("resources/sprites/Pinky/RIGHT_1.png"));
right.append(QPixmap("resources/sprites/Pinky/RIGHT_2.png"));
}
void Pinky::getChaseDirection()
{
if (game->getPlayerDirection() == UP)
getDirection(getTileX(game->getPlayerX()), getTileY(game->getPlayerY()) - PINKY_FRONT_SIGHT);
else if (game->getPlayerDirection() == DOWN)
getDirection(getTileX(game->getPlayerX()), getTileY(game->getPlayerY()) + PINKY_FRONT_SIGHT);
else if (game->getPlayerDirection() == RIGHT)
getDirection(getTileX(game->getPlayerX()) + PINKY_FRONT_SIGHT, getTileY(game->getPlayerY()));
else if (game->getPlayerDirection() == LEFT)
getDirection(getTileX(game->getPlayerX()) - PINKY_FRONT_SIGHT, getTileY(game->getPlayerY()) - PINKY_FRONT_SIGHT);
}
void Pinky::getScatterDirection()
{
getDirection(0, 0);
}