source: nagslang/screens/base.py@ 192:3dc2b6290e66

Last change on this file since 192:3dc2b6290e66 was 180:026297a03963, checked in by Neil Muller <drnlmuller@…>, 9 years ago

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

File size: 660 bytes
RevLine 
[11]1"""A screen or area in which action happens."""
2
[18]3from pygame import event
[11]4import pymunk
5
6
[18]7class Screen(object):
[11]8
[180]9 def __init__(self, name, player, world):
[37]10 self.name = name
11 self.world = world
[180]12 self.protagonist = player
[11]13 self.space = pymunk.Space()
14
[37]15 def setup(self):
[20]16 """Perform setup based on the world state."""
17 pass
18
19 def teardown(self):
20 pass
21
[18]22 def post_event(self, ev):
23 event.post(ev)
24
25 def handle_event(self, ev):
26 pass
27
[11]28 def render(self, surface):
29 pass
30
[34]31 def tick(self, seconds):
[11]32 """Step the given amount of time."""
[34]33 self.space.step(seconds)
Note: See TracBrowser for help on using the repository browser.