Exemple #1
0
def word_scramble():
    dungeon, player = retrieve_data()
    tile = maze_funcs.get_current_tile(dungeon, player)
    letter_tiles = [f'static/img/letters/{letter.upper()}.png' for letter in tile.creature.game.scrambled]

    return flask.render_template('mini_games/word_scramble.html', im_path=maze_funcs.get_image_path(),
                                 text=maze_funcs.game_text(),  letter_tiles=letter_tiles)
Exemple #2
0
def bull_cow_game_post():
    player_guess = flask.request.form['player_guess'].strip().lower()
    dungeon, player = retrieve_data()

    if player_guess == 'exit':
        tile = maze_funcs.get_current_tile(dungeon, player)
        tile.creature.started_game = False
        text = maze_funcs.interact(dungeon, player)
        store_data(dungeon, player)
        return flask.render_template('levels/test_level.html', im_path=maze_funcs.get_image_path(), text=text)
    else:
        solved, text = maze_funcs.mini_game_guess(player_guess, dungeon, player, floor_1.TILE_SIZE)

    if solved:
        text.extend(maze_funcs.interact(dungeon, player))
        store_data(dungeon, player)
        return flask.render_template('levels/test_level.html', im_path=maze_funcs.get_image_path(), text=text)
    else:
        store_data(dungeon, player)
        return flask.render_template('mini_games/bull_cow_game.html', im_path=maze_funcs.get_image_path(), text=text)
Exemple #3
0
def spooktober_level():
    dungeon, player = spooktober_floor.initialize()
    store_data(dungeon, player)
    starting_text = [
        "You awaken in a dimly lit room. Despite being at least 12 feet wide in every "
        "direction it feels constricting and charnel. You hesitate to move forward, but "
        "the longer you remain motionless the more you feel a sense of unexplained "
        "urgency build up around you, almost as if it emanated from the walls themselves.",
        ''
    ]
    starting_text.extend(maze_funcs.interact(dungeon, player))
    return render_template('levels/spooktober_level.html',
                           im_path=maze_funcs.get_image_path(),
                           text=starting_text)
Exemple #4
0
def word_scramble_post():
    player_guess = flask.request.form['player_guess'].strip().lower()
    dungeon, player = retrieve_data()

    if player_guess == 'exit':
        tile = maze_funcs.get_current_tile(dungeon, player)
        tile.creature.started_game = False
        text = maze_funcs.interact(dungeon, player)
        store_data(dungeon, player)
        return flask.render_template('levels/test_level.html', im_path=maze_funcs.get_image_path(), text=text)
    else:
        solved, text = maze_funcs.mini_game_guess(player_guess, dungeon, player, floor_1.TILE_SIZE)

    if solved:
        text.extend(maze_funcs.interact(dungeon, player))
        store_data(dungeon, player)
        return flask.render_template('levels/test_level.html', im_path=maze_funcs.get_image_path(), text=text)
    else:
        tile = maze_funcs.get_current_tile(dungeon, player)
        letter_tiles = [f'static/img/letters/{letter.upper()}.png' for letter in tile.creature.game.scrambled]
        store_data(dungeon, player)

        return flask.render_template('mini_games/word_scramble.html', im_path=maze_funcs.get_image_path(), text=text,
                                     letter_tiles=letter_tiles)
Exemple #5
0
def initialize():
    dungeon_map, player_pos, start_pos_arr, goal_pos_arr, passphrases = make_map(
    )

    im_path = maze_funcs.get_image_path()
    maze_funcs.make_black_map(dungeon_map[0], im_path, TILE_SIZE)

    # Create the player
    player = Player(player_pos)

    # Create the dungeon
    dungeon = Dungeon(player, goal_pos_arr, start_pos_arr, passphrases,
                      dungeon_map)

    # Draw the player's starting room
    maze_funcs.draw_current_tile(dungeon.map, player, im_path, TILE_SIZE)

    return dungeon, player
Exemple #6
0
def spooktober_level_post():
    command = request.form['command'].strip().lower()
    dungeon, player = retrieve_data()

    if maze_funcs.start_mini_game(command, dungeon, player):
        tile = maze_funcs.get_current_tile(dungeon, player)
        if tile.creature.name == 'Thor':
            letter_tiles = [
                f'static/img/letters/{letter.upper()}.png'
                for letter in tile.creature.game.scrambled
            ]
            store_data(dungeon, player)
            return render_template('mini_games/word_scramble.html',
                                   text=maze_funcs.mini_game_text(
                                       dungeon, player),
                                   letter_tiles=letter_tiles)
        elif tile.creature.name == 'Audumbla':
            store_data(dungeon, player)
            return render_template('mini_games/bull_cow_game.html',
                                   text=maze_funcs.mini_game_text(
                                       dungeon, player))
        else:
            raise ValueError(
                "Trying to load mini game for an invalid creature.")

    text = maze_funcs.make_action(command, dungeon, player,
                                  spooktober_floor.TILE_SIZE)
    if maze_funcs.check_win(dungeon, player):
        store_data(dungeon, player)
        return render_template('main/spooktober_end.html')

    text.extend(maze_funcs.interact(dungeon, player))
    store_data(dungeon, player)

    return render_template('levels/spooktober_level.html',
                           im_path=maze_funcs.get_image_path(),
                           text=text)
Exemple #7
0
def test_level():
    dungeon, player = floor_1.initialize()
    store_data(dungeon, player)
    return render_template('levels/test_level.html',
                           im_path=maze_funcs.get_image_path(),
                           text=maze_funcs.interact(dungeon, player))
Exemple #8
0
def bull_cow_game():
    return flask.render_template('mini_games/bull_cow_game.html', im_path=maze_funcs.get_image_path(),
                                 text=maze_funcs.game_text())