Skip to content

Commit

Permalink
Add level select debug option.
Browse files Browse the repository at this point in the history
Set the environment flag LEVEL to the level you want to test.
  • Loading branch information
HexDecimal committed Mar 12, 2021
1 parent 5ce5da5 commit 262b385
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
"request": "launch",
"module": "main",
"console": "internalConsole",
"env": {
"LEVEL": "1"
}
}
]
}
6 changes: 5 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from __future__ import annotations # This may be required to resolve import order issues.

import logging
import os
import sys
import warnings

Expand All @@ -22,8 +23,11 @@ def main() -> None:
tileset = tcod.tileset.load_tilesheet("Alloy_curses_12x12.png", 16, 16, tcod.tileset.CHARMAP_CP437)
with tcod.context.new(width=SCREEN_WIDTH, height=SCREEN_HEIGHT, tileset=tileset) as g.context:
g.world = engine.world.World()
level = 1
if __debug__:
level = int(os.environ.get("LEVEL", level))

g.world.map = procgen.dungeon.generate(g.world, level=1)
g.world.map = procgen.dungeon.generate(g.world, level=level)

g.world.loop()

Expand Down

0 comments on commit 262b385

Please sign in to comment.