Beispiel #1
0
def run():
    pygame.init()

    screen = pygame.display.set_mode(WINDOW_SIZE)

    engine.display_simple_message("Jumping Jack Python", duration=consts.SHORT_DISPLAY_DURATION)

    game = games.Game()
    while game.play_again:
        levels.introduce_level(game)
        level = levels.select_level(game)
        game = level.play()
        if game.status == game.QUIT:
            print("Bye")
            game.play_again = False
            game.status = None
        elif game.status == game.WIN:
            game.status = None
        elif game.status == game.LOSE:
            game.status = None
            if game.lives == 0:
                lose.display_lose_game(game)
                game.reset()
            else:
                lose.display_lose_level()
Beispiel #2
0
def run():
    pygame.init()

    screen = pygame.display.set_mode(WINDOW_SIZE)

    engine.display_simple_message("Jumping Jack Python",
                                  duration=consts.SHORT_DISPLAY_DURATION)

    game = games.Game()
    while game.play_again:
        levels.introduce_level(game)
        level = levels.select_level(game)
        game = level.play()
        if game.status == game.QUIT:
            print("Bye")
            game.play_again = False
            game.status = None
        elif game.status == game.WIN:
            game.status = None
        elif game.status == game.LOSE:
            game.status = None
            if game.lives == 0:
                lose.display_lose_game(game)
                game.reset()
            else:
                lose.display_lose_level()
Beispiel #3
0
def display_lose_game(game):
    won_levels = game.won_levels
    template = u"Game over (won: %d level)" if won_levels == 1 else u"Game over (won: %d levels)"
    message = template % won_levels
    engine.display_simple_message(message)
Beispiel #4
0
def display_lose_level():
    engine.display_simple_message(u"Team fails! Try again...")
Beispiel #5
0
def introduce_level(game):
    msg = u"Level %d" % (game.won_levels + 1)
    engine.display_simple_message(msg)
Beispiel #6
0
def introduce_level(game):
    msg = u"Level %d" % (game.won_levels + 1)
    engine.display_simple_message(msg)
Beispiel #7
0
def display_lose_level():
    engine.display_simple_message(u"Team fails! Try again...")
Beispiel #8
0
def display_lose_game(game):
    won_levels = game.won_levels
    template = u"Game over (won: %d level)" if won_levels == 1 else u"Game over (won: %d levels)"
    message = template % won_levels
    engine.display_simple_message(message)