Changeset 159:7bb8d9d6858a


Ignore:
Timestamp:
Sep 3, 2009, 10:00:28 PM (11 years ago)
Author:
Simon Cross <hodgestar@…>
Branch:
default
Convert:
svn:b4e93282-eac8-4b8b-b765-0f5d36de2b68@160
Message:

Darken center of game over splash screen to make text legible.

Location:
gamelib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • gamelib/gameover.py

    r157 r159  
    1818        self.add(game_over, 0, 0)
    1919        if game_over.survived:
    20             self.splash = imagecache.load_image("images/gameover_win.png")
     20            self.splash = imagecache.load_image("images/gameover_win.png", ["darken_center"])
    2121        else:
    22             self.splash = imagecache.load_image("images/gameover_lose.png")
     22            self.splash = imagecache.load_image("images/gameover_lose.png", ["darken_center"])
    2323
    2424    def paint(self, s):
  • gamelib/imagecache.py

    r53 r159  
    5757# modifiers
    5858
    59 from pygame.locals import BLEND_RGBA_MULT
     59from pygame.locals import BLEND_RGBA_MULT, BLEND_MULT
    6060NIGHT_COLOUR = (100.0, 100.0, 200.0, 255.0)
     61DARKEN_COLOUR = (100.0, 100.0, 100.0, 255.0)
    6162
    6263def convert_to_night(image):
     
    7172    return right_facing_image
    7273
     74def darken_center(image):
     75    darkened = image.copy()
     76    w, h = darkened.get_size()
     77    w, h = int(w*0.5), int(h*0.5)
     78    x, y = int(w*0.5), int(h*0.5)
     79    overlay = pygame.Surface((w, h))
     80    overlay.fill(DARKEN_COLOUR)
     81    darkened.blit(overlay, (x,y), None, BLEND_MULT)
     82    return darkened
     83
    7384# globals
    7485
     
    7687cache.register_modifier("night", convert_to_night)
    7788cache.register_modifier("right_facing", convert_to_right_facing)
     89cache.register_modifier("darken_center", darken_center)
    7890load_image = cache.load_image
Note: See TracChangeset for help on using the changeset viewer.