comparison pyntnclick/scenewidgets.py @ 760:f288e5ec0a75 pyntnclick

Convert FIXME about animation image size equivalence into an assertion
author Stefano Rivera <stefano@rivera.za.net>
date Sat, 26 Jan 2013 13:02:19 +0200
parents 096a568d98aa
children afe7b1cb16c0
comparison
equal deleted inserted replaced
759:386475464202 760:f288e5ec0a75
94 94
95 95
96 class InteractAnimated(Interact): 96 class InteractAnimated(Interact):
97 """Interactive with an animation rather than an image""" 97 """Interactive with an animation rather than an image"""
98 98
99 # FIXME: Assumes all images are the same size
100 # anim_seq - sequence of image names 99 # anim_seq - sequence of image names
101 # delay - number of frames to wait between changing images 100 # delay - number of frames to wait between changing images
102 101
103 def __init__(self, x, y, anim_seq, delay): 102 def __init__(self, x, y, anim_seq, delay):
104 self._pos = (x, y) 103 self._pos = (x, y)
110 109
111 def set_thing(self, thing): 110 def set_thing(self, thing):
112 self._anim_seq = [get_image(thing.folder, x) for x in self._names] 111 self._anim_seq = [get_image(thing.folder, x) for x in self._names]
113 self.image = self._anim_seq[0] 112 self.image = self._anim_seq[0]
114 self.rect = Rect(self._pos, self.image.get_size()) 113 self.rect = Rect(self._pos, self.image.get_size())
114 for image in self._anim_seq:
115 assert image.get_size() == self.rect.size
115 self.interact_rect = self.rect 116 self.interact_rect = self.rect
116 117
117 def animate(self): 118 def animate(self):
118 if self._anim_seq: 119 if self._anim_seq:
119 self._frame_count += 1 120 self._frame_count += 1