From b52af711a099f146e466137224182f7763cd34bd Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Sat, 27 Apr 2013 19:42:44 +0200 Subject: [PATCH] Changed tile generation, decreased tile size. --- resources/yaml/tile_floor.yaml | 2 +- resources/yaml/tile_wall.yaml | 2 +- source/Game.cpp | 2 +- source/generator/Generator.cpp | 14 +++++++------- source/sprites/TileManager.cpp | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/resources/yaml/tile_floor.yaml b/resources/yaml/tile_floor.yaml index 8507d5c..6d1c62c 100644 --- a/resources/yaml/tile_floor.yaml +++ b/resources/yaml/tile_floor.yaml @@ -1,3 +1,3 @@ name: Floor Tile texture: floor.png -size: [100, 100] \ No newline at end of file +size: [75, 75] \ No newline at end of file diff --git a/resources/yaml/tile_wall.yaml b/resources/yaml/tile_wall.yaml index f35bc73..c68c5c6 100644 --- a/resources/yaml/tile_wall.yaml +++ b/resources/yaml/tile_wall.yaml @@ -1,3 +1,3 @@ name: Wall Tile texture: wall.png -size: [100, 100] \ No newline at end of file +size: [75, 75] \ No newline at end of file diff --git a/source/Game.cpp b/source/Game.cpp index 7967046..5e9663e 100644 --- a/source/Game.cpp +++ b/source/Game.cpp @@ -28,7 +28,7 @@ Game::Game(sf::RenderWindow& window) : Generator generator; generator.generateTiles(mTileManager, mWorld, - sf::IntRect(-16, -16, 32, 32)); + sf::IntRect(-32, -32, 64, 64)); mPlayer = std::shared_ptr(new Player(mWorld, mTileManager, sf::Vector2f(0.0f, 0.0f), Yaml("player.yaml"))); mWorld.insertCharacter(mPlayer); diff --git a/source/generator/Generator.cpp b/source/generator/Generator.cpp index 03e82e3..bb58a98 100644 --- a/source/generator/Generator.cpp +++ b/source/generator/Generator.cpp @@ -54,15 +54,15 @@ Generator::generateTiles(TileManager& tm, World& world, for (int x = area.left; x < area.left + area.width; x++) { for (int y = area.top; y < area.top + area.height; y++) { noise[x-area.left][y-area.top] = - (scaled_octave_noise_2d(2, 2, 0.0015f, 0.5f, -0.5f, x, y) + - scaled_octave_noise_2d(3, 3, 0.01f, -1, 1, x, y)) < 0.05f; + scaled_octave_noise_2d(2, 2, 0.05f, 0.5f, -0.5f, x, y) + scaled_octave_noise_2d(2, 2, 0.5f, 0.15f, -0.15f, x, y) + < -0.1f; } } - for (int x = 0; x < (int) noise.size(); x+=5) { - for (int y = 0; y < (int) noise[x].size(); y+=5) { - filterWalls(noise, filtered, x, y, 10, 5, 0); - filterWalls(noise, filtered, x, y, 30, 5, 10); - filterWalls(noise, filtered, x, y, 50, 5, 20); + for (int x = 0; x < (int) noise.size(); x++) { + for (int y = 0; y < (int) noise[x].size(); y++) { + filterWalls(noise, filtered, x, y, 2, 1, 0); + filterWalls(noise, filtered, x, y, 6, 1, 2); + filterWalls(noise, filtered, x, y, 10, 1, 4); } } for (int x = area.left; x < area.left + area.width; x++) { diff --git a/source/sprites/TileManager.cpp b/source/sprites/TileManager.cpp index 67b25e9..ab7169f 100644 --- a/source/sprites/TileManager.cpp +++ b/source/sprites/TileManager.cpp @@ -14,7 +14,7 @@ #include "../util/Yaml.h" #include "../World.h" -const sf::Vector2i TileManager::TILE_SIZE = sf::Vector2i(100, 100); +const sf::Vector2i TileManager::TILE_SIZE = sf::Vector2i(75, 75); /** * Loads tile resources.