Changed tile generation, decreased tile size.
This commit is contained in:
parent
84264a6934
commit
b52af711a0
5 changed files with 11 additions and 11 deletions
|
@ -1,3 +1,3 @@
|
|||
name: Floor Tile
|
||||
texture: floor.png
|
||||
size: [100, 100]
|
||||
size: [75, 75]
|
|
@ -1,3 +1,3 @@
|
|||
name: Wall Tile
|
||||
texture: wall.png
|
||||
size: [100, 100]
|
||||
size: [75, 75]
|
|
@ -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<Player>(new Player(mWorld, mTileManager,
|
||||
sf::Vector2f(0.0f, 0.0f), Yaml("player.yaml")));
|
||||
mWorld.insertCharacter(mPlayer);
|
||||
|
|
|
@ -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++) {
|
||||
|
|
|
@ -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.
|
||||
|
|
Reference in a new issue