diff --git a/data/room/01.room b/data/room/01.room index cee5924..d1eb5c1 100644 --- a/data/room/01.room +++ b/data/room/01.room @@ -1,6 +1,6 @@ name=void main bgColor=black -border=red +border=yellow tileset=standard.png roomUp=0 roomDown=0 @@ -23,8 +23,8 @@ vy=0.3 x1=1 y1=0 x2=1 -y2=6 -color=red +y2=5 +color=magenta [/enemy] [enemy] @@ -40,7 +40,7 @@ x1=5 y1=9 x2=22 y2=9 -color=yellow +color=white [/enemy] [item] @@ -48,7 +48,7 @@ tileset=items.png tile=1 x=1 y=7 -counter=6 +counter=1 [/item] [item] @@ -56,47 +56,5 @@ tileset=items.png tile=1 x=17 y=8 -counter=7 -[/item] - - - -[item] -tileset=items.png -tile=1 -x=12 -y=12 -counter=1 -[/item] - -[item] -tileset=items.png -tile=1 -x=13 -y=12 counter=2 [/item] - -[item] -tileset=items.png -tile=1 -x=14 -y=12 -counter=3 -[/item] - -[item] -tileset=items.png -tile=1 -x=15 -y=12 -counter=4 -[/item] - -[item] -tileset=items.png -tile=1 -x=16 -y=12 -counter=5 -[/item] \ No newline at end of file diff --git a/data/room/02.room b/data/room/02.room index c878c4a..af5a6de 100644 --- a/data/room/02.room +++ b/data/room/02.room @@ -1,6 +1,6 @@ name=case switch bgColor=black -border=green +border=cyan tileset=standard.png roomUp=0 roomDown=04.room @@ -24,12 +24,12 @@ x1=14 y1=0 x2=14 y2=12 -color=magenta +color=cyan [/enemy] [item] tileset=items.png -tile=1 +tile=7 x=19 -y=6 +y=5 [/item] \ No newline at end of file diff --git a/data/room/04.room b/data/room/04.room index 94391c7..62f1275 100644 --- a/data/room/04.room +++ b/data/room/04.room @@ -4,7 +4,7 @@ border=blue tileset=standard.png roomUp=02.room roomDown=0 -roomLeft=0 +roomLeft=07.room roomRight=05.room [tilemap] diff --git a/data/room/04.tmx b/data/room/04.tmx index f210a4e..0d6cf7e 100644 --- a/data/room/04.tmx +++ b/data/room/04.tmx @@ -1,5 +1,5 @@ - + @@ -16,8 +16,8 @@ 25,0,0,0,0,229,229,229,229,229,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,25, 25,0,0,0,0,0,0,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,249,249,249,249,249,249,249,249,249,249,249,249,249,249,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,25, -22,0,0,0,0,0,289,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -22,0,0,0,0,0,289,0,0,0,0,0,0,0,0,0,0,0,381,0,0,0,0,0,0,381,0,0,0,0,0,0, +0,0,0,0,0,0,289,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,289,0,0,0,0,0,0,0,0,0,0,0,381,0,0,0,0,0,0,381,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 diff --git a/data/room/07.room b/data/room/07.room new file mode 100644 index 0000000..8804297 --- /dev/null +++ b/data/room/07.room @@ -0,0 +1,92 @@ +name=chirping +bgColor=black +border=magenta +tileset=standard.png +roomUp=0 +roomDown=0 +roomLeft=08.room +roomRight=04.room + +[tilemap] +07.tmx +[/tilemap] + +[enemy] +tileset=paco.png +animation=paco.ani +width=16 +height=16 +x=4 +y=2 +vx=0 +vy=0.5 +x1=4 +y1=2 +x2=4 +y2=12 +color=yellow +[/enemy] + +[enemy] +tileset=paco.png +animation=paco.ani +width=16 +height=16 +x=9 +y=11 +vx=0 +vy=-0.5 +x1=9 +y1=2 +x2=9 +y2=12 +color=green +[/enemy] + +[enemy] +tileset=paco.png +animation=paco.ani +width=16 +height=16 +x=26 +y=5 +vx=0 +vy=-0.5 +x1=26 +y1=2 +x2=26 +y2=12 +color=white +[/enemy] + +[item] +tileset=items.png +tile=10 +x=2 +y=8 +counter=1 +[/item] + +[item] +tileset=items.png +tile=10 +x=2 +y=3 +counter=2 +[/item] + +[item] +tileset=items.png +tile=10 +x=29 +y=8 +counter=3 +[/item] + +[item] +tileset=items.png +tile=10 +x=29 +y=3 +counter=4 +[/item] \ No newline at end of file diff --git a/data/room/07.tmx b/data/room/07.tmx new file mode 100644 index 0000000..c22ecac --- /dev/null +++ b/data/room/07.tmx @@ -0,0 +1,24 @@ + + + + + +73,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,73, +73,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,73, +73,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,73, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,73, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,73, +73,345,345,345,0,0,345,345,345,0,0,345,345,345,345,345,345,345,345,345,345,0,0,162,345,345,0,0,345,345,345,73, +73,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,162,0,0,0,0,0,0,0,0,73, +73,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,162,0,0,0,0,0,0,0,0,0,73, +73,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,162,0,0,0,0,0,0,0,0,0,0,73, +73,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,162,0,0,0,0,0,0,0,0,0,0,0,73, +73,345,345,345,0,0,345,345,345,0,0,345,345,345,182,0,0,345,345,345,345,345,345,345,345,345,0,0,345,345,345,73, +73,0,0,0,0,0,0,0,0,0,0,0,0,0,0,182,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,73, +73,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,182,0,0,0,0,0,0,0,0,0,0,0,0,0,0,73, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,182,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,182,0,0,0,0,0,0,0,0,0,0,0,0,0, +73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73 + + + diff --git a/data/room/08.room b/data/room/08.room new file mode 100644 index 0000000..f6cb108 --- /dev/null +++ b/data/room/08.room @@ -0,0 +1,12 @@ +name=still thinking +bgColor=black +border=blue +tileset=standard.png +roomUp=0 +roomDown=09.room +roomLeft=10.room +roomRight=07.room + +[tilemap] +08.tmx +[/tilemap] \ No newline at end of file diff --git a/data/room/08.tmx b/data/room/08.tmx new file mode 100644 index 0000000..53e9c15 --- /dev/null +++ b/data/room/08.tmx @@ -0,0 +1,24 @@ + + + + + +33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33, +33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33, +33,33,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,33,33, +33,33,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +33,33,341,341,341,0,0,341,341,341,341,341,0,0,341,341,341,341,341,341,341,341,341,341,341,341,0,0,0,0,0,0, +33,33,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,162,33,33,33,33,33, +33,33,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,162,0,0,0,0,33,33, +33,33,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,162,0,0,0,0,0,33,33, +33,33,341,341,341,0,0,341,341,341,341,341,0,0,341,341,341,341,341,341,341,341,341,162,0,0,0,0,0,0,33,33, +33,33,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,162,0,0,0,0,0,0,0,33,33, +33,33,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,162,0,0,0,0,0,0,0,0,33,33, +33,33,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,162,0,0,0,0,0,0,0,0,0,33,33, +33,33,351,351,351,0,0,351,351,351,351,351,0,0,351,351,351,351,351,351,0,0,0,0,0,0,0,0,0,0,33,33, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +351,351,351,351,351,351,351,351,351,351,351,351,351,351,351,351,351,351,0,0,351,351,351,351,351,351,351,351,351,351,351,351 + + + diff --git a/data/room/09.room b/data/room/09.room new file mode 100644 index 0000000..46194eb --- /dev/null +++ b/data/room/09.room @@ -0,0 +1,12 @@ +name=slope test +bgColor=blue +border=blue +tileset=standard.png +roomUp=08.room +roomDown=0 +roomLeft=0 +roomRight=0 + +[tilemap] +09.tmx +[/tilemap] \ No newline at end of file diff --git a/data/room/09.tmx b/data/room/09.tmx new file mode 100644 index 0000000..0e80816 --- /dev/null +++ b/data/room/09.tmx @@ -0,0 +1,24 @@ + + + + + +54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,0,0,0,163,54,54,54,54,54,54,54,54,54,54,54,54, +54,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,163,0,0,0,0,0,0,0,0,0,0,0,0,54, +54,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,163,0,0,0,0,0,0,0,0,0,0,0,0,0,54, +54,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,163,0,0,0,0,0,0,0,0,0,0,0,0,0,0,54, +54,0,0,0,0,0,0,0,0,0,0,0,0,0,0,163,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,54, +54,0,0,0,0,0,0,0,0,0,0,0,0,0,163,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,54, +54,0,0,0,0,0,0,0,0,0,0,0,0,163,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,54, +54,0,0,0,0,0,0,0,0,0,0,0,163,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,54, +54,0,0,0,0,0,0,0,0,0,0,163,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,54, +54,0,0,0,0,0,0,0,0,0,163,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,54, +54,0,0,0,0,0,0,0,0,163,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,54, +54,0,0,0,0,0,0,0,163,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,54, +54,0,0,0,0,0,0,163,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,54, +54,0,0,0,0,0,163,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,54, +54,0,0,0,0,163,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,54, +54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54 + + + diff --git a/data/room/10.room b/data/room/10.room new file mode 100644 index 0000000..7bb46bb --- /dev/null +++ b/data/room/10.room @@ -0,0 +1,12 @@ +name=welcome to the jail +bgColor=black +border=bright_magenta +tileset=standard.png +roomUp=0 +roomDown=0 +roomLeft=0 +roomRight=08.room + +[tilemap] +10.tmx +[/tilemap] \ No newline at end of file diff --git a/data/room/10.tmx b/data/room/10.tmx new file mode 100644 index 0000000..f60dfa8 --- /dev/null +++ b/data/room/10.tmx @@ -0,0 +1,24 @@ + + + + + +94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94, +94,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,94,0,0,0,0,0,0,0,0,0,0,0,0,0,0,94, +94,0,0,127,127,0,127,127,127,0,127,0,127,0,0,0,94,0,0,0,0,0,0,0,0,0,0,0,0,0,0,94, +94,0,0,0,127,0,127,0,127,0,127,0,127,0,0,0,94,0,0,0,0,0,0,0,0,0,0,0,0,0,0,94, +94,0,127,0,127,0,127,127,127,0,127,0,127,0,0,0,94,0,0,0,0,0,0,0,0,0,0,0,0,0,0,94, +94,0,127,127,127,0,127,0,127,0,127,0,127,127,127,0,94,0,0,0,0,0,0,0,0,0,0,0,0,0,0,94, +94,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,94,0,0,0,0,0,0,0,0,0,0,0,0,0,0,94, +94,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,94,0,0,0,0,0,0,0,0,0,0,0,0,0,0,94, +94,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,94,0,0,0,0,0,0,0,0,0,0,0,0,0,0,94, +94,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,94,0,0,0,0,0,0,0,0,0,0,0,0,0,0,94, +94,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,94,0,0,0,0,0,0,0,0,0,0,0,0,0,0,94, +94,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,94,0,0,0,0,0,0,0,0,0,0,0,0,0,0,94, +94,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,94,0,0,0,0,0,0,0,0,0,0,0,0,0,0,94, +94,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,27,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +94,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,27,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94 + + + diff --git a/media/tilesets/standard.png b/media/tilesets/standard.png index d014b34..316e2fa 100644 Binary files a/media/tilesets/standard.png and b/media/tilesets/standard.png differ diff --git a/source/director.cpp b/source/director.cpp index b0a1a09..7a63d40 100644 --- a/source/director.cpp +++ b/source/director.cpp @@ -356,12 +356,20 @@ bool Director::setFileList() asset->add("/data/room/04.room", room); asset->add("/data/room/05.room", room); asset->add("/data/room/06.room", room); + asset->add("/data/room/07.room", room); + asset->add("/data/room/08.room", room); + asset->add("/data/room/09.room", room); + asset->add("/data/room/10.room", room); asset->add("/data/room/01.tmx", room); asset->add("/data/room/02.tmx", room); asset->add("/data/room/03.tmx", room); asset->add("/data/room/04.tmx", room); asset->add("/data/room/05.tmx", room); asset->add("/data/room/06.tmx", room); + asset->add("/data/room/07.tmx", room); + asset->add("/data/room/08.tmx", room); + asset->add("/data/room/09.tmx", room); + asset->add("/data/room/10.tmx", room); asset->add("/media/tilesets/standard.png", bitmap); diff --git a/source/game.cpp b/source/game.cpp index 3db4ed1..3866f1e 100644 --- a/source/game.cpp +++ b/source/game.cpp @@ -102,6 +102,11 @@ void Game::checkEventHandler() board.music ? JA_ResumeMusic() : JA_PauseMusic(); break; + case SDL_SCANCODE_B: + screen->switchBorder(); + reLoadTextures(); + break; + case SDL_SCANCODE_F: screen->switchVideoMode(); reLoadTextures(); diff --git a/source/item.cpp b/source/item.cpp index 9f9b72b..9026605 100644 --- a/source/item.cpp +++ b/source/item.cpp @@ -14,7 +14,7 @@ Item::Item(item_t item) sprite = new Sprite(item.x, item.y, 8, 8, texture, renderer); // Inicia variables - sprite->setSpriteClip(item.tile * 8, 0, 8, 8); + sprite->setSpriteClip((item.tile % 10) * 8, (item.tile / 10) * 8, 8, 8); collider = sprite->getRect(); colorChangeSpeed = 4; counter = item.counter * colorChangeSpeed; diff --git a/source/room.cpp b/source/room.cpp index b19f6c3..7a77d2a 100644 --- a/source/room.cpp +++ b/source/room.cpp @@ -612,8 +612,8 @@ tile_e Room::getTile(SDL_Point point) return t_slope_l; } - // Las filas 10-14 son de tiles t_passable - if ((tilemap[pos] >= 10 * tilesetWidth) && (tilemap[pos] < 15 * tilesetWidth)) + // Las filas 10-18 son de tiles t_passable + if ((tilemap[pos] >= 10 * tilesetWidth) && (tilemap[pos] < 19 * tilesetWidth)) { return t_passable; } @@ -648,8 +648,8 @@ tile_e Room::getTile(int index) return t_slope_l; } - // Las filas 10-14 son de tiles t_passable - if ((tilemap[index] >= 10 * tilesetWidth) && (tilemap[index] < 15 * tilesetWidth)) + // Las filas 10-18 son de tiles t_passable + if ((tilemap[index] >= 10 * tilesetWidth) && (tilemap[index] < 19 * tilesetWidth)) { return t_passable; } diff --git a/source/screen.cpp b/source/screen.cpp index ee0c164..69ea685 100644 --- a/source/screen.cpp +++ b/source/screen.cpp @@ -15,8 +15,6 @@ Screen::Screen(SDL_Window *window, SDL_Renderer *renderer, options_t *options, i // Define el color del borde para el modo de pantalla completa borderColor = {0x00, 0x00, 0x00}; - borderEnabled = options->borderEnabled; - borderSize = options->borderSize; // Crea la textura donde se dibujan los graficos del juego gameCanvas = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, gameCanvasWidth, gameCanvasHeight); @@ -80,10 +78,10 @@ void Screen::setVideoMode(int fullScreenMode) // Si está activo el modo ventana quita el borde if (fullScreenMode == 0) { - if (borderEnabled) + if (options->borderEnabled) { - const int incWidth = gameCanvasWidth * borderSize; - const int incHeight = gameCanvasHeight * borderSize; + const int incWidth = gameCanvasWidth * options->borderSize; + const int incHeight = gameCanvasHeight * options->borderSize; screenWidth = gameCanvasWidth + incWidth; screenHeight = gameCanvasHeight + incHeight; dest = {0 + (incWidth / 2), 0 + (incHeight / 2), gameCanvasWidth, gameCanvasHeight}; @@ -192,18 +190,18 @@ void Screen::setBlendMode(SDL_BlendMode blendMode) // Establece el tamaño del borde void Screen::setBorderSize(float s) { - borderSize = s; + options->borderSize = s; } // Establece si se ha de ver el borde en el modo ventana void Screen::setBorderEnabled(bool value) { - borderEnabled = value; + options->borderEnabled = value; } // Cambia entre borde visible y no visible void Screen::switchBorder() { - borderEnabled = !borderEnabled; + options->borderEnabled = !options->borderEnabled; setVideoMode(0); } \ No newline at end of file diff --git a/source/screen.h b/source/screen.h index aa013ee..6c0f7ab 100644 --- a/source/screen.h +++ b/source/screen.h @@ -32,8 +32,6 @@ private: anchor_t anchor; // Variable con los anclajes de la pantalla SDL_Rect dest; // Coordenadas donde se va a dibujar la textura del juego sobre la pantalla o ventana color_t borderColor; // Color del borde añadido a la textura de juego para rellenar la pantalla - bool borderEnabled; // Indica si ha de mostrar el borde en el modo de ventana - float borderSize; // Porcentaje de borde que se añade a lo ventana public: // Constructor