Zaimplementowano debuff.
Do dokończenia resetowanie debuff
This commit is contained in:
@@ -5,7 +5,10 @@
|
||||
|
||||
class Bullet : public Projectile {
|
||||
public:
|
||||
Bullet(float x, float y, sf::Texture &texture) : Projectile(x,y, texture) {};
|
||||
Bullet(float x, float y, sf::Texture &texture);
|
||||
|
||||
Bullet(float x, float y, sf::Texture &texture, float speed);
|
||||
|
||||
void update() override;
|
||||
};
|
||||
|
||||
|
||||
24
headers/Debuff.h
Normal file
24
headers/Debuff.h
Normal file
@@ -0,0 +1,24 @@
|
||||
#ifndef DEBUFF_H
|
||||
#define DEBUFF_H
|
||||
#include "ObjectItem.hpp"
|
||||
|
||||
class Debuff : public ObjectItem {
|
||||
public:
|
||||
enum Type {
|
||||
movingSpeedDbf,
|
||||
firerateDbf,
|
||||
bulletSpeedDbf
|
||||
};
|
||||
Debuff(float x, float y, sf::Texture &texture, Type type);
|
||||
|
||||
void update() override;
|
||||
|
||||
Type getType() const {
|
||||
return type_;
|
||||
}
|
||||
|
||||
private:
|
||||
Type type_;
|
||||
};
|
||||
|
||||
#endif //DEBUFF_H
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "Plansza.h"
|
||||
#include "Heart.hpp"
|
||||
#include "PowerUp.h"
|
||||
#include "Debuff.h"
|
||||
#include "Size.h"
|
||||
|
||||
enum ships{
|
||||
@@ -33,9 +34,11 @@ public:
|
||||
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();
|
||||
@@ -44,6 +47,7 @@ public:
|
||||
void check_PowerUp_collisions();
|
||||
void check_Heart_collisions();
|
||||
void check_Meteor_collisions();
|
||||
void check_Debuff_collisions();
|
||||
|
||||
void spawn_player();
|
||||
void spawn_enemy();
|
||||
@@ -58,19 +62,27 @@ public:
|
||||
static ships selectedShip;
|
||||
static unsigned int score;
|
||||
sf::Font font;
|
||||
|
||||
private:
|
||||
Background background;
|
||||
AudioManager audioManager;
|
||||
Player *ship;
|
||||
Size size;
|
||||
sf::RenderWindow *window;
|
||||
sf::Clock meteorSpawnClock;
|
||||
sf::Clock heartSpawnClock;
|
||||
sf::Clock powerUpSpawnClock;
|
||||
// Timers
|
||||
sf::Clock movingSpeedPUTimer;
|
||||
sf::Clock fireratePUTimer;
|
||||
sf::Clock tripleShotPUTimer;
|
||||
sf::Clock spawnClock;
|
||||
sf::Clock movingSpeedDebuffTimer;
|
||||
sf::Clock firerateDebuffTimer;
|
||||
sf::Clock bulletSpeedDebuffTimer;
|
||||
|
||||
// Zegary
|
||||
sf::Clock meteorSpawnClock;
|
||||
sf::Clock heartSpawnClock;
|
||||
sf::Clock powerUpSpawnClock;
|
||||
sf::Clock debuffSpawnClock;
|
||||
// sf::Clock spawnClock;
|
||||
sf::Clock scoreClock;
|
||||
sf::Clock shooterSpawnClock;
|
||||
sf::Clock enemySpawnClock;
|
||||
@@ -78,6 +90,8 @@ private:
|
||||
sf::Clock BomberSpawnClock;
|
||||
sf::Clock KamikadzeSpawnClock;
|
||||
sf::Clock WiazkowiecSpawnClock;
|
||||
|
||||
//Textury
|
||||
sf::Texture playerTexture;
|
||||
sf::Texture playerBulletTexture;
|
||||
sf::Texture playerRocketTexture;
|
||||
@@ -96,6 +110,11 @@ private:
|
||||
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;
|
||||
@@ -105,6 +124,9 @@ private:
|
||||
std::vector<Heart> hearts;
|
||||
std::vector<sf::Sprite> heartStats;
|
||||
std::vector<PowerUp> powerUps;
|
||||
std::vector<Debuff> debuffs;
|
||||
|
||||
// Zmienne prymitywne
|
||||
bool gameOver = false;
|
||||
};
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ public:
|
||||
void moveDown() override;
|
||||
void takeDamage();
|
||||
void setTripleShot(bool toogle);
|
||||
void setBulletSpeed(float speed);
|
||||
|
||||
void update();
|
||||
std::vector<Rocket>& getRockets();
|
||||
@@ -44,6 +45,7 @@ private:
|
||||
sf::Color originalColor;
|
||||
sf::Clock immortalityClock; // Zegar kontrolujący czas nieśmiertelności
|
||||
float immortalityDuration = 1.5f; // Czas trwania nieśmiertelności w sec
|
||||
float bulletSpeed = 10.0f; // prędkość pocisku
|
||||
bool isImmortal = false; // flaga na immortal
|
||||
bool tripleShot = false; // flaga na potrójny strzał
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user