diff --git a/Faceball2030/main.cpp b/Faceball2030/main.cpp index a73c061..a624f1c 100644 --- a/Faceball2030/main.cpp +++ b/Faceball2030/main.cpp @@ -26,6 +26,7 @@ void Enemy::Hurt(int damage) { t.col[2] = BLACK; } health-=damage; + blinkingAmt = 1; } bool Enemy::isDead() { @@ -119,7 +120,6 @@ void Enemy::OnDeathEvent() { if (game->enemyData[id].powerupDrop != PowerupType::NONE) { game->SpawnPowerup(game->enemyData[id].powerupDrop, pos); } - blinkingAmt = 1; } void FaceBall::InitializeEnemyData() { @@ -1762,7 +1762,9 @@ void FaceBall::RenderHud(float fElapsedTime) { FillRectDecal({ 0,0 }, { float(ScreenWidth()),float(ScreenHeight()) }); std::string topText = enemyData[lastHitBy].name + " SAYS"; std::string bottomText = "HAVE A NICE DAY !"; - Display3DKillerModel(); + if (!enemyData[lastHitBy].blinking||std::sinf(30*gameTimer)>0.4f) { + Display3DKillerModel(); + } DrawStringDecal({ (float)(ScreenWidth() / 2 - GetTextSize(topText).x / 2 * 3),140.f }, topText, { 96,96,255 }, { 3,6 }); DrawStringDecal({ float(ScreenWidth() / 2 - GetTextSize(bottomText).x / 2 * 3),float(ScreenHeight() - 140.f) }, bottomText, { 96,96,255 }, { 3,6 }); } @@ -1784,7 +1786,7 @@ void FaceBall::RenderHud(float fElapsedTime) { if (hp > 0) { DrawStringDecal(vf2d{ 112 + hudOffset+32,4+18 }+hudAdjustment, "Triangles: " + std::to_string(triRenderCount), BLACK, { 2,4 }); std::string hudText = "Tags Left: " + std::to_string(tagsRemaining) + " Lives: " + std::to_string(lives); - DrawStringPropDecal(vf2d{ hudOffset + (float)(ScreenWidth() / 2 - GetTextSizeProp(hudText).x * 3 / 2)+32,(float)(ScreenHeight() - 2 - GetTextSizeProp(hudText).y * 5)+18 } + hudAdjustment, hudText, WHITE, { 3,5 }); + DrawStringPropDecal(vf2d{ hudOffset + (float)(ScreenWidth() / 2 - GetTextSizeProp(hudText).x * 3 / 2)+32,(float)(ScreenHeight() - 2 - GetTextSizeProp(hudText).y * 5)+18 } + hudAdjustment, hudText, VERY_DARK_GREY, { 3,5 }); for (int x = -1; x <= 1; x++) { for (int y = -1; y <= 1; y++) { if (x != 0 && y != 0) { @@ -2053,6 +2055,7 @@ void FaceBall::RunEnemyAI(Enemy& e,float fElapsedTime,int myIndex) { bool FaceBall::OnUserUpdate(float fElapsedTime) { + fElapsedTime = std::min(0.1667f, fElapsedTime); gameTimer += fElapsedTime; switch (mode) { case GAME: { diff --git a/Faceball2030/main.h b/Faceball2030/main.h index a0c7522..544f880 100644 --- a/Faceball2030/main.h +++ b/Faceball2030/main.h @@ -84,7 +84,7 @@ struct Mesh private: void Parse(std::string str, int& v, int& uv) { - std::cout << str << "\n"; + //std::cout << str << "\n"; std::stringstream s(str.substr(0, str.find("/") + 1)); s >> v; str.erase(0, str.find("/") + 1); @@ -110,14 +110,14 @@ private: float x, y, z; f >> x >> y >> z; verts.push_back({ x,y,z }); - std::cout << x << " " << y << " " << z << "\n"; + //std::cout << x << " " << y << " " << z << "\n"; } else if (data == "vt") { float u, v; f >> u >> v; uvs.push_back({ u,1 - v }); - std::cout << u << " " << v << "\n"; + //std::cout << u << " " << v << "\n"; } else if (data == "f") {