This repository was archived by the owner on Sep 18, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBossManager.cpp
More file actions
71 lines (61 loc) · 1.95 KB
/
Copy pathBossManager.cpp
File metadata and controls
71 lines (61 loc) · 1.95 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
//
// Created by danielc on 15/04/17.
//
#include <SFML/Graphics/Color.hpp>
#include <SFML/Graphics/Text.hpp>
#include <iostream>
#include <SFML/Graphics/RenderWindow.hpp>
#include "BossManager.h"
using namespace std;
BossManager::BossManager(){
if (!font.loadFromFile("Resources/menu/8bit.ttf"))
{
cout << "error with the font" << endl;
}
text.setPosition(1050,0);
text.setFont(font);
text.setCharacterSize(50); // in pixels, not points!
text.setColor(sf::Color::White);
text.setStyle(sf::Text::Bold );
text2.setPosition(1050,50);
text2.setFont(font);
text2.setCharacterSize(50); // in pixels, not points!
text2.setColor(sf::Color::White);
text2.setStyle(sf::Text::Bold );
texture.loadFromFile("Resources/BossLogo.png");
texture.setSmooth(true);
sprite.setTexture(texture);
sprite.setScale(0.125,0.125);
sprite.setPosition(950,23);
};
void BossManager::BossInit(int level,std::vector<Enemy*> *enemyList, std::vector<Bullet *> *enemyBulletList) {
Enemy *Boss = EnemyFactory::createBoss(level,200,50);
//Boss->setScale(0.2);
Boss->setBulletList(enemyBulletList);
enemyList->push_back(Boss);
Boss->setPosition(sf::Vector2f(600,-200));
//Boss->setPosition(sf::Vector2f(600,-300));
initialBosslife=Boss->getLife();
BossPTR= Boss;
BossLevel=level;
}
void BossManager::life_refresh() {
if (BossPTR != NULL) {
Bosslife = BossPTR->getLife();
cout<<"BOSS: "+ to_string(Bosslife) + " / "+to_string(BossPTR->getLife())<<endl;
}
}
bool BossManager::isdead() {
bool result = false;
if (Bosslife <= 0){
result = true;
}
return result;
}
void BossManager::lifeRender(sf::RenderWindow &window){
text.setString("Boss Lvl. " + to_string(BossLevel));
text2.setString("Life: " + to_string(Bosslife) + "/" + to_string(initialBosslife));
window.draw(text);
window.draw(text2);
window.draw(sprite);
}