all repos — Legends-RPG @ 7ec97552dc243a24c58dcd48fc20549cc8788e01

A fantasy mini-RPG built with Python and Pygame.

Added a victory dance, minor bug fixes.
Justin Armstrong justinmeister@gmail.com
Fri, 02 May 2014 12:21:33 -0700
commit

7ec97552dc243a24c58dcd48fc20549cc8788e01

parent

29d6707d48fd9a25b37b8dd03c3031896d11dc36

5 files changed, 22 insertions(+), 6 deletions(-)

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

@@ -44,7 +44,8 @@ c.ENEMY_HIT: self.enemy_hit(),

c.ENEMY_DEAD: 'Enemy killed.', c.DISPLAY_ENEMY_ATTACK_DAMAGE: self.player_hit(), c.DRINK_HEALING_POTION: 'Player healed.', - c.FIRE_SPELL: 'FIRE BLAST!'} + c.FIRE_SPELL: 'FIRE BLAST!', + c.BATTLE_WON: 'Battle won!'} return state_dict
M data/components/person.pydata/components/person.py

@@ -86,7 +86,8 @@ 'automoving': self.auto_moving,

'battle resting': self.battle_resting, 'attack': self.attack, 'enemy attack': self.enemy_attack, - c.RUN_AWAY: self.run_away} + c.RUN_AWAY: self.run_away, + c.VICTORY_DANCE: self.victory_dance} return state_dict

@@ -394,6 +395,17 @@ self.image_list = []

for image in self.small_image_list: self.image_list.append(pg.transform.scale2x(image)) self.animation() + + def victory_dance(self): + """ + Post Victory Dance. + """ + self.small_image_list = self.animation_dict[self.direction] + self.image_list = [] + for image in self.small_image_list: + self.image_list.append(pg.transform.scale2x(image)) + self.animation(500) + class Player(Person):
M data/constants.pydata/constants.py

@@ -53,6 +53,7 @@ DISPLAY_ENEMY_ATTACK_DAMAGE = 'display enemy attack damage'

DRINK_HEALING_POTION = 'drink healing potion' CURE_SPELL = 'cure spell' FIRE_SPELL = 'fire spell' +VICTORY_DANCE = 'victory dance' #EVENTS
M data/observer.pydata/observer.py

@@ -150,9 +150,11 @@ self.level.set_timer_to_current_time()

self.arrow.become_invisible_surface() self.player.state = c.RUN_AWAY - def battle_won(self): - self.level.end_battle() + self.info_box.state = c.BATTLE_WON + self.level.set_timer_to_current_time() + self.player.state = c.VICTORY_DANCE + def drink_healing_potion(self): """
M data/states/battle.pydata/states/battle.py

@@ -214,7 +214,7 @@ self.state = c.BATTLE_WON

self.timer = self.current_time self.notify(self.state) - elif self.state == c.RUN_AWAY: + elif self.state == c.RUN_AWAY or self.state == c.BATTLE_WON: if (self.current_time - self.timer) > 1500: self.end_battle()

@@ -287,7 +287,7 @@

def player_damaged(self, damage): self.game_data['player stats']['health']['current'] -= damage - def player_healed(self, heal, magic_points): + def player_healed(self, heal, magic_points=0): health = self.game_data['player stats']['health'] health['current'] += heal