-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMissile.cpp
More file actions
61 lines (52 loc) · 952 Bytes
/
Missile.cpp
File metadata and controls
61 lines (52 loc) · 952 Bytes
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
#include <cstdlib>
#include <math.h>
#include "Missile.h"
Missile::Missile()
{
switch (rand() % 4)
{
case 0:
y = 0;
x = rand() % width;
break;
case 1:
y = height;
x = rand() % width;
break;
case 2:
y = rand() % height;
x = 0;
break;
case 3:
y = rand() % height;
x = width;
break;
}
angle = 0;
size = 1;
}
Missile::Missile(double xin, double yin, double angle)
{
x = xin;
y = yin;
this->angle = angle;
size = 1;
}
Missile::~Missile()
{
}
const double Missile_SPEED = 6.0;
void Missile::update()
{
x += Missile_SPEED * Dcos(angle);
y += Missile_SPEED * Dsin(angle);
if (x > width || x < 0 || y > height || y < 0)
markedForDeath = true;
possibleCollideWithFollower();
possibleCollideWithPlayer();
}
void Missile::collideWithPlayer()
{
}
void Missile::collideWithFollower()
{}