diff --git a/data/map/01.map b/data/map/01.map
index 533205d..9e7cb74 100644
--- a/data/map/01.map
+++ b/data/map/01.map
@@ -1,4 +1,6 @@
tileset_img=surface.png
+bgColor1=234,171,159
+bgColor2=144,225,231
room_up=0
room_down=0
@@ -7,4 +9,34 @@ room_right=02.map
[tilemap]
01.tmx
-[/tilemap]
\ No newline at end of file
+[/tilemap]
+
+[enemy]
+tileset=walking_eye.png
+animation=walking_eye.ani
+width=16
+height=16
+x=11
+y=17
+vx=0.3
+vy=0
+x1=11
+y1=17
+x2=15
+y2=17
+[/enemy]
+
+[enemy]
+tileset=flying_eye_horn.png
+animation=flying_eye_horn.ani
+width=16
+height=16
+x=20
+y=8
+vx=0
+vy=0.7
+x1=5
+y1=8
+x2=33
+y2=8
+[/enemy]
\ No newline at end of file
diff --git a/data/map/01.tmx b/data/map/01.tmx
index c27b641..d1af713 100644
--- a/data/map/01.tmx
+++ b/data/map/01.tmx
@@ -14,19 +14,19 @@
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,50,51,52,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,159,160,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,191,192,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,263,264,0,0,0,0,0,0,0,0,257,258,0,0,0,0,0,0,0,297,0,0,0,0,0,0,263,264,0,0,0,0,0,
-0,0,0,0,0,0,0,295,296,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,265,266,0,0,0,0,0,
+0,0,0,0,0,0,0,263,264,0,0,0,0,0,0,0,0,257,258,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,295,296,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,263,264,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,295,296,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,577,578,579,580,581,582,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,189,190,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,577,578,579,580,581,582,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,239,240,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,189,190,0,0,0,0,0,0,0,0,265,266,0,0,0,0,0,
-0,0,0,257,258,257,258,0,0,0,0,0,0,0,0,0,0,0,0,0,0,577,578,579,580,581,582,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,289,290,289,290,0,0,0,0,577,578,579,580,581,582,0,0,0,0,0,0,189,190,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,189,190,0,0,0,0,0,0,577,578,579,580,581,582,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,189,190,0,0,0,0,0,0,0,0,189,190,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-263,264,0,0,0,0,0,193,194,0,0,0,0,189,190,0,0,0,0,0,0,0,281,282,277,278,279,280,0,0,0,0,0,0,0,0,0,0,0,0,
-295,296,0,0,0,0,0,225,226,0,0,0,0,189,190,0,0,281,275,275,275,275,313,314,309,310,311,312,0,0,0,0,0,0,0,0,0,0,0,0,
+0,295,296,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,239,240,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,69,70,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,257,258,257,258,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,101,102,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,289,290,289,290,0,0,0,0,577,578,579,580,581,582,0,0,0,0,0,0,0,0,327,328,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,189,190,0,0,0,0,0,0,0,0,0,0,359,360,69,70,0,0,0,93,94,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,189,190,0,0,0,0,0,0,0,0,0,0,189,190,101,102,0,0,0,125,126,0,0,0,0,0,0,
+263,264,0,0,0,0,0,193,194,0,0,0,0,189,190,0,0,0,0,0,0,0,281,282,277,278,279,274,280,0,0,0,157,158,0,0,0,0,0,0,
+295,296,0,0,0,0,0,225,226,0,0,0,0,189,190,0,0,281,275,275,275,275,313,314,309,310,311,312,304,0,0,0,189,190,0,0,0,0,0,0,
265,264,263,264,263,264,263,264,263,264,263,264,263,264,263,264,263,264,263,266,266,266,283,284,266,265,266,264,263,264,263,264,263,264,263,264,263,264,263,264,
295,296,295,296,295,296,295,296,295,265,295,296,295,296,295,296,295,296,295,296,295,296,315,316,298,297,298,296,295,296,295,296,295,296,295,296,295,296,295,296
diff --git a/data/map/02.map b/data/map/02.map
index 064fb40..8fe9a23 100644
--- a/data/map/02.map
+++ b/data/map/02.map
@@ -1,4 +1,6 @@
tileset_img=surface.png
+bgColor1=234,100,159
+bgColor2=144,235,231
room_up=0
room_down=03.map
@@ -9,21 +11,6 @@ room_right=0
02.tmx
[/tilemap]
-[enemy]
-tileset=walking_eye.png
-animation=walking_eye.ani
-width=16
-height=16
-x=3
-y=17
-vx=0.4
-vy=0
-x1=3
-y1=17
-x2=13
-y2=17
-[/enemy]
-
[enemy]
tileset=flying_eye.png
animation=flying_eye.ani
diff --git a/data/map/02.tmx b/data/map/02.tmx
index d4bd985..28d96c0 100644
--- a/data/map/02.tmx
+++ b/data/map/02.tmx
@@ -4,31 +4,31 @@
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,266,266,266,266,266,266,266,266,266,266,266,266,266,266,0,0,297,297,0,297,297,0,297,297,0,297,297,0,297,297,0,297,297,0,297,297,0,0,
-0,0,266,0,0,0,0,0,0,0,0,0,0,0,0,266,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,265,0,0,0,0,0,0,0,0,0,0,0,0,265,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,18,19,20,0,
-0,0,265,265,265,265,265,265,265,265,265,265,265,265,265,265,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,50,51,52,0,
-0,0,266,0,0,0,0,0,0,0,0,0,0,0,0,266,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,87,88,89,90,0,0,0,0,
-0,0,265,0,0,0,0,0,0,0,0,0,0,0,0,265,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,119,120,121,122,0,0,0,0,
-0,0,265,265,265,265,265,265,265,265,265,265,265,265,265,265,0,18,19,20,0,0,0,0,0,0,0,0,0,0,0,0,151,152,153,154,0,0,0,0,
-0,0,266,0,0,0,0,0,0,0,0,0,0,0,0,266,0,50,51,52,0,0,0,0,0,0,0,0,0,0,0,0,183,184,185,186,0,0,0,0,
-0,0,265,0,0,0,0,0,0,0,0,0,0,0,0,265,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,265,265,265,265,265,265,265,265,265,265,265,265,265,265,0,0,297,297,0,297,297,0,297,297,0,297,297,0,297,297,0,297,297,0,297,297,0,0,
-0,0,266,0,0,0,0,0,0,0,0,0,0,0,0,266,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,265,0,0,0,0,0,0,0,0,0,0,0,0,265,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,265,265,265,265,265,265,265,265,265,265,265,265,265,265,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,266,0,0,0,0,0,0,0,0,0,0,0,0,266,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,265,0,0,0,0,0,0,0,0,0,0,0,0,265,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,265,265,265,265,265,265,265,265,265,265,265,265,265,265,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,266,0,0,0,0,0,0,0,0,0,0,0,0,266,0,0,0,0,0,0,0,0,0,0,0,195,196,0,0,0,0,0,0,0,0,0,0,0,
-0,0,265,0,0,0,0,0,0,0,0,0,0,0,0,265,0,0,0,0,0,0,0,0,0,0,0,227,228,0,0,0,0,0,0,0,0,0,0,0,
-0,0,265,265,265,265,265,265,265,265,265,265,265,265,265,265,0,0,297,297,0,297,297,0,297,297,0,297,297,0,297,297,0,297,297,0,297,297,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-23,24,25,26,27,28,29,30,31,32,23,24,25,26,27,28,29,30,31,32,23,24,25,26,27,28,29,30,31,32,23,24,25,26,27,28,29,30,31,32,
-55,56,57,58,59,60,61,62,63,64,55,56,57,58,59,60,61,62,63,64,55,56,57,58,59,60,61,62,63,64,55,56,57,58,59,60,61,62,63,64,
-263,263,263,263,263,263,263,263,263,263,263,263,263,263,263,263,263,263,263,263,263,264,264,264,264,264,135,136,135,136,264,264,264,264,264,264,264,264,264,264,
-295,295,295,295,295,295,295,295,295,295,295,295,295,295,295,295,295,295,295,295,295,296,296,296,296,296,167,168,167,168,296,296,296,296,296,296,296,296,296,296
+0,0,0,0,0,0,0,0,0,0,0,0,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,19,20,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,50,51,52,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,87,88,89,90,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,119,120,121,122,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,18,19,20,0,0,0,0,0,0,0,0,0,0,0,0,151,152,153,154,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,50,51,52,0,0,0,0,0,0,0,0,0,0,0,0,183,184,185,186,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0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,0,0,0,0,0,0,0,0,0,
+263,263,263,263,263,263,263,263,263,263,263,263,263,263,263,263,263,263,263,263,263,264,264,264,264,264,0,0,0,0,264,264,264,264,264,264,264,264,264,264,
+295,295,295,295,295,295,295,295,295,295,295,295,295,295,295,295,295,295,295,295,295,296,296,296,296,296,0,0,0,0,296,296,296,296,296,296,296,296,296,296
diff --git a/data/map/03.map b/data/map/03.map
index c655a06..bf969fc 100644
--- a/data/map/03.map
+++ b/data/map/03.map
@@ -1,4 +1,6 @@
tileset_img=surface.png
+bgColor1=234,100,159
+bgColor2=144,235,231
room_up=02.map
room_down=0
diff --git a/source/map.cpp b/source/map.cpp
index 9e056c4..4e83fe0 100644
--- a/source/map.cpp
+++ b/source/map.cpp
@@ -167,6 +167,30 @@ bool Map::setVars(std::string var, std::string value)
{
tileset_img = value;
}
+ else if (var == "bgColor1")
+ {
+ // Se introducen los valores separados por comas en un vector
+ std::stringstream ss(value);
+ std::string tmp;
+ getline(ss, tmp, ',');
+ bgColor1.r = std::stoi(tmp);
+ getline(ss, tmp, ',');
+ bgColor1.g = std::stoi(tmp);
+ getline(ss, tmp, ',');
+ bgColor1.b = std::stoi(tmp);
+ }
+ else if (var == "bgColor2")
+ {
+ // Se introducen los valores separados por comas en un vector
+ std::stringstream ss(value);
+ std::string tmp;
+ getline(ss, tmp, ',');
+ bgColor2.r = std::stoi(tmp);
+ getline(ss, tmp, ',');
+ bgColor2.g = std::stoi(tmp);
+ getline(ss, tmp, ',');
+ bgColor2.b = std::stoi(tmp);
+ }
else if (var == "room_up")
{
room_up = value;
@@ -270,17 +294,14 @@ void Map::fillMapTexture()
// Dibuja el degradado de fondo
const int num_lines = 208;
- const color_t color1 = {234, 171, 159};
- const color_t color2 = {144, 225, 231};
-
for (int i = 0; i < num_lines; i++)
{
float step = ((float)i / (float)num_lines);
- int r = color1.r + ((color2.r - color1.r) * step);
- int g = color1.g + ((color2.g - color1.g) * step);
- int b = color1.b + ((color2.b - color1.b) * step);
+ int r = bgColor1.r + ((bgColor2.r - bgColor1.r) * step);
+ int g = bgColor1.g + ((bgColor2.g - bgColor1.g) * step);
+ int b = bgColor1.b + ((bgColor2.b - bgColor1.b) * step);
SDL_SetRenderDrawColor(renderer, r, g, b, 0xFF);
- SDL_RenderDrawLine(renderer, 0, i, 320, i);
+ SDL_RenderDrawLine(renderer, 0, i, 319, i);
}
// Dibuja el mapeado de tiles
@@ -343,7 +364,7 @@ e_tile_map Map::getTile(SDL_Point p)
// Normalizamos los puntos para que no busque fuera del mapa
const int x = std::max(getPlayArea(b_left), (std::min(p.x, getPlayArea(b_right) - 1)));
const int y = std::max(getPlayArea(b_top), (std::min(p.y, getPlayArea(b_bottom) - 1)));
-
+
// Calcula el tile
const int tile = tilemap[((y / tile_size) * map_width) + (x / tile_size)];
const int png_width = 32;
diff --git a/source/map.h b/source/map.h
index fd08e8a..841ca2c 100644
--- a/source/map.h
+++ b/source/map.h
@@ -44,6 +44,8 @@ private:
LTexture *texture_tile; // Textura con los graficos de los tiles habitación
SDL_Texture *map_texture; // Textura para dibujar el mapa de la habitación
std::vector enemy_list; // Listado con los enemigos de la habitación
+ color_t bgColor1; // Color superior del degradado de fondo
+ color_t bgColor2; // Color inferior del degradado de fondo
int tile_size; // Ancho del tile en pixels
int map_width; // Ancho del mapa en tiles
diff --git a/source/title.cpp b/source/title.cpp
index b4eacc3..f7f470a 100644
--- a/source/title.cpp
+++ b/source/title.cpp
@@ -16,7 +16,7 @@ Title::Title(SDL_Renderer *renderer, Screen *screen, Asset *asset, Input *input)
sprite = new AnimatedSprite(texture, renderer, asset->get("intro.ani"));
sprite->setCurrentAnimation("menu");
text = new Text(asset->get("debug.png"), asset->get("debug.txt"), renderer);
- music = JA_LoadMusic(asset->get("music_title.ogg").c_str());
+ music = JA_LoadMusic(asset->get("music_title.ogg").c_str());
// Inicializa variables
section = {SECTION_PROG_TITLE, 0};
@@ -44,7 +44,7 @@ Title::~Title()
delete text;
text = nullptr;
- JA_DeleteMusic(music);
+ JA_DeleteMusic(music);
}
// Actualiza las variables
@@ -88,9 +88,7 @@ void Title::render()
// Dibuja los objetos
sprite->render();
- //text->writeCentered(160, 200, "@2016,2022 JAILDESIGNER & JAILBROTHER (v0.6)", -1);
- const color_t color = {179,83,71};
- text->writeDX(TXT_CENTER|TXT_COLOR,160, 200, "@2016,2022 JAILDESIGNER & JAILBROTHER (v0.6)", -1, color);
+ text->writeDX(TXT_CENTER | TXT_COLOR, 160, 200, "@2016,2022 JAILDESIGNER & JAILBROTHER (v0.6)", -1, {255, 93, 4});
// Vuelca el contenido del renderizador en pantalla
screen->blit();
@@ -99,8 +97,8 @@ void Title::render()
// Bucle principal
section_t Title::run()
{
- JA_PlayMusic(music);
-
+ JA_PlayMusic(music);
+
while (section.name == SECTION_PROG_TITLE)
{
update();
@@ -109,5 +107,5 @@ section_t Title::run()
return section;
- JA_StopMusic();
+ JA_StopMusic();
}