diff options
author | Logan Hunt <loganthebean222@gmail.com> | 2020-08-12 14:13:50 -0600 |
---|---|---|
committer | Logan Hunt <loganthebean222@gmail.com> | 2020-08-12 14:13:50 -0600 |
commit | 70ea8877ace50d2ce609d7d5f721c887b0ea83ec (patch) | |
tree | 514aa4f3d10b0a1db21928f8a002aa10458ecbb5 /src/velocity.cpp | |
parent | 495f771530ce1869098bc568f34c243697cab73c (diff) | |
download | skeet-cs165-70ea8877ace50d2ce609d7d5f721c887b0ea83ec.tar.gz skeet-cs165-70ea8877ace50d2ce609d7d5f721c887b0ea83ec.zip |
Added files
Diffstat (limited to 'src/velocity.cpp')
-rw-r--r-- | src/velocity.cpp | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/src/velocity.cpp b/src/velocity.cpp new file mode 100644 index 0000000..ce739e3 --- /dev/null +++ b/src/velocity.cpp @@ -0,0 +1,58 @@ +#include "velocity.h" + +Velocity :: Velocity () +{ + setDx ( 0.0 ); + setDy ( 0.0 ); +} + +// Velocity constructor +Velocity :: Velocity ( float dx , float dy ) +{ + setDx ( dx ); + setDy ( dy ); +} + +// Get Velocity dx +float Velocity :: getDx() const +{ + return dx; +} + +// Get Velocity dy +float Velocity :: getDy() const +{ + return dy; +} + +// Set Velocity dx +void Velocity :: setDx( float dx ) +{ + this->dx = dx; +} + +// Set Velocity dy +void Velocity :: setDy( float dy ) +{ + this->dy = dy; +} + +// Add dy Velocity +void Velocity :: addDy ( const float dy ) +{ + this->dy += dy; +} + +// Add dx Velocity +void Velocity :: addDx ( const float dx ) +{ + this->dx += dx; +} + +// Update a point +Point Velocity :: updatePoint ( Point &point ) +{ + point.addX ( dx ); + point.addY ( dy ); + return point; +} |