Dziuala 3 strzlowiec
This commit is contained in:
@@ -7,11 +7,16 @@
|
||||
|
||||
#include "../headers/Bullet.h"
|
||||
|
||||
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");
|
||||
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) {
|
||||
|
||||
};
|
||||
|
||||
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) {
|
||||
@@ -20,6 +25,7 @@ void Player::shoot() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Player::alternate_shoot() {
|
||||
auto now = std::chrono::steady_clock::now();
|
||||
if (std::chrono::duration_cast<std::chrono::milliseconds>(now - lastShotTime).count() >= firerate) {
|
||||
|
||||
Reference in New Issue
Block a user