Changed tile generation, decreased tile size.

This commit is contained in:
Felix Ableitner 2013-04-27 19:42:44 +02:00
parent 84264a6934
commit b52af711a0
5 changed files with 11 additions and 11 deletions

View file

@ -1,3 +1,3 @@
name: Floor Tile name: Floor Tile
texture: floor.png texture: floor.png
size: [100, 100] size: [75, 75]

View file

@ -1,3 +1,3 @@
name: Wall Tile name: Wall Tile
texture: wall.png texture: wall.png
size: [100, 100] size: [75, 75]

View file

@ -28,7 +28,7 @@ Game::Game(sf::RenderWindow& window) :
Generator generator; Generator generator;
generator.generateTiles(mTileManager, mWorld, generator.generateTiles(mTileManager, mWorld,
sf::IntRect(-16, -16, 32, 32)); sf::IntRect(-32, -32, 64, 64));
mPlayer = std::shared_ptr<Player>(new Player(mWorld, mTileManager, mPlayer = std::shared_ptr<Player>(new Player(mWorld, mTileManager,
sf::Vector2f(0.0f, 0.0f), Yaml("player.yaml"))); sf::Vector2f(0.0f, 0.0f), Yaml("player.yaml")));
mWorld.insertCharacter(mPlayer); mWorld.insertCharacter(mPlayer);

View file

@ -54,15 +54,15 @@ Generator::generateTiles(TileManager& tm, World& world,
for (int x = area.left; x < area.left + area.width; x++) { for (int x = area.left; x < area.left + area.width; x++) {
for (int y = area.top; y < area.top + area.height; y++) { for (int y = area.top; y < area.top + area.height; y++) {
noise[x-area.left][y-area.top] = 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(2, 2, 0.05f, 0.5f, -0.5f, x, y) + scaled_octave_noise_2d(2, 2, 0.5f, 0.15f, -0.15f, x, y)
scaled_octave_noise_2d(3, 3, 0.01f, -1, 1, x, y)) < 0.05f; < -0.1f;
} }
} }
for (int x = 0; x < (int) noise.size(); x+=5) { for (int x = 0; x < (int) noise.size(); x++) {
for (int y = 0; y < (int) noise[x].size(); y+=5) { for (int y = 0; y < (int) noise[x].size(); y++) {
filterWalls(noise, filtered, x, y, 10, 5, 0); filterWalls(noise, filtered, x, y, 2, 1, 0);
filterWalls(noise, filtered, x, y, 30, 5, 10); filterWalls(noise, filtered, x, y, 6, 1, 2);
filterWalls(noise, filtered, x, y, 50, 5, 20); filterWalls(noise, filtered, x, y, 10, 1, 4);
} }
} }
for (int x = area.left; x < area.left + area.width; x++) { for (int x = area.left; x < area.left + area.width; x++) {

View file

@ -14,7 +14,7 @@
#include "../util/Yaml.h" #include "../util/Yaml.h"
#include "../World.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. * Loads tile resources.