From a175bf363bd7bf32df71af7092f2c66746fa13a4 Mon Sep 17 00:00:00 2001 From: csaez Date: Fri, 14 Feb 2014 01:54:57 -0300 Subject: [PATCH] multi-sprite --- flascii_bird.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/flascii_bird.py b/flascii_bird.py index e6266a6..0865792 100644 --- a/flascii_bird.py +++ b/flascii_bird.py @@ -63,6 +63,17 @@ def bbox(self): self._bbox = Vector(max([len(x) for x in sp]), len(sp)) return self._bbox + @property + def shape(self): + if type(self._shape) in ((list, tuple)): + index = 0 if self.vel.y > 0 else 1 + return self._shape[index] + return self._shape + + @shape.setter + def shape(self, value): + self._shape = value + def simulate(self, forces=None, max_speed=2): forces = forces or list() for f in forces: @@ -117,7 +128,7 @@ def flascii_bird(): ("." * TERMINAL_SIZE.x + "\n") * 3 GROUND = Sprite(GROUND) GROUND.pos = Vector(0, 21) - BIRD = Sprite(" / (._\n===_/-") + BIRD = Sprite(("== (.\n \___\\", " / (./\n===_/")) BIRD.pos = Vector(10, 0) t = 0