Dodano znaczek ladowania ultimate

This commit is contained in:
2025-01-16 23:01:14 +01:00
parent bafab8d75a
commit 3c0cd4b950
8 changed files with 33 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

View File

@@ -120,6 +120,7 @@ private:
sf::Texture movingSpeedDebuffTexture; sf::Texture movingSpeedDebuffTexture;
sf::Texture firerateDebuffTexture; sf::Texture firerateDebuffTexture;
sf::Texture bulletSpeedDebuffTexture; sf::Texture bulletSpeedDebuffTexture;
sf::Texture ultimateIndicatorTextures[6];
// Tablice // Tablice
std::vector<Enemy> enemies; std::vector<Enemy> enemies;
@@ -132,6 +133,9 @@ private:
std::vector<sf::Sprite> heartStats; std::vector<sf::Sprite> heartStats;
std::vector<PowerUp> powerUps; std::vector<PowerUp> powerUps;
std::vector<Debuff> debuffs; std::vector<Debuff> debuffs;
std::vector<sf::Sprite> ultimateIndicators;
void loadUltimateIndicators();
// Zmienne prymitywne // Zmienne prymitywne
Boss* boss = nullptr; // Wskaźnik na bossa Boss* boss = nullptr; // Wskaźnik na bossa

View File

@@ -47,6 +47,8 @@ Plansza::Plansza(unsigned int windowHeight, unsigned int windowWidth, sf::Render
exit(-500); exit(-500);
} }
loadUltimateIndicators();
score = 0; score = 0;
// Wczytywanie czcionki dla licznika punktów // Wczytywanie czcionki dla licznika punktów
@@ -77,6 +79,29 @@ Plansza::Plansza(unsigned int windowHeight, unsigned int windowWidth, sf::Render
// spawnClock.restart(); // spawnClock.restart();
} }
void Plansza::loadUltimateIndicators() {
const std::string texturePaths[6] = {
"../assets/img/ultimate/ultimate_0.png",
"../assets/img/ultimate/ultimate_20.png",
"../assets/img/ultimate/ultimate_40.png",
"../assets/img/ultimate/ultimate_60.png",
"../assets/img/ultimate/ultimate_80.png",
"../assets/img/ultimate/ultimate_100.png"
};
for (int i = 0; i < 6; ++i) {
if (!ultimateIndicatorTextures[i].loadFromFile(texturePaths[i])) {
std::cerr << "Failed to load ultimate indicator texture: " << texturePaths[i] << std::endl;
exit(-1);
}
sf::Sprite sprite;
sprite.setTexture(ultimateIndicatorTextures[i]);
sprite.setPosition(10, window->getSize().y - 60); // Lewy dolny róg
sprite.setScale(0.7f, 0.7f); // Skalowanie
ultimateIndicators.push_back(sprite);
}
}
// TODO: Refactor tej metody bo rozrosła się za bardzo już // TODO: Refactor tej metody bo rozrosła się za bardzo już
void Plansza::update() { void Plansza::update() {
srand(time(0)); // generacja innego ziarna na podstawie zegara systemowego srand(time(0)); // generacja innego ziarna na podstawie zegara systemowego
@@ -111,6 +136,10 @@ void Plansza::update() {
ship->ultimate_shoot(); ship->ultimate_shoot();
} }
int indicatorIndex = ultimateCounter / 40;
indicatorIndex = std::min(indicatorIndex, 5); // Zapobiegaj przekroczeniu zakresu
window->draw(ultimateIndicators[indicatorIndex]);
// TODO: Przenieść obiekt dźwięku wewnątrz klasy Bullet // TODO: Przenieść obiekt dźwięku wewnątrz klasy Bullet
if (sf::Mouse::isButtonPressed(sf::Mouse::Left)) { if (sf::Mouse::isButtonPressed(sf::Mouse::Left)) {
ship->shoot(); ship->shoot();