Dziuala 3 strzlowiec

This commit is contained in:
2024-12-11 00:05:53 +01:00
parent 81b04bae0f
commit 2bffc2de0c
11 changed files with 25 additions and 52 deletions

View File

@@ -7,16 +7,11 @@
#include "../headers/Bullet.h"
Player::Player(int x, int y, const sf::Texture& texture, const sf::Texture& bulletTexture, const sf::Texture& rocketTexture) : Actor(x, y, texture), bulletTexture(bulletTexture), rocketTexture(rocketTexture) {
Player::Player(int x, int y, std::string path) : Actor(x, y, path) {
bulletTexture.loadFromFile("../assets/img/bullets/bullet_pink.png");
rocketTexture.loadFromFile("../assets/img/rockets/Rocket_111.png");
};
void Player::setTextures(const sf::Texture& shipTexture, const sf::Texture& bulletTexture, const sf::Texture& rocketTexture) {
this->actorSprite.setTexture(shipTexture); // Poprawiona nazwa - actorSprite zamiast shipSprite
this->bulletTexture = bulletTexture;
this->rocketTexture = rocketTexture;
}
void Player::shoot() {
auto now = std::chrono::steady_clock::now();
if (std::chrono::duration_cast<std::chrono::milliseconds>(now - lastShotTime).count() >= firerate) {