Newer
Older
#include "car.h"
Car::Car(float speed, float acceleration, float angle, float angular_acceleration, float y, float x)
{
setSpeed(speed);
setAcceleration(acceleration);
setAngle(angle);
setY(y);
setX(x);
}
if ((speed <= 1.0f * (-1000)) || (speed >= 1.0f * 1000)) {
std::cout << "Speed can't be <(-1000) or >1000" << std::endl;
return;
}
m_speed = speed;
}
void Car::setAcceleration(float acceleration)
{
if ((acceleration <= 1.0f * (-100)) || (acceleration >= 1.0f * 100)) {
std::cout << "Acceleration can't be <(-100) or >100" << std::endl;
return;
}
m_acceleration = acceleration;
}
void Car::setY(float y)
{
m_coordinates.second = y;
float Car::getY() const
{
return m_coordinates.second;
void Car::setX(float x)
{
m_coordinates.first = x;
float Car::getX() const
{
return m_coordinates.first;
void Car::setCoordinates(std::pair<float, float> coordinates)
{
m_coordinates = coordinates;
}
std::pair<float, float> Car::getCoordinates() const
{
return m_coordinates;
}
void Car::execute(Command &command)