#include "DangerousRacers/Obstacles/Obstacle.h"

#include <iostream>

Obstacle::Obstacle(const float x, const float y, float& speed, const std::string &texturePath, const ObstacleType type) : DrawableEntity(x, y, texturePath), type(type), speed(speed) {
    sprite.setOrigin(sprite.getLocalBounds().width / 2, sprite.getLocalBounds().height / 2);
    sprite.setScale(2.f, 2.f);
}

void Obstacle::render(sf::RenderWindow &window) {
    DrawableEntity::render(window);
}

void Obstacle::update(const float deltaTime) {
    DrawableEntity::update(deltaTime);

    const sf::Vector2f position = this->getPosition();
    this->moveTo(position.x, position.y + speed * deltaTime, 0.f);
}