Tower Blocks: Episode 6 - Tower Collapse

Published on

In Episode 5 we introduced custom lighting shaders to give our blocks depth and style. This time we are focusing on something more subtle but equally impactful: what happens after the game ends.

Instead of immediately resetting the game, we add a new state where the tower gracefully collapses piece by piece, giving the player a moment to breathe and reflect… and giving the game a satisfying rhythm between rounds.


What We Covered


Design Insights

Why Animate Game Reset?

Previously, the game instantly reset when the player clicked after losing. It felt jarring. Now:

These transitions, even if simple, greatly improve how finished the game feels.

Staggered Collapse for Extra Satisfaction

Each block gets a delay based on its position in the stack:

block->removal.delay = (len - i) * 0.05;

This creates a downward ripple: the higher blocks vanish first, the base vanishes last.


Implementation Highlights

New Removal Struct

typedef struct {
    float timer;
    float delay;
    float scale;
    float rotation;
} Removal;

Each block now tracks its own shrinking/rotation animation.

Animate on Game Over

When the player clicks after losing, we move into RESETTING_STATE and call:

StartTowerCollapse(game);

This sets up each block’s removal delay.

Animate + Delete Over Time

Each frame, we update:

block->removal.scale = 1.0 - t;
block->removal.rotation = t * 7;

If t > 0.9, we remove the block from the array.


What’s Next?

Episode 7 will be our last one where we will introduce sounds to our game.

We are already in a phase where small additions make a big difference. The game’s core is stable and we are making it shine.


Project Code

You will find the complete source code here: tower-blocks