diff --git a/data/room/29.tmx b/data/room/29.tmx
index 8f27104..da5e13f 100644
--- a/data/room/29.tmx
+++ b/data/room/29.tmx
@@ -3,22 +3,22 @@
-133,133,133,133,133,133,133,131,131,133,133,133,132,132,133,133,133,132,132,133,133,133,131,131,133,133,0,0,0,0,505,133,
-133,133,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,505,0,133,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,505,133,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,505,0,133,
133,133,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,505,0,0,133,
133,133,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,505,0,0,0,133,
133,133,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,505,0,0,0,0,133,
-133,133,0,0,228,228,228,0,0,228,228,228,0,0,228,228,228,0,0,228,228,228,0,0,228,228,0,0,228,0,0,133,
+133,133,0,0,234,234,234,0,0,234,234,234,0,0,234,234,234,0,0,234,234,234,0,0,234,234,0,0,234,0,0,133,
133,133,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,133,
-133,133,228,228,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,228,230,133,
-133,133,228,228,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,133,
+133,133,234,234,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,234,231,133,
+133,133,234,234,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,133,
133,133,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,133,
-133,133,0,0,228,228,228,0,0,229,228,228,0,0,228,228,228,0,0,228,228,228,0,0,228,228,0,0,0,0,0,133,
-133,133,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,228,228,133,
+133,133,0,0,234,234,234,0,0,230,234,234,0,0,234,234,234,0,0,234,234,234,0,0,234,234,0,0,0,0,0,133,
+133,133,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,234,234,133,
133,133,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,133,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,228,228,0,0,0,0,133,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,234,234,0,0,0,0,133,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,133,
-133,133,133,133,133,133,133,131,131,133,133,133,132,132,133,133,133,132,132,133,133,133,131,131,133,133,133,133,133,133,133,133
+133,133,133,133,133,133,133,129,129,133,133,133,130,130,133,133,133,130,130,133,133,133,129,129,133,133,133,133,133,133,133,133
diff --git a/data/room/30.room b/data/room/30.room
index d6c6965..071fcb6 100644
--- a/data/room/30.room
+++ b/data/room/30.room
@@ -1,5 +1,5 @@
name=QVOID IS A JAILGAME!
-bgColor=bright_black
+bgColor=blue
border=bright_black
tileMapFile=30.tmx
tileSetFile=standard.png
@@ -9,25 +9,57 @@ roomLeft=0
roomRight=29.room
[enemy]
-tileSetFile=diskette.png
-animation=diskette.ani
+tileSetFile=qvoid.png
+animation=qvoid.ani
width=16
height=16
-x=2
-y=2
-vx=0
+x=1
+y=1
+vx=0.7
vy=0
-x1=2
-y1=2
-x2=2
-y2=2
-color=magenta
+x1=1
+y1=1
+x2=29
+y2=1
+color=white
+[/enemy]
+
+[enemy]
+tileSetFile=qvoid.png
+animation=qvoid.ani
+width=16
+height=16
+x=29
+y=1
+vx=-0.7
+vy=0
+x1=1
+y1=1
+x2=29
+y2=1
+color=red
+[/enemy]
+
+[enemy]
+tileSetFile=qvoid.png
+animation=qvoid.ani
+width=16
+height=16
+x=6
+y=7
+vx=-0.5
+vy=0
+x1=1
+y1=7
+x2=27
+y2=7
+color=green
[/enemy]
[item]
tileSetFile=items.png
-tile=1
+tile=20
x=1
-y=1
+y=2
counter=1
[/item]
\ No newline at end of file
diff --git a/data/room/30.tmx b/data/room/30.tmx
index c04c806..96fc950 100644
--- a/data/room/30.tmx
+++ b/data/room/30.tmx
@@ -3,22 +3,22 @@
-133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,0,0,0,0,0,0,0,0,0,0,0,0,133,
-133,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,133,
-133,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,133,
-133,228,228,0,0,228,228,0,0,228,228,0,0,228,228,0,0,228,228,0,0,0,0,0,0,0,0,0,0,0,0,133,
-133,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,133,
-133,0,0,228,228,0,0,228,228,0,0,228,228,0,0,228,228,0,0,0,228,228,0,0,0,228,228,548,0,0,0,133,
-133,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,548,0,0,133,
-133,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,228,0,133,
-133,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,133,
-133,0,0,0,0,0,0,0,0,485,485,485,0,0,0,228,228,0,0,0,485,485,485,0,0,0,228,228,0,0,0,133,
-133,0,0,0,228,228,228,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,133,
-133,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,228,133,
-133,228,228,548,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,133,
-133,0,0,0,548,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-133,0,0,0,0,548,0,0,0,0,0,555,0,0,0,0,0,0,0,0,0,555,0,0,0,0,0,0,0,0,0,0,
-133,555,555,555,555,555,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,133,133,133
+127,128,129,130,131,132,133,127,128,129,130,131,132,133,127,128,129,130,131,132,133,127,128,129,130,131,132,133,127,128,129,130,
+132,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,132,128,
+131,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,129,
+130,228,229,0,0,230,231,0,0,232,233,0,0,234,228,0,0,229,230,0,0,0,0,0,0,0,0,0,0,0,0,130,
+129,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,131,
+128,0,0,231,232,0,0,233,234,0,0,228,229,0,0,230,231,0,0,0,232,233,0,0,0,0,0,0,0,0,0,132,
+127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,234,228,231,548,0,0,133,
+127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,229,231,127,
+128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,
+128,0,0,0,0,0,0,0,0,232,233,228,0,0,0,485,485,0,0,0,230,231,232,0,0,0,485,485,0,0,0,129,
+129,0,0,0,229,230,231,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,130,
+130,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,131,
+131,232,233,548,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,132,
+132,0,0,0,548,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+132,0,0,0,0,548,0,0,0,0,0,555,0,0,0,0,0,0,0,0,0,555,0,0,0,0,0,0,0,0,0,0,
+133,555,555,555,555,555,127,128,129,130,131,132,485,485,485,485,485,485,485,485,485,128,129,130,131,132,133,127,128,129,130,131
diff --git a/data/tilesets/standard.png b/data/tilesets/standard.png
index 594c760..e893ca3 100644
Binary files a/data/tilesets/standard.png and b/data/tilesets/standard.png differ
diff --git a/source/common/utils.cpp b/source/common/utils.cpp
index df6a3dd..e05dc28 100644
--- a/source/common/utils.cpp
+++ b/source/common/utils.cpp
@@ -575,4 +575,14 @@ std::string boolToString(bool value)
{
return "false";
}
+}
+
+// Compara dos colores
+bool colorAreEqual(color_t color1, color_t color2)
+{
+ const bool r = color1.r == color2.r;
+ const bool g = color1.g == color2.g;
+ const bool b = color1.b == color2.b;
+
+ return (r && g && b);
}
\ No newline at end of file
diff --git a/source/common/utils.h b/source/common/utils.h
index 7b9b1f9..4a5c892 100644
--- a/source/common/utils.h
+++ b/source/common/utils.h
@@ -125,4 +125,7 @@ bool stringToBool(std::string str);
// Convierte un valor booleano en una cadena
std::string boolToString(bool value);
+// Compara dos colores
+bool colorAreEqual(color_t color1, color_t color2);
+
#endif
\ No newline at end of file
diff --git a/source/game.cpp b/source/game.cpp
index 247530a..44a87aa 100644
--- a/source/game.cpp
+++ b/source/game.cpp
@@ -52,8 +52,8 @@ Game::Game(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *as
blackScreen = false;
blackScreenCounter = 0;
- this->player->setInvincible(debug->getEnabled());
- board.music = !debug->getEnabled();
+ // this->player->setInvincible(debug->getEnabled());
+ // board.music = !debug->getEnabled();
section.name = SECTION_PROG_GAME;
section.subsection = 0;
@@ -100,7 +100,7 @@ void Game::checkEventHandler()
case SDL_SCANCODE_D:
debug->switchEnabled();
- player->setInvincible(debug->getEnabled());
+ options->invincible = debug->getEnabled();
board.music = !debug->getEnabled();
board.music ? JA_ResumeMusic() : JA_PauseMusic();
break;
@@ -312,11 +312,9 @@ bool Game::changeRoom(std::string file)
// Crea un objeto habitación nuevo a partir del fichero
room = new Room(resource->getRoom(file), renderer, screen, asset, options, itemTracker, &board.items, debug);
- // Actualiza el marcador
- const color_t c = room->getBorderColor(); // Obtiene el color del vorde
- const color_t cBlack = stringToColor(options->palette, "black");
- board.color = (c.r == cBlack.r && c.g == cBlack.g && c.b == cBlack.b) ? stringToColor(options->palette, "white") : c; // Si el color es negro lo cambia a blanco
- // board.color = (c.r + c.g + c.b == 0) ? stringToColor(options->palette, "white") : c; // Si el color es negro lo cambia a blanco
+ // Pone el color del marcador en función del color del borde de la habitación
+ setScoreBoardColor();
+
if (roomTracker->addRoom(file))
{ // Incrementa el contador de habitaciones visitadas
board.rooms++;
@@ -384,7 +382,7 @@ void Game::checkEndGame()
// Mata al jugador
void Game::killPlayer()
{
- if (this->player->getInvincible() || options->invincible)
+ if (options->invincible)
{
return;
}
@@ -437,12 +435,13 @@ void Game::switchPalette()
// Modifica la variable
options->palette = (options->palette == p_zxspectrum) ? p_zxarne : p_zxspectrum;
+ // Recarga las paletas
room->reLoadPalette();
player->reLoadPalette();
scoreboard->reLoadPalette();
- const color_t c = room->getBorderColor();
- board.color = (c.r + c.g + c.b == 0) ? stringToColor(options->palette, "white") : c; // Si el color es negro lo cambia a blanco
+ // Pone el color del marcador en función del color del borde de la habitación
+ setScoreBoardColor();
}
// Establece la pantalla en negro
@@ -477,4 +476,19 @@ void Game::renderBlackScreen()
screen->clean();
screen->setBorderColor(stringToColor(options->palette, "black"));
}
+}
+
+// Pone el color del marcador en función del color del borde de la habitación
+void Game::setScoreBoardColor()
+{
+ // Obtiene el color del borde
+ const color_t c = room->getBorderColor();
+
+ // Si el color es negro lo cambia a blanco
+ const color_t cBlack = stringToColor(options->palette, "black");
+ board.color = colorAreEqual(c, cBlack) ? stringToColor(options->palette, "white") : c;
+
+ // Si el color es negro brillante lo cambia a blanco
+ const color_t cBrightBlack = stringToColor(options->palette, "bright_black");
+ board.color = colorAreEqual(c, cBrightBlack) ? stringToColor(options->palette, "white") : c;
}
\ No newline at end of file
diff --git a/source/game.h b/source/game.h
index 0e424ef..3f1eb0b 100644
--- a/source/game.h
+++ b/source/game.h
@@ -43,17 +43,17 @@ private:
Test *test;
// Variables
- JA_Music music; // Musica que suena durante el juego
- Uint32 ticks; // Contador de ticks para ajustar la velocidad del programa
- Uint32 ticksSpeed; // Velocidad a la que se repiten los bucles del programa
- section_t section; // Seccion actual dentro del juego
- std::string currentRoom; // Fichero de la habitación actual
- playerSpawn_t spawnPoint; // Lugar de la habitación donde aparece el jugador
- JA_Sound deathSound; // Sonido a reproducir cuando muere el jugador
- board_t board; // Estructura con los datos del marcador
- bool paused; // Indica si el juego se encuentra en pausa
- bool blackScreen; // Indica si la pantalla está en negro. Se utiliza para la muerte del jugador
- int blackScreenCounter; // Contador para temporizar la pantalla en negro
+ JA_Music music; // Musica que suena durante el juego
+ Uint32 ticks; // Contador de ticks para ajustar la velocidad del programa
+ Uint32 ticksSpeed; // Velocidad a la que se repiten los bucles del programa
+ section_t section; // Seccion actual dentro del juego
+ std::string currentRoom; // Fichero de la habitación actual
+ playerSpawn_t spawnPoint; // Lugar de la habitación donde aparece el jugador
+ JA_Sound deathSound; // Sonido a reproducir cuando muere el jugador
+ board_t board; // Estructura con los datos del marcador
+ bool paused; // Indica si el juego se encuentra en pausa
+ bool blackScreen; // Indica si la pantalla está en negro. Se utiliza para la muerte del jugador
+ int blackScreenCounter; // Contador para temporizar la pantalla en negro
// Actualiza el juego, las variables, comprueba la entrada, etc.
void update();
@@ -109,6 +109,9 @@ private:
// Dibuja la pantalla negra
void renderBlackScreen();
+ // Pone el color del marcador en función del color del borde de la habitación
+ void setScoreBoardColor();
+
public:
// Constructor
Game(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *asset, options_t *options, Input *input, Debug *debug);
diff --git a/source/player.cpp b/source/player.cpp
index 22f64e2..bf2f3ee 100644
--- a/source/player.cpp
+++ b/source/player.cpp
@@ -21,7 +21,6 @@ Player::Player(player_t player)
color = stringToColor(options->palette, "white");
onBorder = false;
border = BORDER_TOP;
- invincible = false;
autoMovement = false;
alive = true;
maxFallHeight = BLOCK * 4;
@@ -433,6 +432,13 @@ void Player::move()
autoMovement = false;
}
+ // Si ha salido de una superficie automatica, detiene el movimiento automatico
+ if (state == s_standing && isOnFloor() && !isOnAutoSurface())
+ {
+ // Deja de estar enganchado a la superficie automatica
+ autoMovement = false;
+ }
+
// Se mueve hacia arriba
if (vy < 0.0f)
{
@@ -688,7 +694,7 @@ playerSpawn_t Player::getSpawnParams()
void Player::reLoadTexture()
{
sprite->getTexture()->reLoad();
- //texture->reLoad();
+ // texture->reLoad();
}
// Recarga la paleta
@@ -729,18 +735,6 @@ void Player::updateFeet()
feet[1] = {p.x + 7, p.y + h - 1};
}
-// Obtiene el valor de la variable
-bool Player::getInvincible()
-{
- return invincible;
-}
-
-// Establece el valor de la variable
-void Player::setInvincible(bool value)
-{
- invincible = value;
-}
-
// Cambia el estado del jugador
void Player::setState(state_e value)
{
diff --git a/source/player.h b/source/player.h
index 74683b7..f709ecf 100644
--- a/source/player.h
+++ b/source/player.h
@@ -76,7 +76,6 @@ public:
state_e prevState; // Estado previo en el que se encontraba el jugador
bool onBorder; // Indica si el jugador esta en uno de los cuatro bordes de la pantalla
int border; // Indica en cual de los cuatro bordes se encuentra
- bool invincible; // Si es invencible, no puede morir
bool autoMovement; // Indica si esta siendo arrastrado por una superficie automatica
bool paused; // Indica si el jugador esta en modo pausa
SDL_Rect lastPosition; // Contiene la ultima posición del jugador, por si hay que deshacer algun movimiento
@@ -181,12 +180,6 @@ public:
// Establece el valor de la variable
void setRoom(Room *room);
- // Obtiene el valor de la variable
- bool getInvincible();
-
- // Establece el valor de la variable
- void setInvincible(bool value);
-
// Comprueba si el jugador esta vivo
bool isAlive();