Złączono i wszystko działa, ale trzeba zrobić mocny refactor Planszy bo za dużo niewiadomo skąd biorących się pętli

This commit is contained in:
2024-12-13 20:05:11 +01:00
parent fdf67f4bc2
commit 80a4b1b397
5 changed files with 30 additions and 83 deletions

View File

@@ -26,16 +26,11 @@ public:
virtual void moveDown() = 0;
virtual void shoot() = 0;
std::vector<Bullet>& getBullets();
sf::Sprite& getSprite();
Position getPosition();
void updateBullets();
void setMovingSpeed(float speed);
void dealDamage();
void healUP();
void updateBullets();
protected:
Position position;
sf::Sprite actorSprite;
@@ -44,7 +39,6 @@ protected:
sf::Texture rocketTexture;
std::vector<Bullet> bullets;
sf::Clock damageDealClock;
Position position;
int hp;
unsigned int damage;
unsigned int firerate;

View File

@@ -39,30 +39,14 @@ public:
delete ship; // usuwanie wskaźnika ship
}
private:
sf::RenderWindow *window;
Background background;
AudioManager audioManager;
Player *ship;
Size size;
sf::RenderWindow *window;
sf::Font font;
Size size;
sf::Texture meteorTexture1;
sf::Texture meteorTexture2;
sf::Texture heartTexture;
sf::Texture heartTextureGray;
sf::Clock meteorSpawnClock;
sf::Clock heartSpawnClock;
sf::Texture enemyBulletTexture;
sf::Texture WiazkaTexture;
sf::Texture BombaTexture;
sf::Texture playerTexture;
sf::Texture playerBulletTexture;
sf::Texture playerRocketTexture;
sf::Texture enemyTexture;
sf::Texture advancedEnemyTexture;
sf::Texture BomberEnemyTexture;
sf::Texture KamikadzeTexture;
sf::Texture WiazkowiecTexture;
sf::Clock spawnClock;
sf::Clock scoreClock;
sf::Clock shooterSpawnClock;
@@ -71,6 +55,21 @@ private:
sf::Clock BomberSpawnClock;
sf::Clock KamikadzeSpawnClock;
sf::Clock WiazkowiecSpawnClock;
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 KamikadzeTexture;
sf::Texture WiazkowiecTexture;
sf::Texture WiazkaTexture;
sf::Texture meteorTexture1;
sf::Texture meteorTexture2;
sf::Texture heartTexture;
sf::Texture heartTextureGray;
std::vector<Enemy> enemies;
std::vector<AdvancedEnemy> AEnemies;
std::vector<Bomber> BEnemies;
@@ -81,7 +80,6 @@ private:
std::vector<sf::Sprite> heartStats;
bool gameOver = false;
unsigned int score = 0;
bool isPlayerSpawned = false;
};
#endif //PLANSZA_H

View File

@@ -29,9 +29,7 @@ public:
void moveUp() override;
void moveDown() override;
void takeDamage();
bool isAlive() const;
void update();
void onHit();
void update();
std::vector<Rocket>& getRockets();
@@ -42,11 +40,8 @@ private:
std::vector<Rocket> rockets;
sf::Texture rocketTexture;
sf::Texture bulletTexture;
bool isBlinking = false;
sf::Color originalColor;
sf::Clock immortalityClock; // Zegar kontrolujący czas nieśmiertelności
int health = 3; // Liczba punktów życia gracza
float immortalityDuration = 1.5f; // Czas trwania nieśmiertelności w sec
bool isImmortal = false; // flaga na immortal
};