From 1d9e5ff27d8c646bc60ff777afae6bca32479ea7 Mon Sep 17 00:00:00 2001 From: Sergio Valor Date: Thu, 22 Sep 2022 21:39:41 +0200 Subject: [PATCH] Trabajando en el marcador --- data/map/01.map | 4 ++-- data/map/01.tmx | 38 +++++++++++++++++++------------------- source/game.cpp | 2 ++ source/map.cpp | 2 +- source/scoreboard.cpp | 11 +++++++++++ 5 files changed, 35 insertions(+), 22 deletions(-) diff --git a/data/map/01.map b/data/map/01.map index 60fb2f5..785b6b5 100644 --- a/data/map/01.map +++ b/data/map/01.map @@ -19,8 +19,8 @@ tileset=diamond.png animation=diamond.ani width=16 height=16 -x=13 -y=17 +x=14 +y=12 [/diamond] [diamond] diff --git a/data/map/01.tmx b/data/map/01.tmx index fabd412..7bd5dc3 100644 --- a/data/map/01.tmx +++ b/data/map/01.tmx @@ -23,10 +23,10 @@ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2481,2482,2483,2484,2485,2486,2487,2488,2489,2490,2491,2492,2493,2494,2495,2496,2497,2498,2499,2500,2501,2502,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2557,2558,2559,2560,2561,2562,2563,2564,2565,2566,2567,2568,2569,2570,2571,2572,2573,2574,2575,2576,2577,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,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,1359,1360,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,463,464,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,538,539,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,455,456,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,1501,1506,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,530,531,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,1357,1358,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,1432,1433,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1359,1360,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,459,460,451,452,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,463,464,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,534,535,526,527,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,538,539,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,459,460,451,452,0,465,466,0,0,0,0,0,0,0,0,0,0,455,456,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,534,535,526,527,0,540,541,0,0,0,0,0,0,0,0,0,0,530,531,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1501,1502,1503,1504,1505,1506,0,0,0,0,0,0,0,0,0,0,1357,1358,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1432,1433,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,463,464,0,0,0,0,0, -0,0,0,233,234,235,236,0,0,0,0,0,0,0,0,0,0,233,234,235,236,0,0,0,0,0,1351,1352,1353,1354,1355,1356,0,538,539,0,0,0,0,0, -0,0,0,308,309,310,311,0,0,0,0,0,0,0,0,0,0,308,309,310,311,0,0,0,0,0,0,0,461,462,0,0,0,455,456,0,0,0,0,0, -0,0,0,383,384,385,386,0,0,0,0,0,0,0,0,0,0,383,384,385,386,0,0,0,0,0,0,0,461,462,0,0,0,530,531,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,3,4,0,0,0,0,0,0,0,0,0,0,0,1432,1433,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,76,2,3,79,0,0,0,0,0,0,0,166,167,0,0,463,464,0,0,0,0,0, +0,0,0,233,234,235,236,0,0,0,0,0,0,0,0,0,0,0,5,81,82,8,0,0,0,0,1351,1352,1353,1354,1355,1356,0,538,539,0,0,0,0,0, +0,0,0,308,309,310,311,0,0,0,0,306,307,0,0,0,0,0,80,81,82,83,0,0,0,0,0,0,461,462,0,0,0,455,456,0,0,0,0,0, +0,0,0,383,384,385,386,0,0,0,0,381,382,0,0,0,0,80,81,82,81,82,83,0,241,242,243,0,461,462,0,0,0,530,531,0,0,0,0,0, 1136,1137,1136,1137,1136,1137,1136,1137,1136,1137,1136,1137,1136,1137,1136,1137,1136,1137,1136,1137,1136,1137,1136,1137,1136,1137,1136,1137,1136,1137,1136,1137,1136,1137,1136,1137,1136,1137,1136,1137, -1211,1212,1211,1212,1211,1212,1211,1212,1211,1212,1211,1212,1211,1212,1211,1212,1211,1212,1211,1212,1211,1212,1211,1212,1211,1212,1211,1212,1211,1212,1211,1212,1211,1212,1211,1212,1211,1212,1211,1212, -1286,1287,1286,1287,1286,1287,1286,1287,1286,1287,1286,1287,1286,1287,1286,1287,1286,1287,1286,1287,1286,1287,1286,1287,1286,1287,1286,1287,1286,1287,1286,1287,1286,1287,1286,1287,1286,1287,1286,1287 +1211,1212,1211,1212,1211,1212,1211,1212,1211,1203,1204,1212,1211,1212,1211,1212,1211,1212,1211,1212,1211,1212,1211,1212,1211,1212,1211,1212,1211,1212,1211,1212,1211,1212,1211,1212,1211,1212,1211,1212, +1286,1287,1286,1287,1286,1287,1286,1287,1286,1278,1279,1287,1286,1287,1286,1287,1286,1287,1286,1287,1286,1287,1286,1287,1286,1287,1286,1287,1286,1287,1286,1287,1286,1287,1286,1287,1286,1287,1286,1287 @@ -87,12 +87,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,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,5628,5628,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5628,5628,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,5627,5627,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5627,5627,5627,5627,5627,5627,0,0,0,0,0,0,0,0,0,0,5628,5628,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, diff --git a/source/game.cpp b/source/game.cpp index d8725d8..bf39d44 100644 --- a/source/game.cpp +++ b/source/game.cpp @@ -89,6 +89,8 @@ void Game::update() // Comprueba los eventos de la cola checkEventHandler(); + board.diamonds = player->diamonds; + // Actualiza los objetos debug->clear(); scoreboard->update(); diff --git a/source/map.cpp b/source/map.cpp index 23b1592..d9272fc 100644 --- a/source/map.cpp +++ b/source/map.cpp @@ -30,7 +30,7 @@ Map::Map(std::string file, SDL_Renderer *renderer, Asset *asset, ItemTracker *it if (map_layer1 == NULL) printf("Error: map_layer1 could not be created!\nSDL Error: %s\n", SDL_GetError()); - // Pinta el mapa de la habitación en la textura + // Pinta el mapa en las texturas fillMapTexture(); } diff --git a/source/scoreboard.cpp b/source/scoreboard.cpp index 3e6b8ea..3d03475 100644 --- a/source/scoreboard.cpp +++ b/source/scoreboard.cpp @@ -43,6 +43,17 @@ void ScoreBoard::fillTexture() SDL_SetRenderDrawColor(renderer, 0x00, 0x00, 0x00, 0x00); SDL_RenderClear(renderer); + // Pinta el degradado + const float num_lines = (SCOREBOARD_BOTTOM / 2) - SCOREBOARD_TOP; + + for (int i = SCOREBOARD_TOP; i < SCOREBOARD_TOP + num_lines; i++) + { + float step = ((float)i / num_lines); + int alpha = 64 + ((0 - 64) * step); + SDL_SetRenderDrawColor(renderer, 0, 0, 0, alpha); + SDL_RenderDrawLine(renderer, SCOREBOARD_LEFT, i, SCOREBOARD_RIGHT, i); + } + // Escribe los textos text->writeDX(TXT_CENTER | TXT_SHADOW, PLAY_AREA_CENTER_FIRST_QUARTER_X, 8, "-LIVES-"); text->writeDX(TXT_CENTER | TXT_SHADOW, PLAY_AREA_CENTER_FIRST_QUARTER_X, 8 + text->getCharacterSize(), std::to_string(board->lives));