Skip to content

Commit

Permalink
end-day commit.
Browse files Browse the repository at this point in the history
moved critters to separate module
  • Loading branch information
sirvaulterscoff committed Mar 24, 2011
1 parent 5ee0bcf commit c595775
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 47 deletions.
12 changes: 12 additions & 0 deletions critters.py
Original file line number Diff line number Diff line change
@@ -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

56 changes: 9 additions & 47 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from critters import *
from dungeon_generators import *
from gui import LibtcodGui
from game_input import *
Expand All @@ -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
Expand All @@ -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)
#



1 change: 1 addition & 0 deletions map.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from thirdparty.libtcod import libtcodpy as libtcod

class Map(object):
def __init__(self, map_src):
Expand Down

0 comments on commit c595775

Please sign in to comment.