Compare commits
4 Commits
ultimate
...
ultimateIm
| Author | SHA1 | Date | |
|---|---|---|---|
| bad49c78a5 | |||
| f5d9bae6e9 | |||
| 696714cf9a | |||
| 3c0cd4b950 |
BIN
assets/img/ultimate/ultimate_0.png
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
BIN
assets/img/ultimate/ultimate_10.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
assets/img/ultimate/ultimate_100.png
Normal file
|
After Width: | Height: | Size: 6.1 KiB |
BIN
assets/img/ultimate/ultimate_20.png
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
BIN
assets/img/ultimate/ultimate_30.png
Normal file
|
After Width: | Height: | Size: 2.3 KiB |
BIN
assets/img/ultimate/ultimate_40.png
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
assets/img/ultimate/ultimate_50.png
Normal file
|
After Width: | Height: | Size: 3.0 KiB |
BIN
assets/img/ultimate/ultimate_60.png
Normal file
|
After Width: | Height: | Size: 3.3 KiB |
BIN
assets/img/ultimate/ultimate_70.png
Normal file
|
After Width: | Height: | Size: 3.9 KiB |
BIN
assets/img/ultimate/ultimate_80.png
Normal file
|
After Width: | Height: | Size: 4.5 KiB |
BIN
assets/img/ultimate/ultimate_90.png
Normal file
|
After Width: | Height: | Size: 5.0 KiB |
BIN
assets/sounds/destroyed.ogg
Normal file
@@ -120,6 +120,7 @@ private:
|
||||
sf::Texture movingSpeedDebuffTexture;
|
||||
sf::Texture firerateDebuffTexture;
|
||||
sf::Texture bulletSpeedDebuffTexture;
|
||||
sf::Texture ultimateIndicatorTextures[11];
|
||||
|
||||
// Tablice
|
||||
std::vector<Enemy> enemies;
|
||||
@@ -132,6 +133,9 @@ private:
|
||||
std::vector<sf::Sprite> heartStats;
|
||||
std::vector<PowerUp> powerUps;
|
||||
std::vector<Debuff> debuffs;
|
||||
std::vector<sf::Sprite> ultimateIndicators;
|
||||
|
||||
void loadUltimateIndicators();
|
||||
|
||||
// Zmienne prymitywne
|
||||
Boss* boss = nullptr; // Wskaźnik na bossa
|
||||
|
||||
@@ -6,7 +6,7 @@ AdvancedEnemy::AdvancedEnemy(int x, int y, const sf::Texture& texture, const sf:
|
||||
enemyBulletTexture = bulletTexture;
|
||||
hp = 2; // 2 punkty życia
|
||||
firerate = 2000; // Strzela co 2
|
||||
moving_speed = 2.0f; // Prędkość
|
||||
moving_speed = 4.0f; // Prędkość
|
||||
enemyBulletTexture.loadFromFile("../assets/img/bullets/enemy_bullet.png");
|
||||
}
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
Bomber::Bomber(int x, int y, const sf::Texture& texture, const sf::Texture& bulletTexture) : Actor(x, y, texture) {
|
||||
BombaTexture = bulletTexture;
|
||||
hp = 2; // 2 punkty życia
|
||||
firerate = 10000; // Strzela co 10
|
||||
moving_speed = 10.0f; // Prędkość
|
||||
firerate = 6000; // Strzela co 6
|
||||
moving_speed = 8.0f; // Prędkość
|
||||
}
|
||||
|
||||
void Bomber::setPlanszaHeight(float height, float width) {
|
||||
|
||||
@@ -13,7 +13,7 @@ Boss::Boss(int x, int y, const sf::Texture& bossTexture, const sf::Texture& bull
|
||||
}
|
||||
hp = 100;
|
||||
firerate = 2000;
|
||||
movementSpeed = 2.0f;
|
||||
movementSpeed = 3.0f;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
Enemy::Enemy(int x, int y, const sf::Texture& texture) : Actor(x, y, texture) {
|
||||
hp = 1; // Przeciwnik ma 1 punkt życia
|
||||
firerate = 2000; // Strzela co 2
|
||||
moving_speed = 2.0f; // Prędkość
|
||||
moving_speed = 2.5f; // Prędkość
|
||||
enemyBulletTexture.loadFromFile("../assets/img/bullets/enemy_bullet.png");
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
Kamikadze::Kamikadze(int x, int y, const sf::Texture& texture) : Actor(x, y, texture) {
|
||||
hp = 3; // 3 punkty życia
|
||||
moving_speed = 2.0f; // Prędkość
|
||||
moving_speed = 5.0f; // Prędkość
|
||||
}
|
||||
|
||||
void Kamikadze::shoot(){}
|
||||
|
||||
@@ -47,6 +47,8 @@ Plansza::Plansza(unsigned int windowHeight, unsigned int windowWidth, sf::Render
|
||||
exit(-500);
|
||||
}
|
||||
|
||||
loadUltimateIndicators();
|
||||
|
||||
score = 0;
|
||||
|
||||
// Wczytywanie czcionki dla licznika punktów
|
||||
@@ -61,6 +63,7 @@ Plansza::Plansza(unsigned int windowHeight, unsigned int windowWidth, sf::Render
|
||||
audioManager.loadSoundEffect("shoot", "../assets/sounds/shoot.ogg");
|
||||
audioManager.loadSoundEffect("shoot_alt", "../assets/sounds/shoot_alt.ogg");
|
||||
audioManager.loadSoundEffect("fail", "../assets/sounds/fail.mp3");
|
||||
audioManager.loadSoundEffect("destroyed", "../assets/sounds/destroyed.ogg");
|
||||
|
||||
heartStats.emplace_back(heartTexture);
|
||||
heartStats.emplace_back(heartTexture);
|
||||
@@ -77,6 +80,35 @@ Plansza::Plansza(unsigned int windowHeight, unsigned int windowWidth, sf::Render
|
||||
// spawnClock.restart();
|
||||
}
|
||||
|
||||
void Plansza::loadUltimateIndicators() {
|
||||
const std::string texturePaths[11] = {
|
||||
"../assets/img/ultimate/ultimate_0.png",
|
||||
"../assets/img/ultimate/ultimate_10.png",
|
||||
"../assets/img/ultimate/ultimate_20.png",
|
||||
"../assets/img/ultimate/ultimate_30.png",
|
||||
"../assets/img/ultimate/ultimate_40.png",
|
||||
"../assets/img/ultimate/ultimate_50.png",
|
||||
"../assets/img/ultimate/ultimate_60.png",
|
||||
"../assets/img/ultimate/ultimate_70.png",
|
||||
"../assets/img/ultimate/ultimate_80.png",
|
||||
"../assets/img/ultimate/ultimate_90.png",
|
||||
"../assets/img/ultimate/ultimate_100.png"
|
||||
};
|
||||
|
||||
for (int i = 0; i < 11; ++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);
|
||||
sprite.setScale(0.7f, 0.7f);
|
||||
ultimateIndicators.push_back(sprite);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// TODO: Refactor tej metody bo rozrosła się za bardzo już
|
||||
void Plansza::update() {
|
||||
srand(time(0)); // generacja innego ziarna na podstawie zegara systemowego
|
||||
@@ -111,6 +143,10 @@ void Plansza::update() {
|
||||
ship->ultimate_shoot();
|
||||
}
|
||||
|
||||
int indicatorIndex = ultimateCounter / 20;
|
||||
indicatorIndex = std::min(indicatorIndex, 10); // Zapobiegaj przekroczeniu zakresu
|
||||
window->draw(ultimateIndicators[indicatorIndex]);
|
||||
|
||||
// TODO: Przenieść obiekt dźwięku wewnątrz klasy Bullet
|
||||
if (sf::Mouse::isButtonPressed(sf::Mouse::Left)) {
|
||||
ship->shoot();
|
||||
@@ -133,7 +169,7 @@ void Plansza::update() {
|
||||
spawn_wiazkowiec();
|
||||
spawn_bomber();
|
||||
spawn_kamikadze();
|
||||
// spawn_boss();
|
||||
spawn_boss();
|
||||
|
||||
// utrzymanie meteorów i pocisków w ruchu
|
||||
for (auto &meteor: meteors) {
|
||||
@@ -949,7 +985,7 @@ void Plansza::spawn_player() {
|
||||
}
|
||||
|
||||
void Plansza::spawn_enemy() {
|
||||
if (enemySpawnClock.getElapsedTime().asSeconds() >= 10) { // Spawn co 10 sekund
|
||||
if (enemySpawnClock.getElapsedTime().asSeconds() >= 3) { // Spawn co 3 sekund
|
||||
int spawnX = RandomNumberGenerator::getRandomNumber(50, size.width - 50);
|
||||
enemies.emplace_back(spawnX, -50, enemyTexture);
|
||||
std::cout << "Spawned Basic Enemy at X: " << spawnX << std::endl;
|
||||
@@ -959,7 +995,7 @@ void Plansza::spawn_enemy() {
|
||||
}
|
||||
|
||||
void Plansza::spawn_advanced_enemy() {
|
||||
if (AenemySpawnClock.getElapsedTime().asSeconds() >= 8) { // Spawn co 10 sekund
|
||||
if (AenemySpawnClock.getElapsedTime().asSeconds() >= 5) { // Spawn co 5 sekund
|
||||
int spawnX = RandomNumberGenerator::getRandomNumber(50, size.width - 50);
|
||||
AEnemies.emplace_back(spawnX, -50, advancedEnemyTexture, enemyBulletTexture);
|
||||
std::cout << "Spawned Advanced Enemy at X: " << spawnX << std::endl;
|
||||
@@ -968,7 +1004,7 @@ void Plansza::spawn_advanced_enemy() {
|
||||
}
|
||||
|
||||
void Plansza::spawn_bomber() {
|
||||
if (BomberSpawnClock.getElapsedTime().asSeconds() >= 5) { // Spawn co 10 sekund
|
||||
if (BomberSpawnClock.getElapsedTime().asSeconds() >= 7) { // Spawn co 7 sekund
|
||||
int spawnX = RandomNumberGenerator::getRandomNumber(50, size.width - 50);
|
||||
Bomber bomber(spawnX, -50, BomberEnemyTexture, BombaTexture);
|
||||
bomber.setPlanszaHeight(size.height, size.width); // Przekazanie wysokości i szerokości okna
|
||||
@@ -979,7 +1015,7 @@ void Plansza::spawn_bomber() {
|
||||
}
|
||||
|
||||
void Plansza::spawn_kamikadze() {
|
||||
if (KamikadzeSpawnClock.getElapsedTime().asSeconds() >= 40) { // Spawn co 10 sekund
|
||||
if (KamikadzeSpawnClock.getElapsedTime().asSeconds() >= 9) { // Spawn co 9 sekund
|
||||
int spawnX = RandomNumberGenerator::getRandomNumber(50, size.width - 50);
|
||||
KEnemies.emplace_back(spawnX, -50, KamikadzeTexture);
|
||||
std::cout << "Spawned Kamikadze Enemy at X: " << spawnX << std::endl;
|
||||
@@ -988,7 +1024,7 @@ void Plansza::spawn_kamikadze() {
|
||||
}
|
||||
|
||||
void Plansza::spawn_wiazkowiec() {
|
||||
if (WiazkowiecSpawnClock.getElapsedTime().asSeconds() >= 3) { // Spawn co 10 sekund
|
||||
if (WiazkowiecSpawnClock.getElapsedTime().asSeconds() >= 6) { // Spawn co 6 sekund
|
||||
if (WEnemies.size() < 1) {
|
||||
int spawnX = RandomNumberGenerator::getRandomNumber(50, size.width - 50);
|
||||
Wiazkowiec wiazkowiec(spawnX, -50, WiazkowiecTexture, window);
|
||||
@@ -1001,7 +1037,7 @@ void Plansza::spawn_wiazkowiec() {
|
||||
}
|
||||
|
||||
void Plansza::spawn_boss() {
|
||||
if (!bossSpawned && score >= nextBossScoreThreshold) { // Spawn po 60 sekundach
|
||||
if (!bossSpawned && score >= nextBossScoreThreshold) { // Spawn po BossThreshold i jesli go nie ma
|
||||
boss = new Boss(size.width / 2, -100, BossTexture, enemyBulletTexture, BombaTexture, window);
|
||||
boss->setPlanszaHeight(size.width, size.height);
|
||||
bossSpawned = true;
|
||||
|
||||