diff --git a/data/room/35.tmx b/data/room/35.tmx
index ee220e2..94f127e 100644
--- a/data/room/35.tmx
+++ b/data/room/35.tmx
@@ -3,7 +3,7 @@
-25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,
+115,118,119,114,115,118,119,114,115,118,119,114,115,118,119,114,115,118,119,114,115,118,119,114,115,118,119,114,115,118,119,114,
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,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,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,0,0,0,
@@ -18,7 +18,7 @@
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,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,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,0,0,0,
-25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25
+118,119,114,115,118,119,114,115,118,119,114,115,118,119,114,115,118,119,114,115,118,119,114,115,118,119,114,115,118,119,114,115
diff --git a/data/room/36.room b/data/room/36.room
index ac022a4..194400e 100644
--- a/data/room/36.room
+++ b/data/room/36.room
@@ -7,27 +7,183 @@ roomUp=0
roomDown=0
roomLeft=37.room
roomRight=35.room
+itemColor1=green
+itemColor2=red
[enemy]
-tileSetFile=diskette.png
-animation=diskette.ani
-width=16
+tileSetFile=spark.png
+animation=spark.ani
+width=8
height=16
-x=2
-y=2
-vx=0
+x=6
+y=13
+vx=0.4
vy=0
x1=2
+y1=13
+x2=14
+y2=13
+color=yellow
+[/enemy]
+
+[enemy]
+tileSetFile=spark.png
+animation=spark.ani
+width=8
+height=16
+x=21
+y=13
+vx=0.4
+vy=0
+x1=17
+y1=13
+x2=29
+y2=13
+color=yellow
+[/enemy]
+
+[enemy]
+tileSetFile=spark.png
+animation=spark.ani
+width=8
+height=16
+x=2
+y=10
+vx=0.4
+vy=0
+x1=2
+y1=10
+x2=14
+y2=10
+color=yellow
+mirror=true
+[/enemy]
+
+[enemy]
+tileSetFile=spark.png
+animation=spark.ani
+width=8
+height=16
+x=17
+y=10
+vx=0.4
+vy=0
+x1=17
+y1=10
+x2=29
+y2=10
+color=yellow
+mirror=true
+[/enemy]
+
+[enemy]
+tileSetFile=shock.png
+animation=shock.ani
+width=8
+height=8
+x=13
+y=2
+vx=0
+vy=0.4
+x1=13
y1=2
-x2=2
-y2=2
-color=magenta
+x2=13
+y2=7
+color=bright_yellow
+[/enemy]
+
+[enemy]
+tileSetFile=shock.png
+animation=shock.ani
+width=8
+height=8
+x=10
+y=4
+vx=0
+vy=0.5
+x1=10
+y1=2
+x2=10
+y2=7
+color=bright_yellow
+[/enemy]
+
+[enemy]
+tileSetFile=shock.png
+animation=shock.ani
+width=8
+height=8
+x=7
+y=6
+vx=0
+vy=0.6
+x1=7
+y1=2
+x2=7
+y2=7
+color=bright_yellow
+[/enemy]
+
+[enemy]
+tileSetFile=shock.png
+animation=shock.ani
+width=8
+height=8
+x=24
+y=2
+vx=0
+vy=0.4
+x1=24
+y1=2
+x2=24
+y2=7
+color=bright_yellow
+[/enemy]
+
+[enemy]
+tileSetFile=shock.png
+animation=shock.ani
+width=8
+height=8
+x=21
+y=4
+vx=0
+vy=0.5
+x1=21
+y1=2
+x2=21
+y2=7
+color=bright_yellow
+[/enemy]
+
+[enemy]
+tileSetFile=shock.png
+animation=shock.ani
+width=8
+height=8
+x=18
+y=6
+vx=0
+vy=0.6
+x1=18
+y1=2
+x2=18
+y2=7
+color=bright_yellow
[/enemy]
[item]
tileSetFile=items.png
-tile=1
-x=1
-y=1
+tile=57
+x=3
+y=7
counter=1
+[/item]
+
+[item]
+tileSetFile=items.png
+tile=57
+x=28
+y=7
+counter=2
[/item]
\ No newline at end of file
diff --git a/data/room/45.room b/data/room/45.room
index 1caac82..99b1701 100644
--- a/data/room/45.room
+++ b/data/room/45.room
@@ -62,7 +62,7 @@ color=magenta
tileSetFile=items.png
tile=54
x=17
-y=2
+y=1
[/item]
[item]
diff --git a/data/room/45.tmx b/data/room/45.tmx
index e858bc4..be8c80c 100644
--- a/data/room/45.tmx
+++ b/data/room/45.tmx
@@ -6,12 +6,12 @@
30,30,30,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,
30,30,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,
30,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,
-30,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,
30,0,0,0,0,0,0,0,0,0,0,323,323,0,0,0,0,323,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
30,0,0,0,0,0,0,0,323,323,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
30,0,0,0,0,323,323,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,
+30,0,323,323,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,
30,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,
-0,0,0,0,0,323,323,323,323,323,0,323,323,323,323,323,0,323,323,323,323,0,395,0,0,0,395,395,395,395,395,395,
+0,0,323,323,0,323,323,323,323,323,0,323,323,323,323,323,0,323,323,323,323,0,395,0,0,0,395,395,395,395,395,395,
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,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,395,0,0,0,0,0,0,0,0,0,
30,30,30,0,0,0,395,395,395,0,0,0,395,395,0,0,0,0,395,395,395,0,0,0,0,0,0,0,0,0,0,0,
diff --git a/source/common/movingsprite.cpp b/source/common/movingsprite.cpp
index 3698586..80e4fba 100644
--- a/source/common/movingsprite.cpp
+++ b/source/common/movingsprite.cpp
@@ -49,6 +49,8 @@ MovingSprite::MovingSprite(float x, float y, int w, int h, float velx, float vel
// Establece el tipo de volteado
currentFlip = SDL_FLIP_NONE;
+ currentFlipH = false;
+ currentFlipV = false;
};
// Reinicia todas las variables
@@ -305,16 +307,56 @@ void MovingSprite::switchRotate()
rotateAmount *= -1;
}
-// Establece el valor de la variable
-void MovingSprite::setFlip(SDL_RendererFlip flip)
+// Actualiza el valor de la variable
+void MovingSprite::updateCurrentFlip()
{
- currentFlip = flip;
+ if (currentFlipH && currentFlipV)
+ {
+ currentFlip = SDL_RendererFlip(SDL_FLIP_HORIZONTAL | SDL_FLIP_VERTICAL);
+ }
+
+ else if (currentFlipH && !currentFlipV)
+ {
+ currentFlip = SDL_FLIP_HORIZONTAL;
+ }
+
+ else if (!currentFlipH && currentFlipV)
+ {
+ currentFlip = SDL_FLIP_VERTICAL;
+ }
+
+ else if (!currentFlipH && !currentFlipV)
+ {
+ currentFlip = SDL_FLIP_NONE;
+ }
+}
+
+// Establece el valor de la variable
+void MovingSprite::setFlipH(bool flip)
+{
+ currentFlipH = flip;
+ updateCurrentFlip();
}
// Gira el sprite horizontalmente
-void MovingSprite::flip()
+void MovingSprite::flipH()
{
- currentFlip = (currentFlip == SDL_FLIP_HORIZONTAL) ? SDL_FLIP_NONE : SDL_FLIP_HORIZONTAL;
+ currentFlipH = !currentFlipH;
+ updateCurrentFlip();
+}
+
+// Establece el valor de la variable
+void MovingSprite::setFlipV(bool flip)
+{
+ currentFlipV = flip;
+ updateCurrentFlip();
+}
+
+// Voltea el sprite verticalmente
+void MovingSprite::flipV()
+{
+ currentFlipV = !currentFlipV;
+ updateCurrentFlip();
}
// Obtiene el valor de la variable
@@ -323,6 +365,18 @@ SDL_RendererFlip MovingSprite::getFlip()
return currentFlip;
}
+// Obtiene el valor de la variable
+bool MovingSprite::getFlipH()
+{
+ return currentFlipH;
+}
+
+// Obtiene el valor de la variable
+bool MovingSprite::getFlipV()
+{
+ return currentFlipV;
+}
+
// Devuelve el rectangulo donde está el sprite
SDL_Rect MovingSprite::getRect()
{
diff --git a/source/common/movingsprite.h b/source/common/movingsprite.h
index 23260a6..2c403c6 100644
--- a/source/common/movingsprite.h
+++ b/source/common/movingsprite.h
@@ -35,6 +35,8 @@ protected:
double rotateAmount; // Cantidad de grados a girar en cada iteración
int counter; // Contador interno
SDL_RendererFlip currentFlip; // Indica como se voltea el sprite
+ bool currentFlipV;
+ bool currentFlipH;
public:
// Constructor
@@ -139,15 +141,30 @@ public:
// Cambia el sentido de la rotación
void switchRotate();
+ // Actualiza el valor de la variable
+ void updateCurrentFlip();
+
// Establece el valor de la variable
- void setFlip(SDL_RendererFlip flip);
+ void setFlipH(bool flip);
// Gira el sprite horizontalmente
- void flip();
+ void flipH();
+
+ // Establece el valor de la variable
+ void setFlipV(bool flip);
+
+ // Voltea el sprite verticalmente
+ void flipV();
// Obtiene el valor de la variable
SDL_RendererFlip getFlip();
+ // Obtiene el valor de la variable
+ bool getFlipH();
+
+ // Obtiene el valor de la variable
+ bool getFlipV();
+
// Devuelve el rectangulo donde está el sprite
SDL_Rect getRect();
diff --git a/source/enemy.cpp b/source/enemy.cpp
index cc67fdd..94e77e1 100644
--- a/source/enemy.cpp
+++ b/source/enemy.cpp
@@ -26,9 +26,10 @@ Enemy::Enemy(enemy_t enemy)
{
if (enemy.vx < 0.0f)
{
- sprite->setFlip(SDL_FLIP_HORIZONTAL);
+ sprite->setFlipH(true);
}
}
+ sprite->setFlipV(mirror);
collider = getRect();
@@ -66,7 +67,7 @@ void Enemy::checkPath()
sprite->setVelX(sprite->getVelX() * (-1));
if (doFlip)
{
- sprite->flip();
+ sprite->flipH();
}
}
@@ -75,7 +76,7 @@ void Enemy::checkPath()
sprite->setVelY(sprite->getVelY() * (-1));
if (doFlip)
{
- sprite->flip();
+ sprite->flipH();
}
}
}
diff --git a/source/player.cpp b/source/player.cpp
index bf2f3ee..eb5d140 100644
--- a/source/player.cpp
+++ b/source/player.cpp
@@ -43,7 +43,7 @@ Player::Player(player_t player)
sprite->setWidth(8);
sprite->setHeight(16);
- sprite->setFlip(player.spawn.flip);
+ sprite->setFlipH(player.spawn.flipH);
sprite->setCurrentAnimation("walk");
sprite->animate();
@@ -162,13 +162,13 @@ void Player::checkInput()
if (input->checkInput(INPUT_LEFT, REPEAT_TRUE))
{
vx = -0.6f;
- sprite->setFlip(SDL_FLIP_HORIZONTAL);
+ sprite->setFlipH(true);
}
else if (input->checkInput(INPUT_RIGHT, REPEAT_TRUE))
{
vx = 0.6f;
- sprite->setFlip(SDL_FLIP_NONE);
+ sprite->setFlipH(false);
}
else
@@ -186,11 +186,11 @@ void Player::checkInput()
if (vx > 0.0f)
{
- sprite->setFlip(SDL_FLIP_NONE);
+ sprite->setFlipH(false);
}
else
{
- sprite->setFlip(SDL_FLIP_HORIZONTAL);
+ sprite->setFlipH(true);
}
}
@@ -685,7 +685,7 @@ playerSpawn_t Player::getSpawnParams()
params.vy = vy;
params.jumpIni = jumpIni;
params.state = state;
- params.flip = sprite->getFlip();
+ params.flipH = sprite->getFlipH();
return params;
}
@@ -694,7 +694,6 @@ playerSpawn_t Player::getSpawnParams()
void Player::reLoadTexture()
{
sprite->getTexture()->reLoad();
- // texture->reLoad();
}
// Recarga la paleta
diff --git a/source/player.h b/source/player.h
index f709ecf..618fb17 100644
--- a/source/player.h
+++ b/source/player.h
@@ -30,7 +30,7 @@ struct playerSpawn_t
float vy;
int jumpIni;
state_e state;
- SDL_RendererFlip flip;
+ bool flipH;
};
struct player_t