Ignore:
Timestamp:
09/07/13 18:20:25 (8 years ago)
Author:
Stefano Rivera <stefano@…>
Branch:
default
Phase:
public
Message:

Ephemeral messages

File:
1 edited

Legend:

Unmodified
Added
Removed
  • nagslang/screens/area.py

    r512 r520  
    1010    COLLISION_TYPE_FURNITURE, COLLISION_TYPE_WEREWOLF_ATTACK,
    1111    CMD_TOGGLE_FORM, CMD_ACTION)
    12 from nagslang.events import ScreenChange, DoorEvent, QuitEvent, DeathEvent
     12from nagslang.events import (
     13    AddDrawableEvent, DeathEvent, DoorEvent, QuitEvent, ScreenChange)
    1314from nagslang.level import Level
    1415from nagslang.screens.base import Screen
     
    204205            self.protagonist.set_position(pos)
    205206            ScreenChange.post(level)
    206 
     207        elif AddDrawableEvent.matches(ev):
     208            self._drawables.add(ev.drawable)
     209            if ev.drawable.overlay:
     210                self._level.overlay_drawables.append(ev.drawable.overlay)
    207211        self.keys.handle_event(ev)
    208212
     
    248252        # Maximum width we allow for overlays
    249253        max_width = min(render_rect.width, self._surface.get_width())
    250         for overlay in self._level.overlay_drawables:
     254        for overlay in reversed(self._level.overlay_drawables):
    251255            if overlay.is_visible():
    252256                overlay.render(surface, render_rect.topleft, max_width)
     257                break
    253258        self.render_health_bar(surface)
    254259
     
    269274            for drawable in result.add:
    270275                self._drawables.add(drawable)
     276                if drawable.overlay:
     277                    self._level.overlay_drawables.add(drawable.overlay)
    271278            for drawable in result.remove:
    272279                self._drawables.remove(drawable)
     280                if drawable.overlay:
     281                    self._level.overlay_drawables.remove(drawable.overlay)
    273282
    274283    def render_health_bar(self, surface, damage_experienced=None):
Note: See TracChangeset for help on using the changeset viewer.