Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Draw stamina bar
- stamina_bar_width = 100
- stamina_bar_height = 10
- stamina_x = 10
- stamina_y = 90
- # Background bar (empty stamina)
- pygame.draw.rect(surface, (100, 100, 100),
- (stamina_x, stamina_y, stamina_bar_width, stamina_bar_height))
- # Foreground bar (current stamina)
- stamina_percent = self.stamina / self.max_stamina
- current_bar_width = max(0, int(stamina_bar_width * stamina_percent))
- pygame.draw.rect(surface, (0, 200, 0),
- (stamina_x, stamina_y, current_bar_width, stamina_bar_height))
- # Draw recovery boost button
- button_x = stamina_x + stamina_bar_width + 10
- button_y = stamina_y
- button_width = 20
- button_height = stamina_bar_height
- # Button color changes when active
- button_color = (200, 200, 0) if self.recovery_boost > 1.0 else (150, 150, 0)
- pygame.draw.rect(surface, button_color,
- (button_x, button_y, button_width, button_height))
- # Label for boost button
- font = pygame.font.SysFont(None, 20)
- button_text = font.render("R", True, BLACK)
- text_rect = button_text.get_rect(center=(button_x + button_width // 2,
- button_y + button_height // 2))
- surface.blit(button_text, text_rect)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement