summaryrefslogtreecommitdiff
path: root/src/bird.cpp
blob: 24e660c62e47132e0e82a310f8ce7bbe0fcb0a11 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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 ) );
}