Ya se engancha verticalmente en las plataformas moviles

This commit is contained in:
2022-08-27 07:55:06 +02:00
parent 6b7c49aecd
commit 43c10d335b
4 changed files with 63 additions and 47 deletions

View File

@@ -23,7 +23,9 @@ Game::Game(SDL_Renderer *renderer, Screen *screen, Asset *asset, Input *input)
section.name = SECTION_PROG_GAME;
section.subsection = SUBSECTION_GAME_PLAY;
musicEnabled = true;
debug = true;
musicEnabled = !debug;
}
// Destructor
@@ -39,7 +41,10 @@ Game::~Game()
// Bucle para el juego
section_t Game::run()
{
JA_PlayMusic(music);
if (musicEnabled)
{
JA_PlayMusic(music);
}
while (section.name == SECTION_PROG_GAME)
{
@@ -105,6 +110,15 @@ void Game::checkInput()
if (input->checkInput(INPUT_BUTTON_2, REPEAT_FALSE))
{
debug = !debug;
musicEnabled = !debug;
if (musicEnabled)
{
JA_PlayMusic(music);
}
else
{
JA_StopMusic();
}
}
if (input->checkInput(INPUT_BUTTON_3, REPEAT_FALSE))
@@ -177,16 +191,9 @@ void Game::renderDebugInfo()
text = map->getRoomFileName(b_top) + " " + map->getRoomFileName(b_right) + " " + map->getRoomFileName(b_bottom) + " " + map->getRoomFileName(b_left);
debugText->write(0, line += 6, text, -1);
text = "isOnMovingPlatform = " + std::to_string(player->isOnMovingPlatform());
//SDL_Point p = {76, 180};
//SDL_Rect r = player->sprite->getRect();
//SDL_SetRenderDrawColor(renderer, 255, 0, 0, 128);
//SDL_RenderDrawPoint(renderer, p.x, p.y);
//text = "checkCollision = " + std::to_string(checkCollision(p, r));
debugText->write(0, line += 6, text, -1);
text = std::to_string(map->getActorCollider(0)) + " " + std::to_string(map->getActorCollider(1));
text = "hookedOn = " + std::to_string(player->hookedOnMovingPlatform);
debugText->write(0, line += 6, text, -1);
// Pinta mascaras
SDL_SetRenderDrawColor(renderer, 0, 255, 0, 128);
SDL_Rect rect = player->sprite->getRect();