-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmapObject.cpp
More file actions
88 lines (72 loc) · 2.63 KB
/
Copy pathmapObject.cpp
File metadata and controls
88 lines (72 loc) · 2.63 KB
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#include "mapObject.h"
mapObject::mapObject(std::vector<Object> &conteinerObjct, std::vector<Enemy> &enemy) : conteinerObjct(conteinerObjct), enemy(enemy)
{
texture.loadFromFile("img/Tiles/spriteGround.png");
for (int ch = 0; ch < conteinerObjct.size(); ch++)
{
PropertiMapTitle.textureX = conteinerObjct[ch].rect.left;
PropertiMapTitle.textureY = conteinerObjct[ch].rect.top;
PropertiMapTitle.spritObject.setPosition(PropertiMapTitle.textureX, PropertiMapTitle.textureY);
PropertiMapTitle.spritObject.setTexture(texture);
prop.push_back(PropertiMapTitle);
}
for (int countPl = 1; countPl < 3; countPl++)
{
conteinerObjct.push_back(conteinerObjct[0]);
conteinerObjct[countPl].rect.left = 950 * countPl;
prop.push_back(prop[0]);
prop[countPl].spritObject.setPosition(conteinerObjct[countPl].rect.left, conteinerObjct[countPl].rect.top);
}
};
void mapObject::processingMap(Player &upAnimationSpeed, float &vailSpeedBG)
{
if (checkOpenProcessingMap)
{
gameClock.restart();
checkOpenProcessingMap = false;
}
float seconds = vailSpeedBG; // â ñåêóíäàõ (float)
std::cout << "TIME_" << seconds << std::endl;
if (seconds > timeLimit)
{
speed += 1;
//vailSpeedBG += 0.80f;
timeLimit += 20;
upAnimationSpeed.SetAnimationSpeed(0.01f);
std::cout << "XYYSYSYSYSYS_ " << seconds << std::endl;
}
std::cout << "enemyy1 " << enemy[1].enemyRect.left << std::endl;
for (int itemCount = 0; itemCount < conteinerObjct.size(); itemCount++)
{
if (upAnimationSpeed.getCheckGemeOverEvents())
{
conteinerObjct[itemCount].rect.left -= speed;
prop[itemCount].spritObject.setPosition(conteinerObjct[itemCount].rect.left, conteinerObjct[itemCount].rect.top);
if (conteinerObjct[itemCount].rect.left + conteinerObjct[itemCount].rect.width + 300 < 0)
{
randPointSpavn = rand() % (3 - 1 + 1) + 1;
numbPlatform = itemCount;
conteinerObjct[itemCount].rect.left = 1800; // 1500
if (itemCount == 1)
{
enemy[0].reset(false);
}
if (itemCount == 2)
{
enemy[1].reset(false);
}
}
}
}
}
void mapObject::showObject(sf::RenderWindow &window)
{
for (auto &item : prop)
{
window.draw(item.spritObject);
}
}
std::vector<Properti> &mapObject::getSpriteForObject()
{
return prop;
}