-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOrangeMonster.cpp
More file actions
27 lines (24 loc) · 820 Bytes
/
Copy pathOrangeMonster.cpp
File metadata and controls
27 lines (24 loc) · 820 Bytes
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
//
// Created by danil on 27.11.2020.
//
#include "OrangeMonster.h"
using namespace Monster;
OrangeMonster::OrangeMonster(sf::Texture& texture) {
startPoint = {START_ORANGE_X_POS, START_ORANGE_y_POS};
currentPoint = startPoint;
recessionPoint.x = 29;
recessionPoint.y = 30;
sprite = 'O';
IndexColor = "32";
closedMapItem = 'x';
active = false;
windowSprite.setTexture(texture);
windowSprite.setTextureRect(sf::IntRect(0,141,20,20));
currentFrame = 0;
topOnTexture = 140;
}
Point OrangeMonster::getChasedTarget(Player &player, Point red) {
double distanceToPlayer = calcDistance(player.getPlayerPoint(), getMonsterPos());
if(distanceToPlayer >= MAX_DISTANCE_TO_PACMAN) return player.getPlayerPoint();
else return recessionPoint;
}