Mercurial > touhou
comparison pytouhou/game/text.py @ 439:723a3e67a223
Make pytouhou.game.sprite an extension type.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Sat, 10 Aug 2013 20:48:17 +0200 |
parents | 1222341ea22c |
children | b9d2db93972f |
comparison
equal
deleted
inserted
replaced
438:43a8fed9a8d8 | 439:723a3e67a223 |
---|---|
9 ## This program is distributed in the hope that it will be useful, | 9 ## This program is distributed in the hope that it will be useful, |
10 ## but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 ## but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 ## GNU General Public License for more details. | 12 ## GNU General Public License for more details. |
13 ## | 13 ## |
14 | |
15 from copy import copy | |
16 | 14 |
17 from pytouhou.game.sprite import Sprite | 15 from pytouhou.game.sprite import Sprite |
18 from pytouhou.vm.anmrunner import ANMRunner | 16 from pytouhou.vm.anmrunner import ANMRunner |
19 from pytouhou.utils.interpolator import Interpolator | 17 from pytouhou.utils.interpolator import Interpolator |
20 | 18 |
68 | 66 |
69 | 67 |
70 def set_length(self, length): | 68 def set_length(self, length): |
71 current_length = len(self.glyphes) | 69 current_length = len(self.glyphes) |
72 if length > current_length: | 70 if length > current_length: |
73 self.glyphes.extend(Glyph(copy(self.ref_sprite), | 71 self.glyphes.extend(Glyph(self.ref_sprite.copy(), |
74 (self.x + self.xspacing * i, self.y)) | 72 (self.x + self.xspacing * i, self.y)) |
75 for i in range(current_length, length)) | 73 for i in range(current_length, length)) |
76 elif length < current_length: | 74 elif length < current_length: |
77 self.glyphes[:] = self.glyphes[:length] | 75 self.glyphes[:] = self.glyphes[:length] |
78 | 76 |