start
This commit is contained in:
@@ -17,6 +17,7 @@ public:
|
|||||||
bool getStatus() const;
|
bool getStatus() const;
|
||||||
void update();
|
void update();
|
||||||
static sf::Texture bulletTexture;
|
static sf::Texture bulletTexture;
|
||||||
|
static sf::Texture rocketTexture;
|
||||||
private:
|
private:
|
||||||
sf::Sprite bulletSprite;
|
sf::Sprite bulletSprite;
|
||||||
Position bulletPosition;
|
Position bulletPosition;
|
||||||
|
|||||||
@@ -24,10 +24,6 @@ Position Actor::getPosition() {
|
|||||||
return {position.x, position.y};
|
return {position.x, position.y};
|
||||||
}
|
}
|
||||||
|
|
||||||
void Actor::shoot() {
|
|
||||||
// bullets.emplace_back(float(position.x) + actorSprite.getGlobalBounds().width / 2, position.y, bulletTextureLeft);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<Bullet> &Actor::getBullets() {
|
std::vector<Bullet> &Actor::getBullets() {
|
||||||
return bullets;
|
return bullets;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,3 +32,4 @@ bool Bullet::getStatus() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sf::Texture Bullet::bulletTexture = sf::Texture(); // plain init of static field
|
sf::Texture Bullet::bulletTexture = sf::Texture(); // plain init of static field
|
||||||
|
sf::Texture Bullet::rocketTexture = sf::Texture();
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ void Player::shoot() {
|
|||||||
void Player::alternate_shoot() {
|
void Player::alternate_shoot() {
|
||||||
auto now = std::chrono::steady_clock::now();
|
auto now = std::chrono::steady_clock::now();
|
||||||
if (std::chrono::duration_cast<std::chrono::milliseconds>(now - lastShotTime).count() >= firerate) {
|
if (std::chrono::duration_cast<std::chrono::milliseconds>(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;
|
lastShotTime = now;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user