def draw_bricks(self, surface): """ Draw all bricks (stacked and dropping) to the passed Pygame Surface. """ if self.db: # Dropping brick surface.blit(self.b1().image, self.b1().rect) surface.blit(self.b2().image, self.b2().rect) # Draw "Next" label font_obj = pygame.font.Font(self._font_dir + "OpenSans-Regular.ttf", 20) self.print_surface("Next", surface, (self.max_pos_x + int(self.bw * 3 / 2), self.min_pos_y + 3 * self.bh - 10), font_obj) # Draw next brick next_db = DoubleBrick(self.next_color, self.next_breaker, self.next_topleft, self.brick_size) surface.blit(next_db.brick1.image, next_db.brick1.rect) surface.blit(next_db.brick2.image, next_db.brick2.rect) # Draw rectangle around next brick pygame.draw.rect( surface, white, pygame.rect.Rect((self.max_pos_x + int(self.bw * 7 / 4), self.min_pos_y + int(self.bh * 15 / 4)), (int(self.bw * 3 / 2), int(self.bh * 5 / 2))), 2) # Stacked bricks for col in range(self.num_cols): for row in range(self.num_rows): surface.blit(self.stacked_bricks[col][row].image, self.stacked_bricks[col][row].rect)
def create_brick(self): """ Create a new dropping brick. """ # Create a dropping brick pair self.db = DoubleBrick(self.next_color, self.next_breaker, (self.gen_col * self.bw + self.left, self.top), self.brick_size) # Determine next brick colors and breaker status self.gen_next()