Interactive Fiction _12 – Images

Set Up

A wonderful addition to a text adventure is to include images as part of the experience for the player.  In order to do this you need to:

  1. Change the Story File Format to Glulx.  Do this by clicking on the “Settings” tab and selecting Glulx.
  2. Play the story at least once, and then create a new folder named “Figures” inside the “Materials” folder that is created in the save location for the story.  This is the folder that you place all your images for the project.

*** Note: Keep you images the same size and around 600px wide by 480px tall. Or smaller.***

Images Placed in Play

The easiest way to have images is to have ones that just appear in the game play window.  For this example, I have an image file named green_field.jpg and it is placed in the Figures folder I created in the Materials folder.  I also have a dungeon.jpg image in the Figures folder.

Field is a room. “This is a large open field”.
Figure field-illustration is the file “green_field.jpg”.

Before looking in the Field:
    display figure field-illustration.
Dungeon is a room. “This is a dungeon”.  It is south of the Field.
Figure dungeon-illustration is the file “dungeon.jpg”.

Before going to the Dungeon:
    display figure dungeon-illustration.

Note: The dungeon image will display every time the player goes to the dungeon.  However, the field image will only be displayed when the player “looks”.

Changing Images in a Fixed Window

A more controlled way to display images is to use a couple extensions by Emily Short.  This keeps the image in the same location and just changes the image as the player works through the story.  For this example I have an image file named White_House.png and an image file named tunnel.jpg in the Figures folder that I created in the Materials folder.  I also have an image of an object; the jewel encrusted egg.

Include Location Images by Emily Short.
Include Simple Graphical Window by Emily Short.

Figure of Boarded White House is the file “White_House.png”.
Figure of Tunnel is the file “tunnel.jpg”.

The backyard is a room. “ You are standing behind the boarded white house.” The room illustration is Figure of Boarded White House.

The Tunnel is west of the backyard. The room illustration is Figure of Tunnel.

The Jewel Encrusted Egg is in the Tunnel.  The description of the Jewel Encrusted Egg is “A fine porcelain egg with silver accents and mounted jewels.”.

Carry out examining Jewel Encrusted Egg:
        change currently shown picture to the Figure of Jewel Encrusted Egg;
        follow the current graphics drawing rule.

** Look carefully at the code and see how different it is to display an image of an object compared to a room.**

You can download the extensions and read the documentation for lots of other features by following the links for each extension listed below:

Simple Graphical Window –

Location Images –