|
|
@ -100,6 +100,10 @@ bool Enemy::isBlinking() { |
|
|
|
return blinking; |
|
|
|
return blinking; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool Enemy::isExploded() { |
|
|
|
|
|
|
|
return exploded; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void FaceBall::InitializeEnemyData() { |
|
|
|
void FaceBall::InitializeEnemyData() { |
|
|
|
enemyData[EnemyID::NONE] = { "VOID",undefined,BLACK }; |
|
|
|
enemyData[EnemyID::NONE] = { "VOID",undefined,BLACK }; |
|
|
|
enemyData[EXIT] = { "EXIT",undefined,GREEN }; |
|
|
|
enemyData[EXIT] = { "EXIT",undefined,GREEN }; |
|
|
@ -128,6 +132,7 @@ void FaceBall::ConvertBulletColor(Mesh& bullet, Pixel col) { |
|
|
|
void FaceBall::LoadLevel(int level) |
|
|
|
void FaceBall::LoadLevel(int level) |
|
|
|
{ |
|
|
|
{ |
|
|
|
this->level = level; |
|
|
|
this->level = level; |
|
|
|
|
|
|
|
restingTriangleYDepth = 0.f; |
|
|
|
exitWallsCleared = false; |
|
|
|
exitWallsCleared = false; |
|
|
|
std::vector<std::vector<Tile>>mapData = editor.LoadLevel(level); |
|
|
|
std::vector<std::vector<Tile>>mapData = editor.LoadLevel(level); |
|
|
|
MAP_SIZE = { (int)mapData[0].size(),(int)mapData.size() }; |
|
|
|
MAP_SIZE = { (int)mapData[0].size(),(int)mapData.size() }; |
|
|
@ -1577,6 +1582,42 @@ void FaceBall::RunEnemyAI(Enemy& e,float fElapsedTime,int myIndex) { |
|
|
|
darkenAmt++; |
|
|
|
darkenAmt++; |
|
|
|
e.decreaseColorFactor(); |
|
|
|
e.decreaseColorFactor(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (e.isExploded()) { |
|
|
|
|
|
|
|
if (!e.flippedTriangles) { |
|
|
|
|
|
|
|
e.flippedTriangles = true; |
|
|
|
|
|
|
|
for (Triangle& t : tris) { |
|
|
|
|
|
|
|
vec3d temp=t.p[1]; |
|
|
|
|
|
|
|
t.p[1] = t.p[2]; |
|
|
|
|
|
|
|
t.p[2] = t.p[1]; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
for (Triangle& t : tris) { |
|
|
|
|
|
|
|
float dir = std::atan2f(t.p[0].z, t.p[0].x); |
|
|
|
|
|
|
|
t.p[0].x += std::cosf(dir+ (rand() % 200 / 200.f)- 1) * (rand() % 100/100.f) * fElapsedTime*3; |
|
|
|
|
|
|
|
t.p[0].z += std::sinf(dir + (rand() % 200 / 200.f) - 1) * (rand() % 100 / 100.f) * fElapsedTime * 3; |
|
|
|
|
|
|
|
if (t.p[0].y > 0.041f) { |
|
|
|
|
|
|
|
t.p[0].y = std::max(0.04f, t.p[0].y - 0.8f * fElapsedTime * 3); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
dir = std::atan2f(t.p[1].z, t.p[1].x); |
|
|
|
|
|
|
|
t.p[1].x += std::cosf(dir + (rand() % 200 / 200.f) - 1) * (rand() % 100 / 100.f) * fElapsedTime * 3; |
|
|
|
|
|
|
|
t.p[1].z += std::sinf(dir + (rand() % 200 / 200.f) - 1) * (rand() % 100 / 100.f) * fElapsedTime * 3; |
|
|
|
|
|
|
|
if (t.p[1].y > 0.041f) { |
|
|
|
|
|
|
|
t.p[1].y = std::max(0.04f, t.p[1].y - 0.8f * fElapsedTime * 3); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
dir = std::atan2f(t.p[2].z, t.p[2].x); |
|
|
|
|
|
|
|
t.p[2].x += std::cosf(dir + (rand() % 200 / 200.f) - 1) * (rand() % 70 / 100.f) * fElapsedTime * 3; |
|
|
|
|
|
|
|
t.p[2].z += std::sinf(dir + (rand() % 200 / 200.f) - 1) * (rand() % 70 / 100.f) * fElapsedTime * 3; |
|
|
|
|
|
|
|
if (t.p[2].y > 0.041f) { |
|
|
|
|
|
|
|
t.p[2].y = std::max(0.04f, t.p[2].y - 0.8f * fElapsedTime * 3); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (darkenAmt > 0) { |
|
|
|
|
|
|
|
t.col[0] -= {darkenAmt, darkenAmt, darkenAmt}; |
|
|
|
|
|
|
|
t.col[1] -= {darkenAmt, darkenAmt, darkenAmt}; |
|
|
|
|
|
|
|
t.col[2] -= {darkenAmt, darkenAmt, darkenAmt}; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else { |
|
|
|
for (Triangle& t : tris) { |
|
|
|
for (Triangle& t : tris) { |
|
|
|
if (t.p[0].y > 0.1) { |
|
|
|
if (t.p[0].y > 0.1) { |
|
|
|
t.p[0].y = std::max(0.1f, t.p[0].y - 0.3f * fElapsedTime); |
|
|
|
t.p[0].y = std::max(0.1f, t.p[0].y - 0.3f * fElapsedTime); |
|
|
@ -1608,10 +1649,32 @@ void FaceBall::RunEnemyAI(Enemy& e,float fElapsedTime,int myIndex) { |
|
|
|
t.col[2] -= {darkenAmt, darkenAmt, darkenAmt}; |
|
|
|
t.col[2] -= {darkenAmt, darkenAmt, darkenAmt}; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (e.isExploded()) {
|
|
|
|
|
|
|
|
e.increaseDeathTimer(fElapsedTime*3); |
|
|
|
|
|
|
|
e.increaseColorFactor(fElapsedTime*3); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else { |
|
|
|
e.increaseDeathTimer(fElapsedTime); |
|
|
|
e.increaseDeathTimer(fElapsedTime); |
|
|
|
e.increaseColorFactor(fElapsedTime); |
|
|
|
e.increaseColorFactor(fElapsedTime); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
if (!e.finishedAnimation){ |
|
|
|
|
|
|
|
e.finishedAnimation = true; |
|
|
|
|
|
|
|
if (e.isExploded()) { |
|
|
|
|
|
|
|
for (Triangle& t : e.mesh.tris) { |
|
|
|
|
|
|
|
t.p[0].y = 0.04f+ restingTriangleYDepth; |
|
|
|
|
|
|
|
t.p[1].y = 0.04f + restingTriangleYDepth; |
|
|
|
|
|
|
|
t.p[2].y = 0.04f + restingTriangleYDepth; |
|
|
|
|
|
|
|
restingTriangleYDepth += 0.000001f; |
|
|
|
|
|
|
|
if (restingTriangleYDepth > 0.01f) { |
|
|
|
|
|
|
|
restingTriangleYDepth = 0.f; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
else { |
|
|
|
else { |
|
|
|
EnemyData dat = enemyData[e.GetID()]; |
|
|
|
EnemyData dat = enemyData[e.GetID()]; |
|
|
|
e.ReloadBullet(fElapsedTime); |
|
|
|
e.ReloadBullet(fElapsedTime); |
|
|
|