-
Notifications
You must be signed in to change notification settings - Fork 0
/
Ammo.cpp
64 lines (52 loc) · 901 Bytes
/
Ammo.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
54
55
56
57
58
59
60
61
62
63
#include "Ammo.h"
Ammo::Ammo()
{
frameCD = 69;
}
Ammo::Ammo(float sp,int bumR,int dmgR,int dam,float pitc, int model, int eModel)
{
frameCD = 69;
speed = sp;
bumRad = bumR;
dmgRad = dmgR;
damage = dam;
pitch = pitc;
setModelID(model);
setExplodeModel(eModel);
}
void Ammo::render()
{
glPushMatrix();
glTranslatef(pos.x,pos.y,0);
glRotatef((pitch*radToDeg -135),0,0,1);
glCallList(getModelID());
glPopMatrix();
step();
}
void Ammo::step()
{
if(!exlploded)
{
pos.x-=speed*cos(pitch);
pos.y-=speed*sin(pitch);
}else
{
frameCD-=1;
}
}
void Ammo::explode()
{
if(frameCD != 69)
return;
frameCD = 20;
exlploded = true;
setModelID(explodeModel);
}
void Ammo::setExplodeModel(int mod)
{
explodeModel = mod;
}
int Ammo::getExplodeModel()
{
return explodeModel;
}