Пример #1
0
    def __init__(self, world, nivel=1):
        scene.Scene.__init__(self, world)

        self.items = [
                (u"Comenzar a jugar", game.Game),
                (u"Editar niveles", editor.Editor),
                (u"Ver presentación",presents.Presents),
                (u"Salir", world.salir),
                ]
        if config.DISABLE_EDITOR:
            self.items.pop(1)
        self.sprites = group.Group()
        self.nubes = nubes.Nubes(self.sprites)
        self.font = pygame.font.Font(common.get_ruta('FreeSans.ttf'), int(config.HEIGHT * 0.08))
        self.font_small = pygame.font.Font(common.get_ruta('FreeSans.ttf'), int(config.HEIGHT * 0.04))
        self._draw_background()
        self.cursor = Cursor(world, self.items)
        self.cursor.definir_posicion(0)
        self.sprites.add(self.cursor)

        self._crear_textos()
        self._crear_logotipo()
        self._crear_link()


        self.mouse = editor_mouse.EditorMouse()
        self.sprites.add(self.mouse)
Пример #2
0
    def __init__(self):
        if ENABLE_SOUND:
            pygame.mixer.init(48000)

            self.sounds = {
                'working': pygame.mixer.Sound(common.get_ruta(os.path.join('sounds', 'hammer.ogg'))),
                'menu': pygame.mixer.Sound(common.get_ruta(os.path.join('sounds', 'menu.wav'))),
                'click': pygame.mixer.Sound(common.get_ruta(os.path.join('sounds', 'click.wav'))),
                }
Пример #3
0
    def crear_nivel(self, nivel):
        path = common.get_level_file(nivel, True)
        print "creando", path
        f = open(path, 'wt')

        template = open(common.get_ruta('level_template.txt'), 'rt')
        nivel_template = template.read()
        template.close()

        f.writelines(nivel_template)
        f.close()
Пример #4
0
 def __init__(self, world):
     pygame.mixer.init()
     pygame.mixer.music.load(common.get_ruta(os.path.join('presents', 'music.ogg')))
     #music = pygame.mixer.Sound('presents/music.ogg')
     #music.play()
     pygame.mixer.music.play()
     scene.Scene.__init__(self, world)
     self.sprites = group.Group()
     self.background = common.load("presents/background.png", False, (config.WIDTH, config.HEIGHT))
     self.gcoop = GcoopLogo()
     self.presents = PresentsText()
     self.sprites.add(self.gcoop)
     self.draw_background()
     self.counter = 0
Пример #5
0
    def __init__(self, world, nivel=1, modo_edicion=True):
        pygame.mixer.music.stop()
        scene.Scene.__init__(self, world)
        self.ultimo_avisar = None
        self.sprites = group.Group()
        font_file = common.get_ruta('FreeSans.ttf')
        self.font = pygame.font.Font(font_file, int(config.WIDTH * 0.015))
        self.imagen_bloque = common.load("bloque.png", True, (config.BLOCK_SIZE, config.BLOCK_SIZE))
        self.state = None
        self.mouse = editor_mouse.EditorMouse()
        self.sprites.add(self.mouse)
        self.mapa = Mapa(nivel)
        self.nivel = nivel

        if modo_edicion:
            self.change_state(EditorEditingState(self, 'q'))
        else:
            self.change_state(EditorMenuState(self))

        self._draw_background_and_map()
Пример #6
0
 def __init__(self, sprites):
     self.sprites = sprites
     self.font = pygame.font.Font(common.get_ruta('FreeSans.ttf'), int(config.WIDTH * 0.012))
     self.last_sprite = None