Line drop by pixel

This commit is contained in:
2025-11-30 08:17:34 +01:00
parent 332e2efb74
commit 8279ccbe6d
3 changed files with 49 additions and 2 deletions

View File

@ -3,6 +3,9 @@
#include <SDL3/SDL.h>
#include <vector>
#include <random>
#include <array>
#include "../core/Game.h"
class LineEffect {
public:
@ -71,6 +74,7 @@ public:
// Update and render the effect
bool update(float deltaTime); // Returns true if effect is complete
void render(SDL_Renderer* renderer, SDL_Texture* blocksTex, int gridX, int gridY, int blockSize);
float getRowDropOffset(int row) const;
// Audio
void playLineClearSound(int lineCount);
@ -95,7 +99,7 @@ private:
// Animation timing - Flash then immediate explosion effect
static constexpr float FLASH_DURATION = 0.18f; // Slightly longer flash for anticipation
static constexpr float EXPLODE_DURATION = 0.9f; // Extended fireworks time
static constexpr float DROP_DURATION = 0.20f; // Allow lingering sparks before collapse
static constexpr float DROP_DURATION = 0.35f; // Allow lingering sparks before collapse
void createParticles(int row, int gridX, int gridY, int blockSize);
void spawnShardBurst(float x, float y, SDL_Color tint);
@ -112,4 +116,8 @@ private:
bool loadAudioSample(const std::string& path, std::vector<int16_t>& sample);
void initAudio();
SDL_Color pickFireColor() const;
std::array<float, Game::ROWS> rowDropTargets{};
float dropProgress = 0.0f;
int dropBlockSize = 0;
};