Played around with a circular map real quick.

master
Zed A. Shaw 1 week ago
parent 9dcc2036aa
commit c0d668fb0b
  1. 2
      assets/items.json
  2. 4
      assets/tiles.json
  3. 4
      maze.cpp
  4. 2
      maze.hpp
  5. 13
      worldbuilder.cpp

@ -38,7 +38,7 @@
"foreground": [24, 205, 210], "foreground": [24, 205, 210],
"background": [24, 205, 210] "background": [24, 205, 210]
}, },
{"_type": "LightSource", "strength": 80, "radius": 2.8}, {"_type": "LightSource", "strength": 50, "radius": 2.8},
{"_type": "Sprite", "name": "torch_pillar", "width": 256, "height": 256, "scale": 1.0}, {"_type": "Sprite", "name": "torch_pillar", "width": 256, "height": 256, "scale": 1.0},
{"_type": "Sound", "attack": "pickup", "death": "blank"} {"_type": "Sound", "attack": "pickup", "death": "blank"}
] ]

@ -11,14 +11,14 @@
"foreground": [230, 20, 30], "foreground": [230, 20, 30],
"background": [230, 20, 120], "background": [230, 20, 120],
"collision": true, "collision": true,
"display": 37 "display": 9608
}, },
"WALL_PLAIN": { "WALL_PLAIN": {
"texture": "assets/wall_texture_test-256.png", "texture": "assets/wall_texture_test-256.png",
"foreground": [230, 20, 30], "foreground": [230, 20, 30],
"background": [230, 20, 120], "background": [230, 20, 120],
"collision": true, "collision": true,
"display": 9608 "display": 37
}, },
"WALL_VINES": { "WALL_VINES": {
"texture": "assets/wall_with_vines-256.png", "texture": "assets/wall_with_vines-256.png",

@ -116,15 +116,13 @@ namespace maze {
} }
} }
void Builder::hunt_and_kill() { void Builder::hunt_and_kill(Point on) {
for(auto& room : $rooms) { for(auto& room : $rooms) {
for(matrix::box it{$walls, room.x, room.y, room.width}; it.next();) { for(matrix::box it{$walls, room.x, room.y, room.width}; it.next();) {
$walls[it.y][it.x] = 0; $walls[it.y][it.x] = 0;
} }
} }
Point on{1,1};
while(!complete($walls)) { while(!complete($walls)) {
auto n = neighbors($walls, on); auto n = neighbors($walls, on);
if(n.size() == 0) { if(n.size() == 0) {

@ -16,7 +16,7 @@ namespace maze {
init(); init();
} }
void hunt_and_kill(); void hunt_and_kill(Point on={1,1});
void init(); void init();
void randomize_rooms(); void randomize_rooms();

@ -10,10 +10,23 @@
using namespace fmt; using namespace fmt;
using namespace components; using namespace components;
void big_donut() {
// maze.inner_donut(12, 3);
// $map.invert_space();
// maze.hunt_and_kill({11,11});
// maze.init();
// maze.inner_donut(12, 3);
// $map.invert_space();
// maze.hunt_and_kill({11,11});
}
void WorldBuilder::generate_map() { void WorldBuilder::generate_map() {
maze::Builder maze($map); maze::Builder maze($map);
maze.hunt_and_kill(); maze.hunt_and_kill();
maze.init();
maze.randomize_rooms(); maze.randomize_rooms();
if($map.width() > 20) { if($map.width() > 20) {

Loading…
Cancel
Save