comparison pytouhou/game/item.pyx @ 527:db28538cd399

Use Sprite C arrays instead of their tuple representation where it makes sense.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Wed, 18 Dec 2013 18:19:08 +0100
parents 3d3285918ba1
children e992927f07a8
comparison
equal deleted inserted replaced
526:0b2a92a25245 527:db28538cd399
21 21
22 self._item = item 22 self._item = item
23 self.sprite = item._item_type.indicator_sprite.copy() 23 self.sprite = item._item_type.indicator_sprite.copy()
24 24
25 self.x = self._item.x 25 self.x = self._item.x
26 self.y = self.sprite.texcoords[2] / 2. 26 self.y = self.sprite._texcoords[3] / 2.
27 27
28 28
29 cdef void update(self) nogil: 29 cdef void update(self) nogil:
30 #TODO: alpha 30 #TODO: alpha
31 self.x = self._item.x 31 self.x = self._item.x
183 self.speed, = self.speed_interpolator.values 183 self.speed, = self.speed_interpolator.values
184 dx, dy = cos(self.angle) * self.speed, sin(self.angle) * self.speed 184 dx, dy = cos(self.angle) * self.speed, sin(self.angle) * self.speed
185 self.x += dx 185 self.x += dx
186 self.y += dy 186 self.y += dy
187 187
188 offscreen = self.y < -(<double>self.sprite.texcoords[2] / 2.) 188 offscreen = self.y < -self.sprite._texcoords[3] / 2.
189 if offscreen: 189 if offscreen:
190 if self.indicator is None: 190 if self.indicator is None:
191 self.indicator = Indicator(self) 191 self.indicator = Indicator(self)
192 self.indicator.update() 192 self.indicator.update()
193 else: 193 else: