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):