157 lines
4.0 KiB
C++
157 lines
4.0 KiB
C++
#ifndef PLANSZA_H
|
|
#define PLANSZA_H
|
|
|
|
#include "SFML/System/Clock.hpp"
|
|
#include "SFML/Graphics/RenderWindow.hpp"
|
|
|
|
#include "Meteor.h"
|
|
#include "Enemy.h"
|
|
#include "AdvancedEnemy.h"
|
|
#include "Bomber.h"
|
|
#include "Kamikadze.h"
|
|
#include "Wiazkowiec.h"
|
|
#include "Player.h"
|
|
#include "Background.h"
|
|
#include "AudioManager.h"
|
|
#include "Plansza.h"
|
|
#include "Heart.hpp"
|
|
#include "PowerUp.h"
|
|
#include "Debuff.h"
|
|
#include "Size.h"
|
|
#include "Boss.h"
|
|
|
|
enum ships{
|
|
nova,
|
|
pulsar,
|
|
zenith,
|
|
none
|
|
};
|
|
|
|
class Plansza {
|
|
public:
|
|
Plansza(unsigned int windowHeight, unsigned int windowWidth, sf::RenderWindow *mainWindow, ships selectedShip);
|
|
Size getSize();
|
|
std::vector<Meteor> &getMeteors();
|
|
void spawn_meteor();
|
|
void spawn_hearts();
|
|
void spawn_power_up();
|
|
void spawn_debuff();
|
|
void update_meteors();
|
|
void update_hearts();
|
|
void update_power_ups();
|
|
void update_debuffs();
|
|
|
|
|
|
void update();
|
|
void update_score();
|
|
|
|
void check_PowerUp_collisions();
|
|
void check_Heart_collisions();
|
|
void check_Meteor_collisions();
|
|
void check_Debuff_collisions();
|
|
|
|
void handleUltimate();
|
|
|
|
void spawn_player();
|
|
void spawn_enemy();
|
|
void spawn_advanced_enemy();
|
|
void spawn_wiazkowiec();
|
|
void spawn_boss();
|
|
void spawn_bomber();
|
|
void spawn_kamikadze();
|
|
~Plansza() {
|
|
delete ship;
|
|
delete boss;
|
|
}
|
|
|
|
static ships selectedShip;
|
|
static unsigned int score;
|
|
static unsigned int ultimateCounter;
|
|
sf::Font font;
|
|
|
|
private:
|
|
Background background;
|
|
AudioManager audioManager;
|
|
Player *ship;
|
|
Size size;
|
|
sf::RenderWindow *window;
|
|
// Timers
|
|
sf::Clock movingSpeedPUTimer;
|
|
sf::Clock fireratePUTimer;
|
|
sf::Clock tripleShotPUTimer;
|
|
sf::Clock movingSpeedDebuffTimer;
|
|
sf::Clock firerateDebuffTimer;
|
|
sf::Clock bulletSpeedDebuffTimer;
|
|
|
|
// Zegary
|
|
sf::Clock meteorSpawnClock;
|
|
sf::Clock heartSpawnClock;
|
|
sf::Clock powerUpSpawnClock;
|
|
sf::Clock debuffSpawnClock;
|
|
sf::Clock ultimateClock;
|
|
sf::Clock scoreClock;
|
|
sf::Clock shooterSpawnClock;
|
|
sf::Clock enemySpawnClock;
|
|
sf::Clock AenemySpawnClock;
|
|
sf::Clock BomberSpawnClock;
|
|
sf::Clock KamikadzeSpawnClock;
|
|
sf::Clock WiazkowiecSpawnClock;
|
|
|
|
//Textury
|
|
sf::Texture playerTexture;
|
|
sf::Texture playerBulletTexture;
|
|
sf::Texture playerRocketTexture;
|
|
sf::Texture enemyTexture;
|
|
sf::Texture enemyBulletTexture;
|
|
sf::Texture advancedEnemyTexture;
|
|
sf::Texture BomberEnemyTexture;
|
|
sf::Texture BombaTexture;
|
|
sf::Texture BossTexture;
|
|
sf::Texture KamikadzeTexture;
|
|
sf::Texture WiazkowiecTexture;
|
|
sf::Texture WiazkaTexture;
|
|
sf::Texture meteorTexture1;
|
|
sf::Texture meteorTexture2;
|
|
sf::Texture heartTexture;
|
|
sf::Texture heartTextureGray;
|
|
sf::Texture movingSpeedPowerUpTexture;
|
|
sf::Texture fireratePowerUpTexture;
|
|
sf::Texture tripleShotPowerUpTexture;
|
|
sf::Texture movingSpeedDebuffTexture;
|
|
sf::Texture firerateDebuffTexture;
|
|
sf::Texture bulletSpeedDebuffTexture;
|
|
|
|
// Tablice
|
|
std::vector<Enemy> enemies;
|
|
std::vector<AdvancedEnemy> AEnemies;
|
|
std::vector<Bomber> BEnemies;
|
|
std::vector<Kamikadze> KEnemies;
|
|
std::vector<Wiazkowiec> WEnemies;
|
|
std::vector<Meteor> meteors;
|
|
std::vector<Heart> hearts;
|
|
std::vector<sf::Sprite> heartStats;
|
|
std::vector<PowerUp> powerUps;
|
|
std::vector<Debuff> debuffs;
|
|
|
|
// Zmienne prymitywne
|
|
Boss* boss = nullptr; // Wskaźnik na bossa
|
|
sf::Clock bossSpawnClock; // Zegar do spawnowania bossa
|
|
unsigned int nextBossScoreThreshold = 1000; // Próg punktowy dla spawnu bossa
|
|
bool bossSpawned = false; // Flaga informująca, czy boss został już zespawnowany
|
|
bool gameOver = false;
|
|
|
|
// Używane do powerup i debuff flagi
|
|
struct {
|
|
bool movingSpeed = false;
|
|
bool firerate = false;
|
|
bool tripleShot = false;
|
|
} powerUpCollected;
|
|
struct {
|
|
bool movingSpeed = false;
|
|
bool firerate = false;
|
|
bool bulletSpeed = false;
|
|
} debuffCollected;
|
|
};
|
|
|
|
#endif //PLANSZA_H
|