Los items ya parecen funcionar. revisar power ball y los puntos al coger items

This commit is contained in:
2022-10-03 14:11:13 +02:00
parent 91b868572e
commit 99b61c4b2d
5 changed files with 32 additions and 63 deletions

View File

@@ -2165,7 +2165,6 @@ void Game::checkPlayerItemCollision(Player *player)
}
for (auto item : items)
// for (int i = 0; i < MAX_ITEMS; i++)
{
if (item->isEnabled())
{
@@ -2214,6 +2213,7 @@ void Game::checkPlayerItemCollision(Player *player)
default:
break;
}
item->disable();
}
}
@@ -2255,12 +2255,12 @@ void Game::checkBulletBalloonCollision()
{
if (droppeditem != ITEM_COFFEE_MACHINE)
{
createItem(balloon->getPosX(), balloon->getPosY(), droppeditem);
createItem(droppeditem, balloon->getPosX(), balloon->getPosY());
JA_PlaySound(mSoundItemDrop);
}
else
{
createItem(players.at(index)->getPosX(), 0, droppeditem);
createItem(droppeditem, players.at(index)->getPosX(), 0);
mCoffeeMachineEnabled = true;
}
}
@@ -2326,11 +2326,14 @@ void Game::updateItems()
{
for (auto item : items)
{
item->update();
if (item->isOnFloor())
if (item->isEnabled())
{
JA_PlaySound(mSoundCollision);
mEffect.shake = true;
item->update();
if (item->isOnFloor())
{
JA_PlaySound(mSoundCollision);
mEffect.shake = true;
}
}
}
}
@@ -2354,22 +2357,30 @@ Uint8 Game::dropItem()
{
case 0:
if (luckyNumber < mHelper.itemPoints1Odds)
{
return ITEM_POINTS_1_DISK;
}
break;
case 1:
if (luckyNumber < mHelper.itemPoints2Odds)
{
return ITEM_POINTS_2_GAVINA;
}
break;
case 2:
if (luckyNumber < mHelper.itemPoints3Odds)
{
return ITEM_POINTS_3_PACMAR;
}
break;
case 3:
if (luckyNumber < mHelper.itemClockOdds)
{
return ITEM_CLOCK;
}
break;
case 4:
@@ -2415,8 +2426,8 @@ Uint8 Game::dropItem()
// Crea un objeto item
void Game::createItem(Uint8 type, float x, float y)
{
Item *i = new Item(mRenderer, mAsset, type, x, y);
items.push_back(i);
Item *item = new Item(mRenderer, mAsset, type, x, y);
items.push_back(item);
}
// Vacia el vector de items