Changeset 347:dced49dd9864 for nagslang


Ignore:
Timestamp:
Sep 6, 2013, 1:40:35 PM (7 years ago)
Author:
Jeremy Thurgood <firxen@…>
Branch:
default
Message:

Health bar transparency.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • nagslang/screens/area.py

    r345 r347  
    244244
    245245    def render_health_bar(self, surface, damage_experienced=None):
    246         rect = pygame.Rect(50, 500, 110, 50)
     246        bar_surface = pygame.Surface((110, 50)).convert(surface)
    247247        if damage_experienced:
    248248            health_box_colour = pygame.color.THECOLORS['red']
    249249        else:
    250250            health_box_colour = pygame.color.THECOLORS['white']
    251         pygame.draw.rect(surface, health_box_colour, rect, 0)
     251        bar_surface.fill(health_box_colour)
    252252        if self.protagonist.in_human_form():
    253253            health_colour = pygame.color.THECOLORS['red']
    254254        else:
    255255            health_colour = pygame.color.THECOLORS['violetred3']
    256         rect = pygame.Rect(55, 505, self.protagonist.get_health_level(), 40)
    257         pygame.draw.rect(surface, health_colour, rect, 0)
     256        rect = pygame.Rect(5, 5, self.protagonist.get_health_level(), 40)
     257        pygame.draw.rect(bar_surface, health_colour, rect, 0)
     258        bar_surface.set_alpha(192)
     259        surface.blit(bar_surface, (50, 500))
Note: See TracChangeset for help on using the changeset viewer.