summaryrefslogtreecommitdiff
path: root/src/bird.cpp
diff options
context:
space:
mode:
authorLogan Hunt <loganthebean222@gmail.com>2020-08-12 14:13:50 -0600
committerLogan Hunt <loganthebean222@gmail.com>2020-08-12 14:13:50 -0600
commit70ea8877ace50d2ce609d7d5f721c887b0ea83ec (patch)
tree514aa4f3d10b0a1db21928f8a002aa10458ecbb5 /src/bird.cpp
parent495f771530ce1869098bc568f34c243697cab73c (diff)
downloadskeet-cs165-70ea8877ace50d2ce609d7d5f721c887b0ea83ec.tar.gz
skeet-cs165-70ea8877ace50d2ce609d7d5f721c887b0ea83ec.zip
Added files
Diffstat (limited to 'src/bird.cpp')
-rw-r--r--src/bird.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/bird.cpp b/src/bird.cpp
new file mode 100644
index 0000000..24e660c
--- /dev/null
+++ b/src/bird.cpp
@@ -0,0 +1,27 @@
+#include "bird.h"
+#include "point.h"
+#include "velocity.h"
+#include "uiDraw.h"
+#include <iostream>
+using namespace std;
+// Default constructor
+Bird :: Bird()
+{
+ point.setX( -200.0 );
+ point.setY( -200 ); // (float)random ( -100 , 100 )
+ setRandomDx();
+ setRandomDy( 5.0 , 8.7 );
+}
+
+void Bird :: draw() {}
+
+void Bird :: setRandomDx()
+{
+ float dx = random ( 1.0 , 3.0 );
+ velocity.setDx ( dx );
+}
+
+void Bird :: setRandomDy( const float minDy , const float maxDy )
+{
+ velocity.setDy ( random ( minDy , maxDy ) * ( point.getY() > 0 ? 1 : 1 ) );
+}