Añadido el degradado de fondo al archivo de mapa

This commit is contained in:
2022-08-23 19:00:09 +02:00
parent 2425ab5142
commit f2ea31a564
8 changed files with 109 additions and 67 deletions

View File

@@ -1,4 +1,6 @@
tileset_img=surface.png
bgColor1=234,171,159
bgColor2=144,225,231
room_up=0
room_down=0
@@ -8,3 +10,33 @@ room_right=02.map
[tilemap]
01.tmx
[/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]

View File

@@ -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
</data>

View File

@@ -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

View File

@@ -4,31 +4,31 @@
<layer id="1" name="Capa de patrones 1" width="40" height="26">
<data encoding="csv">
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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,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
</data>
</layer>
</map>

View File

@@ -1,4 +1,6 @@
tileset_img=surface.png
bgColor1=234,100,159
bgColor2=144,235,231
room_up=02.map
room_down=0

View File

@@ -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

View File

@@ -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 *> 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

View File

@@ -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();