diff --git a/critters.py b/critters.py new file mode 100644 index 0000000..3260dab --- /dev/null +++ b/critters.py @@ -0,0 +1,12 @@ +class Player(object): + cur_pos_x, cur_pos_y = 0, 0 + char = '@' + color = [255, 255, 255] + +class Critter(Player): + def __init__(self, char, color, x=0, y=0): + self.char = char + self.color = color + self.cur_pos_x = x + self.cur_pos_y = y + \ No newline at end of file diff --git a/main.py b/main.py index 7ded757..9779f05 100644 --- a/main.py +++ b/main.py @@ -1,3 +1,4 @@ +from critters import * from dungeon_generators import * from gui import LibtcodGui from game_input import * @@ -8,27 +9,9 @@ FOV_LIGHT_WALLS = True TORCH_RADIUS = 10 -class Player(object): - cur_pos_x, cur_pos_y = 0, 0 - char = '@' - color = [255, 255, 255] - -class Critter(Player): - def __init__(self, char, color, x=0, y=0): - self.char = char - self.color = color - self.cur_pos_x = x - self.cur_pos_y = y - -class Tile: - def __init__(self, blocked, block_sight=None): - self.blocked = blocked - - if block_sight is None: block_sight = blocked - self.block_sight = block_sight - critters = [] + recompute_fov = True def can_pass(x, y): global recompute_fov @@ -48,45 +31,24 @@ def main_loop(): gui = LibtcodGui() player = Player() -testCritter = Critter('D', [255, 255, 0], 20, 20) -critters = [player, testCritter] +critters = [player] input = Input(player) -dg = CaveGenerator(40, 25) -dg.generate() -map = dg.finish() -map = Map(dg.finish()) - -#dg = RoomsCoridorsGenerator(80, 40) +#dg = CaveGenerator(40, 25) #dg.generate() +#map = dg.finish() #map = Map(dg.finish()) +dg = RoomsCoridorsGenerator(80, 40) +dg.generate() +map = Map(dg.finish()) + #dg = StaticGenerator() #dg.generate() #map = Map(dg.finish()) gui.init_fov(map) -#for i in range(0, dg.length): -# for j in range(0, dg.width): -# gui.print_critter(i, j, map[i][j].char) -#gui.main_loop(critters, map) - player.cur_pos_x, player.cur_pos_y = find_passable_square(map.map) -testCritter.cur_pos_x, testCritter.cur_pos_y = find_passable_square(map.map) - main_loop() -#libtcod.console_set_custom_font('fonts/arial10x10.png', libtcod.FONT_TYPE_GREYSCALE | libtcod.FONT_LAYOUT_TCOD) -#libtcod.console_init_root(40, 20, 'darktower-rl', False) -#con = libtcod.console_new(40, 20) -#libtcod.console_print_left(con, 1, 1, libtcod.BKGND_NONE, '1') -#libtcod.console_print_left(con, 0, 5, libtcod.BKGND_NONE, 'y') -#libtcod.console_print_left(con, 5, 0, libtcod.BKGND_NONE, 'x') -#libtcod.console_blit(con, 0, 0, 40, 20, 0, 0, 0) -#libtcod.console_flush() -#input.handle_keys(can_pass) -# - - - diff --git a/map.py b/map.py index 90547fd..fd386b5 100644 --- a/map.py +++ b/map.py @@ -1,3 +1,4 @@ +from thirdparty.libtcod import libtcodpy as libtcod class Map(object): def __init__(self, map_src):