WIP - ultimate
This commit is contained in:
@@ -50,6 +50,8 @@ public:
|
||||
void check_Meteor_collisions();
|
||||
void check_Debuff_collisions();
|
||||
|
||||
void handleUltimate();
|
||||
|
||||
void spawn_player();
|
||||
void spawn_enemy();
|
||||
void spawn_advanced_enemy();
|
||||
|
||||
@@ -22,6 +22,7 @@ public:
|
||||
|
||||
void shoot() override;
|
||||
void alternate_shoot();
|
||||
void ultimate_shoot();
|
||||
void setFirerate(unsigned int firerate);
|
||||
void move(float deltaX, float deltaY) override;
|
||||
void moveLeft() override;
|
||||
@@ -30,13 +31,17 @@ public:
|
||||
void moveDown() override;
|
||||
void takeDamage();
|
||||
void setTripleShot(bool toogle);
|
||||
void setBulletSpeed(float speed);
|
||||
|
||||
void setBulletSpeed(float speed);
|
||||
bool getUltimateStatus();
|
||||
void update();
|
||||
|
||||
std::vector<Rocket>& getRockets();
|
||||
|
||||
void loadTexture();
|
||||
|
||||
void setUltimateStatus(bool status);
|
||||
|
||||
private:
|
||||
std::chrono::steady_clock::time_point lastShotTime = std::chrono::steady_clock::now();
|
||||
std::vector<Rocket> rockets;
|
||||
@@ -48,6 +53,7 @@ private:
|
||||
float bulletSpeed = 10.0f; // prędkość pocisku
|
||||
bool isImmortal = false; // flaga na immortal
|
||||
bool tripleShot = false; // flaga na potrójny strzał
|
||||
bool ultimateShootActive = false;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include <iostream>
|
||||
#include "../headers/Plansza.h"
|
||||
#include "../headers/RandomNumberGenerator.h"
|
||||
#include <SFML/Graphics.hpp>
|
||||
|
||||
Plansza::Plansza(unsigned int windowHeight, unsigned int windowWidth, sf::RenderWindow *mainWindow, ships selectedShip)
|
||||
: background("../assets/img/background/background.png", 2.0f) {
|
||||
@@ -1098,4 +1099,30 @@ void Plansza::check_Meteor_collisions() {
|
||||
}
|
||||
|
||||
ships Plansza::selectedShip = none;
|
||||
unsigned int Plansza::score = 0;
|
||||
unsigned int Plansza::score = 0;
|
||||
|
||||
void Plansza::handleUltimate() {
|
||||
sf::Clock ultimateClock;
|
||||
ultimateClock.restart();
|
||||
if(ship->getUltimateStatus()) {
|
||||
sf::RectangleShape ultimateShape(sf::Vector2f(600,800));
|
||||
ultimateShape.setFillColor(sf::Color(255,255,255));
|
||||
|
||||
meteors.clear();
|
||||
// hearts.clear();
|
||||
// powerUps.clear();
|
||||
debuffs.clear();
|
||||
enemies.clear();
|
||||
AEnemies.clear();
|
||||
BEnemies.clear();
|
||||
KEnemies.clear();
|
||||
WEnemies.clear();
|
||||
|
||||
if(ultimateClock.getElapsedTime().asSeconds() < 1) {
|
||||
window->draw(ultimateShape);
|
||||
} else {
|
||||
ship->setUltimateStatus(false);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,6 +58,10 @@ void Player::alternate_shoot() {
|
||||
}
|
||||
}
|
||||
|
||||
void Player::ultimate_shoot() {
|
||||
ultimateShootActive = true;
|
||||
}
|
||||
|
||||
void Player::update() {
|
||||
// Wyłącz nieśmiertelność po określonym czasie
|
||||
if (isImmortal && immortalityClock.getElapsedTime().asSeconds() >= immortalityDuration) {
|
||||
@@ -129,3 +133,11 @@ void Player::setBulletSpeed(float speed) {
|
||||
|
||||
|
||||
Player* Player::player_ = nullptr;
|
||||
|
||||
bool Player::getUltimateStatus() {
|
||||
return ultimateShootActive;
|
||||
}
|
||||
|
||||
void Player::setUltimateStatus(bool status) {
|
||||
ultimateShootActive = status;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user