Changeset 157:e3572b907028


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

Add splash images to game over screen.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gamelib/gameover.py

    r151 r157  
    1111    """Create a game over screen"""
    1212    game_over = GameOver(gameboard)
    13 
    14     c = GameOverContainer(align=0, valign=0)
    15     c.add(game_over, 0, 0)
    16 
    17     return c
     13    return GameOverContainer(game_over, align=0, valign=0)
    1814
    1915class GameOverContainer(gui.Container):
     16    def __init__(self, game_over, *args, **kwargs):
     17        gui.Container.__init__(self, *args, **kwargs)
     18        self.add(game_over, 0, 0)
     19        if game_over.survived:
     20            self.splash = imagecache.load_image("images/gameover_win.png")
     21        else:
     22            self.splash = imagecache.load_image("images/gameover_lose.png")
     23
    2024    def paint(self, s):
    2125        pygame.display.set_caption('Game Over')
    22         #splash = imagecache.load_image("images/splash.png")
    23         #pygame.display.get_surface().blit(splash, (0, 0))
     26        pygame.display.get_surface().blit(self.splash, (0, 0))
    2427        gui.Container.paint(self, s)
    2528
     
    2730    def __init__(self, gameboard, **params):
    2831        gui.Table.__init__(self, **params)
     32        self.tr()
    2933
    3034        def return_pressed():
     
    3539
    3640        if len(gameboard.chickens) > 0:
     41            self.survived = True
    3742            self.td(gui.Label("You Survived", color=constants.FG_COLOR),
    3843                    colspan=3)
    3944        else:
     45            self.survived = False
    4046            self.td(gui.Label("You Lost", color=constants.FG_COLOR),
    4147                    colspan=3)
     
    5359            constants.SELL_PRICE_EGG * gameboard.eggs),
    5460            color=constants.FG_COLOR), colspan=3)
     61
     62        self.tr()
     63        self.td(gui.Spacer(0, 50), colspan=3)
    5564
    5665        return_button = gui.Button("Return to Main Menu")
Note: See TracChangeset for help on using the changeset viewer.