summaryrefslogtreecommitdiff
path: root/src/flyingObject.cpp
diff options
context:
space:
mode:
authorSimponic <loganthebean222@gmail.com>2020-06-30 20:10:29 -0600
committerSimponic <loganthebean222@gmail.com>2020-06-30 20:10:29 -0600
commit3010473314505bd948c687ac644b7d87ef03298d (patch)
treee7099f6c431305cdd041d32ba244eb6360eec2f9 /src/flyingObject.cpp
parent7a60ab9f178dd813c876fcf8e25c947f9a9a5e06 (diff)
downloadasteroids-cs165-3010473314505bd948c687ac644b7d87ef03298d.tar.gz
asteroids-cs165-3010473314505bd948c687ac644b7d87ef03298d.zip
Updated file structure and changed indents to spaces
Diffstat (limited to 'src/flyingObject.cpp')
-rw-r--r--src/flyingObject.cpp20
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 );
+
+}