# HG changeset patch # User Jeremy Thurgood # Date 1378487644 -7200 # Node ID d2c7e17299a78a575238ce599e350ef4dae2ab9f # Parent 582a96e5fdacbb85fca8d613667b198be05b455a Moonlight tiles force wolf form. diff -r 582a96e5fdac -r d2c7e17299a7 data/images/tiles/moonlight.png Binary file data/images/tiles/moonlight.png has changed diff -r 582a96e5fdac -r d2c7e17299a7 data/levels/level2 --- a/data/levels/level2 Fri Sep 06 18:41:29 2013 +0200 +++ b/data/levels/level2 Fri Sep 06 19:14:04 2013 +0200 @@ -18,6 +18,13 @@ - [700, 200] - [700, 150] classname: AcidFloor +- args: + - [600, 250] + - - [600, 250] + - [600, 300] + - [700, 300] + - [700, 250] + classname: ForceWolfFloor lines: [] polygons: 1: diff -r 582a96e5fdac -r d2c7e17299a7 nagslang/game_object.py --- a/nagslang/game_object.py Fri Sep 06 18:41:29 2013 +0200 +++ b/nagslang/game_object.py Fri Sep 06 19:14:04 2013 +0200 @@ -510,11 +510,14 @@ # off terrian, but as long as the rate is reasonably # low, they shouldn't impact gameplay if self._ticks == 0: - protagonist.lose_health(self.damage) + self.apply_effect(protagonist) self._ticks += 1 if self._ticks > self.rate: self._ticks = 0 + def apply_effect(self, protagonist): + protagonist.lose_health(self.damage) + @classmethod def requires(cls): return [("name", "string"), ("position", "coordinates"), @@ -524,3 +527,11 @@ class AcidFloor(HostileTerrain): damage = 1 tile = 'acid.png' + + +class ForceWolfFloor(HostileTerrain): + tile = 'moonlight.png' + rate = 0 + + def apply_effect(self, protagonist): + protagonist.force_wolf_form() diff -r 582a96e5fdac -r d2c7e17299a7 nagslang/protagonist.py --- a/nagslang/protagonist.py Fri Sep 06 18:41:29 2013 +0200 +++ b/nagslang/protagonist.py Fri Sep 06 19:14:04 2013 +0200 @@ -76,6 +76,7 @@ self.angle = 0 self.is_moving = False self.changing_sequence = [] + self.change_delay = 0 self.go_human() @@ -252,6 +253,8 @@ self.inventory = old_protagonist.inventory def toggle_form(self): + if self.change_delay: + return self.changing_sequence.extend(self.CHANGING_SEQUENCE[self.form]) def _go_to_next_form(self): @@ -343,9 +346,16 @@ self.health_level = PROTAGONIST_HEALTH_MAX_LEVEL def update(self, dt): + if self.change_delay > 0: + self.change_delay -= 1 if self.changing_sequence: self._go_to_next_form() if int(self.lifetime + dt) > int(self.lifetime): if self.in_wolf_form(): self.gain_health(1) super(Protagonist, self).update(dt) + + def force_wolf_form(self): + if self.in_human_form() and not self.changing_sequence: + self.toggle_form() + self.change_delay = 2 diff -r 582a96e5fdac -r d2c7e17299a7 source/images/tiles/moonlight.xcf Binary file source/images/tiles/moonlight.xcf has changed