From f9482594ea8092d1451a0a32917393b9d4862c85 Mon Sep 17 00:00:00 2001 From: Sergio Valor Date: Mon, 29 Aug 2022 08:27:33 +0200 Subject: [PATCH] Arreglado el problema con las plataormas verticales. Se iba un pixel --- source/game.cpp | 4 ++-- source/input.cpp | 4 ++-- source/map.cpp | 2 +- source/player.cpp | 2 +- todo.md | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/source/game.cpp b/source/game.cpp index 94b1d29..9e205cb 100644 --- a/source/game.cpp +++ b/source/game.cpp @@ -86,10 +86,10 @@ void Game::update() } } + map->update(); + enemyEngine->update(); player->update(); checkScreenBorders(); - enemyEngine->update(); - map->update(); checkInput(); } } diff --git a/source/input.cpp b/source/input.cpp index 46ca2ba..f79f641 100644 --- a/source/input.cpp +++ b/source/input.cpp @@ -149,8 +149,8 @@ bool Input::discoverGameController() if (SDL_IsGameController(i)) numGamepads++; - printf("\nChecking for game controllers...\n"); - printf("%i joysticks found, %i are gamepads\n", nJoysticks, numGamepads); + printf("** Checking for game controllers ...\n"); + printf("%i joysticks found, %i are gamepads\n\n", nJoysticks, numGamepads); if (numGamepads > 0) { diff --git a/source/map.cpp b/source/map.cpp index 4d35e07..78451f6 100644 --- a/source/map.cpp +++ b/source/map.cpp @@ -61,7 +61,7 @@ bool Map::load(std::string file_path) if (file.good()) { // Procesa el fichero linea a linea - printf("Reading file %s\n", filename.c_str()); + printf("Reading file %s\n\n", filename.c_str()); while (std::getline(file, line)) { // Si la linea contiene el texto [tilemap] se realiza el proceso de carga del fichero tmx diff --git a/source/player.cpp b/source/player.cpp index 4dd518b..1d4f741 100644 --- a/source/player.cpp +++ b/source/player.cpp @@ -300,7 +300,7 @@ void Player::move() // Dejarlo alineado con la plataforma state = standing; vy = 0.0f; - y = -h + map->getActorCollider(hookedOnMovingPlatform).y; + y = map->getActorCollider(hookedOnMovingPlatform).y - h; x += map->getActorIncX(hookedOnMovingPlatform); isOnMovingPlatform(); } diff --git a/todo.md b/todo.md index a4f5379..4a2eac4 100644 --- a/todo.md +++ b/todo.md @@ -1,5 +1,5 @@ ## TAREAS -(A) Plataformas moviles verticales: se ha de enganchar a la vy para no verse afectado por la gravedad +(A) Plataformas moviles verticales: se ha de enganchar a la vy para no verse afectado por la gravedad {cm:2022-08-29} (A) Plataformas moviles horizontales: que no te empujen (B) Plantearse hasta cuanto puede estar fuera el personaje de una plataforma. Ahora mismo con un pixel se aguanta dentro (A) Colisiones más alla del mapa. Si al otro lado del mapa hay una pared, ahora mismo hace cosas raras