Menu Block

Using this Block

In a game where players choose their path, you may have a menu block with from two to six choices, where each choice leads to a different part of the game. In these games, we strongly recommend an introductory visual novel block that sets up the story before the menu page.

Making it your own

What’s in the block

Like every block, the menu block has two files in the folder:

  • An HTML file: menu.html . You should not have to change anything in this file.
  • A config file: menu_config.js – This is where you will make any changes to create your unique game.

As with most blocks, it also has an images folder. Any images used specifically in this block will be saved here.

The config file

In the menu_config.js file you’ll see two sections. As with all blocks, there is an options object. Unlike almost every other block the options here do NOT have a completionURL to go to when you finish with the block, because clicking on each of the menu items sends you to a different part of the game. There is no one path.

const options = {
    title: "Make a choice", // If this is present, a title is shown at the top of the screen.
    bkImage: "./images/menu_background.jpg", // Background image for title
};

title : This is optional and you can see the example image above does not have a title. Enter just plain text. The title will be shown in large font, centered in the middle of the screen.

bkImage : This is the url for the background image for the menu.

The menu items

The menu can have up to two rows and each row can have up to three items. Thus, menus can have from two to six options. (A page with only one option to move on to another part of the game would be a level up page, not a menu. There is a different block for that. )

For each menu item, you’ll need text that will be read by a screen reader (the alt text value for an image) an image, and the url where you want the player to go in the game when they click on that menu item.

const menu_items = [
    // Row 1
    [
        {
           alt: "cavalry",
            imagePath: "images/cavalry_menu.png",
            url:  "../cavalry/gn.html"
        },
        {
            alt: "lakota",
            imagePath: "images/lakota_menu.png",
            url:  "../cavalry/gn.html"
        },
        {
            alt: "railroad",
            imagePath: "images/railroad_menu.png",
            url:  "../railroad/gn.html"
        },

    ],
    // Row 2
    [
        {
            alt: "settlers",
            imagePath: "images/settlers_menu.png",
            url:  "../cavalry/gn.html"
        },
        {
            alt: "shoshone",
            imagePath: "images/shoshone_menu.png",
            url:  "../cavalry/gn.html"
        }
    ] // End Row 2
];

alt : This is the word or words that will be read by screen reader software (alternative text), describing the image for this menu item. It will not show on the screen but can be useful for players with disabilities.

imagePath: location of the image for this box. For ideal results, we recommend images of 500 x 360 pixels.

url: Where clicking on this menu item will take the player.

Design Tips

  • If you only want three options, delete everything from the line with Row 2, to the End Row 2 line.
  • If you want four boxes, we recommend deleting the third box from the first row. A layout of 2 x 2 looks better than 3 and 1.
  • The images above have short titles describing where this choice leads. Whether you include words or not on the image is optional. We’ve done it both ways but many teachers prefer labeled items over images alone.

Similar Posts

  • Splash Block

    Every game needs to start with a splash screen. The only requirements for the Blocks user (you!) to provide are your game title, an image for the splash screen and the link for the start of your game. Your splash screen will have an image, the title of your game and a play button. When the player clicks on the play button, they’re taken to the beginning of your game. Optionally, a sound can play as the splash screen fades out and the first screen fades in.

  • Caves and Trees: Math

    This is a combination game and assessment block. You might also consider it practice or instruction. All the things! The player rolls a die to advance through the game. Caves send the player back, trees can be climbed to the next row. If a player lands on one type of square, they must answer a problem to advance. A second type of square asks a harder problem but the player advances twice as far.

  • Drag and Drop

    This block, in the drag_and_drop folder, has two areas. The top area consists of two images. The bottom area shows four items, which may be images or text. The object is to drag and drop all of the items to the correct area before time runs out.

Leave a Reply

Your email address will not be published. Required fields are marked *