#include "Ball.h" #include "Paddle.h" #include "Game.h" Ball::Ball() { setRadius(radius - 3); setOutlineThickness(3); setOutlineColor(sf::Color::Black); setFillColor(sf::Color::White); setOrigin(radius / 2, radius / 2); } Ball::Ball(int r) { setRadius(r - 3); setOutlineThickness(3); setOutlineColor(sf::Color::Black); setFillColor(sf::Color::White); setOrigin(r / 2, r / 2); radius = r; } float Ball::getX() const { return getPosition().x; } float Ball::getY() const { return getPosition().y; } void Ball::setPosition(float x, float y) { sf::Transformable::setPosition(x, y); } float Ball::getSpeed() const { return ballSpeed; } void Ball::move(float x, float y) { sf::Transformable::move(x, y); } Paddle::Paddle() { size.x = 25; size.y = 100; setSize(sf::Vector2f(25, 100) - sf::Vector2f(3, 3)); setOutlineThickness(3); setOutlineColor(sf::Color::Black); setFillColor(sf::Color(200, 200, 200)); setOrigin(sf::Vector2f(25, 100) / 2.f); } float Paddle::getY() const { return getPosition().y; } float Paddle::getX() const { return getPosition().x; } void Paddle::setPosition(float x, float y) { sf::Transformable::setPosition(x, y); } sf::Vector2f Paddle::getSize() const { return size; } void Paddle::move(float x, float y) { sf::Transformable::move(x, y); } Ball::Ball() { const sf::Time AITime = sf::seconds(0.1f); const float paddleSpeed = 400.f; float rightPaddleSpeed = 0.f; float ballAngle = 0.f; }