From c50d8a8bec27bd8c890287785845fc6aafcb0e0e Mon Sep 17 00:00:00 2001 From: Sergio Valor Date: Fri, 6 Sep 2024 13:54:17 +0200 Subject: [PATCH] =?UTF-8?q?Corregido=20un=20pase=20de=20parametros=20en=20?= =?UTF-8?q?la=20creaci=C3=B3n=20de=20los=20objetos=20y=20las=20balas?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/game.cpp | 4 ++-- source/item.cpp | 5 +---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/source/game.cpp b/source/game.cpp index b7657cd..718e7b5 100644 --- a/source/game.cpp +++ b/source/game.cpp @@ -1468,7 +1468,7 @@ void Game::renderBullets() // Crea un objeto bala void Game::createBullet(int x, int y, int kind, bool poweredUp, int owner) { - Bullet *b = new Bullet(x, y, kind, poweredUp, owner, ¶m->game.playArea.rect, bulletTexture); + Bullet *b = new Bullet(x, y, kind, poweredUp, owner, &(param->game.playArea.rect), bulletTexture); bullets.push_back(b); } @@ -1593,7 +1593,7 @@ int Game::dropItem() // Crea un objeto item void Game::createItem(int kind, float x, float y) { - Item *item = new Item(kind, x, y, ¶m->game.playArea.rect, itemTextures[kind - 1], itemAnimations[kind - 1]); + Item *item = new Item(kind, x, y, &(param->game.playArea.rect), itemTextures[kind - 1], itemAnimations[kind - 1]); items.push_back(item); } diff --git a/source/item.cpp b/source/item.cpp index 844eae2..1e080e8 100644 --- a/source/item.cpp +++ b/source/item.cpp @@ -112,7 +112,7 @@ void Item::move() if ((posY < PLAY_AREA_TOP) && !(kind == ITEM_COFFEE_MACHINE)) { // Corrige - posY -= velY; + posY = PLAY_AREA_TOP; // Invierte el sentido velY = -velY; @@ -121,9 +121,6 @@ void Item::move() // Si el objeto se sale por la parte inferior if (posY + height > playArea->h) { - // Corrige - posY -= velY; - // Detiene el objeto velY = 0; velX = 0;