Zaimplementowano debuff.

Do dokończenia resetowanie debuff
This commit is contained in:
2025-01-13 15:55:45 +01:00
parent 62808a9fbf
commit 67f396ae84
12 changed files with 184 additions and 25 deletions

View File

@@ -1,11 +1,11 @@
#include "../headers/Player.h"
#include <iostream>
#include <SFML/Graphics/Font.hpp>
#include <SFML/Graphics/Text.hpp>
#include "../headers/Player.h"
#include "../headers/Plansza.h"
Player::Player(int x, int y, const sf::Texture& texture) : Actor(x, y, texture) {
hp = 3;
if(Plansza::selectedShip != none) {
@@ -37,13 +37,13 @@ void Player::shoot() {
auto now = std::chrono::steady_clock::now();
if (std::chrono::duration_cast<std::chrono::milliseconds>(now - lastShotTime).count() >= firerate) {
if (tripleShot == true) {
bullets.emplace_back(position.x - 40, position.y, bulletTexture);
bullets.emplace_back(position.x, position.y, bulletTexture);
bullets.emplace_back(position.x + 40, position.y, bulletTexture);
bullets.emplace_back(position.x - 40, position.y, bulletTexture, bulletSpeed);
bullets.emplace_back(position.x, position.y, bulletTexture, bulletSpeed);
bullets.emplace_back(position.x + 40, position.y, bulletTexture, bulletSpeed);
lastShotTime = now;
}
if (tripleShot == false) {
bullets.emplace_back(position.x, position.y, bulletTexture);
bullets.emplace_back(position.x, position.y, bulletTexture, bulletSpeed);
lastShotTime = now;
}
}
@@ -123,4 +123,9 @@ std::vector<Rocket> &Player::getRockets() {
return rockets;
}
void Player::setBulletSpeed(float speed) {
this->bulletSpeed = speed;
}
Player* Player::player_ = nullptr;