Changeset 446:4240854e59b0


Ignore:
Timestamp:
04/09/11 17:58:06 (12 years ago)
Author:
Stefano Rivera <stefano@…>
Branch:
default
Phase:
public
Message:

Better death screen

Location:
skaapsteker
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • skaapsteker/levelscene.py

    r430 r446  
    3737        self._world = physics.World(self._level_surface.get_rect())
    3838        self._paused = False
     39
     40        # Prepare a Surface for displaying when Dead
     41        self._dead_overlay = pygame.Surface(constants.SCREEN, flags=SRCALPHA)
     42        self._dead_overlay.fill((255, 255, 255, 128))
     43        death_text_pos = constants.SCREEN[0] / 2, constants.SCREEN[1] / 2
     44        death_text = Text("You've died.", death_text_pos, size=24)
     45        death_text.rect.move_ip(-death_text.rect.width / 2, -death_text.rect.height)
     46        death_text.draw(self._dead_overlay)
     47        death_text = Text("Press Escape to exit or Return to restart the level.", death_text_pos)
     48        death_text.rect.move_ip(-death_text.rect.width / 2, 0)
     49        death_text.draw(self._dead_overlay)
    3950
    4051        # Helper images for hud
     
    191202
    192203        if self._player_dead:
    193             death_text_pos = self._clip_rect.centerx - 100, self._clip_rect.centery - 100
    194             death_text = Text("You've died.\nPress Escape to exit or Return to restart the level", death_text_pos)
    195             death_text.draw(self._level_surface)
     204            self._level_surface.blit(self._dead_overlay, self._clip_rect)
    196205
    197206        screen_surface.blit(self._level_surface, (0, 0), self._clip_rect)
  • skaapsteker/widgets/bubble.py

    r383 r446  
    55import pygame
    66
     7from . import Widget
    78from ..engine import OpenDialog, CloseDialog
    89from .text import Text, TextChoice
    910
    1011
    11 class NotificationWidget(object):
     12class NotificationWidget(Widget):
    1213
    1314    def __init__(self, text):
     
    3940
    4041
    41 class DialogueWidget(object):
     42class DialogueWidget(Widget):
    4243
    4344    def __init__(self, npc):
Note: See TracChangeset for help on using the changeset viewer.