-
Notifications
You must be signed in to change notification settings - Fork 0
/
EnemyShipC.cpp
executable file
·53 lines (45 loc) · 1.11 KB
/
EnemyShipC.cpp
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
#include "EnemyShipC.h"
EnemyShipC::EnemyShipC():EnemyShipBase()
{
speed = 3.0f;
lastShot = 0;
}
bool EnemyShipC::Init(IDirect3DDevice9* d, IDirectSound8 *s)
{
((MyMesh*)(this))->Init(d, "sf3.x");
Sound = s;
Engine.Init(Sound, "EnemyCEngine.wav");
Fire.Init(Sound, "EnemyCFire.wav");
Fire.SetLoop(false);
HitSound.Init(Sound, "hitship.wav");
HitSound.SetLoop(false);
Engine.Play();
maxSpeed = 6.5f;
minSpeed = 1.0f;
casSpeed = 3.0f;
laserInterval = 600;
range = 60;
type = TYPEC;
rotAngle = 1.0f;
health = 750;
return true;
}
void EnemyShipC::FireLaser()
{
if (GetTickCount() - lastShot > laserInterval)
{
Laser laser1(Device, Laser::YELLOW);
Laser laser2(Device, Laser::YELLOW);
laser1.SetRotation(rotationMatrix);
laser1.TranslateV(position + (right * 0.9f));
laser1.SetOrientation(up, right, look);
laser2.SetRotation(rotationMatrix);
laser2.TranslateV(position - (right * 0.9f));
laser2.SetOrientation(up, right, look);
lasers.push_back(laser1);
lasers.push_back(laser2);
Fire.Play();
lastShot = GetTickCount();
}
else return;
}