diff --git a/data/map/01.map b/data/map/01.map index 4932f3f..f8e722b 100644 --- a/data/map/01.map +++ b/data/map/01.map @@ -5,7 +5,7 @@ bgColor2=144,225,231 room_up=0 room_down=0 -room_left=0 +room_left=04.map room_right=02.map [tilemap] diff --git a/data/map/01.tmx b/data/map/01.tmx index a092352..786249f 100644 --- a/data/map/01.tmx +++ b/data/map/01.tmx @@ -5,30 +5,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,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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,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,50,51,52,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,0,18,19,20,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,0,50,51,52,0,0,0,0,0,0,0,0,0,0,0,183,184,185,186,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,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,159,160,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,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,109,110,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,445,447,0,0,0,0,0,0,0,0,448,450,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,479,481,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,445,447,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,479,481,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,583,584,0,0,0,0,0,0,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,127,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,366,367,367,368,0,0,0,0,0,189,190,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,430,431,431,432,0,0,0,0,577,578,579,580,581,582,0,0,0,0,0,0,0,0,583,584,0,0,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,615,616,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, -363,364,0,0,0,0,0,193,194,0,0,0,0,189,190,0,0,0,0,0,0,0,362,282,277,278,279,274,364,0,0,0,157,158,0,0,0,0,0,0, -295,396,0,0,0,0,0,225,226,0,0,0,0,189,190,0,0,362,275,275,275,275,313,314,309,310,311,312,396,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 +0,0,0,0,0,0,0,0,0,0,0,0,553,554,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,253,254,0,0,0,0,0,105,106,0,0,0,0,0,0,0,0,0,75,76,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,448,449,449,450,0,0,0,0,37,38,0,0,0,0,0,0,0,0,0,109,110,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,482,483,483,484,0,0,0,547,548,549,550,551,552,0,0,0,0,0,0,77,78,11,12,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,37,38,0,0,0,0,0,0,0,0,111,112,45,46,7,8,0,0,0,5,6,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,7,8,0,0,0,0,0,0,0,0,0,0,37,38,41,42,0,0,0,39,40,0,0,0,0,0,0, +344,345,0,0,0,0,0,207,208,0,0,0,0,41,42,0,0,0,0,0,0,0,343,344,292,293,294,344,345,0,0,0,105,106,0,0,0,0,0,0, +378,379,0,0,0,0,0,241,242,0,0,0,0,37,38,0,0,343,291,344,291,291,313,314,326,327,328,378,379,0,0,0,37,38,0,0,0,0,0,0, +279,280,291,292,279,280,279,291,292,280,279,280,291,292,279,280,279,280,281,281,282,281,282,281,281,282,281,282,279,280,279,280,291,292,279,280,291,292,279,280, +313,314,325,326,313,314,313,325,326,314,313,314,325,326,313,314,313,314,313,315,316,314,313,314,313,314,313,314,313,314,313,314,325,326,313,314,325,326,313,314 diff --git a/data/map/02.ene b/data/map/02.ene index c6af4bc..72cf460 100644 --- a/data/map/02.ene +++ b/data/map/02.ene @@ -11,19 +11,4 @@ x1=9 y1=12 x2=9 y2=20 -[/path] - -[path] -tileset=flying_eye_horn.png -animation=flying_eye_horn.ani -width=16 -height=16 -x=15 -y=5 -vx=0.5 -vy=0 -x1=5 -y1=5 -x2=30 -y2=5 [/path] \ No newline at end of file diff --git a/data/map/02.map b/data/map/02.map index 3918179..ddcd5ea 100644 --- a/data/map/02.map +++ b/data/map/02.map @@ -1,10 +1,7 @@ tileset_img=surface.png enemy_file=02.ene -bgColor1=234,100,159 -bgColor2=144,235,231 - -bgColor1=153,229,80 -bgColor2=95,205,228 +bgColor1=234,171,159 +bgColor2=144,225,231 room_up=0 room_down=03.map diff --git a/data/map/03.tmx b/data/map/03.tmx index 1282ab9..0a2e82c 100644 --- a/data/map/03.tmx +++ b/data/map/03.tmx @@ -7,8 +7,8 @@ 381,0,0,0,0,0,0,0,37,38,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,37,38,0,0,0,0,0,0,0,0,0,0,380, 381,0,0,0,0,0,0,0,37,38,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,37,38,0,0,0,0,0,0,0,0,0,0,482, 381,0,0,0,0,0,0,0,77,78,11,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,37,38,0,0,0,0,0,0,0,0,0,0,0, -381,0,0,0,0,0,0,0,111,112,45,46,0,0,0,0,0,0,0,0,0,0,0,0,0,547,548,549,550,551,552,0,0,0,0,0,0,0,0,0, -381,0,0,0,0,0,0,0,0,0,7,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,37,38,0,0,0,0,0,0,0,0,0,0,0, +381,0,0,0,0,0,0,0,111,112,45,46,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,553,554,0,0,0,0,0,0,0,0,0,0,0, +381,0,0,0,0,0,0,0,0,0,7,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,105,38,0,0,0,0,0,0,0,0,0,0,0, 311,0,0,0,0,0,0,0,0,0,41,42,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,37,38,0,0,0,0,0,0,0,0,0,0,0, 381,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,37,38,0,0,0,0,0,0,0,0,0,0,276, 310,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,37,38,0,0,0,0,0,0,0,0,0,0,381, diff --git a/data/map/05.map b/data/map/05.map index fd0ee6f..c75cc93 100644 --- a/data/map/05.map +++ b/data/map/05.map @@ -2,7 +2,7 @@ tileset_img=surface.png bgColor1=234,171,159 bgColor2=144,225,231 -room_up=10.map +room_up=0.map room_down=06.map room_left=02.map room_right=07.map @@ -10,3 +10,67 @@ room_right=07.map [tilemap] 05.tmx [/tilemap] + +[actors] + +[moving platform] +tileset=moving_platform.png +animation=moving_platform.ani +width=16 +height=8 +x=18 +y=24 +vx=-0.6 +vy=0 +x1=13 +y1=24 +x2=26 +y2=24 +[/moving platform] + +[diamond] +tileset=diamond.png +animation=diamond.ani +width=16 +height=16 +x=6 +y=6 +[/diamond] + +[diamond] +tileset=diamond.png +animation=diamond.ani +width=16 +height=16 +x=19 +y=10 +[/diamond] + +[diamond] +tileset=diamond.png +animation=diamond.ani +width=16 +height=16 +x=34 +y=15 +[/diamond] + +[diamond] +tileset=diamond.png +animation=diamond.ani +width=16 +height=16 +x=32 +y=2 +[/diamond] + +[diamond] +tileset=diamond.png +animation=diamond.ani +width=16 +height=16 +x=19 +y=21 +[/diamond] + +[/actors] \ No newline at end of file diff --git a/data/map/05.tmx b/data/map/05.tmx index 0b70189..59838ba 100644 --- a/data/map/05.tmx +++ b/data/map/05.tmx @@ -20,7 +20,7 @@ 0,0,0,0,0,0,111,112,45,46,0,0,0,0,0,0,0,0,0,37,38,0,0,0,0,0,0,9,10,79,80,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,9,10,73,79,80,0,0,0,0,0,0,0,0,0,37,38,0,0,0,0,0,0,43,44,113,114,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,43,44,107,113,114,0,0,0,0,0,0,0,0,0,553,554,0,0,0,0,0,0,37,38,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,77,78,11,12,0,0,0,0,0,0,0,0,0,0,105,106,0,0,0,0,0,0,37,38,0,0,0,253,254,253,254,0,0,0,0, +0,0,0,0,0,77,78,11,12,0,0,0,0,0,0,0,0,0,0,105,106,0,0,0,0,0,0,553,554,0,0,0,253,254,253,254,0,0,0,0, 0,0,0,5,6,111,112,45,46,0,0,0,0,0,0,0,0,0,0,37,38,0,0,0,0,0,0,105,106,0,0,0,547,548,549,550,551,552,0,0, 0,0,0,39,40,0,0,7,8,0,0,0,0,0,0,0,0,0,0,37,38,0,0,0,0,0,0,77,78,11,12,0,0,0,105,106,0,0,0,0, 0,0,0,105,106,0,0,41,42,0,0,0,0,0,0,0,0,0,0,77,78,11,12,0,0,0,0,111,112,45,46,0,0,0,105,106,0,0,0,0, diff --git a/data/map/06.map b/data/map/06.map index 3e6c101..e4dc50a 100644 --- a/data/map/06.map +++ b/data/map/06.map @@ -1,6 +1,6 @@ tileset_img=surface.png -bgColor1=234,171,159 -bgColor2=144,225,231 +bgColor1=143,86,59 +bgColor2=69,40,60 room_up=05.map room_down=0 diff --git a/data/map/06.tmx b/data/map/06.tmx index 9398fb9..615cd1d 100644 --- a/data/map/06.tmx +++ b/data/map/06.tmx @@ -14,9 +14,9 @@ 277,382,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,92,116,115,116,115,116,84,277,278, 311,382,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,126,82,81,82,81,82,81,311,483, 277,382,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,85,54,115,116,115,116,115,116,115,277,483, -311,382,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,0,0,0,0,0,54,120,86,82,81,82,81,82,81,311,312, -277,382,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,85,54,81,82,81,82,119,120,81,82,81,82,81,82,277,278, -311,382,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,54,116,115,116,115,116,115,116,115,116,115,116,115,116,311,312, +311,382,553,554,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,0,0,0,0,0,54,120,86,82,81,82,81,82,81,311,312, +277,382,105,106,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,85,54,81,82,81,82,119,120,81,82,81,82,81,82,277,278, +311,382,37,38,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,54,116,115,116,115,116,115,116,115,116,115,116,115,116,311,312, 277,449,449,450,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,85,54,81,82,81,82,81,82,81,82,17,18,81,82,81,82,483,278, 311,312,311,382,0,0,0,0,0,0,0,0,0,0,0,0,0,19,0,0,0,0,92,120,86,116,115,116,115,116,15,50,51,88,18,116,115,116,311,483, 277,278,277,449,449,450,0,0,0,0,0,0,0,0,0,0,19,0,85,54,81,82,81,119,120,82,81,82,81,82,57,0,0,51,52,82,81,82,277,278, diff --git a/source/game.cpp b/source/game.cpp index 44836ef..89bbaba 100644 --- a/source/game.cpp +++ b/source/game.cpp @@ -27,7 +27,7 @@ Game::Game(SDL_Renderer *renderer, Screen *screen, Asset *asset, Input *input) section.subsection = SUBSECTION_GAME_PLAY; musicEnabled = true; - debug = false; + debug = true; musicEnabled = !debug; } @@ -117,7 +117,7 @@ void Game::checkInput() if (input->checkInput(INPUT_BUTTON_2, REPEAT_FALSE)) { debug = !debug; - musicEnabled = !debug; + /*musicEnabled = !debug; if (musicEnabled) { JA_PlayMusic(music); @@ -125,7 +125,7 @@ void Game::checkInput() else { JA_StopMusic(); - } + }*/ } if (input->checkInput(INPUT_BUTTON_3, REPEAT_FALSE)) @@ -195,7 +195,7 @@ void Game::renderDebugInfo() text = "state " + std::to_string(player->state); debugText->write(0, line += 6, text, -1); - text = map->getRoomFileName(b_top) + " " + map->getRoomFileName(b_right) + " " + map->getRoomFileName(b_bottom) + " " + map->getRoomFileName(b_left); + text = map->getName() + " (" + map->getRoomFileName(b_top) + ", " + map->getRoomFileName(b_right) + ", " + map->getRoomFileName(b_bottom) + ", " + map->getRoomFileName(b_left) + ")"; debugText->write(0, line += 6, text, -1); text = "hookedOn = " + std::to_string(player->hookedOnMovingPlatform); diff --git a/source/map.cpp b/source/map.cpp index e11ed03..8da8c8a 100644 --- a/source/map.cpp +++ b/source/map.cpp @@ -7,7 +7,7 @@ Map::Map(std::string file, SDL_Renderer *renderer, Asset *asset, ItemTracker *it tile_size = 8; map_width = 40; map_height = 26; - tileset_width = 32; + tileset_width = 34; name = file.substr(file.find_last_of("\\/") + 1); enemy_file = ""; bgColor1 = bgColor2 = {0, 0, 0}; @@ -422,15 +422,14 @@ e_tile_map Map::getTile(SDL_Point p) // Calcula el tile const int tile = tilemap[((y / tile_size) * map_width) + (x / tile_size)]; - const int png_width = 32; // Las 8 primeras filas son tiles de fondo - if (tile >= 0 && tile < 8 * png_width) + if (tile >= 0 && tile < 8 * tileset_width) { return nothing; } // De la fila 8 a la 15 hay tiles de muro - else if (tile >= (8 * png_width) && tile < 16 * png_width) + else if (tile >= (8 * tileset_width) && tile < 16 * tileset_width) { return wall; } @@ -511,6 +510,12 @@ std::string Map::getRoomFileName(e_border border) return ""; } +// Devuelve el nombre del fichero de la habitación +std::string Map::getName() +{ + return name; +} + // Indica si hay colision con un actor a partir de un rectangulo int Map::actorCollision(SDL_Rect &rect) { diff --git a/source/map.h b/source/map.h index be41fed..f19b3e8 100644 --- a/source/map.h +++ b/source/map.h @@ -97,6 +97,9 @@ public: // Devuelve el nombre del fichero de la habitación en funcion del borde std::string getRoomFileName(e_border border); + // Devuelve el nombre del fichero de la habitación + std::string getName(); + // Indica si hay colision con un actor a partir de un rectangulo int actorCollision(SDL_Rect &rect); diff --git a/source/prog.cpp b/source/prog.cpp index 3440797..d256555 100644 --- a/source/prog.cpp +++ b/source/prog.cpp @@ -26,7 +26,7 @@ Prog::Prog(std::string executablePath) } else { - section.name = SECTION_PROG_LOGO; + section.name = SECTION_PROG_GAME; } input = new Input(asset->get("gamecontrollerdb.txt")); screen = new Screen(window, renderer, options); @@ -147,6 +147,20 @@ bool Prog::setFileList() asset->add("/data/map/03.map", data); asset->add("/data/map/03.tmx", data); asset->add("/data/map/03.ene", data); + asset->add("/data/map/04.map", data); + asset->add("/data/map/04.tmx", data); + asset->add("/data/map/05.map", data); + asset->add("/data/map/05.tmx", data); + asset->add("/data/map/06.map", data); + asset->add("/data/map/06.tmx", data); + asset->add("/data/map/07.map", data); + asset->add("/data/map/07.tmx", data); + asset->add("/data/map/08.map", data); + asset->add("/data/map/08.tmx", data); + asset->add("/data/map/09.map", data); + asset->add("/data/map/09.tmx", data); + asset->add("/data/map/10.map", data); + asset->add("/data/map/10.tmx", data); asset->add("/data/map/surface.png", bitmap); // Ficheros de configuración