blob: 3739d215415032a04a273af301e729a40848f1f5 (
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
#include "UFO.h"
#include "point.h"
#include "velocity.h"
#include <iostream>
using namespace std;
// UFO Default constructor
UFO :: UFO()
{
setAlive ( true );
}
// Get Ufo point
Point UFO :: getPoint() const
{
return this->point;
}
// Get UFO velocity
Velocity UFO:: getVelocity() const
{
return this->velocity;
}
// Get UFO alive
bool UFO :: isAlive() const
{
return this->alive;
}
// Set UFO point
void UFO :: setPoint( const Point &point )
{
this->point = point;
}
// Set UFO velocity
void UFO :: setVelocity( const Velocity &velocity)
{
this->velocity = velocity;
}
// Set UFO velocity with dy & dx
void UFO :: setVelocity ( float dx , float dy )
{
velocity = Velocity ( dx , dy );
}
// Set UFO alive
void UFO :: setAlive ( const bool alive )
{
this->alive = alive;
}
// Advance UFO
void UFO :: advance()
{
setPoint ( this->velocity.updatePoint ( this->point ) );
}
// Kill UFO
void UFO :: kill()
{
this->alive = false;
}
|