Changeset 231
- Timestamp:
- 01/04/07 02:50:21 (5 years ago)
- Location:
- trunk
- Files:
-
- 4 modified
-
NEWS.txt (modified) (1 diff)
-
src/pyspacewar/ui.py (modified) (5 diffs)
-
src/pyspacewar/version.py (modified) (1 diff)
-
src/pyspacewar/world.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/NEWS.txt
r229 r231 1 January 5, 2006: Happy New Year! 2 3 - Show an animation (expanding bubble) when ships respawn. 4 1 5 December 25, 2006: Released version 0.9.3: the Christmas release. 2 6 -
trunk/src/pyspacewar/ui.py
r228 r231 172 172 173 173 174 def linear(x, xmax, y1, y2): 175 """Calculate a linear transition from y1 to y2 as x moves from 0 to xmax. 176 177 >>> for x in range(10): 178 ... print '*' * int(linear(x, 9, 1, 10)) 179 * 180 ** 181 *** 182 **** 183 ***** 184 ****** 185 ******* 186 ******** 187 ********* 188 ********** 189 190 """ 191 return y1 + (y2 - y1) * float(x) / xmax 192 193 174 194 def smooth(x, xmax, y1, y2): 175 195 """Calculate a smooth transition from y1 to y2 as x moves from 0 to xmax. … … 192 212 value = 1 / (1 + math.exp(-t)) 193 213 return y1 + (y2 - y1) * value 194 195 214 196 215 … … 1735 1754 visibility_margin = 120 # Keep ships at least 120px from screen edges 1736 1755 1756 respawn_animation = 100 # Time (game ticks) to show respawn animation 1757 1737 1758 _ui_mode = None # Previous user interface mode 1738 1759 … … 2233 2254 color = colorblend(color, (0x20, 0x20, 0x20), 0.2) 2234 2255 color = colorblend(color, (0, 0, 0), ratio) 2256 elif self.game.world.time - ship.spawn_time < self.respawn_animation: 2257 self.draw_Ship_spawn_animation(ship) 2235 2258 direction_vector = ship.direction_vector * ship.size 2236 2259 side_vector = direction_vector.perpendicular() … … 2316 2339 return (front, back, left_front, left_back, right_front, right_back) 2317 2340 2341 def draw_Ship_spawn_animation(self, ship): 2342 sp = self.viewport.screen_pos(ship.position) 2343 color = self.ship_colors[ship.appearance] 2344 t = math.sqrt((self.game.world.time - ship.spawn_time) 2345 / self.respawn_animation) 2346 radius = linear(t, 1, 1, 100) 2347 color = colorblend((0, 0, 0), color, linear(t, 1, 0.2, 0.9)) 2348 pygame.draw.circle(self.screen, color, sp, int(radius), 1) 2349 2318 2350 def update_missile_trails(self): 2319 2351 """Update missile trails.""" -
trunk/src/pyspacewar/version.py
r229 r231 6 6 7 7 svn_revision = "$Revision$"[11:-2] 8 version = "0.9.3 "8 version = "0.9.3svn" 9 9 10 10 if version.endswith('svn'): -
trunk/src/pyspacewar/world.py
r201 r231 552 552 self.frags = 0 553 553 self.dead = False 554 self.spawn_time = 0 # the value of world.time when last respawned 554 555 555 556 def _set_direction(self, direction): … … 660 661 self.dead = False 661 662 self.health = 1.0 663 if self.world: 664 self.spawn_time = self.world.time 662 665 663 666 def launch(self):
