revisant la seccio game: bales, items e inici

This commit is contained in:
2025-09-24 11:37:23 +02:00
parent 2977869ab5
commit c9a29e26dd
7 changed files with 165 additions and 21 deletions

View File

@@ -1021,7 +1021,7 @@ void Game::initPaths() {
const int X1 = param.game.play_area.center_x - (W / 2);
const int X2 = param.game.play_area.rect.w;
const int Y = param.game.play_area.center_y;
paths_.emplace_back(createPath(X0, X1, PathType::HORIZONTAL, Y, 80, easeOutQuint), 20);
paths_.emplace_back(createPath(X0, X1, PathType::HORIZONTAL, Y, 80, easeOutQuint), 0.33f); // 20 frames → segundos
paths_.emplace_back(createPath(X1, X2, PathType::HORIZONTAL, Y, 80, easeInQuint), 0);
}
@@ -1033,7 +1033,7 @@ void Game::initPaths() {
const int Y1 = param.game.play_area.center_y - (H / 2);
const int Y2 = -H;
const int X = param.game.play_area.center_x;
paths_.emplace_back(createPath(Y0, Y1, PathType::VERTICAL, X, 80, easeOutQuint), 20);
paths_.emplace_back(createPath(Y0, Y1, PathType::VERTICAL, X, 80, easeOutQuint), 0.33f); // 20 frames → segundos
paths_.emplace_back(createPath(Y1, Y2, PathType::VERTICAL, X, 80, easeInQuint), 0);
}
@@ -1046,7 +1046,7 @@ void Game::initPaths() {
const int X1 = param.game.play_area.center_x - (W / 2);
const int X2 = param.game.play_area.rect.w;
const int Y = param.game.play_area.center_y - (H / 2) - 20;
paths_.emplace_back(createPath(X0, X1, PathType::HORIZONTAL, Y, 80, easeOutQuint), 400);
paths_.emplace_back(createPath(X0, X1, PathType::HORIZONTAL, Y, 80, easeOutQuint), 6.67f); // 400 frames → segundos
paths_.emplace_back(createPath(X1, X2, PathType::HORIZONTAL, Y, 80, easeInQuint), 0);
}
@@ -1059,7 +1059,7 @@ void Game::initPaths() {
const int X1 = param.game.play_area.center_x - (W / 2);
const int X2 = -W;
const int Y = param.game.play_area.center_y + (H / 2) - 20;
paths_.emplace_back(createPath(X0, X1, PathType::HORIZONTAL, Y, 80, easeOutQuint), 400);
paths_.emplace_back(createPath(X0, X1, PathType::HORIZONTAL, Y, 80, easeOutQuint), 6.67f); // 400 frames → segundos
paths_.emplace_back(createPath(X1, X2, PathType::HORIZONTAL, Y, 80, easeInQuint), 0);
}
}
@@ -1660,9 +1660,12 @@ void Game::updateDemo() {
fade_in_->update();
fade_out_->update();
// Incrementa el contador de la demo
if (demo_.counter < TOTAL_DEMO_DATA) {
// Incrementa el contador de la demo cada 1/60 segundos (16.67ms)
static float demo_frame_timer = 0.0f;
demo_frame_timer += calculateDeltaTime();
if (demo_frame_timer >= 0.01667f && demo_.counter < TOTAL_DEMO_DATA) {
demo_.counter++;
demo_frame_timer -= 0.01667f; // Mantener precisión acumulada
}
// Activa el fundido antes de acabar con los datos de la demo
@@ -1686,9 +1689,13 @@ void Game::updateRecording() {
// Solo mira y guarda el input en cada update
checkInput();
// Incrementa el contador de la demo
if (demo_.counter < TOTAL_DEMO_DATA)
// Incrementa el contador de la demo cada 1/60 segundos (16.67ms)
static float recording_frame_timer = 0.0f;
recording_frame_timer += calculateDeltaTime();
if (recording_frame_timer >= 0.01667f && demo_.counter < TOTAL_DEMO_DATA) {
demo_.counter++;
recording_frame_timer -= 0.01667f; // Mantener precisión acumulada
}
// Si se ha llenado el vector con datos, sale del programa
else {
@@ -1740,6 +1747,7 @@ void Game::updateGameStateShowingGetReadyMessage(float deltaTime) {
if (music_timer >= 1.67f) {
playMusic();
music_started = true;
setState(State::PLAYING);
}
}
}