added player2 gfx
This commit is contained in:
@@ -284,6 +284,7 @@ const int MULTIPLIER_NUMBER_Y = SCREEN_HEIGHT - (2 * BLOCK) + 2;
|
||||
#define ITEM_CLOCK 4
|
||||
#define ITEM_COFFEE 5
|
||||
#define ITEM_POWER_BALL 6
|
||||
#define ITEM_COFFEE_MACHINE 7
|
||||
|
||||
// Cantidad de objetos simultaneos
|
||||
#define MAX_ITEMS 5
|
||||
|
||||
@@ -210,11 +210,15 @@ void Director::setFileList()
|
||||
mFileList[34] = mExecutablePath + "/" + "../media/gfx/items.png";
|
||||
mFileList[35] = mExecutablePath + "/" + "../media/gfx/logo.png";
|
||||
mFileList[36] = mExecutablePath + "/" + "../media/gfx/menu.png";
|
||||
mFileList[37] = mExecutablePath + "/" + "../media/gfx/player_body.png";
|
||||
mFileList[38] = mExecutablePath + "/" + "../media/gfx/player_death.png";
|
||||
mFileList[39] = mExecutablePath + "/" + "../media/gfx/player_legs.png";
|
||||
mFileList[37] = mExecutablePath + "/" + "../media/gfx/player1_body.png";
|
||||
mFileList[38] = mExecutablePath + "/" + "../media/gfx/player1_death.png";
|
||||
mFileList[39] = mExecutablePath + "/" + "../media/gfx/player1_legs.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
|
||||
|
||||
@@ -1831,6 +1831,7 @@ void Game::popBalloon(Uint8 index)
|
||||
case POWER_BALL:
|
||||
destroyAllBalloons();
|
||||
mPowerBallEnabled = false;
|
||||
mEnemyDeployCounter = 20;
|
||||
break;
|
||||
|
||||
// En cualquier otro caso, crea dos globos de un tipo inferior
|
||||
@@ -2022,6 +2023,10 @@ void Game::checkPlayerItemCollision()
|
||||
mPlayer->giveExtraHit();
|
||||
JA_PlaySound(mSoundItemPickup);
|
||||
break;
|
||||
case ITEM_COFFEE_MACHINE:
|
||||
mPlayer->setPowerUp(true);
|
||||
JA_PlaySound(mSoundItemPickup);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
@@ -2130,10 +2135,13 @@ void Game::resetItems()
|
||||
// Devuelve un item en función del azar
|
||||
Uint8 Game::dropItem()
|
||||
{
|
||||
//return ITEM_COFFEE;
|
||||
if (mPlayer->isPowerUp())
|
||||
return NO_KIND;
|
||||
else
|
||||
return ITEM_COFFEE_MACHINE;
|
||||
|
||||
const Uint8 luckyNumber = rand() % 99;
|
||||
const Uint8 item = rand() % 5;
|
||||
const Uint8 item = rand() % 6;
|
||||
|
||||
switch (item)
|
||||
{
|
||||
@@ -2157,6 +2165,10 @@ Uint8 Game::dropItem()
|
||||
if (luckyNumber < 5)
|
||||
return ITEM_COFFEE;
|
||||
break;
|
||||
case 5:
|
||||
if (luckyNumber < 4)
|
||||
return ITEM_COFFEE_MACHINE;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -5,14 +5,12 @@
|
||||
Item::Item()
|
||||
{
|
||||
mSprite = new AnimatedSprite();
|
||||
//init(NO_KIND, 0, 0, nullptr, nullptr);
|
||||
mClass = NO_KIND;
|
||||
}
|
||||
|
||||
// Destructor
|
||||
Item::~Item()
|
||||
{
|
||||
//init(NO_KIND, 0, 0, nullptr, nullptr);
|
||||
delete mSprite;
|
||||
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);
|
||||
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:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ void Player::init(float x, int y, LTexture *textureLegs, LTexture *textureBody,
|
||||
mStatusFiring = PLAYER_STATUS_FIRING_NO;
|
||||
mInvulnerable = false;
|
||||
mInvulnerableCounter = PLAYER_INVULNERABLE_COUNTER;
|
||||
mPowerUp = true;
|
||||
mPowerUp = false;
|
||||
mPowerUpCounter = PLAYER_POWERUP_COUNTER;
|
||||
mExtraHit = false;
|
||||
mCoffees = 0;
|
||||
|
||||
Reference in New Issue
Block a user