Dodane regulacja prędkości i płynejsze poruszanie się

This commit is contained in:
2024-11-16 15:22:21 +01:00
parent 88fa5901b6
commit a190e81ba2
7 changed files with 99 additions and 49 deletions

View File

@@ -18,19 +18,11 @@ sf::Sprite &Actor::getSprite() {
return actorSprite;
}
void Actor::move(float deltaX, float deltaY) {
actorSprite.move(deltaX, deltaY);
}
void Actor::move(float deltaX, float deltaY) {}
void Actor::moveLeft() {
move(-10.0f, 0.0f);
position.x -= 10;
}
void Actor::moveLeft() {}
void Actor::moveRight() {
move(10.0f, 0.0f);
position.x += 10;
}
void Actor::moveRight() {}
Position Actor::getPosition() {
return {position.x, position.y};
@@ -43,3 +35,11 @@ void Actor::shoot() {
std::vector<Bullet> &Actor::getBullets() {
return bullets;
}
void Actor::updateBullets() {
for (auto& bullet : bullets) {
if(bullet.getStatus()) {
bullets.erase(bullets.begin());
}
}
}