Zaimplementowano debuff.

Do dokończenia resetowanie debuff
This commit is contained in:
2025-01-13 15:55:45 +01:00
parent 62808a9fbf
commit 67f396ae84
12 changed files with 184 additions and 25 deletions

21
sources/Debuff.cpp Normal file
View File

@@ -0,0 +1,21 @@
#include "../headers/Debuff.h"
Debuff::Debuff(float x, float y, sf::Texture &texture, Type type) : ObjectItem(x, y, texture) {
position.x = x;
position.y = y;
texture_ = texture;
sprite.setTexture(texture);
sprite.setOrigin(sprite.getLocalBounds().width / 2, sprite.getLocalBounds().height / 2); // wycentrowanie sprite
sprite.setScale(0.5f, 0.5f);
sprite.setPosition(x, y);
movingSpeed = 3.0f;
this->type_ = type;
}
void Debuff::update() {
sprite.move(0.0f, movingSpeed); // przesunięcie sprajta
position.y += int(movingSpeed); // przesunięcie pozycji
if(position.y > 900) {
outOfBounds = true; // jeżeli wyszedł poza granice ekranu ustaw tą zmienną
}
}