Ignore:
Timestamp:
09/03/13 14:58:45 (8 years ago)
Author:
Neil Muller <drnlmuller@…>
Branch:
default
Phase:
public
Rebase:
36616364363066663031393763616436626334636264353230353363646637376262616364306264
Message:

Add DoorEvent and tweak ScreenChange to keep more state when the player goes through a door

File:
1 edited

Legend:

Unmodified
Added
Removed
  • nagslang/engine.py

    r175 r180  
    2323            'level2': AreaScreen,
    2424        }
    25         self.change_screen('menu')
     25        self.change_screen('menu', None)
    2626        # Dummy resize event, to force us to realise our real size
    2727        # http://stackoverflow.com/q/16442573/8629
     
    2929                                             size=(0, 0), w=0, h=0))
    3030
    31     def change_screen(self, new_screen):
     31    def change_screen(self, new_screen, player):
    3232        if self._current_screen is not None:
    3333            self._current_screen.teardown()
    3434        screen_cls = self._screens[new_screen]
    35         self._current_screen = screen_cls(new_screen, self._world)
     35        self._current_screen = screen_cls(new_screen, player, self._world)
    3636        self._current_screen.setup()
    3737
     
    4848                elif ScreenChange.matches(ev):
    4949                    self._surface.fill(pygame.color.Color(0, 0, 0))
    50                     self.change_screen(ev.screen)
     50                    self.change_screen(ev.screen, ev.player)
    5151                else:
    5252                    self._current_screen.handle_event(ev)
Note: See TracChangeset for help on using the changeset viewer.