A little code refactor

+ new bullet texture added
This commit is contained in:
2024-11-16 16:01:01 +01:00
parent a190e81ba2
commit fcabc0534a
6 changed files with 19 additions and 24 deletions

View File

@@ -5,7 +5,7 @@ Player::Player(int x, int y, std::string path) : Actor(x, y, path) {};
void Player::shoot() {
auto now = std::chrono::steady_clock::now();
if (std::chrono::duration_cast<std::chrono::milliseconds>(now - lastShotTime).count() >= firerate) {
bullets.emplace_back(float(position.x) + actorSprite.getGlobalBounds().width / 2-62, position.y, bulletTexture);
bullets.emplace_back(float(position.x) + actorSprite.getGlobalBounds().width / 2-62, position.y, bulletTextureLeft);
lastShotTime = now;
}
}