From 97d5140ef9a82230df4daab06ee2e96b8c3c30ae Mon Sep 17 00:00:00 2001 From: Sergio Valor Date: Fri, 27 Aug 2021 08:33:21 +0200 Subject: [PATCH] bug hunting coffee machine on windows --- source/director.cpp | 2 +- source/game.cpp | 4 ++-- source/item.cpp | 14 +++++++++++++- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/source/director.cpp b/source/director.cpp index 3c42670..edd8fd8 100644 --- a/source/director.cpp +++ b/source/director.cpp @@ -74,7 +74,7 @@ void Director::init() } // Sección - mSection.name = PROG_SECTION_LOGO; + mSection.name = PROG_SECTION_GAME; mSection.subsection = 0; // Textos diff --git a/source/game.cpp b/source/game.cpp index a7caf0f..d56a841 100644 --- a/source/game.cpp +++ b/source/game.cpp @@ -2269,10 +2269,10 @@ void Game::resetItems() // Devuelve un item en función del azar Uint8 Game::dropItem() { - /*if (mPlayer[0]->isPowerUp() || (mCoffeeMachineEnabled)) + if (mPlayer[0]->isPowerUp() || (mCoffeeMachineEnabled)) return NO_KIND; else - return ITEM_COFFEE_MACHINE;*/ + return ITEM_COFFEE_MACHINE; const Uint8 luckyNumber = rand() % 100; const Uint8 item = rand() % 6; diff --git a/source/item.cpp b/source/item.cpp index f2146a2..18034fe 100644 --- a/source/item.cpp +++ b/source/item.cpp @@ -1,5 +1,6 @@ #include "const.h" #include "item.h" +#include // Constructor Item::Item() @@ -144,6 +145,16 @@ void Item::render() // Actualiza la posición y estados del objeto void Item::move() { + if (mClass == ITEM_COFFEE_MACHINE) + { + printf("---\n"); + printf("x\t%f\n", mPosX); + printf("y\t%f\n", mPosY); + printf("ax\t%f\n", mAccelX); + printf("ay\t%f\n", mAccelY); + printf("---\n"); + } + mStatus = 0; // Calcula la nueva posición @@ -186,7 +197,8 @@ void Item::move() mAccelX = 0; mAccelY = 0; mPosY = PLAY_AREA_BOTTOM - mHeight; - if (mClass == ITEM_COFFEE_MACHINE) mStatus = 1; + if (mClass == ITEM_COFFEE_MACHINE) + mStatus = 1; } // Actualiza la posición del sprite