Added talking well
Justin Armstrong justinmeister@gmail.com
Tue, 18 Mar 2014 00:35:09 -0700
5 files changed,
43 insertions(+),
5 deletions(-)
M
data/components/person.py
→
data/components/person.py
@@ -22,7 +22,7 @@ self.direction = direction
self.image_list = self.animation_dict[self.direction] self.image = self.image_list[self.index] self.rect = self.image.get_rect(left=x, top=y) - self.old_rect = self.rect + #self.old_rect = self.rect self.state_dict = self.create_state_dict() self.vector_dict = self.create_vector_dict() self.x_vel = 0@@ -338,3 +338,31 @@ """King of the town"""
def __init__(self, x, y, direction='down', state='resting'): super(King, self).__init__('king', x, y, direction, state) + +class Well(pg.sprite.Sprite): + """Talking well""" + def __init__(self, x, y): + super(Well, self).__init__() + self.image = pg.Surface((32, 32)) + self.image.set_colorkey((0,0,0)) + self.rect = self.image.get_rect(left=x, top=y) + self.location = self.get_location() + self.dialogue = ["I'm a well!"] + self.blockers = [self.rect] + self.x_vel = self.y_vel = 0 + self.state = 'resting' + self.direction = 'down' + self.default_direction = self.direction + + def get_location(self): + """Get tile location""" + x = self.rect.x / 32 + y = self.rect.y / 32 + + return [x, y] + + def begin_auto_resting(self): + """Placeholder""" + pass + +
M
data/components/textbox.py
→
data/components/textbox.py
@@ -17,7 +17,7 @@
class DialogueBox(object): """Text box used for dialogue""" - def __init__(self, x, dialogue, dialogue_index=0): + def __init__(self, x, dialogue, index=0): self.bground = setup.GFX['dialoguebox'] self.rect = self.bground.get_rect(centerx=x) self.image = pg.Surface(self.rect.size)@@ -27,7 +27,7 @@ self.timer = 0.0
self.arrow_timer = 0.0 self.font = pg.font.Font(setup.FONTS['Fixedsys500c'], 22) self.dialogue_list = dialogue - self.index = dialogue_index + self.index = index self.dialogue_image = self.font.render(dialogue[self.index], False, c.NEAR_BLACK)@@ -75,6 +75,13 @@ if self.index < len(self.dialogue_list) - 1:
self.image.blit(self.arrow.image, self.arrow.rect) else: pass + + +class InfoBox(DialogueBox): + """Text box for information like obtaining new items""" + def __init__(self, x, dialogue): + super(InfoBox, self).__init__(x, dialogue) + self.image = setup.GFX['infobox'] class DialogueHandler(object):
M
data/states/town/sprite_start_pos.txt
→
data/states/town/sprite_start_pos.txt
@@ -44,7 +44,7 @@ 0002220000011000000010000
0000100000011000000010000 0000111111111111111110000 0000000000011000000000000 -0000000W0F011000000000000 -0000000000011000000000000 +0000000D0F011000000000000 +0000000D00011000000000000 0000000000011000000000000 000000000001P000000000000
M
data/tilemap.py
→
data/tilemap.py
@@ -367,6 +367,9 @@ level_sprites.add(soldier)
elif letter == 'C': king = person.King(column*32, row*32, 'down', 'resting') level_sprites.add(king) + elif letter == 'D': + well = person.Well(column*32, row*32) + level_sprites.add(well) tile_map.close()