Started house
Justin Armstrong justinmeister@gmail.com
Mon, 24 Mar 2014 21:26:33 -0700
15 files changed,
132 insertions(+),
11 deletions(-)
jump to
M
data/constants.py
→
data/constants.py
@@ -12,6 +12,7 @@ POTION_SHOP = 'potion shop'
ARMOR_SHOP = 'armor shop' WEAPON_SHOP = 'weapon shop' MAGIC_SHOP = 'magic shop' +HOUSE = 'house' ##Colors
M
data/main.py
→
data/main.py
@@ -2,6 +2,7 @@ from data.states.main_menu import main_menu
from data.states.town import town from data.states.castle import castle from data.states import shop +from data.states.house import house from . import setup, tools from . import constants as c@@ -9,6 +10,7 @@
TOWN = 'town' MAIN_MENU = 'main menu' CASTLE = 'castle' +HOUSE = 'house' INN = 'Inn' ARMOR_SHOP = 'armor shop' WEAPON_SHOP = 'weapon shop'@@ -22,6 +24,7 @@ run_it = tools.Control(setup.ORIGINAL_CAPTION)
state_dict = {TOWN: town.Town(), MAIN_MENU: main_menu.Menu(), CASTLE: castle.Castle(), + HOUSE: house.House(), INN: shop.Inn(), ARMOR_SHOP: shop.ArmorShop(), WEAPON_SHOP: shop.WeaponShop(),
M
data/shopgui.py
→
data/shopgui.py
@@ -315,11 +315,9 @@ """Draw GUI to level surface"""
state_list1 = ['dialogue', 'reject', 'accept', 'hasitem'] state_list2 = ['select', 'confirm', 'buysell'] - if self.state in state_list1: - surface.blit(self.dialogue_box.image, self.dialogue_box.rect) - surface.blit(self.gold_box.image, self.gold_box.rect) - elif self.state in state_list2: - surface.blit(self.dialogue_box.image, self.dialogue_box.rect) + surface.blit(self.dialogue_box.image, self.dialogue_box.rect) + surface.blit(self.gold_box.image, self.gold_box.rect) + if self.state in state_list2: surface.blit(self.selection_box.image, self.selection_box.rect) surface.blit(self.selection_arrow.image, self.selection_arrow.rect) - surface.blit(self.gold_box.image, self.gold_box.rect) +
A
data/states/house/blockers.txt
@@ -0,0 +1,20 @@
+0000000000000000000000000 +0000000000000000000000000 +0000000000000000000000000 +0000000000000000000000000 +00000000BBBBBBBBB00000000 +0000000B11111111B00000000 +0000000B11111111B00000000 +0000000B11111111B00000000 +0000000B11111111B00000000 +0000000B11111111B00000000 +0000000B11111111B00000000 +0000000B11111111B00000000 +0000000B11111111B00000000 +0000000B11111111B00000000 +00000000BBB11BBB000000000 +0000000000000000000000000 +0000000000000000000000000 +0000000000000000000000000 +0000000000000000000000000 +0000000000000000000000000
A
data/states/house/house.py
@@ -0,0 +1,22 @@
+"""This is the house on the lower left hand +corner of the town. Most of its functionality is inherited +from the level_state.py module. Most of the level data is contained +in the tilemap .txt files in this state's directory. Essentially the +only purpose of house.py is to assign dialogue to each sprite. +""" + + +from .. import level_state +from ... import constants as c + +class House(level_state.LevelState): + def __init__(self): + super(House, self).__init__() + self.name = c.HOUSE + self.map_width = 25 + self.map_height = 19 + + def set_sprite_dialogue(self): + """Sets unique dialogue for each sprite""" + for sprite in self.sprites: + pass
A
data/states/house/layer1.txt
@@ -0,0 +1,19 @@
+0000000000000000000000000 +0000000000000000000000000 +0000000000000000000000000 +0000000000000000000000000 +0000000000000000000000000 +00000000BBBBBBBB000000000 +00000000BBBBBBBB000000000 +00000000BBBBBBBB000000000 +00000000BBBBBBBB000000000 +00000000BBBBBBBB000000000 +00000000BBBBBBBB000000000 +00000000BBBBBBBB000000000 +00000000BBBBBBBB000000000 +00000000BBBQEBBB000000000 +00000000KKKKKKKK000000000 +0000000000000000000000000 +0000000000000000000000000 +0000000000000000000000000 +0000000000000000000000000
A
data/states/house/portals.txt
@@ -0,0 +1,20 @@
+0000000000000000000000000 +0000000000000000000000000 +0000000000000000000000000 +0000000000000000000000000 +0000000000000000000000000 +0000000000000000000000000 +0000000000000000000000000 +0000000000000000000000000 +0000000000000000000000000 +0000000000000000000000000 +0000000000000000000000000 +0000000000000000000000000 +0000000000000000000000000 +0000000000000000000000000 +00000000000BB000000000000 +0000000000000000000000000 +0000000000000000000000000 +0000000000000000000000000 +0000000000000000000000000 +0000000000000000000000000
A
data/states/house/sprite_start_pos.txt
@@ -0,0 +1,19 @@
+0000000000000000000000000 +0000000000000000000000000 +0000000000000000000000000 +0000000000000000000000000 +0000000000000000000000000 +0000000000000000000000000 +0000000000S00000000000000 +0000000000000000000000000 +0000000000000000000000000 +0000000000000000000000000 +0000000000000000000000000 +0000000000000000000000000 +0000000000000000000000000 +0000000000000000000000000 +0000000000000000000000000 +0000000000000000000000000 +0000000000000000000000000 +0000000000000000000000000 +0000000000000000000000000
M
data/states/town/portals.txt
→
data/states/town/portals.txt
@@ -40,7 +40,7 @@ 0000000000011000000333000
0003330000011000000333000 0003330000011000000222000 00022200000110000002C2000 -0002A20000011000000010000 +0002H20000011000000010000 0000100000011000000010000 0000111111111111111110000 0000000000011000000000000
M
data/states/town/sprite_start_pos.txt
→
data/states/town/sprite_start_pos.txt
@@ -47,4 +47,4 @@ 0000000000011000000000000
00000000DF011000000000000 00000000D0011000000000000 0000000000011000000000000 -000000000001P000000000000 +0000000000011000000000000
M
data/tilemap.py
→
data/tilemap.py
@@ -57,6 +57,7 @@ tile_dict['inn sign'] = get_tile(0, 96, medieval_signs, 32, 32)
tile_dict['banner1'] = get_tile(112, 38, tileset3, 16, 22) tile_dict['banner2'] = get_tile(128, 38, tileset3, 16, 22) tile_dict['banner3'] = get_tile(144, 38, tileset3, 16, 22) + tile_dict['black tile'] = make_black_surface_tile() return tile_dict@@ -73,6 +74,17 @@
return tile_dict +def make_black_surface_tile(): + """Make a black surface""" + surface = pg.Surface((32, 32)) + surface.fill(c.BLACK_BLUE) + rect = surface.get_rect() + new_dict = {'surface': surface, + 'rect': rect} + + return new_dict + + def make_level_map(state, width, height): """Blits the different layers of the map onto one surface""" map = make_background(state, width, height)@@ -93,12 +105,12 @@ if state_name == c.TOWN:
tile = get_image(0, 0, 16, 16, setup.GFX['tileset2']) else: tile = pg.Surface((16, 16)) - tile.fill(c.NEAR_BLACK) + tile.fill(c.BLACK_BLUE) rect = tile.get_rect() - for row in range(50): - for column in range(25): + for row in range(height): + for column in range(width): rect.y = row * 16 rect.x = column * 16 surface.blit(tile, rect)@@ -204,6 +216,9 @@ blit_tile_to_map(tile, row, column, map)
elif letter == 'H': tile = tile_dict['marble floor'] + blit_tile_to_map(tile, row, column, map) + elif letter == 'K': + tile = tile_dict['black tile'] blit_tile_to_map(tile, row, column, map)@@ -402,6 +417,8 @@ elif letter == 'F':
portal_group.add(portal.Portal(column, row, c.WEAPON_SHOP)) elif letter == 'G': portal_group.add(portal.Portal(column, row, c.ARMOR_SHOP)) + elif letter == 'H': + portal_group.add(portal.Portal(column, row, c.HOUSE)) return portal_group
M
data/tools.py
→
data/tools.py
@@ -160,6 +160,7 @@ 'last state': None,
'last direction': 'up', 'town start pos': [12, 49], 'castle start pos': [12, 26], + 'house start pos': [12, 13], 'king item': {'gold': 500}, 'player inventory': player_items }