changeset 574:94229756abd9

Give extra lives to the player once she has reached a certain score, and increment the default score on continue.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Sat, 26 Jul 2014 13:07:26 +0200
parents 4233c1c01d90
children e4c9eafab6d0
files pytouhou/game/game.pyx pytouhou/game/player.pyx
diffstat 2 files changed, 10 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/pytouhou/game/game.pyx	Sat Jul 26 01:04:24 2014 +0200
+++ b/pytouhou/game/game.pyx	Sat Jul 26 13:07:26 2014 +0200
@@ -360,10 +360,17 @@
         for player, keystate in zip(self.players, keystates):
             player.update(keystate) #TODO: differentiate keystates (multiplayer mode)
 
+            old_effective_score = player.effective_score
             #XXX: Why 78910? Is it really the right value?
-            player.effective_score = min(player.effective_score + 78910,
+            player.effective_score = min(old_effective_score + 78910,
                                          player.score)
-            #TODO: give extra lives to the player
+            if self.stage < 7:
+                for i in [10000000, 20000000, 40000000, 60000000]:
+                    if player.effective_score >= i and old_effective_score < i:
+                        if player.lives < 8:
+                            player.lives += 1
+                        self.modify_difficulty(+2)
+                        player.play_sound('extend')
 
 
     cdef void update_effects(self):
--- a/pytouhou/game/player.pyx	Sat Jul 26 01:04:24 2014 +0200
+++ b/pytouhou/game/player.pyx	Sat Jul 26 13:07:26 2014 +0200
@@ -262,7 +262,7 @@
                         self._game.drop_bonus(self.x, self.y, 4, player=self,
                                               end_pos=(self._game.prng.rand_double() * 288 + 48,
                                                        self._game.prng.rand_double() * 192 - 64))
-                    self.score = 0
+                    self.score = self.continues_used if self.continues_used <= 9 else 9
                     self.effective_score = 0
                     self.lives = 2 #TODO: use the right default.
                     self.bombs = 3 #TODO: use the right default.