rétrécissement du monde

This commit is contained in:
Jonathan Trottier
2023-11-08 10:32:16 -05:00
parent 79013fe5d1
commit 80a5bf90b4
4 changed files with 33 additions and 1 deletions

View File

@@ -883,7 +883,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;
@@ -953,6 +957,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;
}
@@ -1081,6 +1087,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);

View File

@@ -109,6 +109,8 @@ private:
int m_renderCount = 0;
int m_countdown = COUNTDOWN;
int m_nbReductionChunk = 4;
int m_timerReductionChunk = 30;
bool m_damage = false;