Merge pull request #25 from CegepSTH/SQC-33_Retrecissage_du_monde

rétrécissement du monde
This commit is contained in:
MarcEricMartel
2023-11-13 16:46:49 -05:00
committed by GitHub
4 changed files with 33 additions and 1 deletions

View File

@@ -924,7 +924,11 @@ void Engine::DrawHud(float elapsedTime, BlockType bloc) {
glPushMatrix();
int timer = GetCountdown(elapsedTime);
for (int i = 1; i < WORLD_SIZE_X; i++)
{
if (timer <= COUNTDOWN - m_timerReductionChunk * i)
m_world.RemoveChunk(m_nbReductionChunk * i);
}
if (m_keyK) {
SystemNotification(m_messageNotification);
m_keyK = false;
@@ -994,6 +998,8 @@ int Engine::GetFps(float elapsedTime) const { return 1 / elapsedTime; }
int Engine::GetCountdown(float elapsedTime) {
if (m_resetcountdown)
{
m_nbReductionChunk = 4;
m_timerReductionChunk = 30;
m_countdown = m_time + COUNTDOWN;
m_resetcountdown = false;
}
@@ -1122,6 +1128,7 @@ void Engine::Render(float elapsedTime) {
m_world.Update(m_bullets, m_player.GetPosition(), m_blockinfo);
m_renderer.UpdateMesh(&m_world, m_player.GetPosition(), m_blockinfo);
if (m_isSkybox) m_skybox.Render(skybox);
DrawHud(elapsedTime, bloc);