diff options
Diffstat (limited to 'src/flyingObject.cpp')
-rw-r--r-- | src/flyingObject.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/flyingObject.cpp b/src/flyingObject.cpp new file mode 100644 index 0000000..149e3f5 --- /dev/null +++ b/src/flyingObject.cpp @@ -0,0 +1,20 @@ +#include "flyingObject.h" +#include <iostream> + +// Advance flyingobjects +void FlyingObject::advance() +{ + point.addX( getVelocity().getDx() ); + point.addY( getVelocity().getDy() ); + + if ( point.getX() > 200 ) + point.setX( -200 ); + else if ( point.getX() < -200 ) + point.setX( 200 ); + + if ( point.getY() > 200 ) + point.setY( -200 ); + else if ( point.getY() < -200 ) + point.setY( 200 ); + +} |