diff options
Diffstat (limited to 'src/velocity.cpp')
-rw-r--r-- | src/velocity.cpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/velocity.cpp b/src/velocity.cpp new file mode 100644 index 0000000..71bf7cd --- /dev/null +++ b/src/velocity.cpp @@ -0,0 +1,38 @@ +#include "acceleration.h" +#include "velocity.h" + +Velocity :: Velocity() { + setDx(0.0f); + setDy(0.0f); +} + +Velocity :: Velocity(const float dx, const float dy) { + setDx(0.0f); + setDy(0.0f); +} + +void Velocity :: setDx(const float dx) { + this->dx = dx; +} + +void Velocity :: setDy(const float dy) { + this->dy = dy; +} + +float Velocity :: getDx() { + return this->dx; +} + +float Velocity :: getDy() { + return this->dy; +} + +void Velocity :: addVelocity (Velocity &vel) { + this->dx += vel.getDx(); + this->dy += vel.getDy(); +} + +void Velocity :: update(Acceleration &acc) { + this->dx += acc.getD2x(); + this->dy += acc.getD2y(); +} |