January 2001
Beginner
312 pages
6h 4m
English
Let's work through an example that uses arrays to create an interactive story. You might be familiar with this type of “adlib” game in which the user is asked for a series of words—for example, adjectives, nouns, and so on. The user's answers are then inserted into a well-known piece of text to make a totally unique and hopefully amusing story. Here's how to create your own game:
1. |
Choose the story/rhyme/lyrics you want to use, pick out the words you want to replace, and give them each a unique variable name:
Once upon a entry1 dreary, while I pondered, entry2 and weary, Over many a entry3 and curious volume of entry4 lore-- While I entry5, nearly napping, entry6 there came a tapping, As of some one entry7 rapping, ... |
Read now
Unlock full access