afegits els grafics nous per al jugador

This commit is contained in:
2024-07-13 12:02:55 +02:00
parent eba20af28e
commit ebbe84da64
13 changed files with 21 additions and 29 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 835 B

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 529 B

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@@ -1,5 +1,5 @@
frameWidth=24 frameWidth=30
frameHeight=24 frameHeight=30
[animation] [animation]
name=walk name=walk

View File

@@ -1,5 +1,5 @@
frameWidth=24 frameWidth=30
frameHeight=24 frameHeight=30
[animation] [animation]
name=default name=default

View File

@@ -1,5 +1,5 @@
frameWidth=28 frameWidth=35
frameHeight=32 frameHeight=40
[animation] [animation]
name=default name=default

View File

@@ -1,5 +1,5 @@
frameWidth=24 frameWidth=30
frameHeight=24 frameHeight=30
[animation] [animation]
name=walk name=walk

View File

@@ -1,5 +1,5 @@
frameWidth=24 frameWidth=30
frameHeight=24 frameHeight=30
[animation] [animation]
name=walk name=walk

View File

@@ -179,10 +179,10 @@ void Game::init(int playerID)
players.clear(); players.clear();
// Crea los dos jugadores // Crea los dos jugadores
Player *player1 = new Player((PLAY_AREA_CENTER_FIRST_QUARTER_X * ((0 * 2) + 1)) - 11, PLAY_AREA_BOTTOM - 24, renderer, playerTextures[0], playerAnimations); Player *player1 = new Player((PLAY_AREA_CENTER_FIRST_QUARTER_X * ((0 * 2) + 1)) - 11, PLAY_AREA_BOTTOM - 30, renderer, playerTextures[0], playerAnimations);
players.push_back(player1); players.push_back(player1);
Player *player2 = new Player((PLAY_AREA_CENTER_FIRST_QUARTER_X * ((1 * 2) + 1)) - 11, PLAY_AREA_BOTTOM - 24, renderer, playerTextures[1], playerAnimations); Player *player2 = new Player((PLAY_AREA_CENTER_FIRST_QUARTER_X * ((1 * 2) + 1)) - 11, PLAY_AREA_BOTTOM - 30, renderer, playerTextures[1], playerAnimations);
players.push_back(player2); players.push_back(player2);
// Habilita el jugador seleccionado. playerID es player 1 o player 2 // Habilita el jugador seleccionado. playerID es player 1 o player 2

View File

@@ -240,7 +240,6 @@ private:
// Guarda el fichero de datos para la demo // Guarda el fichero de datos para la demo
bool saveDemoFile(); bool saveDemoFile();
#endif #endif
// Inicializa las formaciones enemigas // Inicializa las formaciones enemigas
void initEnemyFormations(); void initEnemyFormations();

View File

@@ -52,11 +52,11 @@ void Player::init()
input = true; input = true;
// Establece la altura y el ancho del jugador // Establece la altura y el ancho del jugador
width = 24; width = 30;
height = 24; height = 30;
// Establece el tamaño del circulo de colisión // Establece el tamaño del circulo de colisión
collider.r = 7; collider.r = 9;
// Actualiza la posición del circulo de colisión // Actualiza la posición del circulo de colisión
shiftColliders(); shiftColliders();
@@ -153,7 +153,7 @@ void Player::move()
headSprite->setPosY(posY); headSprite->setPosY(posY);
fireSprite->setPosX(getPosX() - 2); fireSprite->setPosX(getPosX() - 2);
fireSprite->setPosY(posY - 8); fireSprite->setPosY(posY - 10);
} }
else else
{ {
@@ -179,7 +179,7 @@ void Player::render()
{ {
if (invulnerable) if (invulnerable)
{ {
if ((invulnerableCounter % 10) > 4) if ((invulnerableCounter % 6) > 2)
{ {
if (powerUp) if (powerUp)
{ {
@@ -528,10 +528,12 @@ void Player::removeExtraHit()
{ {
coffees--; coffees--;
} }
if (coffees == 0) if (coffees == 0)
{ {
extraHit = false; extraHit = false;
} }
invulnerable = true; invulnerable = true;
invulnerableCounter = PLAYER_INVULNERABLE_COUNTER; invulnerableCounter = PLAYER_INVULNERABLE_COUNTER;
} }
@@ -576,27 +578,18 @@ Texture *Player::getDeadTexture()
// Actualiza el valor de la variable // Actualiza el valor de la variable
void Player::updatePowerUpHeadOffset() void Player::updatePowerUpHeadOffset()
{ {
if (!powerUp) if (powerUp)
{
// powerUpHeadOffset = 0;
}
else
{
// powerUpHeadOffset = 96;
if (powerUpCounter < 300) if (powerUpCounter < 300)
{ {
if (powerUpCounter % 10 > 4) if (powerUpCounter % 6 > 2)
{ {
// powerUpHeadOffset = 96;
fireSprite->setEnabled(false); fireSprite->setEnabled(false);
} }
else else
{ {
// powerUpHeadOffset = 0;
fireSprite->setEnabled(true); fireSprite->setEnabled(true);
} }
} }
}
} }
// Pone las texturas del jugador // Pone las texturas del jugador