added player2 gfx

This commit is contained in:
2021-08-22 09:41:17 +02:00
parent 837306f16e
commit e793e08e85
11 changed files with 40 additions and 9 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 661 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 672 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 785 B

View File

@@ -284,6 +284,7 @@ const int MULTIPLIER_NUMBER_Y = SCREEN_HEIGHT - (2 * BLOCK) + 2;
#define ITEM_CLOCK 4 #define ITEM_CLOCK 4
#define ITEM_COFFEE 5 #define ITEM_COFFEE 5
#define ITEM_POWER_BALL 6 #define ITEM_POWER_BALL 6
#define ITEM_COFFEE_MACHINE 7
// Cantidad de objetos simultaneos // Cantidad de objetos simultaneos
#define MAX_ITEMS 5 #define MAX_ITEMS 5

View File

@@ -210,11 +210,15 @@ void Director::setFileList()
mFileList[34] = mExecutablePath + "/" + "../media/gfx/items.png"; mFileList[34] = mExecutablePath + "/" + "../media/gfx/items.png";
mFileList[35] = mExecutablePath + "/" + "../media/gfx/logo.png"; mFileList[35] = mExecutablePath + "/" + "../media/gfx/logo.png";
mFileList[36] = mExecutablePath + "/" + "../media/gfx/menu.png"; mFileList[36] = mExecutablePath + "/" + "../media/gfx/menu.png";
mFileList[37] = mExecutablePath + "/" + "../media/gfx/player_body.png"; mFileList[37] = mExecutablePath + "/" + "../media/gfx/player1_body.png";
mFileList[38] = mExecutablePath + "/" + "../media/gfx/player_death.png"; mFileList[38] = mExecutablePath + "/" + "../media/gfx/player1_death.png";
mFileList[39] = mExecutablePath + "/" + "../media/gfx/player_legs.png"; mFileList[39] = mExecutablePath + "/" + "../media/gfx/player1_legs.png";
mFileList[40] = mExecutablePath + "/" + "../media/gfx/title.png"; mFileList[40] = mExecutablePath + "/" + "../media/gfx/title.png";
mFileList[41] = mExecutablePath + "/" + "../media/gfx/player_head.png"; mFileList[41] = mExecutablePath + "/" + "../media/gfx/player1_head.png";
mFileList[42] = mExecutablePath + "/" + "../media/gfx/player2_body.png";
mFileList[43] = mExecutablePath + "/" + "../media/gfx/player2_death.png";
mFileList[44] = mExecutablePath + "/" + "../media/gfx/player2_legs.png";
mFileList[45] = mExecutablePath + "/" + "../media/gfx/player2_head.png";
} }
// Comprueba que todos los ficheros existen // Comprueba que todos los ficheros existen

View File

@@ -1831,6 +1831,7 @@ void Game::popBalloon(Uint8 index)
case POWER_BALL: case POWER_BALL:
destroyAllBalloons(); destroyAllBalloons();
mPowerBallEnabled = false; mPowerBallEnabled = false;
mEnemyDeployCounter = 20;
break; break;
// En cualquier otro caso, crea dos globos de un tipo inferior // En cualquier otro caso, crea dos globos de un tipo inferior
@@ -2022,6 +2023,10 @@ void Game::checkPlayerItemCollision()
mPlayer->giveExtraHit(); mPlayer->giveExtraHit();
JA_PlaySound(mSoundItemPickup); JA_PlaySound(mSoundItemPickup);
break; break;
case ITEM_COFFEE_MACHINE:
mPlayer->setPowerUp(true);
JA_PlaySound(mSoundItemPickup);
break;
default: default:
break; break;
@@ -2130,10 +2135,13 @@ void Game::resetItems()
// Devuelve un item en función del azar // Devuelve un item en función del azar
Uint8 Game::dropItem() Uint8 Game::dropItem()
{ {
//return ITEM_COFFEE; if (mPlayer->isPowerUp())
return NO_KIND;
else
return ITEM_COFFEE_MACHINE;
const Uint8 luckyNumber = rand() % 99; const Uint8 luckyNumber = rand() % 99;
const Uint8 item = rand() % 5; const Uint8 item = rand() % 6;
switch (item) switch (item)
{ {
@@ -2157,6 +2165,10 @@ Uint8 Game::dropItem()
if (luckyNumber < 5) if (luckyNumber < 5)
return ITEM_COFFEE; return ITEM_COFFEE;
break; break;
case 5:
if (luckyNumber < 4)
return ITEM_COFFEE_MACHINE;
break;
default: default:
break; break;
} }

View File

@@ -5,14 +5,12 @@
Item::Item() Item::Item()
{ {
mSprite = new AnimatedSprite(); mSprite = new AnimatedSprite();
//init(NO_KIND, 0, 0, nullptr, nullptr);
mClass = NO_KIND; mClass = NO_KIND;
} }
// Destructor // Destructor
Item::~Item() Item::~Item()
{ {
//init(NO_KIND, 0, 0, nullptr, nullptr);
delete mSprite; delete mSprite;
mSprite = nullptr; mSprite = nullptr;
} }
@@ -82,6 +80,22 @@ void Item::init(Uint8 value, float x, float y, LTexture *texture, SDL_Renderer *
mSprite->setAnimationFrames(0, 1, 16 * 5, 16 * 1, mWidth, mHeight); mSprite->setAnimationFrames(0, 1, 16 * 5, 16 * 1, mWidth, mHeight);
break; break;
case ITEM_COFFEE_MACHINE:
mWidth = 32;
mHeight = 32;
mPosX = (rand() % (PLAY_AREA_WIDTH - mWidth - 3)) + 3;
mPosY = PLAY_AREA_TOP - mHeight;
mVelX = 0.0f;
mVelY = -2.0f;
mSprite->setAnimationNumFrames(0, 4);
mSprite->setAnimationFrames(0, 0, 32 * 0, 16 * 2, mWidth, mHeight);
mSprite->setAnimationFrames(0, 1, 32 * 1, 16 * 2, mWidth, mHeight);
mSprite->setAnimationFrames(0, 2, 32 * 2, 16 * 2, mWidth, mHeight);
mSprite->setAnimationFrames(0, 3, 32 * 3, 16 * 2, mWidth, mHeight);
mCollider.r = mWidth / 2;
shiftColliders();
break;
default: default:
break; break;
} }

View File

@@ -31,7 +31,7 @@ void Player::init(float x, int y, LTexture *textureLegs, LTexture *textureBody,
mStatusFiring = PLAYER_STATUS_FIRING_NO; mStatusFiring = PLAYER_STATUS_FIRING_NO;
mInvulnerable = false; mInvulnerable = false;
mInvulnerableCounter = PLAYER_INVULNERABLE_COUNTER; mInvulnerableCounter = PLAYER_INVULNERABLE_COUNTER;
mPowerUp = true; mPowerUp = false;
mPowerUpCounter = PLAYER_POWERUP_COUNTER; mPowerUpCounter = PLAYER_POWERUP_COUNTER;
mExtraHit = false; mExtraHit = false;
mCoffees = 0; mCoffees = 0;