diff --git a/headers/Bullet.h b/headers/Bullet.h index bd59539..3050af6 100644 --- a/headers/Bullet.h +++ b/headers/Bullet.h @@ -17,6 +17,7 @@ public: bool getStatus() const; void update(); static sf::Texture bulletTexture; + static sf::Texture rocketTexture; private: sf::Sprite bulletSprite; Position bulletPosition; diff --git a/sources/Actor.cpp b/sources/Actor.cpp index 5525c1c..c6a785d 100644 --- a/sources/Actor.cpp +++ b/sources/Actor.cpp @@ -24,10 +24,6 @@ Position Actor::getPosition() { return {position.x, position.y}; } -void Actor::shoot() { -// bullets.emplace_back(float(position.x) + actorSprite.getGlobalBounds().width / 2, position.y, bulletTextureLeft); -} - std::vector &Actor::getBullets() { return bullets; } diff --git a/sources/Bullet.cpp b/sources/Bullet.cpp index 92e6006..d2a362e 100644 --- a/sources/Bullet.cpp +++ b/sources/Bullet.cpp @@ -32,3 +32,4 @@ bool Bullet::getStatus() const { } sf::Texture Bullet::bulletTexture = sf::Texture(); // plain init of static field +sf::Texture Bullet::rocketTexture = sf::Texture(); diff --git a/sources/Player.cpp b/sources/Player.cpp index c29fede..aad1f56 100644 --- a/sources/Player.cpp +++ b/sources/Player.cpp @@ -18,7 +18,7 @@ void Player::shoot() { void Player::alternate_shoot() { auto now = std::chrono::steady_clock::now(); if (std::chrono::duration_cast(now - lastShotTime).count() >= firerate) { - bullets.emplace_back(position.x, position.y).getSprite().scale(1.5f, 1.5f); + rightBullets.emplace_back(position.x, position.y).getSprite().scale(1.5f, 1.5f); lastShotTime = now; } }