Played around with a circular map real quick.
This commit is contained in:
parent
9dcc2036aa
commit
c0d668fb0b
5 changed files with 18 additions and 7 deletions
|
@ -38,7 +38,7 @@
|
|||
"foreground": [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": "Sound", "attack": "pickup", "death": "blank"}
|
||||
]
|
||||
|
|
|
@ -11,14 +11,14 @@
|
|||
"foreground": [230, 20, 30],
|
||||
"background": [230, 20, 120],
|
||||
"collision": true,
|
||||
"display": 37
|
||||
"display": 9608
|
||||
},
|
||||
"WALL_PLAIN": {
|
||||
"texture": "assets/wall_texture_test-256.png",
|
||||
"foreground": [230, 20, 30],
|
||||
"background": [230, 20, 120],
|
||||
"collision": true,
|
||||
"display": 9608
|
||||
"display": 37
|
||||
},
|
||||
"WALL_VINES": {
|
||||
"texture": "assets/wall_with_vines-256.png",
|
||||
|
|
4
maze.cpp
4
maze.cpp
|
@ -116,15 +116,13 @@ namespace maze {
|
|||
}
|
||||
}
|
||||
|
||||
void Builder::hunt_and_kill() {
|
||||
void Builder::hunt_and_kill(Point on) {
|
||||
for(auto& room : $rooms) {
|
||||
for(matrix::box it{$walls, room.x, room.y, room.width}; it.next();) {
|
||||
$walls[it.y][it.x] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
Point on{1,1};
|
||||
|
||||
while(!complete($walls)) {
|
||||
auto n = neighbors($walls, on);
|
||||
if(n.size() == 0) {
|
||||
|
|
2
maze.hpp
2
maze.hpp
|
@ -16,7 +16,7 @@ namespace maze {
|
|||
init();
|
||||
}
|
||||
|
||||
void hunt_and_kill();
|
||||
void hunt_and_kill(Point on={1,1});
|
||||
|
||||
void init();
|
||||
void randomize_rooms();
|
||||
|
|
|
@ -10,10 +10,23 @@
|
|||
using namespace fmt;
|
||||
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() {
|
||||
maze::Builder maze($map);
|
||||
|
||||
maze.hunt_and_kill();
|
||||
maze.init();
|
||||
|
||||
maze.randomize_rooms();
|
||||
|
||||
if($map.width() > 20) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue