powerups fully implemented

This commit is contained in:
2025-01-06 16:17:38 +01:00
parent b1b5858fb6
commit 4d2283d15e
9 changed files with 87 additions and 12 deletions

View File

@@ -36,8 +36,16 @@ void Player::loadTexture() {
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(position.x, position.y, bulletTexture);
lastShotTime = now;
if (tripleShot == true) {
bullets.emplace_back(position.x - 40, position.y, bulletTexture);
bullets.emplace_back(position.x, position.y, bulletTexture);
bullets.emplace_back(position.x + 40, position.y, bulletTexture);
lastShotTime = now;
}
if (tripleShot == false) {
bullets.emplace_back(position.x, position.y, bulletTexture);
lastShotTime = now;
}
}
}
@@ -79,6 +87,10 @@ void Player::takeDamage() {
}
}
void Player::setTripleShot(bool toogle) {
tripleShot = toogle;
}
void Player::setFirerate(unsigned int firerate) {
this->firerate = firerate;
}