all repos — Legends-RPG @ 0c36050b5841a8b230a30b7dcda0ff5d32b310ed

A fantasy mini-RPG built with Python and Pygame.

Fixed some dialogue bugs.
Justin Armstrong justinmeister@gmail.com
Tue, 27 May 2014 23:03:51 -0700
commit

0c36050b5841a8b230a30b7dcda0ff5d32b310ed

parent

68e9a52fe83686831824476d53ff7135dbcec2cf

3 files changed, 30 insertions(+), 25 deletions(-)

jump to
M data/collision.pydata/collision.py

@@ -12,7 +12,6 @@ self.blockers = self.make_blocker_list(blockers, sprites)

self.sprites = sprites self.level = level - def make_blocker_list(self, blockers, sprites): """ Return a combined list of sprite blockers and object blockers.

@@ -26,7 +25,6 @@ for sprite in sprites:

blocker_list.extend(sprite.blockers) return blocker_list - def update(self, keys, current_time): """

@@ -50,7 +48,6 @@ for sprite in self.sprites:

if sprite.state == 'automoving': if sprite.rect.x % 32 == 0 and sprite.rect.y % 32 == 0: sprite.begin_auto_resting() - def check_for_blockers(self): """Checks for collisions with blocker rects"""
M data/components/textbox.pydata/components/textbox.py

@@ -101,7 +101,6 @@

return image - class TextHandler(object): """Handles interaction between sprites to create dialogue boxes"""

@@ -114,7 +113,6 @@ self.allow_input = False

self.level = level self.last_textbox_timer = 0.0 self.game_data = level.game_data - def update(self, keys, current_time): """Checks for the creation of Dialogue boxes"""

@@ -144,24 +142,51 @@ elif self.talking_sprite.item:

self.check_for_item() elif self.talking_sprite.battle: self.game_data['battle type'] = self.talking_sprite.battle - self.dialogue_reset() self.end_dialogue(current_time) + self.level.switch_to_battle = True elif self.talking_sprite.name == 'oldmanbrother' and \ self.game_data['talked to sick brother'] and \ not self.game_data['has brother elixir']: self.talking_sprite.item = 'ELIXIR' self.game_data['has brother elixir'] = True self.check_for_item() + dialogue = ['Hurry! There is precious little time.'] + self.talking_sprite.dialogue = dialogue elif self.talking_sprite.name == 'oldman': if self.game_data['has brother elixir'] and \ not self.game_data['elixir received']: del self.game_data['player inventory']['ELIXIR'] self.game_data['elixir received'] = True - self.dialogue_reset() + dialogue = ['My good health is thanks to you.', + 'I will be forever in your debt.'] + self.talking_sprite.dialogue = dialogue + elif not self.game_data['talked to sick brother']: + self.game_data['talked to sick brother'] = True + + dialogue = ['Hurry to the NorthEast Shores!', + 'I do not have much time left.'] + self.talking_sprite.dialogue = dialogue else: self.end_dialogue(current_time) + elif self.talking_sprite.name == 'king': + + if (self.game_data['crown quest'] + and not self.game_data['delivered crown']): + retrieved_crown_dialogue = ['My crown! You recovered my stolen crown!!!', + 'I can not believe what I see before my eyes.', + 'You are truly a brave and noble warrior.', + 'Henceforth, I name thee Grand Protector of this Town!', + 'Go forth and be recognized.', + 'You are the greatest warrior this world has ever known.'] + self.talking_sprite.dialogue = retrieved_crown_dialogue + self.game_data['delivered crown'] = True + self.end_dialogue(current_time) + elif self.game_data['delivered crown']: + thank_you_dialogue = ['Thank you for retrieving my crown.', + 'My kingdom is forever in your debt.'] + self.talking_sprite.dialogue = thank_you_dialogue + self.end_dialogue(current_time) else: - self.dialogue_reset() self.end_dialogue(current_time)

@@ -203,9 +228,6 @@ if sprite.location == [tile_x + 1, tile_y]:

self.textbox = DialogueBox(sprite.dialogue) sprite.direction = 'left' self.talking_sprite = sprite - - - def check_for_item(self): """Checks if sprite has an item to give to the player"""

@@ -278,13 +300,3 @@ def open_chest(self, sprite):

if sprite.name == 'treasurechest': sprite.index = 1 - def dialogue_reset(self): - """ - Reset dialogue if necessary. - """ - if self.level.reset_dialogue: - sprite = self.level.reset_dialogue[0] - dialogue = self.level.reset_dialogue[1] - sprite.dialogue = dialogue - self.level.reset_dialogue = () -
M data/states/levels.pydata/states/levels.py

@@ -238,15 +238,11 @@ 'This ELIXIR will cure my ailment.',

'As a reward, I will teach you a magic spell.', 'Use it wisely.', 'You learned FIRE BLAST.'] - dialogue = ['My good health is thanks to you.', - 'I will be forever in your debt.'] - self.reset_dialogue = sprite, dialogue elif self.game_data['talked to sick brother']: sprite.dialogue = quest_in_process_dialogue elif not self.game_data['talked to sick brother']: - self.game_data['talked to sick brother'] = True self.reset_dialogue = (sprite, quest_in_process_dialogue) elif sprite.name == 'oldmanbrother': if self.game_data['has brother elixir']: