-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathRandExplosion.cpp
More file actions
98 lines (94 loc) · 2.98 KB
/
RandExplosion.cpp
File metadata and controls
98 lines (94 loc) · 2.98 KB
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#include "RandExplosion.h"
#include "Engine.h"
RandExplosion::RandExplosion()
{
}
//================================================================================================//
/*******************
** RandExplosion spawn **
********************/
//================================================================================================//
void RandExplosion::Spawn(Vec2 pos)
{
IsActive = true;
oPos = Pos = pos;
fLife = fStartLife = 5;//
mSphere = Sphere(15,pos);
iNextExplosion = 0;
iNextLargeExplosion = 0;
}
//================================================================================================//
/*******************
** RandExplosion Clone **
********************/
//================================================================================================//
RandExplosion* RandExplosion::Clone()const
{
return new RandExplosion(*this);
}
//================================================================================================//
/********************
** RandExplosion update **
*********************/
//================================================================================================//
void RandExplosion::Update()
{
iNextExplosion++;
iNextLargeExplosion++;
fLife-=0.02f;
if(fLife<=0)
IsActive = false;
if(iNextExplosion>=10)
{
Vec2 p = Pos,u,r;
float rot = (float)(rand()%360);
UTIL_Misc::MakeVectors(rot,u,r);
p+=r*(float)(rand()%50);
gpEngine->SpawnExplosion(gpEngine->sprExplosionSmall,p,150,0.75f, (float)(rand()%360),false);
SND_SMALLEXPLODE;
iNextExplosion = 0;
}
if(iNextLargeExplosion>=25)
{
gpEngine->SpawnExplosion(gpEngine->sprExplosion2,Pos,220,0.5f, (float)(rand()%360),true);
SND_LARGEEXPLODE;
iNextLargeExplosion = 0;
}
}
//================================================================================================//
/******************
** RandExplosion draw **
*******************/
//================================================================================================//
void RandExplosion::Draw(const float interp)
{
}
//================================================================================================//
/*********************************
** if it goes offscreen kill it **
**********************************/
//================================================================================================//
void RandExplosion::NeedsToBeRemoved()
{
if(Pos.x<gpEngine->Scroll)
IsActive = false;
}
//================================================================================================//
/****************
** Take damage **
*****************/
//================================================================================================//
bool RandExplosion::CheckCollided(Sphere s, float damage)
{
return false;
}
void RandExplosion::LoadFromFile(CFileIO &fIO)
{
}
void RandExplosion::WriteToFile(CFileIO &fIO)
{
}
int RandExplosion::InWater()
{
return 0;
}