You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.0 KiB
53 lines
1.0 KiB
package mightypork.rogue.world;
|
|
|
|
|
|
import java.util.Random;
|
|
|
|
import mightypork.rogue.world.level.Level;
|
|
import mightypork.rogue.world.tile.Tiles;
|
|
import mightypork.rogue.world.tile.models.TileModel;
|
|
|
|
|
|
public class MapGenerator {
|
|
|
|
public static final Random rand = new Random();
|
|
|
|
|
|
public static World createWorld(long seed)
|
|
{
|
|
synchronized (rand) {
|
|
rand.setSeed(seed);
|
|
|
|
final World w = new World();
|
|
w.setSeed(seed);
|
|
|
|
w.addLevel(createLevel(rand.nextLong(), Tiles.FLOOR_DARK, Tiles.WALL_BRICK));
|
|
//w.addLevel(createLevel(rand.nextLong(), Tiles.BRCOBBLE_FLOOR, Tiles.BRCOBBLE_WALL));
|
|
|
|
// TODO place on start position
|
|
w.createPlayer(10, 10, 0);
|
|
return w;
|
|
}
|
|
}
|
|
|
|
|
|
private static Level createLevel(long seed, TileModel floor, TileModel wall)
|
|
{
|
|
// TODO
|
|
|
|
final Level lm = new Level(20, 20);
|
|
lm.setSeed(seed);
|
|
|
|
lm.fill(floor);
|
|
|
|
final Random rand = new Random();
|
|
rand.setSeed(seed);
|
|
|
|
for (int i = 0; i < 150; i++) {
|
|
lm.setTile(wall, rand.nextInt(20), rand.nextInt(20));
|
|
}
|
|
|
|
return lm;
|
|
}
|
|
|
|
}
|
|
|