summaryrefslogtreecommitdiff
path: root/flyingObject.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'flyingObject.cpp')
-rw-r--r--flyingObject.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/flyingObject.cpp b/flyingObject.cpp
new file mode 100644
index 0000000..149e3f5
--- /dev/null
+++ b/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 );
+
+}