Dziala powerup na prędkość poruszania się

This commit is contained in:
2025-01-06 01:31:59 +01:00
parent 3d83a3a767
commit b1b5858fb6
10 changed files with 85 additions and 28 deletions

View File

@@ -1,13 +1,11 @@
#include "../headers/Heart.hpp"
Heart::Heart(float x, float y, sf::Texture &texture) : ObjectItem(x,y,texture) {
outOfBounds = false;
texture = texture;
sprite.setTexture(texture);
texture_ = texture;
sprite.setTexture(texture_);
sprite.setOrigin(sprite.getLocalBounds().width / 2, sprite.getLocalBounds().height / 2); // wycentrowanie sprite
sprite.setPosition(x, y);
movingSpeed = 3.0f;
// sprite.scale(0.05f, 0.05f);
position.x = x;
position.y = y;
rotationSpeed = 0;
@@ -16,7 +14,6 @@ Heart::Heart(float x, float y, sf::Texture &texture) : ObjectItem(x,y,texture) {
void Heart::update() {
sprite.move(0.0f, movingSpeed); // przesunięcie sprajta
position.y += int(movingSpeed); // przesunięcie pozycji
// sprite.rotate(rotationSpeed); // obracanie tym meteorkiem pięknym
if(position.y > 900) {
outOfBounds = true; // jeżeli wyszedł poza granice ekranu ustaw tą zmienną
}