~facundo/enjuewemela/trunk

« back to all changes in this revision

Viewing changes to enjuewemela/stats.py

  • Committer: facundo at com
  • Date: 2012-11-05 12:14:34 UTC
  • mto: (92.1.15 trunk)
  • mto: This revision was merged to the branch mainline in revision 94.
  • Revision ID: facundo@taniquetil.com.ar-20121105121434-8pdaoelvcu9tq5zp
CodeĀ aesthetics.

Show diffs side-by-side

added added

removed removed

Lines of Context:
92
92
                 color=(100, 127, 100, 255))
93
93
        y -= 20
94
94
        self.level_label = f_fixed("0", (middle, y), 20, "center",
95
 
                                      color=(0, 0, 255, 255))
 
95
                                   color=(0, 0, 255, 255))
96
96
 
97
97
        # score
98
98
        y -= 40
100
100
                 color=(100, 127, 100, 255))
101
101
        y -= 20
102
102
        self.score_label = f_fixed("0", (middle, y), 20, "center",
103
 
                                      color=(127, 0, 127, 255))
 
103
                                   color=(127, 0, 127, 255))
104
104
 
105
105
        # get all pieces for level advance
106
106
        self.advance_pieces = gems.get_all()
133
133
 
134
134
        # game time
135
135
        self.game_time_label = f_fixed("0:00", (middle, lower_y + 10), 14,
136
 
                                          "center", color=(250, 50, 50, 255))
 
136
                                       "center", color=(250, 50, 50, 255))
137
137
 
138
138
        #
139
139
        # ------ right side ---------
187
187
    def redraw_stats(self):
188
188
        """Redraw the statistic values."""
189
189
        # these are the values to show
190
 
        to_show = [sum(self.destroyed.values()), self.bombs, self.magics,
191
 
                                                                self.specials]
 
190
        to_show = [sum(self.destroyed.values()),
 
191
                   self.bombs, self.magics, self.specials]
192
192
        to_show.extend(self.added[x] for x in range(7))
193
193
        to_show.extend(self.destroyed[x] for x in range(7))
194
194
 
277
277
 
278
278
    def __str__(self):
279
279
        dt = self.gm.game_time
280
 
        return "Stats(time %d, score %d, added: %s, destroyed: %s)" % (
281
 
                                    dt, self.score, self.added, self.destroyed)
 
280
        t = "Stats(time %d, score %d, added: %s, destroyed: %s)" % (
 
281
            dt, self.score, self.added, self.destroyed)
 
282
        return t
282
283
 
283
284
    def update_timings(self, dt):
284
285
        """Update game timings."""
313
314
            if i < fulls:
314
315
                p.scale = self.final_advance_scale
315
316
            elif i == fulls:
316
 
                p.scale = (self.final_advance_scale * graduated
317
 
                                                        / FRUKIS_LEVEL_LIMIT)
 
317
                p.scale = (self.final_advance_scale * graduated /
 
318
                           FRUKIS_LEVEL_LIMIT)
318
319
            else:
319
320
                p.scale = 0
320
321