From: Stefano Rivera Date: Mon, 12 May 2014 19:10:02 +0000 (+0200) Subject: It isn't always a 4/4 split X-Git-Tag: 0.1~354 X-Git-Url: https://git.ctpug.org.za/?a=commitdiff_plain;h=2db0ff32db75f5e1c2735b793410d0ebd3b7e2a3;p=naja.git It isn't always a 4/4 split --- diff --git a/naja/widgets/game_bits.py b/naja/widgets/game_bits.py index 973c2b8..de6c6be 100644 --- a/naja/widgets/game_bits.py +++ b/naja/widgets/game_bits.py @@ -20,19 +20,20 @@ class GameBitsWidget(Widget): def prepare(self): self.surface = pygame.Surface(BIT_SIZE) + health = self.state.gameboard.health + max_health = self.state.gameboard.max_health wins = self.state.gameboard.wins + wins_required = self.state.gameboard.wins_required bits = [] - bits.extend( - (i < health, 'health', (EIGHT_BIT,)) for i in range(4)) - bits.extend( - (i < wins, 'win', (EIGHT_BIT,)) for i in range(4)) + bits.extend((i < health, 'health') for i in range(max_health)) + bits.extend((i < wins, 'win') for i in range(wins_required)) - for pos, (is_set, image, transforms) in enumerate(bits): + for pos, (is_set, image) in enumerate(bits): img = resources.get_image( 'bits', '%s_%s.png' % (image, 'on' if is_set else 'off'), - transforms=transforms) + transforms=(EIGHT_BIT,)) self.surface.blit(img, (img.get_width() * pos, 0)) def draw(self, surface):