Fixed bug where player crashes game by using something while fade in progress.

This commit is contained in:
Niels Serup 2012-08-09 23:27:26 +02:00
parent d50d043a01
commit 9860036860
2 changed files with 19 additions and 3 deletions

View File

@ -28,11 +28,19 @@ class Level2(level.Level):
self.draw_background() self.draw_background()
bonus = level_bonus.Level(self.game, self.graphics_dir) bonus = level_bonus.Level(self.game, self.graphics_dir)
def f():
self._update = self.update
self.update = lambda *args: None
def g():
self.update = self._update
bonus.enter(self)
fadeout.Fadeout(self.game, g)
self.objects.append( self.objects.append(
lever.Lever( lever.Lever(
self, 64 * 2, 48 * 3, self, 64 * 2, 48 * 3,
[lambda setting: [lambda setting: f()],
fadeout.Fadeout(self.game, lambda: bonus.enter(self))],
toggling=False, toggling=False,
anim='lever_updown')) anim='lever_updown'))

View File

@ -59,10 +59,18 @@ class Level(level.Level):
self.objects.append(block.Block(self, 64 * x, 48 * y, self.objects.append(block.Block(self, 64 * x, 48 * y,
self.imgs['block1'], movable=True)) self.imgs['block1'], movable=True))
def f():
self._update = self.update
self.update = lambda *args: None
def g():
self.update = self._update
self.exit()
fadeout.Fadeout(self.game, g)
self.objects.append( self.objects.append(
lever.Lever( lever.Lever(
self, 64, 48, self, 64, 48,
[lambda setting: fadeout.Fadeout(self.game, self.exit)], [lambda setting: f()],
toggling=False, toggling=False,
anim='lever_updown')) anim='lever_updown'))