From eb00714bd3eff85817bc7fe7169d45a9d7bc603d Mon Sep 17 00:00:00 2001 From: El Saico Date: Fri, 18 Dec 2009 00:41:43 -0200 Subject: [PATCH] F9 = recarrega mapa sem respawn; adicionada Yoshi's Island 3 :P --- config.lua | 2 +- controle.cpp | 5 ++- game.cpp | 5 +-- game.h | 2 +- mario.lua | 108 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 117 insertions(+), 5 deletions(-) create mode 100644 mario.lua diff --git a/config.lua b/config.lua index 36f9aba..888db07 100755 --- a/config.lua +++ b/config.lua @@ -5,5 +5,5 @@ config { speed = {0, 0} }, - maps = {"map1.lua", "map2.lua"} + maps = {"map1.lua", "map2.lua", "mario.lua"} } diff --git a/controle.cpp b/controle.cpp index 9c0a22e..da53cae 100644 --- a/controle.cpp +++ b/controle.cpp @@ -40,11 +40,14 @@ void Controle::handleEvents() { game->previousMap(); break; case SDLK_F7: - game->reloadMap(); + game->reloadMap(true); break; case SDLK_F8: game->nextMap(); break; + case SDLK_F9: + game->reloadMap(false); + break; default: handleEvent(e); break; } break; diff --git a/game.cpp b/game.cpp index 22a6df6..5c1a591 100755 --- a/game.cpp +++ b/game.cpp @@ -173,11 +173,12 @@ void Game::previousMap() { player->setPosition(spawn.x, spawn.y); } -void Game::reloadMap() { +void Game::reloadMap(bool respawn) { enemyManager->loadEnemies(); shotManager->clearShots(); loadMap(config->currentMap()); - player->setPosition(spawn.x, spawn.y); + if (respawn) + player->setPosition(spawn.x, spawn.y); } void Game::nextMap() { diff --git a/game.h b/game.h index 82393dc..927d3cc 100755 --- a/game.h +++ b/game.h @@ -41,7 +41,7 @@ class Game { WeaponItem* dropWeapon(std::string name); void spawnEnemy(std::string name, Ponto position); void previousMap(); - void reloadMap(); + void reloadMap(bool respawn); void nextMap(); }; diff --git a/mario.lua b/mario.lua new file mode 100644 index 0000000..8804f40 --- /dev/null +++ b/mario.lua @@ -0,0 +1,108 @@ +local x = 10000 +local y = 1000 + +map { + spawn = {150, y-250}, + width = x, + height = y, + platforms = { + platform{0, y, 0, y-250, color = {0.5, 0.5, 0}}, + platform{0, y-250, 650, y-250, color = {0.5, 0.5, 0}}, + platform{650, y, 650, y-250, color = {0.5, 0.5, 0}}, + + platform{150, y-350, 350, y-350, color = {0.5, 0.5, 0}}, + + platform{100, y-450, 250, y-450, color = {0.5, 0.5, 0}}, + + platform{150, y-550, 300, y-550, color = {0.5, 0.5, 0}}, + + platform{250, y-650, 450, y-650, color = {0.5, 0.5, 0}}, + + platform{600, y-600, 750, y-600, color = {0.5, 0.5, 0}}, + + -- primeiro "balanço" + platform{900, y-550, 1050, y-550, color = {0.5, 0.25, 0}}, + + platform{1200, y, 1200, y-449, color = {0.5, 0.5, 0}}, + platform{1200, y-450, 1500, y-450, color = {0.5, 0.5, 0}}, + platform{1500, y, 1500, y-449, color = {0.5, 0.5, 0}}, + + platform{1550, y-550, 1700, y-550, color = {1, 1, 0}}, + + platform{1750, y-650, 1900, y-650, color = {1, 1, 0}}, + + platform{1900, y, 1900, y-249, color = {0.5, 0.5, 0}}, + platform{1900, y-250, 2250, y-250, color = {0.5, 0.5, 0}}, + platform{2250, y, 2250, y-249, color = {0.5, 0.5, 0}}, + + platform{2000, y-650, 2150, y-650, color = {0.5, 0.5, 0}}, + + platform{2300, y-600, 2450, y-600, color = {0.5, 0.25, 0}}, + + platform{2600, y, 2600, y-549, color = {0.5, 0.5, 0}}, + platform{2600, y-550, 2750, y-550, color = {0.5, 0.5, 0}}, + platform{2750, y, 2750, y-549, color = {0.5, 0.5, 0}}, + + platform{2900, y-550, 3050, y-550, color = {0.5, 0.5, 0.5}}, + + platform{3100, y-550, 3250, y-550, color = {0.5, 0.5, 0.5}}, + + platform{3300, y-650, 3600, y-650, color = {0.5, 0.5, 0}}, + + platform{3750, y-550, 3900, y-550, color = {0.5, 0.25, 0}}, + + platform{4050, y-450, 4200, y-450, color = {0.5, 0.25, 0}}, + + platform{4200, y, 4200, y-349, color = {0.5, 0.5, 0}}, + platform{4200, y-350, 4500, y-350, color = {0.5, 0.5, 0}}, + platform{4500, y-250, 4500, y-349, color = {0.5, 0.5, 0}}, + platform{4500, y-250, 5500, y-250, color = {0.5, 0.5, 0}}, + platform{5500, y-250, 5500, y-449, color = {0.5, 0.5, 0}}, + platform{5500, y-450, 5650, y-450, color = {0.5, 0.5, 0}}, + platform{5650, y, 5650, y-449, color = {0.5, 0.5, 0}}, + + platform{5300, y-350, 5450, y-350, color = {1, 1, 0}}, + + platform{5700, y-550, 5850, y-550, color = {0.5, 0.5, 0.5}}, + + platform{5900, y-650, 6050, y-650, color = {0.5, 0.5, 0}}, + + platform{6200, y-550, 6350, y-550, color = {0.5, 0.25, 0}}, + + platform{6500, y-350, 6650, y-350, color = {1, 1, 0}}, + + platform{6650, y-450, 6950, y-450, color = {1, 1, 0}}, + + platform{6950, y-550, 7250, y-550, color = {1, 1, 0}}, + + platform{7250, y-650, 7350, y-650, color = {1, 1, 0}}, + + platform{7350, y, 7350, y-750, color = {0.5, 0.5, 0}}, + platform{7350, y-750, 7500, y-750, color = {0.5, 0.5, 0}}, + platform{7500, y, 7500, y-750, color = {0.5, 0.5, 0}}, + + platform{7650, y-650, 7800, y-650, color = {0.5, 0.5, 0.5}}, + + platform{7900, y-600, 8050, y-600, color = {0.5, 0.25, 0}}, + + platform{8150, y-650, 8300, y-650, color = {0.5, 0.5, 0}}, + + platform{8450, y-600, 8600, y-600, color = {0.5, 0.25, 0}}, + + platform{8750, y-550, 8900, y-550, color = {0.5, 0.25, 0}}, + + platform{9000, y, 9000, y-500, color = {0.5, 0.5, 0}}, + platform{9000, y-500, 9200, y-500, color = {0.5, 0.5, 0}}, + platform{9200, y-400, 9200, y-499, color = {0.5, 0.5, 0}}, + platform{9200, y-400, 9400, y-400, color = {0.5, 0.5, 0}}, + platform{9400, y-300, 9400, y-399, color = {0.5, 0.5, 0}}, + platform{9400, y-300, 9999, y-300, color = {0.5, 0.5, 0}}, + platform{9999, y, 9999, y-300, color = {0.5, 0.5, 0}}, + }, + weapons = { + {name = "Flamethrower", spawn = {x/3, y-5000}}, + }, + enemies = { + + }, +} -- 2.11.4.GIT