summaryrefslogtreecommitdiff
path: root/src/bird.cpp
diff options
context:
space:
mode:
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 ) );
+}