Esempio n. 1
0
    def die(self):
        self.draw(update=False)
        self.screen.pixel[self.pacman.x][self.pacman.y] = self.pacman_color
        self.screen.update()

        time.sleep(1)
        start = time.clock()
        end = start + 1.5

        while time.clock() < end:
            self.draw(update=False)
            self.screen.pixel[self.pacman.x][self.pacman.y] = darken_color(self.pacman_color,
                                                                           (end - time.clock()) / (end - start))
            self.screen.update()

        self.screen.fade_out(0.8)
        time.sleep(0.5)

        animation = Animation(self.screen, "pacman/die", interval=100, autoplay=False)
        animation.play_once()
        time.sleep(0.5)

        self.lives -= 1
        if self.lives >= 0:
            self.new_level(reset_food=False)
            self.draw()
        else:
            self.game_over()
Esempio n. 2
0
    def die(self):
        self.draw(update=False)
        self.screen.pixel[self.pacman.x][self.pacman.y] = self.pacman_color
        self.screen.update()

        time.sleep(1)
        start = time.clock()
        end = start + 1.5

        while time.clock() < end:
            self.draw(update=False)
            self.screen.pixel[self.pacman.x][self.pacman.y] = darken_color(
                self.pacman_color, (end - time.clock()) / (end - start))
            self.screen.update()

        self.screen.fade_out(0.8)
        time.sleep(0.5)

        animation = Animation(self.screen,
                              "modules/pacman/die",
                              interval=100,
                              autoplay=False)
        animation.play_once()
        time.sleep(0.5)

        self.lives -= 1
        if self.lives >= 0:
            self.new_level(reset_food=False)
            self.draw()
        else:
            self.game_over()
Esempio n. 3
0
 def game_over(self):
     animation = Animation(self.screen,
                           "modules/pacman/gameover",
                           interval=100,
                           autoplay=False)
     animation.play_once()
     time.sleep(2.0)
     self.new_game()
Esempio n. 4
0
    def level_complete(self):
        animation = Animation(self.screen,
                              "modules/pacman/interlevel",
                              interval=40,
                              autoplay=False)
        animation.play_once()

        self.new_level(reset_food=True)
Esempio n. 5
0
 def game_over(self):
     animation = Animation(self.screen, "pacman/gameover", interval=100, autoplay=False)
     animation.play_once()
     time.sleep(2.0)
     self.new_game()
Esempio n. 6
0
    def level_complete(self):
        animation = Animation(self.screen, "pacman/interlevel", interval=40, autoplay=False)
        animation.play_once()

        self.new_level(reset_food=True)