Player class base

mail@pastecode.io avatar
unknown
plain_text
a year ago
500 B
3
Indexable
class Player
{
public:
    sf::vector2f position;
    sf::CircleShape shape(5);

    Player(sf::vector2f pos)
    {
        this->position = pos;
        this->shape.setFillColor(sf::Color::Red);
        this->shape.setPosition(pos);
    }

    void Draw(sf::RenderWindow& window)
    {
        window.draw(shape);
    }

    void Update()
    {
        this->shape.setPosition(this->position);
    }

    void Move(sf::vector2f movementVector)
    {
        this->position += movementVector;
    }
}