powerups fully implemented
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user