5. Building Objects with Variables

A wand, a golden snitch, and round black glasses. Even with only three objects to identify the character, you probably thought of Harry Potter. Let’s try this again: deerstalker hat, magnifying glass, and pipe. Sherlock Holmes, right? What about lightsaber, blaster, and droid? Luke Skywalker from Star Wars. Kryptonite, cape, and phone booth? Superman.

Objects define a character and give them a purpose. For example, in The Lion, the Witch, and the Wardrobe by C.S. Lewis, the character Edmund is associated with Turkish delight. Turkish delight would have been a luxury candy in 1940s London—difficult to obtain and enjoyed only by the very rich. With this simple object, the author conveys to the reader that Edmund ...

Get Writing Interactive Fiction with Twine now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.