blob: 51d5cecdd7076ca5e71413beae4d6e8385844a36 (
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
#include "toughBird.h"
#include "bullet.h"
#include "uiDraw.h"
#include <math.h>
// ToughBird default constructor
ToughBird :: ToughBird() : Bird()
{
health = 3;
setRandomDy( 4.5 , 6.5 );
}
// Hit ToughBird
int ToughBird :: hit()
{
if ( health > 1 )
{
health -= 1;
return 1;
}
else
{
kill();
return 2;
}
return 0;
}
// Apply gravity to ToughBird
void ToughBird :: applyGravity ()
{
this->velocity.addDy ( -0.05 );
}
// Draw ToughBird
void ToughBird :: draw()
{
drawToughBird( point , 15 , health );
}
|