diff --git a/data/actors/enemies/bug.ani b/data/actors/enemies/bug.ani new file mode 100644 index 0000000..43ce4bc --- /dev/null +++ b/data/actors/enemies/bug.ani @@ -0,0 +1,10 @@ +png_width_in_tiles=6 +tile_width=16 +tile_height=16 + +[animation] +name=walk +speed=8 +loop=yes +frames=0,1,2,3,4,5,6 +[/animation] \ No newline at end of file diff --git a/data/actors/enemies/bug.png b/data/actors/enemies/bug.png new file mode 100644 index 0000000..1a47495 Binary files /dev/null and b/data/actors/enemies/bug.png differ diff --git a/data/actors/enemies/flying_eye.ani b/data/actors/enemies/flying_eye.ani new file mode 100644 index 0000000..43ce4bc --- /dev/null +++ b/data/actors/enemies/flying_eye.ani @@ -0,0 +1,10 @@ +png_width_in_tiles=6 +tile_width=16 +tile_height=16 + +[animation] +name=walk +speed=8 +loop=yes +frames=0,1,2,3,4,5,6 +[/animation] \ No newline at end of file diff --git a/data/actors/enemies/flying_eye.png b/data/actors/enemies/flying_eye.png new file mode 100644 index 0000000..4392cb8 Binary files /dev/null and b/data/actors/enemies/flying_eye.png differ diff --git a/data/actors/enemies/flying_eye_horn.ani b/data/actors/enemies/flying_eye_horn.ani new file mode 100644 index 0000000..43ce4bc --- /dev/null +++ b/data/actors/enemies/flying_eye_horn.ani @@ -0,0 +1,10 @@ +png_width_in_tiles=6 +tile_width=16 +tile_height=16 + +[animation] +name=walk +speed=8 +loop=yes +frames=0,1,2,3,4,5,6 +[/animation] \ No newline at end of file diff --git a/data/actors/enemies/flying_eye_horn.png b/data/actors/enemies/flying_eye_horn.png new file mode 100644 index 0000000..d2a3b69 Binary files /dev/null and b/data/actors/enemies/flying_eye_horn.png differ diff --git a/data/actors/enemies/walking_eye.ani b/data/actors/enemies/walking_eye.ani new file mode 100644 index 0000000..43ce4bc --- /dev/null +++ b/data/actors/enemies/walking_eye.ani @@ -0,0 +1,10 @@ +png_width_in_tiles=6 +tile_width=16 +tile_height=16 + +[animation] +name=walk +speed=8 +loop=yes +frames=0,1,2,3,4,5,6 +[/animation] \ No newline at end of file diff --git a/data/actors/enemies/walking_eye.png b/data/actors/enemies/walking_eye.png new file mode 100644 index 0000000..476f379 Binary files /dev/null and b/data/actors/enemies/walking_eye.png differ diff --git a/data/player/player.png b/data/player/player.png index fe0808b..9fe837a 100644 Binary files a/data/player/player.png and b/data/player/player.png differ diff --git a/source/map.cpp b/source/map.cpp index 9b8cd02..e689f8a 100644 --- a/source/map.cpp +++ b/source/map.cpp @@ -132,11 +132,7 @@ bool Map::setVars(std::string var, std::string value) // Indicador de éxito en la asignación bool success = true; - if (var == "bg_img") - { - bg_img = value; - } - else if (var == "tileset_img") + if (var == "tileset_img") { tileset_img = value; } @@ -176,10 +172,18 @@ void Map::fillMapTexture() SDL_RenderClear(renderer); // Dibuja el degradado de fondo - for (int i = 0; i < 208; i++) + 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++) { - SDL_SetRenderDrawColor(renderer, 234, 171, 159, 0xFF); - SDL_SetRenderDrawColor(renderer, 144, 225, 231, 0xFF); + 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); + SDL_SetRenderDrawColor(renderer, r, g, b, 0xFF); SDL_RenderDrawLine(renderer, 0, i, 320, i); } @@ -205,6 +209,7 @@ void Map::fillMapTexture() // Dibuja el marco del marcador SDL_SetRenderDrawColor(renderer, 85, 50, 85, 0xFF); + SDL_SetRenderDrawColor(renderer, 0, 0, 0, 0xFF); SDL_Rect rect = {0, 208, 320, 32}; SDL_RenderDrawRect(renderer, &rect); rect = {1, 209, 318, 30}; diff --git a/source/map.h b/source/map.h index 51df551..59029ea 100644 --- a/source/map.h +++ b/source/map.h @@ -39,7 +39,6 @@ private: std::string room_left; // Identificador de la habitación que se encuentra a la izquierda std::string room_right; // Identificador de la habitación que se encuentra a la derecha std::string tileset_img; // Imagen con los graficos para la habitación - std::string bg_img; // Imagen con los graficos para la habitación std::vector tilemap; // Indice de los tiles a dibujar en la habitación 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 diff --git a/source/player.cpp b/source/player.cpp index f88baea..5aa91e4 100644 --- a/source/player.cpp +++ b/source/player.cpp @@ -82,12 +82,12 @@ void Player::checkInput() if (input->checkInput(INPUT_LEFT, REPEAT_TRUE)) { vx = std::max(vx -= accelX, -maxVX); - sprite->setFlip(SDL_FLIP_NONE); + sprite->setFlip(SDL_FLIP_HORIZONTAL); } else if (input->checkInput(INPUT_RIGHT, REPEAT_TRUE)) { vx = std::min(vx += accelX, maxVX); - sprite->setFlip(SDL_FLIP_HORIZONTAL); + sprite->setFlip(SDL_FLIP_NONE); } else { diff --git a/source/prog.cpp b/source/prog.cpp index 16dcf78..6d55dce 100644 --- a/source/prog.cpp +++ b/source/prog.cpp @@ -31,7 +31,7 @@ Prog::Prog(std::string executablePath) input = new Input(asset->get("gamecontrollerdb.txt")); screen = new Screen(window, renderer, options); - // Controles + // Controles input->bindKey(INPUT_UP, SDL_SCANCODE_UP); input->bindKey(INPUT_DOWN, SDL_SCANCODE_DOWN); input->bindKey(INPUT_LEFT, SDL_SCANCODE_LEFT); @@ -145,11 +145,11 @@ bool Prog::setFileList() asset->add("/data/map/03.map", data); asset->add("/data/map/03.tmx", data); asset->add("/data/map/surface.png", bitmap); - + // Ficheros de configuración asset->add("/data/config.bin", data, false); asset->add("/data/input/gamecontrollerdb.txt", data); - + // Ficheros del jugador asset->add("/data/player/player.png", bitmap); asset->add("/data/player/player.ani", data); @@ -172,6 +172,16 @@ bool Prog::setFileList() asset->add("/data/font/debug.png", font); asset->add("/data/font/debug.txt", font); + // Ficheros de enemigos + asset->add("/data/actors/enemies/walking_eye.png", bitmap); + asset->add("/data/actors/enemies/walking_eye.ani", data); + asset->add("/data/actors/enemies/bug.png", bitmap); + asset->add("/data/actors/enemies/bug.ani", data); + asset->add("/data/actors/enemies/flying_eye.png", bitmap); + asset->add("/data/actors/enemies/flying_eye.ani", data); + asset->add("/data/actors/enemies/flying_eye_horn.png", bitmap); + asset->add("/data/actors/enemies/flying_eye_horn.ani", data); + return asset->check(); }