2012-08-08 19:42:57 +02:00
|
|
|
import os
|
|
|
|
import pygame
|
|
|
|
import random
|
|
|
|
import re
|
|
|
|
|
|
|
|
import level
|
|
|
|
import player
|
|
|
|
import tile
|
|
|
|
import block
|
|
|
|
import boulder
|
|
|
|
import lever
|
2012-08-09 15:51:59 +02:00
|
|
|
import level_bonus
|
|
|
|
import fadeout
|
2012-08-08 19:42:57 +02:00
|
|
|
|
2012-08-08 20:22:13 +02:00
|
|
|
|
2012-08-08 19:42:57 +02:00
|
|
|
class Level2(level.Level):
|
|
|
|
def __init__(self, game, graphics_dir, paused=False):
|
2012-08-09 15:51:59 +02:00
|
|
|
level.Level.__init__(self, game, graphics_dir, size=(64*5, 48*5),
|
2012-08-08 20:22:13 +02:00
|
|
|
paused=paused)
|
2012-08-08 19:42:57 +02:00
|
|
|
|
2012-08-09 15:51:59 +02:00
|
|
|
self.dimensions = 5, 5
|
2012-08-08 19:42:57 +02:00
|
|
|
|
|
|
|
for i in range(self.dimensions[0]):
|
|
|
|
for j in range(self.dimensions[1]):
|
|
|
|
self.tiles.append(
|
2012-08-14 00:59:06 +02:00
|
|
|
tile.Tile(self, i*64, (j + 1)*48,
|
|
|
|
self.imgs['indoor%d' % random.randint(1, 6)]))
|
2012-08-08 19:42:57 +02:00
|
|
|
|
2012-08-08 20:22:13 +02:00
|
|
|
self.draw_background()
|
|
|
|
|
2012-08-09 15:51:59 +02:00
|
|
|
bonus = level_bonus.Level(self.game, self.graphics_dir)
|
2012-08-09 23:27:26 +02:00
|
|
|
|
|
|
|
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)
|
|
|
|
|
2012-08-09 15:51:59 +02:00
|
|
|
self.objects.append(
|
|
|
|
lever.Lever(
|
|
|
|
self, 64 * 2, 48 * 3,
|
2012-08-09 23:27:26 +02:00
|
|
|
[lambda setting: f()],
|
2012-08-09 15:51:59 +02:00
|
|
|
toggling=False,
|
|
|
|
anim='lever_updown'))
|
2012-08-08 19:42:57 +02:00
|
|
|
|
2012-08-14 00:59:06 +02:00
|
|
|
self.player.set_pos(64 * 2, 48 * 1)
|
|
|
|
self.player.set_init_pos()
|
|
|
|
|
2012-08-08 19:42:57 +02:00
|
|
|
|
|
|
|
def restart(self):
|
|
|
|
for obj in self.objects:
|
|
|
|
obj.reset_pos()
|