Dziala powerup na prędkość poruszania się
This commit is contained in:
@@ -1 +1,20 @@
|
||||
#include "../headers/PowerUp.h"
|
||||
#include "../headers/PowerUp.h"
|
||||
|
||||
PowerUp::PowerUp(float x, float y, sf::Texture &texture): 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;
|
||||
}
|
||||
|
||||
void PowerUp::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ą
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user